Updated SDL_syswm.h for SDL 3.0

* The header is no longer dependent on SDL build configuration
* The structures are versioned separately from the rest of SDL
* SDL_GetWindowWMInfo() now returns a standard result code and is passed the version expected by the application
* Updated WhatsNew.txt and docs/README-migration.md with the first API changes in SDL 3.0
This commit is contained in:
Sam Lantinga
2022-11-23 13:33:48 -08:00
parent 53ca1f7702
commit b0840eb32e
57 changed files with 349 additions and 1411 deletions

View File

@@ -23,15 +23,18 @@
#include <unistd.h>
#include "SDL_fcitx.h"
#include "SDL_hints.h"
#include "SDL_keycode.h"
#include "SDL_keyboard.h"
#include "../../events/SDL_keyboard_c.h"
#include "SDL_dbus.h"
#include "SDL_syswm.h"
#if SDL_VIDEO_DRIVER_X11
# include "../../video/x11/SDL_x11video.h"
#ifdef SDL_VIDEO_DRIVER_X11
#include "../../video/x11/SDL_x11video.h"
#define SDL_ENABLE_SYSWM_X11
#endif
#include "SDL_hints.h"
#include "SDL_syswm.h"
#define FCITX_DBUS_SERVICE "org.freedesktop.portal.Fcitx"
@@ -440,24 +443,19 @@ SDL_Fcitx_UpdateTextRect(const SDL_Rect *rect)
return ;
}
SDL_VERSION(&info.version);
if (!SDL_GetWindowWMInfo(focused_win, &info)) {
return;
}
SDL_GetWindowPosition(focused_win, &x, &y);
#if SDL_VIDEO_DRIVER_X11
if (info.subsystem == SDL_SYSWM_X11) {
SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata;
Display *x_disp = info.info.x11.display;
Window x_win = info.info.x11.window;
int x_screen = displaydata->screen;
Window unused;
X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused);
}
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;
X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused);
}
#endif
}
if (cursor->x == -1 && cursor->y == -1 && cursor->w == 0 && cursor->h == 0) {
/* move to bottom left */

View File

@@ -23,15 +23,16 @@
#ifdef HAVE_IBUS_IBUS_H
#include "SDL.h"
#include "SDL_hints.h"
#include "SDL_syswm.h"
#include "SDL_ibus.h"
#include "SDL_dbus.h"
#include "../../video/SDL_sysvideo.h"
#include "../../events/SDL_keyboard_c.h"
#if SDL_VIDEO_DRIVER_X11
#include "../../video/x11/SDL_x11video.h"
#ifdef SDL_VIDEO_DRIVER_X11
#include "../../video/x11/SDL_x11video.h"
#define SDL_ENABLE_SYSWM_X11
#endif
#include "SDL_syswm.h"
#include <sys/inotify.h>
#include <unistd.h>
@@ -704,25 +705,20 @@ SDL_IBus_UpdateTextRect(const SDL_Rect *rect)
return;
}
SDL_VERSION(&info.version);
if (!SDL_GetWindowWMInfo(focused_win, &info)) {
return;
}
SDL_GetWindowPosition(focused_win, &x, &y);
#if SDL_VIDEO_DRIVER_X11
if (info.subsystem == SDL_SYSWM_X11) {
SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata;
Display *x_disp = info.info.x11.display;
Window x_win = info.info.x11.window;
int x_screen = displaydata->screen;
Window unused;
X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused);
}
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;
X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused);
}
#endif
}
x += ibus_cursor_rect.x;
y += ibus_cursor_rect.y;

View File

@@ -468,7 +468,6 @@
#define SDL_SoftStretch SDL_SoftStretch_REAL
#define SDL_UpperBlitScaled SDL_UpperBlitScaled_REAL
#define SDL_LowerBlitScaled SDL_LowerBlitScaled_REAL
#define SDL_GetWindowWMInfo SDL_GetWindowWMInfo_REAL
#define SDL_GetThreadName SDL_GetThreadName_REAL
#define SDL_ThreadID SDL_ThreadID_REAL
#define SDL_GetThreadID SDL_GetThreadID_REAL

View File

