SDL_syswm.h has been removed and replaced with window properties

main
Sam Lantinga 2023-11-07 14:38:19 -08:00
parent aea6e6de6f
commit fd4a2cce9e
82 changed files with 277 additions and 1069 deletions

View File

@ -345,7 +345,6 @@
<ClInclude Include="..\..\include\SDL3\SDL_stdinc.h" />
<ClInclude Include="..\..\include\SDL3\SDL_surface.h" />
<ClInclude Include="..\..\include\SDL3\SDL_system.h" />
<ClInclude Include="..\..\include\SDL3\SDL_syswm.h" />
<ClInclude Include="..\..\include\SDL3\SDL_test.h" />
<ClInclude Include="..\..\include\SDL3\SDL_test_assert.h" />
<ClInclude Include="..\..\include\SDL3\SDL_test_common.h" />

View File

@ -348,9 +348,6 @@
<ClInclude Include="..\..\include\SDL3\SDL_system.h">
<Filter>API Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\SDL3\SDL_syswm.h">
<Filter>API Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\SDL3\SDL_test.h">
<Filter>API Headers</Filter>
</ClInclude>

View File

@ -83,7 +83,6 @@
<ClInclude Include="..\include\SDL3\SDL_stdinc.h" />
<ClInclude Include="..\include\SDL3\SDL_surface.h" />
<ClInclude Include="..\include\SDL3\SDL_system.h" />
<ClInclude Include="..\include\SDL3\SDL_syswm.h" />
<ClInclude Include="..\include\SDL3\SDL_thread.h" />
<ClInclude Include="..\include\SDL3\SDL_timer.h" />
<ClInclude Include="..\include\SDL3\SDL_touch.h" />

View File

@ -147,9 +147,6 @@
<ClInclude Include="..\include\SDL3\SDL_system.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\SDL3\SDL_syswm.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\SDL3\SDL_thread.h">
<Filter>Header Files</Filter>
</ClInclude>

View File

@ -296,7 +296,6 @@
<ClInclude Include="..\..\include\SDL3\SDL_stdinc.h" />
<ClInclude Include="..\..\include\SDL3\SDL_surface.h" />
<ClInclude Include="..\..\include\SDL3\SDL_system.h" />
<ClInclude Include="..\..\include\SDL3\SDL_syswm.h" />
<ClInclude Include="..\..\include\SDL3\SDL_test.h" />
<ClInclude Include="..\..\include\SDL3\SDL_test_assert.h" />
<ClInclude Include="..\..\include\SDL3\SDL_test_common.h" />

View File

@ -342,9 +342,6 @@
<ClInclude Include="..\..\include\SDL3\SDL_system.h">
<Filter>API Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\SDL3\SDL_syswm.h">
<Filter>API Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\SDL3\SDL_test.h">
<Filter>API Headers</Filter>
</ClInclude>

View File

@ -218,7 +218,6 @@
<ClCompile Include="..\..\..\test\testautomation_sdltest.c" />
<ClCompile Include="..\..\..\test\testautomation_stdlib.c" />
<ClCompile Include="..\..\..\test\testautomation_surface.c" />
<ClCompile Include="..\..\..\test\testautomation_syswm.c" />
<ClCompile Include="..\..\..\test\testautomation_timer.c" />
<ClCompile Include="..\..\..\test\testautomation_video.c" />
<ClCompile Include="..\..\..\test\testautomation_subsystems.c" />

View File

@ -437,7 +437,6 @@
F3F7D9352933074E00816151 /* SDL_error.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8BC2933074A00816151 /* SDL_error.h */; settings = {ATTRIBUTES = (Public, ); }; };
F3F7D9392933074E00816151 /* SDL_opengles2_gl2ext.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8BD2933074A00816151 /* SDL_opengles2_gl2ext.h */; settings = {ATTRIBUTES = (Public, ); }; };
F3F7D93D2933074E00816151 /* SDL_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8BE2933074A00816151 /* SDL_endian.h */; settings = {ATTRIBUTES = (Public, ); }; };
F3F7D9412933074E00816151 /* SDL_syswm.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8BF2933074A00816151 /* SDL_syswm.h */; settings = {ATTRIBUTES = (Public, ); }; };
F3F7D9452933074E00816151 /* SDL_opengl_glext.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8C02933074A00816151 /* SDL_opengl_glext.h */; settings = {ATTRIBUTES = (Public, ); }; };
F3F7D9492933074E00816151 /* SDL_scancode.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8C12933074B00816151 /* SDL_scancode.h */; settings = {ATTRIBUTES = (Public, ); }; };
F3F7D94D2933074E00816151 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F3F7D8C22933074B00816151 /* SDL_sensor.h */; settings = {ATTRIBUTES = (Public, ); }; };
@ -939,7 +938,6 @@
F3F7D8BC2933074A00816151 /* SDL_error.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_error.h; path = SDL3/SDL_error.h; sourceTree = "<group>"; };
F3F7D8BD2933074A00816151 /* SDL_opengles2_gl2ext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_opengles2_gl2ext.h; path = SDL3/SDL_opengles2_gl2ext.h; sourceTree = "<group>"; };
F3F7D8BE2933074A00816151 /* SDL_endian.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_endian.h; path = SDL3/SDL_endian.h; sourceTree = "<group>"; };
F3F7D8BF2933074A00816151 /* SDL_syswm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_syswm.h; path = SDL3/SDL_syswm.h; sourceTree = "<group>"; };
F3F7D8C02933074A00816151 /* SDL_opengl_glext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_opengl_glext.h; path = SDL3/SDL_opengl_glext.h; sourceTree = "<group>"; };
F3F7D8C12933074B00816151 /* SDL_scancode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_scancode.h; path = SDL3/SDL_scancode.h; sourceTree = "<group>"; };
F3F7D8C22933074B00816151 /* SDL_sensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_sensor.h; path = SDL3/SDL_sensor.h; sourceTree = "<group>"; };
@ -1091,7 +1089,6 @@
F3F7D8AC2933074900816151 /* SDL_stdinc.h */,
F3F7D8BB2933074A00816151 /* SDL_surface.h */,
F3F7D8E82933074E00816151 /* SDL_system.h */,
F3F7D8BF2933074A00816151 /* SDL_syswm.h */,
F3F7D8CD2933074C00816151 /* SDL_thread.h */,
F3F7D8B22933074900816151 /* SDL_timer.h */,
F3F7D8AF2933074900816151 /* SDL_touch.h */,
@ -2259,7 +2256,6 @@
A7D8B42823E2514300DCD162 /* SDL_systhread_c.h in Headers */,
5616CA4D252BB2A6005D5928 /* SDL_sysurl.h in Headers */,
A7D8AC3F23E2514100DCD162 /* SDL_sysvideo.h in Headers */,
F3F7D9412933074E00816151 /* SDL_syswm.h in Headers */,
F3F7D9792933074E00816151 /* SDL_thread.h in Headers */,
A7D8B3EC23E2514300DCD162 /* SDL_thread_c.h in Headers */,
F3F7D90D2933074E00816151 /* SDL_timer.h in Headers */,

View File

@ -125,26 +125,6 @@ SDL for iPhone supports polling the built in accelerometer as a joystick device.
The main thing to note when using the accelerometer with SDL is that while the iPhone natively reports accelerometer as floating point values in units of g-force, SDL_GetJoystickAxis() reports joystick values as signed integers. Hence, in order to convert between the two, some clamping and scaling is necessary on the part of the iPhone SDL joystick driver. To convert SDL_GetJoystickAxis() reported values BACK to units of g-force, simply multiply the values by SDL_IPHONE_MAX_GFORCE / 0x7FFF.
Notes -- OpenGL ES
==============================================================================
Your SDL application for iOS uses OpenGL ES for video by default.
OpenGL ES for iOS supports several display pixel formats, such as RGBA8 and RGB565, which provide a 32 bit and 16 bit color buffer respectively. By default, the implementation uses RGB565, but you may use RGBA8 by setting each color component to 8 bits in SDL_GL_SetAttribute().
If your application doesn't use OpenGL's depth buffer, you may find significant performance improvement by setting SDL_GL_DEPTH_SIZE to 0.
Finally, if your application completely redraws the screen each frame, you may find significant performance improvement by setting the attribute SDL_GL_RETAINED_BACKING to 0.
OpenGL ES on iOS doesn't use the traditional system-framebuffer setup provided in other operating systems. Special care must be taken because of this:
- The drawable Renderbuffer must be bound to the GL_RENDERBUFFER binding point when SDL_GL_SwapWindow() is called.
- The drawable Framebuffer Object must be bound while rendering to the screen and when SDL_GL_SwapWindow() is called.
- If multisample antialiasing (MSAA) is used and glReadPixels is used on the screen, the drawable framebuffer must be resolved to the MSAA resolve framebuffer (via glBlitFramebuffer or glResolveMultisampleFramebufferAPPLE), and the MSAA resolve framebuffer must be bound to the GL_READ_FRAMEBUFFER binding point, before glReadPixels is called.
The above objects can be obtained via SDL_GetWindowWMInfo() (in SDL_syswm.h).
Notes -- Keyboard
==============================================================================

View File

@ -1150,6 +1150,8 @@ The following functions have been renamed:
## SDL_system.h
SDL_WindowsMessageHook has changed signatures so the message may be modified and it can block further message processing.
SDL_AndroidGetExternalStorageState() takes the state as an output parameter and returns 0 if the function succeeds or a negative error code if there was an error.
The following functions have been removed:
@ -1159,7 +1161,29 @@ The following functions have been removed:
## SDL_syswm.h
The structures in this file are versioned separately from the rest of SDL, allowing better backwards compatibility and limited forwards compatibility with your application. Instead of calling `SDL_VERSION(&info.version)` before calling SDL_GetWindowWMInfo(), you pass the version in explicitly as SDL_SYSWM_CURRENT_VERSION so SDL knows what fields you expect to be filled out.
This header has been removed.
The Windows and X11 events are now available via callbacks which you can set with SDL_SetWindowsMessageHook() and SDL_SetX11EventHook().
The information previously available in SDL_GetWindowWMInfo() is now available as window properties, e.g.
```c
HWND hwnd = NULL;
SDL_SysWMinfo info;
SDL_VERSION(&info);
if (SDL_GetWindowWMInfo(window, &info) && info.subsystem == SDL_SYSWM_WINDOWS) {
hwnd = info.info.win.window;
}
if (hwnd) {
...
}
```
becomes:
```c
HWND hwnd = (HWND)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.win32.hwnd");
if (hwnd) {
...
}
```
### SDL_GetWindowWMInfo

View File

@ -63,7 +63,7 @@ Here is a rough list of what works, and what doesn't:
* using Direct3D 11.x APIs outside of SDL. Non-XAML / Direct3D-only apps can
choose to render content directly via Direct3D, using SDL to manage the
internal WinRT window, as well as input and audio. (Use
SDL_GetWindowWMInfo() to get the WinRT 'CoreWindow', and pass it into
the window properties to get the WinRT 'CoreWindow', and pass it into
IDXGIFactory2::CreateSwapChainForCoreWindow() as appropriate.)
* What partially works:

View File

