Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed Cocoa and OpenGL builds
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 21, 2010
1 parent 6703fb2 commit d665aaf
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 40 deletions.
8 changes: 4 additions & 4 deletions src/video/SDL_renderer_gles.c
Expand Up @@ -255,7 +255,7 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->DestroyTexture = GLES_DestroyTexture;
renderer->DestroyRenderer = GLES_DestroyRenderer;
renderer->info = GL_ES_RenderDriver.info;
renderer->window = window->id;
renderer->window = window;
renderer->driverdata = data;

renderer->info.flags =
Expand All @@ -276,12 +276,12 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
return NULL;
}

data->context = SDL_GL_CreateContext(window->id);
data->context = SDL_GL_CreateContext(window);
if (!data->context) {
GLES_DestroyRenderer(renderer);
return NULL;
}
if (SDL_GL_MakeCurrent(window->id, data->context) < 0) {
if (SDL_GL_MakeCurrent(window, data->context) < 0) {
GLES_DestroyRenderer(renderer);
return NULL;
}
Expand Down Expand Up @@ -334,7 +334,7 @@ GLES_ActivateRenderer(SDL_Renderer * renderer)
GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
SDL_Window *window = renderer->window;

if (SDL_GL_MakeCurrent(window->id, data->context) < 0) {
if (SDL_GL_MakeCurrent(window, data->context) < 0) {
return -1;
}
if (data->updateSize) {
Expand Down
2 changes: 1 addition & 1 deletion src/video/cocoa/SDL_cocoaopengl.m
Expand Up @@ -212,7 +212,7 @@ - (CGLContextObj)CGLContextObj;
if (window->flags & SDL_WINDOW_FULLSCREEN) {
[nscontext setFullScreen];
} else {
[nscontext setView:[windowdata->window contentView]];
[nscontext setView:[windowdata->nswindow contentView]];
[nscontext update];
}
[nscontext makeCurrentContext];
Expand Down
70 changes: 35 additions & 35 deletions src/video/cocoa/SDL_cocoawindow.m
Expand Up @@ -44,22 +44,22 @@ - (void)listen:(SDL_WindowData *)data

center = [NSNotificationCenter defaultCenter];

[_data->window setNextResponder:self];
if ([_data->window delegate] != nil) {
[center addObserver:self selector:@selector(windowDisExpose:) name:NSWindowDidExposeNotification object:_data->window];
[center addObserver:self selector:@selector(windowDidMove:) name:NSWindowDidMoveNotification object:_data->window];
[center addObserver:self selector:@selector(windowDidResize:) name:NSWindowDidResizeNotification object:_data->window];
[center addObserver:self selector:@selector(windowDidMiniaturize:) name:NSWindowDidMiniaturizeNotification object:_data->window];
[center addObserver:self selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification object:_data->window];
[center addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:_data->window];
[center addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:_data->window];
[_data->nswindow setNextResponder:self];
if ([_data->nswindow delegate] != nil) {
[center addObserver:self selector:@selector(windowDisExpose:) name:NSWindowDidExposeNotification object:_data->nswindow];
[center addObserver:self selector:@selector(windowDidMove:) name:NSWindowDidMoveNotification object:_data->nswindow];
[center addObserver:self selector:@selector(windowDidResize:) name:NSWindowDidResizeNotification object:_data->nswindow];
[center addObserver:self selector:@selector(windowDidMiniaturize:) name:NSWindowDidMiniaturizeNotification object:_data->nswindow];
[center addObserver:self selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification object:_data->nswindow];
[center addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:_data->nswindow];
[center addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:_data->nswindow];
} else {
[_data->window setDelegate:self];
[_data->nswindow setDelegate:self];
}
[center addObserver:self selector:@selector(windowDidHide:) name:NSApplicationDidHideNotification object:NSApp];
[center addObserver:self selector:@selector(windowDidUnhide:) name:NSApplicationDidUnhideNotification object:NSApp];

[_data->window setAcceptsMouseMovedEvents:YES];
[_data->nswindow setAcceptsMouseMovedEvents:YES];
}

- (void)close
Expand All @@ -68,17 +68,17 @@ - (void)close

center = [NSNotificationCenter defaultCenter];

[_data->window setNextResponder:nil];
if ([_data->window delegate] != self) {
[center removeObserver:self name:NSWindowDidExposeNotification object:_data->window];
[center removeObserver:self name:NSWindowDidMoveNotification object:_data->window];
[center removeObserver:self name:NSWindowDidResizeNotification object:_data->window];
[center removeObserver:self name:NSWindowDidMiniaturizeNotification object:_data->window];
[center removeObserver:self name:NSWindowDidDeminiaturizeNotification object:_data->window];
[center removeObserver:self name:NSWindowDidBecomeKeyNotification object:_data->window];
[center removeObserver:self name:NSWindowDidResignKeyNotification object:_data->window];
[_data->nswindow setNextResponder:nil];
if ([_data->nswindow delegate] != self) {
[center removeObserver:self name:NSWindowDidExposeNotification object:_data->nswindow];
[center removeObserver:self name:NSWindowDidMoveNotification object:_data->nswindow];
[center removeObserver:self name:NSWindowDidResizeNotification object:_data->nswindow];
[center removeObserver:self name:NSWindowDidMiniaturizeNotification object:_data->nswindow];
[center removeObserver:self name:NSWindowDidDeminiaturizeNotification object:_data->nswindow];
[center removeObserver:self name:NSWindowDidBecomeKeyNotification object:_data->nswindow];
[center removeObserver:self name:NSWindowDidResignKeyNotification object:_data->nswindow];
} else {
[_data->window setDelegate:nil];
[_data->nswindow setDelegate:nil];
}
[center removeObserver:self name:NSApplicationDidHideNotification object:NSApp];
[center removeObserver:self name:NSApplicationDidUnhideNotification object:NSApp];
Expand All @@ -98,7 +98,7 @@ - (void)windowDidExpose:(NSNotification *)aNotification
- (void)windowDidMove:(NSNotification *)aNotification
{
int x, y;
NSRect rect = [_data->window contentRectForFrameRect:[_data->window frame]];
NSRect rect = [_data->nswindow contentRectForFrameRect:[_data->nswindow frame]];
ConvertNSRect(&rect);
x = (int)rect.origin.x;
y = (int)rect.origin.y;
Expand All @@ -108,7 +108,7 @@ - (void)windowDidMove:(NSNotification *)aNotification
- (void)windowDidResize:(NSNotification *)aNotification
{
int w, h;
NSRect rect = [_data->window contentRectForFrameRect:[_data->window frame]];
NSRect rect = [_data->nswindow contentRectForFrameRect:[_data->nswindow frame]];
w = (int)rect.size.width;
h = (int)rect.size.height;
SDL_SendWindowEvent(_data->window, SDL_WINDOWEVENT_RESIZED, w, h);
Expand Down Expand Up @@ -309,7 +309,7 @@ - (BOOL)canBecomeMainWindow
return -1;
}
data->window = window;
data->window = nswindow;
data->nswindow = nswindow;
data->created = created;
data->display = displaydata->display;
data->videodata = videodata;
Expand Down Expand Up @@ -471,7 +471,7 @@ - (BOOL)canBecomeMainWindow
Cocoa_SetWindowTitle(_THIS, SDL_Window * window)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
NSString *string;

if(window->title) {
Expand All @@ -489,7 +489,7 @@ - (BOOL)canBecomeMainWindow
Cocoa_SetWindowPosition(_THIS, SDL_Window * window)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
SDL_VideoDisplay *display = window->display;
NSRect rect;
SDL_Rect bounds;
Expand Down Expand Up @@ -519,7 +519,7 @@ - (BOOL)canBecomeMainWindow
Cocoa_SetWindowSize(_THIS, SDL_Window * window)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
NSSize size;

size.width = window->w;
Expand All @@ -532,7 +532,7 @@ - (BOOL)canBecomeMainWindow
Cocoa_ShowWindow(_THIS, SDL_Window * window)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;

if (![nswindow isMiniaturized]) {
[nswindow makeKeyAndOrderFront:nil];
Expand All @@ -544,7 +544,7 @@ - (BOOL)canBecomeMainWindow
Cocoa_HideWindow(_THIS, SDL_Window * window)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;

[nswindow orderOut:nil];
[pool release];
Expand All @@ -554,7 +554,7 @@ - (BOOL)canBecomeMainWindow
Cocoa_RaiseWindow(_THIS, SDL_Window * window)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;

[nswindow makeKeyAndOrderFront:nil];
[pool release];
Expand All @@ -564,7 +564,7 @@ - (BOOL)canBecomeMainWindow
Cocoa_MaximizeWindow(_THIS, SDL_Window * window)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;

[nswindow zoom:nil];
[pool release];
Expand All @@ -574,7 +574,7 @@ - (BOOL)canBecomeMainWindow
Cocoa_MinimizeWindow(_THIS, SDL_Window * window)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;

[nswindow miniaturize:nil];
[pool release];
Expand All @@ -584,7 +584,7 @@ - (BOOL)canBecomeMainWindow
Cocoa_RestoreWindow(_THIS, SDL_Window * window)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;

if ([nswindow isMiniaturized]) {
[nswindow deminiaturize:nil];
Expand Down Expand Up @@ -615,7 +615,7 @@ - (BOOL)canBecomeMainWindow
[data->listener close];
[data->listener release];
if (data->created) {
[data->window close];
[data->nswindow close];
}
SDL_free(data);
}
Expand All @@ -625,7 +625,7 @@ - (BOOL)canBecomeMainWindow
SDL_bool
Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
{
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window;
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;

if (info->version.major <= SDL_MAJOR_VERSION) {
//info->window = nswindow;
Expand Down

0 comments on commit d665aaf

Please sign in to comment.