[PATCH v3 3/4] add set_maximised implementation
juan.j.zhao at linux.intel.com
juan.j.zhao at linux.intel.com
Sun Jan 15 09:23:16 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 | 43 ++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 42 insertions(+), 1 deletions(-)
diff --git a/src/shell.c b/src/shell.c
index d19b449..c728c5f 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -416,6 +416,47 @@ shell_surface_get_shell(struct shell_surface *shsurf)
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_surface *es_temp = NULL;
+ struct weston_output *output = NULL;
+ struct wl_shell *wlshell = NULL;
+ uint32_t edges = 0, panel_width = 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_width = priv->surface->width;
+ 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,
@@ -583,7 +624,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
};
--
1.7.5.4
More information about the wayland-devel
mailing list