mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 01:41:30 +00:00
Don't override keys if command fails
This commit is contained in:
parent
b49cfa0c16
commit
f6e65b6bb2
|
@ -104,13 +104,13 @@ int cmd_focus(struct sway_config *config, int argc, char **argv) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (strcasecmp(argv[0], "left") == 0) {
|
if (strcasecmp(argv[0], "left") == 0) {
|
||||||
move_focus(MOVE_LEFT);
|
return move_focus(MOVE_LEFT);
|
||||||
} else if (strcasecmp(argv[0], "right") == 0) {
|
} else if (strcasecmp(argv[0], "right") == 0) {
|
||||||
move_focus(MOVE_RIGHT);
|
return move_focus(MOVE_RIGHT);
|
||||||
} else if (strcasecmp(argv[0], "up") == 0) {
|
} else if (strcasecmp(argv[0], "up") == 0) {
|
||||||
move_focus(MOVE_UP);
|
return move_focus(MOVE_UP);
|
||||||
} else if (strcasecmp(argv[0], "down") == 0) {
|
} else if (strcasecmp(argv[0], "down") == 0) {
|
||||||
move_focus(MOVE_DOWN);
|
return move_focus(MOVE_DOWN);
|
||||||
} else if (strcasecmp(argv[0], "parent") == 0) {
|
} else if (strcasecmp(argv[0], "parent") == 0) {
|
||||||
swayc_t *current = get_focused_container(&root_container);
|
swayc_t *current = get_focused_container(&root_container);
|
||||||
if (current && current->parent) {
|
if (current && current->parent) {
|
||||||
|
|
|
@ -74,8 +74,7 @@ bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifiers
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
ret = false;
|
ret = handle_command(config, binding->command) == 0;
|
||||||
handle_command(config, binding->command);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "movement.h"
|
#include "movement.h"
|
||||||
|
|
||||||
void move_focus(enum movement_direction direction) {
|
int move_focus(enum movement_direction direction) {
|
||||||
swayc_t *current = get_focused_container(&root_container);
|
swayc_t *current = get_focused_container(&root_container);
|
||||||
swayc_t *parent = current->parent;
|
swayc_t *parent = current->parent;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ void move_focus(enum movement_direction direction) {
|
||||||
} else {
|
} else {
|
||||||
unfocus_all(&root_container);
|
unfocus_all(&root_container);
|
||||||
focus_view(parent->children->items[desired]);
|
focus_view(parent->children->items[desired]);
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!can_move) {
|
if (!can_move) {
|
||||||
|
@ -51,7 +51,7 @@ void move_focus(enum movement_direction direction) {
|
||||||
parent = parent->parent;
|
parent = parent->parent;
|
||||||
if (parent->type == C_ROOT) {
|
if (parent->type == C_ROOT) {
|
||||||
// Nothing we can do
|
// Nothing we can do
|
||||||
return;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,6 @@ enum movement_direction{
|
||||||
MOVE_DOWN
|
MOVE_DOWN
|
||||||
};
|
};
|
||||||
|
|
||||||
void move_focus(enum movement_direction direction);
|
int move_focus(enum movement_direction direction);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue