=> 2385c33c3fcb51d08de07fadbe481be309123b28
[1mdiff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c[m [1mindex 3e2764bf..a9716c08 100644[m [1m--- a/src/ui/documentwidget.c[m [1m+++ b/src/ui/documentwidget.c[m [36m@@ -514,6 +514,7 @@[m [mstatic void setLinkNumberMode_DocumentWidget_(iDocumentWidget *d, iBool set) {[m #if defined (iPlatformAppleDesktop)[m enableMenuItemsOnHomeRow_MacOS(!set);[m #endif[m [32m+[m[32m window_Widget(d)->keyPriority = set ? as_Widget(d) : NULL;[m if (d->menu) {[m setFlags_Widget(d->menu, disabled_WidgetFlag, set);[m }[m [1mdiff --git a/src/ui/widget.c b/src/ui/widget.c[m [1mindex 843a46bd..3d839bea 100644[m [1m--- a/src/ui/widget.c[m [1m+++ b/src/ui/widget.c[m [36m@@ -242,6 +242,9 @@[m [mvoid deinit_Widget(iWidget *d) {[m if (win->hover == d) {[m win->hover = NULL;[m }[m [32m+[m[32m if (win->keyPriority == d) {[m [32m+[m[32m win->keyPriority = NULL;[m [32m+[m[32m }[m }[m if (d->flags & nativeMenu_WidgetFlag) {[m releaseNativeMenu_Widget(d);[m [36m@@ -261,6 +264,9 @@[m [mstatic void aboutToBeDestroyed_Widget_(iWidget *d) {[m if (win->focus == d) {[m win->focus = NULL;[m }[m [32m+[m[32m if (win->keyPriority == d) {[m [32m+[m[32m win->keyPriority = NULL;[m [32m+[m[32m }[m if (win->lastHover == d) {[m win->lastHover = NULL;[m }[m [36m@@ -2428,6 +2434,7 @@[m [mvoid setFocus_Widget(iWidget *d) {[m iWindow *win = d ? window_Widget(d) : get_Window();[m iAssert(win);[m if (win->focus != d) {[m [32m+[m[32m win->keyPriority = NULL;[m if (win->focus) {[m iAssert(!contains_PtrSet(win->focus->root->pendingDestruction, win->focus));[m postCommand_Widget(win->focus, "focus.lost");[m [1mdiff --git a/src/ui/window.c b/src/ui/window.c[m [1mindex a5424a92..2c7b2ada 100644[m [1m--- a/src/ui/window.c[m [1m+++ b/src/ui/window.c[m [36m@@ -601,6 +601,7 @@[m [mvoid init_Window(iWindow *d, enum iWindowType type, iRect rect, uint32_t flags)[m d->hover = NULL;[m d->lastHover = NULL;[m d->mouseGrab = NULL;[m [32m+[m[32m d->keyPriority = NULL;[m d->focus = NULL;[m d->pendingCursor = NULL;[m d->isExposed = (deviceType_App() != desktop_AppDeviceType);[m [36m@@ -1372,18 +1373,21 @@[m [miBool processEvent_Window(iWindow *d, const SDL_Event *ev) {[m }[m }[m }[m [31m-// const iWidget *oldHover = d->hover;[m iBool wasUsed = iFalse;[m /* Dispatch first to the mouse-grabbed widget. */[m [31m-// iWidget *widget = d->root.widget;[m if (event.type == SDL_MOUSEMOTION || event.type == SDL_MOUSEWHEEL ||[m event.type == SDL_MOUSEBUTTONUP || event.type == SDL_MOUSEBUTTONDOWN) {[m if (mouseGrab_Widget()) {[m iWidget *grabbed = mouseGrab_Widget();[m [31m- setCurrent_Root(grabbed->root /* findRoot_Window(d, grabbed)*/);[m [32m+[m[32m setCurrent_Root(grabbed->root);[m wasUsed = dispatchEvent_Widget(grabbed, &event);[m }[m }[m [32m+[m[32m /* If there is a priority handler for key events, offer the event to it first.[m [32m+[m[32m This is similar to mouse grabbing, but the handler can refuse the event. */[m [32m+[m[32m if (d->keyPriority && (event.type == SDL_KEYDOWN || event.type == SDL_KEYDOWN)) {[m [32m+[m[32m wasUsed = dispatchEvent_Widget(d->keyPriority, &event);[m [32m+[m[32m }[m /* Dispatch the event to the tree of widgets. */[m if (!wasUsed) {[m wasUsed = dispatchEvent_Window(d, &event);[m [36m@@ -1449,6 +1453,7 @@[m [miBool setKeyRoot_Window(iWindow *d, iRoot *root) {[m d->keyRoot = root;[m postCommand_App("keyroot.changed");[m postRefresh_Window(d);[m [32m+[m[32m d->keyPriority = NULL;[m return iTrue;[m }[m return iFalse;[m [1mdiff --git a/src/ui/window.h b/src/ui/window.h[m [1mindex 21271e67..cc674fcf 100644[m [1m--- a/src/ui/window.h[m [1m+++ b/src/ui/window.h[m [36m@@ -99,6 +99,7 @@[m [mstruct Impl_Window {[m iWidget * hover;[m iWidget * lastHover; /* cleared if deleted */[m iWidget * mouseGrab;[m [32m+[m[32m iWidget * keyPriority; /* window dispatches keyboard events to this widget first */[m iWidget * focus;[m float pixelRatio; /* conversion between points and pixels, e.g., coords, window size */[m float displayScale; /* DPI-based scaling factor of current display, affects uiScale only */[m
text/gemini; charset=utf-8
This content has been proxied by September (3851b).