summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2015-11-10 20:05:34 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2015-11-10 20:05:34 +0000
commit02add558861e61335f362c7d8c94913584335225 (patch)
tree18a5c6508655b92feeba5fcc0967fdc89310101f
parente17e0a72afcfeee5c188c25d1ab1c8f7770cdb49 (diff)
Start cleaning up name vs function differences; replace magic numbers.
-rw-r--r--app/cwm/calmwm.c4
-rw-r--r--app/cwm/calmwm.h49
-rw-r--r--app/cwm/client.c8
-rw-r--r--app/cwm/conf.c224
-rw-r--r--app/cwm/group.c4
-rw-r--r--app/cwm/kbfunc.c36
-rw-r--r--app/cwm/mousefunc.c4
-rw-r--r--app/cwm/xevents.c6
8 files changed, 178 insertions, 157 deletions
diff --git a/app/cwm/calmwm.c b/app/cwm/calmwm.c
index c0e93fe3a..96e7c1601 100644
--- a/app/cwm/calmwm.c
+++ b/app/cwm/calmwm.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: calmwm.c,v 1.94 2015/09/16 17:58:25 okan Exp $
+ * $OpenBSD: calmwm.c,v 1.95 2015/11/10 20:05:33 okan Exp $
*/
#include <sys/types.h>
@@ -116,7 +116,7 @@ main(int argc, char **argv)
while (cwm_status == CWM_RUNNING)
xev_process();
x_teardown();
- if (cwm_status == CWM_EXECWM)
+ if (cwm_status == CWM_EXEC_WM)
u_exec(wm_argv);
return(0);
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h
index cbe870836..bf1ff36d0 100644
--- a/app/cwm/calmwm.h
+++ b/app/cwm/calmwm.h
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: calmwm.h,v 1.307 2015/11/09 20:15:23 okan Exp $
+ * $OpenBSD: calmwm.h,v 1.308 2015/11/10 20:05:33 okan Exp $
*/
#ifndef _CALMWM_H_
@@ -60,35 +60,35 @@
#define CWM_LEFT 0x0040
#define CWM_RIGHT 0x0080
-/* exec */
-#define CWM_EXEC_PROGRAM 0x0001
-#define CWM_EXEC_WM 0x0002
+#define CWM_CLIENT_CYCLE 0x0001
+#define CWM_CLIENT_RCYCLE 0x0002
+#define CWM_CLIENT_CYCLE_INGRP 0x0004
-/* cycle */
-#define CWM_CYCLE 0x0001
-#define CWM_RCYCLE 0x0002
-#define CWM_INGROUP 0x0004
+#define CWM_CLIENT_TILE_HORIZ 0x0001
+#define CWM_CLIENT_TILE_VERT 0x0002
+
+#define CWM_MENU_EXEC 0x0001
+#define CWM_MENU_EXEC_WM 0x0002
-/* menu */
#define CWM_MENU_DUMMY 0x0001
#define CWM_MENU_FILE 0x0002
#define CWM_MENU_LIST 0x0004
-#define CWM_TILE_HORIZ 0x0001
-#define CWM_TILE_VERT 0x0002
+#define CWM_KBD 0x0001
+#define CWM_MOUSE 0x0002
-#define CWM_WIN 0x0001
-#define CWM_CMD 0x0002
+#define CWM_CONTEXT_NONE 0x0000
+#define CWM_CONTEXT_CLIENT 0x0001
+#define CWM_CONTEXT_SCREEN 0x0002
#define CWM_QUIT 0x0000
#define CWM_RUNNING 0x0001
-#define CWM_EXECWM 0x0002
+#define CWM_EXEC_WM 0x0002
union arg {
char *c;
int i;
};
-
union press {
KeySym keysym;
unsigned int button;
@@ -102,7 +102,6 @@ enum cursor_font {
CF_RESIZE,
CF_NITEMS
};
-
enum color {
CWM_COLOR_BORDER_ACTIVE,
CWM_COLOR_BORDER_INACTIVE,
@@ -251,7 +250,7 @@ struct binding {
union arg argument;
unsigned int modmask;
union press press;
- int flags;
+ int context;
};
TAILQ_HEAD(keybinding_q, binding);
TAILQ_HEAD(mousebinding_q, binding);
@@ -479,7 +478,7 @@ void kbfunc_client_nogroup(struct client_ctx *,
union arg *);
void kbfunc_client_raise(struct client_ctx *, union arg *);
void kbfunc_client_rcycle(struct client_ctx *, union arg *);
-void kbfunc_client_search(struct client_ctx *, union arg *);
+void kbfunc_client_tile(struct client_ctx *, union arg *);
void kbfunc_client_toggle_freeze(struct client_ctx *,
union arg *);
void kbfunc_client_toggle_fullscreen(struct client_ctx *,
@@ -492,24 +491,24 @@ void kbfunc_client_toggle_sticky(struct client_ctx *,
union arg *);
void kbfunc_client_toggle_vmaximize(struct client_ctx *,
union arg *);
-void kbfunc_cmdexec(struct client_ctx *, union arg *);
void kbfunc_cwm_status(struct client_ctx *, union arg *);
void kbfunc_exec(struct client_ctx *, union arg *);
-void kbfunc_lock(struct client_ctx *, union arg *);
+void kbfunc_exec_lock(struct client_ctx *, union arg *);
+void kbfunc_exec_term(struct client_ctx *, union arg *);
+void kbfunc_menu_exec(struct client_ctx *, union arg *);
+void kbfunc_menu_client(struct client_ctx *, union arg *);
void kbfunc_menu_cmd(struct client_ctx *, union arg *);
void kbfunc_menu_group(struct client_ctx *, union arg *);
-void kbfunc_ssh(struct client_ctx *, union arg *);
-void kbfunc_term(struct client_ctx *, union arg *);
-void kbfunc_tile(struct client_ctx *, union arg *);
+void kbfunc_menu_ssh(struct client_ctx *, union arg *);
void mousefunc_client_move(struct client_ctx *,
union arg *);
void mousefunc_client_resize(struct client_ctx *,
union arg *);
+void mousefunc_menu_client(struct client_ctx *,
+ union arg *);
void mousefunc_menu_cmd(struct client_ctx *, union arg *);
void mousefunc_menu_group(struct client_ctx *, union arg *);
-void mousefunc_menu_unhide(struct client_ctx *,
- union arg *);
struct menu *menu_filter(struct screen_ctx *, struct menu_q *,
const char *, const char *, int,
diff --git a/app/cwm/client.c b/app/cwm/client.c
index 0b9f3c26b..d9a9b7d5e 100644
--- a/app/cwm/client.c
+++ b/app/cwm/client.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: client.c,v 1.211 2015/11/09 20:03:29 okan Exp $
+ * $OpenBSD: client.c,v 1.212 2015/11/10 20:05:33 okan Exp $
*/
#include <sys/types.h>
@@ -678,7 +678,7 @@ client_cycle(struct screen_ctx *sc, int flags)
oldcc = client_current();
if (oldcc == NULL)
- oldcc = (flags & CWM_RCYCLE) ?
+ oldcc = (flags & CWM_CLIENT_RCYCLE) ?
TAILQ_LAST(&sc->clientq, client_ctx_q) :
TAILQ_FIRST(&sc->clientq);
@@ -686,12 +686,12 @@ client_cycle(struct screen_ctx *sc, int flags)
while (again) {
again = 0;
- newcc = (flags & CWM_RCYCLE) ? client_prev(newcc) :
+ newcc = (flags & CWM_CLIENT_RCYCLE) ? client_prev(newcc) :
client_next(newcc);
/* Only cycle visible and non-ignored windows. */
if ((newcc->flags & (CLIENT_HIDDEN | CLIENT_IGNORE))
- || ((flags & CWM_INGROUP) &&
+ || ((flags & CWM_CLIENT_CYCLE_INGRP) &&
(newcc->gc != oldcc->gc)))
again = 1;
diff --git a/app/cwm/conf.c b/app/cwm/conf.c
index 7d5bfab79..92f775bac 100644
--- a/app/cwm/conf.c
+++ b/app/cwm/conf.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: conf.c,v 1.198 2015/09/16 17:58:25 okan Exp $
+ * $OpenBSD: conf.c,v 1.199 2015/11/10 20:05:33 okan Exp $
*/
#include <sys/types.h>
@@ -346,126 +346,148 @@ conf_client(struct client_ctx *cc)
static const struct {
const char *tag;
void (*handler)(struct client_ctx *, union arg *);
- int flags;
+ int context;
union arg argument;
} name_to_func[] = {
- { "lower", kbfunc_client_lower, CWM_WIN, {0} },
- { "raise", kbfunc_client_raise, CWM_WIN, {0} },
- { "search", kbfunc_client_search, 0, {0} },
- { "menusearch", kbfunc_menu_cmd, 0, {0} },
- { "groupsearch", kbfunc_menu_group, 0, {0} },
- { "hide", kbfunc_client_hide, CWM_WIN, {0} },
- { "cycle", kbfunc_client_cycle, 0, {.i = CWM_CYCLE} },
- { "rcycle", kbfunc_client_cycle, 0, {.i = CWM_RCYCLE} },
- { "label", kbfunc_client_label, CWM_WIN, {0} },
- { "delete", kbfunc_client_delete, CWM_WIN, {0} },
- { "group1", kbfunc_client_group, 0, {.i = 1} },
- { "group2", kbfunc_client_group, 0, {.i = 2} },
- { "group3", kbfunc_client_group, 0, {.i = 3} },
- { "group4", kbfunc_client_group, 0, {.i = 4} },
- { "group5", kbfunc_client_group, 0, {.i = 5} },
- { "group6", kbfunc_client_group, 0, {.i = 6} },
- { "group7", kbfunc_client_group, 0, {.i = 7} },
- { "group8", kbfunc_client_group, 0, {.i = 8} },
- { "group9", kbfunc_client_group, 0, {.i = 9} },
- { "grouponly1", kbfunc_client_grouponly, 0, {.i = 1} },
- { "grouponly2", kbfunc_client_grouponly, 0, {.i = 2} },
- { "grouponly3", kbfunc_client_grouponly, 0, {.i = 3} },
- { "grouponly4", kbfunc_client_grouponly, 0, {.i = 4} },
- { "grouponly5", kbfunc_client_grouponly, 0, {.i = 5} },
- { "grouponly6", kbfunc_client_grouponly, 0, {.i = 6} },
- { "grouponly7", kbfunc_client_grouponly, 0, {.i = 7} },
- { "grouponly8", kbfunc_client_grouponly, 0, {.i = 8} },
- { "grouponly9", kbfunc_client_grouponly, 0, {.i = 9} },
- { "movetogroup1", kbfunc_client_movetogroup, CWM_WIN, {.i = 1} },
- { "movetogroup2", kbfunc_client_movetogroup, CWM_WIN, {.i = 2} },
- { "movetogroup3", kbfunc_client_movetogroup, CWM_WIN, {.i = 3} },
- { "movetogroup4", kbfunc_client_movetogroup, CWM_WIN, {.i = 4} },
- { "movetogroup5", kbfunc_client_movetogroup, CWM_WIN, {.i = 5} },
- { "movetogroup6", kbfunc_client_movetogroup, CWM_WIN, {.i = 6} },
- { "movetogroup7", kbfunc_client_movetogroup, CWM_WIN, {.i = 7} },
- { "movetogroup8", kbfunc_client_movetogroup, CWM_WIN, {.i = 8} },
- { "movetogroup9", kbfunc_client_movetogroup, CWM_WIN, {.i = 9} },
- { "nogroup", kbfunc_client_nogroup, 0, {0} },
- { "cyclegroup", kbfunc_client_cyclegroup, 0, {.i = CWM_CYCLE} },
- { "rcyclegroup", kbfunc_client_cyclegroup, 0, {.i = CWM_RCYCLE} },
- { "cycleingroup", kbfunc_client_cycle, CWM_WIN,
- {.i = (CWM_CYCLE | CWM_INGROUP)} },
- { "rcycleingroup", kbfunc_client_cycle, CWM_WIN,
- {.i = (CWM_RCYCLE | CWM_INGROUP)} },
- { "grouptoggle", kbfunc_client_grouptoggle, CWM_WIN, {.i = 0}},
- { "sticky", kbfunc_client_toggle_sticky, CWM_WIN, {0} },
- { "fullscreen", kbfunc_client_toggle_fullscreen, CWM_WIN, {0} },
- { "maximize", kbfunc_client_toggle_maximize, CWM_WIN, {0} },
- { "vmaximize", kbfunc_client_toggle_vmaximize, CWM_WIN, {0} },
- { "hmaximize", kbfunc_client_toggle_hmaximize, CWM_WIN, {0} },
- { "freeze", kbfunc_client_toggle_freeze, CWM_WIN, {0} },
- { "restart", kbfunc_cwm_status, 0, {.i = CWM_EXECWM} },
- { "quit", kbfunc_cwm_status, 0, {.i = CWM_QUIT} },
- { "exec", kbfunc_exec, 0, {.i = CWM_EXEC_PROGRAM} },
- { "exec_wm", kbfunc_exec, 0, {.i = CWM_EXEC_WM} },
- { "ssh", kbfunc_ssh, 0, {0} },
- { "terminal", kbfunc_term, 0, {0} },
- { "lock", kbfunc_lock, 0, {0} },
- { "moveup", kbfunc_client_moveresize, CWM_WIN,
+ { "lower", kbfunc_client_lower, CWM_CONTEXT_CLIENT, {0} },
+ { "raise", kbfunc_client_raise, CWM_CONTEXT_CLIENT, {0} },
+ { "search", kbfunc_menu_client, CWM_CONTEXT_SCREEN, {0} },
+ { "menusearch", kbfunc_menu_cmd, CWM_CONTEXT_SCREEN, {0} },
+ { "groupsearch", kbfunc_menu_group, CWM_CONTEXT_SCREEN, {0} },
+ { "hide", kbfunc_client_hide, CWM_CONTEXT_CLIENT, {0} },
+ { "cycle", kbfunc_client_cycle, CWM_CONTEXT_SCREEN,
+ {.i = CWM_CLIENT_CYCLE} },
+ { "rcycle", kbfunc_client_cycle, CWM_CONTEXT_SCREEN,
+ {.i = CWM_CLIENT_RCYCLE} },
+ { "label", kbfunc_client_label, CWM_CONTEXT_CLIENT, {0} },
+ { "delete", kbfunc_client_delete, CWM_CONTEXT_CLIENT, {0} },
+ { "group1", kbfunc_client_group, CWM_CONTEXT_SCREEN, {.i = 1} },
+ { "group2", kbfunc_client_group, CWM_CONTEXT_SCREEN, {.i = 2} },
+ { "group3", kbfunc_client_group, CWM_CONTEXT_SCREEN, {.i = 3} },
+ { "group4", kbfunc_client_group, CWM_CONTEXT_SCREEN, {.i = 4} },
+ { "group5", kbfunc_client_group, CWM_CONTEXT_SCREEN, {.i = 5} },
+ { "group6", kbfunc_client_group, CWM_CONTEXT_SCREEN, {.i = 6} },
+ { "group7", kbfunc_client_group, CWM_CONTEXT_SCREEN, {.i = 7} },
+ { "group8", kbfunc_client_group, CWM_CONTEXT_SCREEN, {.i = 8} },
+ { "group9", kbfunc_client_group, CWM_CONTEXT_SCREEN, {.i = 9} },
+ { "grouponly1", kbfunc_client_grouponly, CWM_CONTEXT_SCREEN, {.i = 1} },
+ { "grouponly2", kbfunc_client_grouponly, CWM_CONTEXT_SCREEN, {.i = 2} },
+ { "grouponly3", kbfunc_client_grouponly, CWM_CONTEXT_SCREEN, {.i = 3} },
+ { "grouponly4", kbfunc_client_grouponly, CWM_CONTEXT_SCREEN, {.i = 4} },
+ { "grouponly5", kbfunc_client_grouponly, CWM_CONTEXT_SCREEN, {.i = 5} },
+ { "grouponly6", kbfunc_client_grouponly, CWM_CONTEXT_SCREEN, {.i = 6} },
+ { "grouponly7", kbfunc_client_grouponly, CWM_CONTEXT_SCREEN, {.i = 7} },
+ { "grouponly8", kbfunc_client_grouponly, CWM_CONTEXT_SCREEN, {.i = 8} },
+ { "grouponly9", kbfunc_client_grouponly, CWM_CONTEXT_SCREEN, {.i = 9} },
+ { "movetogroup1", kbfunc_client_movetogroup, CWM_CONTEXT_CLIENT,
+ {.i = 1} },
+ { "movetogroup2", kbfunc_client_movetogroup, CWM_CONTEXT_CLIENT,
+ {.i = 2} },
+ { "movetogroup3", kbfunc_client_movetogroup, CWM_CONTEXT_CLIENT,
+ {.i = 3} },
+ { "movetogroup4", kbfunc_client_movetogroup, CWM_CONTEXT_CLIENT,
+ {.i = 4} },
+ { "movetogroup5", kbfunc_client_movetogroup, CWM_CONTEXT_CLIENT,
+ {.i = 5} },
+ { "movetogroup6", kbfunc_client_movetogroup, CWM_CONTEXT_CLIENT,
+ {.i = 6} },
+ { "movetogroup7", kbfunc_client_movetogroup, CWM_CONTEXT_CLIENT,
+ {.i = 7} },
+ { "movetogroup8", kbfunc_client_movetogroup, CWM_CONTEXT_CLIENT,
+ {.i = 8} },
+ { "movetogroup9", kbfunc_client_movetogroup, CWM_CONTEXT_CLIENT,
+ {.i = 9} },
+ { "nogroup", kbfunc_client_nogroup, CWM_CONTEXT_SCREEN, {0} },
+ { "cyclegroup", kbfunc_client_cyclegroup, CWM_CONTEXT_SCREEN,
+ {.i = CWM_CLIENT_CYCLE} },
+ { "rcyclegroup", kbfunc_client_cyclegroup, CWM_CONTEXT_SCREEN,
+ {.i = CWM_CLIENT_RCYCLE} },
+ { "cycleingroup", kbfunc_client_cycle, CWM_CONTEXT_CLIENT,
+ {.i = (CWM_CLIENT_CYCLE | CWM_CLIENT_CYCLE_INGRP)} },
+ { "rcycleingroup", kbfunc_client_cycle, CWM_CONTEXT_CLIENT,
+ {.i = (CWM_CLIENT_RCYCLE | CWM_CLIENT_CYCLE_INGRP)} },
+ { "grouptoggle", kbfunc_client_grouptoggle, CWM_CONTEXT_CLIENT,
+ {.i = CWM_KBD}},
+ { "sticky", kbfunc_client_toggle_sticky, CWM_CONTEXT_CLIENT, {0} },
+ { "fullscreen", kbfunc_client_toggle_fullscreen, CWM_CONTEXT_CLIENT,
+ {0} },
+ { "maximize", kbfunc_client_toggle_maximize, CWM_CONTEXT_CLIENT, {0} },
+ { "vmaximize", kbfunc_client_toggle_vmaximize, CWM_CONTEXT_CLIENT,
+ {0} },
+ { "hmaximize", kbfunc_client_toggle_hmaximize, CWM_CONTEXT_CLIENT,
+ {0} },
+ { "freeze", kbfunc_client_toggle_freeze, CWM_CONTEXT_CLIENT, {0} },
+ { "restart", kbfunc_cwm_status, CWM_CONTEXT_SCREEN,
+ {.i = CWM_EXEC_WM} },
+ { "quit", kbfunc_cwm_status, CWM_CONTEXT_SCREEN, {.i = CWM_QUIT} },
+ { "exec", kbfunc_menu_exec, CWM_CONTEXT_SCREEN, {.i = CWM_MENU_EXEC} },
+ { "exec_wm", kbfunc_menu_exec, CWM_CONTEXT_SCREEN,
+ {.i = CWM_MENU_EXEC_WM} },
+ { "ssh", kbfunc_menu_ssh, CWM_CONTEXT_SCREEN, {0} },
+ { "terminal", kbfunc_exec_term, CWM_CONTEXT_SCREEN, {0} },
+ { "lock", kbfunc_exec_lock, CWM_CONTEXT_SCREEN, {0} },
+ { "moveup", kbfunc_client_moveresize, CWM_CONTEXT_CLIENT,
{.i = (CWM_UP | CWM_MOVE)} },
- { "movedown", kbfunc_client_moveresize, CWM_WIN,
+ { "movedown", kbfunc_client_moveresize, CWM_CONTEXT_CLIENT,
{.i = (CWM_DOWN | CWM_MOVE)} },
- { "moveright", kbfunc_client_moveresize, CWM_WIN,
+ { "moveright", kbfunc_client_moveresize, CWM_CONTEXT_CLIENT,
{.i = (CWM_RIGHT | CWM_MOVE)} },
- { "moveleft", kbfunc_client_moveresize, CWM_WIN,
+ { "moveleft", kbfunc_client_moveresize, CWM_CONTEXT_CLIENT,
{.i = (CWM_LEFT | CWM_MOVE)} },
- { "bigmoveup", kbfunc_client_moveresize, CWM_WIN,
+ { "bigmoveup", kbfunc_client_moveresize, CWM_CONTEXT_CLIENT,
{.i = (CWM_UP | CWM_MOVE | CWM_BIGMOVE)} },
- { "bigmovedown", kbfunc_client_moveresize, CWM_WIN,
+ { "bigmovedown", kbfunc_client_moveresize, CWM_CONTEXT_CLIENT,
{.i = (CWM_DOWN | CWM_MOVE | CWM_BIGMOVE)} },
- { "bigmoveright", kbfunc_client_moveresize, CWM_WIN,
+ { "bigmoveright", kbfunc_client_moveresize, CWM_CONTEXT_CLIENT,
{.i = (CWM_RIGHT | CWM_MOVE | CWM_BIGMOVE)} },
- { "bigmoveleft", kbfunc_client_moveresize, CWM_WIN,
+ { "bigmoveleft", kbfunc_client_moveresize, CWM_CONTEXT_CLIENT,
{.i = (CWM_LEFT | CWM_MOVE | CWM_BIGMOVE)} },
- { "resizeup", kbfunc_client_moveresize, CWM_WIN,
+ { "resizeup", kbfunc_client_moveresize, CWM_CONTEXT_CLIENT,
{.i = (CWM_UP | CWM_RESIZE)} },
- { "resizedown", kbfunc_client_moveresize, CWM_WIN,
+ { "resizedown", kbfunc_client_moveresize, CWM_CONTEXT_CLIENT,
{.i = (CWM_DOWN | CWM_RESIZE)} },
- { "resizeright", kbfunc_client_moveresize, CWM_WIN,
+ { "resizeright", kbfunc_client_moveresize, CWM_CONTEXT_CLIENT,
{.i = (CWM_RIGHT | CWM_RESIZE)} },
- { "resizeleft", kbfunc_client_moveresize, CWM_WIN,
+ { "resizeleft", kbfunc_client_moveresize, CWM_CONTEXT_CLIENT,
{.i = (CWM_LEFT | CWM_RESIZE)} },
- { "bigresizeup", kbfunc_client_moveresize, CWM_WIN,
+ { "bigresizeup", kbfunc_client_moveresize, CWM_CONTEXT_CLIENT,
{.i = (CWM_UP | CWM_RESIZE | CWM_BIGMOVE)} },
- { "bigresizedown", kbfunc_client_moveresize, CWM_WIN,
+ { "bigresizedown", kbfunc_client_moveresize, CWM_CONTEXT_CLIENT,
{.i = (CWM_DOWN | CWM_RESIZE | CWM_BIGMOVE)} },
- { "bigresizeright", kbfunc_client_moveresize, CWM_WIN,
+ { "bigresizeright", kbfunc_client_moveresize, CWM_CONTEXT_CLIENT,
{.i = (CWM_RIGHT | CWM_RESIZE | CWM_BIGMOVE)} },
- { "bigresizeleft", kbfunc_client_moveresize, CWM_WIN,
+ { "bigresizeleft", kbfunc_client_moveresize, CWM_CONTEXT_CLIENT,
{.i = (CWM_LEFT | CWM_RESIZE | CWM_BIGMOVE)} },
- { "ptrmoveup", kbfunc_client_moveresize, 0,
+ { "ptrmoveup", kbfunc_client_moveresize, CWM_CONTEXT_SCREEN,
{.i = (CWM_UP | CWM_PTRMOVE)} },
- { "ptrmovedown", kbfunc_client_moveresize, 0,
+ { "ptrmovedown", kbfunc_client_moveresize, CWM_CONTEXT_SCREEN,
{.i = (CWM_DOWN | CWM_PTRMOVE)} },
- { "ptrmoveleft", kbfunc_client_moveresize, 0,
+ { "ptrmoveleft", kbfunc_client_moveresize, CWM_CONTEXT_SCREEN,
{.i = (CWM_LEFT | CWM_PTRMOVE)} },
- { "ptrmoveright", kbfunc_client_moveresize, 0,
+ { "ptrmoveright", kbfunc_client_moveresize, CWM_CONTEXT_SCREEN,
{.i = (CWM_RIGHT | CWM_PTRMOVE)} },
- { "bigptrmoveup", kbfunc_client_moveresize, 0,
+ { "bigptrmoveup", kbfunc_client_moveresize, CWM_CONTEXT_SCREEN,
{.i = (CWM_UP | CWM_PTRMOVE | CWM_BIGMOVE)} },
- { "bigptrmovedown", kbfunc_client_moveresize, 0,
+ { "bigptrmovedown", kbfunc_client_moveresize, CWM_CONTEXT_SCREEN,
{.i = (CWM_DOWN | CWM_PTRMOVE | CWM_BIGMOVE)} },
- { "bigptrmoveleft", kbfunc_client_moveresize, 0,
+ { "bigptrmoveleft", kbfunc_client_moveresize, CWM_CONTEXT_SCREEN,
{.i = (CWM_LEFT | CWM_PTRMOVE | CWM_BIGMOVE)} },
- { "bigptrmoveright", kbfunc_client_moveresize, 0,
+ { "bigptrmoveright", kbfunc_client_moveresize, CWM_CONTEXT_SCREEN,
{.i = (CWM_RIGHT | CWM_PTRMOVE | CWM_BIGMOVE)} },
- { "htile", kbfunc_tile, CWM_WIN, {.i = CWM_TILE_HORIZ} },
- { "vtile", kbfunc_tile, CWM_WIN, {.i = CWM_TILE_VERT} },
- { "window_lower", kbfunc_client_lower, CWM_WIN, {0} },
- { "window_raise", kbfunc_client_raise, CWM_WIN, {0} },
- { "window_hide", kbfunc_client_hide, CWM_WIN, {0} },
- { "window_move", mousefunc_client_move, CWM_WIN, {0} },
- { "window_resize", mousefunc_client_resize, CWM_WIN, {0} },
- { "window_grouptoggle", kbfunc_client_grouptoggle, CWM_WIN, {.i = 1} },
- { "menu_group", mousefunc_menu_group, 0, {0} },
- { "menu_unhide", mousefunc_menu_unhide, 0, {0} },
- { "menu_cmd", mousefunc_menu_cmd, 0, {0} },
+ { "htile", kbfunc_client_tile, CWM_CONTEXT_CLIENT,
+ {.i = CWM_CLIENT_TILE_HORIZ} },
+ { "vtile", kbfunc_client_tile, CWM_CONTEXT_CLIENT,
+ {.i = CWM_CLIENT_TILE_VERT} },
+ { "window_lower", kbfunc_client_lower, CWM_CONTEXT_CLIENT, {0} },
+ { "window_raise", kbfunc_client_raise, CWM_CONTEXT_CLIENT, {0} },
+ { "window_hide", kbfunc_client_hide, CWM_CONTEXT_CLIENT, {0} },
+ { "window_move", mousefunc_client_move, CWM_CONTEXT_CLIENT, {0} },
+ { "window_resize", mousefunc_client_resize, CWM_CONTEXT_CLIENT, {0} },
+ { "window_grouptoggle", kbfunc_client_grouptoggle, CWM_CONTEXT_CLIENT,
+ {.i = CWM_MOUSE} },
+ { "menu_group", mousefunc_menu_group, CWM_CONTEXT_SCREEN, {0} },
+ { "menu_unhide", mousefunc_menu_client, CWM_CONTEXT_SCREEN, {0} },
+ { "menu_cmd", mousefunc_menu_cmd, CWM_CONTEXT_SCREEN, {0} },
};
static const struct {
@@ -527,14 +549,14 @@ conf_bind_kbd(struct conf *c, const char *bind, const char *cmd)
continue;
kb->callback = name_to_func[i].handler;
- kb->flags = name_to_func[i].flags;
+ kb->context = name_to_func[i].context;
kb->argument = name_to_func[i].argument;
TAILQ_INSERT_TAIL(&c->keybindingq, kb, entry);
return(1);
}
- kb->callback = kbfunc_cmdexec;
- kb->flags = CWM_CMD;
+ kb->callback = kbfunc_exec;
+ kb->context = CWM_CONTEXT_NONE;
kb->argument.c = xstrdup(cmd);
TAILQ_INSERT_TAIL(&c->keybindingq, kb, entry);
return(1);
@@ -551,7 +573,7 @@ conf_unbind_kbd(struct conf *c, struct binding *unbind)
if (key->press.keysym == unbind->press.keysym) {
TAILQ_REMOVE(&c->keybindingq, key, entry);
- if (key->flags & CWM_CMD)
+ if (key->context == CWM_CONTEXT_NONE)
free(key->argument.c);
free(key);
}
@@ -588,7 +610,7 @@ conf_bind_mouse(struct conf *c, const char *bind, const char *cmd)
continue;
mb->callback = name_to_func[i].handler;
- mb->flags = name_to_func[i].flags;
+ mb->context = name_to_func[i].context;
mb->argument = name_to_func[i].argument;
TAILQ_INSERT_TAIL(&c->mousebindingq, mb, entry);
return(1);
@@ -638,7 +660,7 @@ conf_grab_mouse(Window win)
xu_btn_ungrab(win);
TAILQ_FOREACH(mb, &Conf.mousebindingq, entry) {
- if (mb->flags & CWM_WIN)
+ if (mb->context == CWM_CONTEXT_CLIENT)
xu_btn_grab(win, mb->modmask, mb->press.button);
}
}
diff --git a/app/cwm/group.c b/app/cwm/group.c
index 11c273773..a671f332e 100644
--- a/app/cwm/group.c
+++ b/app/cwm/group.c
@@ -16,7 +16,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: group.c,v 1.120 2015/08/27 18:53:15 okan Exp $
+ * $OpenBSD: group.c,v 1.121 2015/11/10 20:05:33 okan Exp $
*/
#include <sys/types.h>
@@ -272,7 +272,7 @@ group_cycle(struct screen_ctx *sc, int flags)
newgc = oldgc;
for (;;) {
- newgc = (flags & CWM_RCYCLE) ? group_prev(newgc) :
+ newgc = (flags & CWM_CLIENT_RCYCLE) ? group_prev(newgc) :
group_next(newgc);
if (newgc == oldgc)
diff --git a/app/cwm/kbfunc.c b/app/cwm/kbfunc.c
index 546f23603..537d8e0bd 100644
--- a/app/cwm/kbfunc.c
+++ b/app/cwm/kbfunc.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: kbfunc.c,v 1.119 2015/11/09 20:03:29 okan Exp $
+ * $OpenBSD: kbfunc.c,v 1.120 2015/11/10 20:05:33 okan Exp $
*/
#include <sys/types.h>
@@ -142,7 +142,7 @@ kbfunc_client_moveresize(struct client_ctx *cc, union arg *arg)
}
void
-kbfunc_client_search(struct client_ctx *cc, union arg *arg)
+kbfunc_menu_client(struct client_ctx *cc, union arg *arg)
{
struct screen_ctx *sc = cc->sc;
struct client_ctx *old_cc;
@@ -230,13 +230,13 @@ kbfunc_client_hide(struct client_ctx *cc, union arg *arg)
}
void
-kbfunc_cmdexec(struct client_ctx *cc, union arg *arg)
+kbfunc_exec(struct client_ctx *cc, union arg *arg)
{
u_spawn(arg->c);
}
void
-kbfunc_term(struct client_ctx *cc, union arg *arg)
+kbfunc_exec_term(struct client_ctx *cc, union arg *arg)
{
struct cmd *cmd;
@@ -247,7 +247,7 @@ kbfunc_term(struct client_ctx *cc, union arg *arg)
}
void
-kbfunc_lock(struct client_ctx *cc, union arg *arg)
+kbfunc_exec_lock(struct client_ctx *cc, union arg *arg)
{
struct cmd *cmd;
@@ -258,7 +258,7 @@ kbfunc_lock(struct client_ctx *cc, union arg *arg)
}
void
-kbfunc_exec(struct client_ctx *cc, union arg *arg)
+kbfunc_menu_exec(struct client_ctx *cc, union arg *arg)
{
#define NPATHS 256
struct screen_ctx *sc = cc->sc;
@@ -272,14 +272,14 @@ kbfunc_exec(struct client_ctx *cc, union arg *arg)
int l, i, cmd = arg->i;
switch (cmd) {
- case CWM_EXEC_PROGRAM:
+ case CWM_MENU_EXEC:
label = "exec";
break;
- case CWM_EXEC_WM:
+ case CWM_MENU_EXEC_WM:
label = "wm";
break;
default:
- errx(1, "kbfunc_exec: invalid cmd %d", cmd);
+ errx(1, "kbfunc_menu_exec: invalid cmd %d", cmd);
/*NOTREACHED*/
}
@@ -321,11 +321,11 @@ kbfunc_exec(struct client_ctx *cc, union arg *arg)
if (mi->text[0] == '\0')
goto out;
switch (cmd) {
- case CWM_EXEC_PROGRAM:
+ case CWM_MENU_EXEC:
u_spawn(mi->text);
break;
- case CWM_EXEC_WM:
- cwm_status = CWM_EXECWM;
+ case CWM_MENU_EXEC_WM:
+ cwm_status = CWM_EXEC_WM;
free(wm_argv);
wm_argv = xstrdup(mi->text);
break;
@@ -341,7 +341,7 @@ out:
}
void
-kbfunc_ssh(struct client_ctx *cc, union arg *arg)
+kbfunc_menu_ssh(struct client_ctx *cc, union arg *arg)
{
struct screen_ctx *sc = cc->sc;
struct cmd *cmd;
@@ -361,7 +361,7 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg)
TAILQ_INIT(&menuq);
if ((fp = fopen(Conf.known_hosts, "r")) == NULL) {
- warn("kbfunc_ssh: %s", Conf.known_hosts);
+ warn("kbfunc_menu_ssh: %s", Conf.known_hosts);
goto menu;
}
@@ -459,7 +459,7 @@ kbfunc_client_nogroup(struct client_ctx *cc, union arg *arg)
void
kbfunc_client_grouptoggle(struct client_ctx *cc, union arg *arg)
{
- if (arg->i == 0) {
+ if (arg->i == CWM_KBD) {
/* For X apps that steal events. */
XGrabKeyboard(X_Dpy, cc->win, True,
GrabModeAsync, GrabModeAsync, CurrentTime);
@@ -517,13 +517,13 @@ kbfunc_cwm_status(struct client_ctx *cc, union arg *arg)
}
void
-kbfunc_tile(struct client_ctx *cc, union arg *arg)
+kbfunc_client_tile(struct client_ctx *cc, union arg *arg)
{
switch (arg->i) {
- case CWM_TILE_HORIZ:
+ case CWM_CLIENT_TILE_HORIZ:
client_htile(cc);
break;
- case CWM_TILE_VERT:
+ case CWM_CLIENT_TILE_VERT:
client_vtile(cc);
break;
}
diff --git a/app/cwm/mousefunc.c b/app/cwm/mousefunc.c
index 3edb47a28..929fc8da7 100644
--- a/app/cwm/mousefunc.c
+++ b/app/cwm/mousefunc.c
@@ -16,7 +16,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: mousefunc.c,v 1.99 2015/11/09 20:03:30 okan Exp $
+ * $OpenBSD: mousefunc.c,v 1.100 2015/11/10 20:05:33 okan Exp $
*/
#include <sys/types.h>
@@ -196,7 +196,7 @@ mousefunc_menu_group(struct client_ctx *cc, union arg *arg)
}
void
-mousefunc_menu_unhide(struct client_ctx *cc, union arg *arg)
+mousefunc_menu_client(struct client_ctx *cc, union arg *arg)
{
struct screen_ctx *sc = cc->sc;
struct client_ctx *old_cc;
diff --git a/app/cwm/xevents.c b/app/cwm/xevents.c
index e13551415..07091685e 100644
--- a/app/cwm/xevents.c
+++ b/app/cwm/xevents.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: xevents.c,v 1.119 2015/08/27 18:42:56 okan Exp $
+ * $OpenBSD: xevents.c,v 1.120 2015/11/10 20:05:33 okan Exp $
*/
/*
@@ -232,7 +232,7 @@ xev_handle_buttonpress(XEvent *ee)
if (mb == NULL)
return;
- if (mb->flags & CWM_WIN) {
+ if (mb->context == CWM_CONTEXT_CLIENT) {
if (((cc = client_find(e->window)) == NULL) &&
(cc = client_current()) == NULL)
return;
@@ -285,7 +285,7 @@ xev_handle_keypress(XEvent *ee)
if (kb == NULL)
return;
- if (kb->flags & CWM_WIN) {
+ if (kb->context == CWM_CONTEXT_CLIENT) {
if (((cc = client_find(e->window)) == NULL) &&
(cc = client_current()) == NULL)
return;