Commit graph

188 commits

Author SHA1 Message Date
Lothar Serra Mari
d6f105e906 BACKENDS: OPENGLSDL: Only relocate the window to the center of the screen if truly necessary 2021-08-28 10:43:04 +02:00
Lothar Serra Mari
1b42675e52 BACKENDS: OPENGLSDL: Limit window positioning workaround to Win32
It looks like other platforms are not affected by this, at least I
wasn't able to reproduce the issue on Linux in any way.

Since branching off to the next release is very soon and we are running
out of time, I'm limiting this to Win32 in order to avoid unneccessary
breakage by only fixing _really_ affected platforms.
2021-08-28 10:43:04 +02:00
Lothar Serra Mari
4c7bc5effb BACKENDS: OPENGLSDL: Do not try to center window in fullscreen or maximized mode 2021-08-28 10:43:04 +02:00
Lothar Serra Mari
1b6c4f48aa BACKENDS: OPENGLSDL: Forcefully center the window to prevent off-screen rendering 2021-08-28 10:43:04 +02:00
Lothar Serra Mari
cedd57a4ac BACKENDS: OPENGLSDL: Fix wrong check for maximized windows 2021-08-28 10:43:04 +02:00
Lothar Serra Mari
3da65d47cb BACKENDS: OPENGLSDL: Prevent window resizing events in fullscreen mode 2021-08-28 10:43:04 +02:00
Lothar Serra Mari
d07c97f3cd BACKENDS: OPENGLSDL: Remember maximized window state 2021-08-28 10:43:04 +02:00
Thierry Crozat
dc7a09fdd1 SDL: Cleanup HiDPI macOS hacks
The SDL library handles HiDPI differently depending on the system.
On some systems, such as macOS, the drawable area and the SDL window
have a different size (the window is on low-dpi size) while on
other systems such as Windows they have the same size. Because of
that we sometimes need to scale sizes or coordinates between the
two, and sometimes we don't.

This was handled in two different ways. This commit change the code
to handle it consistently everywhere, and also should be more future
proof should SDL change the way it handles HiDPI in the future (as
we now query the size from SDL itself to find out if the scaling is
needed).
2021-08-20 22:10:26 +02:00
athrxx
95f1b010f8 SDL: avoid assert with SDL debug builds 2021-08-15 16:18:16 +02:00
Lothar Serra Mari
900d763264 BACKENDS: OPENGLSDL: Enlarge window if stored dimensions are not sufficient 2021-08-15 13:58:48 +01:00
Lothar Serra Mari
1aaab76b44 BACKENDS: OPENGLSDL: Fix aspect ratio on auto-calculated window sizes 2021-08-15 13:58:48 +01:00
Lothar Serra Mari
51cff582b5 BACKENDS: OPENGLSDL: Disable storing and restoring window sizes for SDL1
The previous implementation was already broken, since the values were never stored in the config file
since that part was already guarded by SDL_VERSION_ATLEAST.

Since we have no way to properly determine if a window is maximized or not for
SDL1, I recommend skipping this part in the compilation.

