]> git.lizzy.rs Git - bspwm.git/commitdiff
Provide a way to disable built-in pointer bindings
authorBastien Dejean <nihilhill@gmail.com>
Sat, 21 May 2016 19:31:14 +0000 (21:31 +0200)
committerBastien Dejean <nihilhill@gmail.com>
Sat, 21 May 2016 19:31:14 +0000 (21:31 +0200)
Fixes #490.

doc/bspwm.1
doc/bspwm.1.asciidoc
messages.c
parse.c
pointer.c
query.c
types.h

index b28085999190e6f95d7e300d26f81f6424366a3f..bb6b821c073b69e8c930be0ce0c993d3f67178d1 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: bspwm
 .\"    Author: [see the "Author" section]
 .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
-.\"      Date: 05/20/2016
+.\"      Date: 05/21/2016
 .\"    Manual: Bspwm Manual
-.\"    Source: Bspwm 0.9.1-75-g666af89
+.\"    Source: Bspwm 0.9.1-76-g319566e
 .\"  Language: English
 .\"
-.TH "BSPWM" "1" "05/20/2016" "Bspwm 0\&.9\&.1\-75\-g666af89" "Bspwm Manual"
+.TH "BSPWM" "1" "05/21/2016" "Bspwm 0\&.9\&.1\-76\-g319566e" "Bspwm Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -1087,7 +1087,8 @@ Action performed when pressing
 \fBmove\fR,
 \fBresize_side\fR,
 \fBresize_corner\fR,
-\fBfocus\fR\&.
+\fBfocus\fR,
+\fBnone\fR\&.
 .RE
 .PP
 \fIclick_to_focus\fR
index 9714eb3e4a2d51eacd03723d199590ffc6121563..0ba586c0f4a2d856f58e25e57463189ee586d938 100644 (file)
@@ -636,7 +636,7 @@ Global Settings
 'pointer_action1'::
 'pointer_action2'::
 'pointer_action3'::
-       Action performed when pressing 'pointer_modifier' + 'button<n>'. Accept the following values: *move*, *resize_side*, *resize_corner*, *focus*.
+       Action performed when pressing 'pointer_modifier' + 'button<n>'. Accept the following values: *move*, *resize_side*, *resize_corner*, *focus*, *none*.
 
 'click_to_focus'::
        Focus a window (or a monitor) by clicking it.
index 5cf92791bdba2ecf6a8a5ef1bacf5cacacdd9b25..1a925586bc471215c198e9eb00d8f0d8086cecd9 100644 (file)
@@ -1439,7 +1439,10 @@ void set_setting(coordinates_t loc, char *name, char *value, FILE *rsp)
                   streq("pointer_action2", name) ||
                   streq("pointer_action3", name)) {
                int index = name[14] - '1';
-               if (!parse_pointer_action(value, &pointer_actions[index])) {
+               if (parse_pointer_action(value, &pointer_actions[index])) {
+                       ungrab_buttons();
+                       grab_buttons();
+               } else {
                        fail(rsp, "config: %s: Invalid value: '%s'.\n", name, value);
                        return;
                }
diff --git a/parse.c b/parse.c
index 04b8ed4b8a6f1785b376e9718d180191b7b02a2a..5c40672555ed7bcf905b6ac6ab57a73ae949e0de 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -227,6 +227,9 @@ bool parse_pointer_action(char *s, pointer_action_t *a)
        } else if (streq("focus", s)) {
                *a = ACTION_FOCUS;
                return true;
+       } else if (streq("none", s)) {
+               *a = ACTION_NONE;
+               return true;
        }
        return false;
 }
index 9222a29f84600f11366977f29e227a8ff7c5457c..284875e2e4afef75734d21caaec440008ac95d3a 100644 (file)
--- a/pointer.c
+++ b/pointer.c
@@ -55,7 +55,9 @@ void grab_buttons(void)
        }
        uint8_t buttons[] = {XCB_BUTTON_INDEX_1, XCB_BUTTON_INDEX_2, XCB_BUTTON_INDEX_3};
        for (unsigned int i = 0; i < LENGTH(buttons); i++) {
-               grab_button(buttons[i], pointer_modifier);
+               if (pointer_actions[i] != ACTION_NONE) {
+                       grab_button(buttons[i], pointer_modifier);
+               }
        }
 }
 
diff --git a/query.c b/query.c
index 7a0e3e214047777dde5b8d9ffd7dec9a791d979e..11e774a026b7fa37939d2284466a51ef03ca89af 100644 (file)
--- a/query.c
+++ b/query.c
@@ -315,9 +315,6 @@ void print_modifier_mask(uint16_t m, FILE *rsp)
 void print_pointer_action(pointer_action_t a, FILE *rsp)
 {
        switch (a) {
-               case ACTION_FOCUS:
-                       fprintf(rsp, "focus");
-                       break;
                case ACTION_MOVE:
                        fprintf(rsp, "move");
                        break;
@@ -327,6 +324,12 @@ void print_pointer_action(pointer_action_t a, FILE *rsp)
                case ACTION_RESIZE_CORNER:
                        fprintf(rsp, "resize_corner");
                        break;
+               case ACTION_FOCUS:
+                       fprintf(rsp, "focus");
+                       break;
+               case ACTION_NONE:
+                       fprintf(rsp, "none");
+                       break;
        }
 }
 
diff --git a/types.h b/types.h
index 027ff11f08d2217315dfd92f18afd0d94b76a891..cfd14f7fc5e50dfee486a4a2815c11347525c489 100644 (file)
--- a/types.h
+++ b/types.h
@@ -117,6 +117,7 @@ typedef enum {
 } resize_handle_t;
 
 typedef enum {
+       ACTION_NONE,
        ACTION_FOCUS,
        ACTION_MOVE,
        ACTION_RESIZE_SIDE,