Merge lp:~cimi/overlay-scrollbar/fix-754736-glist into lp:overlay-scrollbar
- fix-754736-glist
- Merge into trunk
Proposed by
Andrea Cimitan
Status: | Merged |
---|---|
Merged at revision: | 209 |
Proposed branch: | lp:~cimi/overlay-scrollbar/fix-754736-glist |
Merge into: | lp:overlay-scrollbar |
Diff against target: |
555 lines (+287/-75) 2 files modified
os/os-pager.c (+30/-8) os/os-scrollbar.c (+257/-67) |
To merge this branch: | bzr merge lp:~cimi/overlay-scrollbar/fix-754736-glist |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrea Cimitan | Approve | ||
Review via email:
|
Commit message
Description of the change
same as lp:~cimi/ayatana-scrollbar/fix-754736 but using glist
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Andrea Cimitan (cimi) wrote : | # |
- 223. By Andrea Cimitan
-
changed the dispose event a bit, stop deactivate_pager on map event of an active window
- 224. By Andrea Cimitan
-
few fixes in dospose, pass NULL as pointer to the root_filter_func
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Andrea Cimitan (cimi) wrote : | # |
ted approved that in irc :-)
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'os/os-pager.c' |
2 | --- os/os-pager.c 2011-04-08 21:08:32 +0000 |
3 | +++ os/os-pager.c 2011-04-13 13:35:59 +0000 |
4 | @@ -128,6 +128,9 @@ |
5 | |
6 | priv->weight = weight; |
7 | |
8 | + if (priv->parent == NULL) |
9 | + return; |
10 | + |
11 | os_pager_draw (pager); |
12 | } |
13 | |
14 | @@ -196,8 +199,10 @@ |
15 | pager = OS_PAGER (user_data); |
16 | priv = pager->priv; |
17 | |
18 | - if (priv->parent != NULL && priv->pager_window != NULL) |
19 | - os_pager_draw (pager); |
20 | + if (priv->parent == NULL || priv->pager_window == NULL) |
21 | + return; |
22 | + |
23 | + os_pager_draw (pager); |
24 | } |
25 | |
26 | /* Type definition. */ |
27 | @@ -330,6 +335,9 @@ |
28 | if (priv->parent == NULL) |
29 | return; |
30 | |
31 | + /* if there's an animation currently running, stop it. */ |
32 | + os_animation_stop (priv->animation); |
33 | + |
34 | gdk_window_hide (priv->pager_window); |
35 | } |
36 | |
37 | @@ -385,12 +393,22 @@ |
38 | if (priv->parent == NULL) |
39 | return; |
40 | |
41 | - os_animation_stop (priv->animation); |
42 | - |
43 | - os_animation_set_duration (priv->animation, priv->active ? DURATION_FADE_IN : |
44 | - DURATION_FADE_OUT); |
45 | - |
46 | - os_animation_start (priv->animation); |
47 | + /* only start the animation if the pager is visible. */ |
48 | + if (gdk_window_is_visible (priv->pager_window)) |
49 | + { |
50 | + os_animation_stop (priv->animation); |
51 | + |
52 | + os_animation_set_duration (priv->animation, priv->active ? DURATION_FADE_IN : |
53 | + DURATION_FADE_OUT); |
54 | + |
55 | + os_animation_start (priv->animation); |
56 | + } |
57 | + else |
58 | + { |
59 | + priv->weight = 1.0f; |
60 | + |
61 | + os_pager_draw (pager); |
62 | + } |
63 | } |
64 | } |
65 | |
66 | @@ -411,6 +429,10 @@ |
67 | |
68 | priv = pager->priv; |
69 | |
70 | + /* stop currently running animation. */ |
71 | + if (priv->animation != NULL) |
72 | + os_animation_stop (priv->animation); |
73 | + |
74 | if (priv->parent != NULL) |
75 | { |
76 | g_object_unref (priv->parent); |
77 | |
78 | === modified file 'os/os-scrollbar.c' |
79 | --- os/os-scrollbar.c 2011-04-11 14:04:33 +0000 |
80 | +++ os/os-scrollbar.c 2011-04-13 13:35:59 +0000 |
81 | @@ -35,6 +35,9 @@ |
82 | /* Width of the proximity effect in pixels. */ |
83 | #define PROXIMITY_WIDTH 30 |
84 | |
85 | +/* Timeout assumed for PropertyNotify _NET_ACTIVE_WINDOW event. */ |
86 | +#define TIMEOUT_PRESENT_WINDOW 400 |
87 | + |
88 | /* Timeout before hiding in ms, after leaving the thumb. */ |
89 | #define TIMEOUT_THUMB_HIDE 1000 |
90 | |
91 | @@ -56,6 +59,7 @@ |
92 | gboolean enter_notify_event; |
93 | gboolean motion_notify_event; |
94 | gboolean value_changed_event; |
95 | + gboolean active_window; |
96 | gboolean can_deactivate_pager; |
97 | gboolean can_hide; |
98 | gboolean filter; |
99 | @@ -69,11 +73,15 @@ |
100 | gint slide_initial_coordinate; |
101 | gint pointer_x; |
102 | gint pointer_y; |
103 | + gint64 present_time; |
104 | guint32 source_deactivate_pager_id; |
105 | guint32 source_hide_thumb_id; |
106 | guint32 source_unlock_thumb_id; |
107 | }; |
108 | |
109 | +static Atom net_active_window_atom = None; |
110 | +static GList *os_root_list = NULL; |
111 | + |
112 | static gboolean os_scrollbar_expose_event (GtkWidget *widget, GdkEventExpose *event); |
113 | static void os_scrollbar_grab_notify (GtkWidget *widget, gboolean was_grabbed); |
114 | static void os_scrollbar_hide (GtkWidget *widget); |
115 | @@ -115,6 +123,8 @@ |
116 | static void pager_set_state_from_pointer (OsScrollbar *scrollbar, gint x, gint y); |
117 | static void adjustment_changed_cb (GtkAdjustment *adjustment, gpointer user_data); |
118 | static void adjustment_value_changed_cb (GtkAdjustment *adjustment, gpointer user_data); |
119 | +static GdkFilterReturn root_filter_func (GdkXEvent *gdkxevent, GdkEvent *event, gpointer user_data); |
120 | +static void root_gfunc (gpointer data, gpointer user_data); |
121 | static gboolean toplevel_configure_event_cb (GtkWidget *widget, GdkEventConfigure *event, gpointer user_data); |
122 | static GdkFilterReturn toplevel_filter_func (GdkXEvent *gdkxevent, GdkEvent *event, gpointer user_data); |
123 | static gboolean toplevel_leave_notify_event_cb (GtkWidget *widget, GdkEventCrossing *event, gpointer user_data); |
124 | @@ -365,6 +375,8 @@ |
125 | scrollbar = OS_SCROLLBAR (user_data); |
126 | priv = scrollbar->priv; |
127 | |
128 | + OS_DCHECK (!priv->active_window); |
129 | + |
130 | os_scrollbar_deactivate_pager (scrollbar); |
131 | priv->source_deactivate_pager_id = 0; |
132 | |
133 | @@ -698,7 +710,10 @@ |
134 | scrollbar = OS_SCROLLBAR (user_data); |
135 | priv = scrollbar->priv; |
136 | |
137 | - gtk_window_set_transient_for (GTK_WINDOW (widget), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (scrollbar)))); |
138 | + gtk_window_set_transient_for (GTK_WINDOW (widget), |
139 | + GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (scrollbar)))); |
140 | + |
141 | + priv->present_time = g_get_monotonic_time (); |
142 | os_present_gdk_window_with_timestamp (GTK_WIDGET (scrollbar), event->time); |
143 | |
144 | priv->button_press_event = TRUE; |
145 | @@ -800,26 +815,33 @@ |
146 | scrollbar = OS_SCROLLBAR (user_data); |
147 | priv = scrollbar->priv; |
148 | |
149 | + /* add the timeouts only if you are |
150 | + * not interacting with the thumb. */ |
151 | if (!priv->button_press_event) |
152 | { |
153 | - priv->can_deactivate_pager = TRUE; |
154 | + /* never deactivate the pager in an active window. */ |
155 | + if (!priv->active_window) |
156 | + { |
157 | + priv->can_deactivate_pager = TRUE; |
158 | + |
159 | + if (priv->source_deactivate_pager_id != 0) |
160 | + g_source_remove (priv->source_deactivate_pager_id); |
161 | + |
162 | + priv->source_deactivate_pager_id = g_timeout_add (TIMEOUT_THUMB_HIDE, |
163 | + os_scrollbar_deactivate_pager_cb, |
164 | + scrollbar); |
165 | + } |
166 | + |
167 | priv->can_hide = TRUE; |
168 | + |
169 | + if (priv->source_hide_thumb_id != 0) |
170 | + g_source_remove (priv->source_hide_thumb_id); |
171 | + |
172 | + priv->source_hide_thumb_id = g_timeout_add (TIMEOUT_THUMB_HIDE, |
173 | + os_scrollbar_hide_thumb_cb, |
174 | + scrollbar); |
175 | } |
176 | |
177 | - if (priv->source_deactivate_pager_id != 0) |
178 | - g_source_remove (priv->source_deactivate_pager_id); |
179 | - |
180 | - priv->source_deactivate_pager_id = g_timeout_add (TIMEOUT_THUMB_HIDE, |
181 | - os_scrollbar_deactivate_pager_cb, |
182 | - scrollbar); |
183 | - |
184 | - if (priv->source_hide_thumb_id != 0) |
185 | - g_source_remove (priv->source_hide_thumb_id); |
186 | - |
187 | - priv->source_hide_thumb_id = g_timeout_add (TIMEOUT_THUMB_HIDE, |
188 | - os_scrollbar_hide_thumb_cb, |
189 | - scrollbar); |
190 | - |
191 | return FALSE; |
192 | } |
193 | |
194 | @@ -838,7 +860,7 @@ |
195 | scrollbar = OS_SCROLLBAR (user_data); |
196 | priv = scrollbar->priv; |
197 | |
198 | - xid = GDK_WINDOW_XID (gtk_widget_get_window (priv->thumb)); |
199 | + xid = GDK_WINDOW_XID (gtk_widget_get_window (widget)); |
200 | xid_parent = GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (scrollbar))); |
201 | display = GDK_WINDOW_XDISPLAY (gtk_widget_get_window (GTK_WIDGET (scrollbar))); |
202 | |
203 | @@ -1065,6 +1087,8 @@ |
204 | |
205 | priv = scrollbar->priv; |
206 | |
207 | + OS_DCHECK (!priv->active_window); |
208 | + |
209 | gtk_widget_get_allocation (gtk_widget_get_parent (GTK_WIDGET (scrollbar)), &allocation); |
210 | |
211 | if ((x > allocation.x && x < allocation.x + allocation.width) && |
212 | @@ -1076,7 +1100,7 @@ |
213 | else |
214 | { |
215 | priv->can_deactivate_pager = TRUE; |
216 | - os_scrollbar_deactivate_pager (scrollbar); |
217 | + os_pager_set_active (OS_PAGER (priv->pager), FALSE); |
218 | } |
219 | } |
220 | |
221 | @@ -1141,50 +1165,152 @@ |
222 | pager_move (scrollbar); |
223 | } |
224 | |
225 | +static GdkFilterReturn |
226 | +root_filter_func (GdkXEvent *gdkxevent, |
227 | + GdkEvent *event, |
228 | + gpointer user_data) |
229 | +{ |
230 | + XEvent* xevent; |
231 | + |
232 | + xevent = gdkxevent; |
233 | + |
234 | + if (xevent->xany.type == PropertyNotify && |
235 | + xevent->xproperty.atom == net_active_window_atom) |
236 | + { |
237 | + g_list_foreach (os_root_list, root_gfunc, NULL); |
238 | + } |
239 | + |
240 | + return GDK_FILTER_CONTINUE; |
241 | +} |
242 | + |
243 | +static void |
244 | +root_gfunc (gpointer data, |
245 | + gpointer user_data) |
246 | +{ |
247 | + OsScrollbar *scrollbar; |
248 | + OsScrollbarPrivate *priv; |
249 | + |
250 | + scrollbar = OS_SCROLLBAR (data); |
251 | + priv = scrollbar->priv; |
252 | + |
253 | + OS_DCHECK (scrollbar != NULL); |
254 | + |
255 | + if (gtk_widget_get_mapped (GTK_WIDGET (scrollbar))) |
256 | + { |
257 | + if (gtk_widget_get_window (GTK_WIDGET (scrollbar)) == |
258 | + gdk_screen_get_active_window (gtk_widget_get_screen (GTK_WIDGET (scrollbar)))) |
259 | + { |
260 | + /* stops potential running timeout. */ |
261 | + if (priv->source_deactivate_pager_id != 0) |
262 | + { |
263 | + g_source_remove (priv->source_deactivate_pager_id); |
264 | + priv->source_deactivate_pager_id = 0; |
265 | + } |
266 | + |
267 | + priv->active_window = TRUE; |
268 | + |
269 | + priv->can_deactivate_pager = FALSE; |
270 | + os_pager_set_active (OS_PAGER (priv->pager), TRUE); |
271 | + } |
272 | + else if (priv->active_window) |
273 | + { |
274 | + GdkWindow *parent; |
275 | + GdkWindow *window; |
276 | + const gint64 current_time = g_get_monotonic_time (); |
277 | + const gint64 end_time = priv->present_time + TIMEOUT_PRESENT_WINDOW * 1000; |
278 | + |
279 | + priv->active_window = FALSE; |
280 | + |
281 | + /* loop through parent windows until it reaches |
282 | + * either an unknown GdkWindow (NULL), |
283 | + * or the toplevel window. */ |
284 | + window = gtk_widget_get_window (GTK_WIDGET (scrollbar)); |
285 | + parent = gdk_window_at_pointer (NULL, NULL); |
286 | + while (parent != NULL) |
287 | + { |
288 | + if (window == parent) |
289 | + break; |
290 | + |
291 | + parent = gdk_window_get_parent (parent); |
292 | + } |
293 | + |
294 | + if (parent != NULL) |
295 | + { |
296 | + gint x, y; |
297 | + |
298 | + gdk_window_get_pointer (window, &x, &y, NULL); |
299 | + |
300 | + /* when the window is unfocused, |
301 | + * check the position of the pointer |
302 | + * and set the state accordingly. */ |
303 | + pager_set_state_from_pointer (scrollbar, x, y); |
304 | + } |
305 | + else |
306 | + { |
307 | + /* if the pointer is outside of the window, set it inactive. */ |
308 | + priv->can_deactivate_pager = TRUE; |
309 | + os_pager_set_active (OS_PAGER (priv->pager), FALSE); |
310 | + } |
311 | + |
312 | + if ((current_time > end_time) && priv->thumb != NULL) |
313 | + gtk_widget_hide (priv->thumb); |
314 | + } |
315 | + } |
316 | +} |
317 | + |
318 | static gboolean |
319 | toplevel_configure_event_cb (GtkWidget *widget, |
320 | GdkEventConfigure *event, |
321 | gpointer user_data) |
322 | { |
323 | - OsScrollbar *scrollbar; |
324 | - OsScrollbarPrivate *priv; |
325 | - |
326 | - scrollbar = OS_SCROLLBAR (user_data); |
327 | - priv = scrollbar->priv; |
328 | - |
329 | - /* if the widget is mapped see if the mouse pointer |
330 | - * is over this window, if TRUE, |
331 | + OsScrollbar *scrollbar = OS_SCROLLBAR (user_data); |
332 | + OsScrollbarPrivate *priv = scrollbar->priv; |
333 | + const gint64 current_time = g_get_monotonic_time (); |
334 | + const gint64 end_time = priv->present_time + TIMEOUT_PRESENT_WINDOW * 1000; |
335 | + |
336 | + /* if the widget is mapped and the configure-event happens |
337 | + * after the PropertyNotify _NET_ACTIVE_WINDOW event, |
338 | + * see if the mouse pointer is over this window, if TRUE, |
339 | * proceed with pager_set_state_from_pointer. */ |
340 | - if (gtk_widget_get_mapped (GTK_WIDGET (scrollbar))) |
341 | + if ((current_time > end_time) && |
342 | + gtk_widget_get_mapped (GTK_WIDGET (scrollbar))) |
343 | { |
344 | - GdkWindow *parent; |
345 | - |
346 | - /* loop through parent windows until it reaches |
347 | - * either an unknown GdkWindow (NULL), |
348 | - * or the toplevel window. */ |
349 | - parent = gdk_window_at_pointer (NULL, NULL); |
350 | - while (parent != NULL) |
351 | + if (!priv->active_window) |
352 | { |
353 | - if (event->window == parent) |
354 | - break; |
355 | - |
356 | - parent = gdk_window_get_parent (parent); |
357 | + GdkWindow *parent; |
358 | + |
359 | + /* loop through parent windows until it reaches |
360 | + * either an unknown GdkWindow (NULL), |
361 | + * or the toplevel window. */ |
362 | + parent = gdk_window_at_pointer (NULL, NULL); |
363 | + while (parent != NULL) |
364 | + { |
365 | + if (event->window == parent) |
366 | + break; |
367 | + |
368 | + parent = gdk_window_get_parent (parent); |
369 | + } |
370 | + |
371 | + if (parent != NULL) |
372 | + { |
373 | + gint x, y; |
374 | + |
375 | + gtk_widget_get_pointer (widget, &x, &y); |
376 | + |
377 | + /* when the window is resized (maximize/restore), |
378 | + * check the position of the pointer |
379 | + * and set the state accordingly. */ |
380 | + pager_set_state_from_pointer (scrollbar, x, y); |
381 | + } |
382 | } |
383 | - |
384 | - if (parent != NULL) |
385 | + else |
386 | { |
387 | - gint x, y; |
388 | - |
389 | - gtk_widget_get_pointer (widget, &x, &y); |
390 | - |
391 | - /* when the window is resized (maximize/restore), |
392 | - * check the position of the pointer |
393 | - * and set the state accordingly. */ |
394 | - pager_set_state_from_pointer (scrollbar, x, y); |
395 | + priv->can_deactivate_pager = FALSE; |
396 | + os_pager_set_active (OS_PAGER (priv->pager), TRUE); |
397 | } |
398 | } |
399 | |
400 | - if (!priv->enter_notify_event) |
401 | + if (current_time > end_time) |
402 | gtk_widget_hide (GTK_WIDGET (priv->thumb)); |
403 | |
404 | priv->lock_position = FALSE; |
405 | @@ -1225,7 +1351,7 @@ |
406 | * this call checks the pointer after the scroll-event, |
407 | * since it enters the window, |
408 | * then sets the state accordingly. */ |
409 | - if (xevent->type == EnterNotify) |
410 | + if (!priv->active_window && xevent->type == EnterNotify) |
411 | pager_set_state_from_pointer (scrollbar, xevent->xcrossing.x, xevent->xcrossing.y); |
412 | |
413 | /* get the motion_notify_event trough XEvent */ |
414 | @@ -1233,7 +1359,8 @@ |
415 | { |
416 | /* react to motion_notify_event |
417 | * and set the state accordingly. */ |
418 | - pager_set_state_from_pointer (scrollbar, xevent->xmotion.x, xevent->xmotion.y); |
419 | + if (!priv->active_window) |
420 | + pager_set_state_from_pointer (scrollbar, xevent->xmotion.x, xevent->xmotion.y); |
421 | |
422 | /* proximity area */ |
423 | if (priv->orientation == GTK_ORIENTATION_VERTICAL) |
424 | @@ -1332,16 +1459,21 @@ |
425 | scrollbar = OS_SCROLLBAR (user_data); |
426 | priv = scrollbar->priv; |
427 | |
428 | - priv->can_deactivate_pager = TRUE; |
429 | + /* never deactivate the pager in an active window. */ |
430 | + if (!priv->active_window) |
431 | + { |
432 | + priv->can_deactivate_pager = TRUE; |
433 | + |
434 | + if (priv->source_deactivate_pager_id != 0) |
435 | + g_source_remove (priv->source_deactivate_pager_id); |
436 | + |
437 | + priv->source_deactivate_pager_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE, |
438 | + os_scrollbar_deactivate_pager_cb, |
439 | + scrollbar); |
440 | + } |
441 | + |
442 | priv->can_hide = TRUE; |
443 | |
444 | - if (priv->source_deactivate_pager_id != 0) |
445 | - g_source_remove (priv->source_deactivate_pager_id); |
446 | - |
447 | - priv->source_deactivate_pager_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE, |
448 | - os_scrollbar_deactivate_pager_cb, |
449 | - scrollbar); |
450 | - |
451 | if (priv->source_hide_thumb_id != 0) |
452 | g_source_remove (priv->source_hide_thumb_id); |
453 | |
454 | @@ -1398,6 +1530,31 @@ |
455 | OsScrollbarPrivate); |
456 | priv = scrollbar->priv; |
457 | |
458 | + priv->present_time = 0; |
459 | + |
460 | + if (os_root_list == NULL) |
461 | + { |
462 | + GdkWindow *root; |
463 | + |
464 | + /* used in the root_filter_func to match the right property. */ |
465 | + net_active_window_atom = gdk_x11_get_xatom_by_name ("_NET_ACTIVE_WINDOW"); |
466 | + |
467 | + /* append the object to the static linked list. */ |
468 | + os_root_list = g_list_append (os_root_list, scrollbar); |
469 | + |
470 | + /* apply the root_filter_func. */ |
471 | + root = gdk_get_default_root_window (); |
472 | + gdk_window_set_events (root, gdk_window_get_events (root) | |
473 | + GDK_PROPERTY_CHANGE_MASK); |
474 | + gdk_window_add_filter (root, root_filter_func, NULL); |
475 | + } |
476 | + else |
477 | + { |
478 | + /* append the object to the static linked list. */ |
479 | + os_root_list = g_list_append (os_root_list, scrollbar); |
480 | + } |
481 | + |
482 | + priv->active_window = FALSE; |
483 | priv->can_deactivate_pager = TRUE; |
484 | priv->can_hide = TRUE; |
485 | priv->filter = FALSE; |
486 | @@ -1445,6 +1602,12 @@ |
487 | priv->source_unlock_thumb_id = 0; |
488 | } |
489 | |
490 | + os_root_list = g_list_remove (os_root_list, scrollbar); |
491 | + |
492 | + if (os_root_list == NULL) |
493 | + gdk_window_remove_filter (gdk_get_default_root_window (), |
494 | + root_filter_func, NULL); |
495 | + |
496 | if (priv->pager != NULL) |
497 | { |
498 | g_object_unref (priv->pager); |
499 | @@ -1487,7 +1650,7 @@ |
500 | { |
501 | OsScrollbar *scrollbar; |
502 | OsScrollbarPrivate *priv; |
503 | - gint x, y; |
504 | + |
505 | |
506 | scrollbar = OS_SCROLLBAR (widget); |
507 | priv = scrollbar->priv; |
508 | @@ -1496,13 +1659,40 @@ |
509 | |
510 | priv->proximity = TRUE; |
511 | |
512 | - gtk_widget_get_pointer (gtk_widget_get_toplevel (widget), &x, &y); |
513 | - |
514 | - /* when the scrollbar appears on screen (mapped), |
515 | - * for example when switching notebook page, |
516 | - * check the position of the pointer |
517 | - * and set the state accordingly. */ |
518 | - pager_set_state_from_pointer (scrollbar, x, y); |
519 | + /* on map, check for the active window. */ |
520 | + if (gtk_widget_get_window (widget) == |
521 | + gdk_screen_get_active_window (gtk_widget_get_screen (widget))) |
522 | + { |
523 | + /* stops potential running timeout. */ |
524 | + if (priv->source_deactivate_pager_id != 0) |
525 | + { |
526 | + g_source_remove (priv->source_deactivate_pager_id); |
527 | + priv->source_deactivate_pager_id = 0; |
528 | + } |
529 | + |
530 | + priv->active_window = TRUE; |
531 | + } |
532 | + else |
533 | + priv->active_window = FALSE; |
534 | + |
535 | + if (!priv->active_window) |
536 | + { |
537 | + gint x, y; |
538 | + gtk_widget_get_pointer (gtk_widget_get_toplevel (widget), &x, &y); |
539 | + |
540 | + /* when the scrollbar appears on screen (mapped), |
541 | + * for example when switching notebook page, |
542 | + * check the position of the pointer |
543 | + * and set the state accordingly. */ |
544 | + pager_set_state_from_pointer (scrollbar, x, y); |
545 | + } |
546 | + else |
547 | + { |
548 | + /* on map-event of an active window, |
549 | + * the pager should be active. */ |
550 | + priv->can_deactivate_pager = FALSE; |
551 | + os_pager_set_active (OS_PAGER (priv->pager), TRUE); |
552 | + } |
553 | |
554 | if (priv->fullsize == FALSE) |
555 | os_pager_show (OS_PAGER (priv->pager)); |
initial diff against lp:~cimi/ayatana-scrollbar/fix-754736
=== modified file 'os/os-scrollbar.c'
--- os/os-scrollbar.c 2011-04-13 10:08:34 +0000
+++ os/os-scrollbar.c 2011-04-13 10:42:33 +0000
@@ -80,7 +80,7 @@
};
static Atom net_active_ window_ atom = None;
-static GHashTable *os_root_hash_table = NULL;
+static GList *os_root_list = NULL;
static gboolean os_scrollbar_ expose_ event (GtkWidget *widget, GdkEventExpose *event); grab_notify (GtkWidget *widget, gboolean was_grabbed); changed_ cb (GtkAdjustment *adjustment, gpointer user_data); value_changed_ cb (GtkAdjustment *adjustment, gpointer user_data); configure_ event_cb (GtkWidget *widget, GdkEventConfigure *event, gpointer user_data); filter_ func (GdkXEvent *gdkxevent, GdkEvent *event, gpointer user_data); leave_notify_ event_cb (GtkWidget *widget, GdkEventCrossing *event, gpointer user_data);
xevent- >xproperty. atom == net_active_ window_ atom) table_foreach (os_root_ hash_table, root_ghfunc, NULL);
static void os_scrollbar_
@@ -124,7 +124,7 @@
static void adjustment_
static void adjustment_
static GdkFilterReturn root_filter_func (GdkXEvent *gdkxevent, GdkEvent *event, gpointer user_data);
-static void root_ghfunc (gpointer key, gpointer value, gpointer user_data);
+static void root_gfunc (gpointer data, gpointer user_data);
static gboolean toplevel_
static GdkFilterReturn toplevel_
static gboolean toplevel_
@@ -1177,21 +1177,20 @@
if (xevent->xany.type == PropertyNotify &&
{
- g_hash_
+ g_list_foreach (os_root_list, root_gfunc, NULL);
}
return GDK_FILTER_ CONTINUE;
}
static void rivate *priv;
-root_ghfunc (gpointer key,
- gpointer value,
- gpointer user_data)
+root_gfunc (gpointer data,
+ gpointer user_data)
{
OsScrollbar *scrollbar;
OsScrollbarP
- scrollbar = OS_SCROLLBAR (key);
+ scrollbar = OS_SCROLLBAR (data);
priv = scrollbar->priv;
OS_DCHECK (scrollbar != NULL);
@@ -1533,31 +1532,24 @@
priv- >present_ time = 0;
- if (os_root_hash_table == NULL)
+ if (os_root_list == NULL)
{
GdkWindow *root;
/* used in the root_filter_func to match the right property. */
net_active_ window_ atom = gdk_x11_ get_xatom_ by_name ("_NET_ ACTIVE_ WINDOW" );
- /* initialize the hash table. */ hash_table, scrollbar, scrollbar); hash_table) ;
- os_root_hash_table = g_hash_table_new (g_direct_hash, g_direct_equal);
-
- /* insert the object in the hash table and ref. */
- g_hash_table_insert (os_root_
- g_hash_table_ref (os_root_
+ os_root_list = g_list_append (os_root_list, scrollbar);
/* apply the root_filter_func. */ default_ root_window ();
gdk_window_ set_events (root, gdk_window_ get_events (root) |
GDK_PROPERTY_ CHANGE_ MASK); add_filter (root, root_filter_func, os_root_ hash_table) ; add_filter (root, root_filter_func, os_root_list); hash_table, scrollbar, scrollbar); hash_table) ;
root = gdk_get_
- gdk_window_
+ gdk_window_
}
else
{
- /* insert the object in the hash table and ref. */
- g_hash_table_insert (os_root_
- g_hash_table_ref (os_root_
+ os_root_list = g_list_...