Merge lp:~cimi/overlay-scrollbar/fix.868739-take_1bis into lp:overlay-scrollbar

Proposed by Andrea Cimitan
Status: Rejected
Rejected by: Andrea Cimitan
Proposed branch: lp:~cimi/overlay-scrollbar/fix.868739-take_1bis
Merge into: lp:overlay-scrollbar
Diff against target: 73 lines (+12/-24)
1 file modified
os/os-scrollbar.c (+12/-24)
To merge this branch: bzr merge lp:~cimi/overlay-scrollbar/fix.868739-take_1bis
Reviewer Review Type Date Requested Status
Andrea Cimitan Disapprove
Ted Gould (community) Approve
Review via email: mp+79945@code.launchpad.net

Description of the change

Enhanced approach to https://code.launchpad.net/~cimi/ayatana-scrollbar/fix.868739-take_1
Stores the values only when showing the thumb for the first time. (Might fail if someone scrolls a scrolled window which contains the scrollbar while you're in the proximity area and you mapped the thumb)

To post a comment you must log in.
Revision history for this message
Ted Gould (ted) :
review: Approve
Revision history for this message
Andrea Cimitan (cimi) wrote :

I disapprove this and will take the original lp:~cimi/ayatana-scrollbar/fix.868739-take_1
Why? Because I think it's faster to simply write the variables to memory rather than calling the external function (which will do multiple checks on the widget then for its mapped state) AND evaluating the value. Also, should be safer on the weird case mentioned

review: Disapprove

Unmerged revisions

313. By Andrea Cimitan

Fix 868739

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'os/os-scrollbar.c'
2--- os/os-scrollbar.c 2011-10-12 17:12:29 +0000
3+++ os/os-scrollbar.c 2011-10-20 11:14:34 +0000
4@@ -291,23 +291,6 @@
5 }
6 }
7
8-/* Calculate the position of the thumb window. */
9-static void
10-calc_thumb_window_position (OsScrollbar *scrollbar)
11-{
12- OsScrollbarPrivate *priv;
13- gint x_pos, y_pos;
14-
15- priv = scrollbar->priv;
16-
17- /* In reality, I'm storing widget's window, not the toplevel.
18- * Is that the same with gdk_window_get_origin? */
19- gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x_pos, &y_pos);
20-
21- priv->thumb_win.x = x_pos + priv->thumb_all.x;
22- priv->thumb_win.y = y_pos + priv->thumb_all.y;
23-}
24-
25 /* Calculate the workarea using _UNITY_NET_WORKAREA_REGION. */
26 static void
27 calc_workarea (Display *display,
28@@ -2159,8 +2142,6 @@
29 calc_layout_bar (scrollbar, gtk_adjustment_get_value (priv->adjustment));
30 calc_layout_slider (scrollbar, gtk_adjustment_get_value (priv->adjustment));
31
32- calc_thumb_window_position (scrollbar);
33-
34 return FALSE;
35 }
36
37@@ -2179,6 +2160,18 @@
38
39 gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x_pos, &y_pos);
40
41+ if (!gtk_widget_get_mapped (priv->thumb))
42+ {
43+ /* Calculate priv->thumb_win.x and priv->thumb_win.y
44+ * (thumb window allocation in root coordinates).
45+ * I guess it's faster to store these values,
46+ * instead calling everytime gdk_window_get_origin (),
47+ * because it requires less calls than Gdk, which, in fact,
48+ * loops through multiple functions to return them. */
49+ priv->thumb_win.x = x_pos + priv->thumb_all.x;
50+ priv->thumb_win.y = y_pos + priv->thumb_all.y;
51+ }
52+
53 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
54 {
55 x = priv->thumb_all.x;
56@@ -3058,8 +3051,6 @@
57 calc_layout_bar (scrollbar, gtk_adjustment_get_value (priv->adjustment));
58
59 os_bar_set_parent (priv->bar, widget);
60-
61- calc_thumb_window_position (scrollbar);
62 }
63
64 static void
65@@ -3190,9 +3181,6 @@
66
67 move_bar (scrollbar);
68
69- if (gtk_widget_get_realized (widget))
70- calc_thumb_window_position (scrollbar);
71-
72 gtk_widget_set_allocation (widget, allocation);
73 }
74

Subscribers

People subscribed via source and target branches