floating_modifier uses mod_keys instead of anykey

master
taiyu 9 years ago
parent 2d3bd3c747
commit 8205a6fd3b

@ -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;
}

@ -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

Loading…
Cancel
Save