Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Rejiggering the way shaped windows are created as preparation for OS …
…X implementation. Fixed overdrive bug in test program that appears to have been introduced by someone other than myself.
  • Loading branch information
esennesh committed Jul 26, 2010
1 parent 9600256 commit 7936ff88e121d767ff9011474c1581548bbd49a2
@@ -28,8 +28,11 @@
#include "SDL_surface.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 *result = SDL_CreateWindow(title,x,y,w,h,SDL_WINDOW_BORDERLESS | flags & !SDL_WINDOW_FULLSCREEN & !SDL_WINDOW_SHOWN);
SDL_VideoDisplay* display = SDL_ThisDisplay();
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) {
result->shaper = result->display->device->shape_driver.CreateShaper(result);
if(result->shaper != NULL) {
@@ -156,6 +156,7 @@ struct SDL_WindowShaper
/* Define the SDL shape driver structure */
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);
int (*SetWindowShape)(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode);
int (*ResizeWindowShape)(SDL_Window *window);
@@ -105,6 +105,10 @@ static VideoBootStrap *bootstrap[] = {

static SDL_VideoDevice *_this = NULL;

SDL_VideoDisplay* SDL_ThisDisplay() {
return SDL_CurrentDisplay;
}

#define CHECK_WINDOW_MAGIC(window, retval) \
if (!_this) { \
SDL_UninitializedVideo(); \
File renamed without changes.
@@ -23,6 +23,10 @@
#include <windows.h>
#include "SDL_win32shape.h"

SDL_Window* Win32_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) {
return SDL_CreateWindow(title,x,y,w,h,flags);
}

SDL_WindowShaper* Win32_CreateShaper(SDL_Window * window) {
SDL_WindowShaper* result = malloc(sizeof(SDL_WindowShaper));
result->window = window;
@@ -34,6 +34,7 @@ typedef struct {
Uint32 buffersize;
} SDL_ShapeData;

extern SDL_Window* Win32_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags);
extern SDL_WindowShaper* Win32_CreateShaper(SDL_Window * window);
extern int Win32_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode);
extern int Win32_ResizeWindowShape(SDL_Window *window);
@@ -185,6 +185,7 @@ WIN_CreateDevice(int devindex)
device->DestroyWindow = WIN_DestroyWindow;
device->GetWindowWMInfo = WIN_GetWindowWMInfo;

device->shape_driver.CreateShapedWindow = Win32_CreateShapedWindow;
device->shape_driver.CreateShaper = Win32_CreateShaper;
device->shape_driver.SetWindowShape = Win32_SetWindowShape;
device->shape_driver.ResizeWindowShape = Win32_ResizeWindowShape;
@@ -25,6 +25,10 @@
#include "SDL_x11shape.h"
#include "SDL_x11window.h"

SDL_Window* X11_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) {
return SDL_CreateWindow(title,x,y,w,h,flags);
}

SDL_WindowShaper* X11_CreateShaper(SDL_Window* window) {
SDL_WindowShaper* result = NULL;

@@ -33,6 +33,7 @@ typedef struct {
Uint32 bitmapsize;
} SDL_ShapeData;

extern SDL_Window* X11_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags);
extern SDL_WindowShaper* X11_CreateShaper(SDL_Window* window);
extern int X11_ResizeWindowShape(SDL_Window* window);
extern int X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode);
@@ -203,6 +203,7 @@ X11_CreateDevice(int devindex)
device->SetWindowGrab = X11_SetWindowGrab;
device->DestroyWindow = X11_DestroyWindow;
device->GetWindowWMInfo = X11_GetWindowWMInfo;
device->shape_driver.CreateShapedWindow = X11_CreateShapedWindow;
device->shape_driver.CreateShaper = X11_CreateShaper;
device->shape_driver.SetWindowShape = X11_SetWindowShape;
device->shape_driver.ResizeWindowShape = X11_ResizeWindowShape;
@@ -12,7 +12,7 @@
#define SHAPED_WINDOW_Y 150
#define SHAPED_WINDOW_DIMENSION 640

#define TICK_INTERVAL 18
#define TICK_INTERVAL 1000/60

typedef struct LoadedPicture {
SDL_Surface *surface;

0 comments on commit 7936ff8

Please sign in to comment.