libweston-desktop/xdg-shell: Check surface size against acknowledged size
We were checking against the pending size, which lead some clients (simple-egl) to crash because they sent a buffer before acknowledging the latest configure event. Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net> Tested-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com> Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
This commit is contained in:
@@ -60,6 +60,7 @@ struct weston_desktop_xdg_surface {
|
|||||||
} pending;
|
} pending;
|
||||||
struct {
|
struct {
|
||||||
struct weston_desktop_xdg_surface_state state;
|
struct weston_desktop_xdg_surface_state state;
|
||||||
|
struct weston_size size;
|
||||||
} next;
|
} next;
|
||||||
struct {
|
struct {
|
||||||
struct weston_desktop_xdg_surface_state state;
|
struct weston_desktop_xdg_surface_state state;
|
||||||
@@ -244,8 +245,8 @@ weston_desktop_xdg_surface_committed(struct weston_desktop_surface *dsurface,
|
|||||||
bool reconfigure = false;
|
bool reconfigure = false;
|
||||||
|
|
||||||
if (surface->next.state.maximized || surface->next.state.fullscreen)
|
if (surface->next.state.maximized || surface->next.state.fullscreen)
|
||||||
reconfigure = surface->pending.size.width != wsurface->width ||
|
reconfigure = surface->next.size.width != wsurface->width ||
|
||||||
surface->pending.size.height != wsurface->height;
|
surface->next.size.height != wsurface->height;
|
||||||
|
|
||||||
if (reconfigure) {
|
if (reconfigure) {
|
||||||
weston_desktop_xdg_surface_schedule_configure(surface, true);
|
weston_desktop_xdg_surface_schedule_configure(surface, true);
|
||||||
@@ -447,6 +448,7 @@ weston_desktop_xdg_surface_protocol_ack_configure(struct wl_client *wl_client,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
surface->next.state = surface->pending.state;
|
surface->next.state = surface->pending.state;
|
||||||
|
surface->next.size = surface->pending.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ struct weston_desktop_xdg_toplevel {
|
|||||||
} pending;
|
} pending;
|
||||||
struct {
|
struct {
|
||||||
struct weston_desktop_xdg_toplevel_state state;
|
struct weston_desktop_xdg_toplevel_state state;
|
||||||
|
struct weston_size size;
|
||||||
struct weston_size min_size, max_size;
|
struct weston_size min_size, max_size;
|
||||||
} next;
|
} next;
|
||||||
struct {
|
struct {
|
||||||
@@ -424,6 +425,7 @@ static void
|
|||||||
weston_desktop_xdg_toplevel_ack_configure(struct weston_desktop_xdg_toplevel *toplevel)
|
weston_desktop_xdg_toplevel_ack_configure(struct weston_desktop_xdg_toplevel *toplevel)
|
||||||
{
|
{
|
||||||
toplevel->next.state = toplevel->pending.state;
|
toplevel->next.state = toplevel->pending.state;
|
||||||
|
toplevel->next.size = toplevel->pending.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -626,8 +628,8 @@ weston_desktop_xdg_toplevel_committed(struct weston_desktop_xdg_toplevel *toplev
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if ((toplevel->next.state.maximized || toplevel->next.state.fullscreen) &&
|
if ((toplevel->next.state.maximized || toplevel->next.state.fullscreen) &&
|
||||||
(toplevel->pending.size.width != wsurface->width ||
|
(toplevel->next.size.width != wsurface->width ||
|
||||||
toplevel->pending.size.height != wsurface->height)) {
|
toplevel->next.size.height != wsurface->height)) {
|
||||||
struct weston_desktop_client *client =
|
struct weston_desktop_client *client =
|
||||||
weston_desktop_surface_get_client(toplevel->base.desktop_surface);
|
weston_desktop_surface_get_client(toplevel->base.desktop_surface);
|
||||||
struct wl_resource *client_resource =
|
struct wl_resource *client_resource =
|
||||||
|
|||||||
Reference in New Issue
Block a user