diff options
author | S. Christoffer Eliesen <christoffer@eliesen.no> | 2015-10-26 12:20:32 +0100 |
---|---|---|
committer | S. Christoffer Eliesen <christoffer@eliesen.no> | 2015-10-29 17:41:33 +0100 |
commit | 78ca6197697d4f07eddf0c544daff85603adab90 (patch) | |
tree | e499ab901ab3371d5860e36db086ea8b46e8227e /sway/input_state.c | |
parent | input_state: Extract 'pointer_position_set' function from handlers. (diff) | |
download | sway-78ca6197697d4f07eddf0c544daff85603adab90.tar.gz sway-78ca6197697d4f07eddf0c544daff85603adab90.tar.zst sway-78ca6197697d4f07eddf0c544daff85603adab90.zip |
commands: Learn mouse_warping.
Place mouse at center of focused view when changing to a workspace on a
different output, if option is enabled. (This replicates existing i3
option.)
This can be triggered in multiple ways:
A) via `workspace <name>` which changes output
B) via `focus <direction>` which changes output
C) via `focus output <name>` which (obviously) changes output
Diffstat (limited to 'sway/input_state.c')
-rw-r--r-- | sway/input_state.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sway/input_state.c b/sway/input_state.c index bd46a5ac..ee3dc7cf 100644 --- a/sway/input_state.c +++ b/sway/input_state.c | |||
@@ -185,6 +185,13 @@ void pointer_position_set(struct wlc_origin *new_origin, bool force_focus) { | |||
185 | wlc_pointer_set_origin(new_origin); | 185 | wlc_pointer_set_origin(new_origin); |
186 | } | 186 | } |
187 | 187 | ||
188 | void center_pointer_on(swayc_t *view) { | ||
189 | struct wlc_origin new_origin; | ||
190 | new_origin.x = view->x + view->width/2; | ||
191 | new_origin.y = view->y + view->height/2; | ||
192 | pointer_position_set(&new_origin, true); | ||
193 | } | ||
194 | |||
188 | // Mode set left/right click | 195 | // Mode set left/right click |
189 | 196 | ||
190 | static void pointer_mode_set_left(void) { | 197 | static void pointer_mode_set_left(void) { |