Merge lp:~mterry/unity-greeter/click-fixes into lp:unity-greeter

Proposed by Michael Terry
Status: Merged
Merged at revision: 275
Proposed branch: lp:~mterry/unity-greeter/click-fixes
Merge into: lp:unity-greeter
Diff against target: 77 lines (+12/-6)
1 file modified
src/user-list.vala (+12/-6)
To merge this branch: bzr merge lp:~mterry/unity-greeter/click-fixes
Reviewer Review Type Date Requested Status
Robert Ancell Approve
Review via email: mp+91197@code.launchpad.net

Description of the change

This branch fixes two things:

1) A long standing issue where clicks past the beginning or end of the user list will 'wrap around' the list despite the user having clicked on "thin air".

2) And restoring the click functionality at all after I broke it with the refactor. I forgot that GtkFixed is a non-input-window widget. So I added an EventBox to capture clicks.

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/user-list.vala'
2--- src/user-list.vala 2012-01-31 14:43:25 +0000
3+++ src/user-list.vala 2012-02-02 03:02:29 +0000
4@@ -46,7 +46,7 @@
5 public string session_name;
6 }
7
8-public class UserList : Gtk.Fixed
9+public class UserList : Gtk.EventBox
10 {
11 public Background background;
12 public MenuBar menubar;
13@@ -64,6 +64,7 @@
14 private string? error;
15 private string? message;
16
17+ private Gtk.Fixed fixed;
18 private Gtk.Box login_box;
19 private DashEntry prompt_entry;
20 private DashButton login_button;
21@@ -137,6 +138,11 @@
22 background = bg;
23 menubar = mb;
24 can_focus = false;
25+ visible_window = false;
26+
27+ fixed = new Gtk.Fixed ();
28+ fixed.show ();
29+ add (fixed);
30
31 login_box = new DashBox (background);
32 login_box.show ();
33@@ -217,7 +223,7 @@
34
35 private void add_with_class (Gtk.Widget widget)
36 {
37- add (widget);
38+ fixed.add (widget);
39 UnityGreeter.add_style_class (widget);
40 }
41
42@@ -517,7 +523,7 @@
43 public override void size_allocate (Gtk.Allocation allocation)
44 {
45 var resized = allocation.height != get_allocated_height () || allocation.width != get_allocated_width ();
46- set_allocation (allocation);
47+ base.size_allocate (allocation);
48
49 if (!get_realized ())
50 return;
51@@ -757,7 +763,7 @@
52 var x = event.x - box_x;
53 var y = event.y - box_y;
54
55- /* Total height of list */
56+ /* Total height of list */
57 var h = (double) entries.length () * grid_size;
58
59 var offset = 0.0;
60@@ -767,7 +773,7 @@
61
62 /* Check entry above the box */
63 var h_above = (double) n_above * grid_size;
64- if (y < 0 && y > -h_above)
65+ if (entry_y < 0 && y < 0 && y > -h_above)
66 {
67 if (inside_entry (x, y, entry_y, entry) ||
68 inside_entry (x, y, entry_y - h, entry))
69@@ -780,7 +786,7 @@
70 /* Check entry below the box */
71 var below_y = y - box_height * grid_size;
72 var h_below = (double) n_below * grid_size;
73- if (below_y > 0 && below_y < h_below)
74+ if (entry_y > 0 && below_y > 0 && below_y < h_below)
75 {
76 if (inside_entry (x, below_y, entry_y - grid_size, entry) ||
77 inside_entry (x, below_y, entry_y - grid_size + h, entry))

Subscribers

People subscribed via source and target branches