]> git.lizzy.rs Git - bspwm.git/commitdiff
Add setting: pointer_motion_interval
authorBastien Dejean <nihilhill@gmail.com>
Sat, 28 May 2016 07:43:05 +0000 (09:43 +0200)
committerBastien Dejean <nihilhill@gmail.com>
Sat, 28 May 2016 07:43:05 +0000 (09:43 +0200)
Fixes #482.

contrib/bash_completion
contrib/fish_completion
contrib/zsh_completion
doc/bspwm.1
doc/bspwm.1.asciidoc
messages.c
pointer.c
settings.c
settings.h

index 0654f1f61af87a27fbf357e038b5fe59114a1228..c04fa57b0a562049b2134656a69eeec82d9ddeef 100644 (file)
@@ -1,7 +1,7 @@
 _bspc() {
        local commands='node desktop monitor query rule restore wm subscribe config quit'
 
-       local settings='external_rules_command status_prefix normal_border_color active_border_color focused_border_color presel_feedback_color border_width window_gap top_padding right_padding bottom_padding left_padding split_ratio initial_polarity borderless_monocle gapless_monocle single_monocle pointer_modifier pointer_action1 pointer_action2 pointer_action3 click_to_focus focus_follows_pointer pointer_follows_focus pointer_follows_monitor ignore_ewmh_focus center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors'
+       local settings='external_rules_command status_prefix normal_border_color active_border_color focused_border_color presel_feedback_color border_width window_gap top_padding right_padding bottom_padding left_padding split_ratio initial_polarity borderless_monocle gapless_monocle single_monocle pointer_motion_interval pointer_modifier pointer_action1 pointer_action2 pointer_action3 click_to_focus focus_follows_pointer pointer_follows_focus pointer_follows_monitor ignore_ewmh_focus center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors'
 
        COMPREPLY=()
 
index 6488d11d4938013b5331e153ba66946bfd1e5bc7..eb936f8070a5e5a2b910634d2d0307bfe3b6996a 100644 (file)
@@ -11,4 +11,4 @@ function __fish_bspc_using_command
 end
 
 complete -f -c bspc -n '__fish_bspc_needs_command' -a 'node desktop monitor query rule restore wm subscribe config quit'
-complete -f -c bspc -n '__fish_bspc_using_command config' -a 'external_rules_command status_prefix normal_border_color active_border_color focused_border_color presel_feedback_color border_width window_gap top_padding right_padding bottom_padding left_padding split_ratio initial_polarity borderless_monocle gapless_monocle single_monocle pointer_modifier pointer_action1 pointer_action2 pointer_action3 click_to_focus focus_follows_pointer pointer_follows_focus pointer_follows_monitor ignore_ewmh_focus center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors'
+complete -f -c bspc -n '__fish_bspc_using_command config' -a 'external_rules_command status_prefix normal_border_color active_border_color focused_border_color presel_feedback_color border_width window_gap top_padding right_padding bottom_padding left_padding split_ratio initial_polarity borderless_monocle gapless_monocle single_monocle pointer_motion_interval pointer_modifier pointer_action1 pointer_action2 pointer_action3 click_to_focus focus_follows_pointer pointer_follows_focus pointer_follows_monitor ignore_ewmh_focus center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors'
index c8eaee8d29d79118035ce16ae80457d5c929482e..57281d82f439b418b45187c006562d9423dd0bea 100644 (file)
@@ -3,7 +3,7 @@
 _bspc() {
        local -a commands settings
        commands=('node' 'desktop' 'monitor' 'query' 'rule' 'restore' 'wm' 'subscribe' 'config' 'quit')
-       settings=('external_rules_command' 'status_prefix' 'normal_border_color' 'active_border_color' 'focused_border_color' 'presel_feedback_color' 'border_width' 'window_gap' 'top_padding' 'right_padding' 'bottom_padding' 'left_padding' 'split_ratio' 'initial_polarity' 'borderless_monocle' 'gapless_monocle' 'single_monocle' 'pointer_modifier' 'pointer_action1' 'pointer_action2' 'pointer_action3' 'click_to_focus' 'focus_follows_pointer' 'pointer_follows_focus' 'pointer_follows_monitor' 'ignore_ewmh_focus' 'center_pseudo_tiled' 'honor_size_hints' 'remove_disabled_monitors' 'remove_unplugged_monitors' 'merge_overlapping_monitors')
+       settings=('external_rules_command' 'status_prefix' 'normal_border_color' 'active_border_color' 'focused_border_color' 'presel_feedback_color' 'border_width' 'window_gap' 'top_padding' 'right_padding' 'bottom_padding' 'left_padding' 'split_ratio' 'initial_polarity' 'borderless_monocle' 'gapless_monocle' 'single_monocle' 'pointer_motion_interval' 'pointer_modifier' 'pointer_action1' 'pointer_action2' 'pointer_action3' 'click_to_focus' 'focus_follows_pointer' 'pointer_follows_focus' 'pointer_follows_monitor' 'ignore_ewmh_focus' 'center_pseudo_tiled' 'honor_size_hints' 'remove_disabled_monitors' 'remove_unplugged_monitors' 'merge_overlapping_monitors')
        if (( CURRENT == 2 )) ; then
                _values 'command' "$commands[@]"
        elif (( CURRENT == 3 )) ; then
index 8bd250e478c87233ccb2530d387295fdc0652c3e..7e66d337b4559b30467658172c26fa92fb2b4ad9 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: bspwm
 .\"    Author: [see the "Author" section]
 .\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
-.\"      Date: 05/24/2016
+.\"      Date: 05/28/2016
 .\"    Manual: Bspwm Manual
-.\"    Source: Bspwm 0.9.1-78-gfd6d090
+.\"    Source: Bspwm 0.9.1-80-g4583587
 .\"  Language: English
 .\"
-.TH "BSPWM" "1" "05/24/2016" "Bspwm 0\&.9\&.1\-78\-gfd6d090" "Bspwm Manual"
+.TH "BSPWM" "1" "05/28/2016" "Bspwm 0\&.9\&.1\-80\-g4583587" "Bspwm Manual"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -1065,6 +1065,11 @@ Set the desktop layout to
 if there\(cqs only one tiled window in the tree\&.
 .RE
 .PP
+\fIpointer_motion_interval\fR
+.RS 4
+The minimum interval, in milliseconds, between two motion notify events\&.
+.RE
+.PP
 \fIpointer_modifier\fR
 .RS 4
 Keyboard modifier used for moving or resizing windows\&. Accept the following values:
index c2ba4c504057dc5a3e74c50f3c070907624d55cb..3282069210a861185fb6883c731d05bb4703f495 100644 (file)
@@ -630,6 +630,9 @@ Global Settings
 'single_monocle'::
        Set the desktop layout to *monocle* if there's only one tiled window in the tree.
 
+'pointer_motion_interval'::
+       The minimum interval, in milliseconds, between two motion notify events.
+
 'pointer_modifier'::
        Keyboard modifier used for moving or resizing windows. Accept the following values: *shift*, *control*, *lock*, *mod1*, *mod2*, *mod3*, *mod4*, *mod5*.
 
index 1a925586bc471215c198e9eb00d8f0d8086cecd9..d0739c6ff4a51c008564a2ec5c994e91bd20fcea 100644 (file)
@@ -1435,6 +1435,11 @@ void set_setting(coordinates_t loc, char *name, char *value, FILE *rsp)
                        fail(rsp, "config: %s: Invalid value: '%s'.\n", name, value);
                        return;
                }
+       } else if (streq("pointer_motion_interval", name)) {
+               if (sscanf(value, "%u", &pointer_motion_interval) != 1) {
+                       fail(rsp, "config: %s: Invalid value: '%s'.\n", name, value);
+                       return;
+               }
        } else if (streq("pointer_action1", name) ||
                   streq("pointer_action2", name) ||
                   streq("pointer_action3", name)) {
@@ -1568,6 +1573,8 @@ void get_setting(coordinates_t loc, char *name, FILE* rsp)
                fprintf(rsp, "%s", CHILD_POL_STR(initial_polarity));
        } else if (streq("pointer_modifier", name)) {
                print_modifier_mask(pointer_modifier, rsp);
+       } else if (streq("pointer_motion_interval", name)) {
+               fprintf(rsp, "%u", pointer_motion_interval);
        } else if (streq("pointer_action1", name) ||
                   streq("pointer_action2", name) ||
                   streq("pointer_action3", name)) {
index 284875e2e4afef75734d21caaec440008ac95d3a..a132e66da4a89ea7d21eecb987b9bae2ca5dbbca 100644 (file)
--- a/pointer.c
+++ b/pointer.c
@@ -239,8 +239,8 @@ void track_pointer(coordinates_t loc, pointer_action_t pac, xcb_point_t pos)
                uint8_t resp_type = XCB_EVENT_RESPONSE_TYPE(evt);
                if (resp_type == XCB_MOTION_NOTIFY) {
                        xcb_motion_notify_event_t *e = (xcb_motion_notify_event_t*) evt;
-                       int64_t dtime = e->time - last_motion_time;
-                       if (dtime < 20) {
+                       uint32_t dtime = e->time - last_motion_time;
+                       if (dtime < pointer_motion_interval) {
                                continue;
                        }
                        last_motion_time = e->time;
index 7e509dd11a5af34996da7c6c338e5250b38c3dea..1af156a1306e7ddcffe82a46230639b111e74060 100644 (file)
@@ -56,6 +56,7 @@ void load_settings(void)
        split_ratio = SPLIT_RATIO;
        initial_polarity = FIRST_CHILD;
        pointer_modifier = POINTER_MODIFIER;
+       pointer_motion_interval = POINTER_MOTION_INTERVAL;
 
        pointer_actions[0] = ACTION_MOVE;
        pointer_actions[1] = ACTION_RESIZE_SIDE;
index c4075d90b23bde98648e8ef916e264e59507bf55..47ebb6e913b2eac46de053cd2e52622a26da4524 100644 (file)
 
 #include "types.h"
 
-#define WM_NAME                 "bspwm"
-#define CONFIG_NAME             WM_NAME "rc"
-#define CONFIG_HOME_ENV         "XDG_CONFIG_HOME"
-#define POINTER_MODIFIER        XCB_MOD_MASK_4
-#define EXTERNAL_RULES_COMMAND  ""
-#define STATUS_PREFIX           "W"
+#define WM_NAME                  "bspwm"
+#define CONFIG_NAME              WM_NAME "rc"
+#define CONFIG_HOME_ENV          "XDG_CONFIG_HOME"
+#define POINTER_MODIFIER         XCB_MOD_MASK_4
+#define POINTER_MOTION_INTERVAL  17
+#define EXTERNAL_RULES_COMMAND   ""
+#define STATUS_PREFIX            "W"
 
 #define NORMAL_BORDER_COLOR           "#30302f"
 #define ACTIVE_BORDER_COLOR           "#474645"
@@ -74,6 +75,7 @@ double split_ratio;
 
 child_polarity_t initial_polarity;
 uint16_t pointer_modifier;
+uint32_t pointer_motion_interval;
 pointer_action_t pointer_actions[3];
 
 bool borderless_monocle;