From: Quentin Glidic
Some shells (wl_shell) does not let the compositor control the surface
state and instead force one. Therefore, they cannot call
{maximized,fullscreen}_requested as these imply the compositor can still
opt-out.
This new callback is called whenever a state change requests a new size,
be it triggered by the client or the compositor.
Signed-off-by: Quentin Glidic
---
This patch works correctly as-is, but is RFC because I have yet to add
some API to support output choice in wl_shell.
libweston-desktop/internal.h | 12 +++
libweston-desktop/libweston-desktop.c | 8 +
libweston-desktop/libweston-desktop.h | 11 ++
libweston-desktop/surface.c | 36
libweston-desktop/wl-shell.c | 14 +---
libweston-desktop/xdg-shell-v5.c | 64 +--
libweston-desktop/xdg-shell-v6.c | 64 +--
libweston-desktop/xwayland.c | 11 --
8 files changed, 194 insertions(+), 26 deletions(-)
diff --git a/libweston-desktop/internal.h b/libweston-desktop/internal.h
index 763355bf..38386916 100644
--- a/libweston-desktop/internal.h
+++ b/libweston-desktop/internal.h
@@ -80,6 +80,9 @@ weston_desktop_api_maximized_requested(struct weston_desktop
*desktop,
void
weston_desktop_api_minimized_requested(struct weston_desktop *desktop,
struct weston_desktop_surface *surface);
+void
+weston_desktop_api_size_requested(struct weston_desktop *desktop,
+ struct weston_desktop_surface *surface);
void
weston_desktop_api_set_xwayland_position(struct weston_desktop *desktop,
@@ -123,6 +126,15 @@ struct weston_desktop_surface_implementation {
(*get_min_size)(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);
+
void (*destroy)(struct weston_desktop_surface *surface,
void *user_data);
};
diff --git a/libweston-desktop/libweston-desktop.c
b/libweston-desktop/libweston-desktop.c
index 48e90009..a5ae5bd9 100644
--- a/libweston-desktop/libweston-desktop.c
+++ b/libweston-desktop/libweston-desktop.c
@@ -243,6 +243,14 @@ weston_desktop_api_minimized_requested(struct
weston_desktop *desktop,
desktop->api.minimized_requested(surface, desktop->user_data);
}
+void
+weston_desktop_api_size_requested(struct weston_desktop *desktop,
+ struct weston_desktop_surface *surface)
+{
+ if (desktop->api.size_requested != NULL)
+ desktop->api.size_requested(surface, desktop->user_data);
+}
+
void
weston_desktop_api_set_xwayland_position(struct weston_desktop *desktop,
struct weston_desktop_surface *surface,
diff --git a/libweston-desktop/libweston-desktop.h
b/libweston-desktop/libweston-desktop.h
index 03b04c7b..8da10a49 100644
--- a/libweston-desktop/libweston-desktop.h
+++ b/libweston-desktop/libweston-desktop.h
@@ -80,6 +80,8 @@ struct weston_desktop_api {
bool maximized, void *user_data);
void (*minimized_requested)(struct weston_desktop_surface *surface,
void *user_data);
+ void (*size_requested)(struct weston_desktop_surface *surface,
+ void *user_data);
/** Position suggestion for an Xwayland window
*
@@ -192,6 +194,15 @@ weston_desktop_surface_get_max_size(struct
weston_desktop_surface *surface);
struct weston_size
weston_desktop_surface_get_min_size(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_pending_resizing(struct weston_desktop_surface
*surface);
+
#ifdef __cplusplus
}
#endif
diff --git a/libweston-desktop/surface.c b/libweston-desktop/surface.c
index d3be9364..50aa4f46 100644
--- a/libweston-desktop/surface.c
+++ b/libweston-desktop/surface.c
@@ -675,6 +675,42 @@ weston_desktop_surface_get_min_size(struct
weston_desktop_surface *surface)