From 1773ec7859d45256e298776ee6c48990a077aa9b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi
Date: Fri, 10 May 2024 07:20:22 +0300
Subject: [PATCH 1/1] Fixed event handing order when entering text
Key events must be handled first by a focused input field.
src/ui/inputwidget.c | 2 ++
src/ui/window.c | 4 +++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c
index 355486de..a65dc6b3 100644
--- a/src/ui/inputwidget.c
+++ b/src/ui/inputwidget.c
@@ -1378,6 +1378,7 @@ void begin_InputWidget(iInputWidget *d) {
}
updateTextInputRect_InputWidget_(d);
updateVisible_InputWidget_(d);
#endif
}
@@ -1411,6 +1412,7 @@ void end_InputWidget(iInputWidget *d, iBool accept) {
d->inFlags &= ~isMarking_InputWidgetFlag;
deactivateInputMode_InputWidget_(d);
startOrStopCursorTimer_InputWidget_(d, iFalse);
#endif
d->inFlags |= needUpdateBuffer_InputWidgetFlag;
setFlags_Widget(w, selected_WidgetFlag | keepOnTop_WidgetFlag | touchDrag_WidgetFlag, iFalse);
diff --git a/src/ui/window.c b/src/ui/window.c
index 72e88759..654b5948 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -1372,7 +1372,9 @@ iBool processEvent_Window(iWindow *d, const SDL_Event *ev) {
/* If there is a priority handler for key events, offer the event to it first.
This is similar to mouse grabbing, but the handler can refuse the event. */
if (d->keyPriority && (event.type == SDL_KEYDOWN || event.type == SDL_KEYDOWN)) {
wasUsed = dispatchEvent_Widget(d->keyPriority, &event);
/* The event is processed directly by the widget only, not dispatched to
the widget subtree. When dispatching, children still get priority. */
wasUsed = class_Widget(d->keyPriority)->processEvent(d->keyPriority, &event);
}
/* Dispatch the event to the tree of widgets. */
if (!wasUsed) {
--
2.25.1
text/plain
This content has been proxied by September (ba2dc).