From 4dd47196f67a223abf482caf430c3e5dd5c05977 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Tue, 19 Apr 2022 11:13:11 +0800 Subject: [PATCH] Fix opaque region treatment on GTK 3 * src/xfns.c (x_set_alpha_background): * src/xterm.c (x_update_opaque_region): Update opaque region for tooltip frames the correct way on GTK. --- src/xfns.c | 22 +++++++++++++++++++++- src/xterm.c | 9 +++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/xfns.c b/src/xfns.c index 195af1381b9..9ceba98f67d 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -730,9 +730,11 @@ x_set_wait_for_wm (struct frame *f, Lisp_Object new_value, Lisp_Object old_value static void x_set_alpha_background (struct frame *f, Lisp_Object arg, Lisp_Object oldval) { -#ifndef HAVE_GTK3 unsigned long opaque_region[] = {0, 0, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f)}; +#ifdef USE_GTK + GObjectClass *object_class; + GtkWidgetClass *class; #endif gui_set_alpha_background (f, arg, oldval); @@ -776,6 +778,24 @@ x_set_alpha_background (struct frame *f, Lisp_Object arg, Lisp_Object oldval) FRAME_DISPLAY_INFO (f)->Xatom_net_wm_opaque_region, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &opaque_region, 4); +#else + else + { + if (FRAME_TOOLTIP_P (f)) + XChangeProperty (FRAME_X_DISPLAY (f), + FRAME_X_WINDOW (f), + FRAME_DISPLAY_INFO (f)->Xatom_net_wm_opaque_region, + XA_CARDINAL, 32, PropModeReplace, + (unsigned char *) &opaque_region, 4); + else + { + object_class = G_OBJECT_GET_CLASS (FRAME_GTK_OUTER_WIDGET (f)); + class = GTK_WIDGET_CLASS (object_class); + + if (class->style_updated) + class->style_updated (FRAME_GTK_OUTER_WIDGET (f)); + } + } #endif } diff --git a/src/xterm.c b/src/xterm.c index 99269e3e92b..b5b2fe32947 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3783,7 +3783,6 @@ x_toolkit_position (struct frame *f, int x, int y, static void x_update_opaque_region (struct frame *f, XEvent *configure) { -#ifndef HAVE_GTK3 unsigned long opaque_region[] = {0, 0, (configure ? configure->xconfigure.width @@ -3791,7 +3790,6 @@ x_update_opaque_region (struct frame *f, XEvent *configure) (configure ? configure->xconfigure.height : FRAME_PIXEL_HEIGHT (f))}; -#endif if (!FRAME_DISPLAY_INFO (f)->alpha_bits) return; @@ -3810,6 +3808,13 @@ x_update_opaque_region (struct frame *f, XEvent *configure) FRAME_DISPLAY_INFO (f)->Xatom_net_wm_opaque_region, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &opaque_region, 4); +#else + else if (FRAME_TOOLTIP_P (f)) + XChangeProperty (FRAME_X_DISPLAY (f), + FRAME_X_WINDOW (f), + FRAME_DISPLAY_INFO (f)->Xatom_net_wm_opaque_region, + XA_CARDINAL, 32, PropModeReplace, + (unsigned char *) &opaque_region, 4); #endif unblock_input (); } -- 2.39.2