aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sway/commands.c19
-rw-r--r--sway/handlers.c10
2 files changed, 22 insertions, 7 deletions
diff --git a/sway/commands.c b/sway/commands.c
index cc51717b..37bd9b00 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -240,7 +240,24 @@ static bool cmd_floating_mod(struct sway_config *config, int argc, char **argv)
if (!checkarg(argc, "floating_modifier", EXPECTED_EQUAL_TO, 1)) {
return false;
}
- config->floating_mod = xkb_keysym_from_name(argv[0], XKB_KEYSYM_CASE_INSENSITIVE);
+ int i, j;
+ list_t *split = split_string(argv[0], "+");
+ fprintf(stderr,"%s, %d,%d\n",argv[0], split->length,split->items);
+ config->floating_mod = 0;
+
+ //set modifer keys
+ for (i = 0; i < split->length; ++i) {
+ for (j = 0; j < sizeof(modifiers) / sizeof(struct modifier_key); ++j) {
+ if (strcasecmp(modifiers[j].name, split->items[i]) == 0) {
+ config->floating_mod |= modifiers[j].mod;
+ }
+ }
+ }
+ list_free(split);
+ if (!config->floating_mod) {
+ sway_log(L_ERROR, "bindsym - unknown keys %s", argv[0]);
+ return false;
+ }
return true;
}
diff --git a/sway/handlers.c b/sway/handlers.c
index 3ae33294..670569cb 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -15,8 +15,10 @@
#include "focus.h"
uint32_t keys_pressed[32];
+uint32_t key_modifiers;
int keys_pressed_length = 0;
+
static struct wlc_origin mouse_origin;
static bool m1_held = false;
@@ -25,12 +27,7 @@ static bool m2_held = false;
static bool resizing = false;
static bool floating_mod_pressed(void) {
- int i = 0;
- while (i < keys_pressed_length) {
- if (keys_pressed[i++] == config->floating_mod)
- return true;
- }
- return false;
+ return key_modifiers & config->floating_mod;
}
static bool pointer_test(swayc_t *view, void *_origin) {
@@ -297,6 +294,7 @@ static bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifier
return false;
}
bool cmd_success = false;
+ key_modifiers = modifiers->mods;
struct sway_mode *mode = config->current_mode;
// Lowercase if necessary