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

Proposed by Andrea Cimitan
Status: Merged
Merged at revision: 197
Proposed branch: lp:~cimi/overlay-scrollbar/fix-751652
Merge into: lp:overlay-scrollbar
Diff against target: 103 lines (+10/-24)
1 file modified
os/os-thumb.c (+10/-24)
To merge this branch: bzr merge lp:~cimi/overlay-scrollbar/fix-751652
Reviewer Review Type Date Requested Status
Loïc Molinari (community) Approve
Review via email: mp+56489@code.launchpad.net

Description of the change

Another approach to button_release_event's fade-out animation, to fix modal dialogs (there the scrollbar is not receiving enter and leave notify events)

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

always be sure the opacity of the window is 1.0f at map ()

Revision history for this message
Loïc Molinari (loic.molinari) wrote :

It's much cleaner than the previous solution. good stuff!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'os/os-thumb.c'
2--- os/os-thumb.c 2011-04-05 16:25:15 +0000
3+++ os/os-thumb.c 2011-04-06 09:45:22 +0000
4@@ -41,7 +41,6 @@
5 GtkWidget *grabbed_widget;
6 OsAnimation *animation;
7 gboolean button_press_event;
8- gboolean enter_notify_event;
9 gboolean motion_notify_event;
10 gboolean can_rgba;
11 gint pointer_x;
12@@ -60,7 +59,6 @@
13 static gboolean os_thumb_button_press_event (GtkWidget *widget, GdkEventButton *event);
14 static gboolean os_thumb_button_release_event (GtkWidget *widget, GdkEventButton *event);
15 static void os_thumb_composited_changed (GtkWidget *widget);
16-static gboolean os_thumb_enter_notify_event (GtkWidget *widget, GdkEventCrossing *event);
17 static gboolean os_thumb_expose (GtkWidget *widget, GdkEventExpose *event);
18 static gboolean os_thumb_leave_notify_event (GtkWidget *widget, GdkEventCrossing *event);
19 static gboolean os_thumb_motion_notify_event (GtkWidget *widget, GdkEventMotion *event);
20@@ -153,7 +151,6 @@
21 widget_class->button_press_event = os_thumb_button_press_event;
22 widget_class->button_release_event = os_thumb_button_release_event;
23 widget_class->composited_changed = os_thumb_composited_changed;
24- widget_class->enter_notify_event = os_thumb_enter_notify_event;
25 widget_class->expose_event = os_thumb_expose;
26 widget_class->leave_notify_event = os_thumb_leave_notify_event;
27 widget_class->map = os_thumb_map;
28@@ -285,6 +282,7 @@
29 os_thumb_button_release_event (GtkWidget *widget,
30 GdkEventButton *event)
31 {
32+ GtkAllocation allocation;
33 OsThumb *thumb;
34 OsThumbPrivate *priv;
35
36@@ -293,12 +291,16 @@
37
38 OS_DCHECK (priv->source_id == 0);
39
40+ gtk_widget_get_allocation (widget, &allocation);
41+
42 /* priv->source_id should be always 0 here,
43 * because it's set to 0 in both motion_notify_event
44 * and button_press_event.
45- * Add the fade-out timeout only if the pointer is inside,
46- * so if priv->enter_notify_event is TRUE. */
47- if (priv->enter_notify_event)
48+ * Add the fade-out timeout only
49+ * if the pointer is inside the thumb.
50+ * allocation.x and allocation.y are always 0. */
51+ if ((event->x >= 0 && event->x <= allocation.width) &&
52+ (event->y >= 0 && event->y <= allocation.height))
53 priv->source_id = g_timeout_add (TIMEOUT_FADE_OUT,
54 os_thumb_timeout_fade_out_cb,
55 thumb);
56@@ -346,21 +348,6 @@
57 }
58
59 static gboolean
60-os_thumb_enter_notify_event (GtkWidget *widget,
61- GdkEventCrossing *event)
62-{
63- OsThumb *thumb;
64- OsThumbPrivate *priv;
65-
66- thumb = OS_THUMB (widget);
67- priv = thumb->priv;
68-
69- priv->enter_notify_event = TRUE;
70-
71- return FALSE;
72-}
73-
74-static gboolean
75 os_thumb_expose (GtkWidget *widget,
76 GdkEventExpose *event)
77 {
78@@ -577,8 +564,6 @@
79 thumb = OS_THUMB (widget);
80 priv = thumb->priv;
81
82- priv->enter_notify_event = FALSE;
83-
84 /* If we exit the thumb when a button is pressed,
85 * there's no need to stop the animation, it should
86 * already be stopped.
87@@ -606,6 +591,8 @@
88 thumb = OS_THUMB (widget);
89 priv = thumb->priv;
90
91+ gtk_window_set_opacity (GTK_WINDOW (widget), 1.0f);
92+
93 priv->grabbed_widget = gtk_grab_get_current ();
94
95 if (priv->grabbed_widget != NULL)
96@@ -677,7 +664,6 @@
97 priv = thumb->priv;
98
99 priv->button_press_event = FALSE;
100- priv->enter_notify_event = FALSE;
101 priv->motion_notify_event = FALSE;
102
103 if (priv->grabbed_widget != NULL)

Subscribers

People subscribed via source and target branches