diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index ec722874..d307e480 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -4124,13 +4124,34 @@ desktop_shell_desktop_ready(struct wl_client *client, shell_fade_startup(shell); } +static void +desktop_shell_set_panel_position(struct wl_client *client, + struct wl_resource *resource, + uint32_t position) +{ + struct desktop_shell *shell = wl_resource_get_user_data(resource); + + if (position != DESKTOP_SHELL_PANEL_POSITION_TOP && + position != DESKTOP_SHELL_PANEL_POSITION_BOTTOM && + position != DESKTOP_SHELL_PANEL_POSITION_LEFT && + position != DESKTOP_SHELL_PANEL_POSITION_RIGHT) { + wl_resource_post_error(resource, + DESKTOP_SHELL_ERROR_INVALID_ARGUMENT, + "bad position argument"); + return; + } + + shell->panel_position = position; +} + static const struct desktop_shell_interface desktop_shell_implementation = { desktop_shell_set_background, desktop_shell_set_panel, desktop_shell_set_lock_surface, desktop_shell_unlock, desktop_shell_set_grab_surface, - desktop_shell_desktop_ready + desktop_shell_desktop_ready, + desktop_shell_set_panel_position }; static enum shell_surface_type @@ -5344,7 +5365,7 @@ bind_desktop_shell(struct wl_client *client, struct wl_resource *resource; resource = wl_resource_create(client, &desktop_shell_interface, - MIN(version, 2), id); + MIN(version, 3), id); if (client == shell->child.client) { wl_resource_set_implementation(resource, @@ -6265,7 +6286,7 @@ module_init(struct weston_compositor *ec, return -1; if (wl_global_create(ec->wl_display, - &desktop_shell_interface, 2, + &desktop_shell_interface, 3, shell, bind_desktop_shell) == NULL) return -1; @@ -6279,6 +6300,8 @@ module_init(struct weston_compositor *ec, shell->child.deathstamp = weston_compositor_get_time(); + shell->panel_position = DESKTOP_SHELL_PANEL_POSITION_TOP; + setup_output_destroy_handler(ec, shell); loop = wl_display_get_event_loop(ec->wl_display); diff --git a/desktop-shell/shell.h b/desktop-shell/shell.h index e994cdbe..c6ea3288 100644 --- a/desktop-shell/shell.h +++ b/desktop-shell/shell.h @@ -26,6 +26,8 @@ #include "compositor.h" +#include "desktop-shell-server-protocol.h" + enum animation_type { ANIMATION_NONE, @@ -205,6 +207,8 @@ struct desktop_shell { struct wl_listener output_move_listener; struct wl_list output_list; + enum desktop_shell_panel_position panel_position; + char *client; }; diff --git a/protocol/desktop-shell.xml b/protocol/desktop-shell.xml index fdcb17ba..fb0b7481 100644 --- a/protocol/desktop-shell.xml +++ b/protocol/desktop-shell.xml @@ -1,6 +1,6 @@ - + Traditional user interfaces can rely on this interface to define the foundations of typical desktops. Currently it's possible to set up @@ -94,6 +94,29 @@ + + + + + + + + + + + + + + + + + Tell the shell which side of the screen the panel is + located. This is so that new windows do not overlap the panel + and maximized windows maximize properly. + + +