Mercurial > sdl-ios-xcode
diff src/video/directfb/SDL_DirectFB_modes.c @ 3023:d72a0dd80e8b
DirectFB cleanups & simple window manager
- use SDL_getenv, not getenv ...
- no more support for 0.9.25 - not even mentioned any longer on directfb.org
- fix fullscreen issues
- add a simple window manager unless the directfb team comes up with a working wm.
The driver has support for a very, very basic window manager you may
want to use when runnning with "wm=default". Use
export SDL_DIRECTFB_WM=1
to enable basic window borders including icon support. In order to have the window title rendered,
you need to have the following font installed:
/usr/share/fonts/truetype/freefont/FreeSans.ttf
author | Couriersud <couriersud@arcor.de> |
---|---|
date | Sun, 11 Jan 2009 23:49:23 +0000 |
parents | 8cc00819c8d6 |
children | 490f3e4fe753 |
line wrap: on
line diff
--- a/src/video/directfb/SDL_DirectFB_modes.c Sun Jan 11 23:39:11 2009 +0000 +++ b/src/video/directfb/SDL_DirectFB_modes.c Sun Jan 11 23:49:23 2009 +0000 @@ -204,8 +204,8 @@ DFBDisplayLayerConfigFlags failed; int ret; - SDL_DFB_CHECKERR(data->layer-> - SetCooperativeLevel(data->layer, DLSCL_ADMINISTRATIVE)); + SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer, + DLSCL_ADMINISTRATIVE)); config.width = mode->w; config.height = mode->h; config.pixelformat = SDLToDFBPixelFormat(mode->format); @@ -216,13 +216,13 @@ } failed = 0; data->layer->TestConfiguration(data->layer, &config, &failed); - SDL_DFB_CHECKERR(data->layer-> - SetCooperativeLevel(data->layer, DLSCL_SHARED)); + SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer, + DLSCL_SHARED)); if (failed == 0) SDL_AddDisplayMode(_this->current_display, mode); else - SDL_DFB_DEBUG("Mode %d x %d not available: %x\n", mode->w, mode->h, - failed); + SDL_DFB_DEBUG("Mode %d x %d not available: %x\n", mode->w, + mode->h, failed); return; error: @@ -235,13 +235,9 @@ SDL_DFB_DEVICEDATA(_this); IDirectFBDisplayLayer *layer = NULL; SDL_VideoDisplay display; - DFB_DisplayData *dispdata; + DFB_DisplayData *dispdata = NULL; SDL_DisplayMode mode; -#if (DIRECTFB_MAJOR_VERSION == 0) && (DIRECTFB_MINOR_VERSION == 9) && (DIRECTFB_MICRO_VERSION < 23) - DFBCardCapabilities caps; -#else DFBGraphicsDeviceDescription caps; -#endif DFBDisplayLayerConfig dlc; struct scn_callback_t *screencbdata; @@ -259,28 +255,20 @@ screencbdata->vidlayer[i] = -1; } - SDL_DFB_CHECKERR(devdata->dfb-> - EnumScreens(devdata->dfb, &cbScreens, screencbdata)); + SDL_DFB_CHECKERR(devdata->dfb->EnumScreens(devdata->dfb, &cbScreens, + screencbdata)); for (i = 0; i < screencbdata->numscreens; i++) { IDirectFBScreen *screen; - SDL_DFB_CHECKERR(devdata->dfb-> - GetScreen(devdata->dfb, screencbdata->screenid[i], - &screen)); + SDL_DFB_CHECKERR(devdata->dfb->GetScreen(devdata->dfb, + screencbdata->screenid + [i], &screen)); screencbdata->aux = i; - SDL_DFB_CHECKERR(screen-> - EnumDisplayLayers(screen, &cbLayers, screencbdata)); -#if (DIRECTFB_MAJOR_VERSION >= 1) + SDL_DFB_CHECKERR(screen->EnumDisplayLayers(screen, &cbLayers, + screencbdata)); screen->GetSize(screen, &tcw[i], &tch[i]); -#else - /* FIXME: this is only used to center windows - * Should be done otherwise, e.g. get surface from layer - */ - tcw[i] = 800; - tch[i] = 600; -#endif screen->Release(screen); } @@ -293,12 +281,12 @@ SDL_DFB_DEBUG("Found %d screens\n", screencbdata->numscreens); for (i = 0; i < screencbdata->numscreens; i++) { - SDL_DFB_CHECKERR(devdata->dfb-> - GetDisplayLayer(devdata->dfb, - screencbdata->gralayer[i], &layer)); + SDL_DFB_CHECKERR(devdata->dfb->GetDisplayLayer(devdata->dfb, + screencbdata->gralayer + [i], &layer)); - SDL_DFB_CHECKERR(layer-> - SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE)); + SDL_DFB_CHECKERR(layer->SetCooperativeLevel(layer, + DLSCL_ADMINISTRATIVE)); layer->EnableCursor(layer, 1); SDL_DFB_CHECKERR(layer->SetCursorOpacity(layer, 0xC0)); @@ -381,8 +369,8 @@ data.nummodes = 0; /* Enumerate the available fullscreen modes */ SDL_DFB_CALLOC(data.modelist, DFB_MAX_MODES, sizeof(SDL_DisplayMode)); - SDL_DFB_CHECKERR(devdata->dfb-> - EnumVideoModes(devdata->dfb, EnumModesCallback, &data)); + SDL_DFB_CHECKERR(devdata->dfb->EnumVideoModes(devdata->dfb, + EnumModesCallback, &data)); for (i = 0; i < data.nummodes; ++i) { mode = data.modelist[i]; @@ -419,8 +407,8 @@ DFBDisplayLayerConfigFlags fail = 0; DFBResult ret; - SDL_DFB_CHECKERR(data->layer-> - SetCooperativeLevel(data->layer, DLSCL_ADMINISTRATIVE)); + SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer, + DLSCL_ADMINISTRATIVE)); SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &config)); config.flags = DLCONF_WIDTH | DLCONF_HEIGHT; @@ -440,8 +428,8 @@ data->layer->TestConfiguration(data->layer, &config, &fail); if (fail & - (DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT | DLCONF_OPTIONS)) - { + (DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT | + DLCONF_OPTIONS)) { SDL_DFB_ERR("Error setting mode %dx%d-%x\n", mode->w, mode->h, mode->format); return -1; @@ -453,18 +441,16 @@ #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) /* Need to call this twice ! */ SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config)); - //SDL_DFB_CHECKERR(data->layer->SetSourceRectangle(data->layer, 0, 0, config.width, config.height)); #endif /* Double check */ SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &rconfig)); - SDL_DFB_CHECKERR(data->layer-> - SetCooperativeLevel(data->layer, DLSCL_SHARED)); + SDL_DFB_CHECKERR(data-> + layer->SetCooperativeLevel(data->layer, DLSCL_SHARED)); - if ((config.width != rconfig.width) || - (config.height != rconfig.height) || - ((mode->format != SDL_PIXELFORMAT_UNKNOWN) - && (config.pixelformat != rconfig.pixelformat))) { + if ((config.width != rconfig.width) || (config.height != rconfig.height) + || ((mode->format != SDL_PIXELFORMAT_UNKNOWN) + && (config.pixelformat != rconfig.pixelformat))) { SDL_DFB_ERR("Error setting mode %dx%d-%x\n", mode->w, mode->h, mode->format); return -1; @@ -483,7 +469,7 @@ void DirectFB_QuitModes(_THIS) { - DFB_DeviceData *devdata = (DFB_DeviceData *) _this->driverdata; + //DFB_DeviceData *devdata = (DFB_DeviceData *) _this->driverdata; SDL_DisplayMode tmode; DFBResult ret; int i; @@ -502,13 +488,14 @@ (DFB_DisplayData *) _this->displays[i].driverdata; if (dispdata->layer) { - SDL_DFB_CHECK(dispdata->layer-> - SetCooperativeLevel(dispdata->layer, - DLSCL_ADMINISTRATIVE)); - SDL_DFB_CHECK(dispdata->layer-> - SetCursorOpacity(dispdata->layer, 0x00)); - SDL_DFB_CHECK(dispdata->layer-> - SetCooperativeLevel(dispdata->layer, DLSCL_SHARED)); + SDL_DFB_CHECK(dispdata-> + layer->SetCooperativeLevel(dispdata->layer, + DLSCL_ADMINISTRATIVE)); + SDL_DFB_CHECK(dispdata-> + layer->SetCursorOpacity(dispdata->layer, 0x00)); + SDL_DFB_CHECK(dispdata-> + layer->SetCooperativeLevel(dispdata->layer, + DLSCL_SHARED)); } SDL_DFB_RELEASE(dispdata->layer);