From e5aee3e6b1f902e6dfe24626c8f062708aa36dad Mon Sep 17 00:00:00 2001 From: seanpringle Date: Tue, 25 Sep 2012 11:01:15 +1000 Subject: [PATCH 1/6] Revert "fix clang warnings" This reverts commit 94ab5472b9866e5fb98e1995efa44ff49a84bf45. --- action.c | 4 ++-- client.c | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/action.c b/action.c index 683961b..c28a22c 100644 --- a/action.c +++ b/action.c @@ -105,8 +105,8 @@ void action_focus_monitor(void *data, int num, client *cli) void action_fullscreen(void *data, int num, client *cli) { if (!cli) return; - if (cli->full && GETPROP_LONG(cli->window, atoms[XOAT_SPOT], &cli->spot, 1)); - else SETPROP_LONG(cli->window, atoms[XOAT_SPOT], &cli->spot, 1); + if (cli->full) GETPROP_LONG(cli->window, atoms[XOAT_SPOT], &cli->spot, 1); + else SETPROP_LONG(cli->window, atoms[XOAT_SPOT], &cli->spot, 1); client_toggle_state(cli, atoms[_NET_WM_STATE_FULLSCREEN]); client_place_spot(cli, cli->full ? SPOT1: cli->spot, cli->monitor, 1); client_update_border(cli); diff --git a/client.c b/client.c index d07a1f3..0c58b5a 100644 --- a/client.c +++ b/client.c @@ -63,8 +63,8 @@ client* window_build_client(Window win) { c->visible = c->attr.map_state == IsViewable ? 1:0; XGetTransientForHint(display, c->window, &c->transient); - if (!GETPROP_ATOM(win, atoms[_NET_WM_WINDOW_TYPE], &c->type, 1)) c->type = 0; - if (!GETPROP_WIND(win, atoms[WM_CLIENT_LEADER], &c->leader, 1)) c->leader = None; + GETPROP_ATOM(win, atoms[_NET_WM_WINDOW_TYPE], &c->type, 1); + GETPROP_WIND(win, atoms[WM_CLIENT_LEADER], &c->leader, 1); c->manage = !c->attr.override_redirect && c->type != atoms[_NET_WM_WINDOW_TYPE_DESKTOP] @@ -91,8 +91,7 @@ client* window_build_client(Window win) if (c->visible) { - if (!GETPROP_ATOM(c->window, atoms[_NET_WM_STATE], c->states, ATOMLIST)) - memset(c->states, 0, sizeof(Atom) * ATOMLIST); + GETPROP_ATOM(c->window, atoms[_NET_WM_STATE], c->states, ATOMLIST); c->urgent = client_has_state(c, atoms[_NET_WM_STATE_DEMANDS_ATTENTION]); c->full = client_has_state(c, atoms[_NET_WM_STATE_FULLSCREEN]); c->above = client_has_state(c, atoms[_NET_WM_STATE_ABOVE]); From e90457b66a9e43631290dd250a5ee12ec597763f Mon Sep 17 00:00:00 2001 From: seanpringle Date: Tue, 25 Sep 2012 11:03:44 +1000 Subject: [PATCH 2/6] tweak config.h defaults --- config.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/config.h b/config.h index 8ff790d..44f20d9 100644 --- a/config.h +++ b/config.h @@ -29,8 +29,8 @@ // The layout can be flipped so SPOT1 is on the right. // If you do this, review the directional move/focus key bindings too. -//#define SPOT1_ALIGN SPOT1_LEFT -#define SPOT1_ALIGN SPOT1_RIGHT +#define SPOT1_ALIGN SPOT1_LEFT +//#define SPOT1_ALIGN SPOT1_RIGHT // Width of SPOT1 as percentage of screen width. #define SPOT1_WIDTH_PCT 67 @@ -139,8 +139,5 @@ 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_F3, .act = action_find_or_start, .data = "pcmanfm" }, - { .mod = AnyModifier, .key = XK_F4, .act = action_find_or_start, .data = "kate" }, + { .mod = AnyModifier, .key = XK_F1, .act = action_find_or_start, .data = "xterm" }, }; From cd7e6b1051a7f3b3b6d86925b4471ef9260221b4 Mon Sep 17 00:00:00 2001 From: seanpringle Date: Tue, 25 Sep 2012 11:06:00 +1000 Subject: [PATCH 3/6] clang warnings --- action.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.c b/action.c index c28a22c..683961b 100644 --- a/action.c +++ b/action.c @@ -105,8 +105,8 @@ void action_focus_monitor(void *data, int num, client *cli) void action_fullscreen(void *data, int num, client *cli) { if (!cli) return; - if (cli->full) GETPROP_LONG(cli->window, atoms[XOAT_SPOT], &cli->spot, 1); - else SETPROP_LONG(cli->window, atoms[XOAT_SPOT], &cli->spot, 1); + if (cli->full && GETPROP_LONG(cli->window, atoms[XOAT_SPOT], &cli->spot, 1)); + else SETPROP_LONG(cli->window, atoms[XOAT_SPOT], &cli->spot, 1); client_toggle_state(cli, atoms[_NET_WM_STATE_FULLSCREEN]); client_place_spot(cli, cli->full ? SPOT1: cli->spot, cli->monitor, 1); client_update_border(cli); From 9c159e3cc59ae84934d8b400aa624f45637284c0 Mon Sep 17 00:00:00 2001 From: seanpringle Date: Tue, 25 Sep 2012 11:07:29 +1000 Subject: [PATCH 4/6] clang warnings --- client.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client.c b/client.c index 0c58b5a..d07a1f3 100644 --- a/client.c +++ b/client.c @@ -63,8 +63,8 @@ client* window_build_client(Window win) { c->visible = c->attr.map_state == IsViewable ? 1:0; XGetTransientForHint(display, c->window, &c->transient); - GETPROP_ATOM(win, atoms[_NET_WM_WINDOW_TYPE], &c->type, 1); - GETPROP_WIND(win, atoms[WM_CLIENT_LEADER], &c->leader, 1); + if (!GETPROP_ATOM(win, atoms[_NET_WM_WINDOW_TYPE], &c->type, 1)) c->type = 0; + if (!GETPROP_WIND(win, atoms[WM_CLIENT_LEADER], &c->leader, 1)) c->leader = None; c->manage = !c->attr.override_redirect && c->type != atoms[_NET_WM_WINDOW_TYPE_DESKTOP] @@ -91,7 +91,8 @@ client* window_build_client(Window win) if (c->visible) { - GETPROP_ATOM(c->window, atoms[_NET_WM_STATE], c->states, ATOMLIST); + if (!GETPROP_ATOM(c->window, atoms[_NET_WM_STATE], c->states, ATOMLIST)) + memset(c->states, 0, sizeof(Atom) * ATOMLIST); c->urgent = client_has_state(c, atoms[_NET_WM_STATE_DEMANDS_ATTENTION]); c->full = client_has_state(c, atoms[_NET_WM_STATE_FULLSCREEN]); c->above = client_has_state(c, atoms[_NET_WM_STATE_ABOVE]); From 95983b17892022ab4db130d499707b3b8ac1359a Mon Sep 17 00:00:00 2001 From: seanpringle Date: Thu, 25 Oct 2012 02:05:09 +1000 Subject: [PATCH 5/6] protect config.h --- .gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..5f327fd --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +config.h merge=ours From 535ea4ee632ccfbef74e6d53500aba8e5fe1bb48 Mon Sep 17 00:00:00 2001 From: seanpringle Date: Mon, 29 Oct 2012 06:45:26 +1000 Subject: [PATCH 6/6] remove alloca() dependency --- spot.c | 2 +- textbox.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spot.c b/spot.c index 4616a90..5aa79ed 100644 --- a/spot.c +++ b/spot.c @@ -29,7 +29,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. void spot_update_bar(int spot, int mon) { int i, n = 0, len = 0; client *o, *c = NULL; - char *title = alloca(SPOT_BUFF); *title = 0; + char title[SPOT_BUFF]; *title = 0; monitor *m = &monitors[mon]; for_windows(i, o) if (o->manage && o->spot == spot && o->monitor == mon) diff --git a/textbox.c b/textbox.c index 050c2d7..a739d1e 100644 --- a/textbox.c +++ b/textbox.c @@ -95,7 +95,7 @@ void textbox_font(textbox *tb, char *font, char *fg, char *bg) void textbox_extents(textbox *tb) { int length = strlen(tb->text) + strlen(tb->prompt); - char *line = alloca(length + 1); + char line[length + 1]; sprintf(line, "%s%s", tb->prompt, tb->text); XftTextExtents8(display, tb->font, (unsigned char*)line, length, &tb->extents); } @@ -190,7 +190,7 @@ void textbox_draw(textbox *tb) length = text_len + prompt_len; cursor_offset = MIN(tb->cursor + prompt_len, length); - line = alloca(length + 10); + char eline[length + 10]; line = eline; sprintf(line, "%s%s", prompt, text); // replace spaces so XftTextExtents8 includes their width