xwayland: add set_geometry event

This is necessary to react to changes in position of override-redirect
views.
This commit is contained in:
Ilia Bozhinov 2020-10-14 11:47:23 +02:00 committed by Simon Ser
parent afeb941ca0
commit 99f3c643bf
2 changed files with 16 additions and 4 deletions

View File

@ -198,6 +198,7 @@ struct wlr_xwayland_surface {
struct wl_signal set_hints; struct wl_signal set_hints;
struct wl_signal set_decorations; struct wl_signal set_decorations;
struct wl_signal set_override_redirect; struct wl_signal set_override_redirect;
struct wl_signal set_geometry;
struct wl_signal ping_timeout; struct wl_signal ping_timeout;
} events; } events;

View File

@ -164,6 +164,7 @@ static struct wlr_xwayland_surface *xwayland_surface_create(
wl_signal_init(&surface->events.set_decorations); wl_signal_init(&surface->events.set_decorations);
wl_signal_init(&surface->events.set_override_redirect); wl_signal_init(&surface->events.set_override_redirect);
wl_signal_init(&surface->events.ping_timeout); wl_signal_init(&surface->events.ping_timeout);
wl_signal_init(&surface->events.set_geometry);
xcb_get_geometry_reply_t *geometry_reply = xcb_get_geometry_reply_t *geometry_reply =
xcb_get_geometry_reply(xwm->xcb_conn, geometry_cookie, NULL); xcb_get_geometry_reply(xwm->xcb_conn, geometry_cookie, NULL);
@ -935,15 +936,25 @@ static void xwm_handle_configure_notify(struct wlr_xwm *xwm,
return; return;
} }
bool geometry_changed =
(xsurface->x != ev->x || xsurface->y != ev->y ||
xsurface->width != ev->width || xsurface->height != ev->height);
if (geometry_changed) {
xsurface->x = ev->x; xsurface->x = ev->x;
xsurface->y = ev->y; xsurface->y = ev->y;
xsurface->width = ev->width; xsurface->width = ev->width;
xsurface->height = ev->height; xsurface->height = ev->height;
}
if (xsurface->override_redirect != ev->override_redirect) { if (xsurface->override_redirect != ev->override_redirect) {
xsurface->override_redirect = ev->override_redirect; xsurface->override_redirect = ev->override_redirect;
wlr_signal_emit_safe(&xsurface->events.set_override_redirect, xsurface); wlr_signal_emit_safe(&xsurface->events.set_override_redirect, xsurface);
} }
if (geometry_changed) {
wlr_signal_emit_safe(&xsurface->events.set_geometry, NULL);
}
} }
#define ICCCM_WITHDRAWN_STATE 0 #define ICCCM_WITHDRAWN_STATE 0