@@ -500,7 +500,6 @@ SDL_DYNAPI_PROC(int,SDL_LowerBlit,(SDL_Surface *a, SDL_Rect *b, SDL_Surface *c,
SDL_DYNAPI_PROC(int,SDL_SoftStretch,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_UpperBlitScaled,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_LowerBlitScaled,(SDL_Surface *a, SDL_Rect *b, SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowWMInfo,(SDL_Window *a, SDL_SysWMinfo *b),(a,b),return)
SDL_DYNAPI_PROC(const char*,SDL_GetThreadName,(SDL_Thread *a),(a),return)
SDL_DYNAPI_PROC(SDL_threadID,SDL_ThreadID,(void),(),return)
SDL_DYNAPI_PROC(SDL_threadID,SDL_GetThreadID,(SDL_Thread *a),(a),return)

View File

@@ -29,11 +29,13 @@
#include "SDL_hints.h"
#include "SDL_loadso.h"
#include "SDL_syswm.h"
#include "../SDL_sysrender.h"
#include "../SDL_d3dmath.h"
#include "../../video/windows/SDL_windowsvideo.h"
#define SDL_ENABLE_SYSWM_WINDOWS
#include "SDL_syswm.h"
#if SDL_VIDEO_RENDER_D3D
#define D3D_DEBUG_INFO
#include <d3d9.h>
@@ -1596,6 +1598,12 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
SDL_DisplayMode fullscreen_mode;
int displayIndex;
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) {
SDL_OutOfMemory();
@@ -1643,9 +1651,6 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->info.flags = (SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE);
renderer->driverdata = data;
SDL_VERSION(&windowinfo.version);
SDL_GetWindowWMInfo(window, &windowinfo);
window_flags = SDL_GetWindowFlags(window);
SDL_GetWindowSizeInPixels(window, &w, &h);
SDL_GetWindowDisplayMode(window, &fullscreen_mode);

View File

@@ -32,10 +32,12 @@
#endif
#include "SDL_hints.h"
#include "SDL_loadso.h"
#include "SDL_syswm.h"
#include "../SDL_sysrender.h"
#include "../SDL_d3dmath.h"
#define SDL_ENABLE_SYSWM_WINDOWS
#include "SDL_syswm.h"
#include <d3d11_1.h>
#include "SDL_shaders_d3d11.h"
@@ -829,8 +831,13 @@ D3D11_CreateSwapChain(SDL_Renderer * renderer, int w, int h)
} else {
#if defined(__WIN32__) || defined(__WINGDK__)
SDL_SysWMinfo windowinfo;
SDL_VERSION(&windowinfo.version);
SDL_GetWindowWMInfo(renderer->window, &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;
}
result = IDXGIFactory2_CreateSwapChainForHwnd(data->dxgiFactory,
(IUnknown *)data->d3dDevice,

View File

@@ -22,7 +22,6 @@
#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED
#include "SDL_syswm.h"
#include "../../video/winrt/SDL_winrtvideo_cpp.h"
extern "C" {
#include "../SDL_sysrender.h"
@@ -40,6 +39,9 @@ using namespace Windows::Graphics::Display;
#include <DXGI.h>
#define SDL_ENABLE_SYSWM_WINRT
#include "SDL_syswm.h"
#include "SDL_render_winrt.h"
@@ -52,8 +54,9 @@ D3D11_GetCoreWindowFromSDLRenderer(SDL_Renderer * renderer)
}
SDL_SysWMinfo sdlWindowInfo;
SDL_VERSION(&sdlWindowInfo.version);
if ( ! SDL_GetWindowWMInfo(sdlWindow, &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;
}

View File

@@ -34,10 +34,12 @@
#include "../../video/windows/SDL_windowswindow.h"
#include "SDL_hints.h"
#include "SDL_loadso.h"
#include "SDL_syswm.h"
#include "../SDL_sysrender.h"
#include "../SDL_d3dmath.h"
#define SDL_ENABLE_SYSWM_WINDOWS
#include "SDL_syswm.h"
#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
#include "SDL_render_d3d12_xbox.h"
#ifndef D3D12_TEXTURE_DATA_PITCH_ALIGNMENT
@@ -1175,7 +1177,7 @@ static HRESULT
D3D12_CreateSwapChain(SDL_Renderer * renderer, int w, int h)
{
D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata;
IDXGISwapChain1* swapChain;
IDXGISwapChain1* swapChain = NULL;
HRESULT result = S_OK;
SDL_SysWMinfo windowinfo;
@@ -1199,8 +1201,12 @@ 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 */
SDL_VERSION(&windowinfo.version);
SDL_GetWindowWMInfo(renderer->window, &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;
}
result = D3D_CALL(data->dxgiFactory, CreateSwapChainForHwnd,
(IUnknown *)data->commandQueue,

View File

@@ -23,7 +23,6 @@
#if SDL_VIDEO_RENDER_METAL && !SDL_RENDER_DISABLED
#include "SDL_hints.h"
#include "SDL_syswm.h"
#include "SDL_metal.h"
#include "../SDL_sysrender.h"
@@ -31,10 +30,16 @@
#import <Metal/Metal.h>
#import <QuartzCore/CAMetalLayer.h>
#ifdef __MACOSX__
#ifdef SDL_VIDEO_DRIVER_COCOA
#import <AppKit/NSWindow.h>
#import <AppKit/NSView.h>
#define SDL_ENABLE_SYSWM_COCOA
#endif
#ifdef SDL_VIDEO_DRIVER_UIKIT
#import <UIKit/UIKit.h>
#define SDL_ENABLE_SYSWM_UIKIT
#endif
#include "SDL_syswm.h"
/* Regenerate these with build-metal-shaders.sh */
#ifdef __MACOSX__
@@ -1599,9 +1604,8 @@ static SDL_MetalView GetWindowView(SDL_Window *window)
{
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
if (SDL_GetWindowWMInfo(window, &info)) {
#ifdef __MACOSX__
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) {
@@ -1611,7 +1615,8 @@ static SDL_MetalView GetWindowView(SDL_Window *window)
}
}
}
#else
#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) {
@@ -1683,8 +1688,7 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags)
1.0000, 1.7720, 0.0000, 0.0, /* Bcoeff */
};
SDL_VERSION(&syswm.version);
if (!SDL_GetWindowWMInfo(window, &syswm)) {
if (SDL_GetWindowWMInfo(window, &syswm, SDL_SYSWM_CURRENT_VERSION) < 0) {
return NULL;
}

View File

@@ -262,8 +262,7 @@ struct SDL_VideoDevice
SDL_ShapeDriver shape_driver;
/* Get some platform dependent window information */
SDL_bool(*GetWindowWMInfo) (_THIS, SDL_Window * window,
struct SDL_SysWMinfo * info);
int (*GetWindowWMInfo) (_THIS, SDL_Window *window, struct SDL_SysWMinfo *info);
/* * * */
/*

View File

@@ -4416,22 +4416,32 @@ SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask)
}
#endif
SDL_bool
SDL_GetWindowWMInfo(SDL_Window * window, struct SDL_SysWMinfo *info)
int
SDL_GetWindowWMInfo(SDL_Window *window, struct SDL_SysWMinfo *info, Uint32 version)
{
CHECK_WINDOW_MAGIC(window, SDL_FALSE);
CHECK_WINDOW_MAGIC(window, -1);
if (!info) {
SDL_InvalidParamError("info");
return SDL_FALSE;
return SDL_InvalidParamError("info");
}
info->subsystem = SDL_SYSWM_UNKNOWN;
if (!_this->GetWindowWMInfo) {
SDL_Unsupported();
return SDL_FALSE;
/* 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;
}
return (_this->GetWindowWMInfo(_this, window, info));
}
void
@@ -4569,12 +4579,7 @@ static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messagebo
SDL_SysWMinfo info;
SDL_Window *window = messageboxdata->window;
if (!window) {
return SDL_TRUE;
}
SDL_VERSION(&info.version);
if (!SDL_GetWindowWMInfo(window, &info)) {
if (!window || SDL_GetWindowWMInfo(window, &info, SDL_SYSWM_CURRENT_VERSION) < 0) {
return SDL_TRUE;
} else {
return (info.subsystem == drivertype);

View File

@@ -33,6 +33,8 @@
#include "SDL_loadso.h"
#include "SDL_androidvulkan.h"
#define SDL_ENABLE_SYSWM_ANDROID
#include "SDL_syswm.h"
int Android_Vulkan_LoadLibrary(_THIS, const char *path)

View File

@@ -22,7 +22,6 @@
#if SDL_VIDEO_DRIVER_ANDROID
#include "SDL_syswm.h"
#include "../SDL_sysvideo.h"
#include "../../events/SDL_keyboard_c.h"
#include "../../events/SDL_mouse_c.h"
@@ -33,6 +32,9 @@
#include "SDL_androidwindow.h"
#include "SDL_hints.h"
#define SDL_ENABLE_SYSWM_ANDROID
#include "SDL_syswm.h"
/* Currently only one window */
SDL_Window *Android_Window = NULL;
@@ -202,25 +204,19 @@ Android_DestroyWindow(_THIS, SDL_Window *window)
SDL_UnlockMutex(Android_ActivityMutex);
}
SDL_bool
int
Android_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
{
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
if (info->version.major == SDL_MAJOR_VERSION) {
info->subsystem = SDL_SYSWM_ANDROID;
info->info.android.window = data->native_window;
info->subsystem = SDL_SYSWM_ANDROID;
info->info.android.window = data->native_window;
#if SDL_VIDEO_OPENGL_EGL
info->info.android.surface = data->egl_surface;
info->info.android.surface = data->egl_surface;
#endif
return SDL_TRUE;
} else {
SDL_SetError("Application not compiled with SDL %d",
SDL_MAJOR_VERSION);
return SDL_FALSE;
}
return 0;
}
#endif /* SDL_VIDEO_DRIVER_ANDROID */

View File

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

View File

@@ -31,6 +31,8 @@
#if SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_METAL)
#include "SDL_events.h"
#define SDL_ENABLE_SYSWM_COCOA
#include "SDL_syswm.h"

View File

@@ -33,6 +33,8 @@
#include "SDL_loadso.h"
#include "SDL_cocoametalview.h"
#include "SDL_cocoavulkan.h"
#define SDL_ENABLE_SYSWM_COCOA
#include "SDL_syswm.h"
#include <dlfcn.h>

View File

@@ -165,7 +165,7 @@ extern int Cocoa_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp);
extern void Cocoa_SetWindowMouseRect(_THIS, SDL_Window * window);
extern void Cocoa_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbed);
extern void Cocoa_DestroyWindow(_THIS, SDL_Window * window);
extern SDL_bool Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info);
extern int Cocoa_GetWindowWMInfo(_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(_THIS, SDL_Window * window, SDL_FlashOperation operation);

View File

@@ -26,7 +26,6 @@
# error SDL for Mac OS X must be built with a 10.7 SDK or above.
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED < 1070 */
#include "SDL_syswm.h"
#include "SDL_timer.h" /* For SDL_GetTicks() */
#include "SDL_hints.h"
#include "../SDL_sysvideo.h"
@@ -35,12 +34,16 @@
#include "../../events/SDL_touch_c.h"
#include "../../events/SDL_windowevents_c.h"
#include "../../events/SDL_dropevents_c.h"
#include "SDL_cocoavideo.h"
#include "SDL_cocoashape.h"
#include "SDL_cocoamouse.h"
#include "SDL_cocoaopengl.h"
#include "SDL_cocoaopengles.h"
#define SDL_ENABLE_SYSWM_COCOA
#include "SDL_syswm.h"
/* #define DEBUG_COCOAWINDOW */
#ifdef DEBUG_COCOAWINDOW
@@ -2401,21 +2404,15 @@ Cocoa_DestroyWindow(_THIS, SDL_Window * window)
window->driverdata = NULL;
}}
SDL_bool
Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
int
Cocoa_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
{ @autoreleasepool
{
NSWindow *nswindow = ((__bridge SDL_WindowData *) window->driverdata).nswindow;
if (info->version.major <= SDL_MAJOR_VERSION) {
info->subsystem = SDL_SYSWM_COCOA;
info->info.cocoa.window = nswindow;
return SDL_TRUE;
} else {
SDL_SetError("Application not compiled with SDL %d",
SDL_MAJOR_VERSION);
return SDL_FALSE;
}
info->subsystem = SDL_SYSWM_COCOA;
info->info.cocoa.window = nswindow;
return 0;
}}
SDL_bool

