Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
45e68f6c
Commit
45e68f6c
authored
Sep 27, 2010
by
Sam Lantinga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged the Windows custom window system hooks into the union used by X11.
Added Cocoa custom window system hooks
parent
8e2a972b
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
75 additions
and
118 deletions
+75
-118
SDL_syswm.h
include/SDL_syswm.h
+56
-109
SDL_video.c
src/video/SDL_video.c
+8
-1
SDL_cocoawindow.m
src/video/cocoa/SDL_cocoawindow.m
+3
-2
SDL_win32events.c
src/video/win32/SDL_win32events.c
+5
-4
SDL_win32window.c
src/video/win32/SDL_win32window.c
+2
-1
SDL_x11events.c
src/video/x11/SDL_x11events.c
+1
-1
No files found.
include/SDL_syswm.h
View file @
45e68f6c
...
@@ -54,8 +54,12 @@ extern "C" {
...
@@ -54,8 +54,12 @@ extern "C" {
struct
SDL_SysWMinfo
;
struct
SDL_SysWMinfo
;
#else
#else
#if defined(SDL_VIDEO_DRIVER_WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
/* This is the structure for custom window manager events */
/* This is the structure for custom window manager events */
#if defined(SDL_VIDEO_DRIVER_X11) || defined(SDL_VIDEO_DRIVER_DIRECTFB)
#if defined(SDL_VIDEO_DRIVER_X11)
#if defined(SDL_VIDEO_DRIVER_X11)
#if defined(__APPLE__) && defined(__MACH__)
#if defined(__APPLE__) && defined(__MACH__)
/* conflicts with Quickdraw.h */
/* conflicts with Quickdraw.h */
...
@@ -75,21 +79,29 @@ struct SDL_SysWMinfo;
...
@@ -75,21 +79,29 @@ struct SDL_SysWMinfo;
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
#include <directfb/directfb.h>
#include <directfb/directfb.h>
#endif
#endif
#if defined(SDL_VIDEO_DRIVER_COCOA)
#ifdef __OBJC__
#include <Cocoa/Cocoa.h>
#else
typedef
struct
_NSWindow
NSWindow
;
#endif
#endif
/**
/**
* These are the various supported
subsystems under UNIX.
* These are the various supported
windowing subsystems
*/
*/
typedef
enum
typedef
enum
{
{
#if defined(SDL_VIDEO_DRIVER_X11)
SDL_SYSWM_UNKNOWN
,
SDL_SYSWM_WINDOWS
,
SDL_SYSWM_X11
,
SDL_SYSWM_X11
,
#endif
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
SDL_SYSWM_DIRECTFB
,
SDL_SYSWM_DIRECTFB
,
#endif
SDL_SYSWM_COCOA
,
}
SDL_SYSWM_TYPE
;
}
SDL_SYSWM_TYPE
;
/**
/**
* The
UNIX
custom event structure.
* The custom event structure.
*/
*/
struct
SDL_SysWMmsg
struct
SDL_SysWMmsg
{
{
...
@@ -97,17 +109,35 @@ struct SDL_SysWMmsg
...
@@ -97,17 +109,35 @@ struct SDL_SysWMmsg
SDL_SYSWM_TYPE
subsystem
;
SDL_SYSWM_TYPE
subsystem
;
union
union
{
{
#if defined(SDL_VIDEO_DRIVER_WIN32)
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
#if defined(SDL_VIDEO_DRIVER_X11)
#if defined(SDL_VIDEO_DRIVER_X11)
XEvent
xevent
;
struct
{
XEvent
event
;
}
x11
;
#endif
#endif
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
DFBEvent
dfb_event
;
struct
{
DFBEvent
event
;
}
dfb
;
#endif
#endif
}
event
;
#if defined(SDL_VIDEO_DRIVER_COCOA)
struct
{
/* No Cocoa window events yet */
}
cocoa
;
#endif
}
msg
;
};
};
/**
/**
* The
UNIX
custom window manager information structure.
* The custom window manager information structure.
*
*
* When this structure is returned, it holds information about which
* When this structure is returned, it holds information about which
* low level system it is using, and will be one of SDL_SYSWM_TYPE.
* low level system it is using, and will be one of SDL_SYSWM_TYPE.
...
@@ -118,6 +148,12 @@ struct SDL_SysWMinfo
...
@@ -118,6 +148,12 @@ struct SDL_SysWMinfo
SDL_SYSWM_TYPE
subsystem
;
SDL_SYSWM_TYPE
subsystem
;
union
union
{
{
#if defined(SDL_VIDEO_DRIVER_WIN32)
struct
{
HWND
window
;
/**< The Win32 display window */
}
win
;
#endif
#if defined(SDL_VIDEO_DRIVER_X11)
#if defined(SDL_VIDEO_DRIVER_X11)
struct
struct
{
{
...
@@ -131,106 +167,17 @@ struct SDL_SysWMinfo
...
@@ -131,106 +167,17 @@ struct SDL_SysWMinfo
IDirectFB
*
dfb
;
/**< The directfb main interface */
IDirectFB
*
dfb
;
/**< The directfb main interface */
IDirectFBWindow
*
window
;
/**< The directfb window handle */
IDirectFBWindow
*
window
;
/**< The directfb window handle */
IDirectFBSurface
*
surface
;
/**< The directfb client surface */
IDirectFBSurface
*
surface
;
/**< The directfb client surface */
}
directfb
;
}
dfb
;
#endif
#if defined(SDL_VIDEO_DRIVER_COCOA)
struct
{
NSWindow
*
window
;
}
cocoa
;
#endif
#endif
}
info
;
}
info
;
};
};
#elif defined(SDL_VIDEO_DRIVER_WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
/**
* The windows custom event structure.
*/
struct
SDL_SysWMmsg
{
SDL_version
version
;
HWND
hwnd
;
/**< The window for the message */
UINT
msg
;
/**< The type of message */
WPARAM
wParam
;
/**< WORD message parameter */
LPARAM
lParam
;
/**< LONG message parameter */
};
/**
* The windows custom window manager information structure.
*/
struct
SDL_SysWMinfo
{
SDL_version
version
;
HWND
window
;
/**< The Win32 display window */
};
#elif defined(SDL_VIDEO_DRIVER_RISCOS)
/**
* RISC OS custom event structure.
*/
struct
SDL_SysWMmsg
{
SDL_version
version
;
int
eventCode
;
/**< The window for the message */
int
pollBlock
[
64
];
};
/**
* The RISC OS custom window manager information structure.
*/
struct
SDL_SysWMinfo
{
SDL_version
version
;
int
wimpVersion
;
/**< Wimp version running under */
int
taskHandle
;
/**< The RISC OS task handle */
int
window
;
/**< The RISC OS display window */
};
#elif defined(SDL_VIDEO_DRIVER_PHOTON) || defined(SDL_VIDEO_DRIVER_QNXGF)
#include <sys/neutrino.h>
#if defined(SDL_VIDEO_OPENGL_ES)
#include <gf/gf.h>
#endif
/* SDL_VIDEO_OPENGL_ES */
#include <Ph.h>
/**
* The QNX custom event structure.
*/
struct
SDL_SysWMmsg
{
SDL_version
version
;
int
data
;
};
/**
* The QNX Photon custom window manager information structure.
*/
struct
SDL_SysWMinfo
{
SDL_version
version
;
int
data
;
};
#else
/**
* The generic custom event structure.
*/
struct
SDL_SysWMmsg
{
SDL_version
version
;
int
data
;
};
/**
* The generic custom window manager information structure.
*/
struct
SDL_SysWMinfo
{
SDL_version
version
;
int
data
;
};
#endif
/* video driver type */
#endif
/* SDL_PROTOTYPES_ONLY */
#endif
/* SDL_PROTOTYPES_ONLY */
typedef
struct
SDL_SysWMinfo
SDL_SysWMinfo
;
typedef
struct
SDL_SysWMinfo
SDL_SysWMinfo
;
...
...
src/video/SDL_video.c
View file @
45e68f6c
...
@@ -40,12 +40,14 @@
...
@@ -40,12 +40,14 @@
#if SDL_VIDEO_OPENGL
#if SDL_VIDEO_OPENGL
#include "SDL_opengl.h"
#include "SDL_opengl.h"
#endif
/* SDL_VIDEO_OPENGL */
#include "SDL_syswm.h"
/* On Windows, windows.h defines CreateWindow */
/* On Windows, windows.h defines CreateWindow */
#ifdef CreateWindow
#ifdef CreateWindow
#undef CreateWindow
#undef CreateWindow
#endif
#endif
#endif
/* SDL_VIDEO_OPENGL */
/* Available video drivers */
/* Available video drivers */
static
VideoBootStrap
*
bootstrap
[]
=
{
static
VideoBootStrap
*
bootstrap
[]
=
{
...
@@ -3384,6 +3386,11 @@ SDL_GetWindowWMInfo(SDL_Window * window, struct SDL_SysWMinfo *info)
...
@@ -3384,6 +3386,11 @@ SDL_GetWindowWMInfo(SDL_Window * window, struct SDL_SysWMinfo *info)
{
{
CHECK_WINDOW_MAGIC
(
window
,
SDL_FALSE
);
CHECK_WINDOW_MAGIC
(
window
,
SDL_FALSE
);
if
(
!
info
)
{
return
SDL_FALSE
;
}
info
->
subsystem
=
SDL_SYSWM_UNKNOWN
;
if
(
!
_this
->
GetWindowWMInfo
)
{
if
(
!
_this
->
GetWindowWMInfo
)
{
return
SDL_FALSE
;
return
SDL_FALSE
;
}
}
...
...
src/video/cocoa/SDL_cocoawindow.m
View file @
45e68f6c
...
@@ -704,10 +704,11 @@ Cocoa_DestroyWindow(_THIS, SDL_Window * window)
...
@@ -704,10 +704,11 @@ Cocoa_DestroyWindow(_THIS, SDL_Window * window)
SDL_bool
SDL_bool
Cocoa_GetWindowWMInfo
(
_THIS
,
SDL_Window
*
window
,
SDL_SysWMinfo
*
info
)
Cocoa_GetWindowWMInfo
(
_THIS
,
SDL_Window
*
window
,
SDL_SysWMinfo
*
info
)
{
{
//
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
NSWindow
*
nswindow
=
((
SDL_WindowData
*
)
window
->
driverdata
)
->
nswindow
;
if
(
info
->
version
.
major
<=
SDL_MAJOR_VERSION
)
{
if
(
info
->
version
.
major
<=
SDL_MAJOR_VERSION
)
{
//info->window = nswindow;
info
->
subsystem
=
SDL_SYSWM_COCOA
;
info
->
info
.
cocoa
.
window
=
nswindow
;
return
SDL_TRUE
;
return
SDL_TRUE
;
}
else
{
}
else
{
SDL_SetError
(
"Application not compiled with SDL %d.%d
\n
"
,
SDL_SetError
(
"Application not compiled with SDL %d.%d
\n
"
,
...
...
src/video/win32/SDL_win32events.c
View file @
45e68f6c
...
@@ -113,10 +113,11 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
...
@@ -113,10 +113,11 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
SDL_SysWMmsg
wmmsg
;
SDL_SysWMmsg
wmmsg
;
SDL_VERSION
(
&
wmmsg
.
version
);
SDL_VERSION
(
&
wmmsg
.
version
);
wmmsg
.
hwnd
=
hwnd
;
wmmsg
.
subsystem
=
SDL_SYSWM_WINDOWS
;
wmmsg
.
msg
=
msg
;
wmmsg
.
msg
.
win
.
hwnd
=
hwnd
;
wmmsg
.
wParam
=
wParam
;
wmmsg
.
msg
.
win
.
msg
=
msg
;
wmmsg
.
lParam
=
lParam
;
wmmsg
.
msg
.
win
.
wParam
=
wParam
;
wmmsg
.
msg
.
win
.
lParam
=
lParam
;
SDL_SendSysWMEvent
(
&
wmmsg
);
SDL_SendSysWMEvent
(
&
wmmsg
);
}
}
...
...
src/video/win32/SDL_win32window.c
View file @
45e68f6c
...
@@ -551,7 +551,8 @@ WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
...
@@ -551,7 +551,8 @@ WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
{
{
HWND
hwnd
=
((
SDL_WindowData
*
)
window
->
driverdata
)
->
hwnd
;
HWND
hwnd
=
((
SDL_WindowData
*
)
window
->
driverdata
)
->
hwnd
;
if
(
info
->
version
.
major
<=
SDL_MAJOR_VERSION
)
{
if
(
info
->
version
.
major
<=
SDL_MAJOR_VERSION
)
{
info
->
window
=
hwnd
;
info
->
subsystem
=
SDL_SYSWM_WINDOWS
;
info
->
info
.
win
.
window
=
hwnd
;
return
SDL_TRUE
;
return
SDL_TRUE
;
}
else
{
}
else
{
SDL_SetError
(
"Application not compiled with SDL %d.%d
\n
"
,
SDL_SetError
(
"Application not compiled with SDL %d.%d
\n
"
,
...
...
src/video/x11/SDL_x11events.c
View file @
45e68f6c
...
@@ -90,7 +90,7 @@ X11_DispatchEvent(_THIS)
...
@@ -90,7 +90,7 @@ X11_DispatchEvent(_THIS)
SDL_VERSION
(
&
wmmsg
.
version
);
SDL_VERSION
(
&
wmmsg
.
version
);
wmmsg
.
subsystem
=
SDL_SYSWM_X11
;
wmmsg
.
subsystem
=
SDL_SYSWM_X11
;
wmmsg
.
event
.
x
event
=
xevent
;
wmmsg
.
msg
.
x11
.
event
=
xevent
;
SDL_SendSysWMEvent
(
&
wmmsg
);
SDL_SendSysWMEvent
(
&
wmmsg
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment