From 526d3738d74cc232aa0a6227eba17e49d0d4f980 Mon Sep 17 00:00:00 2001 From: seanpringle Date: Fri, 21 Sep 2012 16:54:13 +1000 Subject: [PATCH 1/2] merge from personal --- config.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/config.h b/config.h index d36b69b..72bc136 100644 --- a/config.h +++ b/config.h @@ -54,8 +54,8 @@ // Should new windows be automatically focused, or ignored until focused manually? // IGNORE means new windows only steal focus if they obscure the current window. // STEAL means new windows always steal focus. -//#define FOCUS_START FOCUS_IGNORE -#define FOCUS_START FOCUS_STEAL +#define FOCUS_START FOCUS_IGNORE +//#define FOCUS_START FOCUS_STEAL // Available actions... // action_move .num = SPOT1/2/3 @@ -122,10 +122,6 @@ binding keys[] = { // Find or start apps by WM_CLASS (lower case match). // Only works for apps that use some form of their binary name as their class... { .mod = AnyModifier, .key = XK_F1, .act = action_find_or_start, .data = "konsole" }, - { .mod = AnyModifier, .key = XK_F2, .act = action_find_or_start, .data = "uzbl-tabbed" }, + { .mod = AnyModifier, .key = XK_F2, .act = action_find_or_start, .data = "chromium" }, { .mod = AnyModifier, .key = XK_F3, .act = action_find_or_start, .data = "pcmanfm" }, - { .mod = AnyModifier, .key = XK_F4, .act = action_find_or_start, .data = "kate" }, - { .mod = AnyModifier, .key = XK_F5, .act = action_find_or_start, .data = "xchat" }, - - { .mod = AnyModifier, .key = XK_Menu, .act = action_command, .data = "xowl" }, }; From 3d5c527c0f83a749da955c99b20b14dd06cf44a9 Mon Sep 17 00:00:00 2001 From: seanpringle Date: Fri, 21 Sep 2012 17:48:38 +1000 Subject: [PATCH 2/2] handle _NET_WM_STRUT_PARTIAL properly --- xoat.c | 70 +++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 47 insertions(+), 23 deletions(-) diff --git a/xoat.c b/xoat.c index 070bf2e..064f3ba 100644 --- a/xoat.c +++ b/xoat.c @@ -117,8 +117,8 @@ typedef struct { typedef struct { long left, right, top, bottom, - left_start_y, left_end_y, right_start_y, right_end_y, - top_start_x, top_end_x, bottom_start_x, bottom_end_x; + ly1, ly2, ry1, ry3, + tx1, tx2, bx1, bx2; } wm_strut; typedef struct { @@ -927,6 +927,8 @@ int main(int argc, char *argv[]) self = argv[0]; root = DefaultRootWindow(display); xerror = XSetErrorHandler(oops); + int screen_w = WidthOfScreen(DefaultScreenOfDisplay(display)); + int screen_h = HeightOfScreen(DefaultScreenOfDisplay(display)); for (i = 0; i < ATOMS; i++) atoms[i] = XInternAtom(display, atom_names[i], False); @@ -943,22 +945,8 @@ int main(int argc, char *argv[]) } // default non-multi-head setup - monitors[0].w = WidthOfScreen(DefaultScreenOfDisplay(display)); - monitors[0].h = HeightOfScreen(DefaultScreenOfDisplay(display)); - - // detect panel struts - for_windows(i, c) - { - wm_strut strut; memset(&strut, 0, sizeof(wm_strut)); - if (window_get_cardinal_prop(c->window, atoms[_NET_WM_STRUT_PARTIAL], (unsigned long*)&strut, 12) - || window_get_cardinal_prop(c->window, atoms[_NET_WM_STRUT], (unsigned long*)&strut, 4)) - { - struts.left = MIN(MAX_STRUT, MAX(struts.left, strut.left)); - struts.right = MIN(MAX_STRUT, MAX(struts.right, strut.right)); - struts.top = MIN(MAX_STRUT, MAX(struts.top, strut.top)); - struts.bottom = MIN(MAX_STRUT, MAX(struts.bottom, strut.bottom)); - } - } + monitors[0].w = screen_w; + monitors[0].h = screen_h; // support multi-head. XineramaScreenInfo *info; @@ -975,12 +963,48 @@ int main(int argc, char *argv[]) XFree(info); } - // left struts affect first monitor - monitors[0].x += struts.left; - monitors[0].w -= struts.left; + // detect and adjust for panel struts + for_windows(i, c) + { + wm_strut strut; memset(&strut, 0, sizeof(wm_strut)); + int v2 = window_get_cardinal_prop(c->window, atoms[_NET_WM_STRUT_PARTIAL], (unsigned long*)&strut, 12); + int v1 = v2 ? 0: window_get_cardinal_prop(c->window, atoms[_NET_WM_STRUT], (unsigned long*)&strut, 4); + if (!c->visible || (!v1 && !v2)) continue; - // right struts affect last monitor - monitors[nmonitors-1].w -= struts.right; + for (j = 0; j < nmonitors; j++) + { + monitor *m = &monitors[j]; + if (v1) + { + strut.ly1 = m->y; strut.ly2 = m->y + m->h; + strut.ry1 = m->y; strut.ry3 = m->y + m->h; + strut.tx1 = m->x; strut.tx2 = m->x + m->w; + strut.bx1 = m->x; strut.bx2 = m->x + m->w; + } + if (strut.left > 0 && !m->x + && INTERSECT(0, strut.ly1, strut.left, strut.ly2 - strut.ly1, m->x, m->y, m->w, m->h)) + { + m->x += strut.left; + m->w -= strut.left; + } + if (strut.right > 0 && m->x + m->w == screen_w + && INTERSECT(screen_w - strut.right, strut.ry1, strut.right, strut.ry3 - strut.ry1, m->x, m->y, m->w, m->h)) + { + m->w -= strut.right; + } + if (strut.top > 0 && !m->y + && INTERSECT(strut.tx1, 0, strut.tx2 - strut.tx1, strut.top, m->x, m->y, m->w, m->h)) + { + m->y += strut.top; + m->h -= strut.top; + } + if (strut.bottom > 0 && m->y + m->h == screen_h + && INTERSECT(strut.bx1, screen_h - strut.bottom, strut.bx2 - strut.bx1, strut.bottom, m->x, m->y, m->w, m->h)) + { + m->h -= strut.bottom; + } + } + } // calculate spot boxes for (i = 0; i < nmonitors; i++)