View File

@@ -28,9 +28,10 @@ extern "C" {
#include "../../SDL_internal.h"
#include "SDL.h"
#include "SDL_syswm.h"
#include "SDL_bframebuffer.h"
#include "SDL_syswm.h"
#ifdef __cplusplus
}
#endif

View File

@@ -223,22 +223,12 @@ void HAIKU_DestroyWindow(_THIS, SDL_Window * window) {
window->driverdata = NULL;
}
SDL_bool HAIKU_GetWindowWMInfo(_THIS, SDL_Window * window,
struct SDL_SysWMinfo *info) {
/* FIXME: What is the point of this? What information should be included? */
if (info->version.major == SDL_MAJOR_VERSION) {
info->subsystem = SDL_SYSWM_HAIKU;
return SDL_TRUE;
} else {
SDL_SetError("Application not compiled with SDL %d",
SDL_MAJOR_VERSION);
return SDL_FALSE;
}
int HAIKU_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
{
info->subsystem = SDL_SYSWM_HAIKU;
return 0;
}
#ifdef __cplusplus
}

View File

@@ -46,8 +46,7 @@ extern int HAIKU_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * r
extern int HAIKU_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp);
extern void HAIKU_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbed);
extern void HAIKU_DestroyWindow(_THIS, SDL_Window * window);
extern SDL_bool HAIKU_GetWindowWMInfo(_THIS, SDL_Window * window,
struct SDL_SysWMinfo *info);
extern int HAIKU_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info);

