1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2024-11-25 14:06:08 -05:00

core: still get the overlay window id in debug mode

If we don't the unknown window assertion will trip when we get events
for the overlay window.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-10-08 18:03:48 +01:00
parent 8548894d32
commit b6314851d9
No known key found for this signature in database
GPG key ID: D3A4405BE6CC17F4

View file

@ -1410,7 +1410,8 @@ static void unredirect(session_t *ps) {
xcb_composite_unredirect_subwindows(ps->c.c, ps->c.screen_info->root,
session_redirection_mode(ps));
// Unmap overlay window
if (ps->overlay != XCB_NONE) {
if (ps->overlay != XCB_NONE &&
session_redirection_mode(ps) == XCB_COMPOSITE_REDIRECT_MANUAL) {
xcb_unmap_window(ps->c.c, ps->overlay);
}
@ -2539,6 +2540,21 @@ static session_t *session_init(int argc, char **argv, Display *dpy,
// We are here if we don't really function as a compositor, so we are not
// taking over the screen, and we don't need to register as a compositor
// We still need to know what the overlay window is, so we won't be
// confused when we get events for the overlay window. Since
// CompositeGetOverlayWindow also maps the overlay, we need to immediately
// release it.
auto get_overlay =
xcb_composite_get_overlay_window(ps->c.c, ps->c.screen_info->root);
XCB_AWAIT_VOID(xcb_composite_release_overlay_window, ps->c.c,
ps->c.screen_info->root);
auto overlay_reply =
xcb_composite_get_overlay_window_reply(ps->c.c, get_overlay, NULL);
if (overlay_reply) {
ps->overlay = overlay_reply->overlay_win;
free(overlay_reply);
}
// If we are in debug mode, we need to create a window for rendering if
// the backend supports presenting.
@ -2654,7 +2670,7 @@ static void session_destroy(session_t *ps) {
#endif
// Release overlay window
if (ps->overlay) {
if (ps->overlay && session_redirection_mode(ps) == XCB_COMPOSITE_REDIRECT_MANUAL) {
xcb_composite_release_overlay_window(ps->c.c, ps->overlay);
ps->overlay = XCB_NONE;
}