Updated gtk_xtext_unrealize() to use GTK3 accessors (gtk_widget_get_window(), gtk_widget_set_window(), and gtk_widget_set_realized()) while keeping the GTK2 struct access in the #if !HAVE_GTK3 branch.

Consolidated the GTK3 vs GTK2 branching in gtk_xtext_realize() so GTK3 uses gtk_widget_get_allocation(), gtk_widget_get_parent_window(), and gtk_widget_set_window(), with the existing GTK2 direct struct access preserved under #if !HAVE_GTK3.
This commit is contained in:
2026-01-23 22:00:36 -07:00
parent 00eb2de4c8
commit 0df299acf5

View File

@@ -724,22 +724,26 @@ gtk_xtext_destroy (GtkObject * object)
static void
gtk_xtext_unrealize (GtkWidget * widget)
{
#if HAVE_GTK3
GdkWindow *window = gtk_widget_get_window (widget);
#endif
backend_deinit (GTK_XTEXT (widget));
/* if there are still events in the queue, this'll avoid segfault */
#if HAVE_GTK3
{
GdkWindow *window = gtk_widget_get_window (widget);
if (window)
gdk_window_set_user_data (window, NULL);
}
#endif
#if !HAVE_GTK3
if (window)
gdk_window_set_user_data (window, NULL);
#else
gdk_window_set_user_data (widget->window, NULL);
#endif
if (parent_class->unrealize)
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
#if HAVE_GTK3
gtk_widget_set_window (widget, NULL);
gtk_widget_set_realized (widget, FALSE);
#endif
}
static void
@@ -807,8 +811,7 @@ gtk_xtext_realize (GtkWidget * widget)
gtk_widget_set_realized (widget, TRUE);
gtk_widget_get_allocation (widget, &allocation);
parent_window = gtk_widget_get_parent_window (widget);
#endif
#if !HAVE_GTK3
#else
gtk_widget_set_realized (widget, TRUE);
allocation = widget->allocation;
parent_window = widget->parent->window;
@@ -841,8 +844,7 @@ gtk_xtext_realize (GtkWidget * widget)
#if HAVE_GTK3
gtk_widget_set_window (widget, window);
#endif
#if !HAVE_GTK3
#else
widget->window = window;
#endif