Re: [RFC weston] libweston-desktop: Add size_requested API

2017-06-23 Thread Daniel Stone
Hi Quentin,

On 21 March 2017 at 11:53, Quentin Glidic
 wrote:
> 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.

I'd appreciate if this were split so the requested_size ->
pending_size name change is split. (That has my Acked-by.)

Similarly, the new get_pending_* API has my Acked-by; there are no
users, but it seems entirely straightforward.

Would be good to merge them before we have an alpha, which is I guess
still a couple of weeks away.

The bit which really confuses me is that none of the shells actually
implement size_requested. If no shells implement it, and no users use
get_pending_*, what effect does this actually have? Having it
implemented somewhere might clear things up a bit.

Cheers,
Daniel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[RFC weston] libweston-desktop: Add size_requested API

2017-03-21 Thread Quentin Glidic
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)