@ -101,8 +101,8 @@ typedef enum
/* Window events */
/* 0x200 was SDL_WINDOWEVENT, reserve the number for sdl2-compat */
SDL_EVENT_SYSWM = 0x201, /**< System specific event */
SDL_EVENT_WINDOW_SHOWN, /**< Window has been shown */
/* 0x201 was SDL_EVENT_SYSWM, reserve the number for sdl2-compat */
SDL_EVENT_WINDOW_SHOWN = 0x202, /**< Window has been shown */
SDL_EVENT_WINDOW_HIDDEN, /**< Window has been hidden */
SDL_EVENT_WINDOW_EXPOSED, /**< Window has been exposed and should be redrawn */
SDL_EVENT_WINDOW_MOVED, /**< Window has been moved to data1, data2 */
@ -573,27 +573,6 @@ typedef struct SDL_UserEvent
} SDL_UserEvent;
struct SDL_SysWMmsg;
typedef struct SDL_SysWMmsg SDL_SysWMmsg;
/**
* A video driver dependent system event (event.syswm.*)
*
* This event is disabled by default, you can enable it with
* SDL_SetEventEnabled()
*
* The `msg` is owned by SDL and should be copied if the application
* wants to hold onto it beyond the scope of handling this event.
*
* \note If you want to use this event, you should include SDL_syswm.h.
*/
typedef struct SDL_SysWMEvent
{
Uint32 type; /**< ::SDL_EVENT_SYSWM */
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */
} SDL_SysWMEvent;
/**
* General event structure
*/
@ -623,10 +602,9 @@ typedef union SDL_Event
SDL_SensorEvent sensor; /**< Sensor event data */
SDL_QuitEvent quit; /**< Quit request event data */
SDL_UserEvent user; /**< Custom event data */
SDL_SysWMEvent syswm; /**< System dependent window event data */
SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
SDL_DropEvent drop; /**< Drag and drop event data */
SDL_ClipboardEvent clipboard; /**< Clipboard cancelled event data */
SDL_ClipboardEvent clipboard; /**< Clipboard event data */
/* This is necessary for ABI compatibility between Visual C++ and GCC.
Visual C++ will respect the push pack pragma and use 52 bytes (size of

View File

@ -417,7 +417,6 @@ extern "C" {
* "0" - Don't log any events (default)
* "1" - Log most events (other than the really spammy ones).
* "2" - Include mouse and finger motion events.
* "3" - Include SDL_SysWMEvent events.
*
* This is generally meant to be used to debug SDL itself, but can be useful
* for application developers that need better visibility into what is going

View File

@ -124,7 +124,6 @@
#define SDL_RENDER_DEVICE_RESET SDL_EVENT_RENDER_DEVICE_RESET
#define SDL_RENDER_TARGETS_RESET SDL_EVENT_RENDER_TARGETS_RESET
#define SDL_SENSORUPDATE SDL_EVENT_SENSOR_UPDATE
#define SDL_SYSWMEVENT SDL_EVENT_SYSWM
#define SDL_TEXTEDITING SDL_EVENT_TEXT_EDITING
#define SDL_TEXTEDITING_EXT SDL_EVENT_TEXT_EDITING_EXT
#define SDL_TEXTINPUT SDL_EVENT_TEXT_INPUT
@ -568,7 +567,6 @@
#define SDL_RENDER_DEVICE_RESET SDL_RENDER_DEVICE_RESET_renamed_SDL_EVENT_RENDER_DEVICE_RESET
#define SDL_RENDER_TARGETS_RESET SDL_RENDER_TARGETS_RESET_renamed_SDL_EVENT_RENDER_TARGETS_RESET
#define SDL_SENSORUPDATE SDL_SENSORUPDATE_renamed_SDL_EVENT_SENSOR_UPDATE
#define SDL_SYSWMEVENT SDL_SYSWMEVENT_renamed_SDL_EVENT_SYSWM
#define SDL_TEXTEDITING SDL_TEXTEDITING_renamed_SDL_EVENT_TEXT_EDITING
#define SDL_TEXTEDITING_EXT SDL_TEXTEDITING_EXT_renamed_SDL_EVENT_TEXT_EDITING_EXT
#define SDL_TEXTINPUT SDL_TEXTINPUT_renamed_SDL_EVENT_TEXT_INPUT

View File

@ -40,14 +40,18 @@ extern "C" {
#endif
/* Platform specific functions for Windows */
/*
* Platform specific functions for Windows
*/
#if defined(__WIN32__) || defined(__GDK__)
typedef void (SDLCALL * SDL_WindowsMessageHook)(void *userdata, void *hWnd, unsigned int message, Uint64 wParam, Sint64 lParam);
typedef struct tagMSG MSG;
typedef SDL_bool (SDLCALL *SDL_WindowsMessageHook)(void *userdata, MSG *msg);
/**
* Set a callback for every Windows message, run before TranslateMessage().
*
* The callback may modify the message, and should return SDL_TRUE if the message should continue to be processed, or SDL_FALSE to prevent further processing.
*
* \param callback The SDL_WindowsMessageHook function to call.
* \param userdata a pointer to pass to every iteration of `callback`
*
@ -96,7 +100,27 @@ extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo(SDL_DisplayID displayID,
#endif /* defined(__WIN32__) || defined(__WINGDK__) */
/* Platform specific functions for Linux */
/*
* Platform specific functions for UNIX
*/
typedef union _XEvent XEvent;
typedef SDL_bool (SDLCALL *SDL_X11EventHook)(void *userdata, XEvent *xevent);
/**
* Set a callback for every X11 event
*
* The callback may modify the event, and should return SDL_TRUE if the event should continue to be processed, or SDL_FALSE to prevent further processing.
*
* \param callback The SDL_X11EventHook function to call.
* \param userdata a pointer to pass to every iteration of `callback`
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC void SDLCALL SDL_SetX11EventHook(SDL_X11EventHook callback, void *userdata);
/*
* Platform specific functions for Linux
*/
#ifdef __LINUX__
/**
@ -130,7 +154,9 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID,
#endif /* __LINUX__ */
/* Platform specific functions for iOS */
/*
* Platform specific functions for iOS
*/
#ifdef __IOS__
#define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)
@ -190,7 +216,9 @@ extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
#endif /* __IOS__ */
/* Platform specific functions for Android */
/*
* Platform specific functions for Android
*/
#ifdef __ANDROID__
/**
@ -419,7 +447,9 @@ extern DECLSPEC int SDLCALL SDL_AndroidSendMessage(Uint32 command, int param);
#endif /* __ANDROID__ */
/* Platform specific functions for WinRT */
/*
* Platform specific functions for WinRT
*/
#ifdef __WINRT__
/**
@ -581,7 +611,9 @@ extern DECLSPEC void SDLCALL SDL_OnApplicationDidBecomeActive(void);
extern DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void);
#endif
/* Functions used only by GDK */
/*
* Functions used only by GDK
*/
#ifdef __GDK__
typedef struct XTaskQueueObject *XTaskQueueHandle;
typedef struct XUser *XUserHandle;

View File

@ -1,387 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL_syswm.h
*
* Include file for SDL custom system window manager hooks.
*/
#ifndef SDL_syswm_h_
#define SDL_syswm_h_
#include <SDL3/SDL_stdinc.h>
#include <SDL3/SDL_error.h>
#include <SDL3/SDL_platform_defines.h>
#include <SDL3/SDL_video.h>
/**
* SDL_syswm.h
*
* Your application has access to a special type of event ::SDL_EVENT_SYSWM,
* which contains window-manager specific information and arrives whenever
* an unhandled window event occurs. This event is ignored by default, but
* you can enable it with SDL_SetEventEnabled().
*/
/**
* The available subsystems based on platform
*/
#ifndef SDL_DISABLE_SYSWM_PLATFORMS
#ifndef SDL_DISABLE_SYSWM_ANDROID
#ifdef __ANDROID__
#define SDL_ENABLE_SYSWM_ANDROID
#endif
#endif /* !SDL_DISABLE_SYSWM_ANDROID */
#ifndef SDL_DISABLE_SYSWM_COCOA
#ifdef __MACOS__
#define SDL_ENABLE_SYSWM_COCOA
#endif
#endif /* !SDL_DISABLE_SYSWM_COCOA */
#ifndef SDL_DISABLE_SYSWM_HAIKU
#ifdef __HAIKU__
#define SDL_ENABLE_SYSWM_HAIKU
#endif
#endif /* !SDL_DISABLE_SYSWM_HAIKU */
#ifndef SDL_DISABLE_SYSWM_KMSDRM
#if defined(__LINUX__) || defined(__FREEBSD__) || defined(__OPENBSD__)
#define SDL_ENABLE_SYSWM_KMSDRM
#endif
#endif /* !SDL_DISABLE_SYSWM_KMSDRM */
#ifndef SDL_DISABLE_SYSWM_RISCOS
#ifdef __RISCOS__
#define SDL_ENABLE_SYSWM_RISCOS
#endif
#endif /* !SDL_DISABLE_SYSWM_RISCOS */
#ifndef SDL_DISABLE_SYSWM_UIKIT
#if defined(__IOS__) || defined(__TVOS__)
#define SDL_ENABLE_SYSWM_UIKIT
#endif
#endif /* !SDL_DISABLE_SYSWM_UIKIT */
#ifndef SDL_DISABLE_SYSWM_VIVANTE
/* Not enabled by default */
#endif /* !SDL_DISABLE_SYSWM_VIVANTE */
#ifndef SDL_DISABLE_SYSWM_WAYLAND
#if defined(__LINUX__) || defined(__FREEBSD__)
#define SDL_ENABLE_SYSWM_WAYLAND
#endif
#endif /* !SDL_DISABLE_SYSWM_WAYLAND */
#ifndef SDL_DISABLE_SYSWM_WINDOWS
#if defined(__WIN32__) || defined(__GDK__)
#define SDL_ENABLE_SYSWM_WINDOWS
#endif
#endif /* !SDL_DISABLE_SYSWM_WINDOWS */
#ifndef SDL_DISABLE_SYSWM_WINRT
#ifdef __WINRT__
#define SDL_ENABLE_SYSWM_WINRT
#endif
#endif /* !SDL_DISABLE_SYSWM_WINRT */
#ifndef SDL_DISABLE_SYSWM_X11
#if defined(__unix__) && !defined(__WIN32__) && !defined(__ANDROID__) && !defined(__QNX__)
#define SDL_ENABLE_SYSWM_X11
#endif
#endif /* !SDL_DISABLE_SYSWM_X11 */
#endif /* !SDL_DISABLE_SYSWM_PLATFORMS */
/**
* Forward declaration of types used by subsystems
*/
#ifndef SDL_DISABLE_SYSWM_TYPES
#if defined(SDL_ENABLE_SYSWM_ANDROID) && !defined(SDL_DISABLE_SYSWM_ANDROID_TYPES)
typedef struct ANativeWindow ANativeWindow;
typedef void *EGLSurface;
#endif /* SDL_ENABLE_SYSWM_ANDROID */
#if defined(SDL_ENABLE_SYSWM_COCOA) && !defined(SDL_DISABLE_SYSWM_COCOA_TYPES)
#ifdef __OBJC__
@class NSWindow;
#else
typedef struct _NSWindow NSWindow;
#endif
#endif /* SDL_ENABLE_SYSWM_COCOA */
#if defined(SDL_ENABLE_SYSWM_KMSDRM) && !defined(SDL_DISABLE_SYSWM_KMSDRM_TYPES)
struct gbm_device;
#endif /* SDL_ENABLE_SYSWM_KMSDRM */
#if defined(SDL_ENABLE_SYSWM_UIKIT) && !defined(SDL_DISABLE_SYSWM_UIKIT_TYPES)
#ifdef __OBJC__
#include <UIKit/UIKit.h>
#else
typedef struct _UIWindow UIWindow;
typedef struct _UIViewController UIViewController;
#endif
typedef Uint32 GLuint;
#endif /* SDL_ENABLE_SYSWM_UIKIT */
#if defined(SDL_ENABLE_SYSWM_VIVANTE) && !defined(SDL_DISABLE_SYSWM_VIVANTE_TYPES)
#include <SDL3/SDL_egl.h>
#endif /* SDL_ENABLE_SYSWM_VIVANTE */
#if defined(SDL_ENABLE_SYSWM_WAYLAND) && !defined(SDL_DISABLE_SYSWM_WAYLAND_TYPES)
struct wl_display;
struct wl_egl_window;
struct wl_surface;
struct xdg_popup;
struct xdg_positioner;
struct xdg_surface;
struct xdg_toplevel;
#endif /* SDL_ENABLE_SYSWM_WAYLAND */
#if defined(SDL_ENABLE_SYSWM_WINDOWS) && !defined(SDL_DISABLE_SYSWM_WINDOWS_TYPES)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef NOMINMAX /* don't define min() and max(). */
#define NOMINMAX
#endif
#include <windows.h>
#endif /* SDL_ENABLE_SYSWM_WINDOWS */
#if defined(SDL_ENABLE_SYSWM_WINRT) && !defined(SDL_DISABLE_SYSWM_WINRT_TYPES)
#include <Inspectable.h>
#endif /* SDL_ENABLE_SYSWM_WINRT */
#if defined(SDL_ENABLE_SYSWM_X11) && !defined(SDL_DISABLE_SYSWM_X11_TYPES)
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#endif /* SDL_ENABLE_SYSWM_X11 */
#endif /* !SDL_DISABLE_SYSWM_TYPES */
#include <SDL3/SDL_begin_code.h>
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* This is the current version of structures in this file */
#define SDL_SYSWM_CURRENT_VERSION 1
#define SDL_SYSWM_INFO_SIZE_V1 (16 * (sizeof (void *) >= 8 ? sizeof (void *) : sizeof(Uint64)))
#define SDL_SYSWM_CURRENT_INFO_SIZE SDL_SYSWM_INFO_SIZE_V1
/* This is the tag associated with a Metal view so you can find it */
#define SDL_METALVIEW_TAG 255
/**
* These are the various supported windowing subsystems
*/
typedef enum
{
SDL_SYSWM_UNKNOWN,
SDL_SYSWM_ANDROID,
SDL_SYSWM_COCOA,
SDL_SYSWM_HAIKU,
SDL_SYSWM_KMSDRM,
SDL_SYSWM_RISCOS,
SDL_SYSWM_UIKIT,
SDL_SYSWM_VIVANTE,
SDL_SYSWM_WAYLAND,
SDL_SYSWM_WINDOWS,
SDL_SYSWM_WINRT,
SDL_SYSWM_X11
} SDL_SYSWM_TYPE;
/**
* The custom event structure.
*/
struct SDL_SysWMmsg
{
Uint32 version;
Uint32 subsystem; /**< SDL_SYSWM_TYPE */
Uint32 padding[(2 * (sizeof (void *) >= 8 ? sizeof (void *) : sizeof(Uint64)) - 2 * sizeof(Uint32)) / sizeof(Uint32)];
union
{
#ifdef SDL_ENABLE_SYSWM_WINDOWS
struct {
HWND hwnd; /**< The window for the message */
UINT msg; /**< The type of message */
WPARAM wParam; /**< WORD message parameter */
LPARAM lParam; /**< LONG message parameter */
} win;
#endif
#ifdef SDL_ENABLE_SYSWM_X11
struct {
XEvent event;
} x11;
#endif
/* Can't have an empty union */
int dummy;
} msg;
};
/**
* The custom window manager information structure.
*
* When this structure is returned, it holds information about which
* low level system it is using, and will be one of SDL_SYSWM_TYPE.
*/
struct SDL_SysWMinfo
{
Uint32 version;
Uint32 subsystem; /**< SDL_SYSWM_TYPE */
Uint32 padding[(2 * (sizeof (void *) >= 8 ? sizeof (void *) : sizeof(Uint64)) - 2 * sizeof(Uint32)) / sizeof(Uint32)];
union
{
#ifdef SDL_ENABLE_SYSWM_WINDOWS
struct
{
HWND window; /**< The window handle */
HDC hdc; /**< The window device context */
HINSTANCE hinstance; /**< The instance handle */
} win;
#endif
#ifdef SDL_ENABLE_SYSWM_WINRT
struct
{
IInspectable * window; /**< The WinRT CoreWindow */
} winrt;
#endif
#ifdef SDL_ENABLE_SYSWM_X11
struct
{
Display *display; /**< The X11 display */
int screen; /**< The X11 screen */
Window window; /**< The X11 window */
} x11;
#endif
#ifdef SDL_ENABLE_SYSWM_COCOA
struct
{
#if defined(__OBJC__) && defined(__has_feature)
#if __has_feature(objc_arc)
NSWindow __unsafe_unretained *window; /**< The Cocoa window */
#else
NSWindow *window; /**< The Cocoa window */
#endif
#else
NSWindow *window; /**< The Cocoa window */
#endif
} cocoa;
#endif
#ifdef SDL_ENABLE_SYSWM_UIKIT
struct
{
#if defined(__OBJC__) && defined(__has_feature)
#if __has_feature(objc_arc)
UIWindow __unsafe_unretained *window; /**< The UIKit window */
#else
UIWindow *window; /**< The UIKit window */
#endif
#else
UIWindow *window; /**< The UIKit window */
#endif
GLuint framebuffer; /**< The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
GLuint colorbuffer; /**< The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
} uikit;
#endif
#ifdef SDL_ENABLE_SYSWM_WAYLAND
struct
{
struct wl_display *display; /**< Wayland display */
struct wl_surface *surface; /**< Wayland surface */
struct wl_egl_window *egl_window; /**< Wayland EGL window (native window) */
struct xdg_surface *xdg_surface; /**< Wayland xdg surface (window manager handle) */
struct xdg_toplevel *xdg_toplevel; /**< Wayland xdg toplevel role */
struct xdg_popup *xdg_popup; /**< Wayland xdg popup role */
struct xdg_positioner *xdg_positioner; /**< Wayland xdg positioner, for popup */
} wl;
#endif
#ifdef SDL_ENABLE_SYSWM_ANDROID
struct
{
ANativeWindow *window;
EGLSurface surface;
} android;
#endif
#ifdef SDL_ENABLE_SYSWM_VIVANTE
struct
{
EGLNativeDisplayType display;
EGLNativeWindowType window;
} vivante;
#endif
#ifdef SDL_ENABLE_SYSWM_KMSDRM
struct
{
int dev_index; /**< Device index (ex: the X in /dev/dri/cardX) */
int drm_fd; /**< DRM FD (unavailable on Vulkan windows) */
struct gbm_device *gbm_dev; /**< GBM device (unavailable on Vulkan windows) */
} kmsdrm;
#endif
/* Make sure this union has enough room for 14 pointers */
void *dummy_ptrs[14];
Uint64 dummy_ints[14];
} info;
};
SDL_COMPILE_TIME_ASSERT(SDL_SysWMinfo_size, sizeof(struct SDL_SysWMinfo) == SDL_SYSWM_CURRENT_INFO_SIZE);
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
/**
* Get driver-specific information about a window.
*
* You must include SDL_syswm.h for the declaration of SDL_SysWMinfo.
*
* \param window the window about which information is being requested
* \param info an SDL_SysWMinfo structure filled in with window information
* \param version the version of info being requested, should be
* SDL_SYSWM_CURRENT_VERSION
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_GetWindowWMInfo(SDL_Window *window, SDL_SysWMinfo *info, Uint32 version);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include <SDL3/SDL_close_code.h>
#endif /* SDL_syswm_h_ */

