summaryrefslogtreecommitdiff
path: root/src/ui/keys.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-04-28 17:48:38 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-04-28 17:48:38 +0300
commit87b5dbd9c0393e787d2499d796486d3293f17214 (patch)
tree556f0b6b6a0188fdf9bd02275f796656ef428e86 /src/ui/keys.c
parent408597bd4f71a13a511b6af33601dff0be2ed317 (diff)
Working on multiple UI roots
Root focus switching and opening links in the other root.
Diffstat (limited to 'src/ui/keys.c')
-rw-r--r--src/ui/keys.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ui/keys.c b/src/ui/keys.c
index 6ad9d360..68319598 100644
--- a/src/ui/keys.c
+++ b/src/ui/keys.c
@@ -22,6 +22,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
22 22
23#include "keys.h" 23#include "keys.h"
24#include "util.h" 24#include "util.h"
25#include "window.h"
25#include "app.h" 26#include "app.h"
26 27
27#include <the_Foundation/file.h> 28#include <the_Foundation/file.h>
@@ -223,6 +224,7 @@ static const struct { int id; iMenuItem bind; int flags; } defaultBindings_[] =
223 { 77, { "${keys.tab.close}", closeTab_KeyShortcut, "tabs.close" }, 0 }, 224 { 77, { "${keys.tab.close}", closeTab_KeyShortcut, "tabs.close" }, 0 },
224 { 80, { "${keys.tab.prev}", prevTab_KeyShortcut, "tabs.prev" }, 0 }, 225 { 80, { "${keys.tab.prev}", prevTab_KeyShortcut, "tabs.prev" }, 0 },
225 { 81, { "${keys.tab.next}", nextTab_KeyShortcut, "tabs.next" }, 0 }, 226 { 81, { "${keys.tab.next}", nextTab_KeyShortcut, "tabs.next" }, 0 },
227 { 91, { "${keys.frame.next}", SDLK_TAB, KMOD_CTRL, "keyroot.next", }, 0 },
226 { 100,{ "${keys.hoverurl}", '/', KMOD_PRIMARY, "prefs.hoverlink.toggle" }, 0 }, 228 { 100,{ "${keys.hoverurl}", '/', KMOD_PRIMARY, "prefs.hoverlink.toggle" }, 0 },
227 /* The following cannot currently be changed (built-in duplicates). */ 229 /* The following cannot currently be changed (built-in duplicates). */
228#if defined (iPlatformApple) 230#if defined (iPlatformApple)
@@ -424,21 +426,22 @@ void setLabel_Keys(int id, const char *label) {
424 426
425iBool processEvent_Keys(const SDL_Event *ev) { 427iBool processEvent_Keys(const SDL_Event *ev) {
426 iKeys *d = &keys_; 428 iKeys *d = &keys_;
429 iRoot *root = get_Window()->keyRoot;
427 if (ev->type == SDL_KEYDOWN || ev->type == SDL_KEYUP) { 430 if (ev->type == SDL_KEYDOWN || ev->type == SDL_KEYUP) {
428 const iBinding *bind = find_Keys_(d, ev->key.keysym.sym, keyMods_Sym(ev->key.keysym.mod)); 431 const iBinding *bind = find_Keys_(d, ev->key.keysym.sym, keyMods_Sym(ev->key.keysym.mod));
429 if (bind) { 432 if (bind) {
430 if (ev->type == SDL_KEYUP) { 433 if (ev->type == SDL_KEYUP) {
431 if (bind->flags & argRelease_BindFlag) { 434 if (bind->flags & argRelease_BindFlag) {
432 postCommandf_App("%s release:1", cstr_String(&bind->command)); 435 postCommandf_Root(root, "%s release:1", cstr_String(&bind->command));
433 return iTrue; 436 return iTrue;
434 } 437 }
435 return iFalse; 438 return iFalse;
436 } 439 }
437 if (ev->key.repeat && (bind->flags & argRepeat_BindFlag)) { 440 if (ev->key.repeat && (bind->flags & argRepeat_BindFlag)) {
438 postCommandf_App("%s repeat:1", cstr_String(&bind->command)); 441 postCommandf_Root(root, "%s repeat:1", cstr_String(&bind->command));
439 } 442 }
440 else { 443 else {
441 postCommandString_Root(NULL, &bind->command); 444 postCommandString_Root(root, &bind->command);
442 } 445 }
443 return iTrue; 446 return iTrue;
444 } 447 }