gtk/texthandle: Use gtk_text_handle_present() instead of GtkNative

This commit is contained in:
Jonas Ådahl 2020-12-04 10:53:16 +01:00
parent 369b03a3d8
commit 517bc0db84
5 changed files with 15 additions and 6 deletions

View File

@ -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));
}

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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));