View File

@ -934,6 +934,55 @@ extern DECLSPEC SDL_Window *SDLCALL SDL_GetWindowParent(SDL_Window *window);
/**
* Get the properties associated with a window.
*
* The following properties are provided by SDL:
*
* On Android:
* "SDL.window.android.window" - the ANativeWindow associated with the window
* "SDL.window.android.surface" - the EGLSurface associated with the window
*
* On iOS:
* "SDL.window.uikit.window" - the (__unsafe_unretained) UIWindow associated with the window
* "SDL.window.uikit.metal_view_tag" - the NSInteger tag assocated with metal views on the window
*
* On KMS/DRM:
* "SDL.window.kmsdrm.dev_index" - the device index associated with the window (e.g. the X in /dev/dri/cardX)
* "SDL.window.kmsdrm.drm_fd" - the DRM FD associated with the window
* "SDL.window.kmsdrm.gbm_dev" - the GBM device associated with the window
*
* On macOS:
* "SDL.window.cocoa.window" - the (__unsafe_unretained) NSWindow associated with the window
* "SDL.window.cocoa.metal_view_tag" - the NSInteger tag assocated with metal views on the window
*
* On Vivante:
* "SDL.window.vivante.display" - the EGLNativeDisplayType associated with the window
* "SDL.window.vivante.window" - the EGLNativeWindowType associated with the window
* "SDL.window.vivante.surface" - the EGLSurface associated with the window
*
* On UWP:
* "SDL.window.winrt.window" - the IInspectable CoreWindow associated with the window
*
* On Windows:
* "SDL.window.win32.hwnd" - the HWND associated with the window
* "SDL.window.win32.hdc" - the HDC associated with the window
* "SDL.window.win32.instance" - the HINSTANCE associated with the window
*
* On Wayland:
* "SDL.window.wayland.display" - the wl_display associated with the window
* "SDL.window.wayland.surface" - the wl_surface associated with the window
* "SDL.window.wayland.egl_window" - the wl_egl_window associated with the window
* "SDL.window.wayland.xdg_surface" - the xdg_surface associated with the window
* "SDL.window.wayland.xdg_toplevel" - the xdg_toplevel role associated with the window
* "SDL.window.wayland.xdg_popup" - the xdg_popup role associated with the window
* "SDL.window.wayland.xdg_positioner" - the xdg_positioner associated with the window, in popup mode
*
* Note: The xdg_* window objects do not internally persist across window show/hide calls.
* They will be null if the window is hidden and must be queried each time it is shown.
*
* On X11:
* "SDL.window.x11.display" - the X11 Display associated with the window
* "SDL.window.x11.screen" - the screen number associated with the window
* "SDL.window.x11.window" - the X11 Window associated with the window
*
* \param window the window to query
* \returns a valid property ID on success or 0 on failure; call
* SDL_GetError() for more information.

View File

@ -415,62 +415,6 @@
#cmakedefine SDL_VIDEO_DRIVER_X11_XSHAPE @SDL_VIDEO_DRIVER_X11_XSHAPE@
#cmakedefine SDL_VIDEO_DRIVER_QNX @SDL_VIDEO_DRIVER_QNX@
#ifdef SDL_VIDEO_DRIVER_ANDROID
#define SDL_ENABLE_SYSWM_ANDROID
#else
#define SDL_DISABLE_SYSWM_ANDROID
#endif
#ifdef SDL_VIDEO_DRIVER_COCOA
#define SDL_ENABLE_SYSWM_COCOA
#else
#define SDL_DISABLE_SYSWM_COCOA
#endif
#ifdef SDL_VIDEO_DRIVER_HAIKU
#define SDL_ENABLE_SYSWM_HAIKU
#else
#define SDL_DISABLE_SYSWM_HAIKU
#endif
#ifdef SDL_VIDEO_DRIVER_KMSDRM
#define SDL_ENABLE_SYSWM_KMSDRM
#else
#define SDL_DISABLE_SYSWM_KMSDRM
#endif
#ifdef SDL_VIDEO_DRIVER_RISCOS
#define SDL_ENABLE_SYSWM_RISCOS
#else
#define SDL_DISABLE_SYSWM_RISCOS
#endif
#ifdef SDL_VIDEO_DRIVER_UIKIT
#define SDL_ENABLE_SYSWM_UIKIT
#else
#define SDL_DISABLE_SYSWM_UIKIT
#endif
#ifdef SDL_VIDEO_DRIVER_VIVANTE
#define SDL_ENABLE_SYSWM_VIVANTE
#else
#define SDL_DISABLE_SYSWM_VIVANTE
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND
#define SDL_ENABLE_SYSWM_WAYLAND
#else
#define SDL_DISABLE_SYSWM_WAYLAND
#endif
#ifdef SDL_VIDEO_DRIVER_WINDOWS
#define SDL_ENABLE_SYSWM_WINDOWS
#else
#define SDL_DISABLE_SYSWM_WINDOWS
#endif
#ifdef SDL_VIDEO_DRIVER_WINRT
#define SDL_ENABLE_SYSWM_WINRT
#else
#define SDL_DISABLE_SYSWM_WINRT
#endif
#ifdef SDL_VIDEO_DRIVER_X11
#define SDL_ENABLE_SYSWM_X11
#else
#define SDL_DISABLE_SYSWM_X11
#endif
#cmakedefine SDL_VIDEO_RENDER_D3D @SDL_VIDEO_RENDER_D3D@
#cmakedefine SDL_VIDEO_RENDER_D3D11 @SDL_VIDEO_RENDER_D3D11@
#cmakedefine SDL_VIDEO_RENDER_D3D12 @SDL_VIDEO_RENDER_D3D12@

View File

@ -20,6 +20,14 @@
*/
#include "SDL_internal.h"
#ifndef SDL_VIDEO_DRIVER_X11
DECLSPEC void SDLCALL SDL_SetX11EventHook(SDL_X11EventHook callback, void *userdata)
{
}
#endif
#ifndef __LINUX__
DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority);

View File

