diff options
Diffstat (limited to 'src/ui/window.c')
-rw-r--r-- | src/ui/window.c | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/src/ui/window.c b/src/ui/window.c index 8c252e81..ac9cbd97 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -120,10 +120,11 @@ static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) { | |||
120 | static iBool handleSearchBarCommands_(iWidget *searchBar, const char *cmd) { | 120 | static iBool handleSearchBarCommands_(iWidget *searchBar, const char *cmd) { |
121 | if (equal_Command(cmd, "input.ended") && | 121 | if (equal_Command(cmd, "input.ended") && |
122 | cmp_String(string_Command(cmd, "id"), "find.input") == 0) { | 122 | cmp_String(string_Command(cmd, "id"), "find.input") == 0) { |
123 | if (arg_Command(cmd)) { | 123 | iInputWidget *input = findChild_Widget(searchBar, "find.input"); |
124 | if (arg_Command(cmd) && isVisible_Widget(as_Widget(input))) { | ||
124 | postCommand_App("find.next"); | 125 | postCommand_App("find.next"); |
125 | /* Keep focus. */ | 126 | /* Keep focus. */ |
126 | if (!isEmpty_String(text_InputWidget(findChild_Widget(searchBar, "find.input")))) { | 127 | if (!isEmpty_String(text_InputWidget(input))) { |
127 | postCommand_App("focus.set id:find.input"); | 128 | postCommand_App("focus.set id:find.input"); |
128 | } | 129 | } |
129 | } | 130 | } |
@@ -143,11 +144,11 @@ static iBool handleSearchBarCommands_(iWidget *searchBar, const char *cmd) { | |||
143 | } | 144 | } |
144 | else if (equal_Command(cmd, "find.close")) { | 145 | else if (equal_Command(cmd, "find.close")) { |
145 | if (isVisible_Widget(searchBar)) { | 146 | if (isVisible_Widget(searchBar)) { |
147 | setFlags_Widget(searchBar, hidden_WidgetFlag, iTrue); | ||
148 | arrange_Widget(searchBar->parent); | ||
146 | if (isFocused_Widget(findChild_Widget(searchBar, "find.input"))) { | 149 | if (isFocused_Widget(findChild_Widget(searchBar, "find.input"))) { |
147 | setFocus_Widget(NULL); | 150 | setFocus_Widget(NULL); |
148 | } | 151 | } |
149 | setFlags_Widget(searchBar, hidden_WidgetFlag, iTrue); | ||
150 | arrange_Widget(searchBar->parent); | ||
151 | refresh_Widget(searchBar->parent); | 152 | refresh_Widget(searchBar->parent); |
152 | } | 153 | } |
153 | return iTrue; | 154 | return iTrue; |
@@ -505,25 +506,6 @@ iBool processEvent_Window(iWindow *d, const SDL_Event *ev) { | |||
505 | return iFalse; | 506 | return iFalse; |
506 | } | 507 | } |
507 | 508 | ||
508 | #if 0 | ||
509 | static void waitPresent_Window_(iWindow *d) { | ||
510 | const double ticksPerFrame = 1000.0 / 60.0; | ||
511 | uint32_t nowTime = SDL_GetTicks(); | ||
512 | if (nowTime < d->presentTime) { | ||
513 | SDL_Delay((uint32_t) (d->presentTime - nowTime)); | ||
514 | nowTime = SDL_GetTicks(); | ||
515 | } | ||
516 | /* Now it is the presentation time. */ | ||
517 | /* Figure out the next time in the future. */ | ||
518 | if (d->presentTime <= nowTime) { | ||
519 | d->presentTime += ticksPerFrame * ((int) ((nowTime - d->presentTime) / ticksPerFrame) + 1); | ||
520 | } | ||
521 | else { | ||
522 | d->presentTime = nowTime; | ||
523 | } | ||
524 | } | ||
525 | #endif | ||
526 | |||
527 | void draw_Window(iWindow *d) { | 509 | void draw_Window(iWindow *d) { |
528 | /* Clear the window. */ | 510 | /* Clear the window. */ |
529 | SDL_SetRenderDrawColor(d->render, 0, 0, 0, 255); | 511 | SDL_SetRenderDrawColor(d->render, 0, 0, 0, 255); |
@@ -534,13 +516,12 @@ void draw_Window(iWindow *d) { | |||
534 | #if 0 | 516 | #if 0 |
535 | /* Text cache debugging. */ { | 517 | /* Text cache debugging. */ { |
536 | SDL_Texture *cache = glyphCache_Text(); | 518 | SDL_Texture *cache = glyphCache_Text(); |
537 | SDL_Rect rect = { 140, 60, 512, 512 }; | 519 | SDL_Rect rect = { 140, 60, 1024, 1024 }; |
538 | SDL_SetRenderDrawColor(d->render, 0, 0, 0, 255); | 520 | SDL_SetRenderDrawColor(d->render, 0, 0, 0, 255); |
539 | SDL_RenderFillRect(d->render, &rect); | 521 | SDL_RenderFillRect(d->render, &rect); |
540 | SDL_RenderCopy(d->render, glyphCache_Text(), NULL, &rect); | 522 | SDL_RenderCopy(d->render, glyphCache_Text(), NULL, &rect); |
541 | } | 523 | } |
542 | #endif | 524 | #endif |
543 | // waitPresent_Window_(d); | ||
544 | SDL_RenderPresent(d->render); | 525 | SDL_RenderPresent(d->render); |
545 | } | 526 | } |
546 | 527 | ||