Set _NET_WM_OPAQUE_REGION on non-GTK3 toolkits when using 32 bit visual

* src/xfns.c (x_set_alpha_background): Set opaque region if
opaque.

* src/xterm.c (x_update_opaque_region): New parameter
`configure'.  All callers changed.
(handle_one_xevent): Call `x_update_opaque_region' on configure
events.
This commit is contained in:
Po Lu 2022-02-11 13:44:42 +08:00
parent 2d5b219239
commit 9fdc0f08ce
2 changed files with 41 additions and 4 deletions

View file

@ -730,6 +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)};
#endif
gui_set_alpha_background (f, arg, oldval);
#ifdef USE_GTK
@ -749,6 +754,14 @@ x_set_alpha_background (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
XA_CARDINAL, 32, PropModeReplace,
NULL, 0);
}
#ifndef HAVE_GTK3
else
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
}
static void

View file

@ -345,7 +345,7 @@ static void x_wm_set_icon_pixmap (struct frame *, ptrdiff_t);
static void x_initialize (void);
static bool x_get_current_wm_state (struct frame *, Window, int *, bool *);
static void x_update_opaque_region (struct frame *);
static void x_update_opaque_region (struct frame *, XEvent *);
/* Flush display of frame F. */
@ -366,7 +366,6 @@ x_flush (struct frame *f)
static void
x_drop_xrender_surfaces (struct frame *f)
{
x_update_opaque_region (f);
font_drop_xrender_surfaces (f);
#ifdef HAVE_XRENDER
@ -440,14 +439,37 @@ record_event (char *locus, int type)
#endif
static void
x_update_opaque_region (struct frame *f)
x_update_opaque_region (struct frame *f, XEvent *configure)
{
#ifndef HAVE_GTK3
unsigned long opaque_region[] = {0, 0,
(configure
? configure->xconfigure.width
: FRAME_PIXEL_WIDTH (f)),
(configure
? configure->xconfigure.height
: FRAME_PIXEL_HEIGHT (f))};
#endif
if (!FRAME_DISPLAY_INFO (f)->alpha_bits)
return;
block_input ();
if (f->alpha_background < 1.0)
XChangeProperty (FRAME_X_DISPLAY (f),
FRAME_X_WINDOW (f),
FRAME_DISPLAY_INFO (f)->Xatom_net_wm_opaque_region,
XA_CARDINAL, 32, PropModeReplace,
NULL, 0);
#ifndef HAVE_GTK3
else
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 ();
}
@ -9712,7 +9734,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
f->output_data.x->has_been_visible = true;
}
x_update_opaque_region (f);
x_update_opaque_region (f, NULL);
if (not_hidden && iconified)
{
@ -10350,6 +10372,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
x_cr_update_surface_desired_size (any,
configureEvent.xconfigure.width,
configureEvent.xconfigure.height);
x_update_opaque_region (f, &configureEvent);
#endif
#ifdef USE_GTK
if (!f
@ -10378,6 +10401,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
x_cr_update_surface_desired_size (f, configureEvent.xconfigure.width,
configureEvent.xconfigure.height);
#endif
x_update_opaque_region (f, &configureEvent);
f = 0;
}
#endif