Eliminate false positives in ewmh_handle_struts

This commit is contained in:
Bastien Dejean 2016-11-14 13:21:58 +01:00
parent dc4372f152
commit 89adecf1d5

8
ewmh.c
View file

@ -156,19 +156,19 @@ bool ewmh_handle_struts(xcb_window_t win)
if (xcb_ewmh_get_wm_strut_partial_reply(ewmh, xcb_ewmh_get_wm_strut_partial(ewmh, win), &struts, NULL) == 1) {
for (monitor_t *m = mon_head; m != NULL; m = m->next) {
xcb_rectangle_t rect = m->rectangle;
if (rect.x < (int16_t) struts.left && (int16_t) struts.left_end_y >= rect.y && (int16_t) struts.left_start_y <= (rect.y + rect.height)) {
if (rect.x < (int16_t) struts.left && (int16_t) struts.left_end_y >= rect.y && (int16_t) struts.left_start_y < (rect.y + rect.height)) {
m->padding.left = struts.left - rect.x;
changed = true;
}
if ((rect.x + rect.width) > (int16_t) (screen_width - struts.right) && (int16_t) struts.right_end_y >= rect.y && (int16_t) struts.right_start_y <= (rect.y + rect.height)) {
if ((rect.x + rect.width) > (int16_t) (screen_width - struts.right) && (int16_t) struts.right_end_y >= rect.y && (int16_t) struts.right_start_y < (rect.y + rect.height)) {
m->padding.right = (rect.x + rect.width) - screen_width + struts.right;
changed = true;
}
if (rect.y < (int16_t) struts.top && (int16_t) struts.top_end_x >= rect.x && (int16_t) struts.top_start_x <= (rect.x + rect.width)) {
if (rect.y < (int16_t) struts.top && (int16_t) struts.top_end_x >= rect.x && (int16_t) struts.top_start_x < (rect.x + rect.width)) {
m->padding.top = struts.top - rect.y;
changed = true;
}
if ((rect.y + rect.height) > (int16_t) (screen_height - struts.bottom) && (int16_t) struts.bottom_end_x >= rect.x && (int16_t) struts.bottom_start_x <= (rect.x + rect.width)) {
if ((rect.y + rect.height) > (int16_t) (screen_height - struts.bottom) && (int16_t) struts.bottom_end_x >= rect.x && (int16_t) struts.bottom_start_x < (rect.x + rect.width)) {
m->padding.bottom = (rect.y + rect.height) - screen_height + struts.bottom;
changed = true;
}