View File

@@ -25,7 +25,6 @@
/* SDL internals */
#include "../SDL_sysvideo.h"
#include "SDL_syswm.h"
#include "SDL_log.h"
#include "SDL_hints.h"
#include "../../events/SDL_events_c.h"
@@ -38,6 +37,9 @@
#include "../../core/openbsd/SDL_wscons.h"
#endif
#define SDL_ENABLE_SYSWM_KMSDRM
#include "SDL_syswm.h"
/* KMS/DRM declarations */
#include "SDL_kmsdrmvideo.h"
#include "SDL_kmsdrmevents.h"
@@ -1638,25 +1640,17 @@ KMSDRM_RestoreWindow(_THIS, SDL_Window * window)
/*****************************************************************************/
/* SDL Window Manager function */
/*****************************************************************************/
SDL_bool
KMSDRM_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info)
int
KMSDRM_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
{
SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);
const Uint32 version = SDL_VERSIONNUM((Uint32)info->version.major,
(Uint32)info->version.minor,
(Uint32)info->version.patch);
if (version < SDL_VERSIONNUM(2, 0, 15)) {
SDL_SetError("Version must be 2.0.15 or newer");
return SDL_FALSE;
}
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 SDL_TRUE;
return 0;
}
#endif /* SDL_VIDEO_DRIVER_KMSDRM */

View File

@@ -141,8 +141,7 @@ void KMSDRM_RestoreWindow(_THIS, SDL_Window * window);
void KMSDRM_DestroyWindow(_THIS, SDL_Window * window);
/* Window manager function */
SDL_bool KMSDRM_GetWindowWMInfo(_THIS, SDL_Window * window,
struct SDL_SysWMinfo *info);
int KMSDRM_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info);
/* OpenGL/OpenGL ES functions */
int KMSDRM_GLES_LoadLibrary(_THIS, const char *path);

View File

@@ -28,14 +28,17 @@
#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_KMSDRM
#include "SDL_assert.h"
#include "SDL_loadso.h"
#include "SDL_kmsdrmvideo.h"
#include "SDL_kmsdrmdyn.h"
#include "SDL_assert.h"
#include "SDL_loadso.h"
#include "SDL_kmsdrmvulkan.h"
#define SDL_ENABLE_SYSWM_KMSDRM
#include "SDL_syswm.h"
#include "sys/ioctl.h"
#include <sys/ioctl.h>
#if defined(__OpenBSD__)
#define DEFAULT_VULKAN "libvulkan.so"

View File

@@ -23,6 +23,7 @@
#define _SDL_ngagewindow_h
#include "../SDL_sysvideo.h"
#include "SDL_syswm.h"
#include "SDL_ngagevideo.h"

View File

