mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 15:14:35 +00:00
update sdl2 to 2.32.10
This commit is contained in:
parent
a181f488b2
commit
4823dee76e
44 changed files with 439 additions and 182 deletions
|
|
@ -355,8 +355,7 @@ struct SDL_VideoDevice
|
|||
SDL_bool checked_texture_framebuffer;
|
||||
SDL_bool is_dummy;
|
||||
SDL_bool suspend_screensaver;
|
||||
SDL_Window *wakeup_window;
|
||||
SDL_mutex *wakeup_lock; /* Initialized only if WaitEventTimeout/SendWakeupEvent are supported */
|
||||
void *wakeup_window;
|
||||
int num_displays;
|
||||
SDL_VideoDisplay *displays;
|
||||
SDL_Window *windows;
|
||||
|
|
|
|||
|
|
@ -3368,9 +3368,7 @@ void SDL_DestroyWindow(SDL_Window *window)
|
|||
_this->current_glwin = NULL;
|
||||
}
|
||||
|
||||
if (_this->wakeup_window == window) {
|
||||
_this->wakeup_window = NULL;
|
||||
}
|
||||
SDL_AtomicCASPtr(&_this->wakeup_window, window, NULL);
|
||||
|
||||
/* Now invalidate magic */
|
||||
window->magic = NULL;
|
||||
|
|
|
|||
|
|
@ -287,9 +287,19 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent)
|
|||
/* The menu bar of SDL apps which don't have the typical .app bundle
|
||||
* structure fails to work the first time a window is created (until it's
|
||||
* de-focused and re-focused), if this call is in Cocoa_RegisterApp instead
|
||||
* of here. https://bugzilla.libsdl.org/show_bug.cgi?id=3051
|
||||
* of here. https://github.com/libsdl-org/SDL/issues/1913
|
||||
*/
|
||||
if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) {
|
||||
|
||||
/* this apparently became unnecessary on macOS 14.0, and will addition pop up a
|
||||
hidden dock if you're moving the mouse during launch, so change the default
|
||||
behaviour there. https://github.com/libsdl-org/SDL/issues/10340
|
||||
(13.6 still needs it, presumably 13.7 does, too.) */
|
||||
SDL_bool background_app_default = SDL_FALSE;
|
||||
if (@available(macOS 14.0, *)) {
|
||||
background_app_default = SDL_TRUE; /* by default, don't explicitly activate the dock and then us again to force to foreground */
|
||||
}
|
||||
|
||||
if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, background_app_default)) {
|
||||
/* Get more aggressive for Catalina: activate the Dock first so we definitely reset all activation state. */
|
||||
for (NSRunningApplication *i in [NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.dock"]) {
|
||||
[i activateWithOptions:NSApplicationActivateIgnoringOtherApps];
|
||||
|
|
|
|||
|
|
@ -48,9 +48,6 @@ static void Cocoa_VideoQuit(_THIS);
|
|||
static void Cocoa_DeleteDevice(SDL_VideoDevice * device)
|
||||
{ @autoreleasepool
|
||||
{
|
||||
if (device->wakeup_lock) {
|
||||
SDL_DestroyMutex(device->wakeup_lock);
|
||||
}
|
||||
CFBridgingRelease(device->driverdata);
|
||||
SDL_free(device);
|
||||
}}
|
||||
|
|
@ -76,7 +73,6 @@ static SDL_VideoDevice *Cocoa_CreateDevice(void)
|
|||
return NULL;
|
||||
}
|
||||
device->driverdata = (void *)CFBridgingRetain(data);
|
||||
device->wakeup_lock = SDL_CreateMutex();
|
||||
|
||||
/* Set the function pointers */
|
||||
device->VideoInit = Cocoa_VideoInit;
|
||||
|
|
|
|||
|
|
@ -855,6 +855,11 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
|
|||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, x, y);
|
||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h);
|
||||
|
||||
/* The OS can resize the window automatically if the display density
|
||||
changes while the window is miniaturized or hidden */
|
||||
if (![nswindow isVisible])
|
||||
return;
|
||||
|
||||
/* isZoomed always returns true if the window is not resizable */
|
||||
if ((window->flags & SDL_WINDOW_RESIZABLE) && [nswindow isZoomed]) {
|
||||
zoomed = YES;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect
|
|||
if (!Module['SDL2']) Module['SDL2'] = {};
|
||||
var SDL2 = Module['SDL2'];
|
||||
if (SDL2.ctxCanvas !== Module['canvas']) {
|
||||
SDL2.ctx = Module['createContext'](Module['canvas'], false, true);
|
||||
SDL2.ctx = Browser.createContext(Module['canvas'], false, true);
|
||||
SDL2.ctxCanvas = Module['canvas'];
|
||||
}
|
||||
if (SDL2.w !== w || SDL2.h !== h || SDL2.imageCtx !== SDL2.ctx) {
|
||||
|
|
|
|||
|
|
@ -40,6 +40,48 @@
|
|||
*/
|
||||
#define PIPE_MS_TIMEOUT 14
|
||||
|
||||
/* sigtimedwait() is an optional part of POSIX.1-2001, and OpenBSD doesn't implement it.
|
||||
* Based on https://comp.unix.programmer.narkive.com/rEDH0sPT/sigtimedwait-implementation
|
||||
*/
|
||||
#ifndef HAVE_SIGTIMEDWAIT
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
static int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout)
|
||||
{
|
||||
struct timespec elapsed = { 0 }, rem = { 0 };
|
||||
sigset_t pending;
|
||||
int signo;
|
||||
do {
|
||||
/* Check the pending signals, and call sigwait if there is at least one of interest in the set. */
|
||||
sigpending(&pending);
|
||||
for (signo = 1; signo < NSIG; ++signo) {
|
||||
if (sigismember(set, signo) && sigismember(&pending, signo)) {
|
||||
if (!sigwait(set, &signo)) {
|
||||
if (info) {
|
||||
SDL_memset(info, 0, sizeof *info);
|
||||
info->si_signo = signo;
|
||||
}
|
||||
return signo;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (timeout->tv_sec || timeout->tv_nsec) {
|
||||
long ns = 20000000L; // 2/100ths of a second
|
||||
nanosleep(&(struct timespec){ 0, ns }, &rem);
|
||||
ns -= rem.tv_nsec;
|
||||
elapsed.tv_sec += (elapsed.tv_nsec + ns) / 1000000000L;
|
||||
elapsed.tv_nsec = (elapsed.tv_nsec + ns) % 1000000000L;
|
||||
}
|
||||
} while (elapsed.tv_sec < timeout->tv_sec || (elapsed.tv_sec == timeout->tv_sec && elapsed.tv_nsec < timeout->tv_nsec));
|
||||
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static ssize_t write_pipe(int fd, const void *buffer, size_t total_length, size_t *pos)
|
||||
{
|
||||
int ready = 0;
|
||||
|
|
@ -75,7 +117,7 @@ static ssize_t write_pipe(int fd, const void *buffer, size_t total_length, size_
|
|||
}
|
||||
}
|
||||
|
||||
sigtimedwait(&sig_set, 0, &zerotime);
|
||||
sigtimedwait(&sig_set, NULL, &zerotime);
|
||||
|
||||
#ifdef SDL_THREADS_DISABLED
|
||||
sigprocmask(SIG_SETMASK, &old_sig_set, NULL);
|
||||
|
|
|
|||
|
|
@ -162,9 +162,6 @@ static void Wayland_DeleteDevice(SDL_VideoDevice *device)
|
|||
WAYLAND_wl_display_flush(data->display);
|
||||
WAYLAND_wl_display_disconnect(data->display);
|
||||
}
|
||||
if (device->wakeup_lock) {
|
||||
SDL_DestroyMutex(device->wakeup_lock);
|
||||
}
|
||||
SDL_free(data);
|
||||
SDL_free(device);
|
||||
SDL_WAYLAND_UnloadSymbols();
|
||||
|
|
@ -233,7 +230,6 @@ static SDL_VideoDevice *Wayland_CreateDevice(void)
|
|||
}
|
||||
|
||||
device->driverdata = data;
|
||||
device->wakeup_lock = SDL_CreateMutex();
|
||||
|
||||
/* Set the function pointers */
|
||||
device->VideoInit = Wayland_VideoInit;
|
||||
|
|
|
|||
|
|
@ -93,9 +93,6 @@ static void WIN_DeleteDevice(SDL_VideoDevice *device)
|
|||
SDL_UnloadObject(data->shcoreDLL);
|
||||
}
|
||||
#endif
|
||||
if (device->wakeup_lock) {
|
||||
SDL_DestroyMutex(device->wakeup_lock);
|
||||
}
|
||||
SDL_free(device->driverdata);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
|
@ -120,7 +117,6 @@ static SDL_VideoDevice *WIN_CreateDevice(void)
|
|||
return NULL;
|
||||
}
|
||||
device->driverdata = data;
|
||||
device->wakeup_lock = SDL_CreateMutex();
|
||||
|
||||
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
|
||||
data->userDLL = SDL_LoadObject("USER32.DLL");
|
||||
|
|
|
|||
|
|
@ -108,9 +108,6 @@ static void X11_DeleteDevice(SDL_VideoDevice *device)
|
|||
X11_XCloseDisplay(data->request_display);
|
||||
}
|
||||
SDL_free(data->windowlist);
|
||||
if (device->wakeup_lock) {
|
||||
SDL_DestroyMutex(device->wakeup_lock);
|
||||
}
|
||||
SDL_free(device->driverdata);
|
||||
SDL_free(device);
|
||||
|
||||
|
|
@ -204,8 +201,6 @@ static SDL_VideoDevice *X11_CreateDevice(void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
device->wakeup_lock = SDL_CreateMutex();
|
||||
|
||||
#ifdef X11_DEBUG
|
||||
X11_XSynchronize(data->display, True);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue