Merge lp:~cimi/overlay-scrollbar/move-leave-notify into lp:overlay-scrollbar

Proposed by Andrea Cimitan
Status: Merged
Merged at revision: 232
Proposed branch: lp:~cimi/overlay-scrollbar/move-leave-notify
Merge into: lp:overlay-scrollbar
Diff against target: 118 lines (+32/-49)
1 file modified
os/os-scrollbar.c (+32/-49)
To merge this branch: bzr merge lp:~cimi/overlay-scrollbar/move-leave-notify
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+58536@code.launchpad.net

Description of the change

just move the leave notify event for the toplevel in the filter func, because the callback applied to the toplevel is called also when moving the mouse in a textview, and that could potentially expose issues

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

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-13 13:34:44 +0000
+++ os/os-scrollbar.c 2011-04-20 17:14:30 +0000
@@ -127,7 +127,6 @@
127static void root_gfunc (gpointer data, gpointer user_data);127static void root_gfunc (gpointer data, gpointer user_data);
128static gboolean toplevel_configure_event_cb (GtkWidget *widget, GdkEventConfigure *event, gpointer user_data);128static gboolean toplevel_configure_event_cb (GtkWidget *widget, GdkEventConfigure *event, gpointer user_data);
129static GdkFilterReturn toplevel_filter_func (GdkXEvent *gdkxevent, GdkEvent *event, gpointer user_data);129static GdkFilterReturn toplevel_filter_func (GdkXEvent *gdkxevent, GdkEvent *event, gpointer user_data);
130static gboolean toplevel_leave_notify_event_cb (GtkWidget *widget, GdkEventCrossing *event, gpointer user_data);
131130
132/* Private functions. */131/* Private functions. */
133132
@@ -1354,6 +1353,38 @@
1354 if (!priv->active_window && xevent->type == EnterNotify)1353 if (!priv->active_window && xevent->type == EnterNotify)
1355 pager_set_state_from_pointer (scrollbar, xevent->xcrossing.x, xevent->xcrossing.y);1354 pager_set_state_from_pointer (scrollbar, xevent->xcrossing.x, xevent->xcrossing.y);
13561355
1356 if (xevent->type == LeaveNotify)
1357 {
1358 /* never deactivate the pager in an active window. */
1359 if (!priv->active_window)
1360 {
1361 priv->can_deactivate_pager = TRUE;
1362
1363 if (priv->source_deactivate_pager_id != 0)
1364 g_source_remove (priv->source_deactivate_pager_id);
1365
1366 priv->source_deactivate_pager_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE,
1367 os_scrollbar_deactivate_pager_cb,
1368 scrollbar);
1369 }
1370
1371 priv->can_hide = TRUE;
1372
1373 if (priv->source_hide_thumb_id != 0)
1374 g_source_remove (priv->source_hide_thumb_id);
1375
1376 priv->source_hide_thumb_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE,
1377 os_scrollbar_hide_thumb_cb,
1378 scrollbar);
1379
1380 if (priv->source_unlock_thumb_id != 0)
1381 g_source_remove (priv->source_unlock_thumb_id);
1382
1383 priv->source_unlock_thumb_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE,
1384 os_scrollbar_unlock_thumb_cb,
1385 scrollbar);
1386 }
1387
1357 /* get the motion_notify_event trough XEvent */1388 /* get the motion_notify_event trough XEvent */
1358 if (xevent->type == MotionNotify)1389 if (xevent->type == MotionNotify)
1359 {1390 {
@@ -1447,50 +1478,6 @@
1447 return GDK_FILTER_CONTINUE;1478 return GDK_FILTER_CONTINUE;
1448}1479}
14491480
1450/* Hide the OsScrollbar, when the pointer leaves the toplevel GtkWindow. */
1451static gboolean
1452toplevel_leave_notify_event_cb (GtkWidget *widget,
1453 GdkEventCrossing *event,
1454 gpointer user_data)
1455{
1456 OsScrollbar *scrollbar;
1457 OsScrollbarPrivate *priv;
1458
1459 scrollbar = OS_SCROLLBAR (user_data);
1460 priv = scrollbar->priv;
1461
1462 /* never deactivate the pager in an active window. */
1463 if (!priv->active_window)
1464 {
1465 priv->can_deactivate_pager = TRUE;
1466
1467 if (priv->source_deactivate_pager_id != 0)
1468 g_source_remove (priv->source_deactivate_pager_id);
1469
1470 priv->source_deactivate_pager_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE,
1471 os_scrollbar_deactivate_pager_cb,
1472 scrollbar);
1473 }
1474
1475 priv->can_hide = TRUE;
1476
1477 if (priv->source_hide_thumb_id != 0)
1478 g_source_remove (priv->source_hide_thumb_id);
1479
1480 priv->source_hide_thumb_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE,
1481 os_scrollbar_hide_thumb_cb,
1482 scrollbar);
1483
1484 if (priv->source_unlock_thumb_id != 0)
1485 g_source_remove (priv->source_unlock_thumb_id);
1486
1487 priv->source_unlock_thumb_id = g_timeout_add (TIMEOUT_TOPLEVEL_HIDE,
1488 os_scrollbar_unlock_thumb_cb,
1489 scrollbar);
1490
1491 return FALSE;
1492}
1493
1494/* Type definition. */1481/* Type definition. */
14951482
1496G_DEFINE_TYPE (OsScrollbar, os_scrollbar, GTK_TYPE_SCROLLBAR);1483G_DEFINE_TYPE (OsScrollbar, os_scrollbar, GTK_TYPE_SCROLLBAR);
@@ -1723,8 +1710,6 @@
17231710
1724 g_signal_connect (G_OBJECT (gtk_widget_get_toplevel (widget)), "configure-event",1711 g_signal_connect (G_OBJECT (gtk_widget_get_toplevel (widget)), "configure-event",
1725 G_CALLBACK (toplevel_configure_event_cb), scrollbar);1712 G_CALLBACK (toplevel_configure_event_cb), scrollbar);
1726 g_signal_connect (G_OBJECT (gtk_widget_get_toplevel (widget)), "leave-notify-event",
1727 G_CALLBACK (toplevel_leave_notify_event_cb), scrollbar);
17281713
1729 os_scrollbar_calc_layout_pager (scrollbar, priv->adjustment->value);1714 os_scrollbar_calc_layout_pager (scrollbar, priv->adjustment->value);
17301715
@@ -1842,8 +1827,6 @@
18421827
1843 g_signal_handlers_disconnect_by_func (G_OBJECT (gtk_widget_get_toplevel (widget)),1828 g_signal_handlers_disconnect_by_func (G_OBJECT (gtk_widget_get_toplevel (widget)),
1844 G_CALLBACK (toplevel_configure_event_cb), scrollbar);1829 G_CALLBACK (toplevel_configure_event_cb), scrollbar);
1845 g_signal_handlers_disconnect_by_func (G_OBJECT (gtk_widget_get_toplevel (widget)),
1846 G_CALLBACK (toplevel_leave_notify_event_cb), scrollbar);
18471830
1848 os_pager_set_parent (OS_PAGER (priv->pager), NULL);1831 os_pager_set_parent (OS_PAGER (priv->pager), NULL);
18491832

Subscribers

People subscribed via source and target branches