xwm: Prepare send_configurenotify for non-fullscreen use

Currently weston_wm_window_send_configurenotify is only called for
fullscreen clients, and it is written to be correct only in that case.

Fix it up to handle other cases properly so we can use it for them in a
later commit. Synthetic Configure Notify events are relative to the
root window, so this means adding our window co-ordinate when
necessary.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2022-06-21 08:49:59 -05:00 committed by Pekka Paalanen
parent 23e3a3285a
commit ea9a01f2e3

View File

@ -675,15 +675,22 @@ weston_wm_window_send_configure_notify(struct weston_wm_window *window)
xcb_configure_notify_event_t configure_notify;
struct weston_wm *wm = window->wm;
int x, y;
int32_t dx = 0, dy = 0;
const struct weston_desktop_xwayland_interface *xwayland_api =
wm->server->compositor->xwayland_interface;
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. */
if (window->shsurf)
xwayland_api->get_position(window->shsurf, &dx, &dy);
configure_notify.response_type = XCB_CONFIGURE_NOTIFY;
configure_notify.pad0 = 0;
configure_notify.event = window->id;
configure_notify.window = window->id;
configure_notify.above_sibling = XCB_WINDOW_NONE;
configure_notify.x = x;
configure_notify.y = y;
configure_notify.x = x + dx;
configure_notify.y = y + dy;
configure_notify.width = window->width;
configure_notify.height = window->height;
configure_notify.border_width = 0;