Lagrange [dev]

Fixed event handing order when entering text

=> 1773ec7859d45256e298776ee6c48990a077aa9b

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);
+    window_Widget(w)->keyPriority = w;
 #endif
 }
 
@@ -1411,6 +1412,7 @@ void end_InputWidget(iInputWidget *d, iBool accept) {
     d->inFlags &= ~isMarking_InputWidgetFlag;
     deactivateInputMode_InputWidget_(d);
     startOrStopCursorTimer_InputWidget_(d, iFalse);
+    window_Widget(w)->keyPriority = NULL;
 #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) {
Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/dev/cdiff/1773ec7859d45256e298776ee6c48990a077aa9b
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
24.88405 milliseconds
Gemini-to-HTML Time
0.247565 milliseconds

This content has been proxied by September (ba2dc).