summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-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
5 files changed, 11 insertions, 9 deletions
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 *);