Scale panel window size (issue #656)
o9000 mrovi9000@gmail.com
2 files changed,
19 insertions(+),
0 deletions(-)
M
src/panel.c
→
src/panel.c
@@ -221,6 +221,11 @@ Panel *p = &panels[i];
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;@@ -356,6 +361,19 @@ g_array_append_val(backgrounds, *panel->area.bg);
panel->area.bg = &g_array_index(backgrounds, Background, backgrounds->len - 1); panel->area.bg->border.radius = panel->area.width / 2; } + } + + 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)
M
src/panel.h
→
src/panel.h
@@ -118,6 +118,7 @@ int mouse_over_brightness;
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;