Merge lp:~cimi/overlay-scrollbar/different-thumb-source-handling into lp:overlay-scrollbar

Proposed by Andrea Cimitan
Status: Merged
Approved by: Mirco Müller
Approved revision: 212
Merged at revision: 212
Proposed branch: lp:~cimi/overlay-scrollbar/different-thumb-source-handling
Merge into: lp:overlay-scrollbar
Diff against target: 110 lines (+28/-32)
1 file modified
os/os-thumb.c (+28/-32)
To merge this branch: bzr merge lp:~cimi/overlay-scrollbar/different-thumb-source-handling
Reviewer Review Type Date Requested Status
Mirco Müller (community) Approve
Review via email: mp+57868@code.launchpad.net

Description of the change

changed approach to the source handling

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

stop the animation *after* calling g_source_remove

Revision history for this message
Mirco Müller (macslow) wrote :

Looking ok, sofar from my side. Approved.

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-13 14:59:14 +0000
+++ os/os-thumb.c 2011-04-20 14:54:17 +0000
@@ -118,12 +118,7 @@
118 if (weight < 1.0f)118 if (weight < 1.0f)
119 gtk_window_set_opacity (GTK_WINDOW (thumb), fabs (weight - 1.0f));119 gtk_window_set_opacity (GTK_WINDOW (thumb), fabs (weight - 1.0f));
120 else120 else
121 {121 gtk_widget_hide (GTK_WIDGET (thumb));
122 /* Animation ended. */
123 priv->source_id = 0;
124
125 gtk_widget_hide (GTK_WIDGET (thumb));
126 }
127}122}
128123
129static gboolean124static gboolean
@@ -137,6 +132,7 @@
137 priv = thumb->priv;132 priv = thumb->priv;
138133
139 os_animation_start (priv->animation);134 os_animation_start (priv->animation);
135 priv->source_id = 0;
140136
141 return FALSE;137 return FALSE;
142}138}
@@ -261,16 +257,16 @@
261 thumb = OS_THUMB (widget);257 thumb = OS_THUMB (widget);
262 priv = thumb->priv;258 priv = thumb->priv;
263259
260 if (priv->source_id != 0)
261 {
262 g_source_remove (priv->source_id);
263 priv->source_id = 0;
264 }
265
264 /* Stop the animation on user interaction,266 /* Stop the animation on user interaction,
265 * the button_press_event. */267 * the button_press_event. */
266 if (priv->source_id != 0)268 os_animation_stop (priv->animation);
267 {269 gtk_window_set_opacity (GTK_WINDOW (widget), 1.0f);
268 g_source_remove (priv->source_id);
269 priv->source_id = 0;
270
271 os_animation_stop (priv->animation);
272 gtk_window_set_opacity (GTK_WINDOW (widget), 1.0f);
273 }
274270
275 if (event->type == GDK_BUTTON_PRESS)271 if (event->type == GDK_BUTTON_PRESS)
276 {272 {
@@ -575,9 +571,9 @@
575 {571 {
576 g_source_remove (priv->source_id);572 g_source_remove (priv->source_id);
577 priv->source_id = 0;573 priv->source_id = 0;
578
579 os_animation_stop (priv->animation);
580 }574 }
575
576 os_animation_stop (priv->animation);
581 }577 }
582578
583 priv->use_tolerance = FALSE;579 priv->use_tolerance = FALSE;
@@ -621,15 +617,15 @@
621 thumb = OS_THUMB (widget);617 thumb = OS_THUMB (widget);
622 priv = thumb->priv;618 priv = thumb->priv;
623619
620 if (priv->source_id != 0)
621 {
622 g_source_remove (priv->source_id);
623 priv->source_id = 0;
624 }
625
624 /* On motion, stop the fade-out. */626 /* On motion, stop the fade-out. */
625 if (priv->source_id != 0)627 os_animation_stop (priv->animation);
626 {628 gtk_window_set_opacity (GTK_WINDOW (widget), 1.0f);
627 g_source_remove (priv->source_id);
628 priv->source_id = 0;
629
630 os_animation_stop (priv->animation);
631 gtk_window_set_opacity (GTK_WINDOW (widget), 1.0f);
632 }
633629
634 /* If you're not dragging, and you're outside630 /* If you're not dragging, and you're outside
635 * the tolerance pixels, enable the fade-out.631 * the tolerance pixels, enable the fade-out.
@@ -683,15 +679,15 @@
683 thumb = OS_THUMB (widget);679 thumb = OS_THUMB (widget);
684 priv = thumb->priv;680 priv = thumb->priv;
685681
682 if (priv->source_id != 0)
683 {
684 g_source_remove (priv->source_id);
685 priv->source_id = 0;
686 }
687
686 /* if started, stop the fade-out. */688 /* if started, stop the fade-out. */
687 if (priv->source_id != 0)689 os_animation_stop (priv->animation);
688 {690 gtk_window_set_opacity (GTK_WINDOW (widget), 1.0f);
689 g_source_remove (priv->source_id);
690 priv->source_id = 0;
691
692 os_animation_stop (priv->animation);
693 gtk_window_set_opacity (GTK_WINDOW (widget), 1.0f);
694 }
695691
696 priv->source_id = g_timeout_add (TIMEOUT_FADE_OUT,692 priv->source_id = g_timeout_add (TIMEOUT_FADE_OUT,
697 os_thumb_timeout_fade_out_cb,693 os_thumb_timeout_fade_out_cb,

Subscribers

People subscribed via source and target branches