desktop-shell/client: Introduce helper variables

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@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
dev
Quentin Glidic 9 years ago committed by Daniel Stone
parent 3e37b343a2
commit 51c2c37e0e
  1. 22
      clients/desktop-shell.c

@ -470,16 +470,20 @@ panel_resize_handler(struct widget *widget,
{ {
struct panel_launcher *launcher; struct panel_launcher *launcher;
struct panel *panel = data; 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) { wl_list_for_each(launcher, &panel->launcher_list, link) {
w = cairo_image_surface_get_width(launcher->icon); w = cairo_image_surface_get_width(launcher->icon);
h = cairo_image_surface_get_height(launcher->icon); h = cairo_image_surface_get_height(launcher->icon);
y = by - h / 2;
widget_set_allocation(launcher->widget, widget_set_allocation(launcher->widget,
x, y - h / 2, w + 1, h + 1); x, y, w + 1, h + 1);
x += w + 10; x += w + spacing;
} }
h = 20; h = 20;
@ -489,9 +493,12 @@ panel_resize_handler(struct widget *widget,
else /* CLOCK_FORMAT_MINUTES */ else /* CLOCK_FORMAT_MINUTES */
w = 170; w = 170;
x = width - w - spacing;
y = by - h / 2;
if (panel->clock) if (panel->clock)
widget_set_allocation(panel->clock->widget, widget_set_allocation(panel->clock->widget,
width - w - 8, y - h / 2, w + 1, h + 1); x, y, w + 1, h + 1);
} }
static void static void
@ -503,7 +510,8 @@ panel_configure(void *data,
struct surface *surface = window_get_user_data(window); struct surface *surface = window_get_user_data(window);
struct panel *panel = container_of(surface, struct panel, base); 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 static void

Loading…
Cancel
Save