aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kanakarakis <ivan.kanak@gmail.com>2012-09-14 04:14:02 +0300
committerIvan Kanakarakis <ivan.kanak@gmail.com>2012-09-20 13:03:11 +0300
commite80860e74a22d41698cc6c9db90a900222da54a5 (patch)
treefa86da00e893e048bf68f38d8663fc9e11bad8d4
parentcc705a51334b3e74ea49b2f45be394d9d310f39b (diff)
introduce FOCUS_BUTTON - make CLICK_TO_FOCUS button configurable
-rw-r--r--config.def.h3
-rw-r--r--monsterwm.c6
2 files changed, 5 insertions, 4 deletions
diff --git a/config.def.h b/config.def.h
index 6e11747..618e845 100644
--- a/config.def.h
+++ b/config.def.h
@@ -17,7 +17,8 @@
#define ATTACH_ASIDE True /* False means new window is master */
#define FOLLOW_WINDOW False /* follow the window when moved to a different desktop */
#define FOLLOW_MOUSE False /* focus the window the mouse just entered */
-#define CLICK_TO_FOCUS False /* focus an unfocused window when clicked */
+#define CLICK_TO_FOCUS True /* focus an unfocused window when clicked */
+#define FOCUS_BUTTON Button3 /* mouse button to be used along with CLICK_TO_FOCUS */
#define BORDER_WIDTH 2 /* window border width */
#define FOCUS "#ff950e" /* focused window border color */
#define UNFOCUS "#444444" /* unfocused window border color */
diff --git a/monsterwm.c b/monsterwm.c
index e992d31..2f00afc 100644
--- a/monsterwm.c
+++ b/monsterwm.c
@@ -238,7 +238,7 @@ void buttonpress(XEvent *e) {
Client *c = NULL;
if (wintoclient(e->xbutton.window, &c, &d) && CLICK_TO_FOCUS &&
- c != d->curr && e->xbutton.button == Button1) focus(c, d);
+ c != d->curr && e->xbutton.button == FOCUS_BUTTON) focus(c, d);
for (unsigned int i = 0; i < LENGTH(buttons); i++)
if (CLEANMASK(buttons[i].mask) == CLEANMASK(e->xbutton.state) &&
@@ -579,9 +579,9 @@ void grabbuttons(Client *c) {
unsigned int b, m, modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
for (m = 0; CLICK_TO_FOCUS && m < LENGTH(modifiers); m++)
- if (c != desktops[currdeskidx].curr) XGrabButton(dis, Button1, modifiers[m],
+ if (c != desktops[currdeskidx].curr) XGrabButton(dis, FOCUS_BUTTON, modifiers[m],
c->win, False, BUTTONMASK, GrabModeAsync, GrabModeAsync, None, None);
- else XUngrabButton(dis, Button1, modifiers[m], c->win);
+ else XUngrabButton(dis, FOCUS_BUTTON, modifiers[m], c->win);
for (b = 0, m = 0; b < LENGTH(buttons); b++, m = 0) while (m < LENGTH(modifiers))
XGrabButton(dis, buttons[b].button, buttons[b].mask|modifiers[m++], c->win,