summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2008-06-25 22:37:30 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2008-06-25 22:37:30 +0000
commitf0838c5278d5708f93cd3c5df424f634f7c03ccf (patch)
tree553afa3388661c5cdd00c7490f9b75b515c3990a
parent3d3b7ac4619789b34cb2abbcb995a1bf5fed6493 (diff)
Actually grab the correct mouse buttons for a window, instead of doing the
old hardcoded ones (which now can be wrong). tested by todd@ and johan@.
-rw-r--r--app/cwm/calmwm.h3
-rw-r--r--app/cwm/client.c5
-rw-r--r--app/cwm/conf.c32
3 files changed, 35 insertions, 5 deletions
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h
index edbc32a57..90c9ee2ff 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.
*
- * $Id: calmwm.h,v 1.55 2008/06/17 23:40:33 oga Exp $
+ * $Id: calmwm.h,v 1.56 2008/06/25 22:37:29 oga Exp $
*/
#ifndef _CALMWM_H_
@@ -424,6 +424,7 @@ void conf_bindname(struct conf *, char *, char *);
void conf_unbind(struct conf *, struct keybinding *);
void conf_mousebind(struct conf *, char *, char *);
void conf_mouseunbind(struct conf *, struct mousebinding *);
+void conf_grab_mouse(struct client_ctx *);
int conf_changed(char *);
void conf_reload(struct conf *);
void conf_font(struct conf *);
diff --git a/app/cwm/client.c b/app/cwm/client.c
index 1f5565a3d..317091cf2 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.
*
- * $Id: client.c,v 1.31 2008/06/18 20:42:29 oga Exp $
+ * $Id: client.c,v 1.32 2008/06/25 22:37:29 oga Exp $
*/
#include "headers.h"
@@ -272,8 +272,7 @@ client_setactive(struct client_ctx *cc, int fg)
XInstallColormap(X_Dpy, cc->cmap);
XSetInputFocus(X_Dpy, cc->win,
RevertToPointerRoot, CurrentTime);
- xu_btn_grab(cc->pwin, Mod1Mask, AnyButton);
- xu_btn_grab(cc->pwin, ControlMask|Mod1Mask, Button1);
+ conf_grab_mouse(cc);
/*
* If we're in the middle of alt-tabbing, don't change
* the order please.
diff --git a/app/cwm/conf.c b/app/cwm/conf.c
index 097a64775..9947d8db8 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.
*
- * $Id: conf.c,v 1.42 2008/06/17 23:40:33 oga Exp $
+ * $Id: conf.c,v 1.43 2008/06/25 22:37:29 oga Exp $
*/
#include "headers.h"
@@ -474,3 +474,33 @@ conf_mouseunbind(struct conf *c, struct mousebinding *unbind)
}
}
+/*
+ * Grab the mouse buttons that we need for bindings for this client
+ */
+void
+conf_grab_mouse(struct client_ctx *cc)
+{
+ struct mousebinding *mb;
+ int button;
+
+
+ TAILQ_FOREACH(mb, &Conf.mousebindingq, entry) {
+ if (mb->context != MOUSEBIND_CTX_WIN)
+ continue;
+
+ switch(mb->button) {
+ case 1:
+ button = Button1;
+ break;
+ case 2:
+ button = Button2;
+ break;
+ case 3:
+ button = Button3;
+ break;
+ default:
+ warnx("strange button in mousebinding\n");
+ }
+ xu_btn_grab(cc->pwin, mb->modmask, button);
+ }
+}