@@ -26,12 +26,12 @@
/* SDL internals */
#include "../SDL_sysvideo.h"
#include "SDL_version.h"
#include "SDL_syswm.h"
#include "SDL_loadso.h"
#include "SDL_events.h"
#include "../../events/SDL_mouse_c.h"
#include "../../events/SDL_keyboard_c.h"
#include "SDL_syswm.h"
/* PSP declarations */
@@ -113,9 +113,6 @@ PSP_Create()
device->MinimizeWindow = PSP_MinimizeWindow;
device->RestoreWindow = PSP_RestoreWindow;
device->DestroyWindow = PSP_DestroyWindow;
#if 0
device->GetWindowWMInfo = PSP_GetWindowWMInfo;
#endif
device->GL_LoadLibrary = PSP_GL_LoadLibrary;
device->GL_GetProcAddress = PSP_GL_GetProcAddress;
device->GL_UnloadLibrary = PSP_GL_UnloadLibrary;
@@ -277,27 +274,6 @@ PSP_DestroyWindow(_THIS, SDL_Window * window)
{
}
/*****************************************************************************/
/* SDL Window Manager function */
/*****************************************************************************/
#if 0
SDL_bool
PSP_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info)
{
if (info->version.major <= SDL_MAJOR_VERSION) {
return SDL_TRUE;
} else {
SDL_SetError("Application not compiled with SDL %d",
SDL_MAJOR_VERSION);
return SDL_FALSE;
}
/* Failed to get window manager information */
return SDL_FALSE;
}
#endif
/* TO Write Me */
SDL_bool PSP_HasScreenKeyboardSupport(_THIS)
{

View File

@@ -75,10 +75,6 @@ void PSP_MinimizeWindow(_THIS, SDL_Window * window);
void PSP_RestoreWindow(_THIS, SDL_Window * window);
void PSP_DestroyWindow(_THIS, SDL_Window * window);
/* Window manager function */
SDL_bool PSP_GetWindowWMInfo(_THIS, SDL_Window * window,
struct SDL_SysWMinfo *info);
/* OpenGL/OpenGL ES functions */
int PSP_GL_LoadLibrary(_THIS, const char *path);
void *PSP_GL_GetProcAddress(_THIS, const char *proc);

View File

@@ -33,13 +33,14 @@
/* SDL internals */
#include "../SDL_sysvideo.h"
#include "SDL_version.h"
#include "SDL_syswm.h"
#include "SDL_loadso.h"
#include "SDL_events.h"
#include "../../events/SDL_mouse_c.h"
#include "../../events/SDL_keyboard_c.h"
#include "SDL_hints.h"
#include "SDL_syswm.h"
#ifdef SDL_INPUT_LINUXEV
#include "../../core/linux/SDL_evdev.h"
#endif
@@ -121,9 +122,6 @@ RPI_Create()
device->MinimizeWindow = RPI_MinimizeWindow;
device->RestoreWindow = RPI_RestoreWindow;
device->DestroyWindow = RPI_DestroyWindow;
#if 0
device->GetWindowWMInfo = RPI_GetWindowWMInfo;
#endif
device->GL_LoadLibrary = RPI_GLES_LoadLibrary;
device->GL_GetProcAddress = RPI_GLES_GetProcAddress;
device->GL_UnloadLibrary = RPI_GLES_UnloadLibrary;
@@ -421,26 +419,6 @@ RPI_RestoreWindow(_THIS, SDL_Window * window)
{
}
/*****************************************************************************/
/* SDL Window Manager function */
/*****************************************************************************/
#if 0
SDL_bool
RPI_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info)
{
if (info->version.major <= SDL_MAJOR_VERSION) {
return SDL_TRUE;
} else {
SDL_SetError("application not compiled with SDL %d",
SDL_MAJOR_VERSION);
return SDL_FALSE;
}
/* Failed to get window manager information */
return SDL_FALSE;
}
#endif
#endif /* SDL_VIDEO_DRIVER_RPI */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -83,10 +83,6 @@ void RPI_MinimizeWindow(_THIS, SDL_Window * window);
void RPI_RestoreWindow(_THIS, SDL_Window * window);
void RPI_DestroyWindow(_THIS, SDL_Window * window);
/* Window manager function */
SDL_bool RPI_GetWindowWMInfo(_THIS, SDL_Window * window,
struct SDL_SysWMinfo *info);
/* OpenGL/OpenGL ES functions */
int RPI_GLES_LoadLibrary(_THIS, const char *path);
void *RPI_GLES_GetProcAddress(_THIS, const char *proc);

View File

@@ -23,10 +23,10 @@
#if SDL_VIDEO_DRIVER_RISCOS
#include "SDL_version.h"
#include "SDL_syswm.h"
#include "../SDL_sysvideo.h"
#include "../../events/SDL_mouse_c.h"
#include "SDL_syswm.h"
#include "SDL_riscosvideo.h"
#include "SDL_riscoswindow.h"
@@ -63,17 +63,11 @@ RISCOS_DestroyWindow(_THIS, SDL_Window * window)
window->driverdata = NULL;
}
SDL_bool
RISCOS_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info)
int
RISCOS_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
{
if (info->version.major == SDL_MAJOR_VERSION) {
info->subsystem = SDL_SYSWM_RISCOS;
return SDL_TRUE;
} else {
SDL_SetError("Application not compiled with SDL %d",
SDL_MAJOR_VERSION);
return SDL_FALSE;
}
info->subsystem = SDL_SYSWM_RISCOS;
return 0;
}
#endif /* SDL_VIDEO_DRIVER_RISCOS */

View File

@@ -34,8 +34,7 @@ typedef struct
extern int RISCOS_CreateWindow(_THIS, SDL_Window * window);
extern void RISCOS_DestroyWindow(_THIS, SDL_Window * window);
extern SDL_bool RISCOS_GetWindowWMInfo(_THIS, SDL_Window * window,
struct SDL_SysWMinfo *info);
extern int RISCOS_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info);
#endif /* SDL_riscoswindow_h_ */

View File

@@ -30,12 +30,14 @@
#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_VULKAN || SDL_VIDEO_METAL)
#include "SDL_syswm.h"
#include "../SDL_sysvideo.h"
#import "SDL_uikitwindow.h"
#import "SDL_uikitmetalview.h"
#define SDL_ENABLE_SYSWM_UIKIT
#include "SDL_syswm.h"
@implementation SDL_uikitmetalview

View File

@@ -34,6 +34,8 @@
#include "SDL_loadso.h"
#include "SDL_uikitvulkan.h"
#include "SDL_uikitmetalview.h"
#define SDL_ENABLE_SYSWM_UIKIT
#include "SDL_syswm.h"
#include <dlfcn.h>

View File

@@ -37,8 +37,7 @@ extern void UIKit_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbe
extern void UIKit_UpdatePointerLock(_THIS, SDL_Window * window);
extern void UIKit_DestroyWindow(_THIS, SDL_Window * window);
extern void UIKit_GetWindowSizeInPixels(_THIS, SDL_Window * window, int *w, int *h);
extern SDL_bool UIKit_GetWindowWMInfo(_THIS, SDL_Window * window,
struct SDL_SysWMinfo * info);
extern int UIKit_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info);
extern NSUInteger UIKit_GetSupportedOrientations(SDL_Window * window);

View File

