From b1e5138a5c0a846c63f684ea15eeb8280430b55e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi
Date: Sat, 10 Apr 2021 14:27:20 +0300
Subject: [PATCH 1/1] Allow using Tab key for bindings
Tab was always consumed by focus cycling even though that should be at the lowest priority.
IssueID #244
src/app.c | 10 ++++++++++
src/ui/widget.c | 11 +----------
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/app.c b/src/app.c
index dcb35c3d..133d55a6 100644
--- a/src/app.c
+++ b/src/app.c
@@ -1022,6 +1022,16 @@ void processEvents_App(enum iAppEventMode eventMode) {
/* There may be a key bindings for this. */
wasUsed = processEvent_Keys(&ev);
}
if (!wasUsed) {
/* Focus cycling. */
if (ev.type == SDL_KEYDOWN && ev.key.keysym.sym == SDLK_TAB) {
setFocus_Widget(findFocusable_Widget(focus_Widget(),
ev.key.keysym.mod & KMOD_SHIFT
? backward_WidgetFocusDir
: forward_WidgetFocusDir));
wasUsed = iTrue;
}
}
if (ev.type == SDL_USEREVENT && ev.user.code == command_UserEventCode) {
#if defined (iPlatformAppleDesktop)
handleCommand_MacOS(command_UserEvent(&ev));
diff --git a/src/ui/widget.c b/src/ui/widget.c
index cef36a00..67ec87cd 100644
--- a/src/ui/widget.c
+++ b/src/ui/widget.c
@@ -906,16 +906,7 @@ static iBool scrollOverflow_Widget_(iWidget *d, int delta) {
}
iBool processEvent_Widget(iWidget *d, const SDL_Event *ev) {
if (ev->key.keysym.sym == SDLK_TAB) {
setFocus_Widget(findFocusable_Widget(focus_Widget(),
ev->key.keysym.mod & KMOD_SHIFT
? backward_WidgetFocusDir
: forward_WidgetFocusDir));
return iTrue;
}
(ev->type == SDL_MOUSEBUTTONDOWN || ev->type == SDL_MOUSEBUTTONUP) &&
(mouseGrab_Widget() == d || contains_Widget(d, init_I2(ev->button.x, ev->button.y)))) {
postCommand_Widget(d,
--
2.25.1
text/plain
This content has been proxied by September (ba2dc).