Currently the xwayland implementation of desktop surfaces doesn't do
anything when weston_desktop_surface_set_maximized/fullscreen() is called.
In order to support this, we have to add xwayland internal interfaces
for sending those requests to the xwayland window and call them when
needed.

Signed-off-by: Ilia Bozhinov <[email protected]>
---
 libweston-desktop/xwayland.c           | 26 ++++++++++++++++++++++++++
 xwayland/window-manager.c              | 24 ++++++++++++++++++++++++
 xwayland/xwayland-internal-interface.h |  2 ++
 3 files changed, 52 insertions(+)

diff --git a/libweston-desktop/xwayland.c b/libweston-desktop/xwayland.c
index 9ab9dfbf..751d466c 100644
--- a/libweston-desktop/xwayland.c
+++ b/libweston-desktop/xwayland.c
@@ -193,6 +193,18 @@ weston_desktop_xwayland_surface_get_maximized(struct 
weston_desktop_surface *dsu
        return surface->maximized;
 }
 
+static void
+weston_desktop_xwayland_surface_set_maximized(struct weston_desktop_surface 
*dsurface,
+                                             void *user_data, bool maximized)
+{
+       struct weston_desktop_xwayland_surface *surface = user_data;
+       struct weston_surface *wsurface =
+               weston_desktop_surface_get_surface(surface->surface);
+
+       surface->client_interface->send_maximized(wsurface, maximized);
+       surface->maximized = maximized;
+}
+
 static bool
 weston_desktop_xwayland_surface_get_fullscreen(struct weston_desktop_surface 
*dsurface,
                                               void *user_data)
@@ -202,12 +214,26 @@ weston_desktop_xwayland_surface_get_fullscreen(struct 
weston_desktop_surface *ds
        return surface->fullscreen;
 }
 
+static void
+weston_desktop_xwayland_surface_set_fullscreen(struct weston_desktop_surface 
*dsurface,
+               void *user_data, bool fullscreen)
+{
+       struct weston_desktop_xwayland_surface *surface = user_data;
+       struct weston_surface *wsurface =
+               weston_desktop_surface_get_surface(surface->surface);
+
+       surface->client_interface->send_fullscreen(wsurface, fullscreen);
+       surface->fullscreen = fullscreen;
+}
+
 static const struct weston_desktop_surface_implementation 
weston_desktop_xwayland_surface_internal_implementation = {
        .committed = weston_desktop_xwayland_surface_committed,
        .set_size = weston_desktop_xwayland_surface_set_size,
 
        .get_maximized = weston_desktop_xwayland_surface_get_maximized,
+       .set_maximized = weston_desktop_xwayland_surface_set_maximized,
        .get_fullscreen = weston_desktop_xwayland_surface_get_fullscreen,
+       .set_fullscreen = weston_desktop_xwayland_surface_set_fullscreen,
 
        .destroy = weston_desktop_xwayland_surface_destroy,
 };
diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
index b0f78e2d..66fd7936 100644
--- a/xwayland/window-manager.c
+++ b/xwayland/window-manager.c
@@ -2617,8 +2617,32 @@ send_position(struct weston_surface *surface, int32_t x, 
int32_t y)
        }
 }
 
+static void send_maximized(struct weston_surface *surface, bool maximized)
+{
+       struct weston_wm_window *window = get_wm_window(surface);
+
+       if (window->maximized_horz == maximized &&
+           window->maximized_vert == maximized)
+               return;
+
+       window->maximized_horz = window->maximized_vert = maximized;
+       weston_wm_window_set_net_wm_state(window);
+}
+
+static void send_fullscreen(struct weston_surface *surface, bool fullscreen)
+{
+       struct weston_wm_window *window = get_wm_window(surface);
+       if (window->fullscreen == fullscreen)
+               return;
+
+       window->fullscreen = fullscreen;
+       weston_wm_window_set_net_wm_state(window);
+}
+
 static const struct weston_xwayland_client_interface shell_client = {
        send_configure,
+       send_maximized,
+       send_fullscreen
 };
 
 static int
diff --git a/xwayland/xwayland-internal-interface.h 
b/xwayland/xwayland-internal-interface.h
index 10964440..48716b14 100644
--- a/xwayland/xwayland-internal-interface.h
+++ b/xwayland/xwayland-internal-interface.h
@@ -31,6 +31,8 @@ struct weston_desktop_xwayland_surface;
 
 struct weston_xwayland_client_interface {
        void (*send_configure)(struct weston_surface *surface, int32_t width, 
int32_t height);
+       void (*send_maximized)(struct weston_surface *surface, bool maximized);
+       void (*send_fullscreen)(struct weston_surface *surface, bool 
fullscreen);
 };
 
 struct weston_desktop_xwayland_interface {
-- 
2.13.0

_______________________________________________
wayland-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to