From: Rafael Antognolli <rafael.antogno...@intel.com>

The maximized and fullscreen state flags were added, but used only by
the original shell_surface_set_maximized and
shell_surface_set_fullscreen functions, keeping the previous behavior,
removing any other flag that is not the requested one.

Now new functions were added that will only set that specific flag,
allowing both states to be used at the same time.
---
 src/shell.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/src/shell.c b/src/shell.c
index 2c0ef6d..1619f6e 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1764,6 +1764,29 @@ shell_surface_set_maximized(struct wl_client *client,
 }
 
 static void
+shell_surface_state_set_maximized(struct wl_client *client,
+                                 struct wl_resource *resource,
+                                 struct wl_resource *output_resource)
+{
+       struct shell_surface *shsurf = resource->data;
+
+       if (!shsurf->next.maximized)
+               set_maximized(client, resource, output_resource);
+       shsurf->next.maximized = true;
+       shsurf->state_changed = true;
+}
+
+static void
+shell_surface_state_unset_maximized(struct wl_client *client,
+                                   struct wl_resource *resource)
+{
+       struct shell_surface *shsurf = resource->data;
+
+       shsurf->next.maximized = false;
+       shsurf->state_changed = true;
+}
+
+static void
 black_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy, 
int32_t width, int32_t height);
 
 static struct weston_surface *
@@ -1972,6 +1995,36 @@ shell_surface_set_fullscreen(struct wl_client *client,
 }
 
 static void
+shell_surface_state_set_fullscreen(struct wl_client *client,
+                                  struct wl_resource *resource,
+                                  uint32_t method,
+                                  uint32_t framerate,
+                                  struct wl_resource *output_resource)
+{
+       struct shell_surface *shsurf = wl_resource_get_user_data(resource);
+       struct weston_output *output;
+
+       if (output_resource)
+               output = wl_resource_get_user_data(output_resource);
+       else
+               output = NULL;
+
+       set_fullscreen(shsurf, method, framerate, output);
+       shsurf->next.fullscreen = true;
+       shsurf->state_changed = true;
+}
+
+static void
+shell_surface_state_unset_fullscreen(struct wl_client *client,
+                                    struct wl_resource *resource)
+{
+       struct shell_surface *shsurf = resource->data;
+
+       shsurf->next.fullscreen = false;
+       shsurf->state_changed = true;
+}
+
+static void
 set_xwayland(struct shell_surface *shsurf, int x, int y, uint32_t flags)
 {
        /* XXX: using the same fields for transient type */
@@ -2224,6 +2277,10 @@ static const struct wl_shell_surface_interface 
shell_surface_implementation = {
        shell_surface_set_maximized,
        shell_surface_set_title,
        shell_surface_set_class,
+       shell_surface_state_set_maximized,
+       shell_surface_state_unset_maximized,
+       shell_surface_state_set_fullscreen,
+       shell_surface_state_unset_fullscreen,
 };
 
 static void
-- 
1.7.11.7

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to