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
1=== modified file 'os/os-scrollbar.c'
2--- os/os-scrollbar.c 2011-04-06 10:54:14 +0000
3+++ os/os-scrollbar.c 2011-04-07 13:37:38 +0000
4@@ -1144,14 +1144,41 @@
5 {
6 OsScrollbar *scrollbar;
7 OsScrollbarPrivate *priv;
8- gint x, y;
9
10 scrollbar = OS_SCROLLBAR (user_data);
11 priv = scrollbar->priv;
12
13- gtk_widget_get_pointer (widget, &x, &y);
14-
15- pager_set_state_from_pointer (scrollbar, x, y);
16+ /* if the widget is mapped see if the mouse pointer
17+ * is over this window, if TRUE,
18+ * proceed with pager_set_state_from_pointer. */
19+ if (gtk_widget_get_mapped (GTK_WIDGET (scrollbar)))
20+ {
21+ GdkWindow *parent;
22+
23+ /* loop through parent windows until it reaches
24+ * either an unknown GdkWindow (NULL),
25+ * or the toplevel window. */
26+ parent = gdk_window_at_pointer (NULL, NULL);
27+ while (parent != NULL)
28+ {
29+ if (event->window == parent)
30+ break;
31+
32+ parent = gdk_window_get_parent (parent);
33+ }
34+
35+ if (parent != NULL)
36+ {
37+ gint x, y;
38+
39+ gtk_widget_get_pointer (widget, &x, &y);
40+
41+ /* when the window is resized (maximize/restore),
42+ * check the position of the pointer
43+ * and set the state accordingly. */
44+ pager_set_state_from_pointer (scrollbar, x, y);
45+ }
46+ }
47
48 if (!priv->enter_notify_event)
49 gtk_widget_hide (GTK_WIDGET (priv->thumb));
50@@ -1191,6 +1218,8 @@
51 /* get the motion_notify_event trough XEvent */
52 if (xevent->type == MotionNotify)
53 {
54+ /* react to motion_notify_event
55+ * and set the state accordingly. */
56 pager_set_state_from_pointer (scrollbar, xevent->xmotion.x, xevent->xmotion.y);
57
58 /* proximity area */
59@@ -1462,6 +1491,10 @@
60
61 gtk_widget_get_pointer (gtk_widget_get_toplevel (widget), &x, &y);
62
63+ /* when the scrollbar appears on screen (mapped),
64+ * for example when switching notebook page,
65+ * check the position of the pointer
66+ * and set the state accordingly. */
67 pager_set_state_from_pointer (scrollbar, x, y);
68
69 if (priv->fullsize == FALSE)

Subscribers

People subscribed via source and target branches