config: Add "seamless_mouse" to decide if pointer crosses output edges.

This commit is contained in:
S. Christoffer Eliesen 2015-10-22 01:34:32 +02:00
parent fc1bacf034
commit edf33aad29
5 changed files with 18 additions and 1 deletions

View file

@ -55,6 +55,7 @@ struct sway_config {
bool reloading; bool reloading;
bool reading; bool reading;
bool auto_back_and_forth; bool auto_back_and_forth;
bool seamless_mouse;
int gaps_inner; int gaps_inner;
int gaps_outer; int gaps_outer;

View file

@ -112,6 +112,11 @@ Commands
Resizes the currently focused container or view by _amount_. _amount_ can be Resizes the currently focused container or view by _amount_. _amount_ can be
specified as "n px" or "n ppt" or "n px or n ppt". specified as "n px" or "n ppt" or "n px or n ppt".
**seamless_mouse** <on|off>::
Change output seamlessly when pointer touches edge of output. Outputs need to
be configured with perfectly aligned adjacent positions for this option to
have any effect.
**set** <name> <value>:: **set** <name> <value>::
Creates a substitution for _value_ that can be used with $_name_ in other Creates a substitution for _value_ that can be used with $_name_ in other
commands. commands.

View file

@ -410,6 +410,15 @@ static enum cmd_status cmd_focus_follows_mouse(int argc, char **argv) {
return CMD_SUCCESS; return CMD_SUCCESS;
} }
static enum cmd_status cmd_seamless_mouse(int argc, char **argv) {
if (!checkarg(argc, "seamless_mouse", EXPECTED_EQUAL_TO, 1)) {
return CMD_FAILURE;
}
config->seamless_mouse = (strcasecmp(argv[0], "on") == 0 || strcasecmp(argv[0], "yes") == 0);
return CMD_SUCCESS;
}
static void hide_view_in_scratchpad(swayc_t *sp_view) { static void hide_view_in_scratchpad(swayc_t *sp_view) {
if (sp_view == NULL) { if (sp_view == NULL) {
return; return;
@ -1139,6 +1148,7 @@ static struct cmd_handler handlers[] = {
{ "reload", cmd_reload }, { "reload", cmd_reload },
{ "resize", cmd_resize }, { "resize", cmd_resize },
{ "scratchpad", cmd_scratchpad }, { "scratchpad", cmd_scratchpad },
{ "seamless_mouse", cmd_seamless_mouse },
{ "set", cmd_set }, { "set", cmd_set },
{ "split", cmd_split }, { "split", cmd_split },
{ "splith", cmd_splith }, { "splith", cmd_splith },

View file

@ -102,6 +102,7 @@ static void config_defaults(struct sway_config *config) {
config->active = false; config->active = false;
config->failed = false; config->failed = false;
config->auto_back_and_forth = false; config->auto_back_and_forth = false;
config->seamless_mouse = true;
config->reading = false; config->reading = false;
config->gaps_inner = 0; config->gaps_inner = 0;

View file

@ -357,7 +357,7 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct
// //
// Since this doesn't currently support moving windows between outputs we // Since this doesn't currently support moving windows between outputs we
// don't do the switch if the pointer is in a mode. // don't do the switch if the pointer is in a mode.
if (!pointer_state.mode) { if (config->seamless_mouse && !pointer_state.mode) {
swayc_t *output = swayc_active_output(); swayc_t *output = swayc_active_output();
// TODO: This implementation is naïve: We assume all outputs are // TODO: This implementation is naïve: We assume all outputs are