Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate pointer resize interval #1261 #1284

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contrib/bash_completion
Original file line number Diff line number Diff line change
@@ -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=()

Expand Down
2 changes: 1 addition & 1 deletion contrib/fish_completion
Original file line number Diff line number Diff line change
Expand Up @@ -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'
2 changes: 1 addition & 1 deletion contrib/zsh_completion
Original file line number Diff line number Diff line change
Expand Up @@ -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'\
Expand Down
5 changes: 5 additions & 0 deletions doc/bspwm.1
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions doc/bspwm.1.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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*.

Expand Down
7 changes: 7 additions & 0 deletions src/messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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)) {
Expand Down
3 changes: 2 additions & 1 deletion src/pointer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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;

Expand Down