Got basic, pre-actually-writing-anything Cocoa to build.
authoregottlieb
Tue, 03 Aug 2010 00:47:33 -0400
changeset 48275660aac926e9
parent 4826 d532a5a114cd
child 4828 0463365eeffa
Got basic, pre-actually-writing-anything Cocoa to build.
Xcode/SDL/SDL.xcodeproj/project.pbxproj
include/SDL_revision.h
src/video/SDL_shape.c
src/video/cocoa/SDL_cocoashape.h
src/video/cocoa/SDL_cocoashape.m
src/video/cocoa/SDL_cocoavideo.m
     1.1 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj	Mon Aug 02 23:58:22 2010 -0400
     1.2 +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj	Tue Aug 03 00:47:33 2010 -0400
     1.3 @@ -450,6 +450,13 @@
     1.4  		04F2AF671104AC0800D6DDF7 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F2AF651104AC0800D6DDF7 /* SDL_assert.c */; };
     1.5  		04F2AF691104AC4500D6DDF7 /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F2AF681104AC4500D6DDF7 /* SDL_assert.h */; };
     1.6  		04F2AF6A1104AC4500D6DDF7 /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F2AF681104AC4500D6DDF7 /* SDL_assert.h */; };
     1.7 +		4537737D1207C4CE002F0F45 /* SDL_shape_internals.h in Headers */ = {isa = PBXBuildFile; fileRef = 4537737B1207C4CE002F0F45 /* SDL_shape_internals.h */; };
     1.8 +		4537737E1207C4CE002F0F45 /* SDL_shape.c in Sources */ = {isa = PBXBuildFile; fileRef = 4537737C1207C4CE002F0F45 /* SDL_shape.c */; };
     1.9 +		453773821207C518002F0F45 /* SDL_shape.h in Headers */ = {isa = PBXBuildFile; fileRef = 453773811207C518002F0F45 /* SDL_shape.h */; };
    1.10 +		453773891207C5A2002F0F45 /* SDL_cocoashape.h in Headers */ = {isa = PBXBuildFile; fileRef = 453773871207C5A2002F0F45 /* SDL_cocoashape.h */; };
    1.11 +		4537738A1207C5A2002F0F45 /* SDL_cocoashape.m in Sources */ = {isa = PBXBuildFile; fileRef = 453773881207C5A2002F0F45 /* SDL_cocoashape.m */; };
    1.12 +		453773921207C6E9002F0F45 /* SDL_x11shape.c in Sources */ = {isa = PBXBuildFile; fileRef = 453773901207C6E9002F0F45 /* SDL_x11shape.c */; };
    1.13 +		453773931207C6E9002F0F45 /* SDL_x11shape.h in Headers */ = {isa = PBXBuildFile; fileRef = 453773911207C6E9002F0F45 /* SDL_x11shape.h */; };
    1.14  		BECDF62E0761BA81005FE872 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 01538330006D78D67F000001 /* SDL_audio.c */; };
    1.15  		BECDF62F0761BA81005FE872 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 01538331006D78D67F000001 /* SDL_audiocvt.c */; };
    1.16  		BECDF6300761BA81005FE872 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 01538332006D78D67F000001 /* SDL_audiodev.c */; };
    1.17 @@ -825,6 +832,13 @@
    1.18  		0C5AF5FD01191D2B7F000001 /* SDL_version.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_version.h; path = ../../include/SDL_version.h; sourceTree = SOURCE_ROOT; };
    1.19  		0C5AF5FE01191D2B7F000001 /* SDL_video.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_video.h; path = ../../include/SDL_video.h; sourceTree = SOURCE_ROOT; };
    1.20  		0C5AF5FF01191D2B7F000001 /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL.h; path = ../../include/SDL.h; sourceTree = SOURCE_ROOT; };
    1.21 +		4537737B1207C4CE002F0F45 /* SDL_shape_internals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shape_internals.h; sourceTree = "<group>"; };
    1.22 +		4537737C1207C4CE002F0F45 /* SDL_shape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_shape.c; sourceTree = "<group>"; };
    1.23 +		453773811207C518002F0F45 /* SDL_shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_shape.h; path = ../../include/SDL_shape.h; sourceTree = SOURCE_ROOT; };
    1.24 +		453773871207C5A2002F0F45 /* SDL_cocoashape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoashape.h; sourceTree = "<group>"; };
    1.25 +		453773881207C5A2002F0F45 /* SDL_cocoashape.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoashape.m; sourceTree = "<group>"; };
    1.26 +		453773901207C6E9002F0F45 /* SDL_x11shape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11shape.c; sourceTree = "<group>"; };
    1.27 +		453773911207C6E9002F0F45 /* SDL_x11shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11shape.h; sourceTree = "<group>"; };
    1.28  		B24DA50405A88D52006B9F1C /* SDL_cpuinfo.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SDL_cpuinfo.c; sourceTree = "<group>"; };
    1.29  		B29A290D04E5B28700A80002 /* SDL_loadso.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_loadso.h; path = ../../include/SDL_loadso.h; sourceTree = "<group>"; };
    1.30  		B2CF8DC405C444E400E5DC7F /* SDL_cpuinfo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_cpuinfo.h; path = ../../include/SDL_cpuinfo.h; sourceTree = SOURCE_ROOT; };
    1.31 @@ -1043,6 +1057,8 @@
    1.32  				00CFA70B106B498A00758660 /* SDL_cocoamouse.m */,
    1.33  				00CFA70C106B498A00758660 /* SDL_cocoaopengl.h */,
    1.34  				00CFA70D106B498A00758660 /* SDL_cocoaopengl.m */,
    1.35 +				453773871207C5A2002F0F45 /* SDL_cocoashape.h */,
    1.36 +				453773881207C5A2002F0F45 /* SDL_cocoashape.m */,
    1.37  				00CFA70E106B498A00758660 /* SDL_cocoavideo.h */,
    1.38  				00CFA70F106B498A00758660 /* SDL_cocoavideo.m */,
    1.39  				00CFA710106B498A00758660 /* SDL_cocoawindow.h */,
    1.40 @@ -1087,6 +1103,8 @@
    1.41  				00CFA72B106B498B00758660 /* SDL_x11opengles.h */,
    1.42  				00CFA72C106B498B00758660 /* SDL_x11render.c */,
    1.43  				00CFA72D106B498B00758660 /* SDL_x11render.h */,
    1.44 +				453773901207C6E9002F0F45 /* SDL_x11shape.c */,
    1.45 +				453773911207C6E9002F0F45 /* SDL_x11shape.h */,
    1.46  				00CFA72E106B498B00758660 /* SDL_x11sym.h */,
    1.47  				00CFA72F106B498B00758660 /* SDL_x11video.c */,
    1.48  				00CFA730106B498B00758660 /* SDL_x11video.h */,
    1.49 @@ -1401,6 +1419,8 @@
    1.50  				00CFA80E106B49B600758660 /* SDL_renderer_sw.h */,
    1.51  				00CFA80F106B49B600758660 /* SDL_RLEaccel_c.h */,
    1.52  				00CFA810106B49B600758660 /* SDL_RLEaccel.c */,
    1.53 +				4537737C1207C4CE002F0F45 /* SDL_shape.c */,
    1.54 +				4537737B1207C4CE002F0F45 /* SDL_shape_internals.h */,
    1.55  				00CFA811106B49B600758660 /* SDL_stretch.c */,
    1.56  				00CFA812106B49B600758660 /* SDL_surface.c */,
    1.57  				00CFA813106B49B600758660 /* SDL_sysvideo.h */,
    1.58 @@ -1452,6 +1472,7 @@
    1.59  				00A6EBD91078D569001EEA06 /* SDL_revision.h */,
    1.60  				0C5AF5F801191D2B7F000001 /* SDL_rwops.h */,
    1.61  				00CFA680106B44CE00758660 /* SDL_scancode.h */,
    1.62 +				453773811207C518002F0F45 /* SDL_shape.h */,
    1.63  				00162D3909BD1FA90037C8D0 /* SDL_stdinc.h */,
    1.64  				00CFA681106B44CE00758660 /* SDL_surface.h */,
    1.65  				0C5AF5F901191D2B7F000001 /* SDL_syswm.h */,
    1.66 @@ -1743,6 +1764,10 @@
    1.67  				00A6EBDA1078D569001EEA06 /* SDL_revision.h in Headers */,
    1.68  				04F2AF691104AC4500D6DDF7 /* SDL_assert.h in Headers */,
    1.69  				006E95B011952992001DE610 /* SDL_rwopsbundlesupport.h in Headers */,
    1.70 +				4537737D1207C4CE002F0F45 /* SDL_shape_internals.h in Headers */,
    1.71 +				453773821207C518002F0F45 /* SDL_shape.h in Headers */,
    1.72 +				453773891207C5A2002F0F45 /* SDL_cocoashape.h in Headers */,
    1.73 +				453773931207C6E9002F0F45 /* SDL_x11shape.h in Headers */,
    1.74  			);
    1.75  			runOnlyForDeploymentPostprocessing = 0;
    1.76  		};
    1.77 @@ -2202,6 +2227,9 @@
    1.78  				04DB838D10FD8C81000519B5 /* SDL_drawrect.c in Sources */,
    1.79  				04F2AF661104AC0800D6DDF7 /* SDL_assert.c in Sources */,
    1.80  				006E95B111952992001DE610 /* SDL_rwopsbundlesupport.m in Sources */,
    1.81 +				4537737E1207C4CE002F0F45 /* SDL_shape.c in Sources */,
    1.82 +				4537738A1207C5A2002F0F45 /* SDL_cocoashape.m in Sources */,
    1.83 +				453773921207C6E9002F0F45 /* SDL_x11shape.c in Sources */,
    1.84  			);
    1.85  			runOnlyForDeploymentPostprocessing = 0;
    1.86  		};
     2.1 --- a/include/SDL_revision.h	Mon Aug 02 23:58:22 2010 -0400
     2.2 +++ b/include/SDL_revision.h	Tue Aug 03 00:47:33 2010 -0400
     2.3 @@ -1,1 +1,1 @@
     2.4 -#define SDL_REVISION "hg-4516:eb433f0d2ac5"
     2.5 +#define SDL_REVISION "hg-4526:d532a5a114cd"
     3.1 --- a/src/video/SDL_shape.c	Mon Aug 02 23:58:22 2010 -0400
     3.2 +++ b/src/video/SDL_shape.c	Tue Aug 03 00:47:33 2010 -0400
     3.3 @@ -27,7 +27,7 @@
     3.4  #include "SDL_pixels.h"
     3.5  #include "SDL_surface.h"
     3.6  #include "SDL_shape.h"
     3.7 -#include "../src/video/SDL_shape_internals.h"
     3.8 +#include "SDL_shape_internals.h"
     3.9  
    3.10  SDL_Window* SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) {
    3.11  	SDL_Window *result = SDL_CreateWindow(title,x,y,w,h,SDL_WINDOW_BORDERLESS | flags & !SDL_WINDOW_FULLSCREEN & !SDL_WINDOW_SHOWN);
     4.1 --- a/src/video/cocoa/SDL_cocoashape.h	Mon Aug 02 23:58:22 2010 -0400
     4.2 +++ b/src/video/cocoa/SDL_cocoashape.h	Tue Aug 03 00:47:33 2010 -0400
     4.3 @@ -20,14 +20,26 @@
     4.4      eligottlieb@gmail.com
     4.5  */
     4.6  
     4.7 +#include "SDL_config.h"
     4.8 +
     4.9 +#ifndef _SDL_cocoashape_h
    4.10 +#define _SDL_cocoashape_h
    4.11 +
    4.12 +#include "SDL_stdinc.h"
    4.13 +#include "SDL_video.h"
    4.14 +#include "SDL_shape.h"
    4.15 +#include "SDL_shape_internals.h"
    4.16 +#include "../SDL_sysvideo.h"
    4.17 +
    4.18  typedef struct {
    4.19  	NSGraphicsContext* context;
    4.20 -	SDL_Bool saved;
    4.21 +	SDL_bool saved;
    4.22  	
    4.23 -	NSRect* rects;
    4.24 -	Uint32 count;
    4.25 +	SDL_ShapeTree* shape;
    4.26  } SDL_ShapeData;
    4.27  
    4.28  extern SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window);
    4.29  extern int Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode);
    4.30  extern int Cocoa_ResizeWindowShape(SDL_Window *window);
    4.31 +
    4.32 +#endif
     5.1 --- a/src/video/cocoa/SDL_cocoashape.m	Mon Aug 02 23:58:22 2010 -0400
     5.2 +++ b/src/video/cocoa/SDL_cocoashape.m	Tue Aug 03 00:47:33 2010 -0400
     5.3 @@ -20,28 +20,29 @@
     5.4      eligottlieb@gmail.com
     5.5  */
     5.6  
     5.7 +#include "SDL_stdinc.h"
     5.8  #include "SDL_cocoavideo.h"
     5.9  #include "SDL_shape.h"
    5.10  #include "SDL_cocoashape.h"
    5.11 +#include "SDL_sysvideo.h"
    5.12  
    5.13  SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window) {
    5.14  	SDL_WindowData* data = (SDL_WindowData*)window->driverdata;
    5.15  	[data->nswindow setAlpha:1.0];
    5.16  	[data->nswindow setOpaque:YES];
    5.17  	[data->nswindow setStyleMask:NSBorderlessWindowMask];
    5.18 -	SDL_Shaper* result = result = malloc(sizeof(SDL_WindowShaper));
    5.19 +	SDL_WindowShaper* result = SDL_malloc(sizeof(SDL_WindowShaper));
    5.20  	result->window = window;
    5.21  	result->mode.mode = ShapeModeDefault;
    5.22  	result->mode.parameters.binarizationCutoff = 1;
    5.23  	result->usershownflag = 0;
    5.24  	window->shaper = result;
    5.25  	
    5.26 -	SDL_ShapeData* data = malloc(sizeof(SDL_ShapeData));
    5.27 -	result->driverdata = data;
    5.28 -	data->context = [data->nswindow graphicsContext];
    5.29 -	data->saved = SDL_False;
    5.30 -	data->rects = NULL;
    5.31 -	data->count = 0;
    5.32 +	SDL_ShapeData* shape_data = SDL_malloc(sizeof(SDL_ShapeData));
    5.33 +	result->driverdata = shape_data;
    5.34 +	shape_data->context = [data->nswindow graphicsContext];
    5.35 +	shape_data->saved = SDL_FALSE;
    5.36 +	shape_data->shape = NULL;
    5.37  	
    5.38  	int resized_properly = Cocoa_ResizeWindowShape(window);
    5.39  	assert(resized_properly == 0);
    5.40 @@ -49,17 +50,17 @@
    5.41  }
    5.42  
    5.43  int Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode) {
    5.44 -	SDL_WindowData* data = (SDL_WindowData*)shaper->window->driverdata;
    5.45 -	if(data->saved == SDL_True) {
    5.46 +	SDL_ShapeData* data = (SDL_ShapeData*)shaper->driverdata;
    5.47 +	if(data->saved == SDL_TRUE) {
    5.48  		[data->context restoreGraphicsState];
    5.49 -		data->saved = SDL_False;
    5.50 +		data->saved = SDL_FALSE;
    5.51  	}
    5.52  		
    5.53  	[data->context saveGraphicsState];
    5.54 -	data->saved = SDL_True;
    5.55 +	data->saved = SDL_TRUE;
    5.56  	
    5.57  	[[NSColor clearColor] set];
    5.58 -	NSRectFill([[data->nswindow contentView] frame]);
    5.59 +	NSRectFill([[((SDL_WindowData*)shaper->window->driverdata)->nswindow contentView] frame]);
    5.60  	/* TODO: It looks like Cocoa can set a clipping path based on a list of rectangles.  That's what we get from the
    5.61             Windoze shape-calculation code: a list of rectangles.  This will work... I think. */
    5.62  }
    5.63 @@ -67,5 +68,9 @@
    5.64  int Cocoa_ResizeWindowShape(SDL_Window *window) {
    5.65  	SDL_ShapeData* data = window->shaper->driverdata;
    5.66  	assert(data != NULL);
    5.67 +	
    5.68 +	if(data->shape != NULL)
    5.69 +		SDL_FreeShapeTree(&data->shape);
    5.70 +	
    5.71  	return 0;
    5.72  }
     6.1 --- a/src/video/cocoa/SDL_cocoavideo.m	Mon Aug 02 23:58:22 2010 -0400
     6.2 +++ b/src/video/cocoa/SDL_cocoavideo.m	Tue Aug 03 00:47:33 2010 -0400
     6.3 @@ -22,6 +22,7 @@
     6.4  #include "SDL_config.h"
     6.5  
     6.6  #include "SDL_cocoavideo.h"
     6.7 +#include "SDL_cocoashape.h"
     6.8  #include "SDL_assert.h"
     6.9  
    6.10  /* Initialization/Query functions */