@ -29,7 +29,6 @@
#ifdef SDL_VIDEO_DRIVER_X11
#include "../../video/x11/SDL_x11video.h"
#endif
#include <SDL3/SDL_syswm.h>
#define FCITX_DBUS_SERVICE "org.freedesktop.portal.Fcitx"
@ -412,7 +411,6 @@ SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
void SDL_Fcitx_UpdateTextRect(const SDL_Rect *rect)
{
SDL_Window *focused_win = NULL;
SDL_SysWMinfo info;
int x = 0, y = 0;
SDL_Rect *cursor = &fcitx_client.cursor_rect;
@ -427,17 +425,18 @@ void SDL_Fcitx_UpdateTextRect(const SDL_Rect *rect)
SDL_GetWindowPosition(focused_win, &x, &y);
if (SDL_GetWindowWMInfo(focused_win, &info, SDL_SYSWM_CURRENT_VERSION) == 0) {
#ifdef SDL_ENABLE_SYSWM_X11
if (info.subsystem == SDL_SYSWM_X11) {
Display *x_disp = info.info.x11.display;
int x_screen = info.info.x11.screen;
Window x_win = info.info.x11.window;
Window unused;
#ifdef SDL_VIDEO_DRIVER_X11
{
SDL_PropertiesID props = SDL_GetWindowProperties(focused_win);
Display *x_disp = (Display *)SDL_GetProperty(props, "SDL.window.x11.display");
int x_screen = (int)(intptr_t)SDL_GetProperty(props, "SDL.window.x11.screen");
Window x_win = (Window)SDL_GetProperty(props, "SDL.window.x11.window");
Window unused;
if (x_disp && x_win) {
X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused);
}
#endif
}
#endif
if (cursor->x == -1 && cursor->y == -1 && cursor->w == 0 && cursor->h == 0) {
/* move to bottom left */

View File

@ -32,7 +32,6 @@
#ifdef SDL_VIDEO_DRIVER_X11
#include "../../video/x11/SDL_x11video.h"
#endif
#include <SDL3/SDL_syswm.h>
#include <sys/inotify.h>
#include <unistd.h>
@ -689,7 +688,6 @@ SDL_bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state)
void SDL_IBus_UpdateTextRect(const SDL_Rect *rect)
{
SDL_Window *focused_win;
SDL_SysWMinfo info;
int x = 0, y = 0;
SDL_DBusContext *dbus;
@ -704,18 +702,19 @@ void SDL_IBus_UpdateTextRect(const SDL_Rect *rect)
SDL_GetWindowPosition(focused_win, &x, &y);
if (SDL_GetWindowWMInfo(focused_win, &info, SDL_SYSWM_CURRENT_VERSION) == 0) {
#ifdef SDL_ENABLE_SYSWM_X11
if (info.subsystem == SDL_SYSWM_X11) {
Display *x_disp = info.info.x11.display;
int x_screen = info.info.x11.screen;
Window x_win = info.info.x11.window;
Window unused;
#ifdef SDL_VIDEO_DRIVER_X11
{
SDL_PropertiesID props = SDL_GetWindowProperties(focused_win);
Display *x_disp = (Display *)SDL_GetProperty(props, "SDL.window.x11.display");
int x_screen = (int)(intptr_t)SDL_GetProperty(props, "SDL.window.x11.screen");
Window x_win = (Window)SDL_GetProperty(props, "SDL.window.x11.window");
Window unused;
if (x_disp && x_win) {
X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused);
}
#endif
}
#endif
x += ibus_cursor_rect.x;
y += ibus_cursor_rect.y;

View File

@ -37,7 +37,6 @@
/* These headers have system specific definitions, so aren't included above */
#include <SDL3/SDL_syswm.h>
#include <SDL3/SDL_vulkan.h>
/* This is the version of the dynamic API. This doesn't match the SDL version

View File

@ -360,7 +360,6 @@ SDL3_0.0.0 {
SDL_GetWindowSizeInPixels;
SDL_GetWindowSurface;
SDL_GetWindowTitle;
SDL_GetWindowWMInfo;
SDL_GetYUVConversionMode;
SDL_GetYUVConversionModeForResolution;
SDL_HapticClose;
@ -922,6 +921,7 @@ SDL3_0.0.0 {
SDL_AllocateEventMemory;
SDL_GetDisplayProperties;
SDL_SetPropertyWithCleanup;
SDL_SetX11EventHook;
# extra symbols go here (don't modify this line)
local: *;
};

View File

@ -384,7 +384,6 @@
#define SDL_GetWindowSizeInPixels SDL_GetWindowSizeInPixels_REAL
#define SDL_GetWindowSurface SDL_GetWindowSurface_REAL
#define SDL_GetWindowTitle SDL_GetWindowTitle_REAL
#define SDL_GetWindowWMInfo SDL_GetWindowWMInfo_REAL
#define SDL_GetYUVConversionMode SDL_GetYUVConversionMode_REAL
#define SDL_GetYUVConversionModeForResolution SDL_GetYUVConversionModeForResolution_REAL
#define SDL_HapticClose SDL_HapticClose_REAL
@ -947,3 +946,4 @@
#define SDL_AllocateEventMemory SDL_AllocateEventMemory_REAL
#define SDL_GetDisplayProperties SDL_GetDisplayProperties_REAL
#define SDL_SetPropertyWithCleanup SDL_SetPropertyWithCleanup_REAL
#define SDL_SetX11EventHook SDL_SetX11EventHook_REAL

View File

@ -443,7 +443,6 @@ SDL_DYNAPI_PROC(int,SDL_GetWindowSize,(SDL_Window *a, int *b, int *c),(a,b,c),re
SDL_DYNAPI_PROC(int,SDL_GetWindowSizeInPixels,(SDL_Window *a, int *b, int *c),(a,b,c),return)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_GetWindowSurface,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(const char*,SDL_GetWindowTitle,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_GetWindowWMInfo,(SDL_Window *a, SDL_SysWMinfo *b, Uint32 c),(a,b,c),return)
SDL_DYNAPI_PROC(SDL_YUV_CONVERSION_MODE,SDL_GetYUVConversionMode,(void),(),return)
SDL_DYNAPI_PROC(SDL_YUV_CONVERSION_MODE,SDL_GetYUVConversionModeForResolution,(int a, int b),(a,b),return)
SDL_DYNAPI_PROC(void,SDL_HapticClose,(SDL_Haptic *a),(a),)
@ -980,3 +979,4 @@ SDL_DYNAPI_PROC(size_t,SDL_RWvprintf,(SDL_RWops *a, const char *b, va_list c),(a
SDL_DYNAPI_PROC(void*,SDL_AllocateEventMemory,(size_t a),(a),return)
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetDisplayProperties,(SDL_DisplayID a),(a),return)
SDL_DYNAPI_PROC(int,SDL_SetPropertyWithCleanup,(SDL_PropertiesID a, const char *b, void *c, void (SDLCALL *d)(void *userdata, void *value), void *e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(void,SDL_SetX11EventHook,(SDL_X11EventHook a, void *b),(a,b),)

View File

@ -33,7 +33,6 @@
#include "../sensor/SDL_sensor_c.h"
#endif
#include "../video/SDL_sysvideo.h"
#include <SDL3/SDL_syswm.h>
#undef SDL_PRIs64
#if (defined(__WIN32__) || defined(__GDK__)) && !defined(__CYGWIN__)
@ -194,7 +193,6 @@ static void SDLCALL SDL_PollSentinelChanged(void *userdata, const char *name, co
* - 0: (default) no logging
* - 1: logging of most events
* - 2: as above, plus mouse and finger motion
* - 3: as above, plus SDL_SysWMEvents
*/
static int SDL_EventLoggingVerbosity = 0;
@ -218,11 +216,6 @@ static void SDL_LogEvent(const SDL_Event *event)
return;
}
/* window manager events are even more spammy, and don't provide much useful info. */
if ((SDL_EventLoggingVerbosity < 3) && (event->type == SDL_EVENT_SYSWM)) {
return;
}
/* this is to make (void)SDL_snprintf() calls cleaner. */
#define uint unsigned int
@ -321,11 +314,6 @@ static void SDL_LogEvent(const SDL_Event *event)
SDL_WINDOWEVENT_CASE(SDL_EVENT_WINDOW_DESTROYED);
#undef SDL_WINDOWEVENT_CASE
SDL_EVENT_CASE(SDL_EVENT_SYSWM)
/* !!! FIXME: we don't delve further at the moment. */
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u)", (uint)event->syswm.timestamp);
break;
#define PRINT_KEY_EVENT(event) \
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u state=%s repeat=%s scancode=%u keycode=%u mod=%u)", \
(uint)event->key.timestamp, (uint)event->key.windowID, \
@ -644,7 +632,6 @@ int SDL_StartEventLoop(void)
/* Process most event types */
SDL_SetEventEnabled(SDL_EVENT_TEXT_INPUT, SDL_FALSE);
SDL_SetEventEnabled(SDL_EVENT_TEXT_EDITING, SDL_FALSE);
SDL_SetEventEnabled(SDL_EVENT_SYSWM, SDL_FALSE);
#if 0 /* Leave these events enabled so apps can respond to items being dragged onto them at startup */
SDL_SetEventEnabled(SDL_EVENT_DROP_FILE, SDL_FALSE);
SDL_SetEventEnabled(SDL_EVENT_DROP_TEXT, SDL_FALSE);
@ -1405,27 +1392,6 @@ int SDL_SendAppEvent(SDL_EventType eventType)
return posted;
}
int SDL_SendSysWMEvent(SDL_SysWMmsg *message)
{
int posted;
posted = 0;
if (SDL_EventEnabled(SDL_EVENT_SYSWM)) {
SDL_Event event;
SDL_memset(&event, 0, sizeof(event));
event.type = SDL_EVENT_SYSWM;
event.common.timestamp = 0;
event.syswm.msg = (SDL_SysWMmsg *)SDL_AllocateEventMemory(sizeof(*message));
if (!event.syswm.msg) {
return 0;
}
SDL_copyp(event.syswm.msg, message);
posted = (SDL_PushEvent(&event) > 0);
}
/* Update internal event state */
return posted;
}
int SDL_SendKeymapChangedEvent(void)
{
return SDL_SendAppEvent(SDL_EVENT_KEYMAP_CHANGED);

View File

@ -41,7 +41,6 @@ extern void SDL_StopEventLoop(void);
extern void SDL_QuitInterrupt(void);
extern int SDL_SendAppEvent(SDL_EventType eventType);
extern int SDL_SendSysWMEvent(SDL_SysWMmsg *message);
extern int SDL_SendKeymapChangedEvent(void);
extern int SDL_SendLocaleChangedEvent(void);
extern int SDL_SendSystemThemeChangedEvent(void);

View File

@ -28,8 +28,6 @@
#include "../SDL_d3dmath.h"
#include "../../video/windows/SDL_windowsvideo.h"
#include <SDL3/SDL_syswm.h>
#ifdef SDL_VIDEO_RENDER_D3D
#define D3D_DEBUG_INFO
#include <d3d9.h>
@ -1542,7 +1540,6 @@ SDL_Renderer *D3D_CreateRenderer(SDL_Window *window, Uint32 flags)
{
SDL_Renderer *renderer;
D3D_RenderData *data;
SDL_SysWMinfo windowinfo;
HRESULT result;
D3DPRESENT_PARAMETERS pparams;
IDirect3DSwapChain9 *chain;
@ -1552,12 +1549,6 @@ SDL_Renderer *D3D_CreateRenderer(SDL_Window *window, Uint32 flags)
SDL_DisplayID displayID;
const SDL_DisplayMode *fullscreen_mode = NULL;
if (SDL_GetWindowWMInfo(window, &windowinfo, SDL_SYSWM_CURRENT_VERSION) < 0 ||
windowinfo.subsystem != SDL_SYSWM_WINDOWS) {
SDL_SetError("Couldn't get window handle");
return NULL;
}
renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(*renderer));
if (renderer == NULL) {
SDL_OutOfMemory();
@ -1611,7 +1602,7 @@ SDL_Renderer *D3D_CreateRenderer(SDL_Window *window, Uint32 flags)
}
SDL_zero(pparams);
pparams.hDeviceWindow = windowinfo.info.win.window;
pparams.hDeviceWindow = (HWND)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.win32.hwnd");
pparams.BackBufferWidth = w;
pparams.BackBufferHeight = h;
pparams.BackBufferCount = 1;

View File

@ -30,8 +30,6 @@
#include "../SDL_sysrender.h"
#include "../SDL_d3dmath.h"
#include <SDL3/SDL_syswm.h>
#include <d3d11_1.h>
#include "SDL_shaders_d3d11.h"
@ -827,18 +825,11 @@ static HRESULT D3D11_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
#endif
} else {
#if defined(__WIN32__) || defined(__WINGDK__)
SDL_SysWMinfo windowinfo;
if (SDL_GetWindowWMInfo(renderer->window, &windowinfo, SDL_SYSWM_CURRENT_VERSION) < 0 ||
windowinfo.subsystem != SDL_SYSWM_WINDOWS) {
SDL_SetError("Couldn't get window handle");
result = E_FAIL;
goto done;
}
HWND hwnd = (HWND)SDL_GetProperty(SDL_GetWindowProperties(renderer->window), "SDL.window.win32.hwnd");
result = IDXGIFactory2_CreateSwapChainForHwnd(data->dxgiFactory,
(IUnknown *)data->d3dDevice,
windowinfo.info.win.window,
hwnd,
&swapChainDesc,
NULL,
NULL, /* Allow on all displays. */
@ -848,7 +839,7 @@ static HRESULT D3D11_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
goto done;
}
IDXGIFactory_MakeWindowAssociation(data->dxgiFactory, windowinfo.info.win.window, DXGI_MWA_NO_WINDOW_CHANGES);
IDXGIFactory_MakeWindowAssociation(data->dxgiFactory, hwnd, DXGI_MWA_NO_WINDOW_CHANGES);
#else
SDL_SetError(__FUNCTION__ ", Unable to find something to attach a swap chain to");
goto done;

View File

@ -39,35 +39,14 @@ using namespace Windows::Graphics::Display;
#include <DXGI.h>
#include <SDL3/SDL_syswm.h>
#include "SDL_render_winrt.h"
extern "C" void *
D3D11_GetCoreWindowFromSDLRenderer(SDL_Renderer *renderer)
{
SDL_Window *sdlWindow = renderer->window;
if (renderer->window == NULL) {
return NULL;
}
SDL_SysWMinfo sdlWindowInfo;
if (SDL_GetWindowWMInfo(sdlWindow, &sdlWindowInfo, SDL_SYSWM_CURRENT_VERSION) < 0 ||
sdlWindowInfo.subsystem != SDL_SYSWM_WINRT) {
SDL_SetError("Couldn't get window handle");
return NULL;
}
if (sdlWindowInfo.subsystem != SDL_SYSWM_WINRT) {
return NULL;
}
if (!sdlWindowInfo.info.winrt.window) {
return NULL;
}
IInspectable *window = (IInspectable *)SDL_GetProperty(SDL_GetWindowProperties(renderer->window), "SDL.window.winrt.window");
ABI::Windows::UI::Core::ICoreWindow *coreWindow = NULL;
if (FAILED(sdlWindowInfo.info.winrt.window->QueryInterface(&coreWindow))) {
if (!window || FAILED(window->QueryInterface(&coreWindow))) {
return NULL;
}

View File

@ -32,8 +32,6 @@
#include "../SDL_sysrender.h"
#include "../SDL_d3dmath.h"
#include <SDL3/SDL_syswm.h>
#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
#include "SDL_render_d3d12_xbox.h"
#ifndef D3D12_TEXTURE_DATA_PITCH_ALIGNMENT
@ -1153,7 +1151,6 @@ static HRESULT D3D12_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata;
IDXGISwapChain1 *swapChain = NULL;
HRESULT result = S_OK;
SDL_SysWMinfo windowinfo;
/* Create a swap chain using the same adapter as the existing Direct3D device. */
DXGI_SWAP_CHAIN_DESC1 swapChainDesc;
@ -1175,16 +1172,11 @@ static HRESULT D3D12_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_FRAME_LATENCY_WAITABLE_OBJECT | /* To support SetMaximumFrameLatency */
DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING; /* To support presenting with allow tearing on */
if (SDL_GetWindowWMInfo(renderer->window, &windowinfo, SDL_SYSWM_CURRENT_VERSION) < 0 ||
windowinfo.subsystem != SDL_SYSWM_WINDOWS) {
SDL_SetError("Couldn't get window handle");
result = E_FAIL;
goto done;
}
HWND hwnd = (HWND)SDL_GetProperty(SDL_GetWindowProperties(renderer->window), "SDL.window.win32.hwnd");
result = D3D_CALL(data->dxgiFactory, CreateSwapChainForHwnd,
(IUnknown *)data->commandQueue,
windowinfo.info.win.window,
hwnd,
&swapChainDesc,
NULL,
NULL, /* Allow on all displays. */
@ -1194,7 +1186,7 @@ static HRESULT D3D12_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
goto done;
}
D3D_CALL(data->dxgiFactory, MakeWindowAssociation, windowinfo.info.win.window, DXGI_MWA_NO_WINDOW_CHANGES);
D3D_CALL(data->dxgiFactory, MakeWindowAssociation, hwnd, DXGI_MWA_NO_WINDOW_CHANGES);
result = D3D_CALL(swapChain, QueryInterface, D3D_GUID(SDL_IID_IDXGISwapChain4), (void **)&data->swapChain);
if (FAILED(result)) {

View File

@ -35,7 +35,6 @@
#ifdef SDL_VIDEO_DRIVER_UIKIT
#import <UIKit/UIKit.h>
#endif
#include <SDL3/SDL_syswm.h>
/* Regenerate these with build-metal-shaders.sh */
#ifdef __MACOS__
@ -160,20 +159,16 @@ typedef struct METAL_ShaderPipelines
@implementation METAL_TextureData
@end
static int IsMetalAvailable(const SDL_SysWMinfo *syswm)
static SDL_bool IsMetalAvailable()
{
if (syswm->subsystem != SDL_SYSWM_COCOA && syswm->subsystem != SDL_SYSWM_UIKIT) {
return SDL_SetError("Metal render target only supports Cocoa and UIKit video targets at the moment.");
}
// this checks a weak symbol.
#if (defined(__MACOS__) && (MAC_OS_X_VERSION_MIN_REQUIRED < 101100))
// this checks a weak symbol.
if (MTLCreateSystemDefaultDevice == NULL) { // probably on 10.10 or lower.
return SDL_SetError("Metal framework not available on this system");
SDL_SetError("Metal framework not available on this system");
return SDL_FALSE;
}
#endif
return 0;
return SDL_TRUE;
}
static const MTLBlendOperation invalidBlendOperation = (MTLBlendOperation)0xFFFFFFFF;
@ -1630,29 +1625,31 @@ static int METAL_SetVSync(SDL_Renderer *renderer, const int vsync)
static SDL_MetalView GetWindowView(SDL_Window *window)
{
SDL_SysWMinfo info;
if (SDL_GetWindowWMInfo(window, &info, SDL_SYSWM_CURRENT_VERSION) == 0) {
#ifdef SDL_ENABLE_SYSWM_COCOA
if (info.subsystem == SDL_SYSWM_COCOA) {
NSView *view = info.info.cocoa.window.contentView;
if (view.subviews.count > 0) {
view = view.subviews[0];
if (view.tag == SDL_METALVIEW_TAG) {
return (SDL_MetalView)CFBridgingRetain(view);
}
}
}
#endif
#ifdef SDL_ENABLE_SYSWM_UIKIT
if (info.subsystem == SDL_SYSWM_UIKIT) {
UIView *view = info.info.uikit.window.rootViewController.view;
if (view.tag == SDL_METALVIEW_TAG) {
#ifdef SDL_VIDEO_DRIVER_COCOA
NSWindow *nswindow = (__bridge NSWindow *)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.cocoa.window");
NSInteger tag = (NSInteger)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.cocoa.metal_view_tag");
if (nswindow) {
NSView *view = nswindow.contentView;
if (view.subviews.count > 0) {
view = view.subviews[0];
if (view.tag == tag) {
return (SDL_MetalView)CFBridgingRetain(view);
}
}
#endif
}
#endif
#ifdef SDL_VIDEO_DRIVER_UIKIT
UIWindow *uiwindow = (__bridge UIWindow *)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.uikit.window");
NSInteger tag = (NSInteger)SDL_GetProperty(SDL_GetWindowProperties(window), "SDL.window.uikit.metal_view_tag");
if (uiwindow) {
UIView *view = uiwindow.rootViewController.view;
if (view.tag == tag) {
return (SDL_MetalView)CFBridgingRetain(view);
}
}
#endif
return nil;
}
@ -1664,7 +1661,6 @@ static SDL_Renderer *METAL_CreateRenderer(SDL_Window *window, Uint32 flags)
id<MTLDevice> mtldevice = nil;
SDL_MetalView view = NULL;
CAMetalLayer *layer = nil;
SDL_SysWMinfo syswm;
NSError *err = nil;
dispatch_data_t mtllibdata;
char *constantdata;
@ -1740,11 +1736,7 @@ static SDL_Renderer *METAL_CreateRenderer(SDL_Window *window, Uint32 flags)
1.0000, 1.7720, 0.0000, 0.0, /* Bcoeff */
};
if (SDL_GetWindowWMInfo(window, &syswm, SDL_SYSWM_CURRENT_VERSION) < 0) {
return NULL;
}
if (IsMetalAvailable(&syswm) == -1) {
if (!IsMetalAvailable()) {
return NULL;
}

View File

@ -151,9 +151,6 @@ struct SDL_VideoDisplay
SDL_DisplayData *driverdata;
};
/* Forward declaration */
struct SDL_SysWMinfo;
/* Video device flags */
typedef enum
{
@ -267,9 +264,6 @@ struct SDL_VideoDevice
*/
SDL_ShapeDriver shape_driver;
/* Get some platform dependent window information */
int (*GetWindowWMInfo)(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
/* * * */
/*
* OpenGL support

View File

@ -32,8 +32,6 @@
#include "../events/SDL_events_c.h"
#include "../timer/SDL_timer_c.h"
#include <SDL3/SDL_syswm.h>
#ifdef SDL_VIDEO_OPENGL
#include <SDL3/SDL_opengl.h>
#endif /* SDL_VIDEO_OPENGL */
@ -4671,33 +4669,6 @@ void SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask)
}
#endif
int SDL_GetWindowWMInfo(SDL_Window *window, struct SDL_SysWMinfo *info, Uint32 version)
{
CHECK_WINDOW_MAGIC(window, -1);
if (info == NULL) {
return SDL_InvalidParamError("info");
}
/* Set the version in the structure to the minimum of our version and the application expected version */
version = SDL_min(version, SDL_SYSWM_CURRENT_VERSION);
if (version == 1) {
SDL_memset(info, 0, SDL_SYSWM_INFO_SIZE_V1);
} else {
return SDL_SetError("Unknown info version");
}
info->subsystem = SDL_SYSWM_UNKNOWN;
info->version = version;
if (_this->GetWindowWMInfo) {
return (_this->GetWindowWMInfo(_this, window, info));
} else {
return 0;
}
}
void SDL_StartTextInput(void)
{
SDL_Window *window;
@ -4827,20 +4798,6 @@ int SDL_GetMessageBoxCount(void)
#include "vita/SDL_vitamessagebox.h"
#endif
#if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_WINRT) || defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT) || defined(SDL_VIDEO_DRIVER_X11) || defined(SDL_VIDEO_DRIVER_WAYLAND) || defined(SDL_VIDEO_DRIVER_HAIKU) || defined(SDL_VIDEO_DRIVER_RISCOS)
static SDL_bool SDL_IsMessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype)
{
SDL_SysWMinfo info;
SDL_Window *window = messageboxdata->window;
if (window == NULL || SDL_GetWindowWMInfo(window, &info, SDL_SYSWM_CURRENT_VERSION) < 0) {
return SDL_TRUE;
} else {
return info.subsystem == (Uint32)drivertype;
}
}
#endif
int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
{
int dummybutton;
@ -4894,56 +4851,48 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
#endif
#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
if (retval == -1 &&
SDL_IsMessageboxValidForDriver(messageboxdata, SDL_SYSWM_WINDOWS) &&
WIN_ShowMessageBox(messageboxdata, buttonid) == 0) {
retval = 0;
}
#endif
#ifdef SDL_VIDEO_DRIVER_WINRT
if (retval == -1 &&
SDL_IsMessageboxValidForDriver(messageboxdata, SDL_SYSWM_WINRT) &&
WINRT_ShowMessageBox(messageboxdata, buttonid) == 0) {
retval = 0;
}
#endif
#ifdef SDL_VIDEO_DRIVER_COCOA
if (retval == -1 &&
SDL_IsMessageboxValidForDriver(messageboxdata, SDL_SYSWM_COCOA) &&
Cocoa_ShowMessageBox(messageboxdata, buttonid) == 0) {
retval = 0;
}
#endif
#ifdef SDL_VIDEO_DRIVER_UIKIT
if (retval == -1 &&
SDL_IsMessageboxValidForDriver(messageboxdata, SDL_SYSWM_UIKIT) &&
UIKit_ShowMessageBox(messageboxdata, buttonid) == 0) {
retval = 0;
}
#endif
#ifdef SDL_VIDEO_DRIVER_WAYLAND
if (retval == -1 &&
SDL_IsMessageboxValidForDriver(messageboxdata, SDL_SYSWM_WAYLAND) &&
Wayland_ShowMessageBox(messageboxdata, buttonid) == 0) {
retval = 0;
}
#endif
#ifdef SDL_VIDEO_DRIVER_X11
if (retval == -1 &&
SDL_IsMessageboxValidForDriver(messageboxdata, SDL_SYSWM_X11) &&
X11_ShowMessageBox(messageboxdata, buttonid) == 0) {
retval = 0;
}
#endif
#ifdef SDL_VIDEO_DRIVER_HAIKU
if (retval == -1 &&
SDL_IsMessageboxValidForDriver(messageboxdata, SDL_SYSWM_HAIKU) &&
HAIKU_ShowMessageBox(messageboxdata, buttonid) == 0) {
retval = 0;
}
#endif
#ifdef SDL_VIDEO_DRIVER_RISCOS
if (retval == -1 &&
SDL_IsMessageboxValidForDriver(messageboxdata, SDL_SYSWM_RISCOS) &&
RISCOS_ShowMessageBox(messageboxdata, buttonid) == 0) {
retval = 0;
}

View File

@ -117,7 +117,6 @@ static SDL_VideoDevice *Android_CreateDevice(void)
device->MinimizeWindow = Android_MinimizeWindow;
device->SetWindowResizable = Android_SetWindowResizable;
device->DestroyWindow = Android_DestroyWindow;
device->GetWindowWMInfo = Android_GetWindowWMInfo;
device->free = Android_DeleteDevice;

View File

@ -35,7 +35,6 @@
#include "SDL_androidvulkan.h"
#include <SDL3/SDL_syswm.h>
int Android_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path)
{

View File

@ -31,7 +31,6 @@
#include "SDL_androidvideo.h"
#include "SDL_androidwindow.h"
#include <SDL3/SDL_syswm.h>
/* Currently only one window */
SDL_Window *Android_Window = NULL;
@ -68,12 +67,12 @@ int Android_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
}
data->native_window = Android_JNI_GetNativeWindow();
if (!data->native_window) {
SDL_free(data);
retval = SDL_SetError("Could not fetch native window");
goto endfunction;
}
SDL_SetProperty(SDL_GetWindowProperties(window), "SDL.window.android.window", data->native_window);
/* Do not create EGLSurface for Vulkan window since it will then make the window
incompatible with vkCreateAndroidSurfaceKHR */
@ -88,6 +87,7 @@ int Android_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
goto endfunction;
}
}
SDL_SetProperty(SDL_GetWindowProperties(window), "SDL.window.android.surface", data->egl_surface);
#endif
window->driverdata = data;
@ -194,18 +194,4 @@ void Android_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
SDL_UnlockMutex(Android_ActivityMutex);
}
int Android_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, SDL_SysWMinfo *info)
{
SDL_WindowData *data = window->driverdata;
info->subsystem = SDL_SYSWM_ANDROID;
info->info.android.window = data->native_window;
#ifdef SDL_VIDEO_OPENGL_EGL
info->info.android.surface = data->egl_surface;
#endif
return 0;
}
#endif /* SDL_VIDEO_DRIVER_ANDROID */

View File

@ -33,7 +33,6 @@ extern void Android_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window);
extern void Android_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool resizable);
extern void Android_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
extern int Android_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
extern SDL_Window *Android_Window;
struct SDL_WindowData

