Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Initial work on X11 window code in.

  • Loading branch information
slouken committed Jul 27, 2006
1 parent 7dce748 commit 63d4e0b3ef76655de468cbe104e03260e1ce3b88
@@ -66,7 +66,7 @@ struct SDL_WindowData
{
SDL_WindowID windowID;
NSWindow *window;
BOOL created;
SDL_bool created;
Cocoa_WindowListener *listener;
struct SDL_VideoData *videodata;
};
@@ -242,9 +242,10 @@ - (void)keyUp:(NSEvent *)theEvent
@end

static int
SetupWindowData(SDL_Window * window, NSWindow *nswindow, BOOL created)
SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created)
{
NSAutoreleasePool *pool;
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
SDL_WindowData *data;

/* Allocate the window data */
@@ -256,7 +257,7 @@ - (void)keyUp:(NSEvent *)theEvent
data->windowID = window->id;
data->window = nswindow;
data->created = created;
data->videodata = (SDL_VideoData *) SDL_GetVideoDevice()->driverdata;
data->videodata = videodata;

pool = [[NSAutoreleasePool alloc] init];

@@ -380,7 +381,7 @@ - (void)keyUp:(NSEvent *)theEvent

[pool release];

if (SetupWindowData(window, nswindow, YES) < 0) {
if (SetupWindowData(_this, window, nswindow, SDL_TRUE) < 0) {
[nswindow release];
return -1;
}
@@ -413,7 +414,7 @@ - (void)keyUp:(NSEvent *)theEvent

[pool release];

return SetupWindowData(window, nswindow, NO);
return SetupWindowData(_this, window, nswindow, SDL_FALSE);
}

void
@@ -22,7 +22,6 @@
#include "SDL_config.h"

#include "SDL_win32video.h"
#include "SDL_version.h"
#include "SDL_syswm.h"
#include "SDL_vkeys.h"
#include "../../events/SDL_events_c.h"
@@ -393,6 +392,18 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
SDL_WindowData *data;

/* Send a SDL_SYSWMEVENT if the application wants them */
if (SDL_ProcessEvents[SDL_SYSWMEVENT] == SDL_ENABLE) {
SDL_SysWMmsg wmmsg;

SDL_VERSION(&wmmsg.version);
wmmsg.hwnd = hwnd;
wmmsg.msg = msg;
wmmsg.wParam = wParam;
wmmsg.lParam = lParam;
SDL_SendSysWMEvent(&wmmsg);
}

/* Get the window data for the window */
data = (SDL_WindowData *) GetProp(hwnd, TEXT("SDL_WindowData"));
if (!data) {
@@ -412,18 +423,6 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
#endif

/* Send a SDL_SYSWMEVENT if the application wants them */
if (SDL_ProcessEvents[SDL_SYSWMEVENT] == SDL_ENABLE) {
SDL_SysWMmsg wmmsg;

SDL_VERSION(&wmmsg.version);
wmmsg.hwnd = hwnd;
wmmsg.msg = msg;
wmmsg.wParam = wParam;
wmmsg.lParam = lParam;
SDL_SendSysWMEvent(&wmmsg);
}

switch (msg) {

case WM_SHOWWINDOW:
@@ -31,8 +31,9 @@


static int
SetupWindowData(SDL_Window * window, HWND hwnd, BOOL created)
SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
{
SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
SDL_WindowData *data;

/* Allocate the window data */
@@ -46,7 +47,7 @@ SetupWindowData(SDL_Window * window, HWND hwnd, BOOL created)
data->hdc = GetDC(hwnd);
data->created = created;
data->mouse_pressed = SDL_FALSE;
data->videodata = (SDL_VideoData *) SDL_GetVideoDevice()->driverdata;
data->videodata = videodata;

/* Associate the data with the window */
if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) {
@@ -208,7 +209,7 @@ WIN_CreateWindow(_THIS, SDL_Window * window)
return -1;
}

if (SetupWindowData(window, hwnd, TRUE) < 0) {
if (SetupWindowData(_this, window, hwnd, SDL_TRUE) < 0) {
DestroyWindow(hwnd);
return -1;
}
@@ -245,7 +246,7 @@ WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
SDL_stack_free(title);
}

if (SetupWindowData(window, hwnd, FALSE) < 0) {
if (SetupWindowData(_this, window, hwnd, SDL_FALSE) < 0) {
return -1;
}
return 0;
@@ -30,7 +30,7 @@ typedef struct
HWND hwnd;
HDC hdc;
WNDPROC wndproc;
BOOL created;
SDL_bool created;
int mouse_pressed;
struct SDL_VideoData *videodata;
} SDL_WindowData;

0 comments on commit 63d4e0b

Please sign in to comment.