summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sway/config.h1
-rw-r--r--sway/commands/floating_modifier.c12
-rw-r--r--sway/config.c1
-rw-r--r--sway/input/cursor.c8
-rw-r--r--sway/input/seat.c1
5 files changed, 19 insertions, 4 deletions
diff --git a/include/sway/config.h b/include/sway/config.h
index 032f4196..4a6bb780 100644
--- a/include/sway/config.h
+++ b/include/sway/config.h
@@ -320,6 +320,7 @@ struct sway_config {
320 struct bar_config *current_bar; 320 struct bar_config *current_bar;
321 char *swaybg_command; 321 char *swaybg_command;
322 uint32_t floating_mod; 322 uint32_t floating_mod;
323 bool floating_mod_inverse;
323 uint32_t dragging_key; 324 uint32_t dragging_key;
324 uint32_t resizing_key; 325 uint32_t resizing_key;
325 char *floating_scroll_up_cmd; 326 char *floating_scroll_up_cmd;
diff --git a/sway/commands/floating_modifier.c b/sway/commands/floating_modifier.c
index 9432c9f1..f5d2b3fe 100644
--- a/sway/commands/floating_modifier.c
+++ b/sway/commands/floating_modifier.c
@@ -1,10 +1,11 @@
1#include "strings.h"
1#include "sway/commands.h" 2#include "sway/commands.h"
2#include "sway/config.h" 3#include "sway/config.h"
3#include "util.h" 4#include "util.h"
4 5
5struct cmd_results *cmd_floating_modifier(int argc, char **argv) { 6struct cmd_results *cmd_floating_modifier(int argc, char **argv) {
6 struct cmd_results *error = NULL; 7 struct cmd_results *error = NULL;
7 if ((error = checkarg(argc, "floating_modifier", EXPECTED_EQUAL_TO, 1))) { 8 if ((error = checkarg(argc, "floating_modifier", EXPECTED_AT_LEAST, 1))) {
8 return error; 9 return error;
9 } 10 }
10 11
@@ -14,6 +15,15 @@ struct cmd_results *cmd_floating_modifier(int argc, char **argv) {
14 "Invalid modifier"); 15 "Invalid modifier");
15 } 16 }
16 17
18 if (argc == 1 || strcasecmp(argv[1], "normal") == 0) {
19 config->floating_mod_inverse = false;
20 } else if (strcasecmp(argv[1], "inverse") == 0) {
21 config->floating_mod_inverse = true;
22 } else {
23 return cmd_results_new(CMD_INVALID, "floating_modifier",
24 "Usage: floating_modifier <mod> [inverse|normal]");
25 }
26
17 config->floating_mod = mod; 27 config->floating_mod = mod;
18 28
19 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 29 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
diff --git a/sway/config.c b/sway/config.c
index 90dfb9a9..2afffab1 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -180,6 +180,7 @@ static void config_defaults(struct sway_config *config) {
180 list_add(config->modes, config->current_mode); 180 list_add(config->modes, config->current_mode);
181 181
182 config->floating_mod = 0; 182 config->floating_mod = 0;
183 config->floating_mod_inverse = false;
183 config->dragging_key = BTN_LEFT; 184 config->dragging_key = BTN_LEFT;
184 config->resizing_key = BTN_RIGHT; 185 config->resizing_key = BTN_RIGHT;
185 186
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 2468a341..02bd2239 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -451,15 +451,17 @@ static void dispatch_cursor_button_floating(struct sway_cursor *cursor,
451 bool over_title = edge == WLR_EDGE_NONE && !surface; 451 bool over_title = edge == WLR_EDGE_NONE && !surface;
452 452
453 // Check for beginning move 453 // Check for beginning move
454 if (button == BTN_LEFT && state == WLR_BUTTON_PRESSED && 454 uint32_t btn_move = config->floating_mod_inverse ? BTN_RIGHT : BTN_LEFT;
455 if (button == btn_move && state == WLR_BUTTON_PRESSED &&
455 (mod_pressed || over_title)) { 456 (mod_pressed || over_title)) {
456 seat_begin_move(seat, cont, BTN_LEFT); 457 seat_begin_move(seat, cont, button);
457 return; 458 return;
458 } 459 }
459 460
460 // Check for beginning resize 461 // Check for beginning resize
461 bool resizing_via_border = button == BTN_LEFT && edge != WLR_EDGE_NONE; 462 bool resizing_via_border = button == BTN_LEFT && edge != WLR_EDGE_NONE;
462 bool resizing_via_mod = button == BTN_RIGHT && mod_pressed; 463 uint32_t btn_resize = config->floating_mod_inverse ? BTN_LEFT : BTN_RIGHT;
464 bool resizing_via_mod = button == btn_resize && mod_pressed;
463 if ((resizing_via_border || resizing_via_mod) && 465 if ((resizing_via_border || resizing_via_mod) &&
464 state == WLR_BUTTON_PRESSED) { 466 state == WLR_BUTTON_PRESSED) {
465 if (edge == WLR_EDGE_NONE) { 467 if (edge == WLR_EDGE_NONE) {
diff --git a/sway/input/seat.c b/sway/input/seat.c
index cc0b16cf..8698d69e 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -184,6 +184,7 @@ static void handle_seat_container_destroy(struct wl_listener *listener,
184 bool set_focus = 184 bool set_focus =
185 focus != NULL && 185 focus != NULL &&
186 (focus == con || container_has_child(con, focus)) && 186 (focus == con || container_has_child(con, focus)) &&
187 con->parent && con->parent->children->length > 1 &&
187 con->type != C_WORKSPACE; 188 con->type != C_WORKSPACE;
188 189
189 seat_container_destroy(seat_con); 190 seat_container_destroy(seat_con);