summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/app.c b/src/app.c
index e0037f0c..6bf62dc7 100644
--- a/src/app.c
+++ b/src/app.c
@@ -241,10 +241,11 @@ const iString *execPath_App(void) {
241 return executablePath_CommandLine(&app_.args); 241 return executablePath_CommandLine(&app_.args);
242} 242}
243 243
244void processEvents_App(void) { 244void processEvents_App(enum iAppEventMode eventMode) {
245 iApp *d = &app_; 245 iApp *d = &app_;
246 SDL_Event ev; 246 SDL_Event ev;
247 while (SDL_WaitEvent(&ev)) { 247 while ((eventMode == waitForNewEvents_AppEventMode && SDL_WaitEvent(&ev)) ||
248 (eventMode == postedEventsOnly_AppEventMode && SDL_PollEvent(&ev))) {
248 switch (ev.type) { 249 switch (ev.type) {
249 case SDL_QUIT: 250 case SDL_QUIT:
250 // if (isModified_Song(d->song)) { 251 // if (isModified_Song(d->song)) {
@@ -303,7 +304,7 @@ static int run_App_(iApp *d) {
303 SDL_EventState(SDL_DROPFILE, SDL_ENABLE); /* open files via drag'n'drop */ 304 SDL_EventState(SDL_DROPFILE, SDL_ENABLE); /* open files via drag'n'drop */
304 while (d->running) { 305 while (d->running) {
305 runTickers_App_(d); 306 runTickers_App_(d);
306 processEvents_App(); /* may wait here for a while */ 307 processEvents_App(waitForNewEvents_AppEventMode);
307 refresh_App(); 308 refresh_App();
308 } 309 }
309 return 0; 310 return 0;
@@ -429,14 +430,17 @@ iBool handleCommand_App(const char *cmd) {
429 d->historyPos = 0; 430 d->historyPos = 0;
430 } 431 }
431 /* Insert new item. */ 432 /* Insert new item. */
432 iHistoryItem item; 433 const iHistoryItem *lastItem = historyItem_App_(d, 0);
433 init_HistoryItem(&item); 434 if (!lastItem || cmpString_String(&lastItem->url, url) != 0) {
434 set_String(&item.url, url); 435 iHistoryItem item;
435 pushBack_Array(&d->history, &item); 436 init_HistoryItem(&item);
436 /* Don't make it too long. */ 437 set_String(&item.url, url);
437 if (size_Array(&d->history) > historyMax_App_) { 438 pushBack_Array(&d->history, &item);
438 deinit_HistoryItem(front_Array(&d->history)); 439 /* Don't make it too long. */
439 remove_Array(&d->history, 0); 440 if (size_Array(&d->history) > historyMax_App_) {
441 deinit_HistoryItem(front_Array(&d->history));
442 remove_Array(&d->history, 0);
443 }
440 } 444 }
441 } 445 }
442 } 446 }