diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-16 18:56:01 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-16 18:56:01 +0300 |
commit | 69ea47be1cee7298b65db8104f1c88e51554ba48 (patch) | |
tree | bf4cf799be4d9ceacec548edcd1eff30db92d757 /src/ui/window.c | |
parent | 6d8bf2508f5e2af36b61cca42ed68cad26c41d56 (diff) |
Added Pure Black and Pure White themes
Font changes cause window redrawing to pause so document layout doesn’t get an intermediate update with a different width.
Sheets are mouse-modal.
Diffstat (limited to 'src/ui/window.c')
-rw-r--r-- | src/ui/window.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/ui/window.c b/src/ui/window.c index 8760d36f..75c848e1 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -380,7 +380,7 @@ static void drawBlank_Window_(iWindow *d) { | |||
380 | 380 | ||
381 | void init_Window(iWindow *d, iRect rect) { | 381 | void init_Window(iWindow *d, iRect rect) { |
382 | theWindow_ = d; | 382 | theWindow_ = d; |
383 | d->isBlank = iTrue; | 383 | d->isDrawFrozen = iTrue; |
384 | uint32_t flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI; | 384 | uint32_t flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI; |
385 | #if defined (iPlatformApple) | 385 | #if defined (iPlatformApple) |
386 | SDL_SetHint(SDL_HINT_RENDER_DRIVER, "metal"); | 386 | SDL_SetHint(SDL_HINT_RENDER_DRIVER, "metal"); |
@@ -477,8 +477,8 @@ iBool processEvent_Window(iWindow *d, const SDL_Event *ev) { | |||
477 | } | 477 | } |
478 | default: { | 478 | default: { |
479 | SDL_Event event = *ev; | 479 | SDL_Event event = *ev; |
480 | if (event.type == SDL_USEREVENT && isCommand_UserEvent(ev, "window.unblank")) { | 480 | if (event.type == SDL_USEREVENT && isCommand_UserEvent(ev, "window.unfreeze")) { |
481 | d->isBlank = iFalse; | 481 | d->isDrawFrozen = iFalse; |
482 | postRefresh_App(); | 482 | postRefresh_App(); |
483 | return iTrue; | 483 | return iTrue; |
484 | } | 484 | } |
@@ -513,11 +513,10 @@ iBool processEvent_Window(iWindow *d, const SDL_Event *ev) { | |||
513 | } | 513 | } |
514 | 514 | ||
515 | void draw_Window(iWindow *d) { | 515 | void draw_Window(iWindow *d) { |
516 | /* Clear the window. */ | 516 | if (d->isDrawFrozen) { |
517 | if (d->isBlank) { | ||
518 | drawBlank_Window_(d); | ||
519 | return; | 517 | return; |
520 | } | 518 | } |
519 | /* Clear the window. */ | ||
521 | SDL_SetRenderDrawColor(d->render, 0, 0, 0, 255); | 520 | SDL_SetRenderDrawColor(d->render, 0, 0, 0, 255); |
522 | SDL_RenderClear(d->render); | 521 | SDL_RenderClear(d->render); |
523 | /* Draw widgets. */ | 522 | /* Draw widgets. */ |
@@ -561,6 +560,10 @@ void setUiScale_Window(iWindow *d, float uiScale) { | |||
561 | } | 560 | } |
562 | } | 561 | } |
563 | 562 | ||
563 | void setFreezeDraw_Window(iWindow *d, iBool freezeDraw) { | ||
564 | d->isDrawFrozen = freezeDraw; | ||
565 | } | ||
566 | |||
564 | iInt2 rootSize_Window(const iWindow *d) { | 567 | iInt2 rootSize_Window(const iWindow *d) { |
565 | return d->root->rect.size; | 568 | return d->root->rect.size; |
566 | } | 569 | } |