diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 2ab7d72db..e9f740872 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -2177,7 +2177,8 @@ set_fullscreen(struct shell_surface *shsurf, bool fullscreen, } weston_desktop_surface_set_orientation(shsurf->desktop_surface, WESTON_TOP_LEVEL_TILED_ORIENTATION_NONE); - } else if (weston_desktop_surface_get_maximized(desktop_surface)) { + } else if (weston_desktop_surface_get_maximized(desktop_surface) || + weston_desktop_surface_get_pending_maximized(desktop_surface)) { get_maximized_size(shsurf, &width, &height); } weston_desktop_surface_set_fullscreen(desktop_surface, fullscreen); diff --git a/include/libweston/desktop.h b/include/libweston/desktop.h index 3536935b9..dd09c887c 100644 --- a/include/libweston/desktop.h +++ b/include/libweston/desktop.h @@ -201,6 +201,14 @@ weston_desktop_surface_get_maximized(struct weston_desktop_surface *surface); bool weston_desktop_surface_get_fullscreen(struct weston_desktop_surface *surface); bool +weston_desktop_surface_get_pending_resizing(struct weston_desktop_surface *surface); +bool +weston_desktop_surface_get_pending_activated(struct weston_desktop_surface *surface); +bool +weston_desktop_surface_get_pending_maximized(struct weston_desktop_surface *surface); +bool +weston_desktop_surface_get_pending_fullscreen(struct weston_desktop_surface *surface); +bool weston_desktop_surface_get_resizing(struct weston_desktop_surface *surface); struct weston_geometry weston_desktop_surface_get_geometry(struct weston_desktop_surface *surface); diff --git a/libweston/desktop/internal.h b/libweston/desktop/internal.h index 1d035d5c4..c6c93d4a9 100644 --- a/libweston/desktop/internal.h +++ b/libweston/desktop/internal.h @@ -123,6 +123,14 @@ struct weston_desktop_surface_implementation { void *user_data); bool (*get_resizing)(struct weston_desktop_surface *surface, void *user_data); + bool (*get_pending_activated)(struct weston_desktop_surface *surface, + void *user_data); + bool (*get_pending_fullscreen)(struct weston_desktop_surface *surface, + void *user_data); + bool (*get_pending_maximized)(struct weston_desktop_surface *surface, + void *user_data); + bool (*get_pending_resizing)(struct weston_desktop_surface *surface, + void *user_data); struct weston_size (*get_max_size)(struct weston_desktop_surface *surface, void *user_data); diff --git a/libweston/desktop/surface.c b/libweston/desktop/surface.c index 30b9cdcee..e76111f04 100644 --- a/libweston/desktop/surface.c +++ b/libweston/desktop/surface.c @@ -665,6 +665,42 @@ weston_desktop_surface_get_fullscreen(struct weston_desktop_surface *surface) surface->implementation_data); } +WL_EXPORT bool +weston_desktop_surface_get_pending_activated(struct weston_desktop_surface *surface) +{ + if (surface->implementation->get_pending_activated == NULL) + return false; + return surface->implementation->get_pending_activated(surface, + surface->implementation_data); +} + +WL_EXPORT bool +weston_desktop_surface_get_pending_resizing(struct weston_desktop_surface *surface) +{ + if (surface->implementation->get_pending_resizing == NULL) + return false; + return surface->implementation->get_pending_resizing(surface, + surface->implementation_data); +} + +WL_EXPORT bool +weston_desktop_surface_get_pending_maximized(struct weston_desktop_surface *surface) +{ + if (surface->implementation->get_pending_maximized == NULL) + return false; + return surface->implementation->get_pending_maximized(surface, + surface->implementation_data); +} + +WL_EXPORT bool +weston_desktop_surface_get_pending_fullscreen(struct weston_desktop_surface *surface) +{ + if (surface->implementation->get_pending_fullscreen == NULL) + return false; + return surface->implementation->get_pending_fullscreen(surface, + surface->implementation_data); +} + WL_EXPORT struct weston_geometry weston_desktop_surface_get_geometry(struct weston_desktop_surface *surface) { diff --git a/libweston/desktop/xdg-shell-v6.c b/libweston/desktop/xdg-shell-v6.c index 8aacc53ae..3cf6e8afa 100644 --- a/libweston/desktop/xdg-shell-v6.c +++ b/libweston/desktop/xdg-shell-v6.c @@ -720,6 +720,42 @@ weston_desktop_xdg_toplevel_get_activated(struct weston_desktop_surface *dsurfac return toplevel->current.state.activated; } +static bool +weston_desktop_xdg_toplevel_get_pending_maximized(struct weston_desktop_surface *dsurface, + void *user_data) +{ + struct weston_desktop_xdg_toplevel *toplevel = user_data; + + return toplevel->pending.state.maximized; +} + +static bool +weston_desktop_xdg_toplevel_get_pending_fullscreen(struct weston_desktop_surface *dsurface, + void *user_data) +{ + struct weston_desktop_xdg_toplevel *toplevel = user_data; + + return toplevel->pending.state.fullscreen; +} + +static bool +weston_desktop_xdg_toplevel_get_pending_resizing(struct weston_desktop_surface *dsurface, + void *user_data) +{ + struct weston_desktop_xdg_toplevel *toplevel = user_data; + + return toplevel->pending.state.resizing; +} + +static bool +weston_desktop_xdg_toplevel_get_pending_activated(struct weston_desktop_surface *dsurface, + void *user_data) +{ + struct weston_desktop_xdg_toplevel *toplevel = user_data; + + return toplevel->pending.state.activated; +} + static void weston_desktop_xdg_toplevel_destroy(struct weston_desktop_xdg_toplevel *toplevel) { @@ -1312,6 +1348,11 @@ static const struct weston_desktop_surface_implementation weston_desktop_xdg_sur .get_resizing = weston_desktop_xdg_toplevel_get_resizing, .get_activated = weston_desktop_xdg_toplevel_get_activated, + .get_pending_maximized = weston_desktop_xdg_toplevel_get_pending_maximized, + .get_pending_fullscreen = weston_desktop_xdg_toplevel_get_pending_fullscreen, + .get_pending_resizing = weston_desktop_xdg_toplevel_get_pending_resizing, + .get_pending_activated = weston_desktop_xdg_toplevel_get_pending_activated, + /* These are used for popup only */ .update_position = weston_desktop_xdg_popup_update_position, diff --git a/libweston/desktop/xdg-shell.c b/libweston/desktop/xdg-shell.c index 88b9f72bb..1bcbbaf7a 100644 --- a/libweston/desktop/xdg-shell.c +++ b/libweston/desktop/xdg-shell.c @@ -825,6 +825,42 @@ weston_desktop_xdg_toplevel_get_activated(struct weston_desktop_surface *dsurfac return toplevel->current.state.activated; } +static bool +weston_desktop_xdg_toplevel_get_pending_maximized(struct weston_desktop_surface *dsurface, + void *user_data) +{ + struct weston_desktop_xdg_toplevel *toplevel = user_data; + + return toplevel->pending.state.maximized; +} + +static bool +weston_desktop_xdg_toplevel_get_pending_fullscreen(struct weston_desktop_surface *dsurface, + void *user_data) +{ + struct weston_desktop_xdg_toplevel *toplevel = user_data; + + return toplevel->pending.state.fullscreen; +} + +static bool +weston_desktop_xdg_toplevel_get_pending_resizing(struct weston_desktop_surface *dsurface, + void *user_data) +{ + struct weston_desktop_xdg_toplevel *toplevel = user_data; + + return toplevel->pending.state.resizing; +} + +static bool +weston_desktop_xdg_toplevel_get_pending_activated(struct weston_desktop_surface *dsurface, + void *user_data) +{ + struct weston_desktop_xdg_toplevel *toplevel = user_data; + + return toplevel->pending.state.activated; +} + static void weston_desktop_xdg_toplevel_destroy(struct weston_desktop_xdg_toplevel *toplevel) { @@ -1523,6 +1559,11 @@ static const struct weston_desktop_surface_implementation weston_desktop_xdg_sur .get_resizing = weston_desktop_xdg_toplevel_get_resizing, .get_activated = weston_desktop_xdg_toplevel_get_activated, + .get_pending_maximized = weston_desktop_xdg_toplevel_get_pending_maximized, + .get_pending_fullscreen = weston_desktop_xdg_toplevel_get_pending_fullscreen, + .get_pending_resizing = weston_desktop_xdg_toplevel_get_pending_resizing, + .get_pending_activated = weston_desktop_xdg_toplevel_get_pending_activated, + /* These are used for popup only */ .update_position = weston_desktop_xdg_popup_update_position,