[gtk+] GtkTextHandle: Look up for the first child of a scrolled window found
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkTextHandle: Look up for the first child of a scrolled window found
- Date: Wed, 24 Feb 2016 16:59:04 +0000 (UTC)
commit 60d7f4376ea5ff1722cd20aced72c167372d2a38
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Feb 24 17:19:48 2016 +0100
GtkTextHandle: Look up for the first child of a scrolled window found
Text handles use to connect to the first GtkScrollable up the hierarchy
so they can be repositioned when scrolling. It makes more sense to look
up the first child of a GtkScrolledWindow, it must be an scrollable too,
and will be the scrollable that can actually change the position of the
text handles.
https://bugzilla.gnome.org/show_bug.cgi?id=761676
gtk/gtktexthandle.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c
index 5ed6ebc..cc98d22 100644
--- a/gtk/gtktexthandle.c
+++ b/gtk/gtktexthandle.c
@@ -544,6 +544,21 @@ _gtk_text_handle_update_scrollable (GtkTextHandle *handle,
handle);
}
+static GtkWidget *
+gtk_text_handle_lookup_scrollable (GtkTextHandle *handle)
+{
+ GtkTextHandlePrivate *priv;
+ GtkWidget *scrolled_window;
+
+ priv = handle->priv;
+ scrolled_window = gtk_widget_get_ancestor (priv->parent,
+ GTK_TYPE_SCROLLED_WINDOW);
+ if (!scrolled_window)
+ return NULL;
+
+ return gtk_bin_get_child (GTK_BIN (scrolled_window));
+}
+
static void
_gtk_text_handle_parent_hierarchy_changed (GtkWidget *widget,
GtkWindow *previous_toplevel,
@@ -574,7 +589,7 @@ _gtk_text_handle_parent_hierarchy_changed (GtkWidget *widget,
}
}
- scrollable = gtk_widget_get_ancestor (widget, GTK_TYPE_SCROLLABLE);
+ scrollable = gtk_text_handle_lookup_scrollable (handle);
_gtk_text_handle_update_scrollable (handle, GTK_SCROLLABLE (scrollable));
}
@@ -603,7 +618,7 @@ _gtk_text_handle_set_parent (GtkTextHandle *handle,
G_CALLBACK (_gtk_text_handle_parent_hierarchy_changed),
handle);
- scrollable = gtk_widget_get_ancestor (parent, GTK_TYPE_SCROLLABLE);
+ scrollable = gtk_text_handle_lookup_scrollable (handle);
}
_gtk_text_handle_update_scrollable (handle, GTK_SCROLLABLE (scrollable));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]