From 8c47a12a8669ffec92a6b9ca922eaec0f192b546 Mon Sep 17 00:00:00 2001 From: okan Date: Mon, 8 Apr 2013 00:56:21 +0000 Subject: [PATCH 01/18] missing prototype --- menu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/menu.c b/menu.c index 381da6c..28eac9f 100644 --- a/menu.c +++ b/menu.c @@ -74,6 +74,7 @@ static void menu_draw_entry(struct screen_ctx *, struct menu_ctx *, struct menu_q *, int, int); static int menu_calc_entry(struct screen_ctx *, struct menu_ctx *, int, int); +static struct menu *menu_complete_path(struct menu_ctx *); static int menu_keycode(XKeyEvent *, enum ctltype *, char *); From 28b54db2217c0398132a6b049231c99a99a84160 Mon Sep 17 00:00:00 2001 From: okan Date: Mon, 8 Apr 2013 13:02:31 +0000 Subject: [PATCH 02/18] consistency --- group.c | 1 + kbfunc.c | 1 + menu.c | 1 + mousefunc.c | 2 ++ 4 files changed, 5 insertions(+) diff --git a/group.c b/group.c index 307b5c7..dd47e06 100644 --- a/group.c +++ b/group.c @@ -351,6 +351,7 @@ group_menu(XButtonEvent *e) int i; sc = screen_fromroot(e->root); + TAILQ_INIT(&menuq); for (i = 0; i < CALMWM_NGROUPS; i++) { diff --git a/kbfunc.c b/kbfunc.c index c742f7e..7a406ea 100644 --- a/kbfunc.c +++ b/kbfunc.c @@ -335,6 +335,7 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg) } TAILQ_INIT(&menuq); + lbuf = NULL; while ((buf = fgetln(fp, &len))) { if (buf[len - 1] == '\n') diff --git a/menu.c b/menu.c index 28eac9f..465244f 100644 --- a/menu.c +++ b/menu.c @@ -209,6 +209,7 @@ menu_complete_path(struct menu_ctx *mc) mr = xcalloc(1, sizeof(*mr)); TAILQ_INIT(&menuq); + if ((mi = menu_filter(mc->sc, &menuq, mc->searchstr, NULL, CWM_MENU_DUMMY, search_match_path_any, NULL)) != NULL) { mr->abort = mi->abort; diff --git a/mousefunc.c b/mousefunc.c index 1d2b287..c8edf6a 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -227,6 +227,7 @@ mousefunc_menu_unhide(struct client_ctx *cc, void *arg) old_cc = client_current(); TAILQ_INIT(&menuq); + TAILQ_FOREACH(cc, &Clientq, entry) if (cc->flags & CLIENT_HIDDEN) { wname = (cc->label) ? cc->label : cc->name; @@ -263,6 +264,7 @@ mousefunc_menu_cmd(struct client_ctx *cc, void *arg) struct cmd *cmd; TAILQ_INIT(&menuq); + TAILQ_FOREACH(cmd, &Conf.cmdq, entry) { mi = xcalloc(1, sizeof(*mi)); (void)strlcpy(mi->text, cmd->label, sizeof(mi->text)); From 62a685d82a7c2c91ce82323778f0105d34ad7321 Mon Sep 17 00:00:00 2001 From: okan Date: Mon, 8 Apr 2013 13:05:27 +0000 Subject: [PATCH 03/18] reverse logic to make it like the others --- group.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/group.c b/group.c index dd47e06..cda8d0a 100644 --- a/group.c +++ b/group.c @@ -375,15 +375,11 @@ group_menu(XButtonEvent *e) return; mi = menu_filter(sc, &menuq, NULL, NULL, 0, NULL, NULL); + if (mi != NULL && mi->ctx != NULL) { + gc = (struct group_ctx *)mi->ctx; + (gc->hidden) ? group_show(sc, gc) : group_hide(sc, gc); + } - if (mi == NULL || mi->ctx == NULL) - goto cleanup; - - gc = (struct group_ctx *)mi->ctx; - - (gc->hidden) ? group_show(sc, gc) : group_hide(sc, gc); - -cleanup: menuq_clear(&menuq); } From 58c1d48d10cd7bec3bd186ef2f584b1ad1974f5b Mon Sep 17 00:00:00 2001 From: okan Date: Mon, 8 Apr 2013 15:43:04 +0000 Subject: [PATCH 04/18] plug memleak; always need to menuq_clear even when a selection is made. --- mousefunc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mousefunc.c b/mousefunc.c index c8edf6a..878f63a 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -251,8 +251,9 @@ mousefunc_menu_unhide(struct client_ctx *cc, void *arg) if (old_cc != NULL) client_ptrsave(old_cc); client_ptrwarp(cc); - } else - menuq_clear(&menuq); + } + + menuq_clear(&menuq); } void @@ -277,6 +278,6 @@ mousefunc_menu_cmd(struct client_ctx *cc, void *arg) mi = menu_filter(sc, &menuq, NULL, NULL, 0, NULL, NULL); if (mi != NULL) u_spawn(((struct cmd *)mi->ctx)->image); - else - menuq_clear(&menuq); + + menuq_clear(&menuq); } From 90f95416c6f4461625dd37d5cc44dd92a067a030 Mon Sep 17 00:00:00 2001 From: okan Date: Wed, 10 Apr 2013 19:08:09 +0000 Subject: [PATCH 05/18] _NET_WM_NAME is UTF8_STRING type --- xutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xutil.c b/xutil.c index 32a9974..3605e71 100644 --- a/xutil.c +++ b/xutil.c @@ -292,7 +292,7 @@ xu_ewmh_net_supported_wm_check(struct screen_ctx *sc) XChangeProperty(X_Dpy, w, ewmh[_NET_SUPPORTING_WM_CHECK].atom, XA_WINDOW, 32, PropModeReplace, (unsigned char *)&w, 1); XChangeProperty(X_Dpy, w, ewmh[_NET_WM_NAME].atom, - XA_WM_NAME, 8, PropModeReplace, (unsigned char *)WMNAME, + cwmh[UTF8_STRING].atom, 8, PropModeReplace, (unsigned char *)WMNAME, strlen(WMNAME)); } From 6296efadaa6bcc09068030bec4cb01904ca1a010 Mon Sep 17 00:00:00 2001 From: okan Date: Fri, 12 Apr 2013 14:46:30 +0000 Subject: [PATCH 06/18] push Screenq into screen_init --- calmwm.c | 8 ++------ calmwm.h | 2 +- screen.c | 7 ++++++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/calmwm.c b/calmwm.c index 25ac559..d2aecf9 100644 --- a/calmwm.c +++ b/calmwm.c @@ -146,7 +146,6 @@ dpy_init(const char *dpyname) static void x_setup(void) { - struct screen_ctx *sc; struct keybinding *kb; int i; @@ -156,11 +155,8 @@ x_setup(void) Cursor_question = XCreateFontCursor(X_Dpy, XC_question_arrow); Cursor_resize = XCreateFontCursor(X_Dpy, XC_bottom_right_corner); - for (i = 0; i < ScreenCount(X_Dpy); i++) { - sc = xcalloc(1, sizeof(*sc)); - screen_init(sc, i); - TAILQ_INSERT_TAIL(&Screenq, sc, entry); - } + for (i = 0; i < ScreenCount(X_Dpy); i++) + screen_init(i); /* * XXX key grabs weren't done before, since Screenq was empty, diff --git a/calmwm.h b/calmwm.h index c02db59..86650ca 100644 --- a/calmwm.h +++ b/calmwm.h @@ -375,7 +375,7 @@ void search_print_client(struct menu *, int); struct geom screen_find_xinerama(struct screen_ctx *, int, int); struct screen_ctx *screen_fromroot(Window); -void screen_init(struct screen_ctx *, u_int); +void screen_init(u_int); void screen_update_geometry(struct screen_ctx *); void screen_updatestackingorder(struct screen_ctx *); diff --git a/screen.c b/screen.c index 6b7de6b..7eac18d 100644 --- a/screen.c +++ b/screen.c @@ -31,13 +31,16 @@ #include "calmwm.h" void -screen_init(struct screen_ctx *sc, u_int which) +screen_init(u_int which) { + struct screen_ctx *sc; Window *wins, w0, w1; XWindowAttributes winattr; XSetWindowAttributes rootattr; u_int nwins, i; + sc = xcalloc(1, sizeof(*sc)); + sc->which = which; sc->visual = DefaultVisual(X_Dpy, sc->which); sc->colormap = DefaultColormap(X_Dpy, sc->which); @@ -84,6 +87,8 @@ screen_init(struct screen_ctx *sc, u_int which) if (HasRandr) XRRSelectInput(X_Dpy, sc->rootwin, RRScreenChangeNotifyMask); + TAILQ_INSERT_TAIL(&Screenq, sc, entry); + XSync(X_Dpy, False); } From b5f6bd205c97405e85cf19f3a1f4f162400d7897 Mon Sep 17 00:00:00 2001 From: okan Date: Fri, 12 Apr 2013 14:49:16 +0000 Subject: [PATCH 07/18] makes no sense to set an error handler which uses X_Dpy before XOpenDisplay. --- calmwm.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/calmwm.c b/calmwm.c index d2aecf9..7bc204a 100644 --- a/calmwm.c +++ b/calmwm.c @@ -129,8 +129,6 @@ dpy_init(const char *dpyname) { int i; - XSetErrorHandler(x_errorhandler); - if ((X_Dpy = XOpenDisplay(dpyname)) == NULL) errx(1, "unable to open display \"%s\"", XDisplayName(dpyname)); From ef1b78f4649612a9db2614abcfe968cdec13e139 Mon Sep 17 00:00:00 2001 From: okan Date: Fri, 12 Apr 2013 20:45:57 +0000 Subject: [PATCH 08/18] we already set window state in client_hide or client_unhide right before, so there's no need to do it again. --- client.c | 1 - 1 file changed, 1 deletion(-) diff --git a/client.c b/client.c index 1750360..663b7c5 100644 --- a/client.c +++ b/client.c @@ -125,7 +125,6 @@ client_new(Window win, struct screen_ctx *sc, int mapped) xu_configure(cc); (state == IconicState) ? client_hide(cc) : client_unhide(cc); - xu_setstate(cc, cc->state); TAILQ_INSERT_TAIL(&sc->mruq, cc, mru_entry); TAILQ_INSERT_TAIL(&Clientq, cc, entry); From f3dfc4968cee2080cfa4a4f24f0977b962aa367d Mon Sep 17 00:00:00 2001 From: okan Date: Fri, 12 Apr 2013 20:54:27 +0000 Subject: [PATCH 09/18] we handle WM_STATE here, so remove misleading comment. --- client.c | 1 - 1 file changed, 1 deletion(-) diff --git a/client.c b/client.c index 663b7c5..495625f 100644 --- a/client.c +++ b/client.c @@ -447,7 +447,6 @@ client_ptrsave(struct client_ctx *cc) void client_hide(struct client_ctx *cc) { - /* XXX - add wm_state stuff */ XUnmapWindow(X_Dpy, cc->win); cc->active = 0; From 16ed8bf8e4f561049b732b326f3d0ee475fe13f6 Mon Sep 17 00:00:00 2001 From: okan Date: Sun, 14 Apr 2013 16:13:17 +0000 Subject: [PATCH 10/18] only a window is required to set WM_STATE. also un-confuse xu_ptr_getpos by using 'win' instead of 'rootwin' so as not to imply only the root window is queried, rather any window. --- calmwm.h | 2 +- client.c | 2 +- xutil.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/calmwm.h b/calmwm.h index 86650ca..6f39aeb 100644 --- a/calmwm.h +++ b/calmwm.h @@ -466,7 +466,7 @@ void xu_configure(struct client_ctx *); void xu_getatoms(void); unsigned long xu_getcolor(struct screen_ctx *, char *); int xu_getprop(Window, Atom, Atom, long, u_char **); -int xu_getstate(struct client_ctx *, int *); +int xu_getstate(Window, int *); int xu_getstrprop(Window, Atom, char **); void xu_key_grab(Window, int, int); void xu_key_ungrab(Window, int, int); diff --git a/client.c b/client.c index 495625f..932b4bc 100644 --- a/client.c +++ b/client.c @@ -111,7 +111,7 @@ client_new(Window win, struct screen_ctx *sc, int mapped) } client_draw_border(cc); - if (xu_getstate(cc, &state) < 0) + if (xu_getstate(cc->win, &state) < 0) state = NormalState; XSelectInput(X_Dpy, cc->win, ColormapChangeMask | EnterWindowMask | diff --git a/xutil.c b/xutil.c index 3605e71..a663150 100644 --- a/xutil.c +++ b/xutil.c @@ -72,13 +72,13 @@ xu_btn_ungrab(Window win, int mask, u_int btn) } void -xu_ptr_getpos(Window rootwin, int *x, int *y) +xu_ptr_getpos(Window win, int *x, int *y) { Window w0, w1; int tmp0, tmp1; u_int tmp2; - XQueryPointer(X_Dpy, rootwin, &w0, &w1, &tmp0, &tmp1, x, y, &tmp2); + XQueryPointer(X_Dpy, win, &w0, &w1, &tmp0, &tmp1, x, y, &tmp2); } void @@ -203,11 +203,11 @@ xu_getstrprop(Window win, Atom atm, char **text) { } int -xu_getstate(struct client_ctx *cc, int *state) +xu_getstate(Window win, int *state) { long *p = NULL; - if (xu_getprop(cc->win, cwmh[WM_STATE].atom, cwmh[WM_STATE].atom, 2L, + if (xu_getprop(win, cwmh[WM_STATE].atom, cwmh[WM_STATE].atom, 2L, (u_char **)&p) <= 0) return (-1); From a899d267fe78dbbb923c8626528973f8e6b65bae Mon Sep 17 00:00:00 2001 From: okan Date: Wed, 17 Apr 2013 13:30:38 +0000 Subject: [PATCH 11/18] add conf_ignore and move group_make_autogroup to conf_autogroup to match. --- calmwm.h | 3 ++- conf.c | 33 +++++++++++++++++++++++++++++++++ group.c | 21 --------------------- parse.y | 9 ++------- 4 files changed, 37 insertions(+), 29 deletions(-) diff --git a/calmwm.h b/calmwm.h index 6f39aeb..5166984 100644 --- a/calmwm.h +++ b/calmwm.h @@ -352,7 +352,6 @@ void group_client_delete(struct client_ctx *); void group_cycle(struct screen_ctx *, int); void group_hidetoggle(struct screen_ctx *, int); void group_init(struct screen_ctx *); -void group_make_autogroup(struct conf *, char *, int); void group_menu(XButtonEvent *); void group_movetogroup(struct client_ctx *, int); void group_only(struct screen_ctx *, int); @@ -436,6 +435,7 @@ void menuq_clear(struct menu_q *); int parse_config(const char *, struct conf *); +void conf_autogroup(struct conf *, int, char *); void conf_bindname(struct conf *, char *, char *); void conf_clear(struct conf *); void conf_client(struct client_ctx *); @@ -446,6 +446,7 @@ void conf_gap(struct conf *, struct screen_ctx *); void conf_grab(struct conf *, struct keybinding *); void conf_grab_mouse(struct client_ctx *); void conf_init(struct conf *); +void conf_ignore(struct conf *, char *); void conf_mousebind(struct conf *, char *, char *); void conf_ungrab(struct conf *, struct keybinding *); diff --git a/conf.c b/conf.c index 67f58a6..7303768 100644 --- a/conf.c +++ b/conf.c @@ -52,6 +52,39 @@ conf_cmd_add(struct conf *c, char *image, char *label) } } +void +conf_autogroup(struct conf *c, int no, char *val) +{ + struct autogroupwin *aw; + char *p; + + aw = xcalloc(1, sizeof(*aw)); + + if ((p = strchr(val, ',')) == NULL) { + aw->name = NULL; + aw->class = xstrdup(val); + } else { + *(p++) = '\0'; + aw->name = xstrdup(val); + aw->class = xstrdup(p); + } + aw->num = no; + + TAILQ_INSERT_TAIL(&c->autogroupq, aw, entry); +} + +void +conf_ignore(struct conf *c, char *val) +{ + struct winmatch *wm; + + wm = xcalloc(1, sizeof(*wm)); + + (void)strlcpy(wm->title, val, sizeof(wm->title)); + + TAILQ_INSERT_TAIL(&c->ignoreq, wm, entry); +} + void conf_gap(struct conf *c, struct screen_ctx *sc) { diff --git a/group.c b/group.c index cda8d0a..336400c 100644 --- a/group.c +++ b/group.c @@ -163,27 +163,6 @@ group_init(struct screen_ctx *sc) group_setactive(sc, 1); } -void -group_make_autogroup(struct conf *conf, char *val, int no) -{ - struct autogroupwin *aw; - char *p; - - aw = xcalloc(1, sizeof(*aw)); - - if ((p = strchr(val, ',')) == NULL) { - aw->name = NULL; - aw->class = xstrdup(val); - } else { - *(p++) = '\0'; - aw->name = xstrdup(val); - aw->class = xstrdup(p); - } - aw->num = no; - - TAILQ_INSERT_TAIL(&conf->autogroupq, aw, entry); -} - static void group_setactive(struct screen_ctx *sc, long idx) { diff --git a/parse.y b/parse.y index 8173fe0..2708948 100644 --- a/parse.y +++ b/parse.y @@ -137,16 +137,11 @@ main : FONTNAME STRING { YYERROR; } - group_make_autogroup(conf, $3, $2); + conf_autogroup(conf, $2, $3); free($3); } | IGNORE STRING { - struct winmatch *wm; - - wm = xcalloc(1, sizeof(*wm)); - (void)strlcpy(wm->title, $2, sizeof(wm->title)); - TAILQ_INSERT_TAIL(&conf->ignoreq, wm, entry); - + conf_ignore(conf, $2); free($2); } | BIND STRING string { From 1dbcc394aed6f7e4161ab065516128fa94bd0149 Mon Sep 17 00:00:00 2001 From: okan Date: Wed, 17 Apr 2013 13:31:47 +0000 Subject: [PATCH 12/18] zap extra space --- conf.c | 1 - 1 file changed, 1 deletion(-) diff --git a/conf.c b/conf.c index 7303768..06d4e1c 100644 --- a/conf.c +++ b/conf.c @@ -39,7 +39,6 @@ void conf_cmd_add(struct conf *c, char *image, char *label) { /* "term" and "lock" have special meanings. */ - if (strcmp(label, "term") == 0) (void)strlcpy(c->termpath, image, sizeof(c->termpath)); else if (strcmp(label, "lock") == 0) From 302690624e29eddb506e4a377b59eac029128f3f Mon Sep 17 00:00:00 2001 From: okan Date: Wed, 17 Apr 2013 13:52:20 +0000 Subject: [PATCH 13/18] slightly rework WM_STATE set/get to make it less ambigious; will be more clear on what needs to change to make it right in the end. --- calmwm.h | 2 +- client.c | 18 +++++++++++------- xutil.c | 5 ++--- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/calmwm.h b/calmwm.h index 5166984..ad8555a 100644 --- a/calmwm.h +++ b/calmwm.h @@ -477,7 +477,7 @@ int xu_ptr_regrab(int, Cursor); void xu_ptr_setpos(Window, int, int); void xu_ptr_ungrab(void); void xu_sendmsg(Window, Atom, long); -void xu_setstate(struct client_ctx *, int); +void xu_setstate(Window win, int); void xu_xorcolor(XRenderColor, XRenderColor, XRenderColor *); diff --git a/client.c b/client.c index 932b4bc..01f4347 100644 --- a/client.c +++ b/client.c @@ -101,13 +101,14 @@ client_new(Window win, struct screen_ctx *sc, int mapped) if (wattr.map_state != IsViewable) { client_placecalc(cc); + client_move(cc); if ((wmhints = XGetWMHints(X_Dpy, cc->win)) != NULL) { - if (wmhints->flags & StateHint) - xu_setstate(cc, wmhints->initial_state); - + if (wmhints->flags & StateHint) { + cc->state = wmhints->initial_state; + xu_setstate(cc->win, cc->state); + } XFree(wmhints); } - client_move(cc); } client_draw_border(cc); @@ -151,7 +152,8 @@ client_delete(struct client_ctx *cc) group_client_delete(cc); XGrabServer(X_Dpy); - xu_setstate(cc, WithdrawnState); + cc->state = WithdrawnState; + xu_setstate(cc->win, cc->state); XRemoveFromSaveSet(X_Dpy, cc->win); XSync(X_Dpy, False); @@ -451,7 +453,8 @@ client_hide(struct client_ctx *cc) cc->active = 0; cc->flags |= CLIENT_HIDDEN; - xu_setstate(cc, IconicState); + cc->state = IconicState; + xu_setstate(cc->win, cc->state); if (cc == client_current()) client_none(cc->sc); @@ -463,7 +466,8 @@ client_unhide(struct client_ctx *cc) XMapRaised(X_Dpy, cc->win); cc->flags &= ~CLIENT_HIDDEN; - xu_setstate(cc, NormalState); + cc->state = NormalState; + xu_setstate(cc->win, cc->state); client_draw_border(cc); } diff --git a/xutil.c b/xutil.c index a663150..8a22e21 100644 --- a/xutil.c +++ b/xutil.c @@ -218,15 +218,14 @@ xu_getstate(Window win, int *state) } void -xu_setstate(struct client_ctx *cc, int state) +xu_setstate(Window win, int state) { long dat[2]; dat[0] = state; dat[1] = None; - cc->state = state; - XChangeProperty(X_Dpy, cc->win, + XChangeProperty(X_Dpy, win, cwmh[WM_STATE].atom, cwmh[WM_STATE].atom, 32, PropModeReplace, (unsigned char *)dat, 2); } From 006a29e61773b02855e3c4e4a85d0e05f2837c6e Mon Sep 17 00:00:00 2001 From: okan Date: Wed, 17 Apr 2013 13:57:06 +0000 Subject: [PATCH 14/18] mechanical xu_{get,set}state -> xu_{get,set}_wm_state change --- calmwm.h | 4 ++-- client.c | 10 +++++----- xutil.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/calmwm.h b/calmwm.h index ad8555a..4eb1e69 100644 --- a/calmwm.h +++ b/calmwm.h @@ -467,7 +467,7 @@ void xu_configure(struct client_ctx *); void xu_getatoms(void); unsigned long xu_getcolor(struct screen_ctx *, char *); int xu_getprop(Window, Atom, Atom, long, u_char **); -int xu_getstate(Window, int *); +int xu_get_wm_state(Window, int *); int xu_getstrprop(Window, Atom, char **); void xu_key_grab(Window, int, int); void xu_key_ungrab(Window, int, int); @@ -477,7 +477,7 @@ int xu_ptr_regrab(int, Cursor); void xu_ptr_setpos(Window, int, int); void xu_ptr_ungrab(void); void xu_sendmsg(Window, Atom, long); -void xu_setstate(Window win, int); +void xu_set_wm_state(Window win, int); void xu_xorcolor(XRenderColor, XRenderColor, XRenderColor *); diff --git a/client.c b/client.c index 01f4347..c8d3801 100644 --- a/client.c +++ b/client.c @@ -105,14 +105,14 @@ client_new(Window win, struct screen_ctx *sc, int mapped) if ((wmhints = XGetWMHints(X_Dpy, cc->win)) != NULL) { if (wmhints->flags & StateHint) { cc->state = wmhints->initial_state; - xu_setstate(cc->win, cc->state); + xu_set_wm_state(cc->win, cc->state); } XFree(wmhints); } } client_draw_border(cc); - if (xu_getstate(cc->win, &state) < 0) + if (xu_get_wm_state(cc->win, &state) < 0) state = NormalState; XSelectInput(X_Dpy, cc->win, ColormapChangeMask | EnterWindowMask | @@ -153,7 +153,7 @@ client_delete(struct client_ctx *cc) XGrabServer(X_Dpy); cc->state = WithdrawnState; - xu_setstate(cc->win, cc->state); + xu_set_wm_state(cc->win, cc->state); XRemoveFromSaveSet(X_Dpy, cc->win); XSync(X_Dpy, False); @@ -454,7 +454,7 @@ client_hide(struct client_ctx *cc) cc->active = 0; cc->flags |= CLIENT_HIDDEN; cc->state = IconicState; - xu_setstate(cc->win, cc->state); + xu_set_wm_state(cc->win, cc->state); if (cc == client_current()) client_none(cc->sc); @@ -467,7 +467,7 @@ client_unhide(struct client_ctx *cc) cc->flags &= ~CLIENT_HIDDEN; cc->state = NormalState; - xu_setstate(cc->win, cc->state); + xu_set_wm_state(cc->win, cc->state); client_draw_border(cc); } diff --git a/xutil.c b/xutil.c index 8a22e21..765b664 100644 --- a/xutil.c +++ b/xutil.c @@ -203,7 +203,7 @@ xu_getstrprop(Window win, Atom atm, char **text) { } int -xu_getstate(Window win, int *state) +xu_get_wm_state(Window win, int *state) { long *p = NULL; @@ -218,7 +218,7 @@ xu_getstate(Window win, int *state) } void -xu_setstate(Window win, int state) +xu_set_wm_state(Window win, int state) { long dat[2]; From 94e341725b9e44c4ce1b15135b5b825c5c2b2dd3 Mon Sep 17 00:00:00 2001 From: okan Date: Mon, 29 Apr 2013 00:56:47 +0000 Subject: [PATCH 15/18] use an int in screen_init and avoid needing to cast for screen number (which). --- calmwm.h | 4 ++-- screen.c | 2 +- xevents.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/calmwm.h b/calmwm.h index 4eb1e69..b0a7c12 100644 --- a/calmwm.h +++ b/calmwm.h @@ -205,7 +205,7 @@ TAILQ_HEAD(autogroupwin_q, autogroupwin); struct screen_ctx { TAILQ_ENTRY(screen_ctx) entry; - u_int which; + int which; Visual *visual; Colormap colormap; Window rootwin; @@ -374,7 +374,7 @@ void search_print_client(struct menu *, int); struct geom screen_find_xinerama(struct screen_ctx *, int, int); struct screen_ctx *screen_fromroot(Window); -void screen_init(u_int); +void screen_init(int); void screen_update_geometry(struct screen_ctx *); void screen_updatestackingorder(struct screen_ctx *); diff --git a/screen.c b/screen.c index 7eac18d..6940958 100644 --- a/screen.c +++ b/screen.c @@ -31,7 +31,7 @@ #include "calmwm.h" void -screen_init(u_int which) +screen_init(int which) { struct screen_ctx *sc; Window *wins, w0, w1; diff --git a/xevents.c b/xevents.c index f19d10c..96d51d2 100644 --- a/xevents.c +++ b/xevents.c @@ -362,7 +362,7 @@ xev_handle_randr(XEvent *ee) i = XRRRootToScreen(X_Dpy, rev->root); TAILQ_FOREACH(sc, &Screenq, entry) { - if (sc->which == (u_int)i) { + if (sc->which == i) { XRRUpdateConfiguration(ee); screen_update_geometry(sc); } From 6e8f1f29554e917676a910d7a1568415e52b870a Mon Sep 17 00:00:00 2001 From: okan Date: Tue, 30 Apr 2013 21:10:23 +0000 Subject: [PATCH 16/18] type fix --- group.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/group.c b/group.c index 336400c..d73f8c4 100644 --- a/group.c +++ b/group.c @@ -98,8 +98,7 @@ group_show(struct screen_ctx *sc, struct group_ctx *gc) { struct client_ctx *cc; Window *winlist; - u_int i; - int lastempty = -1; + int i, lastempty = -1; gc->highstack = 0; TAILQ_FOREACH(cc, &gc->clients, group_entry) { From ff6f5301f0c768e28af0e5e0457385556782dbde Mon Sep 17 00:00:00 2001 From: okan Date: Tue, 30 Apr 2013 21:11:07 +0000 Subject: [PATCH 17/18] missing proto --- search.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/search.c b/search.c index 2ee9d26..20e7621 100644 --- a/search.c +++ b/search.c @@ -38,6 +38,8 @@ static void search_match_path(struct menu_q *, struct menu_q *, char *, int); +static void search_match_path_exec(struct menu_q *, struct menu_q *, + char *); static int strsubmatch(char *, char *, int); /* @@ -192,7 +194,7 @@ search_match_path(struct menu_q *menuq, struct menu_q *resultq, char *search, in globfree(&g); } -void +static void search_match_path_exec(struct menu_q *menuq, struct menu_q *resultq, char *search) { return (search_match_path(menuq, resultq, search, PATH_EXEC)); From 5ab3b373d39c333de5774a9503c450fc9fccd814 Mon Sep 17 00:00:00 2001 From: okan Date: Tue, 30 Apr 2013 21:12:20 +0000 Subject: [PATCH 18/18] group conf_* init functions --- screen.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/screen.c b/screen.c index 6940958..345bdcc 100644 --- a/screen.c +++ b/screen.c @@ -50,16 +50,14 @@ screen_init(int which) xu_ewmh_net_supported_wm_check(sc); conf_gap(&Conf, sc); + conf_color(&Conf, sc); + conf_font(&Conf, sc); screen_update_geometry(sc); - conf_color(&Conf, sc); - - group_init(sc); - conf_font(&Conf, sc); - TAILQ_INIT(&sc->mruq); + group_init(sc); menu_init(sc); rootattr.cursor = Cursor_normal;