Add configuration option for disabling mouse warping

This patch adds a new configuration option "mouse_warping [output|none]".

When mouse warping is disabled, mouse cursor does not jump to middle of current
screen when changing workspaces between multiple outputs. This introduces a
"special" cursor state, where focus is in one window and cursor on another.
Useful for eg. scrolling a web page with mouse wheel while typing into another
window on keyboard.
This commit is contained in:
Atte Peltomaki
2014-03-24 19:03:05 +02:00
committed by Michael Stapelberg
parent f41e81bd96
commit 62ea60ba42
9 changed files with 125 additions and 2 deletions

View File

@ -109,6 +109,16 @@ struct Config {
* It is not planned to add any different focus models. */
bool disable_focus_follows_mouse;
/** By default, when switching focus to a window on a different output
* (e.g. focusing a window on workspace 3 on output VGA-1, coming from
* workspace 2 on LVDS-1), the mouse cursor is warped to the center of
* that window.
*
* With the mouse_warping option, you can control when the mouse cursor
* should be warped. "none" disables warping entirely, whereas "output"
* is the default behavior described above. */
warping_t mouse_warping;
/** Remove borders if they are adjacent to the screen edge.
* This is useful if you are reaching scrollbar on the edge of the
* screen or do not want to waste a single pixel of displayspace.

View File

@ -46,6 +46,7 @@ CFGFUN(default_orientation, const char *orientation);
CFGFUN(workspace_layout, const char *layout);
CFGFUN(workspace_back_and_forth, const char *value);
CFGFUN(focus_follows_mouse, const char *value);
CFGFUN(mouse_warping, const char *value);
CFGFUN(force_focus_wrapping, const char *value);
CFGFUN(force_xinerama, const char *value);
CFGFUN(fake_outputs, const char *outputs);

View File

@ -99,6 +99,14 @@ typedef enum {
B_MOUSE = 1
} input_type_t;
/**
* Mouse pointer warping modes.
*/
typedef enum {
POINTER_WARPING_OUTPUT = 0,
POINTER_WARPING_NONE = 1
} warping_t;
/**
* Stores a rectangle, for example the size of a window, the child window etc.
* It needs to be packed so that the compiler will not add any padding bytes.