summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-09-18 08:26:31 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-09-18 08:26:31 +0300
commit95941a8fca886ba258716c535d51d0d68d075993 (patch)
tree0be54cd99abf2da1bbc426485c6a980546a6a3a9 /src/app.c
parentdaaf3e72b472e05a4378a7789c6ebedd9b0e9b6e (diff)
Tracking hover widget; cleanup
The hover widget may get deleted during event processing, so Window keeps track of it for refreshing. TODO: Random crash when a destroyed menu is still in the onTop array (?).
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/app.c b/src/app.c
index ed72c450..e06a32ce 100644
--- a/src/app.c
+++ b/src/app.c
@@ -1069,11 +1069,6 @@ iLocalDef iBool isWaitingAllowed_App_(iApp *d) {
1069 return iFalse; 1069 return iFalse;
1070 } 1070 }
1071#endif 1071#endif
1072//#if defined (iPlatformMobile)
1073// if (!isFinished_Anim(&d->window->rootOffset)) {
1074// return iFalse;
1075// }
1076//#endif
1077 return !value_Atomic(&d->pendingRefresh) && isEmpty_SortedArray(&d->tickers); 1072 return !value_Atomic(&d->pendingRefresh) && isEmpty_SortedArray(&d->tickers);
1078} 1073}
1079 1074
@@ -1273,7 +1268,7 @@ void processEvents_App(enum iAppEventMode eventMode) {
1273 } 1268 }
1274 } 1269 }
1275#endif 1270#endif
1276 const iWidget *oldHover = d->window->hover; 1271 d->window->lastHover = d->window->hover;
1277 iBool wasUsed = processEvent_Window(d->window, &ev); 1272 iBool wasUsed = processEvent_Window(d->window, &ev);
1278 if (!wasUsed) { 1273 if (!wasUsed) {
1279 /* There may be a key bindings for this. */ 1274 /* There may be a key bindings for this. */
@@ -1309,8 +1304,8 @@ void processEvents_App(enum iAppEventMode eventMode) {
1309 free(ev.user.data1); 1304 free(ev.user.data1);
1310 } 1305 }
1311 /* Update when hover has changed. */ 1306 /* Update when hover has changed. */
1312 if (oldHover != d->window->hover) { 1307 if (d->window->lastHover != d->window->hover) {
1313 refresh_Widget(oldHover); 1308 refresh_Widget(d->window->lastHover);
1314 refresh_Widget(d->window->hover); 1309 refresh_Widget(d->window->hover);
1315 } 1310 }
1316 break; 1311 break;
@@ -1318,7 +1313,7 @@ void processEvents_App(enum iAppEventMode eventMode) {
1318 } 1313 }
1319 } 1314 }
1320#if defined (LAGRANGE_ENABLE_IDLE_SLEEP) 1315#if defined (LAGRANGE_ENABLE_IDLE_SLEEP)
1321 if (d->isIdling && !gotEvents /*&& isFinished_Anim(&d->window->rootOffset)*/) { 1316 if (d->isIdling && !gotEvents) {
1322 /* This is where we spend most of our time when idle. 60 Hz still quite a lot but we 1317 /* This is where we spend most of our time when idle. 60 Hz still quite a lot but we
1323 can't wait too long after the user tries to interact again with the app. In any 1318 can't wait too long after the user tries to interact again with the app. In any
1324 case, on macOS SDL_WaitEvent() seems to use 10x more CPU time than sleeping. */ 1319 case, on macOS SDL_WaitEvent() seems to use 10x more CPU time than sleeping. */
@@ -1410,10 +1405,7 @@ void refresh_App(void) {
1410 } 1405 }
1411#endif 1406#endif
1412 if (!exchange_Atomic(&d->pendingRefresh, iFalse)) { 1407 if (!exchange_Atomic(&d->pendingRefresh, iFalse)) {
1413 /* Refreshing wasn't pending. */ 1408 return;
1414// if (isFinished_Anim(&d->window->rootOffset)) {
1415 return;
1416// }
1417 } 1409 }
1418// iTime draw; 1410// iTime draw;
1419// initCurrent_Time(&draw); 1411// initCurrent_Time(&draw);
@@ -2746,7 +2738,7 @@ iBool handleCommand_App(const char *cmd) {
2746 else if (equal_Command(cmd, "feeds.update.finished")) { 2738 else if (equal_Command(cmd, "feeds.update.finished")) {
2747 showCollapsed_Widget(findWidget_Root("feeds.progress"), iFalse); 2739 showCollapsed_Widget(findWidget_Root("feeds.progress"), iFalse);
2748 refreshFinished_Feeds(); 2740 refreshFinished_Feeds();
2749 postRefresh_App(); 2741 refresh_Widget(findWidget_App("url"));
2750 return iFalse; 2742 return iFalse;
2751 } 2743 }
2752 else if (equal_Command(cmd, "visited.changed")) { 2744 else if (equal_Command(cmd, "visited.changed")) {