diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-10 14:27:20 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-10 14:27:20 +0300 |
commit | 44b1f58bb25817d2bc4578e727ce637752d00299 (patch) | |
tree | 9e5be8932a15ebafa97cac5888b31087e33ea090 | |
parent | 963ad5fad6905a94c077246b8045e139e1139fc8 (diff) |
Allow using Tab key for bindings
Tab was always consumed by focus cycling even though that should be at the lowest priority.
IssueID #244
-rw-r--r-- | src/app.c | 10 | ||||
-rw-r--r-- | src/ui/widget.c | 11 |
2 files changed, 11 insertions, 10 deletions
@@ -1023,6 +1023,16 @@ void processEvents_App(enum iAppEventMode eventMode) { | |||
1023 | /* There may be a key bindings for this. */ | 1023 | /* There may be a key bindings for this. */ |
1024 | wasUsed = processEvent_Keys(&ev); | 1024 | wasUsed = processEvent_Keys(&ev); |
1025 | } | 1025 | } |
1026 | if (!wasUsed) { | ||
1027 | /* Focus cycling. */ | ||
1028 | if (ev.type == SDL_KEYDOWN && ev.key.keysym.sym == SDLK_TAB) { | ||
1029 | setFocus_Widget(findFocusable_Widget(focus_Widget(), | ||
1030 | ev.key.keysym.mod & KMOD_SHIFT | ||
1031 | ? backward_WidgetFocusDir | ||
1032 | : forward_WidgetFocusDir)); | ||
1033 | wasUsed = iTrue; | ||
1034 | } | ||
1035 | } | ||
1026 | if (ev.type == SDL_USEREVENT && ev.user.code == command_UserEventCode) { | 1036 | if (ev.type == SDL_USEREVENT && ev.user.code == command_UserEventCode) { |
1027 | #if defined (iPlatformAppleDesktop) | 1037 | #if defined (iPlatformAppleDesktop) |
1028 | handleCommand_MacOS(command_UserEvent(&ev)); | 1038 | handleCommand_MacOS(command_UserEvent(&ev)); |
diff --git a/src/ui/widget.c b/src/ui/widget.c index 1ef2360c..3eea761e 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c | |||
@@ -906,16 +906,7 @@ static iBool scrollOverflow_Widget_(iWidget *d, int delta) { | |||
906 | } | 906 | } |
907 | 907 | ||
908 | iBool processEvent_Widget(iWidget *d, const SDL_Event *ev) { | 908 | iBool processEvent_Widget(iWidget *d, const SDL_Event *ev) { |
909 | if (ev->type == SDL_KEYDOWN) { | 909 | if (d->flags & commandOnClick_WidgetFlag && |
910 | if (ev->key.keysym.sym == SDLK_TAB) { | ||
911 | setFocus_Widget(findFocusable_Widget(focus_Widget(), | ||
912 | ev->key.keysym.mod & KMOD_SHIFT | ||
913 | ? backward_WidgetFocusDir | ||
914 | : forward_WidgetFocusDir)); | ||
915 | return iTrue; | ||
916 | } | ||
917 | } | ||
918 | else if (d->flags & commandOnClick_WidgetFlag && | ||
919 | (ev->type == SDL_MOUSEBUTTONDOWN || ev->type == SDL_MOUSEBUTTONUP) && | 910 | (ev->type == SDL_MOUSEBUTTONDOWN || ev->type == SDL_MOUSEBUTTONUP) && |
920 | (mouseGrab_Widget() == d || contains_Widget(d, init_I2(ev->button.x, ev->button.y)))) { | 911 | (mouseGrab_Widget() == d || contains_Widget(d, init_I2(ev->button.x, ev->button.y)))) { |
921 | postCommand_Widget(d, | 912 | postCommand_Widget(d, |