Some WinRT strangeness with reported window size |
Re: Some WinRT strangeness with reported window size |
DLudwig
|
I am unable to reproduce this. Can you provide a set of steps-to-reproduce, along with expected and observed results? Also, which version/revision of SDL are you using? -- David L. |
|||||||||||||
|
Some WinRT strangeness with reported window size |
hardcoredaniel
Guest
|
Hi David,
can you check out this app: https://www.microsoft.com/en-us/store/p/wmelite-engine/9nblggh4wb5z It will launch in fullscreen. When you resize it to windowed mode, change it to say 50% of its fullscreen size, minimize it, and then restore, it will display in invalid size. If you start resizing the window again, it'll immediately use the proper size. The SDL version from this app is the state of trunk from around mid of june. The behaviour does not change if I use SDL trunk from around 2 weeks ago. Regards, Daniel ---------- Původnà zpráva ---------- Od: DLudwig Komu: Datum: 10. 10. 2016 22:27:52 Předmět: Re: [SDL] Some WinRT strangeness with reported window size
|
|||||||||||||
|
Re: Some WinRT strangeness with reported window size |
DLudwig
|
I see the bug reproduce in that app, but not in my own code. I've tried checking various SDL outputs as well (window size, renderer output size, viewport, and a few other things), and am not yet seeing any discrepencies. Do you have sample code that I could try building + testing against, preferably something dependency-free and single-file? -- David L. |
|||||||||||||
|
Some WinRT strangeness with reported window size |
hardcoredaniel
Guest
|
Hi David,
I'm sorry for having you bothered with an issue that you could not have reproduced due to missing information. After thinking about your observations it occurred to me that some time ago I tried to implement some workaround for the issue that the SDL app will not reliably start (resp change to) fullscreen mode on PCs. What I did was to add some code in my app to react on the window event "SDL_WINDOWEVENT_SHOWN" and to call "SDL_SetWindowFullscreen" with SDL_TRUE as 2nd parameter. This worked well at app start, so that I forgot about this trick. However, when restoring a minimized app that I changed to windowed mode before, the system is not going to fullscreen despite that call (I'm not sure whether or whom to blame, because I intentionally left fullscreen mode before minimizing the window). As the call to "SetWindowFullscreen" cannot return success/failure, SDL doesn't know about this and so probably assumes fullscreen was ok and sends the SDL_WINDOWEVENT_RESIZED with the fullscreen coords. So maybe I will have to modify the SDL sources myself to add a return code to SetWindowFullscreen, return hard-coded success for all other platforms, and success/failure for WinRT only. I remember your comment about such a change not suiting all platforms where the success/failure of such operation is reported asynchronously. Yet I have no other idea how to handle it. BTW: Can you reproduce the width/height parameter inconsistency on the mobile platform? Or is there a relation to my workaround as well? Regards, Daniel ---------- Původnà zpráva ---------- Od: DLudwig Komu: Datum: 15. 10. 2016 20:07:53 Předmět: Re: [SDL] Some WinRT strangeness with reported window size
|
|||||||||||||
|
Some WinRT strangeness with reported window size |
hardcoredaniel
Guest
|
Hi David,
I found that modifying SDL as described fixes the issue. FYI the (pretty ugly) patch is below. Modifying the behaviour in SDL_video.c's "update fullscreen" depending on the result of the TryEnterFullscreen() mode fixes all screen size issues for me. Regards, Daniel --- SDL_snapshot/src/video/SDL_sysvideo.h 2016-10-02 08:22:14.323265900 +0200 +++ SDL_merged/src/video/SDL_sysvideo.h 2016-10-22 16:08:43.340540400 +0200 @@ -220,7 +220,11 @@ void (*RestoreWindow) (_THIS, SDL_Window * window); void (*SetWindowBordered) (_THIS, SDL_Window * window, SDL_bool bordered); void (*SetWindowResizable) (_THIS, SDL_Window * window, SDL_bool resizable); +#ifdef __WINRT__ + int (*SetWindowFullscreen) (_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen); +#else void (*SetWindowFullscreen) (_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen); +#endif int (*SetWindowGammaRamp) (_THIS, SDL_Window * window, const Uint16 * ramp); int (*GetWindowGammaRamp) (_THIS, SDL_Window * window, Uint16 * ramp); void (*SetWindowGrab) (_THIS, SDL_Window * window, SDL_bool grabbed); diff -bBur SDL_snapshot/src/video/SDL_video.c SDL_merged/src/video/SDL_video.c --- SDL_snapshot/src/video/SDL_video.c 2016-10-08 10:16:43.377628700 +0200 +++ SDL_merged/src/video/SDL_video.c 2016-10-22 17:26:58.402858000 +0200 @@ -1265,7 +1265,14 @@ } if (_this->SetWindowFullscreen) { +#ifdef __WINRT__ + if (_this->SetWindowFullscreen(_this, other, display, SDL_TRUE) != 0) + { + resized = SDL_FALSE; + } +#else _this->SetWindowFullscreen(_this, other, display, SDL_TRUE); +#endif } display->fullscreen_window = other; diff -bBur SDL_snapshot/src/video/winrt/SDL_winrtvideo.cpp SDL_merged/src/video/winrt/SDL_winrtvideo.cpp --- SDL_snapshot/src/video/winrt/SDL_winrtvideo.cpp 2016-10-02 08:22:18.423455500 +0200 +++ SDL_merged/src/video/winrt/SDL_winrtvideo.cpp 2016-10-22 17:27:36.208419200 +0200 @@ -80,9 +81,10 @@ /* Window functions */ static int WINRT_CreateWindow(_THIS, SDL_Window * window); static void WINRT_SetWindowSize(_THIS, SDL_Window * window); -static void WINRT_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen); +static int WINRT_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen); static void WINRT_DestroyWindow(_THIS, SDL_Window * window); static SDL_bool WINRT_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info); +static int WINRT_GetDisplayDPI(_THIS, SDL_VideoDisplay * sdl_display, float * ddpi, float * hdpi, float * vdpi); /* Misc functions */ @@ -723,23 +726,49 @@ #endif } -void +int WINRT_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen) { #if NTDDI_VERSION >= NTDDI_WIN10 SDL_WindowData * data = (SDL_WindowData *)window->driverdata; bool isWindowActive = WINRT_IsCoreWindowActive(data->coreWindow.Get()); + bool rememberMode = false; + int successVal = 0; + + const char *hint = SDL_GetHint(SDL_HINT_WINRT_REMEMBER_WINDOW_FULLSCREEN_PREFERENCE); + if (hint) { + if (*hint == '1') { + rememberMode = true; + } + } + if (isWindowActive) { if (fullscreen) { if (!data->appView->IsFullScreenMode) { - data->appView->TryEnterFullScreenMode(); // TODO, WinRT: return failure (to caller?) from TryEnterFullScreenMode() + if (data->appView->TryEnterFullScreenMode() == true) { + if (rememberMode == true) { + data->appView->PreferredLaunchWindowingMode = ApplicationViewWindowingMode::FullScreen; + } + } else { + successVal = -1; + } } } else { if (data->appView->IsFullScreenMode) { data->appView->ExitFullScreenMode(); + + if (rememberMode == true) { + data->appView->PreferredLaunchWindowingMode = ApplicationViewWindowingMode::Auto; + } } } } + else { + successVal = -1; + } + return successVal; +#else + return 0; #endif } ---------- Původnà zpráva ---------- Od: hardcoredaniel Komu: Datum: 18. 10. 2016 17:15:17 Předmět: Re: [SDL] Some WinRT strangeness with reported window size
|
|||||||||||||||
|
Re: Some WinRT strangeness with reported window size |
DLudwig
|
Hi Daniel,
Any chance that you could provide some sample code, maybe some project file(s), with which one could use to reliably reproduce the bug you were initially seeing? -- David L. |
|||||||||||
|
Some WinRT strangeness with reported window size |
hardcoredaniel
Guest
|
Hi David,
sorry for the long delay for my reply. I do not have a small project, mine is rather big (repo size ~3G). But I hope you have some scratch disk space :-) Please check out these 2 repos next to each other (e.g. into the same root dir) from bitbucket: https:///hcdaniel/wmelite-dependencies-for-linux-and-android https:///hcdaniel/wmelite-rapaki-edition The names of the repos must be kept because the project references go across the repos. Then you can open this project: wmelite-rapaki-edition/vs2015_uwp/wmelite_sdl_mixer/wmelite_sdl_mixer.sln And compilation/running should work. The SDL fork that the project references to has the change for fullscreen already implemented. I hope that you can easily remove this reference and point it to SDL trunk instead, to see the difference. Regards, Daniel ---------- Původnà zpráva ---------- Od: DLudwig Komu: Datum: 23. 10. 2016 18:25:44 Předmět: Re: [SDL] Some WinRT strangeness with reported window size
|
|||||||||||||
|