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.
This commit is contained in:
Kristian Høgsberg 2013-08-22 16:20:44 -07:00
parent 122877d5e7
commit e89a8b6ba1

View File

@ -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