Window coordinates are in the global space and windows are not tied to a particular display.

Also added Ctrl-Enter keybinding to the test code to toggle fullscreen mode for testing.
This commit is contained in:
Sam Lantinga 2011-02-10 14:44:25 -08:00
parent 2c021d9b34
commit 018af55e16
21 changed files with 300 additions and 190 deletions

View file

@ -135,7 +135,7 @@ DirectFB_SetContext(_THIS, SDL_Window *window)
* This has simply no effect.
*/
SDL_VideoDisplay *display = window->display;
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
/* FIXME: should we handle the error */

View file

@ -170,7 +170,7 @@ DirectFB_ShowCursor(SDL_Cursor * cursor)
if (!window)
return -1;
else {
SDL_VideoDisplay *display = window->display;
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
if (display) {
DFB_DisplayData *dispdata =
@ -222,7 +222,7 @@ DirectFB_FreeCursor(SDL_Cursor * cursor)
static void
DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_Window * window, int x, int y)
{
SDL_VideoDisplay *display = window->display;
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
DFB_WindowData *windata = (DFB_WindowData *) window->driverdata;
DFBResult ret;

View file

@ -301,7 +301,7 @@ SDL_Renderer *
DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags)
{
SDL_DFB_WINDOWDATA(window);
SDL_VideoDisplay *display = window->display;
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
SDL_Renderer *renderer = NULL;
DirectFB_RenderData *data = NULL;
DFBSurfaceCapabilities scaps;
@ -409,7 +409,7 @@ DirectFB_AcquireVidLayer(SDL_Renderer * renderer, SDL_Texture * texture)
{
//SDL_DFB_RENDERERDATA(renderer);
SDL_Window *window = renderer->window;
SDL_VideoDisplay *display = window->display;
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
SDL_DFB_DEVICEDATA(display->device);
DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
DirectFB_TextureData *data = texture->driverdata;
@ -465,7 +465,7 @@ static int
DirectFB_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{
SDL_Window *window = renderer->window;
SDL_VideoDisplay *display = window->display;
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
SDL_DFB_DEVICEDATA(display->device);
DirectFB_TextureData *data;
DFBSurfaceDescription dsc;
@ -1129,7 +1129,7 @@ static void
DirectFB_DestroyRenderer(SDL_Renderer * renderer)
{
DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
SDL_VideoDisplay *display = renderer->window->display;
SDL_VideoDisplay *display = renderer->SDL_GetDisplayForWindow(window);
#if 0
if (display->palette) {

View file

@ -62,17 +62,17 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window)
bshaped = 1;
/* Fill the window description. */
if (window->x == SDL_WINDOWPOS_CENTERED) {
if (SDL_WINDOWPOS_ISCENTERED(window->x)) {
x = (dispdata->cw - window->w) / 2;
} else if (window->x == SDL_WINDOWPOS_UNDEFINED) {
} else if (SDL_WINDOWPOS_ISUNDEFINED(window->x)) {
x = 0;
} else {
x = window->x;
}
if (window->y == SDL_WINDOWPOS_CENTERED) {
if (SDL_WINDOWPOS_ISCENTERED(window->y)) {
y = (dispdata->ch - window->h) / 2;
} else if (window->y == SDL_WINDOWPOS_UNDEFINED) {
} else if (SDL_WINDOWPOS_ISUNDEFINED(window->y)) {
y = 0;
} else {
y = window->y;
@ -264,17 +264,17 @@ DirectFB_SetWindowPosition(_THIS, SDL_Window * window)
SDL_DFB_DISPLAYDATA(window);
int x, y;
if (window->x == SDL_WINDOWPOS_CENTERED) {
if (SDL_WINDOWPOS_ISCENTERED(window->x)) {
x = (dispdata->cw - window->w) / 2;
} else if (window->x == SDL_WINDOWPOS_UNDEFINED) {
} else if (SDL_WINDOWPOS_ISUNDEFINED(window->x)) {
x = 0;
} else {
x = window->x;
}
if (window->y == SDL_WINDOWPOS_CENTERED) {
if (SDL_WINDOWPOS_ISCENTERED(window->y)) {
y = (dispdata->ch - window->h) / 2;
} else if (window->y == SDL_WINDOWPOS_UNDEFINED) {
} else if (SDL_WINDOWPOS_ISUNDEFINED(window->y)) {
y = 0;
} else {
y = window->y;
@ -358,7 +358,7 @@ void
DirectFB_MaximizeWindow(_THIS, SDL_Window * window)
{
SDL_DFB_WINDOWDATA(window);
SDL_VideoDisplay *display = window->display;
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
DFBWindowOptions wopts;
SDL_DFB_CHECK(windata->dfbwin->GetPosition(windata->dfbwin,
@ -526,7 +526,7 @@ DirectFB_AdjustWindowSurface(SDL_Window * window)
if (adjust) {
#if SDL_DIRECTFB_OPENGL
DirectFB_GL_FreeWindowContexts(window->display->device, window);
DirectFB_GL_FreeWindowContexts(SDL_GetVideoDevice(), window);
#endif
#if (DFB_VERSION_ATLEAST(1,2,1))
@ -552,10 +552,10 @@ DirectFB_AdjustWindowSurface(SDL_Window * window)
GetSubSurface(windata->window_surface,
&windata->client, &windata->surface));
#endif
DirectFB_WM_RedrawLayout(window->display->device, window);
DirectFB_WM_RedrawLayout(SDL_GetVideoDevice(), window);
#if SDL_DIRECTFB_OPENGL
DirectFB_GL_ReAllocWindowContexts(window->display->device, window);
DirectFB_GL_ReAllocWindowContexts(SDL_GetVideoDevice(), window);
#endif
}
error: