Commit graph

119 commits

Author SHA1 Message Date
Cameron Cawley
350e21ba58 SDL: Better workaround for enabling the system cursor 2022-08-26 21:47:49 +01:00
Thierry Crozat
55dccdf787 SDL: Do not adjust window size when creating maximized window 2022-06-05 17:21:18 +01:00
Le Philousophe
06bc7a25fa OPENGL: Indicate support of OpenGL even in 2D mode
This allows to check for OpenGL support in backend without having to
call initGraphics3d
2022-04-03 22:17:19 +02:00
Kalle Kietavainen
ca2405ed05 SDL: Fix mouse clip to game area in HiDPI mode
The mouse position is set in window coordinates, but it's clipped to the
game area in drawable area coordinates. Previously, the scaling between
these two was not taken into account when calculating the right/bottom
edges of the game area. When the clipped mouse position was converted
back to window coordinates and rounded to the nearest integer, it could
end up on the edge of the game area, not inside of it. This leads to a
loop in which the clipped mouse position is outside of the game area and
needs to be clipped again.

This fixes bug #12646.
2022-02-16 22:15:43 +00:00
Cameron Cawley
a14c5a4a53 SDL: Replace gfx_mode with scale_factor in initSizeHint() 2022-01-16 13:22:37 +02:00
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Cameron Cawley
c6836c9b77 SDL: Use SDL_SetWindowMouseRect to confine the mouse area 2021-11-19 19:52:58 +01:00
Orgad Shaneh
44219dfa1a BACKENDS: Use nullptr
Using clang-tidy modernize-use-nullptr
2021-11-14 15:51:59 +02:00
Filippos Karapetis
8f49df6aca SDL: Fix full screen toggling for 3D games
The previous SdlGraphics3dManager::toggleFullScreen() was not using
beginGFXTransaction / endGFXTransaction in toggleFullScreen().
Restore this logic for 3D games, as using transactions in such games
results in a black screen for 3D games when switching to full screen

A regression from d33487f64
2021-09-29 20:24:03 +02:00
Thierry Crozat
feac996b50 SDL: Move code to handle cursor coordinate HiDPI scale to SdlWindow
SDL handles HiDPI scaling differently depending on the system. On
macOS for example the SDL window size and SDL drawable area have a
different size (factor 2 usually) while on Windows they are the
same. When HiDPI is disabled (for the SDL Surface mode for example)
they are always the same.

We need to appl this scaling when converting cursor position between
the drawable area and the SDL window.
2021-08-20 00:12:51 +01:00
Eugene Sandulenko
df1341ae6a
BACKENDS: Display OSD message on saved screenshots 2021-08-16 14:19:07 +02:00
Thierry Crozat
6fcfdb0514 SDL: Fix handling of cursor position on Windows HiDPI 2021-08-14 19:11:11 +01:00
Thierry Crozat
abf782c670 COMMON: Remove kFeatureHiDPI from OSystem and use getHiDPIScreenFactor instead 2021-08-13 21:41:33 +01:00
Thierry Crozat
23ca3604b8 SDL: Fix crash when switching to a 3D graphics manager
The OpenGLSdlGraphics3dManager::getSupportedFormats() implementation
returns an empty list. This caused a crash when trying to get the
first element of the list in SdlGraphicsManager::setState().

This fixes bug #12762: The longest Journey crashes
2021-07-26 23:18:17 +01:00
Cameron Cawley
ac9980a9dd SDL: Fix the default scale factor for high resolution games 2021-06-23 23:31:49 +01:00
Cameron Cawley
d33487f641 SDL: Refactor OpenGLSdlGraphics3dManager to inherit from SdlGraphicsManager 2021-04-17 20:32:27 +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
708caaa8fa BACKENDS: SDL: Do not scale mouse position for LoDPI modes 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
Cameron Cawley
21c1f0d007 SDL: Restore keyboard shortcuts for switching scalers 2021-03-15 16:48:40 +02:00
Thierry Crozat
5412533dec SDL: Fix trying to set unsupported pixel format when changing gfx mode
When switching between the SDL and OpenGL graphics managers, trying
to restore the state could fail as the two managers do not have the
same list of supported formats, so we may not be able to transfer
the pixel format from one to the other. This then resulted in an
assert.

