Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Window coordinates are in the global space and windows are not tied t…
…o a particular display.

Also added Ctrl-Enter keybinding to the test code to toggle fullscreen mode for testing.
  • Loading branch information
slouken committed Feb 10, 2011
1 parent dc18a39 commit 49bd9eb
Show file tree
Hide file tree
Showing 21 changed files with 301 additions and 191 deletions.
22 changes: 19 additions & 3 deletions include/SDL_video.h
Expand Up @@ -113,12 +113,20 @@ typedef enum
/**
* \brief Used to indicate that you don't care what the window position is.
*/
#define SDL_WINDOWPOS_UNDEFINED 0x7FFFFFF
#define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000
#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK|(X))
#define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
#define SDL_WINDOWPOS_ISUNDEFINED(X) \
(((X)&0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)

/**
* \brief Used to indicate that the window position should be centered.
*/
#define SDL_WINDOWPOS_CENTERED 0x7FFFFFE
#define SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000
#define SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK|(X))
#define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0)
#define SDL_WINDOWPOS_ISCENTERED(X) \
(((X)&0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)

/**
* \brief Event subtype for window events
Expand Down Expand Up @@ -303,6 +311,14 @@ extern DECLSPEC int SDLCALL SDL_GetCurrentDisplayMode(int displayIndex, SDL_Disp
*/
extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode * mode, SDL_DisplayMode * closest);

/**
* \brief Get the display index associated with a window.
*
* \return the display index of the display containing the center of the
* window, or -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_GetWindowDisplay(SDL_Window * window);

/**
* \brief Set the display mode used when a fullscreen window is visible.
*
Expand Down Expand Up @@ -531,7 +547,7 @@ extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window * window);
* \sa SDL_GetWindowDisplayMode()
*/
extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window,
int fullscreen);
SDL_bool fullscreen);

/**
* \brief Get an SDL surface associated with the window.
Expand Down
4 changes: 2 additions & 2 deletions src/video/SDL_shape.c
Expand Up @@ -35,7 +35,7 @@ SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned
SDL_Window *result = NULL;
result = SDL_CreateWindow(title,-1000,-1000,w,h,(flags | SDL_WINDOW_BORDERLESS) & (~SDL_WINDOW_FULLSCREEN) & (~SDL_WINDOW_RESIZABLE) /*& (~SDL_WINDOW_SHOWN)*/);
if(result != NULL) {
result->shaper = result->display->device->shape_driver.CreateShaper(result);
result->shaper = SDL_GetVideoDevice()->shape_driver.CreateShaper(result);
if(result->shaper != NULL) {
result->shaper->userx = x;
result->shaper->usery = y;
Expand Down Expand Up @@ -240,7 +240,7 @@ SDL_SetWindowShape(SDL_Window *window,SDL_Surface *shape,SDL_WindowShapeMode *sh

if(shape_mode != NULL)
window->shaper->mode = *shape_mode;
result = window->display->device->shape_driver.SetWindowShape(window->shaper,shape,shape_mode);
result = SDL_GetVideoDevice()->shape_driver.SetWindowShape(window->shaper,shape,shape_mode);
window->shaper->hasshape = SDL_TRUE;
if(window->shaper->userx != 0 && window->shaper->usery != 0) {
SDL_SetWindowPosition(window,window->shaper->userx,window->shaper->usery);
Expand Down
9 changes: 3 additions & 6 deletions src/video/SDL_sysvideo.h
Expand Up @@ -76,8 +76,6 @@ struct SDL_Window
int w, h;
Uint32 flags;

SDL_VideoDisplay *display;

SDL_DisplayMode fullscreen_mode;

SDL_Surface *surface;
Expand Down Expand Up @@ -110,7 +108,6 @@ struct SDL_VideoDisplay
SDL_DisplayMode current_mode;
SDL_bool updating_fullscreen;

SDL_Window *windows;
SDL_Window *fullscreen_window;

SDL_VideoDevice *device;
Expand Down Expand Up @@ -153,8 +150,7 @@ struct SDL_VideoDevice
int (*GetDisplayBounds) (_THIS, SDL_VideoDisplay * display, SDL_Rect * rect);

/*
* Get a list of the available display modes. e.g.
* SDL_AddDisplayMode(_this->current_display, mode)
* Get a list of the available display modes for a display.
*/
void (*GetDisplayModes) (_THIS, SDL_VideoDisplay * display);

Expand Down Expand Up @@ -236,7 +232,7 @@ struct SDL_VideoDevice
SDL_bool suspend_screensaver;
int num_displays;
SDL_VideoDisplay *displays;
int current_display;
SDL_Window *windows;
Uint8 window_magic;
Uint32 next_object_id;
char * clipboard_text;
Expand Down Expand Up @@ -326,6 +322,7 @@ extern SDL_VideoDevice *SDL_GetVideoDevice(void);
extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode);
extern int SDL_AddVideoDisplay(const SDL_VideoDisplay * display);
extern SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode * mode);
extern SDL_VideoDisplay *SDL_GetDisplayForWindow(SDL_Window *window);

extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);

Expand Down

0 comments on commit 49bd9eb

Please sign in to comment.