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:
@@ -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_window *window = get_wm_window(surface);
|
||||||
struct weston_wm *wm =
|
struct weston_wm *wm =
|
||||||
container_of(listener, struct weston_wm, transform_listener);
|
container_of(listener, struct weston_wm, transform_listener);
|
||||||
struct weston_output *output = surface->output;
|
|
||||||
uint32_t mask, values[2];
|
uint32_t mask, values[2];
|
||||||
float sxf, syf;
|
|
||||||
int sx, sy;
|
|
||||||
static int old_sx = -1, old_sy = -1;
|
|
||||||
|
|
||||||
if (!window || !wm)
|
if (!window || !wm)
|
||||||
return;
|
return;
|
||||||
@@ -659,24 +655,15 @@ weston_wm_window_transform(struct wl_listener *listener, void *data)
|
|||||||
if (!weston_surface_is_mapped(surface))
|
if (!weston_surface_is_mapped(surface))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
weston_surface_to_global_float(surface, output->x, output->y,
|
if (window->x != surface->geometry.x ||
|
||||||
&sxf, &syf);
|
window->y != surface->geometry.y) {
|
||||||
|
values[0] = surface->geometry.x;
|
||||||
sx = (int) sxf;
|
values[1] = surface->geometry.y;
|
||||||
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;
|
mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y;
|
||||||
|
|
||||||
xcb_configure_window(wm->conn, window->frame_id, mask, values);
|
xcb_configure_window(wm->conn, window->frame_id, mask, values);
|
||||||
xcb_flush(wm->conn);
|
xcb_flush(wm->conn);
|
||||||
|
}
|
||||||
old_sx = sx;
|
|
||||||
old_sy = sy;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ICCCM_WITHDRAWN_STATE 0
|
#define ICCCM_WITHDRAWN_STATE 0
|
||||||
|
|||||||
Reference in New Issue
Block a user