From 8820d141461c02e818d14cf2afd57a9d21dbbd08 Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Mon, 13 Mar 2006 09:22:35 +0100 Subject: [PATCH] some refactoring of defines --- cmd/wm/client.c | 2 +- cmd/wm/kb.c | 7 ++----- cmd/wm/wm.c | 2 +- cmd/wm/wm.h | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/cmd/wm/client.c b/cmd/wm/client.c index b118e50c..78cb4aa5 100644 --- a/cmd/wm/client.c +++ b/cmd/wm/client.c @@ -170,7 +170,7 @@ send_client_message(Window w, Atom a, long value) void kill_client(Client * c) { - if(c->proto & PROTO_DEL) + if(c->proto & WM_PROTOCOL_DELWIN) send_client_message(c->win, wm_atom[WMProtocols], wm_atom[WMDelete]); else XKillClient(dpy, c->win); diff --git a/cmd/wm/kb.c b/cmd/wm/kb.c index 3ba81c7d..e1a22bff 100644 --- a/cmd/wm/kb.c +++ b/cmd/wm/kb.c @@ -10,14 +10,12 @@ #include "wm.h" -#define NUM_MASKS 8 - void init_lock_modifiers() { XModifierKeymap *modmap; KeyCode num_lock; - static int masks[NUM_MASKS] = { + static int masks[] = { ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask }; @@ -28,7 +26,7 @@ init_lock_modifiers() num_lock = XKeysymToKeycode(dpy, XStringToKeysym("Num_Lock")); if(modmap && modmap->max_keypermod > 0) { - int max = NUM_MASKS * modmap->max_keypermod; + int max = (sizeof(masks) / sizeof(int)) * modmap->max_keypermod; for(i = 0; i < max; i++) { if(num_lock && (modmap->modifiermap[i] == num_lock)) num_lock_mask = masks[i / modmap->max_keypermod]; @@ -63,7 +61,6 @@ blitz_strtomod(char *val) static void grab_key(Key *k) { - fprintf(stderr, "grabbing %s %ld %d\n", k->name, k->mod, k->key); XGrabKey(dpy, k->key, k->mod, root, True, GrabModeAsync, GrabModeAsync); if(num_lock_mask) { diff --git a/cmd/wm/wm.c b/cmd/wm/wm.c index 270f4275..677ce1c7 100644 --- a/cmd/wm/wm.c +++ b/cmd/wm/wm.c @@ -99,7 +99,7 @@ win_proto(Window w) } for(i = 0; i < res; i++) { if(protocols[i] == wm_atom[WMDelete]) - protos |= PROTO_DEL; + protos |= WM_PROTOCOL_DELWIN; } free((char *) protocols); return protos; diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h index 3c6806a4..d80b049d 100644 --- a/cmd/wm/wm.h +++ b/cmd/wm/wm.h @@ -73,12 +73,12 @@ enum { FsFmode }; -#define PROTO_DEL 1 #define DEF_BORDER 3 #define DEF_SNAP 20 #define ROOT_MASK SubstructureRedirectMask #define CLIENT_MASK (StructureNotifyMask | PropertyChangeMask) +#define WM_PROTOCOL_DELWIN 1 typedef struct Tag Tag; typedef struct Area Area;