Skip to content

Commit

Permalink
Add setting: pointer_motion_interval
Browse files Browse the repository at this point in the history
  • Loading branch information
baskerville committed May 28, 2016
1 parent 4583587 commit 0a98de6
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 14 deletions.
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 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=()

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

Expand Down
7 changes: 7 additions & 0 deletions messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions pointer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 8 additions & 6 deletions settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@

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

0 comments on commit 0a98de6

Please sign in to comment.