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
=== modified file 'os/os-thumb.c'
--- os/os-thumb.c 2011-04-05 16:25:15 +0000
+++ os/os-thumb.c 2011-04-06 09:45:22 +0000
@@ -41,7 +41,6 @@
41 GtkWidget *grabbed_widget;41 GtkWidget *grabbed_widget;
42 OsAnimation *animation;42 OsAnimation *animation;
43 gboolean button_press_event;43 gboolean button_press_event;
44 gboolean enter_notify_event;
45 gboolean motion_notify_event;44 gboolean motion_notify_event;
46 gboolean can_rgba;45 gboolean can_rgba;
47 gint pointer_x;46 gint pointer_x;
@@ -60,7 +59,6 @@
60static gboolean os_thumb_button_press_event (GtkWidget *widget, GdkEventButton *event);59static gboolean os_thumb_button_press_event (GtkWidget *widget, GdkEventButton *event);
61static gboolean os_thumb_button_release_event (GtkWidget *widget, GdkEventButton *event);60static gboolean os_thumb_button_release_event (GtkWidget *widget, GdkEventButton *event);
62static void os_thumb_composited_changed (GtkWidget *widget);61static void os_thumb_composited_changed (GtkWidget *widget);
63static gboolean os_thumb_enter_notify_event (GtkWidget *widget, GdkEventCrossing *event);
64static gboolean os_thumb_expose (GtkWidget *widget, GdkEventExpose *event);62static gboolean os_thumb_expose (GtkWidget *widget, GdkEventExpose *event);
65static gboolean os_thumb_leave_notify_event (GtkWidget *widget, GdkEventCrossing *event);63static gboolean os_thumb_leave_notify_event (GtkWidget *widget, GdkEventCrossing *event);
66static gboolean os_thumb_motion_notify_event (GtkWidget *widget, GdkEventMotion *event);64static gboolean os_thumb_motion_notify_event (GtkWidget *widget, GdkEventMotion *event);
@@ -153,7 +151,6 @@
153 widget_class->button_press_event = os_thumb_button_press_event;151 widget_class->button_press_event = os_thumb_button_press_event;
154 widget_class->button_release_event = os_thumb_button_release_event;152 widget_class->button_release_event = os_thumb_button_release_event;
155 widget_class->composited_changed = os_thumb_composited_changed;153 widget_class->composited_changed = os_thumb_composited_changed;
156 widget_class->enter_notify_event = os_thumb_enter_notify_event;
157 widget_class->expose_event = os_thumb_expose;154 widget_class->expose_event = os_thumb_expose;
158 widget_class->leave_notify_event = os_thumb_leave_notify_event;155 widget_class->leave_notify_event = os_thumb_leave_notify_event;
159 widget_class->map = os_thumb_map;156 widget_class->map = os_thumb_map;
@@ -285,6 +282,7 @@
285os_thumb_button_release_event (GtkWidget *widget,282os_thumb_button_release_event (GtkWidget *widget,
286 GdkEventButton *event)283 GdkEventButton *event)
287{284{
285 GtkAllocation allocation;
288 OsThumb *thumb;286 OsThumb *thumb;
289 OsThumbPrivate *priv;287 OsThumbPrivate *priv;
290288
@@ -293,12 +291,16 @@
293291
294 OS_DCHECK (priv->source_id == 0);292 OS_DCHECK (priv->source_id == 0);
295293
294 gtk_widget_get_allocation (widget, &allocation);
295
296 /* priv->source_id should be always 0 here,296 /* priv->source_id should be always 0 here,
297 * because it's set to 0 in both motion_notify_event297 * because it's set to 0 in both motion_notify_event
298 * and button_press_event.298 * and button_press_event.
299 * Add the fade-out timeout only if the pointer is inside,299 * Add the fade-out timeout only
300 * so if priv->enter_notify_event is TRUE. */300 * if the pointer is inside the thumb.
301 if (priv->enter_notify_event)301 * allocation.x and allocation.y are always 0. */
302 if ((event->x >= 0 && event->x <= allocation.width) &&
303 (event->y >= 0 && event->y <= allocation.height))
302 priv->source_id = g_timeout_add (TIMEOUT_FADE_OUT,304 priv->source_id = g_timeout_add (TIMEOUT_FADE_OUT,
303 os_thumb_timeout_fade_out_cb,305 os_thumb_timeout_fade_out_cb,
304 thumb);306 thumb);
@@ -346,21 +348,6 @@
346}348}
347349
348static gboolean350static gboolean
349os_thumb_enter_notify_event (GtkWidget *widget,
350 GdkEventCrossing *event)
351{
352 OsThumb *thumb;
353 OsThumbPrivate *priv;
354
355 thumb = OS_THUMB (widget);
356 priv = thumb->priv;
357
358 priv->enter_notify_event = TRUE;
359
360 return FALSE;
361}
362
363static gboolean
364os_thumb_expose (GtkWidget *widget,351os_thumb_expose (GtkWidget *widget,
365 GdkEventExpose *event)352 GdkEventExpose *event)
366{353{
@@ -577,8 +564,6 @@
577 thumb = OS_THUMB (widget);564 thumb = OS_THUMB (widget);
578 priv = thumb->priv;565 priv = thumb->priv;
579566
580 priv->enter_notify_event = FALSE;
581
582 /* If we exit the thumb when a button is pressed,567 /* If we exit the thumb when a button is pressed,
583 * there's no need to stop the animation, it should568 * there's no need to stop the animation, it should
584 * already be stopped.569 * already be stopped.
@@ -606,6 +591,8 @@
606 thumb = OS_THUMB (widget);591 thumb = OS_THUMB (widget);
607 priv = thumb->priv;592 priv = thumb->priv;
608593
594 gtk_window_set_opacity (GTK_WINDOW (widget), 1.0f);
595
609 priv->grabbed_widget = gtk_grab_get_current ();596 priv->grabbed_widget = gtk_grab_get_current ();
610597
611 if (priv->grabbed_widget != NULL)598 if (priv->grabbed_widget != NULL)
@@ -677,7 +664,6 @@
677 priv = thumb->priv;664 priv = thumb->priv;
678665
679 priv->button_press_event = FALSE;666 priv->button_press_event = FALSE;
680 priv->enter_notify_event = FALSE;
681 priv->motion_notify_event = FALSE;667 priv->motion_notify_event = FALSE;
682668
683 if (priv->grabbed_widget != NULL)669 if (priv->grabbed_widget != NULL)

Subscribers

People subscribed via source and target branches