2015-06-21 09:33:46 -06:00
|
|
|
/*
|
|
|
|
Simple DirectMedia Layer
|
2022-01-03 10:40:00 -07:00
|
|
|
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
2015-06-21 09:33:46 -06:00
|
|
|
|
|
|
|
This software is provided 'as-is', without any express or implied
|
|
|
|
warranty. In no event will the authors be held liable for any damages
|
|
|
|
arising from the use of this software.
|
|
|
|
|
|
|
|
Permission is granted to anyone to use this software for any purpose,
|
|
|
|
including commercial applications, and to alter it and redistribute it
|
|
|
|
freely, subject to the following restrictions:
|
|
|
|
|
|
|
|
1. The origin of this software must not be misrepresented; you must not
|
|
|
|
claim that you wrote the original software. If you use this software
|
|
|
|
in a product, an acknowledgment in the product documentation would be
|
|
|
|
appreciated but is not required.
|
|
|
|
2. Altered source versions must be plainly marked as such, and must not be
|
|
|
|
misrepresented as being the original software.
|
|
|
|
3. This notice may not be removed or altered from any source distribution.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \file SDL_syswm.h
|
|
|
|
*
|
|
|
|
* Include file for SDL custom system window manager hooks.
|
|
|
|
*/
|
|
|
|
|
2016-11-20 22:34:54 -07:00
|
|
|
#ifndef SDL_syswm_h_
|
|
|
|
#define SDL_syswm_h_
|
2015-06-21 09:33:46 -06:00
|
|
|
|
2022-11-26 21:43:38 -07:00
|
|
|
#include <SDL3/SDL_stdinc.h>
|
|
|
|
#include <SDL3/SDL_error.h>
|
|
|
|
#include <SDL3/SDL_video.h>
|
|
|
|
#include <SDL3/SDL_version.h>
|
2015-06-21 09:33:46 -06:00
|
|
|
|
|
|
|
/**
|
2018-12-05 08:13:12 -07:00
|
|
|
* \brief SDL_syswm.h
|
2015-06-21 09:33:46 -06:00
|
|
|
*
|
|
|
|
* Your application has access to a special type of event ::SDL_SYSWMEVENT,
|
|
|
|
* which contains window-manager specific information and arrives whenever
|
|
|
|
* an unhandled window event occurs. This event is ignored by default, but
|
2022-12-28 18:06:38 -07:00
|
|
|
* you can enable it with SDL_SetEventEnabled().
|
2022-11-23 14:33:48 -07:00
|
|
|
*
|
|
|
|
* 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
|
2015-06-21 09:33:46 -06:00
|
|
|
*/
|
|
|
|
struct SDL_SysWMinfo;
|
2018-11-06 10:50:24 -07:00
|
|
|
|
2022-12-22 09:38:59 -07:00
|
|
|
#include <SDL3/SDL_begin_code.h>
|
2018-05-07 20:26:02 -06:00
|
|
|
/* Set up for C function definitions, even when using C++ */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2022-11-23 14:33:48 -07:00
|
|
|
/* 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
|
|
|
|
|
|
|
|
|
2018-11-06 10:50:24 -07:00
|
|
|
#if !defined(SDL_PROTOTYPES_ONLY)
|
2015-06-21 09:33:46 -06:00
|
|
|
/**
|
|
|
|
* These are the various supported windowing subsystems
|
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
SDL_SYSWM_UNKNOWN,
|
2022-11-23 14:33:48 -07:00
|
|
|
SDL_SYSWM_ANDROID,
|
2015-06-21 09:33:46 -06:00
|
|
|
SDL_SYSWM_COCOA,
|
2022-11-23 14:33:48 -07:00
|
|
|
SDL_SYSWM_HAIKU,
|
|
|
|
SDL_SYSWM_KMSDRM,
|
|
|
|
SDL_SYSWM_RISCOS,
|
2015-06-21 09:33:46 -06:00
|
|
|
SDL_SYSWM_UIKIT,
|
2022-11-23 14:33:48 -07:00
|
|
|
SDL_SYSWM_VIVANTE,
|
2015-06-21 09:33:46 -06:00
|
|
|
SDL_SYSWM_WAYLAND,
|
2022-11-23 14:33:48 -07:00
|
|
|
SDL_SYSWM_WINDOWS,
|
2022-11-23 11:41:43 -07:00
|
|
|
SDL_SYSWM_WINRT,
|
2022-11-23 14:33:48 -07:00
|
|
|
SDL_SYSWM_X11
|
2015-06-21 09:33:46 -06:00
|
|
|
} SDL_SYSWM_TYPE;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The custom event structure.
|
|
|
|
*/
|
|
|
|
struct SDL_SysWMmsg
|
|
|
|
{
|
2022-11-23 14:33:48 -07:00
|
|
|
Uint32 version;
|
|
|
|
Uint32 subsystem; /**< SDL_SYSWM_TYPE */
|
|
|
|
|
|
|
|
Uint32 padding[(2 * (sizeof (void *) >= 8 ? sizeof (void *) : sizeof(Uint64)) - 2 * sizeof(Uint32)) / sizeof(Uint32)];
|
|
|
|
|
2015-06-21 09:33:46 -06:00
|
|
|
union
|
|
|
|
{
|
2022-11-23 14:33:48 -07:00
|
|
|
#if defined(SDL_ENABLE_SYSWM_WINDOWS)
|
2015-06-21 09:33:46 -06:00
|
|
|
struct {
|
|
|
|
HWND hwnd; /**< The window for the message */
|
|
|
|
UINT msg; /**< The type of message */
|
|
|
|
WPARAM wParam; /**< WORD message parameter */
|
|
|
|
LPARAM lParam; /**< LONG message parameter */
|
|
|
|
} win;
|
|
|
|
#endif
|
2022-11-23 14:33:48 -07:00
|
|
|
#if defined(SDL_ENABLE_SYSWM_X11)
|
2015-06-21 09:33:46 -06:00
|
|
|
struct {
|
|
|
|
XEvent event;
|
|
|
|
} x11;
|
|
|
|
#endif
|
|
|
|
/* Can't have an empty union */
|
|
|
|
int dummy;
|
|
|
|
} msg;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The custom window manager information structure.
|
|
|
|
*
|
|
|
|
* When this structure is returned, it holds information about which
|
|
|
|
* low level system it is using, and will be one of SDL_SYSWM_TYPE.
|
|
|
|
*/
|
|
|
|
struct SDL_SysWMinfo
|
|
|
|
{
|
2022-11-23 14:33:48 -07:00
|
|
|
Uint32 version;
|
|
|
|
Uint32 subsystem; /**< SDL_SYSWM_TYPE */
|
|
|
|
|
|
|
|
Uint32 padding[(2 * (sizeof (void *) >= 8 ? sizeof (void *) : sizeof(Uint64)) - 2 * sizeof(Uint32)) / sizeof(Uint32)];
|
|
|
|
|
2015-06-21 09:33:46 -06:00
|
|
|
union
|
|
|
|
{
|
2022-11-23 14:33:48 -07:00
|
|
|
#if defined(SDL_ENABLE_SYSWM_WINDOWS)
|
2015-06-21 09:33:46 -06:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
HWND window; /**< The window handle */
|
|
|
|
HDC hdc; /**< The window device context */
|
2016-11-20 22:18:55 -07:00
|
|
|
HINSTANCE hinstance; /**< The instance handle */
|
2015-06-21 09:33:46 -06:00
|
|
|
} win;
|
|
|
|
#endif
|
2022-11-23 14:33:48 -07:00
|
|
|
#if defined(SDL_ENABLE_SYSWM_WINRT)
|
2022-11-23 11:41:43 -07:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
IInspectable * window; /**< The WinRT CoreWindow */
|
|
|
|
} winrt;
|
|
|
|
#endif
|
2022-11-23 14:33:48 -07:00
|
|
|
#if defined(SDL_ENABLE_SYSWM_X11)
|
2015-06-21 09:33:46 -06:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
Display *display; /**< The X11 display */
|
2022-11-23 14:33:48 -07:00
|
|
|
int screen; /**< The X11 screen */
|
2015-06-21 09:33:46 -06:00
|
|
|
Window window; /**< The X11 window */
|
|
|
|
} x11;
|
|
|
|
#endif
|
2022-11-23 14:33:48 -07:00
|
|
|
#if defined(SDL_ENABLE_SYSWM_COCOA)
|
2015-06-21 09:33:46 -06:00
|
|
|
struct
|
|
|
|
{
|
2021-02-22 05:50:02 -07:00
|
|
|
#if defined(__OBJC__) && defined(__has_feature)
|
|
|
|
#if __has_feature(objc_arc)
|
2017-06-04 15:15:39 -06:00
|
|
|
NSWindow __unsafe_unretained *window; /**< The Cocoa window */
|
2021-02-22 05:50:02 -07:00
|
|
|
#else
|
|
|
|
NSWindow *window; /**< The Cocoa window */
|
|
|
|
#endif
|
2015-06-21 09:33:46 -06:00
|
|
|
#else
|
2017-06-04 15:15:39 -06:00
|
|
|
NSWindow *window; /**< The Cocoa window */
|
2015-06-21 09:33:46 -06:00
|
|
|
#endif
|
|
|
|
} cocoa;
|
|
|
|
#endif
|
2022-11-23 14:33:48 -07:00
|
|
|
#if defined(SDL_ENABLE_SYSWM_UIKIT)
|
2015-06-21 09:33:46 -06:00
|
|
|
struct
|
|
|
|
{
|
2021-02-22 05:50:02 -07:00
|
|
|
#if defined(__OBJC__) && defined(__has_feature)
|
|
|
|
#if __has_feature(objc_arc)
|
2017-06-04 15:15:39 -06:00
|
|
|
UIWindow __unsafe_unretained *window; /**< The UIKit window */
|
2021-02-22 05:50:02 -07:00
|
|
|
#else
|
|
|
|
UIWindow *window; /**< The UIKit window */
|
|
|
|
#endif
|
2015-06-21 09:33:46 -06:00
|
|
|
#else
|
2017-06-04 15:15:39 -06:00
|
|
|
UIWindow *window; /**< The UIKit window */
|
2015-06-21 09:33:46 -06:00
|
|
|
#endif
|
2017-06-04 15:15:39 -06:00
|
|
|
GLuint framebuffer; /**< The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */
|
|
|
|
GLuint colorbuffer; /**< The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */
|
|
|
|
GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */
|
2015-06-21 09:33:46 -06:00
|
|
|
} uikit;
|
|
|
|
#endif
|
2022-11-23 14:33:48 -07:00
|
|
|
#if defined(SDL_ENABLE_SYSWM_WAYLAND)
|
2015-06-21 09:33:46 -06:00
|
|
|
struct
|
|
|
|
{
|
2021-01-14 15:42:53 -07:00
|
|
|
struct wl_display *display; /**< Wayland display */
|
|
|
|
struct wl_surface *surface; /**< Wayland surface */
|
|
|
|
struct wl_egl_window *egl_window; /**< Wayland EGL window (native window) */
|
2021-07-27 15:12:26 -06:00
|
|
|
struct xdg_surface *xdg_surface; /**< Wayland xdg surface (window manager handle) */
|
2021-09-25 00:55:41 -06:00
|
|
|
struct xdg_toplevel *xdg_toplevel; /**< Wayland xdg toplevel role */
|
2022-04-18 10:30:08 -06:00
|
|
|
struct xdg_popup *xdg_popup; /**< Wayland xdg popup role */
|
|
|
|
struct xdg_positioner *xdg_positioner; /**< Wayland xdg positioner, for popup */
|
2015-06-21 09:33:46 -06:00
|
|
|
} wl;
|
|
|
|
#endif
|
|
|
|
|
2022-11-23 14:33:48 -07:00
|
|
|
#if defined(SDL_ENABLE_SYSWM_ANDROID)
|
2015-06-21 09:33:46 -06:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
ANativeWindow *window;
|
|
|
|
EGLSurface surface;
|
|
|
|
} android;
|
|
|
|
#endif
|
|
|
|
|
2022-11-23 14:33:48 -07:00
|
|
|
#if defined(SDL_ENABLE_SYSWM_VIVANTE)
|
2016-01-16 22:58:49 -07:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
EGLNativeDisplayType display;
|
|
|
|
EGLNativeWindowType window;
|
|
|
|
} vivante;
|
|
|
|
#endif
|
|
|
|
|
2022-11-23 14:33:48 -07:00
|
|
|
#if defined(SDL_ENABLE_SYSWM_KMSDRM)
|
2021-01-30 20:04:26 -07:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
int dev_index; /**< Device index (ex: the X in /dev/dri/cardX) */
|
|
|
|
int drm_fd; /**< DRM FD (unavailable on Vulkan windows) */
|
|
|
|
struct gbm_device *gbm_dev; /**< GBM device (unavailable on Vulkan windows) */
|
|
|
|
} kmsdrm;
|
|
|
|
#endif
|
|
|
|
|
2022-11-23 14:33:48 -07:00
|
|
|
/* Make sure this union has enough room for 14 pointers */
|
|
|
|
void *dummy_ptrs[14];
|
|
|
|
Uint64 dummy_ints[14];
|
2015-06-21 09:33:46 -06:00
|
|
|
} info;
|
|
|
|
};
|
2022-11-23 14:33:48 -07:00
|
|
|
SDL_COMPILE_TIME_ASSERT(SDL_SysWMinfo_size, sizeof(struct SDL_SysWMinfo) == SDL_SYSWM_CURRENT_INFO_SIZE);
|
2015-06-21 09:33:46 -06:00
|
|
|
|
|
|
|
#endif /* SDL_PROTOTYPES_ONLY */
|
|
|
|
|
|
|
|
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
|
|
|
|
|
2021-03-21 12:18:39 -06:00
|
|
|
|
2015-06-21 09:33:46 -06:00
|
|
|
/**
|
2021-03-21 12:18:39 -06:00
|
|
|
* Get driver-specific information about a window.
|
|
|
|
*
|
|
|
|
* You must include SDL_syswm.h for the declaration of SDL_SysWMinfo.
|
2015-06-21 09:33:46 -06:00
|
|
|
*
|
2021-03-21 12:18:39 -06:00
|
|
|
* \param window the window about which information is being requested
|
|
|
|
* \param info an SDL_SysWMinfo structure filled in with window information
|
2022-11-23 15:07:15 -07:00
|
|
|
* \param version the version of info being requested, should be
|
|
|
|
* SDL_SYSWM_CURRENT_VERSION
|
2022-11-23 14:33:48 -07:00
|
|
|
* \returns 0 on success or a negative error code on failure; call
|
|
|
|
* SDL_GetError() for more information.
|
2015-06-21 09:33:46 -06:00
|
|
|
*
|
2022-11-22 15:40:14 -07:00
|
|
|
* \since This function is available since SDL 3.0.0.
|
2015-06-21 09:33:46 -06:00
|
|
|
*/
|
2022-11-23 14:33:48 -07:00
|
|
|
extern DECLSPEC int SDLCALL SDL_GetWindowWMInfo(SDL_Window *window, SDL_SysWMinfo *info, Uint32 version);
|
2015-06-21 09:33:46 -06:00
|
|
|
|
|
|
|
|
|
|
|
/* Ends C function definitions when using C++ */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2022-12-22 09:38:59 -07:00
|
|
|
#include <SDL3/SDL_close_code.h>
|
2015-06-21 09:33:46 -06:00
|
|
|
|
2016-11-20 22:34:54 -07:00
|
|
|
#endif /* SDL_syswm_h_ */
|