Lines Matching +full:data +full:- +full:width

2 From: Jeffy Chen <jeffy.chen@rock-chips.com>
4 Subject: [PATCH 68/92] desktop-shell: Support setting panel scale in
9 panel-scale=2
11 Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
12 ---
13 clients/desktop-shell.c | 41 ++++++++++++++++++++++++++---------------
14 1 file changed, 26 insertions(+), 15 deletions(-)
16 diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
18 --- a/clients/desktop-shell.c
19 +++ b/clients/desktop-shell.c
20 @@ -110,6 +110,7 @@ struct panel {
28 @@ -242,17 +243,18 @@ panel_launcher_redraw_handler(struct widget *widget, void *data)
30 struct panel_launcher *launcher = data;
32 + double scale = launcher->panel->scale;
35 cr = widget_cairo_create(launcher->panel->widget);
38 allocation.x += allocation.width / 2 -
39 - cairo_image_surface_get_width(launcher->icon) / 2;
40 + cairo_image_surface_get_width(launcher->icon) * scale / 2;
41 if (allocation.width > allocation.height)
42 allocation.x += allocation.width / 2 - allocation.height / 2;
43 allocation.y += allocation.height / 2 -
44 - cairo_image_surface_get_height(launcher->icon) / 2;
45 + cairo_image_surface_get_height(launcher->icon) * scale / 2;
46 if (allocation.height > allocation.width)
47 allocation.y += allocation.height / 2 - allocation.width / 2;
48 if (launcher->pressed) {
49 @@ -260,14 +262,15 @@ panel_launcher_redraw_handler(struct widget *widget, void *data)
54 cairo_set_source_surface(cr, launcher->icon,
55 - allocation.x, allocation.y);
59 if (launcher->focused) {
61 cairo_mask_surface(cr, launcher->icon,
62 - allocation.x, allocation.y);
67 @@ -394,6 +397,8 @@ panel_clock_redraw_handler(struct widget *widget, void *data)
71 + double scale = clock->panel->scale;
76 @@ -404,11 +409,11 @@ panel_clock_redraw_handler(struct widget *widget, void *data)
79 cr = widget_cairo_create(clock->panel->widget);
80 - cairo_set_font_size(cr, 14);
85 - allocation.width - DEFAULT_SPACING * 1.5 - extents.width;
86 + allocation.width - spacing * 1.5 - extents.width;
89 allocation.width / 2 - extents.width / 2;
90 @@ -499,8 +504,10 @@ panel_resize_handler(struct widget *widget,
91 int w = height > width ? width : height;
93 …int horizontal = panel->panel_position == WESTON_DESKTOP_SHELL_PANEL_POSITION_TOP || panel->panel_…
94 - int first_pad_h = horizontal ? 0 : DEFAULT_SPACING / 2;
95 - int first_pad_w = horizontal ? DEFAULT_SPACING / 2 : 0;
96 + double scale = panel->scale;
101 wl_list_for_each(launcher, &panel->launcher_list, link) {
102 widget_set_allocation(launcher->widget, x, y,
103 @@ -513,14 +520,14 @@ panel_resize_handler(struct widget *widget,
106 if (panel->clock_format == CLOCK_FORMAT_SECONDS)
107 - w = 170;
110 - w = 150;
114 x = width - w;
116 - y = height - (h = DEFAULT_SPACING * 3);
117 + y = height - (h = spacing * 3);
119 if (panel->clock)
120 widget_set_allocation(panel->clock->widget,
121 @@ -552,21 +559,21 @@ panel_configure(void *data,
122 switch (desktop->panel_position) {
125 - height = 32;
126 + height = 32 * panel->scale;
130 switch (desktop->clock_format) {
132 - width = 32;
133 + width = 32 * panel->scale;
138 - width = 150;
139 + width = 150 * panel->scale;
142 - width = 170;
143 + width = 170 * panel->scale;
147 @@ -636,6 +643,10 @@ panel_create(struct desktop *desktop, struct output *output)
148 s = weston_config_get_section(desktop->config, "shell", NULL, NULL);
149 weston_config_section_get_color(s, "panel-color",
150 &panel->color, 0xaa000000);
151 + weston_config_section_get_double(s, "panel-scale",
152 + &panel->scale, 1.0f);
153 + if (!panel->scale)
154 + panel->scale = 1.0f;
158 --