Merge lp:~azzar1/unity/fix-lp-1308911 into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 3817
Proposed branch: lp:~azzar1/unity/fix-lp-1308911
Merge into: lp:unity
Diff against target: 53 lines (+10/-0)
3 files modified
lockscreen/UserPromptView.cpp (+1/-0)
unity-shared/IMTextEntry.cpp (+7/-0)
unity-shared/IMTextEntry.h (+2/-0)
To merge this branch: bzr merge lp:~azzar1/unity/fix-lp-1308911
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
PS Jenkins bot (community) continuous-integration Approve
Brandon Schaefer (community) Approve
Review via email: mp+219877@code.launchpad.net

Commit message

Clear the clipboard when locking the screen.

Description of the change

== Problem ==
Clipboard contents are accessible within lockscreen.

== Fix ==
Clear the clipboard when locking the screen.

== Test ==
TestLockScreenController.LockScreenClearsClipboard added.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

LGTM

review: Approve
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Mh, I think that this would cause a regression where the clipboard is not restored once unlocked.

So imho, we should save the clipboard and restore it once unlocked (the best would be even saving the contents inside a file in the runtime dir, and restoring it from that in case of crash, but this is lower prio).

review: Needs Fixing
Revision history for this message
Andrea Azzarone (azzar1) wrote :

> Mh, I think that this would cause a regression where the clipboard is not
> restored once unlocked.
>
> So imho, we should save the clipboard and restore it once unlocked (the best
> would be even saving the contents inside a file in the runtime dir, and
> restoring it from that in case of crash, but this is lower prio).

Actually that's the way g-s works so we cannot consider it a regression. At this point clearing the clipboard does not make sense, we can just disable copy-paste for the text-entry.

Revision history for this message
Andrea Azzarone (azzar1) wrote :

Branch updated.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrea Azzarone (azzar1) wrote :

Branch updated!!

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Cool!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lockscreen/UserPromptView.cpp'
2--- lockscreen/UserPromptView.cpp 2014-04-25 21:58:08 +0000
3+++ lockscreen/UserPromptView.cpp 2014-05-26 14:59:14 +0000
4@@ -333,6 +333,7 @@
5 text_entry->SetPasswordMode(!visible);
6 text_entry->SetPasswordChar("•");
7 text_entry->SetToggleCursorVisibilityOnKeyFocus(true);
8+ text_entry->clipboard_enabled = false;
9
10 text_entry->key_up.connect(sigc::mem_fun(this, &UserPromptView::RecvKeyUp));
11
12
13=== modified file 'unity-shared/IMTextEntry.cpp'
14--- unity-shared/IMTextEntry.cpp 2014-03-05 03:48:27 +0000
15+++ unity-shared/IMTextEntry.cpp 2014-05-26 14:59:14 +0000
16@@ -27,10 +27,14 @@
17
18 IMTextEntry::IMTextEntry()
19 : TextEntry("", NUX_TRACKER_LOCATION)
20+ , clipboard_enabled(true)
21 {}
22
23 void IMTextEntry::CopyClipboard()
24 {
25+ if (!clipboard_enabled())
26+ return;
27+
28 int start, end;
29
30 if (GetSelectionBounds(&start, &end))
31@@ -52,6 +56,9 @@
32
33 void IMTextEntry::Paste(bool primary)
34 {
35+ if (!clipboard_enabled())
36+ return;
37+
38 GdkAtom origin = primary ? GDK_SELECTION_PRIMARY : GDK_SELECTION_CLIPBOARD;
39 GtkClipboard* clip = gtk_clipboard_get(origin);
40
41
42=== modified file 'unity-shared/IMTextEntry.h'
43--- unity-shared/IMTextEntry.h 2014-03-05 03:48:27 +0000
44+++ unity-shared/IMTextEntry.h 2014-05-26 14:59:14 +0000
45@@ -33,6 +33,8 @@
46 public:
47 IMTextEntry();
48
49+ nux::Property<bool> clipboard_enabled;
50+
51 bool im_preedit();
52
53 protected: