struct wl_list hidden_surface_list;
};
+enum shell_surface_purpose {
+ SHELL_SURFACE_NORMAL,
+ SHELL_SURFACE_PANEL,
+ SHELL_SURFACE_BACKGROUND,
+ SHELL_SURFACE_LOCK,
+};
+
struct shell_surface {
struct wl_listener destroy_listener;
+
+ enum shell_surface_purpose purpose;
};
struct wlsc_move_grab {
surface->shell_priv = priv;
+ priv->purpose = SHELL_SURFACE_NORMAL;
+
return priv;
}
struct wlsc_output *output =
container_of(shell->compositor->output_list.next,
struct wlsc_output, link);
+ struct shell_surface *priv;
shell->background = surface_resource->data;
shell->background_listener.func = handle_background_surface_destroy;
wl_list_insert(&surface_resource->destroy_listener_list,
&shell->background_listener.link);
+ priv = get_shell_surface(surface);
+ priv->purpose = SHELL_SURFACE_BACKGROUND;
+
wl_resource_post_event(resource,
DESKTOP_SHELL_CONFIGURE,
wlsc_compositor_get_time(), 0, surface,
struct wlsc_output *output =
container_of(shell->compositor->output_list.next,
struct wlsc_output, link);
+ struct shell_surface *priv;
shell->panel = surface_resource->data;
wl_list_insert(&surface_resource->destroy_listener_list,
&shell->panel_listener.link);
+ priv = get_shell_surface(shell->panel);
+ priv->purpose = SHELL_SURFACE_PANEL;
+
wl_resource_post_event(resource,
DESKTOP_SHELL_CONFIGURE,
wlsc_compositor_get_time(), 0, surface_resource,
struct wl_resource *surface_resource)
{
struct wl_shell *shell = resource->data;
+ struct shell_surface *priv;
shell->prepare_event_sent = false;
shell->lock_surface_listener.func = handle_lock_surface_destroy;
wl_list_insert(&surface_resource->destroy_listener_list,
&shell->lock_surface_listener.link);
+
+ priv = get_shell_surface(shell->lock_surface);
+ priv->purpose = SHELL_SURFACE_LOCK;
}
static void
{
struct wl_shell *shell = container_of(base, struct wl_shell, shell);
struct wlsc_compositor *compositor = shell->compositor;
+ struct shell_surface *priv;
+
+ priv = get_shell_surface(es);
wlsc_surface_activate(es, device, time);
if (compositor->wxs)
wlsc_xserver_surface_activate(es);
- if (es == shell->background) {
+ switch (priv->purpose) {
+ case SHELL_SURFACE_BACKGROUND:
+ /* put background back to bottom */
wl_list_remove(&es->link);
wl_list_insert(compositor->surface_list.prev, &es->link);
- } else if (shell->panel && !shell->locked) {
- wl_list_remove(&shell->panel->link);
- wl_list_insert(&compositor->surface_list, &shell->panel->link);
+ break;
+ case SHELL_SURFACE_PANEL:
+ /* already put on top */
+ break;
+ default:
+ if (shell->panel && !shell->locked) {
+ /* bring panel back to top */
+ wl_list_remove(&shell->panel->link);
+ wl_list_insert(&compositor->surface_list,
+ &shell->panel->link);
+ }
}
}
struct wl_list *surface_list = &shell->compositor->surface_list;
struct wlsc_surface *cur;
struct wlsc_surface *tmp;
+ struct shell_surface *priv;
struct wlsc_input_device *device;
uint32_t time;
if (cur->surface.resource.client == NULL)
continue;
- if (cur == shell->background)
+ priv = get_shell_surface(cur);
+ if (priv->purpose == SHELL_SURFACE_BACKGROUND)
continue;
cur->output = NULL;
struct wl_shell *shell = container_of(base, struct wl_shell, shell);
struct wlsc_compositor *compositor = shell->compositor;
struct wl_list *list;
+ struct shell_surface *priv;
+
+ priv = get_shell_surface(surface);
if (shell->locked)
list = &shell->hidden_surface_list;
list = &compositor->surface_list;
/* surface stacking order, see also activate() */
- if (surface == shell->background) {
+ switch (priv->purpose) {
+ case SHELL_SURFACE_BACKGROUND:
/* background always visible, at the bottom */
wl_list_insert(compositor->surface_list.prev, &surface->link);
-
- } else if (surface == shell->panel) {
+ break;
+ case SHELL_SURFACE_PANEL:
/* panel always on top, hidden while locked */
wl_list_insert(list, &surface->link);
-
- } else if (surface == shell->lock_surface) {
+ break;
+ case SHELL_SURFACE_LOCK:
/* lock surface always visible, on top */
wl_list_insert(&compositor->surface_list, &surface->link);
wlsc_compositor_repick(compositor);
- wlsc_compositor_wake(compositor);
- } else {
+ wlsc_compositor_wake(compositor);
+ break;
+ default:
/* everything else just below the panel */
- wl_list_insert(&shell->panel->link, &surface->link);
+ if (shell->panel)
+ wl_list_insert(&shell->panel->link, &surface->link);
+ else
+ wl_list_insert(list, &surface->link);
}
if (surface->map_type == WLSC_SURFACE_MAP_TOPLEVEL) {
surface->width = width;
surface->height = height;
- if (!shell->locked || surface == shell->lock_surface)
+ if (!shell->locked || priv->purpose == SHELL_SURFACE_LOCK)
wlsc_surface_configure(surface,
surface->x, surface->y, width, height);
}