all repos — tint2 @ 12f04e3055ba1d8d4a362bdba0ed11fcfa07ff62

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

Scale panel window size (issue #656)
o9000 mrovi9000@gmail.com
commit

12f04e3055ba1d8d4a362bdba0ed11fcfa07ff62

parent

7f62594cf6591c7be1fc0535b64255e1beb9c589

2 files changed, 19 insertions(+), 0 deletions(-)

jump to
M src/panel.csrc/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.hsrc/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;