[gtk] scrolledwindow: Reset indicators in unmap()
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] scrolledwindow: Reset indicators in unmap()
- Date: Fri, 18 Jan 2019 19:06:00 +0000 (UTC)
commit 3ca688a6ddb629cab33ce9523dd8cbb9bd03b069
Author: Timm Bäder <mail baedert org>
Date: Wed Jan 16 14:24:59 2019 +0100
scrolledwindow: Reset indicators in unmap()
This is unrelated to any windowing resources these days, so no need for
an unrealize handler.
gtk/gtkscrolledwindow.c | 99 ++++++++++++++++---------------------------------
1 file changed, 31 insertions(+), 68 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index b320e6f3b2..acb4c65700 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -360,8 +360,6 @@ static void gtk_scrolled_window_measure (GtkWidget *widget,
static void gtk_scrolled_window_map (GtkWidget *widget);
static void gtk_scrolled_window_unmap (GtkWidget *widget);
static void gtk_scrolled_window_realize (GtkWidget *widget);
-static void gtk_scrolled_window_unrealize (GtkWidget *widget);
-
static void _gtk_scrolled_window_set_adjustment_value (GtkScrolledWindow *scrolled_window,
GtkAdjustment *adjustment,
gdouble value);
@@ -377,7 +375,6 @@ static void gtk_scrolled_window_start_deceleration (GtkScrolledWindow *scrol
static void gtk_scrolled_window_update_use_indicators (GtkScrolledWindow *scrolled_window);
static void remove_indicator (GtkScrolledWindow *sw,
Indicator *indicator);
-static void indicator_stop_fade (Indicator *indicator);
static gboolean maybe_hide_indicator (gpointer data);
static void indicator_start_fade (Indicator *indicator,
@@ -516,7 +513,6 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
widget_class->map = gtk_scrolled_window_map;
widget_class->unmap = gtk_scrolled_window_unmap;
widget_class->realize = gtk_scrolled_window_realize;
- widget_class->unrealize = gtk_scrolled_window_unrealize;
widget_class->direction_changed = gtk_scrolled_window_direction_changed;
container_class->add = gtk_scrolled_window_add;
@@ -3588,6 +3584,35 @@ gtk_scrolled_window_map (GtkWidget *widget)
gtk_scrolled_window_update_animating (scrolled_window);
}
+static void
+indicator_reset (Indicator *indicator)
+{
+ if (indicator->conceil_timer)
+ {
+ g_source_remove (indicator->conceil_timer);
+ indicator->conceil_timer = 0;
+ }
+
+ if (indicator->over_timeout_id)
+ {
+ g_source_remove (indicator->over_timeout_id);
+ indicator->over_timeout_id = 0;
+ }
+
+ if (indicator->scrollbar && indicator->tick_id)
+ {
+ gtk_widget_remove_tick_callback (indicator->scrollbar,
+ indicator->tick_id);
+ indicator->tick_id = 0;
+ }
+
+ indicator->scrollbar = NULL;
+ indicator->over = FALSE;
+ gtk_progress_tracker_finish (&indicator->tracker);
+ indicator->current_pos = indicator->source_pos = indicator->target_pos = 0;
+ indicator->last_scroll_time = 0;
+}
+
static void
gtk_scrolled_window_unmap (GtkWidget *widget)
{
@@ -3598,8 +3623,8 @@ gtk_scrolled_window_unmap (GtkWidget *widget)
gtk_scrolled_window_update_animating (scrolled_window);
- indicator_stop_fade (&priv->hindicator);
- indicator_stop_fade (&priv->vindicator);
+ indicator_reset (&priv->hindicator);
+ indicator_reset (&priv->vindicator);
}
static void
@@ -3677,27 +3702,6 @@ indicator_start_fade (Indicator *indicator,
indicator_set_fade (indicator, target);
}
-static void
-indicator_stop_fade (Indicator *indicator)
-{
- if (indicator->tick_id != 0)
- {
- indicator_set_fade (indicator, indicator->target_pos);
- gtk_widget_remove_tick_callback (indicator->scrollbar, indicator->tick_id);
- indicator->tick_id = 0;
- }
-
- if (indicator->conceil_timer)
- {
- g_source_remove (indicator->conceil_timer);
- indicator->conceil_timer = 0;
- }
-
- gtk_progress_tracker_finish (&indicator->tracker);
- indicator->current_pos = indicator->source_pos = indicator->target_pos = 0;
- indicator->last_scroll_time = 0;
-}
-
static gboolean
maybe_hide_indicator (gpointer data)
{
@@ -3834,47 +3838,6 @@ gtk_scrolled_window_realize (GtkWidget *widget)
GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->realize (widget);
}
-static void
-indicator_reset (Indicator *indicator)
-{
- if (indicator->conceil_timer)
- {
- g_source_remove (indicator->conceil_timer);
- indicator->conceil_timer = 0;
- }
-
- if (indicator->over_timeout_id)
- {
- g_source_remove (indicator->over_timeout_id);
- indicator->over_timeout_id = 0;
- }
-
- if (indicator->scrollbar && indicator->tick_id)
- {
- gtk_widget_remove_tick_callback (indicator->scrollbar,
- indicator->tick_id);
- indicator->tick_id = 0;
- }
-
- indicator->scrollbar = NULL;
- indicator->over = FALSE;
- gtk_progress_tracker_finish (&indicator->tracker);
- indicator->current_pos = indicator->source_pos = indicator->target_pos = 0;
- indicator->last_scroll_time = 0;
-}
-
-static void
-gtk_scrolled_window_unrealize (GtkWidget *widget)
-{
- GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
- GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window);
-
- indicator_reset (&priv->hindicator);
- indicator_reset (&priv->vindicator);
-
- GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->unrealize (widget);
-}
-
/**
* gtk_scrolled_window_get_min_content_width:
* @scrolled_window: a #GtkScrolledWindow
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]