mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-02 07:27:19 +08:00
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:
+2
-846
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,24 @@
|
||||
# Migrating to SDL 3.0
|
||||
|
||||
This guide provides useful information for migrating applications from SDL 2.0 to SDL 3.0.
|
||||
|
||||
We have provided a handy Python script to automate some of this work for you [link to script], and details on the changes are organized by SDL 2.0 header below.
|
||||
|
||||
## SDL_syswm.h
|
||||
|
||||
This header no longer includes platform specific headers and type definitions, instead allowing you to include the ones appropriate for your use case. You should define one or more of the following to enable the relevant platform-specific support:
|
||||
* SDL_ENABLE_SYSWM_ANDROID
|
||||
* SDL_ENABLE_SYSWM_COCOA
|
||||
* SDL_ENABLE_SYSWM_KMSDRM
|
||||
* SDL_ENABLE_SYSWM_UIKIT
|
||||
* SDL_ENABLE_SYSWM_VIVANTE
|
||||
* SDL_ENABLE_SYSWM_WAYLAND
|
||||
* SDL_ENABLE_SYSWM_WINDOWS
|
||||
* SDL_ENABLE_SYSWM_X11
|
||||
|
||||
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.
|
||||
|
||||
### SDL_GetWindowWMInfo
|
||||
|
||||
This function now returns a standard int result instead of SDL_bool, returning 0 if the function succeeds or a negative error code if there was an error. You should also pass `SDL_SYSWM_CURRENT_VERSION` as the new third version parameter. The version member of the info structure will be filled in with the version of data that is returned, the minimum of the version you requested and the version supported by the runtime SDL library.
|
||||
|
||||
+61
-131
@@ -40,86 +40,38 @@
|
||||
* 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_EventState().
|
||||
*
|
||||
* As of SDL 3.0, this file no longer includes the platform specific headers
|
||||
* and types. You should include the headers you need and define one or more
|
||||
* of the following for the subsystems you're working with:
|
||||
*
|
||||
* SDL_ENABLE_SYSWM_ANDROID
|
||||
* SDL_ENABLE_SYSWM_COCOA
|
||||
* SDL_ENABLE_SYSWM_KMSDRM
|
||||
* SDL_ENABLE_SYSWM_UIKIT
|
||||
* SDL_ENABLE_SYSWM_VIVANTE
|
||||
* SDL_ENABLE_SYSWM_WAYLAND
|
||||
* SDL_ENABLE_SYSWM_WINDOWS
|
||||
* SDL_ENABLE_SYSWM_WINRT
|
||||
* SDL_ENABLE_SYSWM_X11
|
||||
*/
|
||||
struct SDL_SysWMinfo;
|
||||
|
||||
#if !defined(SDL_PROTOTYPES_ONLY)
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
|
||||
#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
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_WINRT)
|
||||
#include <Inspectable.h>
|
||||
#endif
|
||||
|
||||
/* This is the structure for custom window manager events */
|
||||
#if defined(SDL_VIDEO_DRIVER_X11)
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
/* conflicts with Quickdraw.h */
|
||||
#define Cursor X11Cursor
|
||||
#endif
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
/* matches the re-define above */
|
||||
#undef Cursor
|
||||
#endif
|
||||
|
||||
#endif /* defined(SDL_VIDEO_DRIVER_X11) */
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_COCOA)
|
||||
#ifdef __OBJC__
|
||||
@class NSWindow;
|
||||
#else
|
||||
typedef struct _NSWindow NSWindow;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_UIKIT)
|
||||
#ifdef __OBJC__
|
||||
#include <UIKit/UIKit.h>
|
||||
#else
|
||||
typedef struct _UIWindow UIWindow;
|
||||
typedef struct _UIViewController UIViewController;
|
||||
#endif
|
||||
typedef Uint32 GLuint;
|
||||
#endif
|
||||
|
||||
#if defined(SDL_VIDEO_VULKAN) || defined(SDL_VIDEO_METAL)
|
||||
#define SDL_METALVIEW_TAG 255
|
||||
#endif
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_ANDROID)
|
||||
typedef struct ANativeWindow ANativeWindow;
|
||||
typedef void *EGLSurface;
|
||||
#endif
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_VIVANTE)
|
||||
#include "SDL_egl.h"
|
||||
#endif
|
||||
|
||||
#endif /* SDL_PROTOTYPES_ONLY */
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_KMSDRM)
|
||||
struct gbm_device;
|
||||
#endif
|
||||
|
||||
|
||||
#include "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
|
||||
|
||||
|
||||
#if !defined(SDL_PROTOTYPES_ONLY)
|
||||
/**
|
||||
* These are the various supported windowing subsystems
|
||||
@@ -127,17 +79,17 @@ extern "C" {
|
||||
typedef enum
|
||||
{
|
||||
SDL_SYSWM_UNKNOWN,
|
||||
SDL_SYSWM_WINDOWS,
|
||||
SDL_SYSWM_X11,
|
||||
SDL_SYSWM_COCOA,
|
||||
SDL_SYSWM_UIKIT,
|
||||
SDL_SYSWM_WAYLAND,
|
||||
SDL_SYSWM_WINRT,
|
||||
SDL_SYSWM_ANDROID,
|
||||
SDL_SYSWM_VIVANTE,
|
||||
SDL_SYSWM_COCOA,
|
||||
SDL_SYSWM_HAIKU,
|
||||
SDL_SYSWM_KMSDRM,
|
||||
SDL_SYSWM_RISCOS
|
||||
SDL_SYSWM_RISCOS,
|
||||
SDL_SYSWM_UIKIT,
|
||||
SDL_SYSWM_VIVANTE,
|
||||
SDL_SYSWM_WAYLAND,
|
||||
SDL_SYSWM_WINDOWS,
|
||||
SDL_SYSWM_WINRT,
|
||||
SDL_SYSWM_X11
|
||||
} SDL_SYSWM_TYPE;
|
||||
|
||||
/**
|
||||
@@ -145,11 +97,14 @@ typedef enum
|
||||
*/
|
||||
struct SDL_SysWMmsg
|
||||
{
|
||||
SDL_version version;
|
||||
SDL_SYSWM_TYPE subsystem;
|
||||
Uint32 version;
|
||||
Uint32 subsystem; /**< SDL_SYSWM_TYPE */
|
||||
|
||||
Uint32 padding[(2 * (sizeof (void *) >= 8 ? sizeof (void *) : sizeof(Uint64)) - 2 * sizeof(Uint32)) / sizeof(Uint32)];
|
||||
|
||||
union
|
||||
{
|
||||
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
|
||||
#if defined(SDL_ENABLE_SYSWM_WINDOWS)
|
||||
struct {
|
||||
HWND hwnd; /**< The window for the message */
|
||||
UINT msg; /**< The type of message */
|
||||
@@ -157,34 +112,10 @@ struct SDL_SysWMmsg
|
||||
LPARAM lParam; /**< LONG message parameter */
|
||||
} win;
|
||||
#endif
|
||||
#if defined(SDL_VIDEO_DRIVER_X11)
|
||||
#if defined(SDL_ENABLE_SYSWM_X11)
|
||||
struct {
|
||||
XEvent event;
|
||||
} x11;
|
||||
#endif
|
||||
#if defined(SDL_VIDEO_DRIVER_COCOA)
|
||||
struct
|
||||
{
|
||||
/* Latest version of Xcode clang complains about empty structs in C v. C++:
|
||||
error: empty struct has size 0 in C, size 1 in C++
|
||||
*/
|
||||
int dummy;
|
||||
/* No Cocoa window events yet */
|
||||
} cocoa;
|
||||
#endif
|
||||
#if defined(SDL_VIDEO_DRIVER_UIKIT)
|
||||
struct
|
||||
{
|
||||
int dummy;
|
||||
/* No UIKit window events yet */
|
||||
} uikit;
|
||||
#endif
|
||||
#if defined(SDL_VIDEO_DRIVER_VIVANTE)
|
||||
struct
|
||||
{
|
||||
int dummy;
|
||||
/* No Vivante window events yet */
|
||||
} vivante;
|
||||
#endif
|
||||
/* Can't have an empty union */
|
||||
int dummy;
|
||||
@@ -199,11 +130,14 @@ struct SDL_SysWMmsg
|
||||
*/
|
||||
struct SDL_SysWMinfo
|
||||
{
|
||||
SDL_version version;
|
||||
SDL_SYSWM_TYPE subsystem;
|
||||
Uint32 version;
|
||||
Uint32 subsystem; /**< SDL_SYSWM_TYPE */
|
||||
|
||||
Uint32 padding[(2 * (sizeof (void *) >= 8 ? sizeof (void *) : sizeof(Uint64)) - 2 * sizeof(Uint32)) / sizeof(Uint32)];
|
||||
|
||||
union
|
||||
{
|
||||
#if defined(SDL_VIDEO_DRIVER_WINDOWS)
|
||||
#if defined(SDL_ENABLE_SYSWM_WINDOWS)
|
||||
struct
|
||||
{
|
||||
HWND window; /**< The window handle */
|
||||
@@ -211,20 +145,21 @@ struct SDL_SysWMinfo
|
||||
HINSTANCE hinstance; /**< The instance handle */
|
||||
} win;
|
||||
#endif
|
||||
#if defined(SDL_VIDEO_DRIVER_WINRT)
|
||||
#if defined(SDL_ENABLE_SYSWM_WINRT)
|
||||
struct
|
||||
{
|
||||
IInspectable * window; /**< The WinRT CoreWindow */
|
||||
} winrt;
|
||||
#endif
|
||||
#if defined(SDL_VIDEO_DRIVER_X11)
|
||||
#if defined(SDL_ENABLE_SYSWM_X11)
|
||||
struct
|
||||
{
|
||||
Display *display; /**< The X11 display */
|
||||
int screen; /**< The X11 screen */
|
||||
Window window; /**< The X11 window */
|
||||
} x11;
|
||||
#endif
|
||||
#if defined(SDL_VIDEO_DRIVER_COCOA)
|
||||
#if defined(SDL_ENABLE_SYSWM_COCOA)
|
||||
struct
|
||||
{
|
||||
#if defined(__OBJC__) && defined(__has_feature)
|
||||
@@ -238,7 +173,7 @@ struct SDL_SysWMinfo
|
||||
#endif
|
||||
} cocoa;
|
||||
#endif
|
||||
#if defined(SDL_VIDEO_DRIVER_UIKIT)
|
||||
#if defined(SDL_ENABLE_SYSWM_UIKIT)
|
||||
struct
|
||||
{
|
||||
#if defined(__OBJC__) && defined(__has_feature)
|
||||
@@ -255,12 +190,11 @@ struct SDL_SysWMinfo
|
||||
GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
|
||||
} uikit;
|
||||
#endif
|
||||
#if defined(SDL_VIDEO_DRIVER_WAYLAND)
|
||||
#if defined(SDL_ENABLE_SYSWM_WAYLAND)
|
||||
struct
|
||||
{
|
||||
struct wl_display *display; /**< Wayland display */
|
||||
struct wl_surface *surface; /**< Wayland surface */
|
||||
void *shell_surface; /**< DEPRECATED Wayland shell_surface (window manager handle) */
|
||||
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 */
|
||||
@@ -269,7 +203,7 @@ struct SDL_SysWMinfo
|
||||
} wl;
|
||||
#endif
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_ANDROID)
|
||||
#if defined(SDL_ENABLE_SYSWM_ANDROID)
|
||||
struct
|
||||
{
|
||||
ANativeWindow *window;
|
||||
@@ -277,7 +211,7 @@ struct SDL_SysWMinfo
|
||||
} android;
|
||||
#endif
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_VIVANTE)
|
||||
#if defined(SDL_ENABLE_SYSWM_VIVANTE)
|
||||
struct
|
||||
{
|
||||
EGLNativeDisplayType display;
|
||||
@@ -285,7 +219,7 @@ struct SDL_SysWMinfo
|
||||
} vivante;
|
||||
#endif
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_KMSDRM)
|
||||
#if defined(SDL_ENABLE_SYSWM_KMSDRM)
|
||||
struct
|
||||
{
|
||||
int dev_index; /**< Device index (ex: the X in /dev/dri/cardX) */
|
||||
@@ -294,11 +228,12 @@ struct SDL_SysWMinfo
|
||||
} kmsdrm;
|
||||
#endif
|
||||
|
||||
/* Make sure this union is always 64 bytes (8 64-bit pointers). */
|
||||
/* Be careful not to overflow this if you add a new target! */
|
||||
Uint8 dummy[64];
|
||||
/* 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);
|
||||
|
||||
#endif /* SDL_PROTOTYPES_ONLY */
|
||||
|
||||
@@ -310,20 +245,15 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo;
|
||||
*
|
||||
* You must include SDL_syswm.h for the declaration of SDL_SysWMinfo.
|
||||
*
|
||||
* The caller must initialize the `info` structure's version by using
|
||||
* `SDL_VERSION(&info.version)`, and then this function will fill in the rest
|
||||
* of the structure with information about the given window.
|
||||
*
|
||||
* \param window the window about which information is being requested
|
||||
* \param info an SDL_SysWMinfo structure filled in with window information
|
||||
* \returns SDL_TRUE if the function is implemented and the `version` member
|
||||
* of the `info` struct is valid, or SDL_FALSE if the information
|
||||
* could not be retrieved; call SDL_GetError() for more 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 SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window,
|
||||
SDL_SysWMinfo * info);
|
||||
extern DECLSPEC int SDLCALL SDL_GetWindowWMInfo(SDL_Window *window, SDL_SysWMinfo *info, Uint32 version);
|
||||
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
|
||||
+10
-12
@@ -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
|
||||
|
||||
#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 (SDL_GetWindowWMInfo(focused_win, &info, SDL_SYSWM_CURRENT_VERSION) == 0) {
|
||||
#ifdef SDL_ENABLE_SYSWM_X11
|
||||
if (info.subsystem == SDL_SYSWM_X11) {
|
||||
SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata;
|
||||
|
||||
Display *x_disp = info.info.x11.display;
|
||||
int x_screen = info.info.x11.screen;
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (cursor->x == -1 && cursor->y == -1 && cursor->w == 0 && cursor->h == 0) {
|
||||
/* move to bottom left */
|
||||
|
||||
@@ -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
|
||||
#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 (SDL_GetWindowWMInfo(focused_win, &info, SDL_SYSWM_CURRENT_VERSION) == 0) {
|
||||
#ifdef SDL_ENABLE_SYSWM_X11
|
||||
if (info.subsystem == SDL_SYSWM_X11) {
|
||||
SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata;
|
||||
|
||||
Display *x_disp = info.info.x11.display;
|
||||
int x_screen = info.info.x11.screen;
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
x += ibus_cursor_rect.x;
|
||||
y += ibus_cursor_rect.y;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
/* * * */
|
||||
/*
|
||||
|
||||
+20
-15
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,12 +204,11 @@ 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;
|
||||
|
||||
@@ -215,12 +216,7 @@ Android_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
|
||||
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 */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
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;
|
||||
}
|
||||
return 0;
|
||||
}}
|
||||
|
||||
SDL_bool
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -223,21 +223,11 @@ 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) {
|
||||
int HAIKU_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
|
||||
{
|
||||
info->subsystem = SDL_SYSWM_HAIKU;
|
||||
return SDL_TRUE;
|
||||
} else {
|
||||
SDL_SetError("Application not compiled with SDL %d",
|
||||
SDL_MAJOR_VERSION);
|
||||
return SDL_FALSE;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
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 */
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#define _SDL_ngagewindow_h
|
||||
|
||||
#include "../SDL_sysvideo.h"
|
||||
|
||||
#include "SDL_syswm.h"
|
||||
|
||||
#include "SDL_ngagevideo.h"
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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: */
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
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;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_RISCOS */
|
||||
|
||||
@@ -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_ */
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
int
|
||||
UIKit_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
|
||||
{ @autoreleasepool
|
||||
{
|
||||
@autoreleasepool {
|
||||
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;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}}
|
||||
|
||||
#if !TARGET_OS_TV
|
||||
NSUInteger
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
|
||||
#include "SDL_loadso.h"
|
||||
#include "SDL_waylandvulkan.h"
|
||||
|
||||
#define SDL_ENABLE_SYSWM_WAYLAND
|
||||
#include "SDL_syswm.h"
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
|
||||
@@ -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
|
||||
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;
|
||||
|
||||
#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
|
||||
#endif
|
||||
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;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/* Deprecated in 2.0.16 */
|
||||
info->info.wl.shell_surface = NULL;
|
||||
|
||||
info->subsystem = SDL_SYSWM_WAYLAND;
|
||||
|
||||
return SDL_TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
int
|
||||
WINRT_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_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;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ABI::Windows::System::Display::IDisplayRequest *
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user