xwm: Don't send synthetic ConfigureNotify to windows that were mapped O-R

It's entirely possible, if ridiculous, for an X11 client to change a
window's override redirect flag while it's mapped. If this changes from
true to false we will start receiving Configure requests for the window.

That leads us to a crash when we try to query the window's current
position from the shell to send a configure notify event, as the shell
doesn't know about the surface.

Instead of trying to cleverly handle this, mostly go back to the behaviour
these clients would've seen before commit cf5aca5a and don't send them
a synthetic configure notify.

We also specifically check in weston_wm_handle_configure_request for
the same condition, and early return there, bypassing a couple of
other things we would've done previously.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2022-07-28 12:52:11 -05:00
parent 3387afd56b
commit 0aac3dd343

View File

@ -683,6 +683,17 @@ weston_wm_window_send_configure_notify(struct weston_wm_window *window)
const struct weston_desktop_xwayland_interface *xwayland_api =
wm->server->compositor->xwayland_interface;
if (window->override_redirect) {
/* Some clever application has changed the override redirect
* flag on an existing window. We didn't see it at map time,
* so have no idea what to do with it now. Log and leave.
*/
wm_printf(wm, "XWM warning: Can't send XCB_CONFIGURE_NOTIFY to"
" window %d which was mapped override redirect\n",
window->id);
return;
}
weston_wm_window_get_child_position(window, &x, &y);
/* Synthetic ConfigureNotify events must be relative to the root
* window, so get our offset if we're mapped. */
@ -783,6 +794,13 @@ weston_wm_handle_configure_request(struct weston_wm *wm, xcb_generic_event_t *ev
if (!wm_lookup_window(wm, configure_request->window, &window))
return;
/* If we see this, a window's override_redirect state has changed
* after it was mapped, and we don't really know what to do about
* that.
*/
if (window->override_redirect)
return;
if (window->fullscreen) {
weston_wm_window_send_configure_notify(window);
return;