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
=== modified file 'os/os-scrollbar.c'
--- os/os-scrollbar.c 2011-10-12 17:12:29 +0000
+++ os/os-scrollbar.c 2011-10-20 11:14:34 +0000
@@ -291,23 +291,6 @@
291 }291 }
292}292}
293293
294/* Calculate the position of the thumb window. */
295static void
296calc_thumb_window_position (OsScrollbar *scrollbar)
297{
298 OsScrollbarPrivate *priv;
299 gint x_pos, y_pos;
300
301 priv = scrollbar->priv;
302
303 /* In reality, I'm storing widget's window, not the toplevel.
304 * Is that the same with gdk_window_get_origin? */
305 gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x_pos, &y_pos);
306
307 priv->thumb_win.x = x_pos + priv->thumb_all.x;
308 priv->thumb_win.y = y_pos + priv->thumb_all.y;
309}
310
311/* Calculate the workarea using _UNITY_NET_WORKAREA_REGION. */294/* Calculate the workarea using _UNITY_NET_WORKAREA_REGION. */
312static void295static void
313calc_workarea (Display *display,296calc_workarea (Display *display,
@@ -2159,8 +2142,6 @@
2159 calc_layout_bar (scrollbar, gtk_adjustment_get_value (priv->adjustment));2142 calc_layout_bar (scrollbar, gtk_adjustment_get_value (priv->adjustment));
2160 calc_layout_slider (scrollbar, gtk_adjustment_get_value (priv->adjustment));2143 calc_layout_slider (scrollbar, gtk_adjustment_get_value (priv->adjustment));
21612144
2162 calc_thumb_window_position (scrollbar);
2163
2164 return FALSE;2145 return FALSE;
2165}2146}
21662147
@@ -2179,6 +2160,18 @@
21792160
2180 gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x_pos, &y_pos);2161 gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (scrollbar)), &x_pos, &y_pos);
21812162
2163 if (!gtk_widget_get_mapped (priv->thumb))
2164 {
2165 /* Calculate priv->thumb_win.x and priv->thumb_win.y
2166 * (thumb window allocation in root coordinates).
2167 * I guess it's faster to store these values,
2168 * instead calling everytime gdk_window_get_origin (),
2169 * because it requires less calls than Gdk, which, in fact,
2170 * loops through multiple functions to return them. */
2171 priv->thumb_win.x = x_pos + priv->thumb_all.x;
2172 priv->thumb_win.y = y_pos + priv->thumb_all.y;
2173 }
2174
2182 if (priv->orientation == GTK_ORIENTATION_VERTICAL)2175 if (priv->orientation == GTK_ORIENTATION_VERTICAL)
2183 {2176 {
2184 x = priv->thumb_all.x;2177 x = priv->thumb_all.x;
@@ -3058,8 +3051,6 @@
3058 calc_layout_bar (scrollbar, gtk_adjustment_get_value (priv->adjustment));3051 calc_layout_bar (scrollbar, gtk_adjustment_get_value (priv->adjustment));
30593052
3060 os_bar_set_parent (priv->bar, widget);3053 os_bar_set_parent (priv->bar, widget);
3061
3062 calc_thumb_window_position (scrollbar);
3063}3054}
30643055
3065static void3056static void
@@ -3190,9 +3181,6 @@
31903181
3191 move_bar (scrollbar);3182 move_bar (scrollbar);
31923183
3193 if (gtk_widget_get_realized (widget))
3194 calc_thumb_window_position (scrollbar);
3195
3196 gtk_widget_set_allocation (widget, allocation);3184 gtk_widget_set_allocation (widget, allocation);
3197}3185}
31983186

Subscribers

People subscribed via source and target branches