Scale panel window size (issue #656)
This commit is contained in:
parent
7f62594cf6
commit
12f04e3055
2 changed files with 19 additions and 0 deletions
18
src/panel.c
18
src/panel.c
|
@ -221,6 +221,11 @@ void init_panel()
|
|||
|
||||
if (panel_config.monitor < 0)
|
||||
p->monitor = i;
|
||||
if (ui_scale_dpi_ref > 0 && server.monitors[p->monitor].dpi > 0)
|
||||
p->scale = server.monitors[p->monitor].dpi / ui_scale_dpi_ref;
|
||||
else
|
||||
p->scale = 1;
|
||||
fprintf(stderr, "tint2: panel %d uses scale %f\n", i + 1, p->scale);
|
||||
if (!p->area.bg)
|
||||
p->area.bg = &g_array_index(backgrounds, Background, 0);
|
||||
p->area.parent = p;
|
||||
|
@ -358,6 +363,19 @@ void panel_compute_size(Panel *panel)
|
|||
}
|
||||
}
|
||||
|
||||
if (!panel->fractional_width) {
|
||||
if (panel_horizontal)
|
||||
panel->area.width *= panel->scale;
|
||||
else
|
||||
panel->area.height *= panel->scale;
|
||||
}
|
||||
if (!panel->fractional_height) {
|
||||
if (panel_horizontal)
|
||||
panel->area.height *= panel->scale;
|
||||
else
|
||||
panel->area.width *= panel->scale;
|
||||
}
|
||||
|
||||
if (panel->area.width + panel->marginx > server.monitors[panel->monitor].width)
|
||||
panel->area.width = server.monitors[panel->monitor].width - panel->marginx;
|
||||
if (panel->area.height + panel->marginy > server.monitors[panel->monitor].height)
|
||||
|
|
|
@ -118,6 +118,7 @@ typedef struct Panel {
|
|||
int mouse_pressed_alpha;
|
||||
int mouse_pressed_saturation;
|
||||
int mouse_pressed_brightness;
|
||||
double scale;
|
||||
|
||||
// Per-panel parameters and states for Taskbar and Task
|
||||
GlobalTaskbar g_taskbar;
|
||||
|
|
Loading…
Reference in a new issue