Commit f19b00ed authored by Jonny Lamb's avatar Jonny Lamb
Browse files

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.
parent b1536ac5
......@@ -12,6 +12,10 @@
<arg name="existing_surface" type="object" interface="wl_surface"/>
<request name="set_panel">
<arg name="surface" type="object" interface="wl_surface"/>
<request name="slide_surface">
<arg name="surface" type="object" interface="wl_surface"/>
<arg name="x" type="int"/>
......@@ -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,
shell_helper_set_panel (desktop->helper, panel->surface);
gtk_widget_show_all (panel->window);
......@@ -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->, struct weston_view, surface_link);
if (wl_list_empty(&view->layer_link)) {
wl_list_insert(&helper->panel_layer->view_list, &view->layer_link);
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 =
struct weston_view *view = container_of(surface->,
struct weston_view,
/* 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,
/* set new configure functions that only ensure the surface is in the
* correct layer. */
surface->configure = configure_panel;
surface->configure_private = helper;
enum SlideState {
......@@ -276,6 +320,7 @@ shell_helper_slide_surface_back(struct wl_client *client,
static const struct shell_helper_interface helper_implementation = {
......@@ -312,6 +357,7 @@ module_init(struct weston_compositor *ec,
return -1;
helper->compositor = ec;
helper->panel_layer = NULL;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment