This adds a global event scope that an sdl_handler can register to in
order to receive all current events, regardless of the current
scope. Care should be taken to not be registerd in a local event
context and the global context at the same time as it will lead to the
event handler potentially being invoked twice.
This also adds the workaround needed for #24209 in the new event
handler in the video class.
This removes the usage of the display::get_singleton() in the event
handling code since it may cause incorrect behaviour (crash) when the
singleton has been incorrectly set to null.
This also removes SDL_PumpEvents() from grid.cpp the rendering code
should not be directly interacting with the event handling and it's
causing instabilities.
SDL2 uses shared memory to communicate with the graphics system when
using a software renderer. A resize event will cause SDL2 to
invalidate the SDL_surface that relies on shared memory and any
subsequent calls to will be SDL_GetWindowSurface will cause the shared
memory do be unmapped as the old surface is released. This is
problematic when it occurs during a rendering cycle, because the
software rendered may also invoke SDL_GetWindowSurface, making any
references to that surface that the game contains become stale. This
will in turn cause a segmentation fault during blitting.
This change makes sure that only references are used to the video
surface instead of a copy. This will help to avoid stale values after
a resize event has occured where it will cause a crash due to a stale
pointer.
Separated the dialog code from the resolution gathering code. This makes
it easier to port the code to SDL2.
This also changes the sorting of the resolutions, first width then
height instead of based on the area. Before a part of the list looked
like:
1280 x 720
1152 x 864
1280 x 960
1440 x 900
1282 x 1024
These now look like:
1152 x 864
1280 x 720
1280 x 960
1280 x 1024
1440 x 900
The new sorting makes more sense to me.
The goal is to replace all stikcy exceptions jail break exceptions and
make the exeption handling of Lua a bit more like normal C++ exception
handling.
Implemented sticky exceptions that can be rethrown at will.
Used them to ensure that quitting the game, loading a new game, and
leaving to title screen, work correctly when WML is being executed.