View File

@ -30,8 +30,6 @@
#if defined(SDL_VIDEO_DRIVER_COCOA) && (defined(SDL_VIDEO_VULKAN) || defined(SDL_VIDEO_METAL))
#include <SDL3/SDL_syswm.h>
static int SDLCALL SDL_MetalViewEventWatch(void *userdata, SDL_Event *event)
{
/* Update the drawable size when SDL receives a size changed event for

View File

@ -115,7 +115,6 @@ static SDL_VideoDevice *Cocoa_CreateDevice(void)
device->SetWindowMouseGrab = Cocoa_SetWindowMouseGrab;
device->SetWindowKeyboardGrab = Cocoa_SetWindowKeyboardGrab;
device->DestroyWindow = Cocoa_DestroyWindow;
device->GetWindowWMInfo = Cocoa_GetWindowWMInfo;
device->SetWindowHitTest = Cocoa_SetWindowHitTest;
device->AcceptDragAndDrop = Cocoa_AcceptDragAndDrop;
device->FlashWindow = Cocoa_FlashWindow;

View File

@ -33,8 +33,6 @@
#include "SDL_cocoametalview.h"
#include "SDL_cocoavulkan.h"
#include <SDL3/SDL_syswm.h>
#include <dlfcn.h>
const char *defaultPaths[] = {

View File

@ -29,6 +29,8 @@
#include "../SDL_egl_c.h"
#endif
#define SDL_METALVIEW_TAG 255
@class SDL_CocoaWindowData;
typedef enum
@ -165,7 +167,6 @@ extern SDL_DisplayID Cocoa_GetDisplayForWindow(SDL_VideoDevice *_this, SDL_Windo
extern void Cocoa_SetWindowMouseRect(SDL_VideoDevice *_this, SDL_Window *window);
extern void Cocoa_SetWindowMouseGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed);
extern void Cocoa_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
extern int Cocoa_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
extern int Cocoa_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
extern void Cocoa_AcceptDragAndDrop(SDL_Window *window, SDL_bool accept);
extern int Cocoa_FlashWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOperation operation);

View File

@ -41,7 +41,6 @@
#include "SDL_cocoaopengl.h"
#include "SDL_cocoaopengles.h"
#include <SDL3/SDL_syswm.h>
/* #define DEBUG_COCOAWINDOW */
@ -1863,6 +1862,10 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, NSWindow
*/
[nswindow setOneShot:NO];
SDL_PropertiesID props = SDL_GetWindowProperties(window);
SDL_SetProperty(props, "SDL.window.cocoa.window", (__bridge void *)data.nswindow);
SDL_SetProperty(props, "SDL.window.cocoa.metal_view_tag", SDL_METALVIEW_TAG);
/* All done! */
window->driverdata = (SDL_WindowData *)CFBridgingRetain(data);
return 0;
@ -2580,17 +2583,6 @@ void Cocoa_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
}
}
int Cocoa_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, SDL_SysWMinfo *info)
{
@autoreleasepool {
NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)window->driverdata).nswindow;
info->subsystem = SDL_SYSWM_COCOA;
info->info.cocoa.window = nswindow;
return 0;
}
}
SDL_bool Cocoa_IsWindowInFullscreenSpace(SDL_Window *window)
{
@autoreleasepool {

View File

@ -29,8 +29,6 @@ extern "C" {
#include "SDL_internal.h"
#include "SDL_bframebuffer.h"
#include <SDL3/SDL_syswm.h>
#ifdef __cplusplus
}
#endif

View File

@ -91,7 +91,6 @@ static SDL_VideoDevice * HAIKU_CreateDevice(void)
device->SetWindowMouseGrab = HAIKU_SetWindowMouseGrab;
device->SetWindowMinimumSize = HAIKU_SetWindowMinimumSize;
device->DestroyWindow = HAIKU_DestroyWindow;
device->GetWindowWMInfo = HAIKU_GetWindowWMInfo;
device->CreateWindowFramebuffer = HAIKU_CreateWindowFramebuffer;
device->UpdateWindowFramebuffer = HAIKU_UpdateWindowFramebuffer;
device->DestroyWindowFramebuffer = HAIKU_DestroyWindowFramebuffer;

View File

@ -26,8 +26,6 @@
#include "SDL_BWin.h"
#include <new>
#include <SDL3/SDL_syswm.h>
/* Define a path to window's BWIN data */
#ifdef __cplusplus
extern "C" {
@ -211,13 +209,6 @@ void HAIKU_DestroyWindow(SDL_VideoDevice *_this, SDL_Window * window) {
window->driverdata = NULL;
}
int HAIKU_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info)
{
info->subsystem = SDL_SYSWM_HAIKU;
return 0;
}
#ifdef __cplusplus
}
#endif

View File

@ -41,6 +41,5 @@ extern void HAIKU_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window,
extern void HAIKU_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen);
extern void HAIKU_SetWindowMouseGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed);
extern void HAIKU_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
extern int HAIKU_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
#endif

