Mercurial > dwindows
changeset 2336:dd1b2cc95c91
GTK4: Don't unref the PangoContext returned from gtk_widget_get_pango_context().
Only go native if necessary in dw_window_get_pos_size(), plus refactor so we
only get the surface on X11 where we can query the position.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 02 Mar 2021 10:30:10 +0000 |
parents | 1d413d869fa2 |
children | ef078d219bfc |
files | gtk4/dw.c |
diffstat | 1 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/gtk4/dw.c Tue Mar 02 05:21:33 2021 +0000 +++ b/gtk4/dw.c Tue Mar 02 10:30:10 2021 +0000 @@ -6880,17 +6880,17 @@ { PangoFontDescription *font; char *fontname = NULL; - int free_fontname = 0; + int free_fontname = FALSE; if(text) { if(handle) { fontname = (char *)g_object_get_data(G_OBJECT(handle), "_dw_fontname"); - if ( fontname == NULL ) + if(fontname == NULL) { fontname = dw_window_get_font(handle); - free_fontname = 1; + free_fontname = TRUE; } } else if(pixmap) @@ -6925,7 +6925,6 @@ g_object_unref(layout); } - g_object_unref(context); } pango_font_description_free(font); } @@ -8748,11 +8747,12 @@ } #ifdef GDK_WINDOWING_X11 - { - GdkSurface *surface = gtk_native_get_surface(GTK_NATIVE(handle)); + if(x || y) + { GdkDisplay *display = gdk_display_get_default(); + GdkSurface *surface; - if(surface && display && GDK_IS_X11_DISPLAY(display)) + if(display && GDK_IS_X11_DISPLAY(display) && (surface = gtk_native_get_surface(GTK_NATIVE(handle)))) { XWindowAttributes xwa; int ix = 0, iy = 0;