mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
Fixed crash when creating a dummy window on Mac OS X
This commit is contained in:
parent
d6bcec8f6a
commit
cb5a0b0f6a
@ -1164,35 +1164,38 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
|
|||||||
CHECK_WINDOW_MAGIC(window,-1);
|
CHECK_WINDOW_MAGIC(window,-1);
|
||||||
|
|
||||||
/* if we are in the process of hiding don't go back to fullscreen */
|
/* if we are in the process of hiding don't go back to fullscreen */
|
||||||
if ( window->is_hiding && fullscreen )
|
if (window->is_hiding && fullscreen) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __MACOSX__
|
#ifdef __MACOSX__
|
||||||
/* if the window is going away and no resolution change is necessary,
|
/* if the window is going away and no resolution change is necessary,
|
||||||
do nothing, or else we may trigger an ugly double-transition
|
do nothing, or else we may trigger an ugly double-transition
|
||||||
*/
|
*/
|
||||||
if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)
|
if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */
|
if (SDL_strcmp(_this->name, "dummy") != 0) {
|
||||||
if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) {
|
/* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */
|
||||||
if (!Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE)) {
|
if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) {
|
||||||
return -1;
|
if (!Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} else if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)) {
|
||||||
|
display = SDL_GetDisplayForWindow(window);
|
||||||
|
SDL_SetDisplayModeForDisplay(display, NULL);
|
||||||
|
if (_this->SetWindowFullscreen) {
|
||||||
|
_this->SetWindowFullscreen(_this, window, display, SDL_FALSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)) {
|
|
||||||
display = SDL_GetDisplayForWindow(window);
|
|
||||||
SDL_SetDisplayModeForDisplay(display, NULL);
|
|
||||||
if (_this->SetWindowFullscreen) {
|
|
||||||
_this->SetWindowFullscreen(_this, window, display, SDL_FALSE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) {
|
if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) {
|
||||||
if (Cocoa_IsWindowInFullscreenSpace(window) != fullscreen) {
|
if (Cocoa_IsWindowInFullscreenSpace(window) != fullscreen) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
window->last_fullscreen_flags = window->flags;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
window->last_fullscreen_flags = window->flags;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
#elif __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10)
|
#elif __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10)
|
||||||
/* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen
|
/* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen
|
||||||
@ -1345,7 +1348,7 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (((flags & SDL_WINDOW_UTILITY) != 0) + ((flags & SDL_WINDOW_TOOLTIP) != 0) + ((flags & SDL_WINDOW_POPUP_MENU) != 0)) > 1 ) {
|
if ((((flags & SDL_WINDOW_UTILITY) != 0) + ((flags & SDL_WINDOW_TOOLTIP) != 0) + ((flags & SDL_WINDOW_POPUP_MENU) != 0)) > 1) {
|
||||||
SDL_SetError("Conflicting window flags specified");
|
SDL_SetError("Conflicting window flags specified");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -3790,7 +3793,7 @@ SDL_SetWindowHitTest(SDL_Window * window, SDL_HitTest callback, void *userdata)
|
|||||||
float SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches)
|
float SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches)
|
||||||
{
|
{
|
||||||
float den2 = hinches * hinches + vinches * vinches;
|
float den2 = hinches * hinches + vinches * vinches;
|
||||||
if ( den2 <= 0.0f ) {
|
if (den2 <= 0.0f) {
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user