[PATCH weston 3/7] desktop-shell: Properly position the panel surface

Quentin Glidic sardemff7+wayland at sardemff7.net
Thu Jun 23 16:55:20 UTC 2016


From: Quentin Glidic <sardemff7+git at sardemff7.net>

Now weston actually supports putting the panel at the bottom of the
screen.

Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
---
 desktop-shell/shell.c | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index a5fca56..2bb92df 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -4335,7 +4335,7 @@ static void
 shell_fade(struct desktop_shell *shell, enum fade_type type);
 
 static void
-configure_static_view(struct weston_view *ev, struct weston_layer *layer)
+configure_static_view(struct weston_view *ev, struct weston_layer *layer, int x, int y)
 {
 	struct weston_view *v, *next;
 
@@ -4347,7 +4347,7 @@ configure_static_view(struct weston_view *ev, struct weston_layer *layer)
 		}
 	}
 
-	weston_view_set_position(ev, ev->output->x, ev->output->y);
+	weston_view_set_position(ev, ev->output->x + x, ev->output->y + y);
 
 	if (wl_list_empty(&ev->layer_link.link)) {
 		weston_layer_entry_insert(&layer->view_list, &ev->layer_link);
@@ -4384,7 +4384,7 @@ background_configure(struct weston_surface *es, int32_t sx, int32_t sy)
 
 	view = container_of(es->views.next, struct weston_view, surface_link);
 
-	configure_static_view(view, &shell->background_layer);
+	configure_static_view(view, &shell->background_layer, 0, 0);
 }
 
 static void
@@ -4449,10 +4449,26 @@ panel_configure(struct weston_surface *es, int32_t sx, int32_t sy)
 {
 	struct desktop_shell *shell = es->configure_private;
 	struct weston_view *view;
+	int width, height;
+	int x = 0, y = 0;
 
 	view = container_of(es->views.next, struct weston_view, surface_link);
 
-	configure_static_view(view, &shell->panel_layer);
+	get_panel_size(shell, view, &width, &height);
+	switch (shell->panel_position) {
+	case WESTON_DESKTOP_SHELL_PANEL_POSITION_TOP:
+		break;
+	case WESTON_DESKTOP_SHELL_PANEL_POSITION_BOTTOM:
+		y = view->output->height - height;
+		break;
+	case WESTON_DESKTOP_SHELL_PANEL_POSITION_LEFT:
+		break;
+	case WESTON_DESKTOP_SHELL_PANEL_POSITION_RIGHT:
+		x = view->output->width - width;
+		break;
+	}
+
+	configure_static_view(view, &shell->panel_layer, x, y);
 }
 
 static void
-- 
2.9.0



More information about the wayland-devel mailing list