summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-02-03 09:55:24 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-02-03 09:55:24 +0200
commit99ae8d71d5a302c2812e3b469953eaf71f5a6654 (patch)
tree5fabda969b7def498d77266e78c57a9f77df30c2 /src/ui
parentf5d9ddb6fe63b3601532d9ba1bce2963815f0dbb (diff)
Window: Fullscreen mode shouldn't affect the retained window rect
IssueID #130
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/window.c8
-rw-r--r--src/ui/window.h1
2 files changed, 7 insertions, 2 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index f8123a17..6d697e88 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -827,6 +827,10 @@ static iBool isMaximized_Window_(const iWindow *d) {
827#endif 827#endif
828} 828}
829 829
830iBool isFullscreen_Window(const iWindow *d) {
831 return (SDL_GetWindowFlags(d->win) & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0;
832}
833
830static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) { 834static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {
831 switch (ev->event) { 835 switch (ev->event) {
832 case SDL_WINDOWEVENT_EXPOSED: 836 case SDL_WINDOWEVENT_EXPOSED:
@@ -845,7 +849,7 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {
845#endif 849#endif
846 return iFalse; 850 return iFalse;
847 case SDL_WINDOWEVENT_MOVED: { 851 case SDL_WINDOWEVENT_MOVED: {
848 if (!isMaximized_Window_(d) && !d->isDrawFrozen) { 852 if (!isMaximized_Window_(d) && !isFullscreen_Window(d) && !d->isDrawFrozen) {
849 d->lastRect.pos = init_I2(ev->data1, ev->data2); 853 d->lastRect.pos = init_I2(ev->data1, ev->data2);
850 iInt2 border = zero_I2(); 854 iInt2 border = zero_I2();
851#if !defined (iPlatformApple) 855#if !defined (iPlatformApple)
@@ -856,7 +860,7 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {
856 return iTrue; 860 return iTrue;
857 } 861 }
858 case SDL_WINDOWEVENT_RESIZED: 862 case SDL_WINDOWEVENT_RESIZED:
859 if (!isMaximized_Window_(d) && !d->isDrawFrozen) { 863 if (!isMaximized_Window_(d) && !isFullscreen_Window(d) && !d->isDrawFrozen) {
860 d->lastRect.size = init_I2(ev->data1, ev->data2); 864 d->lastRect.size = init_I2(ev->data1, ev->data2);
861 } 865 }
862 updateRootSize_Window_(d, iTrue /* we were already redrawing during the resize */); 866 updateRootSize_Window_(d, iTrue /* we were already redrawing during the resize */);
diff --git a/src/ui/window.h b/src/ui/window.h
index 4b6a6e7a..8cadad1b 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -65,5 +65,6 @@ iInt2 coord_Window (const iWindow *, int x, int y);
65iInt2 mouseCoord_Window (const iWindow *); 65iInt2 mouseCoord_Window (const iWindow *);
66uint32_t frameTime_Window (const iWindow *); 66uint32_t frameTime_Window (const iWindow *);
67SDL_Renderer *renderer_Window (const iWindow *); 67SDL_Renderer *renderer_Window (const iWindow *);
68iBool isFullscreen_Window (const iWindow *);
68 69
69iWindow * get_Window (void); 70iWindow * get_Window (void);