all repos — tint2 @ 9150a180fa827f6245a9424d2c6d6032c94d56c6

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

panel: Compute fractional width after reserving the margin, not before (issue #559)
o9000 mrovi9000@gmail.com
commit

9150a180fa827f6245a9424d2c6d6032c94d56c6

parent

7b6ce979404a7b6c8de2edd7c0a07d64ba3f6e78

3 files changed, 12 insertions(+), 12 deletions(-)

jump to
M src/config.csrc/config.c

@@ -304,13 +304,13 @@

char *b; if ((b = strchr(value1, '%'))) { b[0] = '\0'; - panel_config.fractional_width = 1; + panel_config.fractional_width = TRUE; } panel_config.area.width = atoi(value1); if (panel_config.area.width == 0) { // full width mode panel_config.area.width = 100; - panel_config.fractional_width = 1; + panel_config.fractional_width = TRUE; } if (value2) { if ((b = strchr(value2, '%'))) {
M src/panel.csrc/panel.c

@@ -287,11 +287,9 @@ panel->fractional_height = FALSE;

panel->area.height = 32; } if (panel->fractional_width) - panel->area.width = server.monitors[panel->monitor].width * panel->area.width / 100; + panel->area.width = (server.monitors[panel->monitor].width - panel->marginx) * panel->area.width / 100; if (panel->fractional_height) - panel->area.height = server.monitors[panel->monitor].height * panel->area.height / 100; - if (panel->area.width + panel->marginx > server.monitors[panel->monitor].width) - panel->area.width = server.monitors[panel->monitor].width - panel->marginx; + panel->area.height = (server.monitors[panel->monitor].height - panel->marginy) * panel->area.height / 100; if (panel->area.bg->border.radius > panel->area.height / 2) { printf("panel_background_id rounded is too big... please fix your tint2rc\n"); g_array_append_val(backgrounds, *panel->area.bg);

@@ -309,17 +307,14 @@ panel->area.width = 140;

} int old_panel_height = panel->area.height; if (panel->fractional_width) - panel->area.height = server.monitors[panel->monitor].height * panel->area.width / 100; + panel->area.height = (server.monitors[panel->monitor].height - panel->marginy) * panel->area.width / 100; else panel->area.height = panel->area.width; if (panel->fractional_height) - panel->area.width = server.monitors[panel->monitor].width * old_panel_height / 100; + panel->area.width = (server.monitors[panel->monitor].width - panel->marginx) * old_panel_height / 100; else panel->area.width = old_panel_height; - - if (panel->area.height + panel->marginy > server.monitors[panel->monitor].height) - panel->area.height = server.monitors[panel->monitor].height - panel->marginy; if (panel->area.bg->border.radius > panel->area.width / 2) { printf("panel_background_id rounded is too big... please fix your tint2rc\n");

@@ -328,6 +323,11 @@ panel->area.bg = &g_array_index(backgrounds, Background, backgrounds->len - 1);

panel->area.bg->border.radius = panel->area.width / 2; } } + + 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) + panel->area.height = server.monitors[panel->monitor].height - panel->marginy; // panel position determined here if (panel_position & LEFT) {
M src/panel.hsrc/panel.h

@@ -96,7 +96,7 @@

// position relative to root window int posx, posy; int marginx, marginy; - int fractional_width, fractional_height; + gboolean fractional_width, fractional_height; int monitor; int font_shadow; gboolean mouse_effects;