@@ -25,7 +25,6 @@
#include "SDL_hints.h"
#include "SDL_mouse.h"
#include "SDL_system.h"
#include "SDL_syswm.h"
#include "SDL_video.h"
#include "../SDL_sysvideo.h"
#include "../SDL_pixels_c.h"
@@ -35,10 +34,12 @@
#include "SDL_uikitevents.h"
#include "SDL_uikitmodes.h"
#include "SDL_uikitwindow.h"
#import "SDL_uikitappdelegate.h"
#include "SDL_uikitappdelegate.h"
#include "SDL_uikitview.h"
#include "SDL_uikitopenglview.h"
#import "SDL_uikitview.h"
#import "SDL_uikitopenglview.h"
#define SDL_ENABLE_SYSWM_UIKIT
#include "SDL_syswm.h"
#include <Foundation/Foundation.h>
@@ -390,44 +391,25 @@ UIKit_GetWindowSizeInPixels(_THIS, SDL_Window * window, int *w, int *h)
*h = size.height * scale;
}}
SDL_bool
UIKit_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
int
UIKit_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
{ @autoreleasepool
{
@autoreleasepool {
SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata;
if (info->version.major <= SDL_MAJOR_VERSION) {
int versionnum = SDL_VERSIONNUM(info->version.major, info->version.minor, info->version.patch);
info->subsystem = SDL_SYSWM_UIKIT;
info->info.uikit.window = data.uiwindow;
info->subsystem = SDL_SYSWM_UIKIT;
info->info.uikit.window = data.uiwindow;
/* These struct members were added in SDL 2.0.4. */
if (versionnum >= SDL_VERSIONNUM(2,0,4)) {
#if SDL_VIDEO_OPENGL_ES || 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;
} else {
#else
{
#endif
info->info.uikit.framebuffer = 0;
info->info.uikit.colorbuffer = 0;
info->info.uikit.resolveFramebuffer = 0;
}
}
return SDL_TRUE;
} else {
SDL_SetError("Application not compiled with SDL %d",
SDL_MAJOR_VERSION);
return SDL_FALSE;
}
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

View File

@@ -26,12 +26,13 @@
/* SDL internals */
#include "../SDL_sysvideo.h"
#include "SDL_version.h"
#include "SDL_syswm.h"
#include "SDL_loadso.h"
#include "SDL_events.h"
#include "../../events/SDL_mouse_c.h"
#include "../../events/SDL_keyboard_c.h"
#include "SDL_syswm.h"
/* VITA declarations */
#include <psp2/kernel/processmgr.h>
#include "SDL_vitavideo.h"
@@ -132,7 +133,6 @@ VITA_Create()
device->SetWindowMouseGrab = VITA_SetWindowGrab;
device->SetWindowKeyboardGrab = VITA_SetWindowGrab;
device->DestroyWindow = VITA_DestroyWindow;
device->GetWindowWMInfo = VITA_GetWindowWMInfo;
/*
// Disabled, causes issues on high-framerate updates. SDL still emulates this.
@@ -395,24 +395,6 @@ VITA_DestroyWindow(_THIS, SDL_Window * window)
Vita_Window = NULL;
}
/*****************************************************************************/
/* SDL Window Manager function */
/*****************************************************************************/
SDL_bool
VITA_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info)
{
if (info->version.major <= SDL_MAJOR_VERSION) {
return SDL_TRUE;
} else {
SDL_SetError("application not compiled with SDL %d\n",
SDL_MAJOR_VERSION);
return SDL_FALSE;
}
/* Failed to get window manager information */
return SDL_FALSE;
}
SDL_bool VITA_HasScreenKeyboardSupport(_THIS)
{
return SDL_TRUE;

View File

@@ -85,10 +85,6 @@ void VITA_RestoreWindow(_THIS, SDL_Window * window);
void VITA_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed);
void VITA_DestroyWindow(_THIS, SDL_Window * window);
/* Window manager function */
SDL_bool VITA_GetWindowWMInfo(_THIS, SDL_Window * window,
struct SDL_SysWMinfo *info);
#if SDL_VIDEO_DRIVER_VITA
#if defined(SDL_VIDEO_VITA_PVR_OGL)
/* OpenGL functions */

View File

@@ -25,11 +25,12 @@
/* SDL internals */
#include "../SDL_sysvideo.h"
#include "SDL_version.h"
#include "SDL_syswm.h"
#include "SDL_loadso.h"
#include "SDL_events.h"
#include "../../events/SDL_events_c.h"
#include "SDL_syswm.h"
#ifdef SDL_INPUT_LINUXEV
#include "../../core/linux/SDL_evdev.h"
#endif

View File

@@ -80,8 +80,7 @@ void VIVANTE_HideWindow(_THIS, SDL_Window * window);
void VIVANTE_DestroyWindow(_THIS, SDL_Window * window);
/* Window manager function */
SDL_bool VIVANTE_GetWindowWMInfo(_THIS, SDL_Window * window,
struct SDL_SysWMinfo *info);
int VIVANTE_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info);
/* Event functions */
void VIVANTE_PumpEvents(_THIS);

View File

@@ -33,6 +33,8 @@
#include "SDL_loadso.h"
#include "SDL_waylandvulkan.h"
#define SDL_ENABLE_SYSWM_WAYLAND
#include "SDL_syswm.h"
#if defined(__OpenBSD__)

View File

@@ -1152,94 +1152,36 @@ static const struct wl_surface_listener surface_listener = {
handle_surface_leave
};
static void
Wayland_FillEmptyShellInfo(SDL_SysWMinfo * info, const Uint32 version)
{
info->info.wl.xdg_surface = NULL;
if (version >= SDL_VERSIONNUM(2, 0, 17)) {
info->info.wl.xdg_toplevel = NULL;
if (version >= SDL_VERSIONNUM(2, 0, 22)) {
info->info.wl.xdg_popup = NULL;
info->info.wl.xdg_positioner = NULL;
}
}
}
SDL_bool
Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
int
Wayland_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
{
SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata;
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
const Uint32 version = SDL_VERSIONNUM((Uint32)info->version.major,
(Uint32)info->version.minor,
(Uint32)info->version.patch);
/* Before 2.0.6, it was possible to build an SDL with Wayland support
(SDL_SysWMinfo will be large enough to hold Wayland info), but build
your app against SDL headers that didn't have Wayland support
(SDL_SysWMinfo could be smaller than Wayland needs. This would lead
to an app properly using SDL_GetWindowWMInfo() but we'd accidentally
overflow memory on the stack or heap. To protect against this, we've
padded out the struct unconditionally in the headers and Wayland will
just return an error for older apps using this function. Those apps
will need to be recompiled against newer headers or not use Wayland,
maybe by forcing SDL_VIDEODRIVER=x11. */
if (version < SDL_VERSIONNUM(2, 0, 6)) {
info->subsystem = SDL_SYSWM_UNKNOWN;
SDL_SetError("Version must be 2.0.6 or newer");
return SDL_FALSE;
}
info->subsystem = SDL_SYSWM_WAYLAND;
info->info.wl.display = data->waylandData->display;
info->info.wl.surface = data->surface;
if (version >= SDL_VERSIONNUM(2, 0, 15)) {
info->info.wl.egl_window = data->egl_window;
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);
if (version >= SDL_VERSIONNUM(2, 0, 17)) {
info->info.wl.xdg_toplevel = libdecor_frame_get_xdg_toplevel(data->shell_surface.libdecor.frame);
if (version >= SDL_VERSIONNUM(2, 0, 22)) {
info->info.wl.xdg_popup = NULL;
info->info.wl.xdg_positioner = NULL;
}
}
} else {
/* Not mapped yet */
Wayland_FillEmptyShellInfo(info, version);
}
} else
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) {
info->info.wl.xdg_surface = data->shell_surface.xdg.surface;
if (version >= SDL_VERSIONNUM(2, 0, 17)) {
SDL_bool popup = data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP;
info->info.wl.xdg_toplevel = popup ? NULL : data->shell_surface.xdg.roleobj.toplevel;
if (version >= SDL_VERSIONNUM(2, 0, 22)) {
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;
} else {
info->info.wl.xdg_popup = NULL;
info->info.wl.xdg_positioner = NULL;
}
}
}
} else {
/* Either it's not mapped yet or we don't have a shell protocol */
Wayland_FillEmptyShellInfo(info, version);
if (viddata->shell.xdg && data->shell_surface.xdg.surface != NULL) {
SDL_bool popup = (data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) ? SDL_TRUE : SDL_FALSE;
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;
}
}
/* Deprecated in 2.0.16 */
info->info.wl.shell_surface = NULL;
info->subsystem = SDL_SYSWM_WAYLAND;
return SDL_TRUE;
return 0;
}
int

