summaryrefslogtreecommitdiff
path: root/src/ui/window.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-09-20 12:27:51 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-09-20 12:27:51 +0300
commitba6d544b1237aea6901cf5b4f6562db9eb0f46c4 (patch)
treeacb5ba66943ad745090c24e922ffdc47be00faea /src/ui/window.c
parent2d81addf78d6a8b0fb2f2959b04a385c4adffdf2 (diff)
Fixed build on Windows (MSYS)
Diffstat (limited to 'src/ui/window.c')
-rw-r--r--src/ui/window.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index e9a34ace..27ef2bc3 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -240,7 +240,7 @@ static void updateSize_MainWindow_(iMainWindow *d, iBool notifyAlways) {
240} 240}
241 241
242void drawWhileResizing_MainWindow(iMainWindow *d, int w, int h) { 242void drawWhileResizing_MainWindow(iMainWindow *d, int w, int h) {
243 draw_MainWindow(d); 243 draw_MainWindow(d);
244} 244}
245 245
246static float pixelRatio_Window_(const iWindow *d) { 246static float pixelRatio_Window_(const iWindow *d) {
@@ -438,7 +438,7 @@ void init_Window(iWindow *d, enum iWindowType type, iRect rect, uint32_t flags)
438 if (left_Rect(rect) >= 0 || top_Rect(rect) >= 0) { 438 if (left_Rect(rect) >= 0 || top_Rect(rect) >= 0) {
439 SDL_SetWindowPosition(d->win, left_Rect(rect), top_Rect(rect)); 439 SDL_SetWindowPosition(d->win, left_Rect(rect), top_Rect(rect));
440 } 440 }
441 SDL_GetRendererOutputSize(d->render, &d->size.x, &d->size.y); 441 SDL_GetRendererOutputSize(d->render, &d->size.x, &d->size.y);
442 drawBlank_Window_(d); 442 drawBlank_Window_(d);
443 d->pixelRatio = pixelRatio_Window_(d); /* point/pixel conversion */ 443 d->pixelRatio = pixelRatio_Window_(d); /* point/pixel conversion */
444 d->displayScale = displayScale_Window_(d); 444 d->displayScale = displayScale_Window_(d);
@@ -472,7 +472,7 @@ void deinit_Window(iWindow *d) {
472 if (d->cursors[i]) { 472 if (d->cursors[i]) {
473 SDL_FreeCursor(d->cursors[i]); 473 SDL_FreeCursor(d->cursors[i]);
474 } 474 }
475 } 475 }
476} 476}
477 477
478void init_MainWindow(iMainWindow *d, iRect rect) { 478void init_MainWindow(iMainWindow *d, iRect rect) {
@@ -522,7 +522,7 @@ void init_MainWindow(iMainWindow *d, iRect rect) {
522#endif 522#endif
523 } 523 }
524#if defined(iPlatformMsys) 524#if defined(iPlatformMsys)
525 SDL_SetWindowMinimumSize(d->win, minSize.x * d->base.displayScale, minSize.y * d->base.displayScale); 525 SDL_SetWindowMinimumSize(d->base.win, minSize.x * d->base.displayScale, minSize.y * d->base.displayScale);
526 useExecutableIconResource_SDLWindow(d->base.win); 526 useExecutableIconResource_SDLWindow(d->base.win);
527#endif 527#endif
528#if defined (iPlatformLinux) 528#if defined (iPlatformLinux)
@@ -538,7 +538,7 @@ void init_MainWindow(iMainWindow *d, iRect rect) {
538 setupWindow_iOS(as_Window(d)); 538 setupWindow_iOS(as_Window(d));
539#endif 539#endif
540 setCurrent_Text(d->base.text); 540 setCurrent_Text(d->base.text);
541 SDL_GetRendererOutputSize(d->base.render, &d->base.size.x, &d->base.size.y); 541 SDL_GetRendererOutputSize(d->base.render, &d->base.size.x, &d->base.size.y);
542 setupUserInterface_MainWindow(d); 542 setupUserInterface_MainWindow(d);
543 postCommand_App("~bindings.changed"); /* update from bindings */ 543 postCommand_App("~bindings.changed"); /* update from bindings */
544 /* Load the border shadow texture. */ { 544 /* Load the border shadow texture. */ {
@@ -800,7 +800,7 @@ static iBool handleWindowEvent_MainWindow_(iMainWindow *d, const SDL_WindowEvent
800 // printf("normal rect set (move)\n"); fflush(stdout); 800 // printf("normal rect set (move)\n"); fflush(stdout);
801 iInt2 border = zero_I2(); 801 iInt2 border = zero_I2();
802#if !defined(iPlatformApple) 802#if !defined(iPlatformApple)
803 SDL_GetWindowBordersSize(d->win, &border.y, &border.x, NULL, NULL); 803 SDL_GetWindowBordersSize(d->base.win, &border.y, &border.x, NULL, NULL);
804#endif 804#endif
805 d->place.normalRect.pos = 805 d->place.normalRect.pos =
806 max_I2(zero_I2(), sub_I2(d->place.normalRect.pos, border)); 806 max_I2(zero_I2(), sub_I2(d->place.normalRect.pos, border));
@@ -1055,7 +1055,7 @@ iBool dispatchEvent_Window(iWindow *d, const SDL_Event *ev) {
1055 if (!isEscapeKeypress_(ev)) { 1055 if (!isEscapeKeypress_(ev)) {
1056 /* Key events go only to the root with keyboard focus, with the exception 1056 /* Key events go only to the root with keyboard focus, with the exception
1057 of Escape that will also affect the entire window. */ 1057 of Escape that will also affect the entire window. */
1058 continue; 1058 continue;
1059 } 1059 }
1060 } 1060 }
1061 if (ev->type == SDL_MOUSEWHEEL && !contains_Rect(rect_Root(root), 1061 if (ev->type == SDL_MOUSEWHEEL && !contains_Rect(rect_Root(root),
@@ -1126,7 +1126,7 @@ void draw_Window(iWindow *d) {
1126#if !defined (NDEBUG) 1126#if !defined (NDEBUG)
1127 draw_Text(defaultBold_FontId, safeRect_Root(root).pos, red_ColorId, "%d", drawCount_); 1127 draw_Text(defaultBold_FontId, safeRect_Root(root).pos, red_ColorId, "%d", drawCount_);
1128 drawCount_ = 0; 1128 drawCount_ = 0;
1129#endif 1129#endif
1130 } 1130 }
1131// drawRectThickness_Paint(&p, (iRect){ zero_I2(), sub_I2(d->size, one_I2()) }, gap_UI / 4, uiSeparator_ColorId); 1131// drawRectThickness_Paint(&p, (iRect){ zero_I2(), sub_I2(d->size, one_I2()) }, gap_UI / 4, uiSeparator_ColorId);
1132 setCurrent_Root(NULL); 1132 setCurrent_Root(NULL);
@@ -1587,6 +1587,9 @@ iWindow *newPopup_Window(iInt2 screenPos, iWidget *rootWidget) {
1587 new_Window(popup_WindowType, 1587 new_Window(popup_WindowType,
1588 (iRect){ screenPos, divf_I2(rootWidget->rect.size, get_Window()->pixelRatio) }, 1588 (iRect){ screenPos, divf_I2(rootWidget->rect.size, get_Window()->pixelRatio) },
1589 SDL_WINDOW_ALWAYS_ON_TOP | 1589 SDL_WINDOW_ALWAYS_ON_TOP |
1590#if !defined (iPlatformAppleDesktop)
1591 SDL_WINDOW_BORDERLESS |
1592#endif
1590 SDL_WINDOW_POPUP_MENU | 1593 SDL_WINDOW_POPUP_MENU |
1591 SDL_WINDOW_SKIP_TASKBAR); 1594 SDL_WINDOW_SKIP_TASKBAR);
1592#if defined (iPlatformAppleDesktop) 1595#if defined (iPlatformAppleDesktop)