diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-21 11:09:17 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-21 11:09:17 +0300 |
commit | aa3690044d7096c20a6608a5c7fb0546d407da5a (patch) | |
tree | 8b31a1e021834ad86d60e58c5eaba33e548c7f4f /src/ui | |
parent | 8c1ccfed06a4b986d1a4addd8c173ad6bb4d6691 (diff) |
Keybindings for split view menu
The split view keys now have keybindings. The default bindings for
horizontal/vertical were changed to conform to Emacs (3/2).
IssueID #278
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/keys.c | 12 | ||||
-rw-r--r-- | src/ui/root.c | 4 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/ui/keys.c b/src/ui/keys.c index 42d0d613..8af7867c 100644 --- a/src/ui/keys.c +++ b/src/ui/keys.c | |||
@@ -188,6 +188,7 @@ static void clear_Keys_(iKeys *d) { | |||
188 | enum iBindFlag { | 188 | enum iBindFlag { |
189 | argRepeat_BindFlag = iBit(1), | 189 | argRepeat_BindFlag = iBit(1), |
190 | argRelease_BindFlag = iBit(2), | 190 | argRelease_BindFlag = iBit(2), |
191 | noDirectTrigger_BindFlag = iBit(3), /* can only be triggered via LabelWidget */ | ||
191 | }; | 192 | }; |
192 | 193 | ||
193 | /* TODO: This indirection could be used for localization, although all UI strings | 194 | /* TODO: This indirection could be used for localization, although all UI strings |
@@ -227,6 +228,14 @@ static const struct { int id; iMenuItem bind; int flags; } defaultBindings_[] = | |||
227 | { 81, { "${keys.tab.next}", nextTab_KeyShortcut, "tabs.next" }, 0 }, | 228 | { 81, { "${keys.tab.next}", nextTab_KeyShortcut, "tabs.next" }, 0 }, |
228 | { 90, { "${keys.split.menu}", SDLK_j, KMOD_PRIMARY, "splitmenu.open" }, 0 }, | 229 | { 90, { "${keys.split.menu}", SDLK_j, KMOD_PRIMARY, "splitmenu.open" }, 0 }, |
229 | { 91, { "${keys.split.next}", SDLK_TAB, KMOD_CTRL, "keyroot.next", }, 0 }, | 230 | { 91, { "${keys.split.next}", SDLK_TAB, KMOD_CTRL, "keyroot.next", }, 0 }, |
231 | { 92, { "${keys.split.menu.merge}", '1', 0, "ui.split arg:0", }, noDirectTrigger_BindFlag }, | ||
232 | { 93, { "${keys.split.menu.swap}", SDLK_x, 0, "ui.split swap:1", }, noDirectTrigger_BindFlag }, | ||
233 | { 94, { "${keys.split.menu.horiz}", '3', 0, "ui.split arg:3 axis:0", }, noDirectTrigger_BindFlag }, | ||
234 | { 95, { "${keys.split.menu.horiz12}", SDLK_d, 0, "ui.split arg:1 axis:0", }, noDirectTrigger_BindFlag }, | ||
235 | { 96, { "${keys.split.menu.horiz21}", SDLK_e, 0, "ui.split arg:2 axis:0", }, noDirectTrigger_BindFlag }, | ||
236 | { 97, { "${keys.split.menu.vert}", '2', 0, "ui.split arg:3 axis:1", }, noDirectTrigger_BindFlag }, | ||
237 | { 98, { "${keys.split.menu.vert12}", SDLK_f, 0, "ui.split arg:1 axis:1", }, noDirectTrigger_BindFlag }, | ||
238 | { 99, { "${keys.split.menu.vert21}", SDLK_r, 0, "ui.split arg:2 axis:1", }, noDirectTrigger_BindFlag }, | ||
230 | { 100,{ "${keys.hoverurl}", '/', KMOD_PRIMARY, "prefs.hoverlink.toggle" }, 0 }, | 239 | { 100,{ "${keys.hoverurl}", '/', KMOD_PRIMARY, "prefs.hoverlink.toggle" }, 0 }, |
231 | /* The following cannot currently be changed (built-in duplicates). */ | 240 | /* The following cannot currently be changed (built-in duplicates). */ |
232 | #if defined (iPlatformApple) | 241 | #if defined (iPlatformApple) |
@@ -432,6 +441,9 @@ iBool processEvent_Keys(const SDL_Event *ev) { | |||
432 | if (ev->type == SDL_KEYDOWN || ev->type == SDL_KEYUP) { | 441 | if (ev->type == SDL_KEYDOWN || ev->type == SDL_KEYUP) { |
433 | const iBinding *bind = find_Keys_(d, ev->key.keysym.sym, keyMods_Sym(ev->key.keysym.mod)); | 442 | const iBinding *bind = find_Keys_(d, ev->key.keysym.sym, keyMods_Sym(ev->key.keysym.mod)); |
434 | if (bind) { | 443 | if (bind) { |
444 | if (bind->flags & noDirectTrigger_BindFlag) { | ||
445 | return iFalse; | ||
446 | } | ||
435 | if (ev->type == SDL_KEYUP) { | 447 | if (ev->type == SDL_KEYUP) { |
436 | if (bind->flags & argRelease_BindFlag) { | 448 | if (bind->flags & argRelease_BindFlag) { |
437 | postCommandf_Root(root, "%s release:1", cstr_String(&bind->command)); | 449 | postCommandf_Root(root, "%s release:1", cstr_String(&bind->command)); |
diff --git a/src/ui/root.c b/src/ui/root.c index 9a089992..2a2130d8 100644 --- a/src/ui/root.c +++ b/src/ui/root.c | |||
@@ -1308,11 +1308,11 @@ void createUserInterface_Root(iRoot *d) { | |||
1308 | { "${menu.split.merge}", '1', 0, "ui.split arg:0" }, | 1308 | { "${menu.split.merge}", '1', 0, "ui.split arg:0" }, |
1309 | { "${menu.split.swap}", SDLK_x, 0, "ui.split swap:1" }, | 1309 | { "${menu.split.swap}", SDLK_x, 0, "ui.split swap:1" }, |
1310 | { "---", 0, 0, NULL }, | 1310 | { "---", 0, 0, NULL }, |
1311 | { "${menu.split.horizontal}", '2', 0, "ui.split arg:3 axis:0" }, | 1311 | { "${menu.split.horizontal}", '3', 0, "ui.split arg:3 axis:0" }, |
1312 | { "${menu.split.horizontal} 1:2", SDLK_d, 0, "ui.split arg:1 axis:0" }, | 1312 | { "${menu.split.horizontal} 1:2", SDLK_d, 0, "ui.split arg:1 axis:0" }, |
1313 | { "${menu.split.horizontal} 2:1", SDLK_e, 0, "ui.split arg:2 axis:0" }, | 1313 | { "${menu.split.horizontal} 2:1", SDLK_e, 0, "ui.split arg:2 axis:0" }, |
1314 | { "---", 0, 0, NULL }, | 1314 | { "---", 0, 0, NULL }, |
1315 | { "${menu.split.vertical}", '3', 0, "ui.split arg:3 axis:1" }, | 1315 | { "${menu.split.vertical}", '2', 0, "ui.split arg:3 axis:1" }, |
1316 | { "${menu.split.vertical} 1:2", SDLK_f, 0, "ui.split arg:1 axis:1" }, | 1316 | { "${menu.split.vertical} 1:2", SDLK_f, 0, "ui.split arg:1 axis:1" }, |
1317 | { "${menu.split.vertical} 2:1", SDLK_r, 0, "ui.split arg:2 axis:1" }, | 1317 | { "${menu.split.vertical} 2:1", SDLK_r, 0, "ui.split arg:2 axis:1" }, |
1318 | }, 10); | 1318 | }, 10); |