summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2014-05-09 18:03:24 +0100
committerJonny Lamb <jonny.lamb@collabora.co.uk>2014-05-09 18:03:24 +0100
commitf19b00ed0d4f8445e33ea77dea72199b5d455c3c (patch)
tree9ddc00cd16e557ef22b1f6c9c77b310007fa55ad
parentb1536ac5c82ed1549d2a57c4632952bee0f23dfd (diff)
downloadgraynard-f19b00ed0d4f8445e33ea77dea72199b5d455c3c.tar.gz
graynard-f19b00ed0d4f8445e33ea77dea72199b5d455c3c.zip
shell-helper: add set_panel request to override surface configure
The weston_surface's configure function defined by weston's desktop-shell module had loads of things we don't want such as moving the surface to 0,0 and removing all other surface's from the panel layer. By setting our own configure function we can only do the things we want.
-rw-r--r--protocol/shell-helper.xml4
-rw-r--r--shell/maynard.c1
-rw-r--r--shell/shell-helper.c46
3 files changed, 51 insertions, 0 deletions
diff --git a/protocol/shell-helper.xml b/protocol/shell-helper.xml
index e9e324d..404b775 100644
--- a/protocol/shell-helper.xml
+++ b/protocol/shell-helper.xml
@@ -12,6 +12,10 @@
<arg name="existing_surface" type="object" interface="wl_surface"/>
</request>
+ <request name="set_panel">
+ <arg name="surface" type="object" interface="wl_surface"/>
+ </request>
+
<request name="slide_surface">
<arg name="surface" type="object" interface="wl_surface"/>
<arg name="x" type="int"/>
diff --git a/shell/maynard.c b/shell/maynard.c
index d9c8f10..a6c7e6d 100644
--- a/shell/maynard.c
+++ b/shell/maynard.c
@@ -434,6 +434,7 @@ panel_create (struct desktop *desktop)
desktop_shell_set_panel (desktop->shell, desktop->output, panel->surface);
desktop_shell_set_panel_position (desktop->shell,
DESKTOP_SHELL_PANEL_POSITION_LEFT);
+ shell_helper_set_panel (desktop->helper, panel->surface);
gtk_widget_show_all (panel->window);
diff --git a/shell/shell-helper.c b/shell/shell-helper.c
index 4806ef5..111d483 100644
--- a/shell/shell-helper.c
+++ b/shell/shell-helper.c
@@ -31,6 +31,8 @@ struct shell_helper {
struct wl_listener destroy_listener;
+ struct weston_layer *panel_layer;
+
struct wl_list slide_list;
};
@@ -104,6 +106,48 @@ shell_helper_add_surface_to_layer(struct wl_client *client,
new_surface->output = existing_view->output;
}
+static void
+configure_panel(struct weston_surface *es, int32_t sx, int32_t sy)
+{
+ struct shell_helper *helper = es->configure_private;
+ struct weston_view *view;
+
+ view = container_of(es->views.next, struct weston_view, surface_link);
+
+ if (wl_list_empty(&view->layer_link)) {
+ wl_list_insert(&helper->panel_layer->view_list, &view->layer_link);
+ weston_compositor_schedule_repaint(es->compositor);
+ }
+}
+
+static void
+shell_helper_set_panel(struct wl_client *client,
+ struct wl_resource *resource,
+ struct wl_resource *surface_resource)
+{
+ struct shell_helper *helper = wl_resource_get_user_data(resource);
+ struct weston_surface *surface =
+ wl_resource_get_user_data(surface_resource);
+ struct weston_view *view = container_of(surface->views.next,
+ struct weston_view,
+ surface_link);
+
+ /* we need to save the panel's layer so we can use it later on, but
+ * it hasn't yet been defined because the original surface configure
+ * function hasn't yet been calld. if we call it here we will have
+ * access to the layer. */
+ surface->configure(surface, 0, 0);
+
+ helper->panel_layer = container_of(&view->layer_link,
+ struct weston_layer,
+ view_list);
+
+ /* set new configure functions that only ensure the surface is in the
+ * correct layer. */
+ surface->configure = configure_panel;
+ surface->configure_private = helper;
+}
+
enum SlideState {
SLIDE_STATE_NONE,
SLIDE_STATE_SLIDING_OUT,
@@ -276,6 +320,7 @@ shell_helper_slide_surface_back(struct wl_client *client,
static const struct shell_helper_interface helper_implementation = {
shell_helper_move_surface,
shell_helper_add_surface_to_layer,
+ shell_helper_set_panel,
shell_helper_slide_surface,
shell_helper_slide_surface_back
};
@@ -312,6 +357,7 @@ module_init(struct weston_compositor *ec,
return -1;
helper->compositor = ec;
+ helper->panel_layer = NULL;
wl_list_init(&helper->slide_list);