aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--calmwm.h4
-rw-r--r--conf.c10
-rw-r--r--cwmrc.58
-rw-r--r--xevents.c8
-rw-r--r--xutil.c27
5 files changed, 30 insertions, 27 deletions
diff --git a/calmwm.h b/calmwm.h
index bb38b04..edbc32a 100644
--- a/calmwm.h
+++ b/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.
*
- * $Id: calmwm.h,v 1.54 2008/06/15 02:47:46 oga Exp $
+ * $Id: calmwm.h,v 1.55 2008/06/17 23:40:33 oga Exp $
*/
#ifndef _CALMWM_H_
@@ -384,7 +384,7 @@ void xev_register(struct xevent *);
void xev_loop(void);
int xu_ptr_grab(Window, int, Cursor);
-int xu_btn_grab(Window, int, u_int);
+void xu_btn_grab(Window, int, u_int);
int xu_ptr_regrab(int, Cursor);
void xu_btn_ungrab(Window, int, u_int);
void xu_ptr_ungrab(void);
diff --git a/conf.c b/conf.c
index c30b3f8..097a647 100644
--- a/conf.c
+++ b/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.
*
- * $Id: conf.c,v 1.41 2008/06/16 19:09:48 mk Exp $
+ * $Id: conf.c,v 1.42 2008/06/17 23:40:33 oga Exp $
*/
#include "headers.h"
@@ -323,14 +323,6 @@ conf_bindname(struct conf *c, char *name, char *binding)
strchr(name, 'M') < strchr(name, '-'))
current_binding->modmask |= Mod1Mask;
- if (strchr(name, '2') != NULL &&
- strchr(name, '2') < strchr(name, '-'))
- current_binding->modmask |= Mod2Mask;
-
- if (strchr(name, '3') != NULL &&
- strchr(name, '3') < strchr(name, '-'))
- current_binding->modmask |= Mod3Mask;
-
if (strchr(name, '4') != NULL &&
strchr(name, '4') < strchr(name, '-'))
current_binding->modmask |= Mod4Mask;
diff --git a/cwmrc.5 b/cwmrc.5
index d8f87d7..0992e4f 100644
--- a/cwmrc.5
+++ b/cwmrc.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: cwmrc.5,v 1.9 2008/06/14 21:48:54 okan Exp $
+.\" $OpenBSD: cwmrc.5,v 1.10 2008/06/17 23:40:33 oga Exp $
.\"
.\" Copyright (c) 2004,2005 Marius Aamodt Eriksen <marius@monkey.org>
.\"
@@ -15,7 +15,7 @@
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" The following requests are required for all man pages.
-.Dd $Mdocdate: June 14 2008 $
+.Dd $Mdocdate: June 17 2008 $
.Dt CWMRC 5
.Os
.Sh NAME
@@ -57,10 +57,6 @@ The Control key.
The Meta key.
.It S
The Shift key.
-.It 2
-The Mod2 key.
-.It 3
-The Mod3 key.
.It 4
The Mod4 key (normally the windows key).
.El
diff --git a/xevents.c b/xevents.c
index 299993d..5c60f82 100644
--- a/xevents.c
+++ b/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.
*
- * $Id: xevents.c,v 1.22 2008/06/17 20:55:48 oga Exp $
+ * $Id: xevents.c,v 1.23 2008/06/17 23:40:33 oga Exp $
*/
/*
@@ -228,6 +228,9 @@ xev_handle_buttonpress(struct xevent *xev, XEvent *ee)
cc = client_find(e->window);
+ /* Ignore caps lock and numlock */
+ e->state &= ~(Mod2Mask | LockMask);
+
TAILQ_FOREACH(mb, &Conf.mousebindingq, entry) {
if (e->button == mb->button && e->state == mb->modmask)
break;
@@ -273,6 +276,9 @@ xev_handle_keypress(struct xevent *xev, XEvent *ee)
keysym = XKeycodeToKeysym(X_Dpy, e->keycode, 0);
skeysym = XKeycodeToKeysym(X_Dpy, e->keycode, 1);
+ /* we don't care about caps lock and numlock here */
+ e->state &= ~(LockMask | Mod2Mask);
+
TAILQ_FOREACH(kb, &Conf.keybindingq, entry) {
if (keysym != kb->keysym && skeysym == kb->keysym)
modshift = ShiftMask;
diff --git a/xutil.c b/xutil.c
index ad58c00..a76d5c0 100644
--- a/xutil.c
+++ b/xutil.c
@@ -15,12 +15,14 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: xutil.c,v 1.6 2008/05/15 22:18:00 oga Exp $
+ * $Id: xutil.c,v 1.7 2008/06/17 23:40:33 oga Exp $
*/
#include "headers.h"
#include "calmwm.h"
+unsigned int ign_mods[] = { 0, LockMask, Mod2Mask, Mod2Mask | LockMask };
+
int
xu_ptr_grab(Window win, int mask, Cursor curs)
{
@@ -42,18 +44,22 @@ xu_ptr_ungrab(void)
XUngrabPointer(X_Dpy, CurrentTime);
}
-int
+void
xu_btn_grab(Window win, int mask, u_int btn)
{
- return (XGrabButton(X_Dpy, btn, mask, win,
- False, ButtonMask, GrabModeAsync,
- GrabModeSync, None, None) == GrabSuccess ? 0 : -1);
+ int i;
+ for (i = 0; i < sizeof(ign_mods)/sizeof(*ign_mods); i++)
+ XGrabButton(X_Dpy, btn, (mask | ign_mods[i]), win,
+ False, ButtonMask, GrabModeAsync,
+ GrabModeSync, None, None);
}
void
xu_btn_ungrab(Window win, int mask, u_int btn)
{
- XUngrabButton(X_Dpy, btn, mask, win);
+ int i;
+ for (i = 0; i < sizeof(ign_mods)/sizeof(*ign_mods); i++)
+ XUngrabButton(X_Dpy, btn, (mask | ign_mods[i]), win);
}
void
@@ -75,15 +81,18 @@ xu_ptr_setpos(Window win, int x, int y)
void
xu_key_grab(Window win, int mask, int keysym)
{
- KeyCode code;
+ KeyCode code;
+ int i;
code = XKeysymToKeycode(X_Dpy, keysym);
if ((XKeycodeToKeysym(X_Dpy, code, 0) != keysym) &&
(XKeycodeToKeysym(X_Dpy, code, 1) == keysym))
mask |= ShiftMask;
- XGrabKey(X_Dpy, XKeysymToKeycode(X_Dpy, keysym), mask, win, True,
- GrabModeAsync, GrabModeAsync);
+ for (i = 0; i < sizeof(ign_mods)/sizeof(*ign_mods); i++)
+ XGrabKey(X_Dpy, XKeysymToKeycode(X_Dpy, keysym),
+ (mask | ign_mods[i]), win, True, GrabModeAsync,
+ GrabModeAsync);
}
void