View File

@@ -25,9 +25,11 @@
#define SDL_waylandwindow_h_
#include "../SDL_sysvideo.h"
#include "SDL_syswm.h"
#include "../../events/SDL_touch_c.h"
#define SDL_ENABLE_SYSWM_WAYLAND
#include "SDL_syswm.h"
#include "SDL_waylandvideo.h"
struct SDL_WaylandInput;
@@ -132,8 +134,7 @@ extern void Wayland_SetWindowTitle(_THIS, SDL_Window * window);
extern void Wayland_DestroyWindow(_THIS, SDL_Window *window);
extern void Wayland_SuspendScreenSaver(_THIS);
extern SDL_bool
Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info);
extern int Wayland_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info);
extern int Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
extern int Wayland_FlashWindow(_THIS, SDL_Window * window, SDL_FlashOperation operation);

View File

@@ -25,7 +25,6 @@
#include "SDL_windowsvideo.h"
#include "SDL_windowsshape.h"
#include "SDL_system.h"
#include "SDL_syswm.h"
#include "SDL_timer.h"
#include "SDL_vkeys.h"
#include "SDL_hints.h"
@@ -36,6 +35,9 @@
#include "SDL_hints.h"
#include "SDL_log.h"
#define SDL_ENABLE_SYSWM_WINDOWS
#include "SDL_syswm.h"
/* Dropfile support */
#include <shellapi.h>
@@ -641,7 +643,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) {
SDL_SysWMmsg wmmsg;
SDL_VERSION(&wmmsg.version);
wmmsg.version = SDL_SYSWM_CURRENT_VERSION;
wmmsg.subsystem = SDL_SYSWM_WINDOWS;
wmmsg.msg.win.hwnd = hwnd;
wmmsg.msg.win.msg = msg;

View File

@@ -33,6 +33,8 @@
#include "SDL_loadso.h"
#include "SDL_windowsvulkan.h"
#define SDL_ENABLE_SYSWM_WINDOWS
#include "SDL_syswm.h"
int WIN_Vulkan_LoadLibrary(_THIS, const char *path)

View File

@@ -42,7 +42,7 @@
/* Dropfile support */
#include <shellapi.h>
/* This is included after SDL_windowsvideo.h, which includes windows.h */
#define SDL_ENABLE_SYSWM_WINDOWS
#include "SDL_syswm.h"
/* Windows CE compatibility */
@@ -1195,30 +1195,17 @@ WIN_DestroyWindow(_THIS, SDL_Window * window)
CleanupWindowData(_this, window);
}
SDL_bool
WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
int
WIN_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
{
const SDL_WindowData *data = (const SDL_WindowData *) window->driverdata;
if (info->version.major <= SDL_MAJOR_VERSION) {
int versionnum = SDL_VERSIONNUM(info->version.major, info->version.minor, info->version.patch);
info->subsystem = SDL_SYSWM_WINDOWS;
info->info.win.window = data->hwnd;
info->subsystem = SDL_SYSWM_WINDOWS;
info->info.win.window = data->hwnd;
info->info.win.hdc = data->hdc;
info->info.win.hinstance = data->hinstance;
if (versionnum >= SDL_VERSIONNUM(2, 0, 4)) {
info->info.win.hdc = data->hdc;
}
if (versionnum >= SDL_VERSIONNUM(2, 0, 5)) {
info->info.win.hinstance = data->hinstance;
}
return SDL_TRUE;
} else {
SDL_SetError("Application not compiled with SDL %d",
SDL_MAJOR_VERSION);
return SDL_FALSE;
}
return 0;
}
/*

View File

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

View File

@@ -54,13 +54,10 @@ static const GUID SDL_IID_IDXGIFactory2 = { 0x50c83a1c, 0xe072, 0x4c48, { 0x
/* SDL includes */
extern "C" {
#include "SDL_video.h"
#include "SDL_mouse.h"
#include "../SDL_sysvideo.h"
#include "../SDL_pixels_c.h"
#include "../../events/SDL_events_c.h"
#include "../../render/SDL_sysrender.h"
#include "SDL_syswm.h"
#include "SDL_winrtopengles.h"
#include "../../core/windows/SDL_windows.h"
}
@@ -72,9 +69,14 @@ extern "C" {
#include "SDL_winrtgamebar_cpp.h"
#include "SDL_winrtmouse_c.h"
#include "SDL_main.h"
#include "SDL_mouse.h"
#include "SDL_video.h"
#include "SDL_system.h"
#include "SDL_hints.h"
#define SDL_ENABLE_SYSWM_WINRT
#include "SDL_syswm.h"
/* Initialization/Query functions */
static int WINRT_VideoInit(_THIS);
@@ -88,7 +90,7 @@ static int WINRT_CreateWindow(_THIS, SDL_Window * window);
static void WINRT_SetWindowSize(_THIS, SDL_Window * window);
static void WINRT_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
static void WINRT_DestroyWindow(_THIS, SDL_Window * window);
static SDL_bool WINRT_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info);
static int WINRT_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info);
/* Misc functions */
@@ -826,21 +828,14 @@ WINRT_DestroyWindow(_THIS, SDL_Window * window)
}
}
SDL_bool
WINRT_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
int
WINRT_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
{
SDL_WindowData * data = (SDL_WindowData *) window->driverdata;
SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
if (info->version.major <= SDL_MAJOR_VERSION) {
info->subsystem = SDL_SYSWM_WINRT;
info->info.winrt.window = reinterpret_cast<IInspectable *>(data->coreWindow.Get());
return SDL_TRUE;
} else {
SDL_SetError("Application not compiled with SDL %d",
SDL_MAJOR_VERSION);
return SDL_FALSE;
}
return SDL_FALSE;
info->subsystem = SDL_SYSWM_WINRT;
info->info.winrt.window = reinterpret_cast<IInspectable *>(data->coreWindow.Get());
return 0;
}
static ABI::Windows::System::Display::IDisplayRequest *

