mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-25 22:10:59 +00:00
Fix window flag handling with SDL3.
These are two problems breaking the window flags for renderers which don't use OpenGL or enforce their own flags: * In SDL 3 the window flags were increased from 32 bit to 64 bit. SDL 3.1.3 introduced a new type SDL_WindowFlags for them. Use it to represent the window flags. This is currently a noop, becaue SDL 3 doesn't have any flags above 32 bit yet. This might require another breakage of the renderer API in the future, because currently renderers pass a 32 bit flags thing to the client. * `SDL_SetNumberProperty()` got a new type `SDL_PROP_WINDOW_CREATE_FLAGS_NUMBER` to represent the flags. It must be used, otherwise strange things happen. Closes #1156.
This commit is contained in:
parent
c719a18d54
commit
b74d1a5247
1 changed files with 5 additions and 8 deletions
|
@ -99,7 +99,7 @@ ClearDisplayIndices(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static qboolean
|
static qboolean
|
||||||
CreateSDLWindow(int flags, int fullscreen, int w, int h)
|
CreateSDLWindow(SDL_WindowFlags flags, int fullscreen, int w, int h)
|
||||||
{
|
{
|
||||||
if (SDL_WINDOWPOS_ISUNDEFINED(last_position_x) || SDL_WINDOWPOS_ISUNDEFINED(last_position_y) || last_position_x < 0 ||last_position_y < 24)
|
if (SDL_WINDOWPOS_ISUNDEFINED(last_position_x) || SDL_WINDOWPOS_ISUNDEFINED(last_position_y) || last_position_x < 0 ||last_position_y < 24)
|
||||||
{
|
{
|
||||||
|
@ -121,10 +121,7 @@ CreateSDLWindow(int flags, int fullscreen, int w, int h)
|
||||||
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_Y_NUMBER, last_position_y);
|
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_Y_NUMBER, last_position_y);
|
||||||
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, w);
|
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, w);
|
||||||
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER, h);
|
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER, h);
|
||||||
SDL_SetNumberProperty(props, "flags", flags);
|
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_FLAGS_NUMBER, flags);
|
||||||
|
|
||||||
if (flags & SDL_WINDOW_OPENGL)
|
|
||||||
SDL_SetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN, true);
|
|
||||||
|
|
||||||
window = SDL_CreateWindowWithProperties(props);
|
window = SDL_CreateWindowWithProperties(props);
|
||||||
SDL_DestroyProperties(props);
|
SDL_DestroyProperties(props);
|
||||||
|
@ -457,7 +454,7 @@ GLimp_Shutdown(void)
|
||||||
* compositor might scale us.
|
* compositor might scale us.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
Glimp_DetermineHighDPISupport(int flags)
|
Glimp_DetermineHighDPISupport(SDL_WindowFlags flags)
|
||||||
{
|
{
|
||||||
/* Make sure that high dpi is never set when we don't want it. */
|
/* Make sure that high dpi is never set when we don't want it. */
|
||||||
flags &= ~SDL_WINDOW_HIGH_PIXEL_DENSITY;
|
flags &= ~SDL_WINDOW_HIGH_PIXEL_DENSITY;
|
||||||
|
@ -484,11 +481,11 @@ Glimp_DetermineHighDPISupport(int flags)
|
||||||
qboolean
|
qboolean
|
||||||
GLimp_InitGraphics(int fullscreen, int *pwidth, int *pheight)
|
GLimp_InitGraphics(int fullscreen, int *pwidth, int *pheight)
|
||||||
{
|
{
|
||||||
int flags;
|
SDL_WindowFlags flags;
|
||||||
|
SDL_WindowFlags fs_flag = 0;
|
||||||
int curWidth, curHeight;
|
int curWidth, curHeight;
|
||||||
int width = *pwidth;
|
int width = *pwidth;
|
||||||
int height = *pheight;
|
int height = *pheight;
|
||||||
unsigned int fs_flag = 0;
|
|
||||||
|
|
||||||
if (fullscreen == FULLSCREEN_EXCLUSIVE || fullscreen == FULLSCREEN_DESKTOP)
|
if (fullscreen == FULLSCREEN_EXCLUSIVE || fullscreen == FULLSCREEN_DESKTOP)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue