Compare commits

...

19 Commits

Author SHA1 Message Date
Sam Lantinga
f6864924f7 Updated to version 3.2.8 for release 2025-03-04 14:37:06 -08:00
Sam Lantinga
6b3dafa4d3 Fixed crash when restoring the desktop mode on macOS
Fixes https://github.com/libsdl-org/SDL/issues/12460

(cherry picked from commit 80ae3a7516)
2025-03-04 14:34:10 -08:00
Sam Lantinga
5c0c5d2816 Fixed crash unplugging a HIDAPI controller
(cherry picked from commit 5f07347e4f)
2025-03-04 11:42:37 -08:00
Sam Lantinga
de11dd3d60 Make SDL_RegisterEvents() thread-safe
Fixes https://github.com/libsdl-org/SDL/issues/12457

(cherry picked from commit 82552e5b7c)
2025-03-04 10:28:53 -08:00
Frank Praznik
ac09af2600 video: Synthesize fullscreen related moves if the driver does not.
(cherry picked from commit 9f9a442823)
2025-03-04 12:49:56 -05:00
Frank Praznik
26d1afa29c x11: Synthesize fullscreen size events on Openbox
Openbox doesn't send size events when entering fullscreen, so they must be synthesized. This is not desirable on any other window manager, as it can break fullscreen positioning on multi-monitor configurations.

(cherry picked from commit e7abbf158a)
2025-03-04 12:49:56 -05:00
Volian0
6aab3b9da8 Fix for Message Box failing to init on X11 (#12455)
Fixed X11 message boxes failing to initialize, because the proper X Logical Font Description could not be found

(cherry picked from commit debbe1cf75)
2025-03-04 08:34:58 -08:00
Sam Lantinga
d959719a3d Fixed clip rect when logical presentation is enabled
We don't need to include the logical offset, it's already included in the viewport.

Fixes https://github.com/libsdl-org/SDL/issues/12454

(cherry picked from commit 4bb46e93c8)
2025-03-04 08:25:46 -08:00
Sam Lantinga
5a7b17fec5 Added fullscreen_active to better track fullscreen state
This is true if fullscreen is pending or currently active. This is a better check in SDL_SetDesktopDisplayMode() because a fullscreen mode may be pending and complete asynchronously and the window hasn't been set to fullscreen yet.

(cherry picked from commit 7c29c8b266)
2025-03-03 21:19:15 -08:00
Frank Praznik
1d6bb62870 Use _this pointer to reference the video device
(cherry picked from commit 3b9f0dff10)
2025-03-03 19:01:40 -05:00
Frank Praznik
0c3603d893 Check the display device before dereferencing
It can be null if the desktop mode is set early during initial display enumeration.

(cherry picked from commit 0ccf272eea)
2025-03-03 11:25:25 -05:00
Frank Praznik
38a5bca892 video: Handle Cocoa desktop mode switch inhibition in the video layer
The X backend had the same issue, so both Cocoa and X can be handled in the same location.

(cherry picked from commit 6c347cbf33)
2025-03-03 11:05:32 -05:00
Sam Lantinga
70a289076a Don't save temporary mode changes to the desktop mode
Fixes https://github.com/libsdl-org/SDL/issues/12441

(cherry picked from commit 24ec2ed785)
2025-03-03 11:05:20 -05:00
Simon McVittie
1d0ecf982f pipewire: Don't require pw_check_library_version() with Pipewire < 0.3.75
The Debian 12 'bookworm' stable release only has 0.3.65, which is earlier
than the introduction of that symbol. Similarly, Steam Runtime 3 'sniper'
and Steam Runtime 2 'soldier' have a backport of 0.3.65 from Debian 12,
so they have the same limitation.

steamrt/tasks#686

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit d57aa6f7af)
2025-03-03 07:32:51 -08:00
Sam Lantinga
18d93d11e1 Only use VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR on Android
This fixes Nintendo Switch where the identity bit isn't available. We only needed this on Android to automatically handle device user orientation.

(cherry picked from commit 2c7c3d4d7b)
2025-03-02 09:14:12 -08:00
Sam Lantinga
110a832f5c Save and restore error messages when rolling back after failed init
Fixes https://github.com/libsdl-org/SDL/issues/12439

