[PATCH v2 2/2] shell: Add set_maximised for wl_shell_surface interface.
juan.j.zhao at linux.intel.com
juan.j.zhao at linux.intel.com
Mon Jan 9 06:54:20 PST 2012
From: Alex Wu <zhiwen.wu at linux.intel.com>
mainly send a configure event to the client
Signed-off-by: Juan Zhao <juan.j.zhao at linux.intel.com>
Signed-off-by: Alex Wu <zhiwen.wu at linux.intel.com>
---
src/shell.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/src/shell.c b/src/shell.c
index d12bc1a..b93bfa3 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -408,6 +408,53 @@ get_default_output(struct weston_compositor *compositor)
}
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;
+ 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;
+
+
+ /*FIXME: get the panel width and height of the first panel*/
+ struct weston_compositor *ec = output->compositor;
+ wl_list_for_each(es_temp, &ec->surface_list, link) {
+ if((es_temp->type == WESTON_SURFACE_TYPE_PANEL) &&
+ ((panel_width < es_temp->width) ||
+ (panel_height < es_temp->height))){
+ panel_width = es_temp->width;
+ panel_height = es_temp->height;
+ break;
+ }
+ }
+
+ /*FIXME: the pannel is on the top-left*/
+ 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);
+}
+
+
+
+static void
shell_surface_set_fullscreen(struct wl_client *client,
struct wl_resource *resource, uint32_t framerate,
uint32_t flags)
@@ -574,6 +621,7 @@ static const struct wl_shell_surface_interface shell_surface_implementation = {
shell_surface_set_toplevel,
shell_surface_set_transient,
shell_surface_set_fullscreen,
+ shell_surface_set_maximised,
shell_surface_set_popup
};
--
1.7.5.4
More information about the wayland-devel
mailing list