From ea467dcc7c2dd8a6ac0a086decb3ac3809156bcc Mon Sep 17 00:00:00 2001 From: oga Date: Wed, 25 Jun 2008 22:37:29 +0000 Subject: 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@. --- conf.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'conf.c') diff --git a/conf.c b/conf.c index 097a647..9947d8d 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.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); + } +} -- cgit v1.2.3-2-gb3c3