Merged the Windows custom window system hooks into the union used by X11.

Added Cocoa custom window system hooks
This commit is contained in:
Sam Lantinga
2010-09-27 01:24:05 -07:00
parent 5426a79715
commit bf43df8ba5
6 changed files with 75 additions and 118 deletions

View File

@@ -40,12 +40,14 @@
#if SDL_VIDEO_OPENGL
#include "SDL_opengl.h"
#endif /* SDL_VIDEO_OPENGL */
#include "SDL_syswm.h"
/* On Windows, windows.h defines CreateWindow */
#ifdef CreateWindow
#undef CreateWindow
#endif
#endif /* SDL_VIDEO_OPENGL */
/* Available video drivers */
static VideoBootStrap *bootstrap[] = {
@@ -3384,6 +3386,11 @@ SDL_GetWindowWMInfo(SDL_Window * window, struct SDL_SysWMinfo *info)
{
CHECK_WINDOW_MAGIC(window, SDL_FALSE);
if (!info) {
return SDL_FALSE;
}
info->subsystem = SDL_SYSWM_UNKNOWN;
if (!_this->GetWindowWMInfo) {
return SDL_FALSE;
}

View File

@@ -704,10 +704,11 @@ Cocoa_DestroyWindow(_THIS, SDL_Window * window)
SDL_bool
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) {
//info->window = nswindow;
info->subsystem = SDL_SYSWM_COCOA;
info->info.cocoa.window = nswindow;
return SDL_TRUE;
} else {
SDL_SetError("Application not compiled with SDL %d.%d\n",

View File

@@ -113,10 +113,11 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
SDL_SysWMmsg wmmsg;
SDL_VERSION(&wmmsg.version);
wmmsg.hwnd = hwnd;
wmmsg.msg = msg;
wmmsg.wParam = wParam;
wmmsg.lParam = lParam;
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);
}

View File

@@ -551,7 +551,8 @@ WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
{
HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
if (info->version.major <= SDL_MAJOR_VERSION) {
info->window = hwnd;
info->subsystem = SDL_SYSWM_WINDOWS;
info->info.win.window = hwnd;
return SDL_TRUE;
} else {
SDL_SetError("Application not compiled with SDL %d.%d\n",

View File

@@ -90,7 +90,7 @@ X11_DispatchEvent(_THIS)
SDL_VERSION(&wmmsg.version);
wmmsg.subsystem = SDL_SYSWM_X11;
wmmsg.event.xevent = xevent;
wmmsg.msg.x11.event = xevent;
SDL_SendSysWMEvent(&wmmsg);
}