1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 04:48:06 +01:00

Correct calculation of usable space for reserved area.

Previous patch has correct the way, how reserved area found in
_NET_WM_STRUT was calculated. Unfortunately, the calculation was not
precise, as for not reserved areas (i.e. values of 0 for one of the
cardinals is set) must be calculated anyway for given head, otherwise
usable area might be too broad.
This commit is contained in:
2021-03-18 16:41:36 +01:00
committed by Carlos R. Mafra
parent bbf24d1d39
commit 82ab2d2d06

View File

@@ -874,13 +874,26 @@ Bool wNETWMGetUsableArea(WScreen *scr, int head, WArea *area)
* *
* By coincidence, coordinates x1 and y1 from left and top are the same as * By coincidence, coordinates x1 and y1 from left and top are the same as
* the original data which came from _NET_WM_STRUT, since they meaning * the original data which came from _NET_WM_STRUT, since they meaning
* distance from the edge. * distance from the edge, so we leave it as-is, otherwise if they have 0
* value, we need to set right head position.
*/ */
/* optional reserved space from left */
if (area->x1 == 0) area->x1 = rect.pos.x;
/* optional reserved space from top */
if (area->y1 == 0) area->y1 = rect.pos.y;
/* optional reserved space from right */ /* optional reserved space from right */
if (area->x2 == 0)
area->x2 = rect.pos.x + rect.size.width;
else
area->x2 = scr->scr_width - area->x2; area->x2 = scr->scr_width - area->x2;
/* optional reserved space from bottom */ /* optional reserved space from bottom */
if (area->y2 == 0)
area->y2 = rect.pos.y + rect.size.height;
else
area->y2 = scr->scr_height - area->y2; area->y2 = scr->scr_height - area->y2;
return True; return True;