From 517bc0db843238455ef138bc9fc89f836833388c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 4 Dec 2020 10:53:16 +0100 Subject: [PATCH] gtk/texthandle: Use gtk_text_handle_present() instead of GtkNative --- gtk/gtklayoutmanager.c | 3 +++ gtk/gtktext.c | 4 ++-- gtk/gtktexthandle.c | 8 ++++++-- gtk/gtktexthandleprivate.h | 2 ++ gtk/gtktextview.c | 4 ++-- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/gtk/gtklayoutmanager.c b/gtk/gtklayoutmanager.c index 483d92ce93..1a7b7afbf6 100644 --- a/gtk/gtklayoutmanager.c +++ b/gtk/gtklayoutmanager.c @@ -78,6 +78,7 @@ #include "gtkwidgetprivate.h" #include "gtknative.h" #include "gtkpopover.h" +#include "gtktexthandleprivate.h" #ifdef G_ENABLE_DEBUG #define LAYOUT_MANAGER_WARN_NOT_IMPLEMENTED(m,method) G_STMT_START { \ @@ -366,6 +367,8 @@ allocate_native_children (GtkWidget *widget) { if (GTK_IS_POPOVER (child)) gtk_popover_present (GTK_POPOVER (child)); + else if (GTK_IS_TEXT_HANDLE (child)) + gtk_text_handle_present (GTK_TEXT_HANDLE (child)); else if (GTK_IS_NATIVE (child)) gtk_native_check_resize (GTK_NATIVE (child)); } diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 427bb9a891..c39e007d61 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -2465,10 +2465,10 @@ gtk_text_size_allocate (GtkWidget *widget, gtk_popover_present (GTK_POPOVER (priv->selection_bubble)); if (priv->text_handles[TEXT_HANDLE_CURSOR]) - gtk_native_check_resize (GTK_NATIVE (priv->text_handles[TEXT_HANDLE_CURSOR])); + gtk_text_handle_present (priv->text_handles[TEXT_HANDLE_CURSOR]); if (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND]) - gtk_native_check_resize (GTK_NATIVE (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND])); + gtk_text_handle_present (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND]); } static void diff --git a/gtk/gtktexthandle.c b/gtk/gtktexthandle.c index 6d80068088..8d7deddb3e 100644 --- a/gtk/gtktexthandle.c +++ b/gtk/gtktexthandle.c @@ -167,8 +167,12 @@ gtk_text_handle_present_surface (GtkTextHandle *handle) static void gtk_text_handle_native_check_resize (GtkNative *native) { - GtkTextHandle *handle = GTK_TEXT_HANDLE (native); - GtkWidget *widget = GTK_WIDGET (native); +} + +void +gtk_text_handle_present (GtkTextHandle *handle) +{ + GtkWidget *widget = GTK_WIDGET (handle); if (!_gtk_widget_get_alloc_needed (widget)) gtk_widget_ensure_allocate (widget); diff --git a/gtk/gtktexthandleprivate.h b/gtk/gtktexthandleprivate.h index 0a02eac12e..c01fedcd50 100644 --- a/gtk/gtktexthandleprivate.h +++ b/gtk/gtktexthandleprivate.h @@ -35,6 +35,8 @@ typedef enum GtkTextHandle * gtk_text_handle_new (GtkWidget *parent); +void gtk_text_handle_present (GtkTextHandle *handle); + void gtk_text_handle_set_role (GtkTextHandle *handle, GtkTextHandleRole role); GtkTextHandleRole gtk_text_handle_get_role (GtkTextHandle *handle); diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 5e26378748..ce097cb586 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -4537,10 +4537,10 @@ gtk_text_view_size_allocate (GtkWidget *widget, gtk_popover_present (GTK_POPOVER (priv->popup_menu)); if (priv->text_handles[TEXT_HANDLE_CURSOR]) - gtk_native_check_resize (GTK_NATIVE (priv->text_handles[TEXT_HANDLE_CURSOR])); + gtk_text_handle_present (priv->text_handles[TEXT_HANDLE_CURSOR]); if (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND]) - gtk_native_check_resize (GTK_NATIVE (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND])); + gtk_text_handle_present (priv->text_handles[TEXT_HANDLE_SELECTION_BOUND]); if (priv->selection_bubble) gtk_popover_present (GTK_POPOVER (priv->selection_bubble));