Merge lp:~cimi/overlay-scrollbar/fix-752836 into lp:overlay-scrollbar

Proposed by Andrea Cimitan
Status: Merged
Approved by: Ted Gould
Approved revision: 201
Merged at revision: 200
Proposed branch: lp:~cimi/overlay-scrollbar/fix-752836
Merge into: lp:overlay-scrollbar
Diff against target: 69 lines (+37/-4)
1 file modified
os/os-scrollbar.c (+37/-4)
To merge this branch: bzr merge lp:~cimi/overlay-scrollbar/fix-752836
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+56754@code.launchpad.net

Description of the change

The solution is clearly explained in the comments within the code

To post a comment you must log in.
201. By Andrea Cimitan

fixed comment typi

Revision history for this message
Ted Gould (ted) wrote :

You don't need the 'found' variable. You can just check to see if parent is equal to NULL.

review: Approve
202. By Andrea Cimitan

Removed gboolean found as ted suggested

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-04-06 10:54:14 +0000
+++ os/os-scrollbar.c 2011-04-07 13:37:38 +0000
@@ -1144,14 +1144,41 @@
1144{1144{
1145 OsScrollbar *scrollbar;1145 OsScrollbar *scrollbar;
1146 OsScrollbarPrivate *priv;1146 OsScrollbarPrivate *priv;
1147 gint x, y;
11481147
1149 scrollbar = OS_SCROLLBAR (user_data);1148 scrollbar = OS_SCROLLBAR (user_data);
1150 priv = scrollbar->priv;1149 priv = scrollbar->priv;
11511150
1152 gtk_widget_get_pointer (widget, &x, &y);1151 /* if the widget is mapped see if the mouse pointer
11531152 * is over this window, if TRUE,
1154 pager_set_state_from_pointer (scrollbar, x, y);1153 * proceed with pager_set_state_from_pointer. */
1154 if (gtk_widget_get_mapped (GTK_WIDGET (scrollbar)))
1155 {
1156 GdkWindow *parent;
1157
1158 /* loop through parent windows until it reaches
1159 * either an unknown GdkWindow (NULL),
1160 * or the toplevel window. */
1161 parent = gdk_window_at_pointer (NULL, NULL);
1162 while (parent != NULL)
1163 {
1164 if (event->window == parent)
1165 break;
1166
1167 parent = gdk_window_get_parent (parent);
1168 }
1169
1170 if (parent != NULL)
1171 {
1172 gint x, y;
1173
1174 gtk_widget_get_pointer (widget, &x, &y);
1175
1176 /* when the window is resized (maximize/restore),
1177 * check the position of the pointer
1178 * and set the state accordingly. */
1179 pager_set_state_from_pointer (scrollbar, x, y);
1180 }
1181 }
11551182
1156 if (!priv->enter_notify_event)1183 if (!priv->enter_notify_event)
1157 gtk_widget_hide (GTK_WIDGET (priv->thumb));1184 gtk_widget_hide (GTK_WIDGET (priv->thumb));
@@ -1191,6 +1218,8 @@
1191 /* get the motion_notify_event trough XEvent */1218 /* get the motion_notify_event trough XEvent */
1192 if (xevent->type == MotionNotify)1219 if (xevent->type == MotionNotify)
1193 {1220 {
1221 /* react to motion_notify_event
1222 * and set the state accordingly. */
1194 pager_set_state_from_pointer (scrollbar, xevent->xmotion.x, xevent->xmotion.y);1223 pager_set_state_from_pointer (scrollbar, xevent->xmotion.x, xevent->xmotion.y);
11951224
1196 /* proximity area */1225 /* proximity area */
@@ -1462,6 +1491,10 @@
14621491
1463 gtk_widget_get_pointer (gtk_widget_get_toplevel (widget), &x, &y);1492 gtk_widget_get_pointer (gtk_widget_get_toplevel (widget), &x, &y);
14641493
1494 /* when the scrollbar appears on screen (mapped),
1495 * for example when switching notebook page,
1496 * check the position of the pointer
1497 * and set the state accordingly. */
1465 pager_set_state_from_pointer (scrollbar, x, y);1498 pager_set_state_from_pointer (scrollbar, x, y);
14661499
1467 if (priv->fullsize == FALSE)1500 if (priv->fullsize == FALSE)

Subscribers

People subscribed via source and target branches