Lagrange [work/v1.7]

Window: Allow all mouse clicks to change active split

=> cd3d98aff300fca672da79e15ac255ab3a800e5c

diff --git a/src/ui/window.c b/src/ui/window.c
index 99430a05..22cf1fb0 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -854,6 +854,19 @@ iBool processEvent_Window(iWindow *d, const SDL_Event *ev) {
                 const iInt2 pos = coord_Window(d, event.button.x, event.button.y);
                 event.button.x = pos.x;
                 event.button.y = pos.y;
+                if (event.type == SDL_MOUSEBUTTONDOWN) {
+                    /* Button clicks will change keyroot. */
+                    if (numRoots_Window(d) > 1) {
+                        const iInt2 click = init_I2(event.button.x, event.button.y);
+                        iForIndices(i, d->roots) {
+                            iRoot *root = d->roots[i];
+                            if (root != d->keyRoot && contains_Rect(rect_Root(root), click)) {
+                                setKeyRoot_Window(d, root);
+                                break;
+                            }
+                        }
+                    }
+                }
             }
             const iWidget *oldHover = d->hover;
             iBool wasUsed = iFalse;
@@ -885,7 +898,9 @@ iBool processEvent_Window(iWindow *d, const SDL_Event *ev) {
                     wasUsed = dispatchEvent_Window(d, &paste);
                 }
                 if (event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_RIGHT) {
-                    postContextClick_Window(d, &event.button);
+                    if (postContextClick_Window(d, &event.button)) {
+                        wasUsed = iTrue;
+                    }
                 }
             }
             if (isMetricsChange_UserEvent(&event)) {
Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.7/cdiff/cd3d98aff300fca672da79e15ac255ab3a800e5c
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
65.97779 milliseconds
Gemini-to-HTML Time
0.346407 milliseconds

This content has been proxied by September (ba2dc).