Commit 01cddf42 authored by Eli Gottlieb's avatar Eli Gottlieb

OK, it appears that dramatic hacks are not necessary to make Cocoa work...

parent 155833dd
Eli Gottlieb's checklist for the GSOC shaped windows project. Dated July 9, 2010. Eli Gottlieb's checklist for the GSOC shaped windows project. Dated July 9, 2010.
1. Enable proper linking of the X11 implementation and test it. 1. Enable proper linking of the X11 implementation and test it.
--> Find the place in the build system for platform-specific linking flags. STATUS: BLOODY IMPOSSIBLE. --> Find the place in the build system for platform-specific linking flags. STATUS: DONE
--> Add a linker flag to bring in libXext.a. STATUS: WILL BE SIMPLE ONCE PREVIOUS STEP IS ACCOMPLISHED (kshemashiach yagia). --> Add a linker flag to bring in libXext.a. STATUS: DONE.
2. Build the Win32 implementation of shaped-windows functionality. 2. Build the Win32 implementation of shaped-windows functionality.
--> Add driver functions to the SDL_ShapeDriver in the Win32 driver's SDL_DisplayDevice at the proper point in the code. STATUS: CHECK. --> Add driver functions to the SDL_ShapeDriver in the Win32 driver's SDL_DisplayDevice at the proper point in the code. STATUS: CHECK.
--> Add a hook in the Windows resize-window code to call Win32_ResizeWindowShape(). STATUS: CHECK. --> Add a hook in the Windows resize-window code to call Win32_ResizeWindowShape(). STATUS: CHECK.
--> Get the Windows code to build and run properly. STATUS: IN PROGRESS.
3. Enable building the testeyes program. 3. Enable building the testeyes program.
--> Reprogram it to use the latest shaped-windows API. STATUS: CHECK. --> Reprogram it to use the latest shaped-windows API. STATUS: CHECK.
--> Get it, along with the rest of the test suite in my branch, building successfully. STATUS: REQUIRES X11 IMPLEMENTATION TO LINK PROPERLY AND/OR A BUILD-BUDDY BUILDING AND RUNNING THE TEST FOR ME. --> Get it, along with the rest of the test suite in my branch, building successfully. STATUS: DONE.
--> Debug testeyes and the platform-specific shaped-window implementations in tandem. STATUS: TO BEGIN, CURRENT SPRINT. --> Debug testeyes and the platform-specific shaped-window implementations in tandem. STATUS: IN PROGRESS.
4. Implement the SDL shaped-windows API for Mac OS X using Cocoa. STATUS: NEXT SPRINT. 4. Implement the SDL shaped-windows API for Mac OS X using Cocoa. STATUS: IN PROGRESS
--> Locate (once more) the API documentation for shaped windows under Cocoa. --> Locate (once more) the API documentation for shaped windows under Cocoa. STATUS: NEARLY FINISHED.
--> Design and encode a version of SDL_ShapeData for Cocoa. --> Design and encode a version of SDL_ShapeData for Cocoa. STATUS: IN PROGRESS.
--> Write Cocoa_CreateShaper(). --> Write Cocoa_CreateShaper(). STATUS: IN PROGRESS.
--> Write Cocoa_ResizeWindowShape(). --> Write Cocoa_ResizeWindowShape(). STATUS: IN PROGRESS.
--> Write Cocoa_SetWindowShape(). --> Write Cocoa_SetWindowShape(). STATUS: IN PROGRESS.
--> If necessary, implement functionality adjunct to SDL_CalculateShapeBitmap() for Cocoa usage. --> If necessary, implement functionality adjunct to SDL_CalculateShapeBitmap() for Cocoa usage.
5. Use testeyes to debug all implementations. STATUS: SPRINT + 2. 5. Use testeyes to debug all implementations. STATUS: SPRINT + 2.
--> Debug Cocoa implementation. --> Debug Cocoa implementation.
......
...@@ -28,11 +28,8 @@ ...@@ -28,11 +28,8 @@
#include "SDL_surface.h" #include "SDL_surface.h"
#include "SDL_shape.h" #include "SDL_shape.h"
extern SDL_VideoDisplay* SDL_ThisDisplay();
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_VideoDisplay* display = SDL_ThisDisplay(); SDL_Window *result = SDL_CreateWindow(title,x,y,w,h,SDL_WINDOW_BORDERLESS | flags & !SDL_WINDOW_FULLSCREEN & !SDL_WINDOW_SHOWN);
SDL_Window *result = display->device->shape_driver.CreateShapedWindow(title,x,y,w,h,SDL_WINDOW_BORDERLESS | flags & !SDL_WINDOW_FULLSCREEN & !SDL_WINDOW_SHOWN);
if(result != NULL) { if(result != NULL) {
result->shaper = result->display->device->shape_driver.CreateShaper(result); result->shaper = result->display->device->shape_driver.CreateShaper(result);
if(result->shaper != NULL) { if(result->shaper != NULL) {
......
...@@ -156,7 +156,6 @@ struct SDL_WindowShaper ...@@ -156,7 +156,6 @@ struct SDL_WindowShaper
/* Define the SDL shape driver structure */ /* Define the SDL shape driver structure */
struct SDL_ShapeDriver struct SDL_ShapeDriver
{ {
SDL_Window *(*CreateShapedWindow)(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags);
SDL_WindowShaper *(*CreateShaper)(SDL_Window * window); SDL_WindowShaper *(*CreateShaper)(SDL_Window * window);
int (*SetWindowShape)(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode); int (*SetWindowShape)(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode);
int (*ResizeWindowShape)(SDL_Window *window); int (*ResizeWindowShape)(SDL_Window *window);
......
...@@ -105,10 +105,6 @@ static VideoBootStrap *bootstrap[] = { ...@@ -105,10 +105,6 @@ static VideoBootStrap *bootstrap[] = {
static SDL_VideoDevice *_this = NULL; static SDL_VideoDevice *_this = NULL;
SDL_VideoDisplay* SDL_ThisDisplay() {
return SDL_CurrentDisplay;
}
#define CHECK_WINDOW_MAGIC(window, retval) \ #define CHECK_WINDOW_MAGIC(window, retval) \
if (!_this) { \ if (!_this) { \
SDL_UninitializedVideo(); \ SDL_UninitializedVideo(); \
......
...@@ -21,5 +21,22 @@ ...@@ -21,5 +21,22 @@
*/ */
#include "SDL_shape.h" #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);
...@@ -92,6 +92,11 @@ Cocoa_CreateDevice(int devindex) ...@@ -92,6 +92,11 @@ Cocoa_CreateDevice(int devindex)
device->SetWindowGrab = Cocoa_SetWindowGrab; device->SetWindowGrab = Cocoa_SetWindowGrab;
device->DestroyWindow = Cocoa_DestroyWindow; device->DestroyWindow = Cocoa_DestroyWindow;
device->GetWindowWMInfo = Cocoa_GetWindowWMInfo; device->GetWindowWMInfo = Cocoa_GetWindowWMInfo;
device->shape_driver.CreateShaper = Cocoa_CreateShaper;
device->shape_driver.SetWindowShape = Cocoa_SetWindowShape;
device->shape_driver.ResizeWindowShape = Cocoa_ResizeWindowShape;
#ifdef SDL_VIDEO_OPENGL_CGL #ifdef SDL_VIDEO_OPENGL_CGL
device->GL_LoadLibrary = Cocoa_GL_LoadLibrary; device->GL_LoadLibrary = Cocoa_GL_LoadLibrary;
device->GL_GetProcAddress = Cocoa_GL_GetProcAddress; device->GL_GetProcAddress = Cocoa_GL_GetProcAddress;
......
...@@ -185,7 +185,6 @@ WIN_CreateDevice(int devindex) ...@@ -185,7 +185,6 @@ WIN_CreateDevice(int devindex)
device->DestroyWindow = WIN_DestroyWindow; device->DestroyWindow = WIN_DestroyWindow;
device->GetWindowWMInfo = WIN_GetWindowWMInfo; device->GetWindowWMInfo = WIN_GetWindowWMInfo;
device->shape_driver.CreateShapedWindow = Win32_CreateShapedWindow;
device->shape_driver.CreateShaper = Win32_CreateShaper; device->shape_driver.CreateShaper = Win32_CreateShaper;
device->shape_driver.SetWindowShape = Win32_SetWindowShape; device->shape_driver.SetWindowShape = Win32_SetWindowShape;
device->shape_driver.ResizeWindowShape = Win32_ResizeWindowShape; device->shape_driver.ResizeWindowShape = Win32_ResizeWindowShape;
......
...@@ -203,7 +203,6 @@ X11_CreateDevice(int devindex) ...@@ -203,7 +203,6 @@ X11_CreateDevice(int devindex)
device->SetWindowGrab = X11_SetWindowGrab; device->SetWindowGrab = X11_SetWindowGrab;
device->DestroyWindow = X11_DestroyWindow; device->DestroyWindow = X11_DestroyWindow;
device->GetWindowWMInfo = X11_GetWindowWMInfo; device->GetWindowWMInfo = X11_GetWindowWMInfo;
device->shape_driver.CreateShapedWindow = X11_CreateShapedWindow;
device->shape_driver.CreateShaper = X11_CreateShaper; device->shape_driver.CreateShaper = X11_CreateShaper;
device->shape_driver.SetWindowShape = X11_SetWindowShape; device->shape_driver.SetWindowShape = X11_SetWindowShape;
device->shape_driver.ResizeWindowShape = X11_ResizeWindowShape; device->shape_driver.ResizeWindowShape = X11_ResizeWindowShape;
......
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