Mercurial > sdl-ios-xcode
comparison src/video/directfb/SDL_DirectFB_window.c @ 5251:58265e606e4e
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.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 10 Feb 2011 14:44:25 -0800 |
parents | 164f20ba08eb |
children | b530ef003506 |
comparison
equal
deleted
inserted
replaced
5250:329d435f97f4 | 5251:58265e606e4e |
---|---|
60 /* FIXME ... ughh, ugly */ | 60 /* FIXME ... ughh, ugly */ |
61 if (window->x == -1000 && window->y == -1000) | 61 if (window->x == -1000 && window->y == -1000) |
62 bshaped = 1; | 62 bshaped = 1; |
63 | 63 |
64 /* Fill the window description. */ | 64 /* Fill the window description. */ |
65 if (window->x == SDL_WINDOWPOS_CENTERED) { | 65 if (SDL_WINDOWPOS_ISCENTERED(window->x)) { |
66 x = (dispdata->cw - window->w) / 2; | 66 x = (dispdata->cw - window->w) / 2; |
67 } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { | 67 } else if (SDL_WINDOWPOS_ISUNDEFINED(window->x)) { |
68 x = 0; | 68 x = 0; |
69 } else { | 69 } else { |
70 x = window->x; | 70 x = window->x; |
71 } | 71 } |
72 | 72 |
73 if (window->y == SDL_WINDOWPOS_CENTERED) { | 73 if (SDL_WINDOWPOS_ISCENTERED(window->y)) { |
74 y = (dispdata->ch - window->h) / 2; | 74 y = (dispdata->ch - window->h) / 2; |
75 } else if (window->y == SDL_WINDOWPOS_UNDEFINED) { | 75 } else if (SDL_WINDOWPOS_ISUNDEFINED(window->y)) { |
76 y = 0; | 76 y = 0; |
77 } else { | 77 } else { |
78 y = window->y; | 78 y = window->y; |
79 } | 79 } |
80 | 80 |
262 { | 262 { |
263 SDL_DFB_WINDOWDATA(window); | 263 SDL_DFB_WINDOWDATA(window); |
264 SDL_DFB_DISPLAYDATA(window); | 264 SDL_DFB_DISPLAYDATA(window); |
265 int x, y; | 265 int x, y; |
266 | 266 |
267 if (window->x == SDL_WINDOWPOS_CENTERED) { | 267 if (SDL_WINDOWPOS_ISCENTERED(window->x)) { |
268 x = (dispdata->cw - window->w) / 2; | 268 x = (dispdata->cw - window->w) / 2; |
269 } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { | 269 } else if (SDL_WINDOWPOS_ISUNDEFINED(window->x)) { |
270 x = 0; | 270 x = 0; |
271 } else { | 271 } else { |
272 x = window->x; | 272 x = window->x; |
273 } | 273 } |
274 | 274 |
275 if (window->y == SDL_WINDOWPOS_CENTERED) { | 275 if (SDL_WINDOWPOS_ISCENTERED(window->y)) { |
276 y = (dispdata->ch - window->h) / 2; | 276 y = (dispdata->ch - window->h) / 2; |
277 } else if (window->y == SDL_WINDOWPOS_UNDEFINED) { | 277 } else if (SDL_WINDOWPOS_ISUNDEFINED(window->y)) { |
278 y = 0; | 278 y = 0; |
279 } else { | 279 } else { |
280 y = window->y; | 280 y = window->y; |
281 } | 281 } |
282 | 282 |
356 | 356 |
357 void | 357 void |
358 DirectFB_MaximizeWindow(_THIS, SDL_Window * window) | 358 DirectFB_MaximizeWindow(_THIS, SDL_Window * window) |
359 { | 359 { |
360 SDL_DFB_WINDOWDATA(window); | 360 SDL_DFB_WINDOWDATA(window); |
361 SDL_VideoDisplay *display = window->display; | 361 SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); |
362 DFBWindowOptions wopts; | 362 DFBWindowOptions wopts; |
363 | 363 |
364 SDL_DFB_CHECK(windata->dfbwin->GetPosition(windata->dfbwin, | 364 SDL_DFB_CHECK(windata->dfbwin->GetPosition(windata->dfbwin, |
365 &windata->restore.x, &windata->restore.y)); | 365 &windata->restore.x, &windata->restore.y)); |
366 SDL_DFB_CHECK(windata->dfbwin->GetSize(windata->dfbwin, &windata->restore.w, | 366 SDL_DFB_CHECK(windata->dfbwin->GetSize(windata->dfbwin, &windata->restore.w, |
524 adjust = 1; | 524 adjust = 1; |
525 } | 525 } |
526 | 526 |
527 if (adjust) { | 527 if (adjust) { |
528 #if SDL_DIRECTFB_OPENGL | 528 #if SDL_DIRECTFB_OPENGL |
529 DirectFB_GL_FreeWindowContexts(window->display->device, window); | 529 DirectFB_GL_FreeWindowContexts(SDL_GetVideoDevice(), window); |
530 #endif | 530 #endif |
531 | 531 |
532 #if (DFB_VERSION_ATLEAST(1,2,1)) | 532 #if (DFB_VERSION_ATLEAST(1,2,1)) |
533 SDL_DFB_CHECKERR(windata->dfbwin->ResizeSurface(windata->dfbwin, | 533 SDL_DFB_CHECKERR(windata->dfbwin->ResizeSurface(windata->dfbwin, |
534 windata->size.w, | 534 windata->size.w, |
550 windata->size.h)); | 550 windata->size.h)); |
551 SDL_DFB_CHECKERR(windata->window_surface-> | 551 SDL_DFB_CHECKERR(windata->window_surface-> |
552 GetSubSurface(windata->window_surface, | 552 GetSubSurface(windata->window_surface, |
553 &windata->client, &windata->surface)); | 553 &windata->client, &windata->surface)); |
554 #endif | 554 #endif |
555 DirectFB_WM_RedrawLayout(window->display->device, window); | 555 DirectFB_WM_RedrawLayout(SDL_GetVideoDevice(), window); |
556 | 556 |
557 #if SDL_DIRECTFB_OPENGL | 557 #if SDL_DIRECTFB_OPENGL |
558 DirectFB_GL_ReAllocWindowContexts(window->display->device, window); | 558 DirectFB_GL_ReAllocWindowContexts(SDL_GetVideoDevice(), window); |
559 #endif | 559 #endif |
560 } | 560 } |
561 error: | 561 error: |
562 return; | 562 return; |
563 } | 563 } |