Age | Commit message (Collapse) | Author |
|
We don't change the icon that often but there's much more x11 colors than just black and gray20 that we may end up having in the XPM file
|
|
|
|
Folks are confused about the new behaviour where the mouse is not
restricted to the game area in fullscreen, which is understandable.
This changes mouseIsGrabbed to use SDL directly in order to avoid
making changes to the user preference in the _inputGrabState.
Otherwise we'd either clobber the user's previous windowed mouse
grab preference, or require maintaining a second variable just to
track the original state, when we can have SDL do that for us.
|
|
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.
|
|
This patch refactors the OpenGL and SDL graphics backends,
primarily to unify window scaling and mouse handling, and to
fix coordinate mapping between the ScummVM window and the
virtual game screen when they have different aspect ratios.
Unified code for these two backends has been moved to a new
header-only WindowedGraphicsManager class, so named because it
contains code for managing graphics managers that interact with
a windowing system and render virtual screens within a larger
physical content window.
The biggest behavioral change here is with the coordinate
system mapping:
Previously, mouse offsets were converted by mapping the whole
space within the window as input to the virtual game screen
without maintaining aspect ratio. This was done to prevent
'stickiness' when the mouse cursor was within the window but
outside of the virtual game screen, but it caused noticeable
distortion of mouse movement speed on the axis with blank
space.
Instead of introducing mouse speed distortion to prevent
stickiness, this patch changes coordinate transformation to
show the system cursor when the mouse moves outside of the virtual
game screen when mouse grab is off, or by holding the mouse inside
the virtual game screen (instead of the entire window) when mouse
grab is on.
This patch also improves some other properties of the
GraphicsManager/PaletteManager interfaces:
* Nullipotent operations (getWidth, getHeight, etc.) of the
PaletteManager/GraphicsManager interfaces are now const
* Methods marked `virtual` but not inherited by any subclass have
been de-virtualized
* Extra unnecessary calculations of hardware height in
SurfaceSdlGraphicsManager have been removed
* Methods have been renamed where appropriate for clarity
(setWindowSize -> handleResize, etc.)
* C++11 support improved with `override` specifier added on
overridden virtual methods in subclasses (primarily to avoid
myself accidentally creating new methods in the subclasses
by changing types/names during refactoring)
Additional refactoring can and should be done at some point to
continue to deduplicate code between the OpenGL and SDL backends.
Since the primary goal here was to improve the coordinate mapping,
full refactoring of these backends was not completed here.
|
|
This matches the other ScummVM and SDL APIs for mouse warp.
|
|
|
|
The call to SDL_SetWindowSize works around a macOS specific SDL2 bug.
Fixes the window not restoring to its previous position when exiting
fullscreen on Linux/X11.
|
|
When updating or recreating the window, if we changed the window
size at the same time we also toggle between OpenGL and non
OpenGL mode, or toggle fullscreen mode, we may have a pending
SDL resize event with the wrong size. So we need to make sure to
append another one with the correct size to end up with the correct
size. This fixes bug #9971.
|
|
|
|
Destroying and recreating the SDL window whenever the video mode
changes in SDL2 is not necessary and causes several problems:
1. In windowed mode, the game window shifts position;
2. In fullscreen mode in macOS, every time the window is
recreated, it causes the OS to play its switch-to-fullscreen
animation again and emit system alert noises;
3. The window content flickers; and
4. The engine loses events from the old destroyed window.
This patch changes the SDL backend code to avoid destroying and
recreating the SDL window when using SDL2, except when switching
OpenGL modes, since there is no way to change the OpenGL feature
of a window.
There are still some outstanding issues with OpenGL where window
size ends up getting reset even though the user has resized it;
this will probably need to be addressed at some point in another
patch.
Thanks to @bgK and @criezy for their feedback which made this
patch much better.
Co-Authored-By: Bastien Bouclet <bastien.bouclet@gmail.com>
|
|
|
|
This should make sure that the logo is properly set on Win32 with SDL2.
|
|
|
|
Based on changes by aquadran.
|
|
|
|
|