(cherry picked from commit 1a7c206986)
2025-03-02 07:57:36 -08:00
Frank Praznik
6a9e970880 cocoa: Don't overwrite the desktop mode when changing the fullscreen mode
Changing the mode triggers a display reconfiguration event, which will overwrite the desktop mode with the set fullscreen mode, preventing proper restoration when leaving fullscreen. Don't overwrite the desktop mode if the reconfiguration is due to a fullscreen mode switch.

(cherry picked from commit b69201daeb)
2025-03-01 23:43:29 -05:00
Frank Praznik
4e3058ce82 cocoa: Run pending events to completion
Fullscreen spaces and miniaturization will always give us some notification that they succeeded or failed, so the timeout isn't required. This prevents errant timeouts when live-resize is active.

(cherry picked from commit 078d737a27)
2025-03-01 19:34:00 -08:00
Sam Lantinga
bc6307a872 Updated to version 3.2.7 for development 2025-03-01 19:29:51 -08:00
21 changed files with 138 additions and 55 deletions

View File

@@ -5,7 +5,7 @@ if(NOT DEFINED CMAKE_BUILD_TYPE)
endif()
# See docs/release_checklist.md
project(SDL3 LANGUAGES C VERSION "3.2.6")
project(SDL3 LANGUAGES C VERSION "3.2.8")
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(SDL3_MAINPROJECT ON)

View File

@@ -19,10 +19,10 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.2.6</string>
<string>3.2.8</string>
<key>CFBundleSignature</key>
<string>SDLX</string>
<key>CFBundleVersion</key>
<string>3.2.6</string>
<string>3.2.8</string>
</dict>
</plist>

View File

@@ -3086,7 +3086,7 @@
CLANG_ENABLE_OBJC_ARC = YES;
DEPLOYMENT_POSTPROCESSING = YES;
DYLIB_COMPATIBILITY_VERSION = 201.0.0;
DYLIB_CURRENT_VERSION = 201.6.0;
DYLIB_CURRENT_VERSION = 201.8.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_ALTIVEC_EXTENSIONS = YES;
@@ -3121,7 +3121,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 3.2.6;
MARKETING_VERSION = 3.2.8;
OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3;
PRODUCT_NAME = SDL3;
@@ -3150,7 +3150,7 @@
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
DYLIB_COMPATIBILITY_VERSION = 201.0.0;
DYLIB_CURRENT_VERSION = 201.6.0;
DYLIB_CURRENT_VERSION = 201.8.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@@ -3182,7 +3182,7 @@
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 3.2.6;
MARKETING_VERSION = 3.2.8;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3;

View File

