Commit 8f1459d9 authored by egottlieb's avatar egottlieb

Got basic, pre-actually-writing-anything Cocoa to build.

parent 34bbabf0
...@@ -450,6 +450,13 @@ ...@@ -450,6 +450,13 @@
04F2AF671104AC0800D6DDF7 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F2AF651104AC0800D6DDF7 /* SDL_assert.c */; }; 04F2AF671104AC0800D6DDF7 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F2AF651104AC0800D6DDF7 /* SDL_assert.c */; };
04F2AF691104AC4500D6DDF7 /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F2AF681104AC4500D6DDF7 /* SDL_assert.h */; }; 04F2AF691104AC4500D6DDF7 /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F2AF681104AC4500D6DDF7 /* SDL_assert.h */; };
04F2AF6A1104AC4500D6DDF7 /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F2AF681104AC4500D6DDF7 /* SDL_assert.h */; }; 04F2AF6A1104AC4500D6DDF7 /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F2AF681104AC4500D6DDF7 /* SDL_assert.h */; };
4537737D1207C4CE002F0F45 /* SDL_shape_internals.h in Headers */ = {isa = PBXBuildFile; fileRef = 4537737B1207C4CE002F0F45 /* SDL_shape_internals.h */; };
4537737E1207C4CE002F0F45 /* SDL_shape.c in Sources */ = {isa = PBXBuildFile; fileRef = 4537737C1207C4CE002F0F45 /* SDL_shape.c */; };
453773821207C518002F0F45 /* SDL_shape.h in Headers */ = {isa = PBXBuildFile; fileRef = 453773811207C518002F0F45 /* SDL_shape.h */; };
453773891207C5A2002F0F45 /* SDL_cocoashape.h in Headers */ = {isa = PBXBuildFile; fileRef = 453773871207C5A2002F0F45 /* SDL_cocoashape.h */; };
4537738A1207C5A2002F0F45 /* SDL_cocoashape.m in Sources */ = {isa = PBXBuildFile; fileRef = 453773881207C5A2002F0F45 /* SDL_cocoashape.m */; };
453773921207C6E9002F0F45 /* SDL_x11shape.c in Sources */ = {isa = PBXBuildFile; fileRef = 453773901207C6E9002F0F45 /* SDL_x11shape.c */; };
453773931207C6E9002F0F45 /* SDL_x11shape.h in Headers */ = {isa = PBXBuildFile; fileRef = 453773911207C6E9002F0F45 /* SDL_x11shape.h */; };
BECDF62E0761BA81005FE872 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 01538330006D78D67F000001 /* SDL_audio.c */; }; BECDF62E0761BA81005FE872 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 01538330006D78D67F000001 /* SDL_audio.c */; };
BECDF62F0761BA81005FE872 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 01538331006D78D67F000001 /* SDL_audiocvt.c */; }; BECDF62F0761BA81005FE872 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 01538331006D78D67F000001 /* SDL_audiocvt.c */; };
BECDF6300761BA81005FE872 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 01538332006D78D67F000001 /* SDL_audiodev.c */; }; BECDF6300761BA81005FE872 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 01538332006D78D67F000001 /* SDL_audiodev.c */; };
...@@ -825,6 +832,13 @@ ...@@ -825,6 +832,13 @@
0C5AF5FD01191D2B7F000001 /* SDL_version.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_version.h; path = ../../include/SDL_version.h; sourceTree = SOURCE_ROOT; }; 0C5AF5FD01191D2B7F000001 /* SDL_version.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_version.h; path = ../../include/SDL_version.h; sourceTree = SOURCE_ROOT; };
0C5AF5FE01191D2B7F000001 /* SDL_video.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_video.h; path = ../../include/SDL_video.h; sourceTree = SOURCE_ROOT; }; 0C5AF5FE01191D2B7F000001 /* SDL_video.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_video.h; path = ../../include/SDL_video.h; sourceTree = SOURCE_ROOT; };
0C5AF5FF01191D2B7F000001 /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL.h; path = ../../include/SDL.h; sourceTree = SOURCE_ROOT; }; 0C5AF5FF01191D2B7F000001 /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL.h; path = ../../include/SDL.h; sourceTree = SOURCE_ROOT; };
4537737B1207C4CE002F0F45 /* SDL_shape_internals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shape_internals.h; sourceTree = "<group>"; };
4537737C1207C4CE002F0F45 /* SDL_shape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_shape.c; sourceTree = "<group>"; };
453773811207C518002F0F45 /* SDL_shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_shape.h; path = ../../include/SDL_shape.h; sourceTree = SOURCE_ROOT; };
453773871207C5A2002F0F45 /* SDL_cocoashape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoashape.h; sourceTree = "<group>"; };
453773881207C5A2002F0F45 /* SDL_cocoashape.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoashape.m; sourceTree = "<group>"; };
453773901207C6E9002F0F45 /* SDL_x11shape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11shape.c; sourceTree = "<group>"; };
453773911207C6E9002F0F45 /* SDL_x11shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11shape.h; sourceTree = "<group>"; };
B24DA50405A88D52006B9F1C /* SDL_cpuinfo.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SDL_cpuinfo.c; sourceTree = "<group>"; }; B24DA50405A88D52006B9F1C /* SDL_cpuinfo.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SDL_cpuinfo.c; sourceTree = "<group>"; };
B29A290D04E5B28700A80002 /* SDL_loadso.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_loadso.h; path = ../../include/SDL_loadso.h; sourceTree = "<group>"; }; B29A290D04E5B28700A80002 /* SDL_loadso.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_loadso.h; path = ../../include/SDL_loadso.h; sourceTree = "<group>"; };
B2CF8DC405C444E400E5DC7F /* SDL_cpuinfo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_cpuinfo.h; path = ../../include/SDL_cpuinfo.h; sourceTree = SOURCE_ROOT; }; B2CF8DC405C444E400E5DC7F /* SDL_cpuinfo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_cpuinfo.h; path = ../../include/SDL_cpuinfo.h; sourceTree = SOURCE_ROOT; };
...@@ -1043,6 +1057,8 @@ ...@@ -1043,6 +1057,8 @@
00CFA70B106B498A00758660 /* SDL_cocoamouse.m */, 00CFA70B106B498A00758660 /* SDL_cocoamouse.m */,
00CFA70C106B498A00758660 /* SDL_cocoaopengl.h */, 00CFA70C106B498A00758660 /* SDL_cocoaopengl.h */,
00CFA70D106B498A00758660 /* SDL_cocoaopengl.m */, 00CFA70D106B498A00758660 /* SDL_cocoaopengl.m */,
453773871207C5A2002F0F45 /* SDL_cocoashape.h */,
453773881207C5A2002F0F45 /* SDL_cocoashape.m */,
00CFA70E106B498A00758660 /* SDL_cocoavideo.h */, 00CFA70E106B498A00758660 /* SDL_cocoavideo.h */,
00CFA70F106B498A00758660 /* SDL_cocoavideo.m */, 00CFA70F106B498A00758660 /* SDL_cocoavideo.m */,
00CFA710106B498A00758660 /* SDL_cocoawindow.h */, 00CFA710106B498A00758660 /* SDL_cocoawindow.h */,
...@@ -1087,6 +1103,8 @@ ...@@ -1087,6 +1103,8 @@
00CFA72B106B498B00758660 /* SDL_x11opengles.h */, 00CFA72B106B498B00758660 /* SDL_x11opengles.h */,
00CFA72C106B498B00758660 /* SDL_x11render.c */, 00CFA72C106B498B00758660 /* SDL_x11render.c */,
00CFA72D106B498B00758660 /* SDL_x11render.h */, 00CFA72D106B498B00758660 /* SDL_x11render.h */,
453773901207C6E9002F0F45 /* SDL_x11shape.c */,
453773911207C6E9002F0F45 /* SDL_x11shape.h */,
00CFA72E106B498B00758660 /* SDL_x11sym.h */, 00CFA72E106B498B00758660 /* SDL_x11sym.h */,
00CFA72F106B498B00758660 /* SDL_x11video.c */, 00CFA72F106B498B00758660 /* SDL_x11video.c */,
00CFA730106B498B00758660 /* SDL_x11video.h */, 00CFA730106B498B00758660 /* SDL_x11video.h */,
...@@ -1401,6 +1419,8 @@ ...@@ -1401,6 +1419,8 @@
00CFA80E106B49B600758660 /* SDL_renderer_sw.h */, 00CFA80E106B49B600758660 /* SDL_renderer_sw.h */,
00CFA80F106B49B600758660 /* SDL_RLEaccel_c.h */, 00CFA80F106B49B600758660 /* SDL_RLEaccel_c.h */,
00CFA810106B49B600758660 /* SDL_RLEaccel.c */, 00CFA810106B49B600758660 /* SDL_RLEaccel.c */,
4537737C1207C4CE002F0F45 /* SDL_shape.c */,
4537737B1207C4CE002F0F45 /* SDL_shape_internals.h */,
00CFA811106B49B600758660 /* SDL_stretch.c */, 00CFA811106B49B600758660 /* SDL_stretch.c */,
00CFA812106B49B600758660 /* SDL_surface.c */, 00CFA812106B49B600758660 /* SDL_surface.c */,
00CFA813106B49B600758660 /* SDL_sysvideo.h */, 00CFA813106B49B600758660 /* SDL_sysvideo.h */,
...@@ -1452,6 +1472,7 @@ ...@@ -1452,6 +1472,7 @@
00A6EBD91078D569001EEA06 /* SDL_revision.h */, 00A6EBD91078D569001EEA06 /* SDL_revision.h */,
0C5AF5F801191D2B7F000001 /* SDL_rwops.h */, 0C5AF5F801191D2B7F000001 /* SDL_rwops.h */,
00CFA680106B44CE00758660 /* SDL_scancode.h */, 00CFA680106B44CE00758660 /* SDL_scancode.h */,
453773811207C518002F0F45 /* SDL_shape.h */,
00162D3909BD1FA90037C8D0 /* SDL_stdinc.h */, 00162D3909BD1FA90037C8D0 /* SDL_stdinc.h */,
00CFA681106B44CE00758660 /* SDL_surface.h */, 00CFA681106B44CE00758660 /* SDL_surface.h */,
0C5AF5F901191D2B7F000001 /* SDL_syswm.h */, 0C5AF5F901191D2B7F000001 /* SDL_syswm.h */,
...@@ -1743,6 +1764,10 @@ ...@@ -1743,6 +1764,10 @@
00A6EBDA1078D569001EEA06 /* SDL_revision.h in Headers */, 00A6EBDA1078D569001EEA06 /* SDL_revision.h in Headers */,
04F2AF691104AC4500D6DDF7 /* SDL_assert.h in Headers */, 04F2AF691104AC4500D6DDF7 /* SDL_assert.h in Headers */,
006E95B011952992001DE610 /* SDL_rwopsbundlesupport.h in Headers */, 006E95B011952992001DE610 /* SDL_rwopsbundlesupport.h in Headers */,
4537737D1207C4CE002F0F45 /* SDL_shape_internals.h in Headers */,
453773821207C518002F0F45 /* SDL_shape.h in Headers */,
453773891207C5A2002F0F45 /* SDL_cocoashape.h in Headers */,
453773931207C6E9002F0F45 /* SDL_x11shape.h in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -2202,6 +2227,9 @@ ...@@ -2202,6 +2227,9 @@
04DB838D10FD8C81000519B5 /* SDL_drawrect.c in Sources */, 04DB838D10FD8C81000519B5 /* SDL_drawrect.c in Sources */,
04F2AF661104AC0800D6DDF7 /* SDL_assert.c in Sources */, 04F2AF661104AC0800D6DDF7 /* SDL_assert.c in Sources */,
006E95B111952992001DE610 /* SDL_rwopsbundlesupport.m in Sources */, 006E95B111952992001DE610 /* SDL_rwopsbundlesupport.m in Sources */,
4537737E1207C4CE002F0F45 /* SDL_shape.c in Sources */,
4537738A1207C5A2002F0F45 /* SDL_cocoashape.m in Sources */,
453773921207C6E9002F0F45 /* SDL_x11shape.c in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
......
#define SDL_REVISION "hg-4516:eb433f0d2ac5" #define SDL_REVISION "hg-4526:d532a5a114cd"
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "SDL_pixels.h" #include "SDL_pixels.h"
#include "SDL_surface.h" #include "SDL_surface.h"
#include "SDL_shape.h" #include "SDL_shape.h"
#include "../src/video/SDL_shape_internals.h" #include "SDL_shape_internals.h"
SDL_Window* SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) { SDL_Window* SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) {
SDL_Window *result = SDL_CreateWindow(title,x,y,w,h,SDL_WINDOW_BORDERLESS | flags & !SDL_WINDOW_FULLSCREEN & !SDL_WINDOW_SHOWN); SDL_Window *result = SDL_CreateWindow(title,x,y,w,h,SDL_WINDOW_BORDERLESS | flags & !SDL_WINDOW_FULLSCREEN & !SDL_WINDOW_SHOWN);
......
...@@ -20,14 +20,26 @@ ...@@ -20,14 +20,26 @@
eligottlieb@gmail.com eligottlieb@gmail.com
*/ */
#include "SDL_config.h"
#ifndef _SDL_cocoashape_h
#define _SDL_cocoashape_h
#include "SDL_stdinc.h"
#include "SDL_video.h"
#include "SDL_shape.h"
#include "SDL_shape_internals.h"
#include "../SDL_sysvideo.h"
typedef struct { typedef struct {
NSGraphicsContext* context; NSGraphicsContext* context;
SDL_Bool saved; SDL_bool saved;
NSRect* rects; SDL_ShapeTree* shape;
Uint32 count;
} SDL_ShapeData; } SDL_ShapeData;
extern SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window); extern SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window);
extern int Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode); extern int Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode);
extern int Cocoa_ResizeWindowShape(SDL_Window *window); extern int Cocoa_ResizeWindowShape(SDL_Window *window);
#endif
...@@ -20,28 +20,29 @@ ...@@ -20,28 +20,29 @@
eligottlieb@gmail.com eligottlieb@gmail.com
*/ */
#include "SDL_stdinc.h"
#include "SDL_cocoavideo.h" #include "SDL_cocoavideo.h"
#include "SDL_shape.h" #include "SDL_shape.h"
#include "SDL_cocoashape.h" #include "SDL_cocoashape.h"
#include "SDL_sysvideo.h"
SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window) { SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window) {
SDL_WindowData* data = (SDL_WindowData*)window->driverdata; SDL_WindowData* data = (SDL_WindowData*)window->driverdata;
[data->nswindow setAlpha:1.0]; [data->nswindow setAlpha:1.0];
[data->nswindow setOpaque:YES]; [data->nswindow setOpaque:YES];
[data->nswindow setStyleMask:NSBorderlessWindowMask]; [data->nswindow setStyleMask:NSBorderlessWindowMask];
SDL_Shaper* result = result = malloc(sizeof(SDL_WindowShaper)); SDL_WindowShaper* result = SDL_malloc(sizeof(SDL_WindowShaper));
result->window = window; result->window = window;
result->mode.mode = ShapeModeDefault; result->mode.mode = ShapeModeDefault;
result->mode.parameters.binarizationCutoff = 1; result->mode.parameters.binarizationCutoff = 1;
result->usershownflag = 0; result->usershownflag = 0;
window->shaper = result; window->shaper = result;
SDL_ShapeData* data = malloc(sizeof(SDL_ShapeData)); SDL_ShapeData* shape_data = SDL_malloc(sizeof(SDL_ShapeData));
result->driverdata = data; result->driverdata = shape_data;
data->context = [data->nswindow graphicsContext]; shape_data->context = [data->nswindow graphicsContext];
data->saved = SDL_False; shape_data->saved = SDL_FALSE;
data->rects = NULL; shape_data->shape = NULL;
data->count = 0;
int resized_properly = Cocoa_ResizeWindowShape(window); int resized_properly = Cocoa_ResizeWindowShape(window);
assert(resized_properly == 0); assert(resized_properly == 0);
...@@ -49,17 +50,17 @@ SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window) { ...@@ -49,17 +50,17 @@ SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window) {
} }
int Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode) { int Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode) {
SDL_WindowData* data = (SDL_WindowData*)shaper->window->driverdata; SDL_ShapeData* data = (SDL_ShapeData*)shaper->driverdata;
if(data->saved == SDL_True) { if(data->saved == SDL_TRUE) {
[data->context restoreGraphicsState]; [data->context restoreGraphicsState];
data->saved = SDL_False; data->saved = SDL_FALSE;
} }
[data->context saveGraphicsState]; [data->context saveGraphicsState];
data->saved = SDL_True; data->saved = SDL_TRUE;
[[NSColor clearColor] set]; [[NSColor clearColor] set];
NSRectFill([[data->nswindow contentView] frame]); NSRectFill([[((SDL_WindowData*)shaper->window->driverdata)->nswindow contentView] frame]);
/* TODO: It looks like Cocoa can set a clipping path based on a list of rectangles. That's what we get from the /* TODO: It looks like Cocoa can set a clipping path based on a list of rectangles. That's what we get from the
Windoze shape-calculation code: a list of rectangles. This will work... I think. */ Windoze shape-calculation code: a list of rectangles. This will work... I think. */
} }
...@@ -67,5 +68,9 @@ int Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowS ...@@ -67,5 +68,9 @@ int Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowS
int Cocoa_ResizeWindowShape(SDL_Window *window) { int Cocoa_ResizeWindowShape(SDL_Window *window) {
SDL_ShapeData* data = window->shaper->driverdata; SDL_ShapeData* data = window->shaper->driverdata;
assert(data != NULL); assert(data != NULL);
if(data->shape != NULL)
SDL_FreeShapeTree(&data->shape);
return 0; return 0;
} }
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "SDL_config.h" #include "SDL_config.h"
#include "SDL_cocoavideo.h" #include "SDL_cocoavideo.h"
#include "SDL_cocoashape.h"
#include "SDL_assert.h" #include "SDL_assert.h"
/* Initialization/Query functions */ /* Initialization/Query functions */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment