From e89a8b6ba15a2239d84c79178410017bfe7172bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 22 Aug 2013 16:20:44 -0700 Subject: [PATCH] xwm: Fix transform listener The coordinate transformation was broken (worked for first output where output->x/y was 0,0, broke on all other outputs). We can just use surface->geometry.x/y directly. We can't use the full transformation, the best we can do is to move the X window to the geometry.x/y location. Get rid of the static old_sx/sy hack as well. --- src/xwayland/window-manager.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c index a18bb0e5..3d36f70e 100644 --- a/src/xwayland/window-manager.c +++ b/src/xwayland/window-manager.c @@ -647,11 +647,7 @@ weston_wm_window_transform(struct wl_listener *listener, void *data) struct weston_wm_window *window = get_wm_window(surface); struct weston_wm *wm = container_of(listener, struct weston_wm, transform_listener); - struct weston_output *output = surface->output; uint32_t mask, values[2]; - float sxf, syf; - int sx, sy; - static int old_sx = -1, old_sy = -1; if (!window || !wm) return; @@ -659,24 +655,15 @@ weston_wm_window_transform(struct wl_listener *listener, void *data) if (!weston_surface_is_mapped(surface)) return; - weston_surface_to_global_float(surface, output->x, output->y, - &sxf, &syf); + if (window->x != surface->geometry.x || + window->y != surface->geometry.y) { + values[0] = surface->geometry.x; + values[1] = surface->geometry.y; + mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y; - sx = (int) sxf; - sy = (int) syf; - - if (old_sx == sx && old_sy == sy) - return; - - values[0] = sx; - values[1] = sy; - mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y; - - xcb_configure_window(wm->conn, window->frame_id, mask, values); - xcb_flush(wm->conn); - - old_sx = sx; - old_sy = sy; + xcb_configure_window(wm->conn, window->frame_id, mask, values); + xcb_flush(wm->conn); + } } #define ICCCM_WITHDRAWN_STATE 0