View File

@ -35,8 +35,6 @@
#include "../../core/openbsd/SDL_wscons.h"
#endif
#include <SDL3/SDL_syswm.h>
/* KMS/DRM declarations */
#include "SDL_kmsdrmdyn.h"
#include "SDL_kmsdrmevents.h"
@ -295,7 +293,6 @@ static SDL_VideoDevice *KMSDRM_CreateDevice(void)
device->MinimizeWindow = KMSDRM_MinimizeWindow;
device->RestoreWindow = KMSDRM_RestoreWindow;
device->DestroyWindow = KMSDRM_DestroyWindow;
device->GetWindowWMInfo = KMSDRM_GetWindowWMInfo;
device->GL_LoadLibrary = KMSDRM_GLES_LoadLibrary;
device->GL_GetProcAddress = KMSDRM_GLES_GetProcAddress;
@ -1437,6 +1434,11 @@ int KMSDRM_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
windata->viddata = viddata;
window->driverdata = windata;
SDL_PropertiesID props = SDL_GetWindowProperties(window);
SDL_SetProperty(props, "SDL.window.kmsdrm.dev_index", (void *)(intptr_t)viddata->devindex);
SDL_SetProperty(props, "SDL.window.kmsdrm.drm_fd", (void *)(intptr_t)viddata->drm_fd);
SDL_SetProperty(props, "SDL.window.kmsdrm.gbm_dev", viddata->gbm_dev);
if (!is_vulkan && !vulkan_mode) { /* NON-Vulkan block. */
/* Maybe you didn't ask for an OPENGL window, but that's what you will get.
@ -1595,19 +1597,4 @@ void KMSDRM_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window)
{
}
/*****************************************************************************/
/* SDL Window Manager function */
/*****************************************************************************/
int KMSDRM_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info)
{
SDL_VideoData *viddata = _this->driverdata;
info->subsystem = SDL_SYSWM_KMSDRM;
info->info.kmsdrm.dev_index = viddata->devindex;
info->info.kmsdrm.drm_fd = viddata->drm_fd;
info->info.kmsdrm.gbm_dev = viddata->gbm_dev;
return 0;
}
#endif /* SDL_VIDEO_DRIVER_KMSDRM */

View File

@ -135,9 +135,6 @@ void KMSDRM_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window);
void KMSDRM_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window);
void KMSDRM_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
/* Window manager function */
int KMSDRM_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
/* OpenGL/OpenGL ES functions */
int KMSDRM_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path);
SDL_FunctionPointer KMSDRM_GLES_GetProcAddress(SDL_VideoDevice *_this, const char *proc);

View File

@ -34,8 +34,6 @@
#include "SDL_kmsdrmdyn.h"
#include "SDL_kmsdrmvulkan.h"
#include <SDL3/SDL_syswm.h>
#include <sys/ioctl.h>
#ifdef __OpenBSD__

View File

@ -24,8 +24,6 @@
#include "../SDL_sysvideo.h"
#include <SDL3/SDL_syswm.h>
#include "SDL_ngagevideo.h"
typedef struct
@ -34,10 +32,7 @@ typedef struct
} NGAGE_Window;
extern int
NGAGE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window);
extern void
NGAGE_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
extern int NGAGE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window);
extern void NGAGE_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
#endif /* SDL_ngagewindow */

View File

@ -28,8 +28,6 @@
#include "../../events/SDL_mouse_c.h"
#include "../../events/SDL_keyboard_c.h"
#include <SDL3/SDL_syswm.h>
/* PSP declarations */
#include "SDL_pspvideo.h"
#include "SDL_pspevents_c.h"

View File

@ -35,8 +35,6 @@
#include "../../events/SDL_mouse_c.h"
#include "../../events/SDL_keyboard_c.h"
#include <SDL3/SDL_syswm.h>
#ifdef SDL_INPUT_LINUXEV
#include "../../core/linux/SDL_evdev.h"
#endif

View File

@ -79,7 +79,6 @@ static SDL_VideoDevice *RISCOS_CreateDevice(void)
device->CreateSDLWindow = RISCOS_CreateWindow;
device->DestroyWindow = RISCOS_DestroyWindow;
device->GetWindowWMInfo = RISCOS_GetWindowWMInfo;
device->CreateWindowFramebuffer = RISCOS_CreateWindowFramebuffer;
device->UpdateWindowFramebuffer = RISCOS_UpdateWindowFramebuffer;

View File

@ -25,8 +25,6 @@
#include "../SDL_sysvideo.h"
#include "../../events/SDL_mouse_c.h"
#include <SDL3/SDL_syswm.h>
#include "SDL_riscosvideo.h"
#include "SDL_riscoswindow.h"
@ -61,10 +59,4 @@ void RISCOS_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
window->driverdata = NULL;
}
int RISCOS_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info)
{
info->subsystem = SDL_SYSWM_RISCOS;
return 0;
}
#endif /* SDL_VIDEO_DRIVER_RISCOS */

View File

@ -34,6 +34,5 @@ struct SDL_WindowData
extern int RISCOS_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window);
extern void RISCOS_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
extern int RISCOS_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
#endif /* SDL_riscoswindow_h_ */

View File

@ -35,8 +35,6 @@
#import "SDL_uikitwindow.h"
#import "SDL_uikitmetalview.h"
#include <SDL3/SDL_syswm.h>
@implementation SDL_uikitmetalview
/* Returns a Metal-compatible layer. */

View File

@ -94,7 +94,6 @@ static SDL_VideoDevice *UIKit_CreateDevice(void)
device->SetWindowFullscreen = UIKit_SetWindowFullscreen;
device->SetWindowMouseGrab = UIKit_SetWindowMouseGrab;
device->DestroyWindow = UIKit_DestroyWindow;
device->GetWindowWMInfo = UIKit_GetWindowWMInfo;
device->GetDisplayUsableBounds = UIKit_GetDisplayUsableBounds;
device->GetWindowSizeInPixels = UIKit_GetWindowSizeInPixels;

View File

@ -34,8 +34,6 @@
#include "SDL_uikitvulkan.h"
#include "SDL_uikitmetalview.h"
#include <SDL3/SDL_syswm.h>
#include <dlfcn.h>
const char *defaultPaths[] = {

View File

@ -37,10 +37,11 @@ extern void UIKit_SetWindowMouseGrab(SDL_VideoDevice *_this, SDL_Window *window,
extern void UIKit_UpdatePointerLock(SDL_VideoDevice *_this, SDL_Window *window);
extern void UIKit_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
extern void UIKit_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int *w, int *h);
extern int UIKit_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
extern NSUInteger UIKit_GetSupportedOrientations(SDL_Window *window);
#define SDL_METALVIEW_TAG 255
@class UIWindow;
@interface SDL_UIKitWindowData : NSObject

View File

@ -34,8 +34,6 @@
#include "SDL_uikitview.h"
#include "SDL_uikitopenglview.h"
#include <SDL3/SDL_syswm.h>
#include <Foundation/Foundation.h>
@implementation SDL_UIKitWindowData
@ -155,6 +153,10 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, UIWindow
* hierarchy. */
[view setSDLWindow:window];
SDL_PropertiesID props = SDL_GetWindowProperties(window);
SDL_SetProperty(props, "SDL.window.uikit.window", (__bridge void *)data.uiwindow);
SDL_SetProperty(props, "SDL.window.uikit.metal_view_tag", SDL_METALVIEW_TAG);
return 0;
}
@ -385,26 +387,6 @@ void UIKit_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int
}
}
int UIKit_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, SDL_SysWMinfo *info)
{
@autoreleasepool {
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->driverdata;
info->subsystem = SDL_SYSWM_UIKIT;
info->info.uikit.window = data.uiwindow;
#if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2)
if ([data.viewcontroller.view isKindOfClass:[SDL_uikitopenglview class]]) {
SDL_uikitopenglview *glview = (SDL_uikitopenglview *)data.viewcontroller.view;
info->info.uikit.framebuffer = glview.drawableFramebuffer;
info->info.uikit.colorbuffer = glview.drawableRenderbuffer;
info->info.uikit.resolveFramebuffer = glview.msaaResolveFramebuffer;
}
#endif
return 0;
}
}
#if !TARGET_OS_TV
NSUInteger
UIKit_GetSupportedOrientations(SDL_Window *window)

View File