Now, the function at least works properly for SDL2 - it was broken on _both_ versions before.
2021-08-15 13:58:48 +01:00
Lothar Serra Mari
8a8557e94d BACKENDS: OPENGLSDL: Fix logic errors in window size management 2021-08-15 13:58:48 +01:00
Cameron Cawley
c4699cb280 SDL: Move getDisplayDpiFromSdl and getDpiScalingFactor into the SdlWindow class 2021-08-14 19:09:33 +01:00
Thierry Crozat
4d59d40f32 OPENGLSDL: Fix compilation with SDL1 2021-08-14 03:25:43 +01:00
Thierry Crozat
c9682dfbcf OPENGLSDL: Fix changing scaler with hotkey in games
Also improve decreasing the scaler when using a custom window size.
2021-08-13 23:58:34 +01:00
Thierry Crozat
5caacb763b SDL: Change signature of getDpiScalingFactor to return the result 2021-08-13 21:41:33 +01:00
Thierry Crozat
abf782c670 COMMON: Remove kFeatureHiDPI from OSystem and use getHiDPIScreenFactor instead 2021-08-13 21:41:33 +01:00
Thierry Crozat
63dd44a81d SDL: Implement getHiDPIScreenFactor 2021-08-13 21:41:33 +01:00
Lothar Serra Mari
aae99da842 BACKENDS: OPENGLSDL: Save detected window dimensions to the config file
This prevents undefined behavior if no window dimensions are present in
the ScummVM config file from previous runs.
2021-07-30 20:47:53 +02:00
Thierry Crozat
2a410768ad OPENGLSDL: Fix increasing/decreasing the window size on macOS 2021-07-16 13:20:38 +01:00
Thierry Crozat
c1a2d5ba1b OPENGLSDL: Remove getting the supported screen resolutions for SDL2
Since we use the SDL_WINDOW_FULLSCREEN_DESKTOP with SDL2, we always
use the desktop resolution in fullscreen mode anyway. Cycling
through other resolutions did nothing and was confusing.
2021-07-16 13:20:38 +01:00
Lothar Serra Mari
f4eb3a63b8 BACKENDS: OPENGLSDL: Improve auto-handling of window sizes 2021-06-13 07:50:43 +02:00
Lothar Serra Mari
e2d417e785 BACKENDS: OPENGLSDL: Fix division by zero when no previous resizing events occured 2021-05-29 19:47:37 +02:00
SupSuper
60f1fd98aa SDL: Use the window display index when querying display modes 2021-05-01 11:22:22 +03:00
Lothar Serra Mari
db52dde75d BACKENDS: OPENGLSDL: Fix typo while initializing _windowIsMaximized state 2021-04-28 14:36:46 +02:00
Lothar Serra Mari
1b68301540 BACKENDS: OPENGLSDL: Properly handle maximized windows 2021-04-27 07:25:22 +02:00
Eugene Sandulenko
50e6460fe2
BACKENDS: OPENGL: Add workaround for macOS window size memorizing 2021-04-19 13:10:25 +02:00
Lothar Serra Mari
f288ab7e20 BACKENDS: OPENGLSDL: Flush config file after resize events 2021-04-18 15:16:52 +02:00
Lothar Serra Mari
ceca0b5ae8 GUI: Add support for GUI window sizing based on screen resolution 2021-04-18 14:41:29 +02:00
Eugene Sandulenko
5e7fe2dc57
JANITORIAL: Replace spaces in indentation with tabs 2021-04-15 21:20:36 +02:00
rsn8887
fca3abd9ef SWITCH: Fix wrong zoom on SDL to GL transition again 2021-04-13 16:17:22 -05:00
SupSuper
8fba77eefa BACKENDS: OPENGLSDL: Always use drawable size when resizing window
This corrects situations in SDL2 where the window size is not
the same as the drawable size, leading to incorrect rendering.
2021-04-12 18:38:45 +02:00
Cameron Cawley
24b59ecb4c Revert "OPENGL: Implement high DPI support on Android (#1895)"
This reverts commit 177d709909.
2021-04-12 00:54:12 +01:00
Eugene Sandulenko
fda5847789 BACKENDS: OPENGLSDL: Fix compilation with SDL1 2021-04-11 21:21:44 +02:00
Eugene Sandulenko
c06d47e397 COMMON: Added kFeatureHiDPI and return it from the backend 2021-04-11 21:21:44 +02:00
Eugene Sandulenko
bb15133a0a BACKENDS: OPENGLSDL: Fix switching to full screen with Alt+Enter 2021-04-11 21:21:44 +02:00
Eugene Sandulenko
5e395d166a BACKENDS: HiDPI support in OpenGL backend 2021-04-11 21:21:44 +02:00
Thierry Crozat
7408dee5df Revert "GRAPHICS: Tentative fix saveScreenshot() warning for OpenGL"
This reverts commit 0f118d0210.
2021-04-07 00:09:50 +01:00
antoniou79
0f118d0210 GRAPHICS: Tentative fix saveScreenshot() warning for OpenGL
Building for Android (OpenGL) had noisy warning for hiding overloaded virtual function

Added a dummy implementation in OpenGLGraphics manager, and also for OpenGLSdlGraphicsManager it now explicitly calls the SdlGraphicsManager implementation for the void argument signature.
2021-04-03 14:03:36 +03:00
rsn8887
397ea454ba SWITCH: Fix wrong zoom on SDL to GL transition 2021-02-17 22:58:09 -06:00
SupSuper
0128d5e3b5 OPENGLSDL: Fix SDL asserting when getting fullscreen state
This fixes a null pointer being passed to SDL_GetWindowFlags
when there is no window yet, since the condition was incomplete
2020-11-01 20:10:15 +00:00
Paweł Kołodziejski
59ba9cb715
SDL: Do not allow toggle fullscreen for backends which can lose opengl context used for 3d games. (#2514) 2020-10-13 20:27:58 +02:00
Thierry Crozat
c5ede297ea JANITORIAL: Simplify some code that use U32String::format 2020-09-08 21:24:27 +01:00
aryanrawlani28
d48453693c GUI: U32: Use translated strings as arguments for formatting function usage. 2020-08-30 14:43:41 +02:00
aryanrawlani28
bd19eaa5bf GUI: U32: More code improvements in engines and misc fixes
- Xeen's GUIError now takes in U32String
- Scumm's ValueDisplayDialog takes in U32
- Mohawk's InfoDialog & PauseDialog takes in U32
- Mohawk - in riven.cpp, Some assignment fixes
- Backends -in sdl.cpp, Remove incorrect conversion from iso8859 when setting text in clipboard
- Graphics - Add u32 strings instead of decoding each piece in format
2020-08-30 14:43:41 +02:00
aryanrawlani28
e22b32abfe GUI: U32: Use Common::U32String::format where necessary and GUIError to u32
- Where necessary as in, where translated messages are used.
- GUIErrorMessage now takes in U32String
- error messages across some engines use U32Strings. they are changed because they show a message dialog.
2020-08-30 14:43:41 +02:00
aryanrawlani28
b9a449480b GUI: U32: Remove u32::format references
- Removed because implicit conversion can simply handle this usecase
2020-08-30 14:43:41 +02:00
aryanrawlani28
f800ca4ada GUI: U32: Convert majority of code to use U32
This commit also includes some additional major changes.

- Return U32String from TransMan getTranslation()
- Change tooltips to be U32Strings
- Remove temporary code of convertToU32String
- U32 Support various dialogs (Browser, FileBrowser, Messages, Chooser, etc)
- U32 for music plugins
- U32 for OSD messages
- Add some helper functions to ustr.cpp
- Change default tooltips from nullptr & 0 -> ""
- Some runtime exceptions may occur when changing languages due to incorrect String::Format
2020-08-30 14:43:41 +02:00
Cameron Cawley
2f6d219dce SDL: Move detection of the desktop resolution into the SdlWindow class 2020-05-10 21:53:07 +02:00