summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/app.c38
-rw-r--r--src/app.h2
-rw-r--r--src/macos.m51
-rw-r--r--src/periodic.c19
-rw-r--r--src/ui/documentwidget.c2
-rw-r--r--src/ui/touch.c3
-rw-r--r--src/ui/widget.c3
-rw-r--r--src/ui/window.c10
-rw-r--r--src/ui/window.h2
9 files changed, 69 insertions, 61 deletions
diff --git a/src/app.c b/src/app.c
index ec8b59b3..010c6d74 100644
--- a/src/app.c
+++ b/src/app.c
@@ -559,6 +559,7 @@ static iBool loadState_App_(iApp *d) {
559 const int winState = read32_File(f); 559 const int winState = read32_File(f);
560 const int keyRoot = (winState & 1); 560 const int keyRoot = (winState & 1);
561 const iBool isCurrent = (winState & current_WindowStateFlag) != 0; 561 const iBool isCurrent = (winState & current_WindowStateFlag) != 0;
562// printf("[State] '%.4s' split:%d state:%x\n", magic, splitMode, winState);
562 if (numWins == 1) { 563 if (numWins == 1) {
563 win = d->window; 564 win = d->window;
564 } 565 }
@@ -575,7 +576,7 @@ static iBool loadState_App_(iApp *d) {
575 setCurrent_Root(NULL); 576 setCurrent_Root(NULL);
576 win->pendingSplitMode = splitMode; 577 win->pendingSplitMode = splitMode;
577 setSplitMode_MainWindow(win, splitMode | noEvents_WindowSplit); 578 setSplitMode_MainWindow(win, splitMode | noEvents_WindowSplit);
578 win->base.keyRoot = d->window->base.roots[keyRoot]; 579 win->base.keyRoot = win->base.roots[keyRoot];
579 } 580 }
580 else if (!memcmp(magic, magicSidebar_App_, 4)) { 581 else if (!memcmp(magic, magicSidebar_App_, 4)) {
581 if (!win) { 582 if (!win) {
@@ -1061,8 +1062,8 @@ static void init_App_(iApp *d, int argc, char **argv) {
1061 } 1062 }
1062 postCommand_App("~navbar.actions.changed"); 1063 postCommand_App("~navbar.actions.changed");
1063 postCommand_App("~toolbar.actions.changed"); 1064 postCommand_App("~toolbar.actions.changed");
1064 postCommand_Root(NULL, "~window.unfreeze"); 1065 postCommand_App("~window.unfreeze");
1065 postCommand_Root(NULL, "font.reset"); 1066 postCommand_App("font.reset");
1066 d->autoReloadTimer = SDL_AddTimer(60 * 1000, postAutoReloadCommand_App_, NULL); 1067 d->autoReloadTimer = SDL_AddTimer(60 * 1000, postAutoReloadCommand_App_, NULL);
1067 postCommand_Root(NULL, "document.autoreload"); 1068 postCommand_Root(NULL, "document.autoreload");
1068#if defined (LAGRANGE_ENABLE_IDLE_SLEEP) 1069#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)
@@ -1390,6 +1391,12 @@ static iPtrArray *listWindows_App_(const iApp *d, iPtrArray *windows) {
1390 return windows; 1391 return windows;
1391} 1392}
1392 1393
1394iPtrArray *listWindows_App(void) {
1395 iPtrArray *wins = new_PtrArray();
1396 listWindows_App_(&app_, wins);
1397 return wins;
1398}
1399
1393void processEvents_App(enum iAppEventMode eventMode) { 1400void processEvents_App(enum iAppEventMode eventMode) {
1394 iApp *d = &app_; 1401 iApp *d = &app_;
1395 iRoot *oldCurrentRoot = current_Root(); /* restored afterwards */ 1402 iRoot *oldCurrentRoot = current_Root(); /* restored afterwards */
@@ -1672,6 +1679,9 @@ static void runTickers_App_(iApp *d) {
1672 iConstForEach(Array, i, &pending->values) { 1679 iConstForEach(Array, i, &pending->values) {
1673 const iTicker *ticker = i.value; 1680 const iTicker *ticker = i.value;
1674 if (ticker->callback) { 1681 if (ticker->callback) {
1682 if (ticker->root) {
1683 setCurrent_Window(ticker->root->window);
1684 }
1675 setCurrent_Root(ticker->root); /* root might be NULL */ 1685 setCurrent_Root(ticker->root); /* root might be NULL */
1676 ticker->callback(ticker->context); 1686 ticker->callback(ticker->context);
1677 } 1687 }
@@ -1864,9 +1874,9 @@ void postCommand_Root(iRoot *d, const char *command) {
1864 } 1874 }
1865 SDL_Event ev = { .type = SDL_USEREVENT }; 1875 SDL_Event ev = { .type = SDL_USEREVENT };
1866 ev.user.code = command_UserEventCode; 1876 ev.user.code = command_UserEventCode;
1867// ev.user.windowID = id_Window(get_Window());
1868 ev.user.data1 = strdup(command); 1877 ev.user.data1 = strdup(command);
1869 ev.user.data2 = d; /* all events are root-specific */ 1878 ev.user.data2 = d; /* all events are root-specific */
1879 ev.user.windowID = d ? id_Window(d->window) : 0; /* root-specific means window-specific */
1870 SDL_PushEvent(&ev); 1880 SDL_PushEvent(&ev);
1871 iWindow *win = get_Window(); 1881 iWindow *win = get_Window();
1872#if defined (iPlatformAndroid) 1882#if defined (iPlatformAndroid)
@@ -1969,6 +1979,10 @@ size_t windowIndex_App(const iMainWindow *win) {
1969 return indexOf_PtrArray(&app_.mainWindows, win); 1979 return indexOf_PtrArray(&app_.mainWindows, win);
1970} 1980}
1971 1981
1982const iPtrArray *mainWindows_App(void) {
1983 return &app_.mainWindows;
1984}
1985
1972void setActiveWindow_App(iMainWindow *win) { 1986void setActiveWindow_App(iMainWindow *win) {
1973 iApp *d = &app_; 1987 iApp *d = &app_;
1974 d->window = win; 1988 d->window = win;
@@ -2527,12 +2541,16 @@ iBool handleCommand_App(const char *cmd) {
2527 return iTrue; 2541 return iTrue;
2528 } 2542 }
2529 else if (equal_Command(cmd, "window.maximize")) { 2543 else if (equal_Command(cmd, "window.maximize")) {
2530 if (!argLabel_Command(cmd, "toggle")) { 2544 const size_t winIndex = argU32Label_Command(cmd, "index");
2531 setSnap_MainWindow(d->window, maximized_WindowSnap); 2545 if (winIndex < size_PtrArray(&d->mainWindows)) {
2532 } 2546 iMainWindow *win = at_PtrArray(&d->mainWindows, winIndex);
2533 else { 2547 if (!argLabel_Command(cmd, "toggle")) {
2534 setSnap_MainWindow(d->window, snap_MainWindow(d->window) == maximized_WindowSnap ? 0 : 2548 setSnap_MainWindow(win, maximized_WindowSnap);
2535 maximized_WindowSnap); 2549 }
2550 else {
2551 setSnap_MainWindow(
2552 win, snap_MainWindow(win) == maximized_WindowSnap ? 0 : maximized_WindowSnap);
2553 }
2536 } 2554 }
2537 return iTrue; 2555 return iTrue;
2538 } 2556 }
diff --git a/src/app.h b/src/app.h
index dd24ec8e..63a477a5 100644
--- a/src/app.h
+++ b/src/app.h
@@ -98,6 +98,7 @@ iPeriodic * periodic_App (void);
98iDocumentWidget * document_App (void); 98iDocumentWidget * document_App (void);
99iObjectList * listDocuments_App (const iRoot *rootOrNull); /* NULL for all roots */ 99iObjectList * listDocuments_App (const iRoot *rootOrNull); /* NULL for all roots */
100iStringSet * listOpenURLs_App (void); /* all tabs */ 100iStringSet * listOpenURLs_App (void); /* all tabs */
101iPtrArray * listWindows_App (void);
101iDocumentWidget * newTab_App (const iDocumentWidget *duplicateOf, iBool switchToNew); 102iDocumentWidget * newTab_App (const iDocumentWidget *duplicateOf, iBool switchToNew);
102void trimCache_App (void); 103void trimCache_App (void);
103void trimMemory_App (void); 104void trimMemory_App (void);
@@ -128,6 +129,7 @@ void setActiveWindow_App (iMainWindow *win);
128void closeWindow_App (iMainWindow *win); 129void closeWindow_App (iMainWindow *win);
129size_t numWindows_App (void); 130size_t numWindows_App (void);
130size_t windowIndex_App (const iMainWindow *win); 131size_t windowIndex_App (const iMainWindow *win);
132const iPtrArray *mainWindows_App(void);
131void addPopup_App (iWindow *popup); 133void addPopup_App (iWindow *popup);
132void removePopup_App (iWindow *popup); 134void removePopup_App (iWindow *popup);
133void postRefresh_App (void); 135void postRefresh_App (void);
diff --git a/src/macos.m b/src/macos.m
index 7b248c3b..5f376874 100644
--- a/src/macos.m
+++ b/src/macos.m
@@ -83,7 +83,9 @@ static void ignoreImmediateKeyDownEvents_(void) {
83 However, we shouldn't double-activate menu items when a shortcut key is used in our 83 However, we shouldn't double-activate menu items when a shortcut key is used in our
84 widgets. Quite a kludge: take advantage of Window's focus-acquisition threshold to 84 widgets. Quite a kludge: take advantage of Window's focus-acquisition threshold to
85 ignore the immediately following key down events. */ 85 ignore the immediately following key down events. */
86 get_Window()->focusGainedAt = SDL_GetTicks(); 86 iForEach(PtrArray, w, collect_PtrArray(listWindows_App())) {
87 as_Window(w.ptr)->focusGainedAt = SDL_GetTicks();
88 }
87} 89}
88 90
89/*----------------------------------------------------------------------------------------------*/ 91/*----------------------------------------------------------------------------------------------*/
@@ -435,9 +437,17 @@ static iBool processScrollWheelEvent_(NSEvent *event) {
435 const iBool isPerPixel = (event.hasPreciseScrollingDeltas != 0); 437 const iBool isPerPixel = (event.hasPreciseScrollingDeltas != 0);
436 const iBool isInertia = (event.momentumPhase & (NSEventPhaseBegan | NSEventPhaseChanged)) != 0; 438 const iBool isInertia = (event.momentumPhase & (NSEventPhaseBegan | NSEventPhaseChanged)) != 0;
437 const iBool isEnded = event.scrollingDeltaX == 0.0f && event.scrollingDeltaY == 0.0f && !isInertia; 439 const iBool isEnded = event.scrollingDeltaX == 0.0f && event.scrollingDeltaY == 0.0f && !isInertia;
438 const iWindow *win = &get_MainWindow()->base; 440 const iWindow *win = NULL; //&get_MainWindow()->base;
439 if (event.window != nsWindow_(win->win)) { 441 /* If this event belongs to one of the MainWindows, handle it and mark it for that window.
440 /* Not the main window. */ 442 If it's for an auxiliary window, let the system handle it. */
443 iConstForEach(PtrArray, i, mainWindows_App()) {
444 if (event.window == nsWindow_(as_Window(i.ptr)->win)) {
445 win = i.ptr;
446 break;
447 }
448 }
449 if (!win) { //event.window != nsWindow_(win->win)) {
450 /* Not a main window. */
441 return iFalse; 451 return iFalse;
442 } 452 }
443 if (isPerPixel) { 453 if (isPerPixel) {
@@ -478,16 +488,18 @@ static iBool processScrollWheelEvent_(NSEvent *event) {
478 else { 488 else {
479 SDL_MouseWheelEvent e = { .type = SDL_MOUSEWHEEL }; 489 SDL_MouseWheelEvent e = { .type = SDL_MOUSEWHEEL };
480 e.timestamp = SDL_GetTicks(); 490 e.timestamp = SDL_GetTicks();
491 e.windowID = id_Window(win);
481 e.which = 1; /* Distinction between trackpad and regular mouse. */ 492 e.which = 1; /* Distinction between trackpad and regular mouse. */
482 /* Disregard any wheel acceleration. */ 493 /* Disregard any wheel acceleration. */
483 e.x = event.scrollingDeltaX > 0 ? 1 : event.scrollingDeltaX < 0 ? -1 : 0; 494 e.x = event.scrollingDeltaX > 0 ? 1 : event.scrollingDeltaX < 0 ? -1 : 0;
484 e.y = event.scrollingDeltaY > 0 ? 1 : event.scrollingDeltaY < 0 ? -1 : 0; 495 e.y = event.scrollingDeltaY > 0 ? 1 : event.scrollingDeltaY < 0 ? -1 : 0;
485 SDL_PushEvent((SDL_Event *) &e); 496 SDL_PushEvent((SDL_Event *) &e);
486 return iTrue; 497 return iTrue;
487 } 498 }
488 /* Post corresponding MOUSEWHEEL events. */ 499 /* Post corresponding MOUSEWHEEL events. */
489 SDL_MouseWheelEvent e = { .type = SDL_MOUSEWHEEL }; 500 SDL_MouseWheelEvent e = { .type = SDL_MOUSEWHEEL };
490 e.timestamp = SDL_GetTicks(); 501 e.timestamp = SDL_GetTicks();
502 e.windowID = id_Window(win);
491 e.which = isPerPixel ? 0 : 1; /* Distinction between trackpad and regular mouse. */ 503 e.which = isPerPixel ? 0 : 1; /* Distinction between trackpad and regular mouse. */
492 setPerPixel_MouseWheelEvent(&e, isPerPixel); 504 setPerPixel_MouseWheelEvent(&e, isPerPixel);
493 if (isPerPixel) { 505 if (isPerPixel) {
@@ -517,28 +529,6 @@ static iBool processScrollWheelEvent_(NSEvent *event) {
517 // printf("#### [%d] dx:%d dy:%d phase:%ld inertia:%d end:%d\n", preventTapGlitch_, e.x, e.y, (long) event.momentumPhase, 529 // printf("#### [%d] dx:%d dy:%d phase:%ld inertia:%d end:%d\n", preventTapGlitch_, e.x, e.y, (long) event.momentumPhase,
518 // isInertia, isEnded); fflush(stdout); 530 // isInertia, isEnded); fflush(stdout);
519 SDL_PushEvent((SDL_Event *) &e); 531 SDL_PushEvent((SDL_Event *) &e);
520#if 0
521 /* On macOS, we handle both trackpad and mouse events. We expect SDL to identify
522 which device is sending the event. */
523 if (ev.wheel.which == 0) {
524 /* Trackpad with precise scrolling w/inertia (points). */
525 setPerPixel_MouseWheelEvent(&ev.wheel, iTrue);
526 ev.wheel.x *= -d->window->base.pixelRatio;
527 ev.wheel.y *= d->window->base.pixelRatio;
528 /* Only scroll on one axis at a time. */
529 if (iAbs(ev.wheel.x) > iAbs(ev.wheel.y)) {
530 ev.wheel.y = 0;
531 }
532 else {
533 ev.wheel.x = 0;
534 }
535 }
536 else {
537 /* Disregard wheel acceleration applied by the OS. */
538 ev.wheel.x = -ev.wheel.x;
539 ev.wheel.y = iSign(ev.wheel.y);
540 }
541#endif
542 return iTrue; 532 return iTrue;
543} 533}
544 534
@@ -565,13 +555,6 @@ void setupApplication_MacOS(void) {
565 windowCloseItem.action = @selector(closeTab); 555 windowCloseItem.action = @selector(closeTab);
566 [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskScrollWheel 556 [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskScrollWheel
567 handler:^NSEvent*(NSEvent *event){ 557 handler:^NSEvent*(NSEvent *event){
568// printf("event type: %lu\n", (unsigned long) event.type);
569// fflush(stdout);
570// if (event.type == NSEventTypeGesture) {
571// trackSwipe_(event);
572// printf("GESTURE phase:%lu\n", (unsigned long) event.phase);
573//fflush(stdout);
574// }
575 if (event.type == NSEventTypeScrollWheel && 558 if (event.type == NSEventTypeScrollWheel &&
576 processScrollWheelEvent_(event)) { 559 processScrollWheelEvent_(event)) {
577 return nil; /* was eaten */ 560 return nil; /* was eaten */
diff --git a/src/periodic.c b/src/periodic.c
index b4f51ed3..0558ed50 100644
--- a/src/periodic.c
+++ b/src/periodic.c
@@ -107,14 +107,17 @@ iBool dispatchCommands_Periodic(iPeriodic *d) {
107 iConstForEach(Array, i, &d->commands.values) { 107 iConstForEach(Array, i, &d->commands.values) {
108 const iPeriodicCommand *pc = i.value; 108 const iPeriodicCommand *pc = i.value;
109 iAssert(isInstance_Object(pc->context, &Class_Widget)); 109 iAssert(isInstance_Object(pc->context, &Class_Widget));
110 const SDL_UserEvent ev = { 110 iRoot *root = constAs_Widget(pc->context)->root;
111 .type = SDL_USEREVENT, 111 if (root) {
112 .code = command_UserEventCode, 112 const SDL_UserEvent ev = {
113 .data1 = (void *) cstr_String(&pc->command), 113 .type = SDL_USEREVENT,
114 .data2 = findRoot_Window(get_Window(), pc->context) 114 .code = command_UserEventCode,
115 }; 115 .data1 = (void *) cstr_String(&pc->command),
116 if (ev.data2) { 116 .data2 = root,
117 setCurrent_Root(ev.data2); 117 .windowID = id_Window(root->window),
118 };
119 setCurrent_Window(root->window);
120 setCurrent_Root(root);
118 dispatchEvent_Widget(pc->context, (const SDL_Event *) &ev); 121 dispatchEvent_Widget(pc->context, (const SDL_Event *) &ev);
119 wasPosted = iTrue; 122 wasPosted = iTrue;
120 } 123 }
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index f8cc10b9..76c26e27 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -5582,7 +5582,7 @@ static void prerender_DocumentWidget_(iAny *context) {
5582 .vis = visibleRange_DocumentView_(&d->view), 5582 .vis = visibleRange_DocumentView_(&d->view),
5583 .showLinkNumbers = (d->flags & showLinkNumbers_DocumentWidgetFlag) != 0 5583 .showLinkNumbers = (d->flags & showLinkNumbers_DocumentWidgetFlag) != 0
5584 }; 5584 };
5585 // printf("%u prerendering\n", SDL_GetTicks()); 5585 // printf("%u prerendering\n", SDL_GetTicks());
5586 if (d->view.visBuf->buffers[0].texture) { 5586 if (d->view.visBuf->buffers[0].texture) {
5587 makePaletteGlobal_GmDocument(d->view.doc); 5587 makePaletteGlobal_GmDocument(d->view.doc);
5588 if (render_DocumentView_(&d->view, &ctx, iTrue /* just fill up progressively */)) { 5588 if (render_DocumentView_(&d->view, &ctx, iTrue /* just fill up progressively */)) {
diff --git a/src/ui/touch.c b/src/ui/touch.c
index a178a913..21a92b80 100644
--- a/src/ui/touch.c
+++ b/src/ui/touch.c
@@ -244,7 +244,8 @@ static void dispatchNotification_Touch_(const iTouch *d, int code) {
244 .timestamp = SDL_GetTicks(), 244 .timestamp = SDL_GetTicks(),
245 .code = code, 245 .code = code,
246 .data1 = d->affinity, 246 .data1 = d->affinity,
247 .data2 = d->affinity->root 247 .data2 = d->affinity->root,
248 .windowID = id_Window(window_Widget(d->affinity)),
248 }); 249 });
249 setCurrent_Root(oldRoot); 250 setCurrent_Root(oldRoot);
250 } 251 }
diff --git a/src/ui/widget.c b/src/ui/widget.c
index fc754b7a..2e878878 100644
--- a/src/ui/widget.c
+++ b/src/ui/widget.c
@@ -168,7 +168,8 @@ void deinit_Widget(iWidget *d) {
168 if (d->flags & visualOffset_WidgetFlag) { 168 if (d->flags & visualOffset_WidgetFlag) {
169 removeTicker_App(visualOffsetAnimation_Widget_, d); 169 removeTicker_App(visualOffsetAnimation_Widget_, d);
170 } 170 }
171 iWindow *win = get_Window(); 171 iWindow *win = d->root->window;
172 iAssert(win);
172 if (win->lastHover == d) { 173 if (win->lastHover == d) {
173 win->lastHover = NULL; 174 win->lastHover = NULL;
174 } 175 }
diff --git a/src/ui/window.c b/src/ui/window.c
index 0a97b97c..6f680cd4 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -682,6 +682,7 @@ iBool isFullscreen_MainWindow(const iMainWindow *d) {
682} 682}
683 683
684iRoot *findRoot_Window(const iWindow *d, const iWidget *widget) { 684iRoot *findRoot_Window(const iWindow *d, const iWidget *widget) {
685
685 while (widget->parent) { 686 while (widget->parent) {
686 widget = widget->parent; 687 widget = widget->parent;
687 } 688 }
@@ -1023,7 +1024,7 @@ iBool processEvent_Window(iWindow *d, const SDL_Event *ev) {
1023 } 1024 }
1024 } 1025 }
1025 case SDL_RENDER_TARGETS_RESET: 1026 case SDL_RENDER_TARGETS_RESET:
1026 case SDL_RENDER_DEVICE_RESET: { 1027 case SDL_RENDER_DEVICE_RESET: {
1027 if (mw) { 1028 if (mw) {
1028 invalidate_MainWindow_(mw, iTrue /* force full reset */); 1029 invalidate_MainWindow_(mw, iTrue /* force full reset */);
1029 } 1030 }
@@ -1109,7 +1110,7 @@ iBool processEvent_Window(iWindow *d, const SDL_Event *ev) {
1109 event.type == SDL_MOUSEBUTTONUP || event.type == SDL_MOUSEBUTTONDOWN) { 1110 event.type == SDL_MOUSEBUTTONUP || event.type == SDL_MOUSEBUTTONDOWN) {
1110 if (mouseGrab_Widget()) { 1111 if (mouseGrab_Widget()) {
1111 iWidget *grabbed = mouseGrab_Widget(); 1112 iWidget *grabbed = mouseGrab_Widget();
1112 setCurrent_Root(findRoot_Window(d, grabbed)); 1113 setCurrent_Root(grabbed->root /* findRoot_Window(d, grabbed)*/);
1113 wasUsed = dispatchEvent_Widget(grabbed, &event); 1114 wasUsed = dispatchEvent_Widget(grabbed, &event);
1114 } 1115 }
1115 } 1116 }
@@ -1200,13 +1201,11 @@ static uint32_t windowId_SDLEvent_(const SDL_Event *ev) {
1200} 1201}
1201 1202
1202iBool dispatchEvent_Window(iWindow *d, const SDL_Event *ev) { 1203iBool dispatchEvent_Window(iWindow *d, const SDL_Event *ev) {
1203#if 0
1204 /* For the right window? */ 1204 /* For the right window? */
1205 const uint32_t evWin = windowId_SDLEvent_(ev); 1205 const uint32_t evWin = windowId_SDLEvent_(ev);
1206 if (evWin && evWin != id_Window(d)) { 1206 if (evWin && evWin != id_Window(d)) {
1207 return iFalse; /* Meant for a different window. */ 1207 return iFalse; /* Meant for a different window. */
1208 } 1208 }
1209#endif
1210 if (ev->type == SDL_MOUSEMOTION) { 1209 if (ev->type == SDL_MOUSEMOTION) {
1211 /* Hover widget may change. */ 1210 /* Hover widget may change. */
1212 setHover_Widget(NULL); 1211 setHover_Widget(NULL);
@@ -1591,6 +1590,7 @@ void setSplitMode_MainWindow(iMainWindow *d, int splitFlags) {
1591 } 1590 }
1592 iWindow *w = as_Window(d); 1591 iWindow *w = as_Window(d);
1593 iAssert(current_Root() == NULL); 1592 iAssert(current_Root() == NULL);
1593 setCurrent_Window(w);
1594 if (d->splitMode != splitMode) { 1594 if (d->splitMode != splitMode) {
1595 int oldCount = numRoots_Window(w); 1595 int oldCount = numRoots_Window(w);
1596 setFreezeDraw_MainWindow(d, iTrue); 1596 setFreezeDraw_MainWindow(d, iTrue);
@@ -1619,8 +1619,8 @@ void setSplitMode_MainWindow(iMainWindow *d, int splitFlags) {
1619 /* The last child is the [+] button for adding a tab. */ 1619 /* The last child is the [+] button for adding a tab. */
1620 moveTabButtonToEnd_Widget(findChild_Widget(docTabs, "newtab")); 1620 moveTabButtonToEnd_Widget(findChild_Widget(docTabs, "newtab"));
1621 setFlags_Widget(findWidget_Root("navbar.unsplit"), hidden_WidgetFlag, iTrue); 1621 setFlags_Widget(findWidget_Root("navbar.unsplit"), hidden_WidgetFlag, iTrue);
1622 iRelease(tabs);
1623 postCommandf_App("tabs.switch id:%s", cstr_String(id_Widget(constAs_Widget(curPage)))); 1622 postCommandf_App("tabs.switch id:%s", cstr_String(id_Widget(constAs_Widget(curPage))));
1623 iRelease(tabs);
1624 } 1624 }
1625 else if (oldCount == 1 && splitMode) { 1625 else if (oldCount == 1 && splitMode) {
1626 /* Add a second root. */ 1626 /* Add a second root. */
diff --git a/src/ui/window.h b/src/ui/window.h
index 5abf23eb..c7d59380 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -139,7 +139,7 @@ iAnyObject * hitChild_Window (const iWindow *, iInt2 coord);
139uint32_t frameTime_Window (const iWindow *); 139uint32_t frameTime_Window (const iWindow *);
140SDL_Renderer * renderer_Window (const iWindow *); 140SDL_Renderer * renderer_Window (const iWindow *);
141int numRoots_Window (const iWindow *); 141int numRoots_Window (const iWindow *);
142iRoot * findRoot_Window (const iWindow *, const iWidget *widget); 142//iRoot * findRoot_Window (const iWindow *, const iWidget *widget);
143iRoot * otherRoot_Window (const iWindow *, iRoot *root); 143iRoot * otherRoot_Window (const iWindow *, iRoot *root);
144 144
145iBool processEvent_Window (iWindow *, const SDL_Event *); 145iBool processEvent_Window (iWindow *, const SDL_Event *);