[PATCH 5/7] xdg-shell: Implement state set functions.

antognolli at gmail.com antognolli at gmail.com
Fri Jul 19 12:42:47 PDT 2013


From: Rafael Antognolli <rafael.antognolli at 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/xdg-surface.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/src/xdg-surface.c b/src/xdg-surface.c
index 82e3551..32fea0f 100644
--- a/src/xdg-surface.c
+++ b/src/xdg-surface.c
@@ -1770,6 +1770,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 *
@@ -1978,6 +2001,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 */
@@ -2232,6 +2285,10 @@ static const struct xdg_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



More information about the wayland-devel mailing list