diff src/video/cocoa/SDL_cocoashape.m @ 4810:7a602fd2121f

OK, it appears that dramatic hacks are not necessary to make Cocoa work...
author Eli Gottlieb <eligottlieb@gmail.com>
date Mon, 26 Jul 2010 20:41:45 -0400
parents 329708ffe2a7
children d79939f20c45
line wrap: on
line diff
--- a/src/video/cocoa/SDL_cocoashape.m	Mon Jul 26 17:27:04 2010 -0400
+++ b/src/video/cocoa/SDL_cocoashape.m	Mon Jul 26 20:41:45 2010 -0400
@@ -21,5 +21,22 @@
 */
 
 #include "SDL_shape.h"
+#include "SDL_cocoashape.h"
 
-/* Functions implementing shaped windows for Cocoa will be implemented when the API is decided on. */
+SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window) {
+	SDL_WindowData* data = (SDL_WindowData*)window->driverdata;
+	[data->nswindow setAlpha:1.0];
+	[data->nswindow setOpaque:YES];
+	SDL_Shaper* result = result = malloc(sizeof(SDL_WindowShaper));
+	result->window = window;
+	result->mode.mode = ShapeModeDefault;
+	result->mode.parameters.binarizationCutoff = 1;
+	result->usershownflag = 0;
+	window->shaper = result;
+	int resized_properly = Cocoa_ResizeWindowShape(window);
+	assert(resized_properly == 0);
+	return result;
+}
+
+extern int Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode);
+extern int Cocoa_ResizeWindowShape(SDL_Window *window);