mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-28 20:37:24 +02:00
SDL_syswm.h has been removed and replaced with window properties
This commit is contained in:
@@ -151,9 +151,6 @@ struct SDL_VideoDisplay
|
||||
SDL_DisplayData *driverdata;
|
||||
};
|
||||
|
||||
/* Forward declaration */
|
||||
struct SDL_SysWMinfo;
|
||||
|
||||
/* Video device flags */
|
||||
typedef enum
|
||||
{
|
||||
@@ -267,9 +264,6 @@ struct SDL_VideoDevice
|
||||
*/
|
||||
SDL_ShapeDriver shape_driver;
|
||||
|
||||
/* Get some platform dependent window information */
|
||||
int (*GetWindowWMInfo)(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
|
||||
|
||||
/* * * */
|
||||
/*
|
||||
* OpenGL support
|
||||
|
||||
@@ -32,8 +32,6 @@
|
||||
#include "../events/SDL_events_c.h"
|
||||
#include "../timer/SDL_timer_c.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
#ifdef SDL_VIDEO_OPENGL
|
||||
#include <SDL3/SDL_opengl.h>
|
||||
#endif /* SDL_VIDEO_OPENGL */
|
||||
@@ -4671,33 +4669,6 @@ void SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask)
|
||||
}
|
||||
#endif
|
||||
|
||||
int SDL_GetWindowWMInfo(SDL_Window *window, struct SDL_SysWMinfo *info, Uint32 version)
|
||||
{
|
||||
CHECK_WINDOW_MAGIC(window, -1);
|
||||
|
||||
if (info == NULL) {
|
||||
return SDL_InvalidParamError("info");
|
||||
}
|
||||
|
||||
/* Set the version in the structure to the minimum of our version and the application expected version */
|
||||
version = SDL_min(version, SDL_SYSWM_CURRENT_VERSION);
|
||||
|
||||
if (version == 1) {
|
||||
SDL_memset(info, 0, SDL_SYSWM_INFO_SIZE_V1);
|
||||
} else {
|
||||
return SDL_SetError("Unknown info version");
|
||||
}
|
||||
|
||||
info->subsystem = SDL_SYSWM_UNKNOWN;
|
||||
info->version = version;
|
||||
|
||||
if (_this->GetWindowWMInfo) {
|
||||
return (_this->GetWindowWMInfo(_this, window, info));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void SDL_StartTextInput(void)
|
||||
{
|
||||
SDL_Window *window;
|
||||
@@ -4827,20 +4798,6 @@ int SDL_GetMessageBoxCount(void)
|
||||
#include "vita/SDL_vitamessagebox.h"
|
||||
#endif
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_WINRT) || defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT) || defined(SDL_VIDEO_DRIVER_X11) || defined(SDL_VIDEO_DRIVER_WAYLAND) || defined(SDL_VIDEO_DRIVER_HAIKU) || defined(SDL_VIDEO_DRIVER_RISCOS)
|
||||
static SDL_bool SDL_IsMessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype)
|
||||
{
|
||||
SDL_SysWMinfo info;
|
||||
SDL_Window *window = messageboxdata->window;
|
||||
|
||||
if (window == NULL || SDL_GetWindowWMInfo(window, &info, SDL_SYSWM_CURRENT_VERSION) < 0) {
|
||||
return SDL_TRUE;
|
||||
} else {
|
||||
return info.subsystem == (Uint32)drivertype;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
{
|
||||
int dummybutton;
|
||||
@@ -4894,56 +4851,48 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
#endif
|
||||
#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
|
||||
if (retval == -1 &&
|
||||
SDL_IsMessageboxValidForDriver(messageboxdata, SDL_SYSWM_WINDOWS) &&
|
||||
WIN_ShowMessageBox(messageboxdata, buttonid) == 0) {
|
||||
retval = 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_WINRT
|
||||
if (retval == -1 &&
|
||||
SDL_IsMessageboxValidForDriver(messageboxdata, SDL_SYSWM_WINRT) &&
|
||||
WINRT_ShowMessageBox(messageboxdata, buttonid) == 0) {
|
||||
retval = 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_COCOA
|
||||
if (retval == -1 &&
|
||||
SDL_IsMessageboxValidForDriver(messageboxdata, SDL_SYSWM_COCOA) &&
|
||||
Cocoa_ShowMessageBox(messageboxdata, buttonid) == 0) {
|
||||
retval = 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_UIKIT
|
||||
if (retval == -1 &&
|
||||
SDL_IsMessageboxValidForDriver(messageboxdata, SDL_SYSWM_UIKIT) &&
|
||||
UIKit_ShowMessageBox(messageboxdata, buttonid) == 0) {
|
||||
retval = 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_WAYLAND
|
||||
if (retval == -1 &&
|
||||
SDL_IsMessageboxValidForDriver(messageboxdata, SDL_SYSWM_WAYLAND) &&
|
||||
Wayland_ShowMessageBox(messageboxdata, buttonid) == 0) {
|
||||
retval = 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_X11
|
||||
if (retval == -1 &&
|
||||
SDL_IsMessageboxValidForDriver(messageboxdata, SDL_SYSWM_X11) &&
|
||||
X11_ShowMessageBox(messageboxdata, buttonid) == 0) {
|
||||
retval = 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_HAIKU
|
||||
if (retval == -1 &&
|
||||
SDL_IsMessageboxValidForDriver(messageboxdata, SDL_SYSWM_HAIKU) &&
|
||||
HAIKU_ShowMessageBox(messageboxdata, buttonid) == 0) {
|
||||
retval = 0;
|
||||
}
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_RISCOS
|
||||
if (retval == -1 &&
|
||||
SDL_IsMessageboxValidForDriver(messageboxdata, SDL_SYSWM_RISCOS) &&
|
||||
RISCOS_ShowMessageBox(messageboxdata, buttonid) == 0) {
|
||||
retval = 0;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,6 @@ static SDL_VideoDevice *Android_CreateDevice(void)
|
||||
device->MinimizeWindow = Android_MinimizeWindow;
|
||||
device->SetWindowResizable = Android_SetWindowResizable;
|
||||
device->DestroyWindow = Android_DestroyWindow;
|
||||
device->GetWindowWMInfo = Android_GetWindowWMInfo;
|
||||
|
||||
device->free = Android_DeleteDevice;
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
|
||||
#include "SDL_androidvulkan.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
int Android_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "SDL_androidvideo.h"
|
||||
#include "SDL_androidwindow.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
/* Currently only one window */
|
||||
SDL_Window *Android_Window = NULL;
|
||||
@@ -68,12 +67,12 @@ int Android_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
}
|
||||
|
||||
data->native_window = Android_JNI_GetNativeWindow();
|
||||
|
||||
if (!data->native_window) {
|
||||
SDL_free(data);
|
||||
retval = SDL_SetError("Could not fetch native window");
|
||||
goto endfunction;
|
||||
}
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), "SDL.window.android.window", data->native_window);
|
||||
|
||||
/* Do not create EGLSurface for Vulkan window since it will then make the window
|
||||
incompatible with vkCreateAndroidSurfaceKHR */
|
||||
@@ -88,6 +87,7 @@ int Android_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
goto endfunction;
|
||||
}
|
||||
}
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), "SDL.window.android.surface", data->egl_surface);
|
||||
#endif
|
||||
|
||||
window->driverdata = data;
|
||||
@@ -194,18 +194,4 @@ void Android_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
SDL_UnlockMutex(Android_ActivityMutex);
|
||||
}
|
||||
|
||||
int Android_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, SDL_SysWMinfo *info)
|
||||
{
|
||||
SDL_WindowData *data = window->driverdata;
|
||||
|
||||
info->subsystem = SDL_SYSWM_ANDROID;
|
||||
info->info.android.window = data->native_window;
|
||||
|
||||
#ifdef SDL_VIDEO_OPENGL_EGL
|
||||
info->info.android.surface = data->egl_surface;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_ANDROID */
|
||||
|
||||
@@ -33,7 +33,6 @@ extern void Android_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
extern void Android_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool resizable);
|
||||
|
||||
extern void Android_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
extern int Android_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
|
||||
extern SDL_Window *Android_Window;
|
||||
|
||||
struct SDL_WindowData
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
|
||||
#if defined(SDL_VIDEO_DRIVER_COCOA) && (defined(SDL_VIDEO_VULKAN) || defined(SDL_VIDEO_METAL))
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
static int SDLCALL SDL_MetalViewEventWatch(void *userdata, SDL_Event *event)
|
||||
{
|
||||
/* Update the drawable size when SDL receives a size changed event for
|
||||
|
||||
@@ -115,7 +115,6 @@ static SDL_VideoDevice *Cocoa_CreateDevice(void)
|
||||
device->SetWindowMouseGrab = Cocoa_SetWindowMouseGrab;
|
||||
device->SetWindowKeyboardGrab = Cocoa_SetWindowKeyboardGrab;
|
||||
device->DestroyWindow = Cocoa_DestroyWindow;
|
||||
device->GetWindowWMInfo = Cocoa_GetWindowWMInfo;
|
||||
device->SetWindowHitTest = Cocoa_SetWindowHitTest;
|
||||
device->AcceptDragAndDrop = Cocoa_AcceptDragAndDrop;
|
||||
device->FlashWindow = Cocoa_FlashWindow;
|
||||
|
||||
@@ -33,8 +33,6 @@
|
||||
#include "SDL_cocoametalview.h"
|
||||
#include "SDL_cocoavulkan.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
const char *defaultPaths[] = {
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
#include "../SDL_egl_c.h"
|
||||
#endif
|
||||
|
||||
#define SDL_METALVIEW_TAG 255
|
||||
|
||||
@class SDL_CocoaWindowData;
|
||||
|
||||
typedef enum
|
||||
@@ -165,7 +167,6 @@ extern SDL_DisplayID Cocoa_GetDisplayForWindow(SDL_VideoDevice *_this, SDL_Windo
|
||||
extern void Cocoa_SetWindowMouseRect(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
extern void Cocoa_SetWindowMouseGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed);
|
||||
extern void Cocoa_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
extern int Cocoa_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
|
||||
extern int Cocoa_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
|
||||
extern void Cocoa_AcceptDragAndDrop(SDL_Window *window, SDL_bool accept);
|
||||
extern int Cocoa_FlashWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOperation operation);
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
#include "SDL_cocoaopengl.h"
|
||||
#include "SDL_cocoaopengles.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
/* #define DEBUG_COCOAWINDOW */
|
||||
|
||||
@@ -1863,6 +1862,10 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, NSWindow
|
||||
*/
|
||||
[nswindow setOneShot:NO];
|
||||
|
||||
SDL_PropertiesID props = SDL_GetWindowProperties(window);
|
||||
SDL_SetProperty(props, "SDL.window.cocoa.window", (__bridge void *)data.nswindow);
|
||||
SDL_SetProperty(props, "SDL.window.cocoa.metal_view_tag", SDL_METALVIEW_TAG);
|
||||
|
||||
/* All done! */
|
||||
window->driverdata = (SDL_WindowData *)CFBridgingRetain(data);
|
||||
return 0;
|
||||
@@ -2580,17 +2583,6 @@ void Cocoa_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
}
|
||||
}
|
||||
|
||||
int Cocoa_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, SDL_SysWMinfo *info)
|
||||
{
|
||||
@autoreleasepool {
|
||||
NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)window->driverdata).nswindow;
|
||||
|
||||
info->subsystem = SDL_SYSWM_COCOA;
|
||||
info->info.cocoa.window = nswindow;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool Cocoa_IsWindowInFullscreenSpace(SDL_Window *window)
|
||||
{
|
||||
@autoreleasepool {
|
||||
|
||||
@@ -29,8 +29,6 @@ extern "C" {
|
||||
#include "SDL_internal.h"
|
||||
#include "SDL_bframebuffer.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -91,7 +91,6 @@ static SDL_VideoDevice * HAIKU_CreateDevice(void)
|
||||
device->SetWindowMouseGrab = HAIKU_SetWindowMouseGrab;
|
||||
device->SetWindowMinimumSize = HAIKU_SetWindowMinimumSize;
|
||||
device->DestroyWindow = HAIKU_DestroyWindow;
|
||||
device->GetWindowWMInfo = HAIKU_GetWindowWMInfo;
|
||||
device->CreateWindowFramebuffer = HAIKU_CreateWindowFramebuffer;
|
||||
device->UpdateWindowFramebuffer = HAIKU_UpdateWindowFramebuffer;
|
||||
device->DestroyWindowFramebuffer = HAIKU_DestroyWindowFramebuffer;
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
#include "SDL_BWin.h"
|
||||
#include <new>
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
/* Define a path to window's BWIN data */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -211,13 +209,6 @@ void HAIKU_DestroyWindow(SDL_VideoDevice *_this, SDL_Window * window) {
|
||||
window->driverdata = NULL;
|
||||
}
|
||||
|
||||
int HAIKU_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info)
|
||||
{
|
||||
info->subsystem = SDL_SYSWM_HAIKU;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -41,6 +41,5 @@ extern void HAIKU_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window,
|
||||
extern void HAIKU_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen);
|
||||
extern void HAIKU_SetWindowMouseGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed);
|
||||
extern void HAIKU_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
extern int HAIKU_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -35,8 +35,6 @@
|
||||
#include "../../core/openbsd/SDL_wscons.h"
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
/* KMS/DRM declarations */
|
||||
#include "SDL_kmsdrmdyn.h"
|
||||
#include "SDL_kmsdrmevents.h"
|
||||
@@ -295,7 +293,6 @@ static SDL_VideoDevice *KMSDRM_CreateDevice(void)
|
||||
device->MinimizeWindow = KMSDRM_MinimizeWindow;
|
||||
device->RestoreWindow = KMSDRM_RestoreWindow;
|
||||
device->DestroyWindow = KMSDRM_DestroyWindow;
|
||||
device->GetWindowWMInfo = KMSDRM_GetWindowWMInfo;
|
||||
|
||||
device->GL_LoadLibrary = KMSDRM_GLES_LoadLibrary;
|
||||
device->GL_GetProcAddress = KMSDRM_GLES_GetProcAddress;
|
||||
@@ -1437,6 +1434,11 @@ int KMSDRM_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
windata->viddata = viddata;
|
||||
window->driverdata = windata;
|
||||
|
||||
SDL_PropertiesID props = SDL_GetWindowProperties(window);
|
||||
SDL_SetProperty(props, "SDL.window.kmsdrm.dev_index", (void *)(intptr_t)viddata->devindex);
|
||||
SDL_SetProperty(props, "SDL.window.kmsdrm.drm_fd", (void *)(intptr_t)viddata->drm_fd);
|
||||
SDL_SetProperty(props, "SDL.window.kmsdrm.gbm_dev", viddata->gbm_dev);
|
||||
|
||||
if (!is_vulkan && !vulkan_mode) { /* NON-Vulkan block. */
|
||||
|
||||
/* Maybe you didn't ask for an OPENGL window, but that's what you will get.
|
||||
@@ -1595,19 +1597,4 @@ void KMSDRM_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
{
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* SDL Window Manager function */
|
||||
/*****************************************************************************/
|
||||
int KMSDRM_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info)
|
||||
{
|
||||
SDL_VideoData *viddata = _this->driverdata;
|
||||
|
||||
info->subsystem = SDL_SYSWM_KMSDRM;
|
||||
info->info.kmsdrm.dev_index = viddata->devindex;
|
||||
info->info.kmsdrm.drm_fd = viddata->drm_fd;
|
||||
info->info.kmsdrm.gbm_dev = viddata->gbm_dev;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_KMSDRM */
|
||||
|
||||
@@ -135,9 +135,6 @@ void KMSDRM_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
void KMSDRM_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
void KMSDRM_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
|
||||
/* Window manager function */
|
||||
int KMSDRM_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
|
||||
|
||||
/* OpenGL/OpenGL ES functions */
|
||||
int KMSDRM_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path);
|
||||
SDL_FunctionPointer KMSDRM_GLES_GetProcAddress(SDL_VideoDevice *_this, const char *proc);
|
||||
|
||||
@@ -34,8 +34,6 @@
|
||||
#include "SDL_kmsdrmdyn.h"
|
||||
#include "SDL_kmsdrmvulkan.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
|
||||
#include "../SDL_sysvideo.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
#include "SDL_ngagevideo.h"
|
||||
|
||||
typedef struct
|
||||
@@ -34,10 +32,7 @@ typedef struct
|
||||
|
||||
} NGAGE_Window;
|
||||
|
||||
extern int
|
||||
NGAGE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
|
||||
extern void
|
||||
NGAGE_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
extern int NGAGE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
extern void NGAGE_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
|
||||
#endif /* SDL_ngagewindow */
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
#include "../../events/SDL_mouse_c.h"
|
||||
#include "../../events/SDL_keyboard_c.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
/* PSP declarations */
|
||||
#include "SDL_pspvideo.h"
|
||||
#include "SDL_pspevents_c.h"
|
||||
|
||||
@@ -35,8 +35,6 @@
|
||||
#include "../../events/SDL_mouse_c.h"
|
||||
#include "../../events/SDL_keyboard_c.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
#ifdef SDL_INPUT_LINUXEV
|
||||
#include "../../core/linux/SDL_evdev.h"
|
||||
#endif
|
||||
|
||||
@@ -79,7 +79,6 @@ static SDL_VideoDevice *RISCOS_CreateDevice(void)
|
||||
|
||||
device->CreateSDLWindow = RISCOS_CreateWindow;
|
||||
device->DestroyWindow = RISCOS_DestroyWindow;
|
||||
device->GetWindowWMInfo = RISCOS_GetWindowWMInfo;
|
||||
|
||||
device->CreateWindowFramebuffer = RISCOS_CreateWindowFramebuffer;
|
||||
device->UpdateWindowFramebuffer = RISCOS_UpdateWindowFramebuffer;
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
#include "../SDL_sysvideo.h"
|
||||
#include "../../events/SDL_mouse_c.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
#include "SDL_riscosvideo.h"
|
||||
#include "SDL_riscoswindow.h"
|
||||
|
||||
@@ -61,10 +59,4 @@ void RISCOS_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
window->driverdata = NULL;
|
||||
}
|
||||
|
||||
int RISCOS_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info)
|
||||
{
|
||||
info->subsystem = SDL_SYSWM_RISCOS;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_RISCOS */
|
||||
|
||||
@@ -34,6 +34,5 @@ struct SDL_WindowData
|
||||
|
||||
extern int RISCOS_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
extern void RISCOS_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
extern int RISCOS_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
|
||||
|
||||
#endif /* SDL_riscoswindow_h_ */
|
||||
|
||||
@@ -35,8 +35,6 @@
|
||||
#import "SDL_uikitwindow.h"
|
||||
#import "SDL_uikitmetalview.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
@implementation SDL_uikitmetalview
|
||||
|
||||
/* Returns a Metal-compatible layer. */
|
||||
|
||||
@@ -94,7 +94,6 @@ static SDL_VideoDevice *UIKit_CreateDevice(void)
|
||||
device->SetWindowFullscreen = UIKit_SetWindowFullscreen;
|
||||
device->SetWindowMouseGrab = UIKit_SetWindowMouseGrab;
|
||||
device->DestroyWindow = UIKit_DestroyWindow;
|
||||
device->GetWindowWMInfo = UIKit_GetWindowWMInfo;
|
||||
device->GetDisplayUsableBounds = UIKit_GetDisplayUsableBounds;
|
||||
device->GetWindowSizeInPixels = UIKit_GetWindowSizeInPixels;
|
||||
|
||||
|
||||
@@ -34,8 +34,6 @@
|
||||
#include "SDL_uikitvulkan.h"
|
||||
#include "SDL_uikitmetalview.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
const char *defaultPaths[] = {
|
||||
|
||||
@@ -37,10 +37,11 @@ extern void UIKit_SetWindowMouseGrab(SDL_VideoDevice *_this, SDL_Window *window,
|
||||
extern void UIKit_UpdatePointerLock(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
extern void UIKit_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
extern void UIKit_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int *w, int *h);
|
||||
extern int UIKit_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
|
||||
|
||||
extern NSUInteger UIKit_GetSupportedOrientations(SDL_Window *window);
|
||||
|
||||
#define SDL_METALVIEW_TAG 255
|
||||
|
||||
@class UIWindow;
|
||||
|
||||
@interface SDL_UIKitWindowData : NSObject
|
||||
|
||||
@@ -34,8 +34,6 @@
|
||||
#include "SDL_uikitview.h"
|
||||
#include "SDL_uikitopenglview.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
@implementation SDL_UIKitWindowData
|
||||
@@ -86,13 +84,13 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, UIWindow
|
||||
SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
|
||||
SDL_UIKitDisplayData *displaydata = (__bridge SDL_UIKitDisplayData *)display->driverdata;
|
||||
SDL_uikitview *view;
|
||||
|
||||
|
||||
#if TARGET_OS_XR
|
||||
CGRect frame = UIKit_ComputeViewFrame(window);
|
||||
#else
|
||||
CGRect frame = UIKit_ComputeViewFrame(window, displaydata.uiscreen);
|
||||
#endif
|
||||
|
||||
|
||||
int width = (int)frame.size.width;
|
||||
int height = (int)frame.size.height;
|
||||
|
||||
@@ -155,6 +153,10 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, UIWindow
|
||||
* hierarchy. */
|
||||
[view setSDLWindow:window];
|
||||
|
||||
SDL_PropertiesID props = SDL_GetWindowProperties(window);
|
||||
SDL_SetProperty(props, "SDL.window.uikit.window", (__bridge void *)data.uiwindow);
|
||||
SDL_SetProperty(props, "SDL.window.uikit.metal_view_tag", SDL_METALVIEW_TAG);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -385,26 +387,6 @@ void UIKit_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int
|
||||
}
|
||||
}
|
||||
|
||||
int UIKit_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, SDL_SysWMinfo *info)
|
||||
{
|
||||
@autoreleasepool {
|
||||
SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->driverdata;
|
||||
|
||||
info->subsystem = SDL_SYSWM_UIKIT;
|
||||
info->info.uikit.window = data.uiwindow;
|
||||
|
||||
#if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2)
|
||||
if ([data.viewcontroller.view isKindOfClass:[SDL_uikitopenglview class]]) {
|
||||
SDL_uikitopenglview *glview = (SDL_uikitopenglview *)data.viewcontroller.view;
|
||||
info->info.uikit.framebuffer = glview.drawableFramebuffer;
|
||||
info->info.uikit.colorbuffer = glview.drawableRenderbuffer;
|
||||
info->info.uikit.resolveFramebuffer = glview.msaaResolveFramebuffer;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#if !TARGET_OS_TV
|
||||
NSUInteger
|
||||
UIKit_GetSupportedOrientations(SDL_Window *window)
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
#include "../../events/SDL_mouse_c.h"
|
||||
#include "../../events/SDL_keyboard_c.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
/* VITA declarations */
|
||||
#include <psp2/kernel/processmgr.h>
|
||||
#include "SDL_vitavideo.h"
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
#include "../SDL_sysvideo.h"
|
||||
#include "../../events/SDL_events_c.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
#ifdef SDL_INPUT_LINUXEV
|
||||
#include "../../core/linux/SDL_evdev.h"
|
||||
#endif
|
||||
@@ -81,7 +79,6 @@ static SDL_VideoDevice *VIVANTE_Create()
|
||||
device->ShowWindow = VIVANTE_ShowWindow;
|
||||
device->HideWindow = VIVANTE_HideWindow;
|
||||
device->DestroyWindow = VIVANTE_DestroyWindow;
|
||||
device->GetWindowWMInfo = VIVANTE_GetWindowWMInfo;
|
||||
|
||||
#ifdef SDL_VIDEO_OPENGL_EGL
|
||||
device->GL_LoadLibrary = VIVANTE_GLES_LoadLibrary;
|
||||
@@ -258,6 +255,9 @@ int VIVANTE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
/* Setup driver data for this window */
|
||||
window->driverdata = data;
|
||||
|
||||
SDL_PropertiesID props = SDL_GetWindowProperties(window);
|
||||
SDL_SetProperty(props, "SDL.window.vivante.display", displaydata->native_display);
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK
|
||||
data->native_window = vdkCreateWindow(displaydata->native_display, window->x, window->y, window->w, window->h);
|
||||
#else
|
||||
@@ -266,6 +266,7 @@ int VIVANTE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
if (!data->native_window) {
|
||||
return SDL_SetError("VIVANTE: Can't create native window");
|
||||
}
|
||||
SDL_SetProperty(props, "SDL.window.vivante.window", data->native_window);
|
||||
|
||||
#ifdef SDL_VIDEO_OPENGL_EGL
|
||||
if (window->flags & SDL_WINDOW_OPENGL) {
|
||||
@@ -276,6 +277,7 @@ int VIVANTE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
} else {
|
||||
data->egl_surface = EGL_NO_SURFACE;
|
||||
}
|
||||
SDL_SetProperty(props, "SDL.window.vivante.surface", data->egl_surface);
|
||||
#endif
|
||||
|
||||
/* Window has been successfully created */
|
||||
@@ -347,20 +349,6 @@ void VIVANTE_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
SDL_SetKeyboardFocus(NULL);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* SDL Window Manager function */
|
||||
/*****************************************************************************/
|
||||
int VIVANTE_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info)
|
||||
{
|
||||
SDL_WindowData *data = window->driverdata;
|
||||
SDL_DisplayData *displaydata = SDL_GetDisplayDriverData(SDL_GetPrimaryDisplay());
|
||||
|
||||
info->subsystem = SDL_SYSWM_VIVANTE;
|
||||
info->info.vivante.display = displaydata->native_display;
|
||||
info->info.vivante.window = data->native_window;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* SDL event functions */
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -80,9 +80,6 @@ void VIVANTE_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
void VIVANTE_HideWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
void VIVANTE_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
|
||||
/* Window manager function */
|
||||
int VIVANTE_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
|
||||
|
||||
/* Event functions */
|
||||
void VIVANTE_PumpEvents(SDL_VideoDevice *_this);
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "SDL_vivantevideo.h"
|
||||
|
||||
#include "SDL_vivantevulkan.h"
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
int VIVANTE_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path)
|
||||
{
|
||||
|
||||
@@ -174,7 +174,6 @@ static SDL_VideoDevice *Wayland_CreateDevice(void)
|
||||
device->VideoInit = Wayland_VideoInit;
|
||||
device->VideoQuit = Wayland_VideoQuit;
|
||||
device->GetDisplayBounds = Wayland_GetDisplayBounds;
|
||||
device->GetWindowWMInfo = Wayland_GetWindowWMInfo;
|
||||
device->SuspendScreenSaver = Wayland_SuspendScreenSaver;
|
||||
|
||||
device->PumpEvents = Wayland_PumpEvents;
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
#include "../SDL_vulkan_internal.h"
|
||||
#include "SDL_waylandvulkan.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
#define DEFAULT_VULKAN "libvulkan.so"
|
||||
#else
|
||||
|
||||
@@ -1301,37 +1301,6 @@ static void SetKeyboardFocus(SDL_Window *window)
|
||||
SDL_SetKeyboardFocus(window);
|
||||
}
|
||||
|
||||
int Wayland_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, SDL_SysWMinfo *info)
|
||||
{
|
||||
SDL_VideoData *viddata = _this->driverdata;
|
||||
SDL_WindowData *data = window->driverdata;
|
||||
|
||||
info->subsystem = SDL_SYSWM_WAYLAND;
|
||||
info->info.wl.display = data->waylandData->display;
|
||||
info->info.wl.surface = data->surface;
|
||||
info->info.wl.egl_window = data->egl_window;
|
||||
|
||||
#ifdef HAVE_LIBDECOR_H
|
||||
if (data->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) {
|
||||
if (data->shell_surface.libdecor.frame != NULL) {
|
||||
info->info.wl.xdg_surface = libdecor_frame_get_xdg_surface(data->shell_surface.libdecor.frame);
|
||||
info->info.wl.xdg_toplevel = libdecor_frame_get_xdg_toplevel(data->shell_surface.libdecor.frame);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
if (viddata->shell.xdg && data->shell_surface.xdg.surface != NULL) {
|
||||
SDL_bool popup = (data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP);
|
||||
info->info.wl.xdg_surface = data->shell_surface.xdg.surface;
|
||||
info->info.wl.xdg_toplevel = popup ? NULL : data->shell_surface.xdg.roleobj.toplevel;
|
||||
if (popup) {
|
||||
info->info.wl.xdg_popup = data->shell_surface.xdg.roleobj.popup.popup;
|
||||
info->info.wl.xdg_positioner = data->shell_surface.xdg.roleobj.popup.positioner;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
|
||||
{
|
||||
return 0; /* just succeed, the real work is done elsewhere. */
|
||||
@@ -1380,6 +1349,7 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
{
|
||||
SDL_VideoData *c = _this->driverdata;
|
||||
SDL_WindowData *data = window->driverdata;
|
||||
SDL_PropertiesID props = SDL_GetWindowProperties(window);
|
||||
|
||||
/* If this is a child window, the parent *must* be in the final shown state,
|
||||
* meaning that it has received a configure event, followed by a frame callback.
|
||||
@@ -1427,13 +1397,17 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
} else {
|
||||
libdecor_frame_set_app_id(data->shell_surface.libdecor.frame, data->app_id);
|
||||
libdecor_frame_map(data->shell_surface.libdecor.frame);
|
||||
|
||||
SDL_SetProperty(props, "SDL.window.wayland.xdg_surface", libdecor_frame_get_xdg_surface(data->shell_surface.libdecor.frame));
|
||||
SDL_SetProperty(props, "SDL.window.wayland.xdg_toplevel", libdecor_frame_get_xdg_toplevel(data->shell_surface.libdecor.frame));
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
if ((data->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL || data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) && c->shell.xdg) {
|
||||
if ((data->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL || data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) && c->shell.xdg) {
|
||||
data->shell_surface.xdg.surface = xdg_wm_base_get_xdg_surface(c->shell.xdg, data->surface);
|
||||
xdg_surface_set_user_data(data->shell_surface.xdg.surface, data);
|
||||
xdg_surface_add_listener(data->shell_surface.xdg.surface, &shell_surface_listener_xdg, data);
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), "SDL.window.wayland.xdg_surface", data->shell_surface.xdg.surface);
|
||||
|
||||
if (data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) {
|
||||
SDL_Window *parent = window->parent;
|
||||
@@ -1485,10 +1459,14 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
SetKeyboardFocus(window);
|
||||
}
|
||||
}
|
||||
|
||||
SDL_SetProperty(props, "SDL.window.wayland.xdg_popup", data->shell_surface.xdg.roleobj.popup.popup);
|
||||
SDL_SetProperty(props, "SDL.window.wayland.xdg_positioner", data->shell_surface.xdg.roleobj.popup.positioner);
|
||||
} else {
|
||||
data->shell_surface.xdg.roleobj.toplevel = xdg_surface_get_toplevel(data->shell_surface.xdg.surface);
|
||||
xdg_toplevel_set_app_id(data->shell_surface.xdg.roleobj.toplevel, data->app_id);
|
||||
xdg_toplevel_add_listener(data->shell_surface.xdg.roleobj.toplevel, &toplevel_listener_xdg, data);
|
||||
SDL_SetProperty(props, "SDL.window.wayland.xdg_toplevel", data->shell_surface.xdg.roleobj.toplevel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1624,12 +1602,17 @@ static void Wayland_ReleasePopup(SDL_VideoDevice *_this, SDL_Window *popup)
|
||||
xdg_positioner_destroy(popupdata->shell_surface.xdg.roleobj.popup.positioner);
|
||||
popupdata->shell_surface.xdg.roleobj.popup.popup = NULL;
|
||||
popupdata->shell_surface.xdg.roleobj.popup.positioner = NULL;
|
||||
|
||||
SDL_PropertiesID props = SDL_GetWindowProperties(popup);
|
||||
SDL_SetProperty(props, "SDL.window.wayland.xdg_popup", NULL);
|
||||
SDL_SetProperty(props, "SDL.window.wayland.xdg_positioner", NULL);
|
||||
}
|
||||
|
||||
void Wayland_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
{
|
||||
SDL_VideoData *data = _this->driverdata;
|
||||
SDL_WindowData *wind = window->driverdata;
|
||||
SDL_PropertiesID props = SDL_GetWindowProperties(window);
|
||||
|
||||
wind->surface_status = WAYLAND_SURFACE_STATUS_HIDDEN;
|
||||
|
||||
@@ -1649,19 +1632,24 @@ void Wayland_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
if (wind->shell_surface.libdecor.frame) {
|
||||
libdecor_frame_unref(wind->shell_surface.libdecor.frame);
|
||||
wind->shell_surface.libdecor.frame = NULL;
|
||||
|
||||
SDL_SetProperty(props, "SDL.window.wayland.xdg_surface", NULL);
|
||||
SDL_SetProperty(props, "SDL.window.wayland.xdg_toplevel", NULL);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
if (data->shell.xdg) {
|
||||
if (data->shell.xdg) {
|
||||
if (wind->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP) {
|
||||
Wayland_ReleasePopup(_this, window);
|
||||
} else if (wind->shell_surface.xdg.roleobj.toplevel) {
|
||||
xdg_toplevel_destroy(wind->shell_surface.xdg.roleobj.toplevel);
|
||||
wind->shell_surface.xdg.roleobj.toplevel = NULL;
|
||||
SDL_SetProperty(props, "SDL.window.wayland.xdg_toplevel", NULL);
|
||||
}
|
||||
if (wind->shell_surface.xdg.surface) {
|
||||
xdg_surface_destroy(wind->shell_surface.xdg.surface);
|
||||
wind->shell_surface.xdg.surface = NULL;
|
||||
SDL_SetProperty(props, "SDL.window.wayland.xdg_surface", NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2109,6 +2097,11 @@ int Wayland_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
}
|
||||
} /* All other cases will be WAYLAND_SURFACE_UNKNOWN */
|
||||
|
||||
SDL_PropertiesID props = SDL_GetWindowProperties(window);
|
||||
SDL_SetProperty(props, "SDL.window.wayland.display", data->waylandData->display);
|
||||
SDL_SetProperty(props, "SDL.window.wayland.surface", data->surface);
|
||||
SDL_SetProperty(props, "SDL.window.wayland.egl_window", data->egl_window);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
#include "../SDL_sysvideo.h"
|
||||
#include "../../events/SDL_touch_c.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
#include "SDL_waylandvideo.h"
|
||||
|
||||
struct SDL_WaylandInput;
|
||||
@@ -151,7 +149,6 @@ extern void Wayland_ShowWindowSystemMenu(SDL_Window *window, int x, int y);
|
||||
extern void Wayland_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
extern int Wayland_SuspendScreenSaver(SDL_VideoDevice *_this);
|
||||
|
||||
extern int Wayland_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, SDL_SysWMinfo *info);
|
||||
extern int Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
|
||||
extern int Wayland_FlashWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOperation operation);
|
||||
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
#include "../../events/SDL_touch_c.h"
|
||||
#include "../../events/scancodes_windows.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
/* Dropfile support */
|
||||
#include <shellapi.h>
|
||||
|
||||
@@ -715,19 +713,6 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
SDL_WindowData *data;
|
||||
LRESULT returnCode = -1;
|
||||
|
||||
/* Send a SDL_EVENT_SYSWM if the application wants them */
|
||||
if (SDL_EventEnabled(SDL_EVENT_SYSWM)) {
|
||||
SDL_SysWMmsg wmmsg;
|
||||
|
||||
wmmsg.version = SDL_SYSWM_CURRENT_VERSION;
|
||||
wmmsg.subsystem = SDL_SYSWM_WINDOWS;
|
||||
wmmsg.msg.win.hwnd = hwnd;
|
||||
wmmsg.msg.win.msg = msg;
|
||||
wmmsg.msg.win.wParam = wParam;
|
||||
wmmsg.msg.win.lParam = lParam;
|
||||
SDL_SendSysWMEvent(&wmmsg);
|
||||
}
|
||||
|
||||
/* Get the window data for the window */
|
||||
data = WIN_GetWindowDataFromHWND(hwnd);
|
||||
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
|
||||
@@ -1809,7 +1794,9 @@ int WIN_WaitEventTimeout(SDL_VideoDevice *_this, Sint64 timeoutNS)
|
||||
return 0;
|
||||
}
|
||||
if (g_WindowsMessageHook) {
|
||||
g_WindowsMessageHook(g_WindowsMessageHookData, msg.hwnd, msg.message, msg.wParam, msg.lParam);
|
||||
if (!g_WindowsMessageHook(g_WindowsMessageHookData, &msg)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/* Always translate the message in case it's a non-SDL window (e.g. with Qt integration) */
|
||||
TranslateMessage(&msg);
|
||||
@@ -1845,7 +1832,9 @@ void WIN_PumpEvents(SDL_VideoDevice *_this)
|
||||
|
||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||
if (g_WindowsMessageHook) {
|
||||
g_WindowsMessageHook(g_WindowsMessageHookData, msg.hwnd, msg.message, msg.wParam, msg.lParam);
|
||||
if (!g_WindowsMessageHook(g_WindowsMessageHookData, &msg)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
|
||||
|
||||
@@ -201,7 +201,6 @@ static SDL_VideoDevice *WIN_CreateDevice(void)
|
||||
device->SetWindowKeyboardGrab = WIN_SetWindowKeyboardGrab;
|
||||
#endif
|
||||
device->DestroyWindow = WIN_DestroyWindow;
|
||||
device->GetWindowWMInfo = WIN_GetWindowWMInfo;
|
||||
#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
|
||||
device->CreateWindowFramebuffer = WIN_CreateWindowFramebuffer;
|
||||
device->UpdateWindowFramebuffer = WIN_UpdateWindowFramebuffer;
|
||||
|
||||
@@ -35,8 +35,6 @@
|
||||
|
||||
#include "SDL_windowsvulkan.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
int WIN_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path)
|
||||
{
|
||||
VkExtensionProperties *extensions = NULL;
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
/* Dropfile support */
|
||||
#include <shellapi.h>
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
/* Dark mode support */
|
||||
#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE
|
||||
#define DWMWA_USE_IMMERSIVE_DARK_MODE 20
|
||||
@@ -440,6 +438,11 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, HWND hwnd
|
||||
|
||||
data->initializing = SDL_FALSE;
|
||||
|
||||
SDL_PropertiesID props = SDL_GetWindowProperties(window);
|
||||
SDL_SetProperty(props, "SDL.window.win32.hwnd", data->hwnd);
|
||||
SDL_SetProperty(props, "SDL.window.win32.hdc", data->hdc);
|
||||
SDL_SetProperty(props, "SDL.window.win32.instance", data->hinstance);
|
||||
|
||||
/* All done! */
|
||||
return 0;
|
||||
}
|
||||
@@ -1250,18 +1253,6 @@ void WIN_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
CleanupWindowData(_this, window);
|
||||
}
|
||||
|
||||
int WIN_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, SDL_SysWMinfo *info)
|
||||
{
|
||||
const SDL_WindowData *data = (const SDL_WindowData *)window->driverdata;
|
||||
|
||||
info->subsystem = SDL_SYSWM_WINDOWS;
|
||||
info->info.win.window = data->hwnd;
|
||||
info->info.win.hdc = data->hdc;
|
||||
info->info.win.hinstance = data->hinstance;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates a HelperWindow used for DirectInput.
|
||||
*/
|
||||
|
||||
@@ -100,7 +100,6 @@ extern void WIN_SetWindowMouseRect(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
extern void WIN_SetWindowMouseGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed);
|
||||
extern void WIN_SetWindowKeyboardGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed);
|
||||
extern void WIN_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
extern int WIN_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
|
||||
extern void WIN_OnWindowEnter(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
extern void WIN_UpdateClipCursor(SDL_Window *window);
|
||||
extern int WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
|
||||
|
||||
@@ -67,8 +67,6 @@ extern "C" {
|
||||
#include "SDL_winrtmouse_c.h"
|
||||
#include "SDL_winrtvideo_cpp.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
/* Initialization/Query functions */
|
||||
static int WINRT_VideoInit(SDL_VideoDevice *_this);
|
||||
static int WINRT_InitModes(SDL_VideoDevice *_this);
|
||||
@@ -80,7 +78,6 @@ static int WINRT_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
static void WINRT_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
static void WINRT_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen);
|
||||
static void WINRT_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
static int WINRT_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, SDL_SysWMinfo *info);
|
||||
|
||||
/* Misc functions */
|
||||
static ABI::Windows::System::Display::IDisplayRequest *WINRT_CreateDisplayRequest(SDL_VideoDevice *_this);
|
||||
@@ -133,7 +130,6 @@ static SDL_VideoDevice *WINRT_CreateDevice(void)
|
||||
device->DestroyWindow = WINRT_DestroyWindow;
|
||||
device->SetDisplayMode = WINRT_SetDisplayMode;
|
||||
device->PumpEvents = WINRT_PumpEvents;
|
||||
device->GetWindowWMInfo = WINRT_GetWindowWMInfo;
|
||||
device->SuspendScreenSaver = WINRT_SuspendScreenSaver;
|
||||
|
||||
#if NTDDI_VERSION >= NTDDI_WIN10
|
||||
@@ -612,6 +608,7 @@ int WINRT_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
data->appView = ApplicationView::GetForCurrentView();
|
||||
#endif
|
||||
}
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), "SDL.window.winrt.window", reinterpret_cast<IInspectable *>(data->coreWindow.Get()));
|
||||
|
||||
/* Make note of the requested window flags, before they start getting changed. */
|
||||
const Uint32 requestedFlags = window->flags;
|
||||
@@ -779,15 +776,6 @@ void WINRT_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
}
|
||||
}
|
||||
|
||||
int WINRT_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, SDL_SysWMinfo *info)
|
||||
{
|
||||
SDL_WindowData *data = window->driverdata;
|
||||
|
||||
info->subsystem = SDL_SYSWM_WINRT;
|
||||
info->info.winrt.window = reinterpret_cast<IInspectable *>(data->coreWindow.Get());
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ABI::Windows::System::Display::IDisplayRequest *WINRT_CreateDisplayRequest(SDL_VideoDevice *_this)
|
||||
{
|
||||
/* Setup a WinRT DisplayRequest object, usable for enabling/disabling screensaver requests */
|
||||
|
||||
@@ -40,8 +40,6 @@
|
||||
#include "../../core/linux/SDL_system_theme.h"
|
||||
#include "../../SDL_utils_c.h"
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*#define DEBUG_XEVENTS*/
|
||||
@@ -324,27 +322,25 @@ static char *X11_URIToLocal(char *uri)
|
||||
return file;
|
||||
}
|
||||
|
||||
/* An X11 event hook */
|
||||
static SDL_X11EventHook g_X11EventHook = NULL;
|
||||
static void *g_X11EventHookData = NULL;
|
||||
|
||||
void SDL_SetX11EventHook(SDL_X11EventHook callback, void *userdata)
|
||||
{
|
||||
g_X11EventHook = callback;
|
||||
g_X11EventHookData = userdata;
|
||||
}
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
|
||||
static void X11_HandleGenericEvent(SDL_VideoData *videodata, XEvent *xev)
|
||||
{
|
||||
/* event is a union, so cookie == &event, but this is type safe. */
|
||||
XGenericEventCookie *cookie = &xev->xcookie;
|
||||
if (X11_XGetEventData(videodata->display, cookie)) {
|
||||
X11_HandleXinput2Event(videodata, cookie);
|
||||
|
||||
/* Send a SDL_EVENT_SYSWM if the application wants them.
|
||||
* Since event data is only available until XFreeEventData is called,
|
||||
* the *only* way for an application to access it is to register an event filter/watcher
|
||||
* and do all the processing on the SDL_EVENT_SYSWM inside the callback. */
|
||||
if (SDL_EventEnabled(SDL_EVENT_SYSWM)) {
|
||||
SDL_SysWMmsg wmmsg;
|
||||
|
||||
wmmsg.version = SDL_SYSWM_CURRENT_VERSION;
|
||||
wmmsg.subsystem = SDL_SYSWM_X11;
|
||||
wmmsg.msg.x11.event = *xev;
|
||||
SDL_SendSysWMEvent(&wmmsg);
|
||||
if (!g_X11EventHook || g_X11EventHook(g_X11EventHookData, xev)) {
|
||||
X11_HandleXinput2Event(videodata, cookie);
|
||||
}
|
||||
|
||||
X11_XFreeEventData(videodata->display, cookie);
|
||||
}
|
||||
}
|
||||
@@ -870,22 +866,19 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Calling the event hook for generic events happens in X11_HandleGenericEvent(), where the event data is available */
|
||||
if (g_X11EventHook) {
|
||||
if (!g_X11EventHook(g_X11EventHookData, xevent)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_X11_XRANDR
|
||||
if (videodata->xrandr_event_base && (xevent->type == (videodata->xrandr_event_base + RRNotify))) {
|
||||
X11_HandleXRandREvent(_this, xevent);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Send a SDL_EVENT_SYSWM if the application wants them */
|
||||
if (SDL_EventEnabled(SDL_EVENT_SYSWM)) {
|
||||
SDL_SysWMmsg wmmsg;
|
||||
|
||||
wmmsg.version = SDL_SYSWM_CURRENT_VERSION;
|
||||
wmmsg.subsystem = SDL_SYSWM_X11;
|
||||
wmmsg.msg.x11.event = *xevent;
|
||||
SDL_SendSysWMEvent(&wmmsg);
|
||||
}
|
||||
|
||||
#if 0
|
||||
printf("type = %d display = %d window = %d\n",
|
||||
xevent->type, xevent->xany.display, xevent->xany.window);
|
||||
|
||||
@@ -207,7 +207,6 @@ static SDL_VideoDevice *X11_CreateDevice(void)
|
||||
device->CreateWindowFramebuffer = X11_CreateWindowFramebuffer;
|
||||
device->UpdateWindowFramebuffer = X11_UpdateWindowFramebuffer;
|
||||
device->DestroyWindowFramebuffer = X11_DestroyWindowFramebuffer;
|
||||
device->GetWindowWMInfo = X11_GetWindowWMInfo;
|
||||
device->SetWindowHitTest = X11_SetWindowHitTest;
|
||||
device->AcceptDragAndDrop = X11_AcceptDragAndDrop;
|
||||
device->FlashWindow = X11_FlashWindow;
|
||||
|
||||
@@ -39,8 +39,6 @@
|
||||
#include "SDL_x11opengles.h"
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_syswm.h>
|
||||
|
||||
#define _NET_WM_STATE_REMOVE 0l
|
||||
#define _NET_WM_STATE_ADD 1l
|
||||
|
||||
@@ -300,6 +298,7 @@ Uint32 X11_GetNetWMState(SDL_VideoDevice *_this, SDL_Window *window, Window xwin
|
||||
static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, Window w, BOOL created)
|
||||
{
|
||||
SDL_VideoData *videodata = _this->driverdata;
|
||||
SDL_DisplayData *displaydata = SDL_GetDisplayDriverDataForWindow(window);
|
||||
SDL_WindowData *data;
|
||||
int numwindows = videodata->numwindows;
|
||||
int windowlistlength = videodata->windowlistlength;
|
||||
@@ -382,6 +381,13 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, Window w,
|
||||
|
||||
/* All done! */
|
||||
window->driverdata = data;
|
||||
|
||||
SDL_PropertiesID props = SDL_GetWindowProperties(window);
|
||||
int screen = (displaydata ? displaydata->screen : 0);
|
||||
SDL_SetProperty(props, "SDL.window.x11.display", data->videodata->display);
|
||||
SDL_SetProperty(props, "SDL.window.x11.screen", (void *)(intptr_t)screen);
|
||||
SDL_SetProperty(props, "SDL.window.x11.window", (void *)(uintptr_t)data->xwindow);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1848,23 +1854,6 @@ void X11_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
window->driverdata = NULL;
|
||||
}
|
||||
|
||||
int X11_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, SDL_SysWMinfo *info)
|
||||
{
|
||||
SDL_WindowData *data = window->driverdata;
|
||||
SDL_DisplayData *displaydata = SDL_GetDisplayDriverDataForWindow(window);
|
||||
|
||||
if (data == NULL) {
|
||||
/* This sometimes happens in SDL_IBus_UpdateTextRect() while creating the window */
|
||||
return SDL_SetError("Window not initialized");
|
||||
}
|
||||
|
||||
info->subsystem = SDL_SYSWM_X11;
|
||||
info->info.x11.display = data->videodata->display;
|
||||
info->info.x11.screen = displaydata->screen;
|
||||
info->info.x11.window = data->xwindow;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int X11_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
|
||||
{
|
||||
return 0; /* just succeed, the real work is done elsewhere. */
|
||||
|
||||
@@ -111,7 +111,6 @@ extern void *X11_GetWindowICCProfile(SDL_VideoDevice *_this, SDL_Window *window,
|
||||
extern void X11_SetWindowMouseGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed);
|
||||
extern void X11_SetWindowKeyboardGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed);
|
||||
extern void X11_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
|
||||
extern int X11_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
|
||||
extern int X11_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
|
||||
extern void X11_AcceptDragAndDrop(SDL_Window *window, SDL_bool accept);
|
||||
extern int X11_FlashWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOperation operation);
|
||||
|
||||
Reference in New Issue
Block a user