[PATCH v5 4/4] add implementation for set_maximised

juan.j.zhao at linux.intel.com juan.j.zhao at linux.intel.com
Mon Jan 16 22:17:50 PST 2012


From: Juan Zhao <juan.j.zhao at linux.intel.com>

Signed-off-by: Juan Zhao <juan.j.zhao at linux.intel.com>
Signed-off-by: Zhiwen Wu <zhiwen.wu at linux.intel.com>
---
 src/shell.c |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/src/shell.c b/src/shell.c
index cba0556..8da38b7 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -409,6 +409,55 @@ get_default_output(struct weston_compositor *compositor)
 			    struct weston_output, link);
 }
 
+static struct wl_shell *
+shell_surface_get_shell(struct shell_surface *shsurf)
+{
+	struct weston_surface *es = shsurf->surface;
+	struct weston_shell *shell=es->compositor->shell;
+
+	return (struct wl_shell *)container_of(shell, struct wl_shell, shell);
+}
+
+static void
+shell_surface_set_maximised(struct wl_client *client,
+			    struct wl_resource *resource)
+{
+	struct shell_surface *shsurf = resource->data;
+	struct weston_surface *es = shsurf->surface;
+	struct weston_output *output = NULL;
+	struct wl_shell *wlshell = NULL;
+	uint32_t edges = 0, panel_height = 0;
+	struct shell_surface *priv;
+
+	if (reset_shell_surface_type(shsurf))
+		return;
+
+	/* FIXME: set maximised on first output */
+	/* FIXME: Handle output going away */
+	output = get_default_output(es->compositor);
+	es->output = output;
+
+	shsurf->saved_x = es->x;
+	shsurf->saved_y = es->y;
+
+	wlshell = shell_surface_get_shell(shsurf);
+	wl_list_for_each(priv, &wlshell->panels, link) {
+		if (priv->output == es->output) {
+			panel_height = priv->surface->height;
+			break;
+		}
+	}
+
+	es->x = 0;
+	es->y = panel_height;
+	edges = WL_SHELL_SURFACE_RESIZE_TOP|WL_SHELL_SURFACE_RESIZE_LEFT;
+	wl_resource_post_event(&shsurf->resource,
+			       WL_SHELL_SURFACE_CONFIGURE,
+			       weston_compositor_get_time(), edges,
+			       output->current->width, output->current->height-panel_height);
+	weston_surface_damage(es);
+}
+
 static void
 shell_surface_set_fullscreen(struct wl_client *client,
 			     struct wl_resource *resource, uint32_t method,
@@ -576,7 +625,7 @@ static const struct wl_shell_surface_interface shell_surface_implementation = {
 	shell_surface_set_toplevel,
 	shell_surface_set_transient,
 	shell_surface_set_fullscreen,
-	NULL,
+	shell_surface_set_maximised,
 	shell_surface_set_popup
 };
 
@@ -1141,7 +1190,6 @@ map(struct weston_shell *base,
 	struct weston_compositor *compositor = shell->compositor;
 	struct wl_list *list;
 	struct shell_surface *shsurf;
-	struct weston_output *fs_output = surface->fs_support.fullscreen_output;
 	enum shell_surface_type surface_type = SHELL_SURFACE_NONE;
 	int do_configure;
 
-- 
1.7.2.2



More information about the wayland-devel mailing list