@ -28,8 +28,6 @@
#include "../../events/SDL_mouse_c.h"
#include "../../events/SDL_keyboard_c.h"
#include <SDL3/SDL_syswm.h>
/* VITA declarations */
#include <psp2/kernel/processmgr.h>
#include "SDL_vitavideo.h"

View File

@ -26,8 +26,6 @@
#include "../SDL_sysvideo.h"
#include "../../events/SDL_events_c.h"
#include <SDL3/SDL_syswm.h>
#ifdef SDL_INPUT_LINUXEV
#include "../../core/linux/SDL_evdev.h"
#endif
@ -81,7 +79,6 @@ static SDL_VideoDevice *VIVANTE_Create()
device->ShowWindow = VIVANTE_ShowWindow;
device->HideWindow = VIVANTE_HideWindow;
device->DestroyWindow = VIVANTE_DestroyWindow;
device->GetWindowWMInfo = VIVANTE_GetWindowWMInfo;
#ifdef SDL_VIDEO_OPENGL_EGL
device->GL_LoadLibrary = VIVANTE_GLES_LoadLibrary;
@ -258,6 +255,9 @@ int VIVANTE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
/* Setup driver data for this window */
window->driverdata = data;
SDL_PropertiesID props = SDL_GetWindowProperties(window);
SDL_SetProperty(props, "SDL.window.vivante.display", displaydata->native_display);
#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK
data->native_window = vdkCreateWindow(displaydata->native_display, window->x, window->y, window->w, window->h);
#else
@ -266,6 +266,7 @@ int VIVANTE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
if (!data->native_window) {
return SDL_SetError("VIVANTE: Can't create native window");
}
SDL_SetProperty(props, "SDL.window.vivante.window", data->native_window);
#ifdef SDL_VIDEO_OPENGL_EGL
if (window->flags & SDL_WINDOW_OPENGL) {
@ -276,6 +277,7 @@ int VIVANTE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
} else {
data->egl_surface = EGL_NO_SURFACE;
}
SDL_SetProperty(props, "SDL.window.vivante.surface", data->egl_surface);
#endif
/* Window has been successfully created */
@ -347,20 +349,6 @@ void VIVANTE_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
SDL_SetKeyboardFocus(NULL);
}
/*****************************************************************************/
/* SDL Window Manager function */
/*****************************************************************************/
int VIVANTE_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info)
{
SDL_WindowData *data = window->driverdata;
SDL_DisplayData *displaydata = SDL_GetDisplayDriverData(SDL_GetPrimaryDisplay());
info->subsystem = SDL_SYSWM_VIVANTE;
info->info.vivante.display = displaydata->native_display;
info->info.vivante.window = data->native_window;
return 0;
}
/*****************************************************************************/
/* SDL event functions */
/*****************************************************************************/

View File

@ -80,9 +80,6 @@ void VIVANTE_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window);
void VIVANTE_HideWindow(SDL_VideoDevice *_this, SDL_Window *window);
void VIVANTE_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
/* Window manager function */
int VIVANTE_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
/* Event functions */
void VIVANTE_PumpEvents(SDL_VideoDevice *_this);

View File

@ -33,7 +33,6 @@
#include "SDL_vivantevideo.h"
#include "SDL_vivantevulkan.h"
#include <SDL3/SDL_syswm.h>
int VIVANTE_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path)
{

View File

@ -174,7 +174,6 @@ static SDL_VideoDevice *Wayland_CreateDevice(void)
device->VideoInit = Wayland_VideoInit;
device->VideoQuit = Wayland_VideoQuit;
device->GetDisplayBounds = Wayland_GetDisplayBounds;
device->GetWindowWMInfo = Wayland_GetWindowWMInfo;
device->SuspendScreenSaver = Wayland_SuspendScreenSaver;
device->PumpEvents = Wayland_PumpEvents;

View File

@ -36,8 +36,6 @@
#include "../SDL_vulkan_internal.h"
#include "SDL_waylandvulkan.h"
#include <SDL3/SDL_syswm.h>
#ifdef __OpenBSD__
#define DEFAULT_VULKAN "libvulkan.so"
#else

View File

@ -1301,37 +1301,6 @@ static void SetKeyboardFocus(SDL_Window *window)
SDL_SetKeyboardFocus(window);
}
int Wayland_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, SDL_SysWMinfo *info)
{
SDL_VideoData *viddata = _this->driverdata;
SDL_WindowData *data = window->driverdata;
info->subsystem = SDL_SYSWM_WAYLAND;
info->info.wl.display = data->waylandData->display;
info->info.wl.surface = data->surface;
info->info.wl.egl_window = data->egl_window;
#ifdef HAVE_LIBDECOR_H
if (data->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) {
if (data->shell_surface.libdecor.frame != NULL) {
info->info.wl.xdg_surface = libdecor_frame_get_xdg_surface(data->shell_surface.libdecor.frame);
info->info.wl.xdg_toplevel = libdecor_frame_get_xdg_toplevel(data->shell_surface.libdecor.frame);
}
} else
#endif
if (viddata->shell.xdg && data->shell_surface.xdg.surface != NULL) {
SDL_bool popup = (data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP);
info->info.wl.xdg_surface = data->shell_surface.xdg.surface;
info->info.wl.xdg_toplevel = popup ? NULL : data->shell_surface.xdg.roleobj.toplevel;
if (popup) {
info->info.wl.xdg_popup = data->shell_surface.xdg.roleobj.popup.popup;
info->info.wl.xdg_positioner = data->shell_surface.xdg.roleobj.popup.positioner;
}
}
return 0;
}
int Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
{
return 0; /* just succeed, the real work is done elsewhere. */
@ -1380,6 +1349,7 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
{
SDL_VideoData *c = _this->driverdata;
SDL_WindowData *data = window->driverdata;
SDL_PropertiesID props = SDL_GetWindowProperties(window);
/* If this is a child window, the parent *must* be in the final shown state,
* meaning that it has received a configure event, followed by a frame callback.
@ -1427,13 +1397,17 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
} else {
libdecor_frame_set_app_id(data->shell_surface.libdecor.frame, data->app_id);
libdecor_frame_map(data->shell_surface.libdecor.frame);
SDL_SetProperty(props, "SDL.window.wayland.xdg_surface", libdecor_frame_get_xdg_surface(data->shell_surface.libdecor.frame));
SDL_SetProperty(props, "SDL.window.wayland.xdg_toplevel", libdecor_frame_get_xdg_toplevel(data->shell_surface.libdecor.frame));
}
} else
#endif
if ((data->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL || data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) && c->shell.xdg) {
if ((data->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL || data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) && c->shell.xdg) {
data->shell_surface.xdg.surface = xdg_wm_base_get_xdg_surface(c->shell.xdg, data->surface);
xdg_surface_set_user_data(data->shell_surface.xdg.surface, data);
xdg_surface_add_listener(data->shell_surface.xdg.surface, &shell_surface_listener_xdg, data);
SDL_SetProperty(SDL_GetWindowProperties(window), "SDL.window.wayland.xdg_surface", data->shell_surface.xdg.surface);
if (data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) {
SDL_Window *parent = window->parent;
@ -1485,10 +1459,14 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
SetKeyboardFocus(window);
}
}
SDL_SetProperty(props, "SDL.window.wayland.xdg_popup", data->shell_surface.xdg.roleobj.popup.popup);
SDL_SetProperty(props, "SDL.window.wayland.xdg_positioner", data->shell_surface.xdg.roleobj.popup.positioner);
} else {
data->shell_surface.xdg.roleobj.toplevel = xdg_surface_get_toplevel(data->shell_surface.xdg.surface);
xdg_toplevel_set_app_id(data->shell_surface.xdg.roleobj.toplevel, data->app_id);
xdg_toplevel_add_listener(data->shell_surface.xdg.roleobj.toplevel, &toplevel_listener_xdg, data);
SDL_SetProperty(props, "SDL.window.wayland.xdg_toplevel", data->shell_surface.xdg.roleobj.toplevel);
}
}
@ -1624,12 +1602,17 @@ static void Wayland_ReleasePopup(SDL_VideoDevice *_this, SDL_Window *popup)
xdg_positioner_destroy(popupdata->shell_surface.xdg.roleobj.popup.positioner);
popupdata->shell_surface.xdg.roleobj.popup.popup = NULL;
popupdata->shell_surface.xdg.roleobj.popup.positioner = NULL;
SDL_PropertiesID props = SDL_GetWindowProperties(popup);
SDL_SetProperty(props, "SDL.window.wayland.xdg_popup", NULL);
SDL_SetProperty(props, "SDL.window.wayland.xdg_positioner", NULL);
}
void Wayland_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
{
SDL_VideoData *data = _this->driverdata;
SDL_WindowData *wind = window->driverdata;
SDL_PropertiesID props = SDL_GetWindowProperties(window);
wind->surface_status = WAYLAND_SURFACE_STATUS_HIDDEN;
@ -1649,19 +1632,24 @@ void Wayland_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
if (wind->shell_surface.libdecor.frame) {
libdecor_frame_unref(wind->shell_surface.libdecor.frame);
wind->shell_surface.libdecor.frame = NULL;
SDL_SetProperty(props, "SDL.window.wayland.xdg_surface", NULL);
SDL_SetProperty(props, "SDL.window.wayland.xdg_toplevel", NULL);
}
} else
#endif
if (data->shell.xdg) {
if (data->shell.xdg) {
if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) {
Wayland_ReleasePopup(_this, window);
} else if (wind->shell_surface.xdg.roleobj.toplevel) {
xdg_toplevel_destroy(wind->shell_surface.xdg.roleobj.toplevel);
wind->shell_surface.xdg.roleobj.toplevel = NULL;
SDL_SetProperty(props, "SDL.window.wayland.xdg_toplevel", NULL);
}
if (wind->shell_surface.xdg.surface) {
xdg_surface_destroy(wind->shell_surface.xdg.surface);
wind->shell_surface.xdg.surface = NULL;
SDL_SetProperty(props, "SDL.window.wayland.xdg_surface", NULL);
}
}
@ -2109,6 +2097,11 @@ int Wayland_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
}
} /* All other cases will be WAYLAND_SURFACE_UNKNOWN */
SDL_PropertiesID props = SDL_GetWindowProperties(window);
SDL_SetProperty(props, "SDL.window.wayland.display", data->waylandData->display);
SDL_SetProperty(props, "SDL.window.wayland.surface", data->surface);
SDL_SetProperty(props, "SDL.window.wayland.egl_window", data->egl_window);
return 0;
}

View File

@ -27,8 +27,6 @@
#include "../SDL_sysvideo.h"
#include "../../events/SDL_touch_c.h"
#include <SDL3/SDL_syswm.h>
#include "SDL_waylandvideo.h"
struct SDL_WaylandInput;
@ -151,7 +149,6 @@ extern void Wayland_ShowWindowSystemMenu(SDL_Window *window, int x, int y);
extern void Wayland_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
extern int Wayland_SuspendScreenSaver(SDL_VideoDevice *_this);
extern int Wayland_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, SDL_SysWMinfo *info);
extern int Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
extern int Wayland_FlashWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOperation operation);

View File

@ -29,8 +29,6 @@
#include "../../events/SDL_touch_c.h"
#include "../../events/scancodes_windows.h"
#include <SDL3/SDL_syswm.h>
/* Dropfile support */
#include <shellapi.h>
@ -715,19 +713,6 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
SDL_WindowData *data;
LRESULT returnCode = -1;
/* Send a SDL_EVENT_SYSWM if the application wants them */
if (SDL_EventEnabled(SDL_EVENT_SYSWM)) {
SDL_SysWMmsg wmmsg;
wmmsg.version = SDL_SYSWM_CURRENT_VERSION;
wmmsg.subsystem = SDL_SYSWM_WINDOWS;
wmmsg.msg.win.hwnd = hwnd;
wmmsg.msg.win.msg = msg;
wmmsg.msg.win.wParam = wParam;
wmmsg.msg.win.lParam = lParam;
SDL_SendSysWMEvent(&wmmsg);
}
/* Get the window data for the window */
data = WIN_GetWindowDataFromHWND(hwnd);
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
@ -1809,7 +1794,9 @@ int WIN_WaitEventTimeout(SDL_VideoDevice *_this, Sint64 timeoutNS)
return 0;
}
if (g_WindowsMessageHook) {
g_WindowsMessageHook(g_WindowsMessageHookData, msg.hwnd, msg.message, msg.wParam, msg.lParam);
if (!g_WindowsMessageHook(g_WindowsMessageHookData, &msg)) {
return 1;
}
}
/* Always translate the message in case it's a non-SDL window (e.g. with Qt integration) */
TranslateMessage(&msg);
@ -1845,7 +1832,9 @@ void WIN_PumpEvents(SDL_VideoDevice *_this)
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
if (g_WindowsMessageHook) {
g_WindowsMessageHook(g_WindowsMessageHookData, msg.hwnd, msg.message, msg.wParam, msg.lParam);
if (!g_WindowsMessageHook(g_WindowsMessageHookData, &msg)) {
continue;
}
}
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)

View File

