diff options
author | Ilia Bozhinov <ammen99@gmail.com> | 2020-10-14 11:47:23 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-10-14 21:49:51 +0200 |
commit | 99f3c643bf9407c4e0b3eb901b1e44588ae11357 (patch) | |
tree | 54f8529bed6d2a8bd4fc2697eec8d0cca8bac5fb | |
parent | afeb941ca027995530d940b81f28421456c77640 (diff) |
xwayland: add set_geometry event
This is necessary to react to changes in position of override-redirect
views.
-rw-r--r-- | include/wlr/xwayland.h | 1 | ||||
-rw-r--r-- | xwayland/xwm.c | 19 |
2 files changed, 16 insertions, 4 deletions
diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h index 26a14aea..b801b5dd 100644 --- a/include/wlr/xwayland.h +++ b/include/wlr/xwayland.h @@ -198,6 +198,7 @@ struct wlr_xwayland_surface { struct wl_signal set_hints; struct wl_signal set_decorations; struct wl_signal set_override_redirect; + struct wl_signal set_geometry; struct wl_signal ping_timeout; } events; diff --git a/xwayland/xwm.c b/xwayland/xwm.c index b3e6c885..b53759da 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -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_override_redirect); 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(xwm->xcb_conn, geometry_cookie, NULL); @@ -935,15 +936,25 @@ static void xwm_handle_configure_notify(struct wlr_xwm *xwm, return; } - xsurface->x = ev->x; - xsurface->y = ev->y; - xsurface->width = ev->width; - xsurface->height = ev->height; + 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->y = ev->y; + xsurface->width = ev->width; + xsurface->height = ev->height; + } if (xsurface->override_redirect != ev->override_redirect) { xsurface->override_redirect = ev->override_redirect; 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 |