xwayland: Don't move window in response to geometry change if state changed

When we leave fullscreen or maximized mode we restore a saved window
position. This is expected, but that saved position was saved when window
geometry was set to have shadows rendered.

Since we restore a saved position that had shadow geometry, we don't want
to move the window when we set geometry again, or we'll move away from the
intended saved position.

I guess this is a counter-proposal to !614

Fixes #454

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
dev
Derek Foreman 2 years ago
parent 40e76fe19d
commit 93b58c5648
  1. 13
      libweston-desktop/xwayland.c

@ -64,6 +64,7 @@ struct weston_desktop_xwayland_surface {
bool committed; bool committed;
bool added; bool added;
enum weston_desktop_xwayland_surface_state state; enum weston_desktop_xwayland_surface_state state;
enum weston_desktop_xwayland_surface_state prev_state;
}; };
static void static void
@ -150,8 +151,16 @@ weston_desktop_xwayland_surface_committed(struct weston_desktop_surface *dsurfac
if (surface->has_next_geometry) { if (surface->has_next_geometry) {
oldgeom = weston_desktop_surface_get_geometry(surface->surface); oldgeom = weston_desktop_surface_get_geometry(surface->surface);
sx -= surface->next_geometry.x - oldgeom.x; /* If we're transitioning away from fullscreen or maximized
sy -= surface->next_geometry.y - oldgeom.y; * we've moved to old saved co-ordinates that were saved
* with window geometry in place, so avoid adajusting by
* the geometry in those cases.
*/
if (surface->state == surface->prev_state) {
sx -= surface->next_geometry.x - oldgeom.x;
sy -= surface->next_geometry.y - oldgeom.y;
}
surface->prev_state = surface->state;
surface->has_next_geometry = false; surface->has_next_geometry = false;
weston_desktop_surface_set_geometry(surface->surface, weston_desktop_surface_set_geometry(surface->surface,

Loading…
Cancel
Save