diff options
Diffstat (limited to 'src/ui/window.c')
-rw-r--r-- | src/ui/window.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ui/window.c b/src/ui/window.c index 82109c07..ef8aea71 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -420,6 +420,7 @@ static void drawBlank_Window_(iWindow *d) { | |||
420 | void init_Window(iWindow *d, iRect rect) { | 420 | void init_Window(iWindow *d, iRect rect) { |
421 | theWindow_ = d; | 421 | theWindow_ = d; |
422 | iZap(d->cursors); | 422 | iZap(d->cursors); |
423 | d->pendingCursor = NULL; | ||
423 | d->isDrawFrozen = iTrue; | 424 | d->isDrawFrozen = iTrue; |
424 | uint32_t flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI; | 425 | uint32_t flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI; |
425 | #if defined (iPlatformApple) | 426 | #if defined (iPlatformApple) |
@@ -515,6 +516,13 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) { | |||
515 | return iFalse; | 516 | return iFalse; |
516 | } | 517 | } |
517 | 518 | ||
519 | static void applyCursor_Window_(iWindow *d) { | ||
520 | if (d->pendingCursor) { | ||
521 | SDL_SetCursor(d->pendingCursor); | ||
522 | d->pendingCursor = NULL; | ||
523 | } | ||
524 | } | ||
525 | |||
518 | iBool processEvent_Window(iWindow *d, const SDL_Event *ev) { | 526 | iBool processEvent_Window(iWindow *d, const SDL_Event *ev) { |
519 | switch (ev->type) { | 527 | switch (ev->type) { |
520 | case SDL_WINDOWEVENT: { | 528 | case SDL_WINDOWEVENT: { |
@@ -552,6 +560,9 @@ iBool processEvent_Window(iWindow *d, const SDL_Event *ev) { | |||
552 | if (oldHover != hover_Widget()) { | 560 | if (oldHover != hover_Widget()) { |
553 | postRefresh_App(); | 561 | postRefresh_App(); |
554 | } | 562 | } |
563 | if (event.type == SDL_MOUSEMOTION) { | ||
564 | applyCursor_Window_(d); | ||
565 | } | ||
555 | return wasUsed; | 566 | return wasUsed; |
556 | } | 567 | } |
557 | } | 568 | } |
@@ -610,11 +621,11 @@ void setFreezeDraw_Window(iWindow *d, iBool freezeDraw) { | |||
610 | d->isDrawFrozen = freezeDraw; | 621 | d->isDrawFrozen = freezeDraw; |
611 | } | 622 | } |
612 | 623 | ||
613 | void setCursor_Window(iWindow *d, int cursor) { | 624 | void setCursor_Window(iWindow *d, int cursor) { |
614 | if (!d->cursors[cursor]) { | 625 | if (!d->cursors[cursor]) { |
615 | d->cursors[cursor] = SDL_CreateSystemCursor(cursor); | 626 | d->cursors[cursor] = SDL_CreateSystemCursor(cursor); |
616 | } | 627 | } |
617 | SDL_SetCursor(d->cursors[cursor]); | 628 | d->pendingCursor = d->cursors[cursor]; |
618 | } | 629 | } |
619 | 630 | ||
620 | iInt2 rootSize_Window(const iWindow *d) { | 631 | iInt2 rootSize_Window(const iWindow *d) { |