[gtk+/wip/overlay-scrollbar] Fix repeated mode changes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/overlay-scrollbar] Fix repeated mode changes
- Date: Thu, 9 Oct 2014 21:19:21 +0000 (UTC)
commit 6529ded2fc8db69c7263ea81550b80a74c9f8e05
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Oct 9 17:02:51 2014 -0400
Fix repeated mode changes
Make sure to properly undo and redo all the setup
work in setup_indicator and remove_indicator so they
can be used repeatedly.
gtk/gtkscrolledwindow.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index e6affa2..930cbdb 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -3474,7 +3474,13 @@ setup_indicator (GtkScrolledWindow *scrolled_window,
indicator->enabled = TRUE;
indicator->scrollbar = scrollbar;
+
+ g_object_ref (scrollbar);
+ gtk_widget_unparent (scrollbar);
gtk_widget_set_parent_window (scrollbar, indicator->window);
+ gtk_widget_set_parent (scrollbar, GTK_WIDGET (scrolled_window));
+ g_object_unref (scrollbar);
+
gtk_style_context_add_class (context, "overlay-indicator");
g_signal_connect (context, "changed",
G_CALLBACK (indicator_style_changed), indicator);
@@ -3484,6 +3490,10 @@ setup_indicator (GtkScrolledWindow *scrolled_window,
G_CALLBACK (indicator_leave_notify), indicator);
g_signal_connect (adjustment, "value-changed",
G_CALLBACK (indicator_value_changed), indicator);
+
+ gdk_window_hide (indicator->window);
+ gtk_widget_set_opacity (scrollbar, 0.0);
+ indicator->current_pos = 0.0;
}
static void
@@ -3527,7 +3537,9 @@ remove_indicator (GtkScrolledWindow *scrolled_window,
gtk_widget_set_parent (scrollbar, GTK_WIDGET (scrolled_window));
g_object_unref (scrollbar);
+ gdk_window_show (indicator->window);
gtk_widget_set_opacity (scrollbar, 1.0);
+ indicator->current_pos = 1.0;
}
static gboolean
@@ -3801,6 +3813,7 @@ gtk_scrolled_window_set_overlay_scrolling (GtkScrolledWindow *scrolled_window,
if (priv->overlay_scrolling != overlay_scrolling)
{
priv->overlay_scrolling = overlay_scrolling;
+
if (gtk_widget_get_realized (GTK_WIDGET (scrolled_window)))
gtk_scrolled_window_update_touch_mode (scrolled_window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]