From f42fd344e921eb5623ed57c99472742daebf1749 Mon Sep 17 00:00:00 2001 From: Loic Coyle Date: Thu, 15 Apr 2021 01:18:59 +0200 Subject: [PATCH 1/2] Add new setting: pointer_motion_interval_resize --- src/messages.c | 7 +++++++ src/pointer.c | 3 ++- src/settings.c | 2 ++ src/settings.h | 2 ++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/messages.c b/src/messages.c index d3852594..d28d4cb7 100644 --- a/src/messages.c +++ b/src/messages.c @@ -1630,6 +1630,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_resize", name)) { + if (sscanf(value, "%u", &pointer_motion_interval_resize) != 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)) { @@ -1814,6 +1819,8 @@ void get_setting(coordinates_t loc, char *name, FILE* rsp) print_button_index(click_to_focus, rsp); } else if (streq("pointer_motion_interval", name)) { fprintf(rsp, "%u", pointer_motion_interval); + } else if (streq("pointer_motion_interval_resize", name)) { + fprintf(rsp, "%u", pointer_motion_interval_resize); } else if (streq("pointer_action1", name) || streq("pointer_action2", name) || streq("pointer_action3", name)) { diff --git a/src/pointer.c b/src/pointer.c index 5eb93c34..26309961 100644 --- a/src/pointer.c +++ b/src/pointer.c @@ -280,7 +280,8 @@ void track_pointer(coordinates_t loc, pointer_action_t pac, xcb_point_t pos) if (resp_type == XCB_MOTION_NOTIFY) { xcb_motion_notify_event_t *e = (xcb_motion_notify_event_t*) evt; uint32_t dtime = e->time - last_motion_time; - if (dtime < pointer_motion_interval) { + if ((pac == ACTION_MOVE && dtime < pointer_motion_interval) || + ((pac == ACTION_RESIZE_SIDE || pac == ACTION_RESIZE_CORNER) && dtime < pointer_motion_interval_resize)) { continue; } last_motion_time = e->time; diff --git a/src/settings.c b/src/settings.c index 52358f7a..e90fc821 100644 --- a/src/settings.c +++ b/src/settings.c @@ -48,6 +48,7 @@ tightness_t directional_focus_tightness; uint16_t pointer_modifier; uint32_t pointer_motion_interval; +uint32_t pointer_motion_interval_resize; pointer_action_t pointer_actions[3]; int8_t mapping_events_count; @@ -109,6 +110,7 @@ void load_settings(void) pointer_modifier = POINTER_MODIFIER; pointer_motion_interval = POINTER_MOTION_INTERVAL; + pointer_motion_interval_resize = POINTER_MOTION_INTERVAL_RESIZE; pointer_actions[0] = ACTION_MOVE; pointer_actions[1] = ACTION_RESIZE_SIDE; pointer_actions[2] = ACTION_RESIZE_CORNER; diff --git a/src/settings.h b/src/settings.h index 248860d0..5d2dbcad 100644 --- a/src/settings.h +++ b/src/settings.h @@ -29,6 +29,7 @@ #define POINTER_MODIFIER XCB_MOD_MASK_4 #define POINTER_MOTION_INTERVAL 17 +#define POINTER_MOTION_INTERVAL_RESIZE POINTER_MOTION_INTERVAL #define EXTERNAL_RULES_COMMAND "" #define STATUS_PREFIX "W" @@ -88,6 +89,7 @@ extern tightness_t directional_focus_tightness; extern uint16_t pointer_modifier; extern uint32_t pointer_motion_interval; +extern uint32_t pointer_motion_interval_resize; extern pointer_action_t pointer_actions[3]; extern int8_t mapping_events_count; From 04dd82ae19ed952b310c42dba282fed343d9a54f Mon Sep 17 00:00:00 2001 From: Loic Coyle Date: Fri, 16 Apr 2021 13:01:22 +0200 Subject: [PATCH 2/2] add pointer_motion_interval_resize to completions/docs --- contrib/bash_completion | 2 +- contrib/fish_completion | 2 +- contrib/zsh_completion | 2 +- doc/bspwm.1 | 5 +++++ doc/bspwm.1.asciidoc | 3 +++ 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/contrib/bash_completion b/contrib/bash_completion index 6ab1e128..83eb2d96 100644 --- a/contrib/bash_completion +++ b/contrib/bash_completion @@ -1,7 +1,7 @@ _bspc() { local commands='node desktop monitor query rule 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 top_monocle_padding right_monocle_padding bottom_monocle_padding left_monocle_padding split_ratio automatic_scheme removal_adjustment initial_polarity directional_focus_tightness presel_feedback borderless_monocle gapless_monocle single_monocle borderless_singleton pointer_motion_interval pointer_modifier pointer_action1 pointer_action2 pointer_action3 click_to_focus swallow_first_click focus_follows_pointer pointer_follows_focus pointer_follows_monitor mapping_events_count ignore_ewmh_focus ignore_ewmh_fullscreen ignore_ewmh_struts 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 top_monocle_padding right_monocle_padding bottom_monocle_padding left_monocle_padding split_ratio automatic_scheme removal_adjustment initial_polarity directional_focus_tightness presel_feedback borderless_monocle gapless_monocle single_monocle borderless_singleton pointer_motion_interval pointer_motion_interval_resize pointer_modifier pointer_action1 pointer_action2 pointer_action3 click_to_focus swallow_first_click focus_follows_pointer pointer_follows_focus pointer_follows_monitor mapping_events_count ignore_ewmh_focus ignore_ewmh_fullscreen ignore_ewmh_struts center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors' COMPREPLY=() diff --git a/contrib/fish_completion b/contrib/fish_completion index 3cd6f4d6..2b8621ce 100644 --- a/contrib/fish_completion +++ b/contrib/fish_completion @@ -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 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 top_monocle_padding right_monocle_padding bottom_monocle_padding left_monocle_padding split_ratio automatic_scheme removal_adjustment initial_polarity directional_focus_tightness presel_feedback borderless_monocle gapless_monocle single_monocle borderless_singleton pointer_motion_interval pointer_modifier pointer_action1 pointer_action2 pointer_action3 click_to_focus swallow_first_click focus_follows_pointer pointer_follows_focus pointer_follows_monitor mapping_events_count ignore_ewmh_focus ignore_ewmh_fullscreen ignore_ewmh_struts 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 top_monocle_padding right_monocle_padding bottom_monocle_padding left_monocle_padding split_ratio automatic_scheme removal_adjustment initial_polarity directional_focus_tightness presel_feedback borderless_monocle gapless_monocle single_monocle borderless_singleton pointer_motion_interval pointer_motion_interval_resize pointer_modifier pointer_action1 pointer_action2 pointer_action3 click_to_focus swallow_first_click focus_follows_pointer pointer_follows_focus pointer_follows_monitor mapping_events_count ignore_ewmh_focus ignore_ewmh_fullscreen ignore_ewmh_struts center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors' diff --git a/contrib/zsh_completion b/contrib/zsh_completion index c3d0b47d..ff5811b6 100644 --- a/contrib/zsh_completion +++ b/contrib/zsh_completion @@ -321,7 +321,7 @@ _bspc() { behaviour_bool=(single_monocle removal_adjustment ignore_ewmh_focus ignore_ewmh_struts center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors) behaviour=(mapping_events_count ignore_ewmh_fullscreen external_rules_command split_ratio automatic_scheme initial_polarity directional_focus_tightness status_prefix) input_bool=(swallow_first_click focus_follows_pointer pointer_follows_{focus,monitor}) - input=(click_to_focus pointer_motion_interval pointer_modifier pointer_action{1,2,3}) + input=(click_to_focus pointer_motion_interval pointer_motion_interval_resize pointer_modifier pointer_action{1,2,3}) if [[ "$CURRENT" == (2|3) ]];then _arguments \ '-d[Set settings for the selected desktop]: :_bspc_selector -- desktop'\ diff --git a/doc/bspwm.1 b/doc/bspwm.1 index e798b239..bb103dc0 100644 --- a/doc/bspwm.1 +++ b/doc/bspwm.1 @@ -1256,6 +1256,11 @@ Remove borders of the only window on the only monitor regardless its layout\&. The minimum interval, in milliseconds, between two motion notify events\&. .RE .PP +\fIpointer_motion_interval_resize\fR +.RS 4 +The minimum interval, in milliseconds, between two resize notify events\&. +.RE +.PP \fIpointer_modifier\fR .RS 4 Keyboard modifier used for moving or resizing windows\&. Accept the following values: diff --git a/doc/bspwm.1.asciidoc b/doc/bspwm.1.asciidoc index ca504c27..006f4db2 100644 --- a/doc/bspwm.1.asciidoc +++ b/doc/bspwm.1.asciidoc @@ -739,6 +739,9 @@ Global Settings 'pointer_motion_interval':: The minimum interval, in milliseconds, between two motion notify events. +'pointer_motion_interval_resize':: + The minimum interval, in milliseconds, between two resize notify events. + 'pointer_modifier':: Keyboard modifier used for moving or resizing windows. Accept the following values: *shift*, *control*, *lock*, *mod1*, *mod2*, *mod3*, *mod4*, *mod5*.