This fixes bug #12079
2021-02-08 12:59:52 +00:00
Cameron Cawley
d968d22eb1
SDL: Refactor grabbing and locking the mouse (#2522) 2020-10-14 08:03:31 +02:00
Cameron Cawley
26cd7d44e2
SDL: Implement lockMouse() in the 2D graphics managers (#2517) 2020-10-13 21:31:10 +02: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
Cameron Cawley
5cb84a437d SDL: Clip the coordinates sent by mouse events 2020-09-27 00:32:01 +01:00
aryanrawlani28
a9bfe35216 GUI: U32: More issue fixes and general improvements
- Use the fake constructor for message dialog less often
- solve errors regarding comparision between string and u32string in midi
- solve errors in testbed/speech related to ttsMan->say
- fix unsigned comparision warning in tab.cpp
- fix issue with static strings and translations in sdl-graphics
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
SupSuper
fa615bc52f BACKENDS: Fix inconsistent usage of const modifier
Fixes warnings from mismatching method signatures between parent and child managers
2020-05-30 06:49:09 +01:00
Cameron Cawley
f8a883f2b1 SDL: Unify implementations of activateManager and deactivateManager 2020-05-10 12:02:44 +01:00
Cameron Cawley
205175c4e5 SDL: Don't allow switching to and from fullscreen if it isn't supported 2020-03-27 22:50:41 +01:00
Bastien Bouclet
d94c7c3bcc SDL: Move the keyboard mouse to a subclass of SdlEventSource
And deprecate it. The new Virtual Mouse system is expected to replace
it.
2020-03-09 20:00:31 +01:00
Bastien Bouclet
7daf2a4f5b SDL: Add back Alt+KP_ENTER as a shortcut for toggle fullscreen
Fixes #11341.
2020-02-04 08:22:02 +01:00
Bastien Bouclet
426867f4bc KEYMAPPER: Give human readable descriptions to the keymaps 2020-01-29 08:51:29 +01:00
Bastien Bouclet
13fbdb935a KEYMAPPER: Use custom backend actions for the SDL graphics keymap 2020-01-29 08:51:29 +01:00
Bastien Bouclet
be49fc4b9a SDL: Add a keymap for the graphics manager 2020-01-29 08:51:29 +01:00
Bastien Bouclet
0339b9a6bf SDL: Use the name of the running target as a base for screenshot files 2020-01-22 21:27:38 +02:00
sluicebox
b593fe2f45 SDL: Fix Windows screenshots with unicode paths
Use Common::FSNode to test for screenshot existence instead of
SDL_RWFromFile(). SDL does different character encoding conversions
which fail on Windows when a unicode character is in the path.

Fixes bug #11118
2019-11-10 07:08:22 +02:00
Cameron Cawley
177d709909 OPENGL: Implement high DPI support on Android (#1895)
* OPENGL: Implement high DPI support on Android

* PSP2: Fix build
2019-11-01 13:39:46 +02:00
Cameron Cawley
ea9e33bd10 GUI: Check if fullscreen is available at runtime 2019-08-18 06:21:28 +03:00
Cameron Cawley
e40cdea6ba
SDL: Use Common::KEYCODE_KP_ENTER instead of SDLK_KP_ENTER 2019-04-02 22:41:21 +01:00
Filippos Karapetis
769cf5492c SDL: Wrap the full screen toggle code into a separate function 2019-03-10 18:32:13 +02:00
Cameron Cawley
f426ba6c36 SDL: Move fullscreen and screenshot event handling to SdlGraphicsManager (#1522) 2019-03-10 18:25:25 +02:00
Bastien Bouclet
779b97ee3f SDL: Don't use the window size hint for fullscreen
Prevents the opengl backend from changing mode when entering fullscreen
for games with a window size hint.

Fixes #10335. Closes gh-1074.
2017-11-29 16:49:32 -06:00
Colin Snover
c278677d07 SDL: Store fake mouse warp event in virtual coordinates
Normally, notifyMousePosition converts real mouse events into the
virtual coordinate system, but events only get sent through
notifyMousePosition if they are real events from SDL since that
method also decides if the real mouse is inside the content area or
not. As such, these fake events need to be pre-converted to virtual
coordinates or else the wrong values are sent through to the engine
when a scaler or AR correction is in use.
2017-11-27 20:39:21 -06:00
Thierry Crozat
1d1f898c01 SDL: Preserve mouse position when switching between OpenGL and SurfaceSDL backends
Since those GraphcisManager initialize the cursor position to (0,0) when
created the cursor was jumping to the top left corner and then moving
back to its initial position as soon as the mouse was moved. Now it
stays at its initial position.

There are still some issues with it when changing between OpenGL and
SurfaceSDL at the same time as toggling fullscreen. But it is not worse
than before.
2017-11-11 00:15:13 +00:00
Colin Snover
8e8ec3900c SDL: Get correct default graphics mode ID when queried
Fixes Trac#10312.
2017-11-07 21:34:42 -06:00
Colin Snover
f6ab0e5c10 SDL: Allow window size to be reset whenever launcher is visible
This ensures the window gets resized properly when a user changes
the scaler options in the GUI. Simply unlocking the window size on
a call to setGraphicsMode is not good enough, because the scaler
mode can be changed by games during mode switches, and we don't
want to reset the window size in that case.
2017-10-15 13:24:21 -05:00
Colin Snover
d1b77d4b68 BACKENDS: Fix missing mouse events when system cursor cannot be moved
Normally with SDL, a mouse motion event will be sent after the
system mouse cursor has been moved by a call to
SDL_WarpMouseInWindow, but if the system cursor cannot be moved
(e.g. because the window does not have mouse focus), games still
need to receive these mouse events so they can successfully update
the mouse position internally. Otherwise, games continue to think
the mouse is still in the original position and will continue to
try to perform whatever action is associated with that mouse
position.

Refs Trac#9689.
2017-10-15 13:24:21 -05:00
Colin Snover
cd538ffffa BACKENDS: Do not send mouse events to games occurring outside the game draw rect 2017-10-15 13:24:21 -05:00
Colin Snover
da0a8db704 BACKENDS: Also hide mouse cursor outside game area when an engine has hidden the cursor
The only reason we show the system cursor outside the game area is
to show users where their mouse is when the window is resized and
the mouse is outside the game area. If the game cannot be
interacted with, then the mouse also does not need to be shown in
the black areas.
2017-10-15 13:24:20 -05:00