@ -201,7 +201,6 @@ static SDL_VideoDevice *WIN_CreateDevice(void)
device->SetWindowKeyboardGrab = WIN_SetWindowKeyboardGrab;
#endif
device->DestroyWindow = WIN_DestroyWindow;
device->GetWindowWMInfo = WIN_GetWindowWMInfo;
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
device->CreateWindowFramebuffer = WIN_CreateWindowFramebuffer;
device->UpdateWindowFramebuffer = WIN_UpdateWindowFramebuffer;

View File

@ -35,8 +35,6 @@
#include "SDL_windowsvulkan.h"
#include <SDL3/SDL_syswm.h>
int WIN_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path)
{
VkExtensionProperties *extensions = NULL;

View File

@ -38,8 +38,6 @@
/* Dropfile support */
#include <shellapi.h>
#include <SDL3/SDL_syswm.h>
/* Dark mode support */
#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE
#define DWMWA_USE_IMMERSIVE_DARK_MODE 20
@ -440,6 +438,11 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, HWND hwnd
data->initializing = SDL_FALSE;
SDL_PropertiesID props = SDL_GetWindowProperties(window);
SDL_SetProperty(props, "SDL.window.win32.hwnd", data->hwnd);
SDL_SetProperty(props, "SDL.window.win32.hdc", data->hdc);
SDL_SetProperty(props, "SDL.window.win32.instance", data->hinstance);
/* All done! */
return 0;
}
@ -1250,18 +1253,6 @@ void WIN_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
CleanupWindowData(_this, window);
}
int WIN_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, SDL_SysWMinfo *info)
{
const SDL_WindowData *data = (const SDL_WindowData *)window->driverdata;
info->subsystem = SDL_SYSWM_WINDOWS;
info->info.win.window = data->hwnd;
info->info.win.hdc = data->hdc;
info->info.win.hinstance = data->hinstance;
return 0;
}
/*
* Creates a HelperWindow used for DirectInput.
*/

View File

@ -100,7 +100,6 @@ extern void WIN_SetWindowMouseRect(SDL_VideoDevice *_this, SDL_Window *window);
extern void WIN_SetWindowMouseGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed);
extern void WIN_SetWindowKeyboardGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed);
extern void WIN_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
extern int WIN_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
extern void WIN_OnWindowEnter(SDL_VideoDevice *_this, SDL_Window *window);
extern void WIN_UpdateClipCursor(SDL_Window *window);
extern int WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);

View File

@ -67,8 +67,6 @@ extern "C" {
#include "SDL_winrtmouse_c.h"
#include "SDL_winrtvideo_cpp.h"
#include <SDL3/SDL_syswm.h>
/* Initialization/Query functions */
static int WINRT_VideoInit(SDL_VideoDevice *_this);
static int WINRT_InitModes(SDL_VideoDevice *_this);
@ -80,7 +78,6 @@ static int WINRT_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window);
static void WINRT_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window);
static void WINRT_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen);
static void WINRT_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
static int WINRT_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, SDL_SysWMinfo *info);
/* Misc functions */
static ABI::Windows::System::Display::IDisplayRequest *WINRT_CreateDisplayRequest(SDL_VideoDevice *_this);
@ -133,7 +130,6 @@ static SDL_VideoDevice *WINRT_CreateDevice(void)
device->DestroyWindow = WINRT_DestroyWindow;
device->SetDisplayMode = WINRT_SetDisplayMode;
device->PumpEvents = WINRT_PumpEvents;
device->GetWindowWMInfo = WINRT_GetWindowWMInfo;
device->SuspendScreenSaver = WINRT_SuspendScreenSaver;
#if NTDDI_VERSION >= NTDDI_WIN10
@ -612,6 +608,7 @@ int WINRT_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
data->appView = ApplicationView::GetForCurrentView();
#endif
}
SDL_SetProperty(SDL_GetWindowProperties(window), "SDL.window.winrt.window", reinterpret_cast<IInspectable *>(data->coreWindow.Get()));
/* Make note of the requested window flags, before they start getting changed. */
const Uint32 requestedFlags = window->flags;
@ -779,15 +776,6 @@ void WINRT_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
}
}
int WINRT_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, SDL_SysWMinfo *info)
{
SDL_WindowData *data = window->driverdata;
info->subsystem = SDL_SYSWM_WINRT;
info->info.winrt.window = reinterpret_cast<IInspectable *>(data->coreWindow.Get());
return 0;
}
static ABI::Windows::System::Display::IDisplayRequest *WINRT_CreateDisplayRequest(SDL_VideoDevice *_this)
{
/* Setup a WinRT DisplayRequest object, usable for enabling/disabling screensaver requests */

View File

@ -40,8 +40,6 @@
#include "../../core/linux/SDL_system_theme.h"
#include "../../SDL_utils_c.h"
#include <SDL3/SDL_syswm.h>
#include <stdio.h>
/*#define DEBUG_XEVENTS*/
@ -324,27 +322,25 @@ static char *X11_URIToLocal(char *uri)
return file;
}
/* An X11 event hook */
static SDL_X11EventHook g_X11EventHook = NULL;
static void *g_X11EventHookData = NULL;
void SDL_SetX11EventHook(SDL_X11EventHook callback, void *userdata)
{
g_X11EventHook = callback;
g_X11EventHookData = userdata;
}
#ifdef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
static void X11_HandleGenericEvent(SDL_VideoData *videodata, XEvent *xev)
{
/* event is a union, so cookie == &event, but this is type safe. */
XGenericEventCookie *cookie = &xev->xcookie;
if (X11_XGetEventData(videodata->display, cookie)) {
X11_HandleXinput2Event(videodata, cookie);
/* Send a SDL_EVENT_SYSWM if the application wants them.
* Since event data is only available until XFreeEventData is called,
* the *only* way for an application to access it is to register an event filter/watcher
* and do all the processing on the SDL_EVENT_SYSWM inside the callback. */
if (SDL_EventEnabled(SDL_EVENT_SYSWM)) {
SDL_SysWMmsg wmmsg;
wmmsg.version = SDL_SYSWM_CURRENT_VERSION;
wmmsg.subsystem = SDL_SYSWM_X11;
wmmsg.msg.x11.event = *xev;
SDL_SendSysWMEvent(&wmmsg);
if (!g_X11EventHook || g_X11EventHook(g_X11EventHookData, xev)) {
X11_HandleXinput2Event(videodata, cookie);
}
X11_XFreeEventData(videodata->display, cookie);
}
}
@ -870,22 +866,19 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
}
#endif
/* Calling the event hook for generic events happens in X11_HandleGenericEvent(), where the event data is available */
if (g_X11EventHook) {
if (!g_X11EventHook(g_X11EventHookData, xevent)) {
return;
}
}
#ifdef SDL_VIDEO_DRIVER_X11_XRANDR
if (videodata->xrandr_event_base && (xevent->type == (videodata->xrandr_event_base + RRNotify))) {
X11_HandleXRandREvent(_this, xevent);
}
#endif
/* Send a SDL_EVENT_SYSWM if the application wants them */
if (SDL_EventEnabled(SDL_EVENT_SYSWM)) {
SDL_SysWMmsg wmmsg;
wmmsg.version = SDL_SYSWM_CURRENT_VERSION;
wmmsg.subsystem = SDL_SYSWM_X11;
wmmsg.msg.x11.event = *xevent;
SDL_SendSysWMEvent(&wmmsg);
}
#if 0
printf("type = %d display = %d window = %d\n",
xevent->type, xevent->xany.display, xevent->xany.window);

View File

@ -207,7 +207,6 @@ static SDL_VideoDevice *X11_CreateDevice(void)
device->CreateWindowFramebuffer = X11_CreateWindowFramebuffer;
device->UpdateWindowFramebuffer = X11_UpdateWindowFramebuffer;
device->DestroyWindowFramebuffer = X11_DestroyWindowFramebuffer;
device->GetWindowWMInfo = X11_GetWindowWMInfo;
device->SetWindowHitTest = X11_SetWindowHitTest;
device->AcceptDragAndDrop = X11_AcceptDragAndDrop;
device->FlashWindow = X11_FlashWindow;

View File

@ -39,8 +39,6 @@
#include "SDL_x11opengles.h"
#endif
#include <SDL3/SDL_syswm.h>
#define _NET_WM_STATE_REMOVE 0l
#define _NET_WM_STATE_ADD 1l
@ -300,6 +298,7 @@ Uint32 X11_GetNetWMState(SDL_VideoDevice *_this, SDL_Window *window, Window xwin
static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, Window w, BOOL created)
{
SDL_VideoData *videodata = _this->driverdata;
SDL_DisplayData *displaydata = SDL_GetDisplayDriverDataForWindow(window);
SDL_WindowData *data;
int numwindows = videodata->numwindows;
int windowlistlength = videodata->windowlistlength;
@ -382,6 +381,13 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, Window w,
/* All done! */
window->driverdata = data;
SDL_PropertiesID props = SDL_GetWindowProperties(window);
int screen = (displaydata ? displaydata->screen : 0);
SDL_SetProperty(props, "SDL.window.x11.display", data->videodata->display);
SDL_SetProperty(props, "SDL.window.x11.screen", (void *)(intptr_t)screen);
SDL_SetProperty(props, "SDL.window.x11.window", (void *)(uintptr_t)data->xwindow);
return 0;
}
@ -1848,23 +1854,6 @@ void X11_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
window->driverdata = NULL;
}
int X11_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, SDL_SysWMinfo *info)
{
SDL_WindowData *data = window->driverdata;
SDL_DisplayData *displaydata = SDL_GetDisplayDriverDataForWindow(window);
if (data == NULL) {
/* This sometimes happens in SDL_IBus_UpdateTextRect() while creating the window */
return SDL_SetError("Window not initialized");
}
info->subsystem = SDL_SYSWM_X11;
info->info.x11.display = data->videodata->display;
info->info.x11.screen = displaydata->screen;
info->info.x11.window = data->xwindow;
return 0;
}
int X11_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
{
return 0; /* just succeed, the real work is done elsewhere. */

View File

@ -111,7 +111,6 @@ extern void *X11_GetWindowICCProfile(SDL_VideoDevice *_this, SDL_Window *window,
extern void X11_SetWindowMouseGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed);
extern void X11_SetWindowKeyboardGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed);
extern void X11_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
extern int X11_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
extern int X11_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
extern void X11_AcceptDragAndDrop(SDL_Window *window, SDL_bool accept);
extern int X11_FlashWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOperation operation);

View File

@ -42,7 +42,6 @@ static SDLTest_TestSuiteReference *testSuites[] = {
&sdltestTestSuite,
&stdlibTestSuite,
&surfaceTestSuite,
&syswmTestSuite,
&timerTestSuite,
&videoTestSuite,
&subsystemsTestSuite, /* run last, not interfere with other test enviroment */

View File

@ -30,7 +30,6 @@ extern SDLTest_TestSuiteReference sdltestTestSuite;
extern SDLTest_TestSuiteReference stdlibTestSuite;
extern SDLTest_TestSuiteReference subsystemsTestSuite;
extern SDLTest_TestSuiteReference surfaceTestSuite;
extern SDLTest_TestSuiteReference syswmTestSuite;
extern SDLTest_TestSuiteReference timerTestSuite;
extern SDLTest_TestSuiteReference videoTestSuite;

View File

@ -1,60 +0,0 @@
/**
* SysWM test suite
*/
/* Avoid inclusion of e.g. X11 headers when these are not installed */
#include <build_config/SDL_build_config.h>
#include <SDL3/SDL.h>
#include <SDL3/SDL_syswm.h>
#include <SDL3/SDL_test.h>
#include "testautomation_suites.h"
/* Test case functions */
/**
* Call to SDL_GetWindowWMInfo
*/
static int syswm_getWindowWMInfo(void *arg)
{
int result;
SDL_Window *window;
SDL_SysWMinfo info;
window = SDL_CreateWindow("", 0, 0, SDL_WINDOW_HIDDEN);
SDLTest_AssertPass("Call to SDL_CreateWindow()");
SDLTest_AssertCheck(window != NULL, "Check that value returned from SDL_CreateWindow is not NULL");
if (window == NULL) {
return TEST_ABORTED;
}
/* Make call */
result = SDL_GetWindowWMInfo(window, &info, SDL_SYSWM_CURRENT_VERSION);
SDLTest_AssertPass("Call to SDL_GetWindowWMInfo()");
SDLTest_Log((result == 0) ? "Got window information" : "Couldn't get window information");
SDL_DestroyWindow(window);
SDLTest_AssertPass("Call to SDL_DestroyWindow()");
return TEST_COMPLETED;
}
/* ================= Test References ================== */
/* SysWM test cases */
static const SDLTest_TestCaseReference syswmTest1 = {
(SDLTest_TestCaseFp)syswm_getWindowWMInfo, "syswm_getWindowWMInfo", "Call to SDL_GetWindowWMInfo", TEST_ENABLED
};
/* Sequence of SysWM test cases */
static const SDLTest_TestCaseReference *syswmTests[] = {
&syswmTest1, NULL
};
/* SysWM test suite (global) */
SDLTest_TestSuiteReference syswmTestSuite = {
"SysWM",
NULL,
syswmTests,
NULL
};