View File

@@ -39,6 +39,8 @@
#include "SDL_hints.h"
#include "SDL_timer.h"
#define SDL_ENABLE_SYSWM_X11
#include "SDL_syswm.h"
#include <stdio.h>
@@ -317,7 +319,7 @@ static void X11_HandleGenericEvent(SDL_VideoData *videodata, XEvent *xev)
if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) {
SDL_SysWMmsg wmmsg;
SDL_VERSION(&wmmsg.version);
wmmsg.version = SDL_SYSWM_CURRENT_VERSION;
wmmsg.subsystem = SDL_SYSWM_X11;
wmmsg.msg.x11.event = *xev;
SDL_SendSysWMEvent(&wmmsg);
@@ -812,7 +814,7 @@ X11_DispatchEvent(_THIS, XEvent *xevent)
if (SDL_GetEventState(SDL_SYSWMEVENT) == SDL_ENABLE) {
SDL_SysWMmsg wmmsg;
SDL_VERSION(&wmmsg.version);
wmmsg.version = SDL_SYSWM_CURRENT_VERSION;
wmmsg.subsystem = SDL_SYSWM_X11;
wmmsg.msg.x11.event = *xevent;
SDL_SendSysWMEvent(&wmmsg);

View File

@@ -40,6 +40,8 @@
#endif
#include "SDL_timer.h"
#define SDL_ENABLE_SYSWM_X11
#include "SDL_syswm.h"
#define _NET_WM_STATE_REMOVE 0l
@@ -1761,30 +1763,22 @@ X11_DestroyWindow(_THIS, SDL_Window * window)
window->driverdata = NULL;
}
SDL_bool
X11_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
int
X11_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
{
SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
Display *display;
SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata;
if (!data) {
/* This sometimes happens in SDL_IBus_UpdateTextRect() while creating the window */
SDL_SetError("Window not initialized");
return SDL_FALSE;
return SDL_SetError("Window not initialized");
}
display = data->videodata->display;
if (info->version.major == SDL_MAJOR_VERSION) {
info->subsystem = SDL_SYSWM_X11;
info->info.x11.display = display;
info->info.x11.window = data->xwindow;
return SDL_TRUE;
} else {
SDL_SetError("Application not compiled with SDL %d",
SDL_MAJOR_VERSION);
return SDL_FALSE;
}
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

View File

@@ -111,8 +111,7 @@ extern void* X11_GetWindowICCProfile(_THIS, SDL_Window * window, size_t * size);
extern void X11_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbed);
extern void X11_SetWindowKeyboardGrab(_THIS, SDL_Window * window, SDL_bool grabbed);
extern void X11_DestroyWindow(_THIS, SDL_Window * window);
extern SDL_bool X11_GetWindowWMInfo(_THIS, SDL_Window * window,
struct SDL_SysWMinfo *info);
extern int X11_GetWindowWMInfo(_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(_THIS, SDL_Window * window, SDL_FlashOperation operation);