@@ -1,4 +1,4 @@
Title SDL 3.2.6
Title SDL 3.2.8
Version 1
Description SDL Library for macOS (http://www.libsdl.org)
DefaultLocation /Library/Frameworks

View File

@@ -60,7 +60,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 3;
private static final int SDL_MINOR_VERSION = 2;
private static final int SDL_MICRO_VERSION = 6;
private static final int SDL_MICRO_VERSION = 8;
/*
// Display InputType.SOURCE/CLASS of events and devices
//

View File

@@ -20,7 +20,7 @@
*/
/**
* Main include header for the SDL library, version 3.2.6
* Main include header for the SDL library, version 3.2.8
*
* It is almost always best to include just this one header instead of
* picking out individual headers included here. There are exceptions to

View File

@@ -62,7 +62,7 @@ extern "C" {
*
* \since This macro is available since SDL 3.2.0.
*/
#define SDL_MICRO_VERSION 6
#define SDL_MICRO_VERSION 8
/**
* This macro turns the version numbers into a numeric value.

View File

@@ -356,7 +356,9 @@ bool SDL_InitSubSystem(SDL_InitFlags flags)
SDL_IncrementSubsystemRefCount(SDL_INIT_VIDEO);
if (!SDL_VideoInit(NULL)) {
SDL_DecrementSubsystemRefCount(SDL_INIT_VIDEO);
SDL_PushError();
SDL_QuitSubSystem(SDL_INIT_EVENTS);
SDL_PopError();
goto quit_and_error;
}
} else {
@@ -381,7 +383,9 @@ bool SDL_InitSubSystem(SDL_InitFlags flags)
SDL_IncrementSubsystemRefCount(SDL_INIT_AUDIO);
if (!SDL_InitAudio(NULL)) {
SDL_DecrementSubsystemRefCount(SDL_INIT_AUDIO);
SDL_PushError();
SDL_QuitSubSystem(SDL_INIT_EVENTS);
SDL_PopError();
goto quit_and_error;
}
} else {
@@ -406,7 +410,9 @@ bool SDL_InitSubSystem(SDL_InitFlags flags)
SDL_IncrementSubsystemRefCount(SDL_INIT_JOYSTICK);
if (!SDL_InitJoysticks()) {
SDL_DecrementSubsystemRefCount(SDL_INIT_JOYSTICK);
SDL_PushError();
SDL_QuitSubSystem(SDL_INIT_EVENTS);
SDL_PopError();
goto quit_and_error;
}
} else {
@@ -430,7 +436,9 @@ bool SDL_InitSubSystem(SDL_InitFlags flags)
SDL_IncrementSubsystemRefCount(SDL_INIT_GAMEPAD);
if (!SDL_InitGamepads()) {
SDL_DecrementSubsystemRefCount(SDL_INIT_GAMEPAD);
SDL_PushError();
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
SDL_PopError();
goto quit_and_error;
}
} else {
@@ -493,7 +501,9 @@ bool SDL_InitSubSystem(SDL_InitFlags flags)
SDL_IncrementSubsystemRefCount(SDL_INIT_CAMERA);
if (!SDL_CameraInit(NULL)) {
SDL_DecrementSubsystemRefCount(SDL_INIT_CAMERA);
SDL_PushError();
SDL_QuitSubSystem(SDL_INIT_EVENTS);
SDL_PopError();
goto quit_and_error;
}
} else {
@@ -511,7 +521,11 @@ bool SDL_InitSubSystem(SDL_InitFlags flags)
return SDL_ClearError();
quit_and_error:
{
SDL_PushError();
SDL_QuitSubSystem(flags_initialized);
SDL_PopError();
}
return false;
}

View File

@@ -46,4 +46,16 @@ typedef struct SDL_error
// Defined in SDL_thread.c
extern SDL_error *SDL_GetErrBuf(bool create);
// Macros to save and restore error values
#define SDL_PushError() \
char *saved_error = SDL_strdup(SDL_GetError())
#define SDL_PopError() \
do { \
if (saved_error) { \
SDL_SetError("%s", saved_error); \
SDL_free(saved_error); \
} \
} while (0)
#endif // SDL_error_c_h_

View File

@@ -58,7 +58,9 @@ static bool pipewire_initialized = false;
// Pipewire entry points
static const char *(*PIPEWIRE_pw_get_library_version)(void);
#if PW_CHECK_VERSION(0, 3, 75)
static bool (*PIPEWIRE_pw_check_library_version)(int major, int minor, int micro);
#endif
static void (*PIPEWIRE_pw_init)(int *, char ***);
static void (*PIPEWIRE_pw_deinit)(void);
static struct pw_main_loop *(*PIPEWIRE_pw_main_loop_new)(const struct spa_dict *loop);
@@ -151,7 +153,9 @@ static void unload_pipewire_library(void)
static bool load_pipewire_syms(void)
{
SDL_PIPEWIRE_SYM(pw_get_library_version);
#if PW_CHECK_VERSION(0, 3, 75)
SDL_PIPEWIRE_SYM(pw_check_library_version);
#endif
SDL_PIPEWIRE_SYM(pw_init);
SDL_PIPEWIRE_SYM(pw_deinit);
SDL_PIPEWIRE_SYM(pw_main_loop_new);
@@ -1024,7 +1028,11 @@ static bool hotplug_loop_init(void)
spa_list_init(&hotplug.global_list);
#if PW_CHECK_VERSION(0, 3, 75)
hotplug.have_1_0_5 = PIPEWIRE_pw_check_library_version(1,0,5);
#else
hotplug.have_1_0_5 = false;
#endif
hotplug.loop = PIPEWIRE_pw_thread_loop_new("SDLPwCameraPlug", NULL);
if (!hotplug.loop) {

View File

@@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,2,6,0
PRODUCTVERSION 3,2,6,0
FILEVERSION 3,2,8,0
PRODUCTVERSION 3,2,8,0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x40004L
@@ -23,12 +23,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "SDL\0"
VALUE "FileVersion", "3, 2, 6, 0\0"
VALUE "FileVersion", "3, 2, 8, 0\0"
VALUE "InternalName", "SDL\0"
VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0"
VALUE "OriginalFilename", "SDL3.dll\0"
VALUE "ProductName", "Simple DirectMedia Layer\0"
VALUE "ProductVersion", "3, 2, 6, 0\0"
VALUE "ProductVersion", "3, 2, 8, 0\0"
END
END
BLOCK "VarFileInfo"

View File

@@ -110,7 +110,7 @@ typedef struct
} SDL_DisabledEventBlock;
static SDL_DisabledEventBlock *SDL_disabled_events[256];
static Uint32 SDL_userevents = SDL_EVENT_USER;
static SDL_AtomicInt SDL_userevents;
typedef struct SDL_TemporaryMemory
{
@@ -1893,9 +1893,11 @@ Uint32 SDL_RegisterEvents(int numevents)
{
Uint32 event_base = 0;
if ((numevents > 0) && (SDL_userevents + numevents <= SDL_EVENT_LAST)) {
event_base = SDL_userevents;
SDL_userevents += numevents;
if (numevents > 0) {
int value = SDL_AddAtomicInt(&SDL_userevents, numevents);
if (value >= 0 && value <= (SDL_EVENT_LAST - SDL_EVENT_USER)) {
event_base = (Uint32)(SDL_EVENT_USER + value);
}
}
return event_base;
}

View File

@@ -4634,7 +4634,11 @@ static Uint32 VULKAN_INTERNAL_CreateSwapchain(
swapchainCreateInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
swapchainCreateInfo.queueFamilyIndexCount = 0;
swapchainCreateInfo.pQueueFamilyIndices = NULL;
#ifdef SDL_PLATFORM_ANDROID
swapchainCreateInfo.preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
#else
swapchainCreateInfo.preTransform = swapchainSupportDetails.capabilities.currentTransform;
#endif
swapchainCreateInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
swapchainCreateInfo.presentMode = SDLToVK_PresentMode[windowData->presentMode];
swapchainCreateInfo.clipped = VK_TRUE;

View File

@@ -1135,12 +1135,13 @@ check_removed:
goto check_removed;
} else {
HIDAPI_DelDevice(device);
device = NULL;
// Update the device list again in case this device comes back
SDL_HIDAPI_change_count = 0;
}
}
if (device->broken && device->parent) {
if (device && device->broken && device->parent) {
HIDAPI_DelDevice(device->parent);
// We deleted a different device here, restart the loop

View File

@@ -462,8 +462,8 @@ static void UpdatePixelClipRect(SDL_Renderer *renderer, SDL_RenderViewState *vie
{
const float scale_x = view->current_scale.x;
const float scale_y = view->current_scale.y;
view->pixel_clip_rect.x = (int)SDL_floorf((view->clip_rect.x * scale_x) + view->logical_offset.x);
view->pixel_clip_rect.y = (int)SDL_floorf((view->clip_rect.y * scale_y) + view->logical_offset.y);
view->pixel_clip_rect.x = (int)SDL_floorf(view->clip_rect.x * scale_x);
view->pixel_clip_rect.y = (int)SDL_floorf(view->clip_rect.y * scale_y);
view->pixel_clip_rect.w = (int)SDL_ceilf(view->clip_rect.w * scale_x);
view->pixel_clip_rect.h = (int)SDL_ceilf(view->clip_rect.h * scale_y);
}

View File

@@ -163,6 +163,8 @@ struct SDL_VideoDisplay
float content_scale;
SDL_HDROutputProperties HDR;
// This is true if we are fullscreen or fullscreen is pending
bool fullscreen_active;
SDL_Window *fullscreen_window;
SDL_VideoDevice *device;

View File

@@ -1435,6 +1435,11 @@ void SDL_SetDesktopDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode
{
SDL_DisplayMode last_mode;
if (display->fullscreen_active) {
// This is a temporary mode change, don't save the desktop mode
return;
}
SDL_copyp(&last_mode, &display->desktop_mode);
if (display->desktop_mode.internal) {
@@ -1944,6 +1949,8 @@ bool SDL_UpdateFullscreenMode(SDL_Window *window, SDL_FullscreenOp fullscreen, b
SDL_MinimizeWindow(display->fullscreen_window);
}
display->fullscreen_active = window->fullscreen_exclusive;
if (!SDL_SetDisplayModeForDisplay(display, mode)) {
goto error;
}
@@ -1961,6 +1968,7 @@ bool SDL_UpdateFullscreenMode(SDL_Window *window, SDL_FullscreenOp fullscreen, b
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_ENTER_FULLSCREEN, 0, 0);
}
} else if (ret == SDL_FULLSCREEN_FAILED) {
display->fullscreen_active = false;
goto error;
}
}
@@ -1976,18 +1984,24 @@ bool SDL_UpdateFullscreenMode(SDL_Window *window, SDL_FullscreenOp fullscreen, b
* This is also unnecessary on Cocoa, Wayland, Win32, and X11 (will send SDL_EVENT_WINDOW_RESIZED).
*/
if (!SDL_SendsFullscreenDimensions(_this)) {
SDL_Rect displayRect;
if (mode) {
mode_w = mode->w;
mode_h = mode->h;
SDL_GetDisplayBounds(mode->displayID, &displayRect);
} else {
mode_w = display->desktop_mode.w;
mode_h = display->desktop_mode.h;
SDL_GetDisplayBounds(display->id, &displayRect);
}
if (window->w != mode_w || window->h != mode_h) {
resized = true;
}
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MOVED, displayRect.x, displayRect.y);
if (resized) {
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, mode_w, mode_h);
} else {
@@ -2005,6 +2019,8 @@ bool SDL_UpdateFullscreenMode(SDL_Window *window, SDL_FullscreenOp fullscreen, b
// Restore the desktop mode
if (display) {
display->fullscreen_active = false;
SDL_SetDisplayModeForDisplay(display, NULL);
}
if (commit) {
@@ -2034,6 +2050,7 @@ bool SDL_UpdateFullscreenMode(SDL_Window *window, SDL_FullscreenOp fullscreen, b
}
if (!SDL_SendsFullscreenDimensions(_this)) {
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MOVED, window->windowed.x, window->windowed.y);
if (resized) {
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, window->windowed.w, window->windowed.h);
} else {

View File

@@ -644,7 +644,9 @@ static CGError SetDisplayModeForDisplay(CGDirectDisplayID display, SDL_DisplayMo
result = CGDisplaySetDisplayMode(display, moderef, NULL);
if (result == kCGErrorSuccess) {
// If this mode works, try it first next time.
if (i > 0) {
CFArrayExchangeValuesAtIndices(data->modes, i, 0);
}
break;
}
}

View File

@@ -915,7 +915,8 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
- (BOOL)hasPendingWindowOperation
{
return pendingWindowOperation != PENDING_OPERATION_NONE ||
// A pending zoom may be deferred until leaving fullscreen, so don't block on it.
return (pendingWindowOperation & ~PENDING_OPERATION_ZOOM) != PENDING_OPERATION_NONE ||
isMiniaturizing || inFullscreenTransition;
}
@@ -3263,24 +3264,11 @@ bool Cocoa_SyncWindow(SDL_VideoDevice *_this, SDL_Window *window)
bool result = true;
@autoreleasepool {
/* The timeout needs to be high enough that animated fullscreen
* spaces transitions won't cause it to time out.
*/
Uint64 timeout = SDL_GetTicksNS() + SDL_MS_TO_NS(2000);
SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
while (true) {
do {
SDL_PumpEvents();
if (SDL_GetTicksNS() >= timeout) {
result = false;
break;
}
if (![data.listener hasPendingWindowOperation]) {
break;
}
SDL_Delay(10);
}
} while ([data.listener hasPendingWindowOperation]);
}
return result;

View File

@@ -48,13 +48,17 @@
static const char g_MessageBoxFontLatin1[] =
"-*-*-medium-r-normal--0-120-*-*-p-0-iso8859-1";
static const char g_MessageBoxFont[] =
"-*-*-medium-r-normal--*-120-*-*-*-*-iso10646-1," // explicitly unicode (iso10646-1)
"-*-*-medium-r-*--*-120-*-*-*-*-iso10646-1," // explicitly unicode (iso10646-1)
"-*-*-*-*-*--*-*-*-*-*-*-iso10646-1," // just give me anything Unicode.
"-*-*-medium-r-normal--*-120-*-*-*-*-iso8859-1," // explicitly latin1, in case low-ASCII works out.
"-*-*-medium-r-*--*-120-*-*-*-*-iso8859-1," // explicitly latin1, in case low-ASCII works out.
"-*-*-*-*-*--*-*-*-*-*-*-iso8859-1"; // just give me anything latin1.
static const char* g_MessageBoxFont[] = {
"-*-*-medium-r-normal--*-120-*-*-*-*-iso10646-1", // explicitly unicode (iso10646-1)
"-*-*-medium-r-*--*-120-*-*-*-*-iso10646-1", // explicitly unicode (iso10646-1)
"-misc-*-*-*-*--*-*-*-*-*-*-iso10646-1", // misc unicode (fix for some systems)
"-*-*-*-*-*--*-*-*-*-*-*-iso10646-1", // just give me anything Unicode.
"-*-*-medium-r-normal--*-120-*-*-*-*-iso8859-1", // explicitly latin1, in case low-ASCII works out.
"-*-*-medium-r-*--*-120-*-*-*-*-iso8859-1", // explicitly latin1, in case low-ASCII works out.
"-misc-*-*-*-*--*-*-*-*-*-*-iso8859-1", // misc latin1 (fix for some systems)
"-*-*-*-*-*--*-*-*-*-*-*-iso8859-1", // just give me anything latin1.
NULL
};
static const SDL_MessageBoxColor g_default_colors[SDL_MESSAGEBOX_COLOR_COUNT] = {
{ 56, 54, 53 }, // SDL_MESSAGEBOX_COLOR_BACKGROUND,
@@ -200,13 +204,19 @@ static bool X11_MessageBoxInit(SDL_MessageBoxDataX11 *data, const SDL_MessageBox
if (SDL_X11_HAVE_UTF8) {
char **missing = NULL;
int num_missing = 0;
data->font_set = X11_XCreateFontSet(data->display, g_MessageBoxFont,
int i_font;
for (i_font = 0; g_MessageBoxFont[i_font]; ++i_font) {
data->font_set = X11_XCreateFontSet(data->display, g_MessageBoxFont[i_font],
&missing, &num_missing, NULL);
if (missing) {
X11_XFreeStringList(missing);
}
if (data->font_set) {
break;
}
}
if (!data->font_set) {
return SDL_SetError("Couldn't load font %s", g_MessageBoxFont);
return SDL_SetError("Couldn't load x11 message box font");
}
} else
#endif

View File

@@ -78,6 +78,23 @@ static bool X11_IsXWayland(Display *d)
return X11_XQueryExtension(d, "XWAYLAND", &opcode, &event, &error) == True;
}
static bool X11_CheckCurrentDesktop(const char *name)
{
SDL_Environment *env = SDL_GetEnvironment();
const char *desktopVar = SDL_GetEnvironmentVariable(env, "DESKTOP_SESSION");
if (desktopVar && SDL_strcasecmp(desktopVar, name) == 0) {
return true;
}
desktopVar = SDL_GetEnvironmentVariable(env, "XDG_CURRENT_DESKTOP");
if (desktopVar && SDL_strcasestr(desktopVar, name)) {
return true;
}
return false;
}
static SDL_VideoDevice *X11_CreateDevice(void)
{
SDL_VideoDevice *device;
@@ -256,8 +273,14 @@ static SDL_VideoDevice *X11_CreateDevice(void)
device->system_theme = SDL_SystemTheme_Get();
#endif
device->device_caps = VIDEO_DEVICE_CAPS_HAS_POPUP_WINDOW_SUPPORT |
VIDEO_DEVICE_CAPS_SENDS_FULLSCREEN_DIMENSIONS;
device->device_caps = VIDEO_DEVICE_CAPS_HAS_POPUP_WINDOW_SUPPORT;
/* Openbox doesn't send the new window dimensions when entering fullscreen, so the events must be synthesized.
* This is otherwise not wanted, as it can break fullscreen window positioning on multi-monitor configurations.
*/
if (!X11_CheckCurrentDesktop("openbox")) {
device->device_caps |= VIDEO_DEVICE_CAPS_SENDS_DISPLAY_CHANGES;
}
data->is_xwayland = X11_IsXWayland(x11_display);
if (data->is_xwayland) {