summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);