[PATCH weston 6/7] desktop-shell/client: Introduce helper variables

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


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

These variables will be much more useful in the following commit.
The indentation is off to avoid future diff noise.

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

diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index 6686e53..0f2af73 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -470,16 +470,20 @@ panel_resize_handler(struct widget *widget,
 {
 	struct panel_launcher *launcher;
 	struct panel *panel = data;
-	int x, y, w, h;
+	int by = height / 2;
+	int spacing = 10;
+	int x = spacing;
+	int y = spacing;
+	int w, h;
 
-	x = 10;
-	y = 16;
 	wl_list_for_each(launcher, &panel->launcher_list, link) {
 		w = cairo_image_surface_get_width(launcher->icon);
 		h = cairo_image_surface_get_height(launcher->icon);
+
+			y = by - h / 2;
 		widget_set_allocation(launcher->widget,
-				      x, y - h / 2, w + 1, h + 1);
-		x += w + 10;
+				      x, y, w + 1, h + 1);
+			x += w + spacing;
 	}
 
 	h = 20;
@@ -489,9 +493,12 @@ panel_resize_handler(struct widget *widget,
 	else /* CLOCK_FORMAT_MINUTES */
 		w = 170;
 
+		x = width - w - spacing;
+		y = by - h / 2;
+
 	if (panel->clock)
 		widget_set_allocation(panel->clock->widget,
-				      width - w - 8, y - h / 2, w + 1, h + 1);
+				      x, y, w + 1, h + 1);
 }
 
 static void
@@ -503,7 +510,8 @@ panel_configure(void *data,
 	struct surface *surface = window_get_user_data(window);
 	struct panel *panel = container_of(surface, struct panel, base);
 
-	window_schedule_resize(panel->window, width, 32);
+		height = 32;
+	window_schedule_resize(panel->window, width, height);
 }
 
 static void
-- 
2.9.0



More information about the wayland-devel mailing list