Commit 2cd92198 authored by Couriersud's avatar Couriersud

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

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403485
parent 3e968cec
...@@ -49,6 +49,19 @@ export SDL_DIRECTFB_YUV_UNDERLAY=1 ...@@ -49,6 +49,19 @@ export SDL_DIRECTFB_YUV_UNDERLAY=1
to make the YUV texture an underlay. This will make the cursor to to make the YUV texture an underlay. This will make the cursor to
be shown. be shown.
Simple Window Manager
=====================
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. In order to have the window title rendered,
you need to have the following font installed:
/usr/share/fonts/truetype/freefont/FreeSans.ttf
OPENGL Support OPENGL Support
============== ==============
......
This diff is collapsed.
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2009 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#ifndef _SDL_directfb_wm_h
#define _SDL_directfb_wm_h
typedef struct _DFB_Theme DFB_Theme;
struct _DFB_Theme
{
int left_size;
int right_size;
int top_size;
int bottom_size;
DFBColor frame_color;
int caption_size;
DFBColor caption_color;
int font_size;
DFBColor font_color;
char *font;
DFBColor close_color;
DFBColor max_color;
};
extern void DirectFB_WM_AdjustWindowLayout(SDL_Window * window);
extern void DirectFB_WM_MaximizeWindow(_THIS, SDL_Window * window);
extern void DirectFB_WM_RestoreWindow(_THIS, SDL_Window * window);
extern void DirectFB_WM_RedrawLayout(SDL_Window * window);
extern int DirectFB_WM_ProcessEvent(_THIS, SDL_Window *window, DFBWindowEvent * evt);
extern DFBResult DirectFB_WM_GetClientSize(_THIS, SDL_Window * window, int *cw, int *ch);
#endif /* _SDL_directfb_wm_h */
/* vi: set ts=4 sw=4 expandtab: */
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#include "SDL_DirectFB_dyn.h"
#include "SDL_DirectFB_video.h" #include "SDL_DirectFB_video.h"
#include "SDL_DirectFB_dyn.h"
#ifdef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC #ifdef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC
#include "SDL_name.h" #include "SDL_name.h"
...@@ -69,11 +69,11 @@ SDL_DirectFB_LoadLibrary(void) ...@@ -69,11 +69,11 @@ SDL_DirectFB_LoadLibrary(void)
} }
} }
if (retval) { if (retval) {
const char *stemp = DirectFBCheckVersion(DIRECTFB_MAJOR_VERSION,
DIRECTFB_MINOR_VERSION,
DIRECTFB_MICRO_VERSION);
/* Version Check */ /* Version Check */
if ((*SDL_DirectFB_Symbols.directfb_major_version != if (stemp != NULL) {
DIRECTFB_MAJOR_VERSION)
|| (*SDL_DirectFB_Symbols.directfb_minor_version !=
DIRECTFB_MINOR_VERSION)) {
fprintf(stderr, fprintf(stderr,
"DirectFB Lib: Version mismatch. Compiled: %d.%d.%d Library %d.%d.%d\n", "DirectFB Lib: Version mismatch. Compiled: %d.%d.%d Library %d.%d.%d\n",
DIRECTFB_MAJOR_VERSION, DIRECTFB_MINOR_VERSION, DIRECTFB_MAJOR_VERSION, DIRECTFB_MINOR_VERSION,
......
...@@ -30,8 +30,9 @@ ...@@ -30,8 +30,9 @@
DFB_SYM(const char *, DirectFBUsageString, ( void ), (), return) \ DFB_SYM(const char *, DirectFBUsageString, ( void ), (), return) \
DFB_SYM(DFBResult, DirectFBInit, (int *argc, char *(*argv[]) ), (argc, argv), return) \ DFB_SYM(DFBResult, DirectFBInit, (int *argc, char *(*argv[]) ), (argc, argv), return) \
DFB_SYM(DFBResult, DirectFBSetOption, (const char *name, const char *value), (name, value), return) \ DFB_SYM(DFBResult, DirectFBSetOption, (const char *name, const char *value), (name, value), return) \
DFB_SYM(DFBResult, DirectFBCreate, (IDirectFB **interface), (interface), return) DFB_SYM(DFBResult, DirectFBCreate, (IDirectFB **interface), (interface), return) \
DFB_SYM(const char *, DirectFBCheckVersion, (unsigned int required_major, unsigned int required_minor, unsigned int required_micro), \
(required_major, required_minor, required_micro), return)
// #define SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC "/usr/lib/libdirectfb-1.2.so.0" // #define SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC "/usr/lib/libdirectfb-1.2.so.0"
int SDL_DirectFB_LoadLibrary(void); int SDL_DirectFB_LoadLibrary(void);
......
This diff is collapsed.
...@@ -204,8 +204,8 @@ CheckSetDisplayMode(_THIS, DFB_DisplayData * data, SDL_DisplayMode * mode) ...@@ -204,8 +204,8 @@ CheckSetDisplayMode(_THIS, DFB_DisplayData * data, SDL_DisplayMode * mode)
DFBDisplayLayerConfigFlags failed; DFBDisplayLayerConfigFlags failed;
int ret; int ret;
SDL_DFB_CHECKERR(data->layer-> SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer,
SetCooperativeLevel(data->layer, DLSCL_ADMINISTRATIVE)); DLSCL_ADMINISTRATIVE));
config.width = mode->w; config.width = mode->w;
config.height = mode->h; config.height = mode->h;
config.pixelformat = SDLToDFBPixelFormat(mode->format); config.pixelformat = SDLToDFBPixelFormat(mode->format);
...@@ -216,13 +216,13 @@ CheckSetDisplayMode(_THIS, DFB_DisplayData * data, SDL_DisplayMode * mode) ...@@ -216,13 +216,13 @@ CheckSetDisplayMode(_THIS, DFB_DisplayData * data, SDL_DisplayMode * mode)
} }
failed = 0; failed = 0;
data->layer->TestConfiguration(data->layer, &config, &failed); data->layer->TestConfiguration(data->layer, &config, &failed);
SDL_DFB_CHECKERR(data->layer-> SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer,
SetCooperativeLevel(data->layer, DLSCL_SHARED)); DLSCL_SHARED));
if (failed == 0) if (failed == 0)
SDL_AddDisplayMode(_this->current_display, mode); SDL_AddDisplayMode(_this->current_display, mode);
else else
SDL_DFB_DEBUG("Mode %d x %d not available: %x\n", mode->w, mode->h, SDL_DFB_DEBUG("Mode %d x %d not available: %x\n", mode->w,
failed); mode->h, failed);
return; return;
error: error:
...@@ -235,13 +235,9 @@ DirectFB_InitModes(_THIS) ...@@ -235,13 +235,9 @@ DirectFB_InitModes(_THIS)
SDL_DFB_DEVICEDATA(_this); SDL_DFB_DEVICEDATA(_this);
IDirectFBDisplayLayer *layer = NULL; IDirectFBDisplayLayer *layer = NULL;
SDL_VideoDisplay display; SDL_VideoDisplay display;
DFB_DisplayData *dispdata; DFB_DisplayData *dispdata = NULL;
SDL_DisplayMode mode; SDL_DisplayMode mode;
#if (DIRECTFB_MAJOR_VERSION == 0) && (DIRECTFB_MINOR_VERSION == 9) && (DIRECTFB_MICRO_VERSION < 23)
DFBCardCapabilities caps;
#else
DFBGraphicsDeviceDescription caps; DFBGraphicsDeviceDescription caps;
#endif
DFBDisplayLayerConfig dlc; DFBDisplayLayerConfig dlc;
struct scn_callback_t *screencbdata; struct scn_callback_t *screencbdata;
...@@ -259,28 +255,20 @@ DirectFB_InitModes(_THIS) ...@@ -259,28 +255,20 @@ DirectFB_InitModes(_THIS)
screencbdata->vidlayer[i] = -1; screencbdata->vidlayer[i] = -1;
} }
SDL_DFB_CHECKERR(devdata->dfb-> SDL_DFB_CHECKERR(devdata->dfb->EnumScreens(devdata->dfb, &cbScreens,
EnumScreens(devdata->dfb, &cbScreens, screencbdata)); screencbdata));
for (i = 0; i < screencbdata->numscreens; i++) { for (i = 0; i < screencbdata->numscreens; i++) {
IDirectFBScreen *screen; IDirectFBScreen *screen;
SDL_DFB_CHECKERR(devdata->dfb-> SDL_DFB_CHECKERR(devdata->dfb->GetScreen(devdata->dfb,
GetScreen(devdata->dfb, screencbdata->screenid[i], screencbdata->screenid
&screen)); [i], &screen));
screencbdata->aux = i; screencbdata->aux = i;
SDL_DFB_CHECKERR(screen-> SDL_DFB_CHECKERR(screen->EnumDisplayLayers(screen, &cbLayers,
EnumDisplayLayers(screen, &cbLayers, screencbdata)); screencbdata));
#if (DIRECTFB_MAJOR_VERSION >= 1)
screen->GetSize(screen, &tcw[i], &tch[i]); 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); screen->Release(screen);
} }
...@@ -293,12 +281,12 @@ DirectFB_InitModes(_THIS) ...@@ -293,12 +281,12 @@ DirectFB_InitModes(_THIS)
SDL_DFB_DEBUG("Found %d screens\n", screencbdata->numscreens); SDL_DFB_DEBUG("Found %d screens\n", screencbdata->numscreens);
for (i = 0; i < screencbdata->numscreens; i++) { for (i = 0; i < screencbdata->numscreens; i++) {
SDL_DFB_CHECKERR(devdata->dfb-> SDL_DFB_CHECKERR(devdata->dfb->GetDisplayLayer(devdata->dfb,
GetDisplayLayer(devdata->dfb, screencbdata->gralayer
screencbdata->gralayer[i], &layer)); [i], &layer));
SDL_DFB_CHECKERR(layer-> SDL_DFB_CHECKERR(layer->SetCooperativeLevel(layer,
SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE)); DLSCL_ADMINISTRATIVE));
layer->EnableCursor(layer, 1); layer->EnableCursor(layer, 1);
SDL_DFB_CHECKERR(layer->SetCursorOpacity(layer, 0xC0)); SDL_DFB_CHECKERR(layer->SetCursorOpacity(layer, 0xC0));
...@@ -381,8 +369,8 @@ DirectFB_GetDisplayModes(_THIS) ...@@ -381,8 +369,8 @@ DirectFB_GetDisplayModes(_THIS)
data.nummodes = 0; data.nummodes = 0;
/* Enumerate the available fullscreen modes */ /* Enumerate the available fullscreen modes */
SDL_DFB_CALLOC(data.modelist, DFB_MAX_MODES, sizeof(SDL_DisplayMode)); SDL_DFB_CALLOC(data.modelist, DFB_MAX_MODES, sizeof(SDL_DisplayMode));
SDL_DFB_CHECKERR(devdata->dfb-> SDL_DFB_CHECKERR(devdata->dfb->EnumVideoModes(devdata->dfb,
EnumVideoModes(devdata->dfb, EnumModesCallback, &data)); EnumModesCallback, &data));
for (i = 0; i < data.nummodes; ++i) { for (i = 0; i < data.nummodes; ++i) {
mode = data.modelist[i]; mode = data.modelist[i];
...@@ -419,8 +407,8 @@ DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode) ...@@ -419,8 +407,8 @@ DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
DFBDisplayLayerConfigFlags fail = 0; DFBDisplayLayerConfigFlags fail = 0;
DFBResult ret; DFBResult ret;
SDL_DFB_CHECKERR(data->layer-> SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer,
SetCooperativeLevel(data->layer, DLSCL_ADMINISTRATIVE)); DLSCL_ADMINISTRATIVE));
SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &config)); SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &config));
config.flags = DLCONF_WIDTH | DLCONF_HEIGHT; config.flags = DLCONF_WIDTH | DLCONF_HEIGHT;
...@@ -440,8 +428,8 @@ DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode) ...@@ -440,8 +428,8 @@ DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
data->layer->TestConfiguration(data->layer, &config, &fail); data->layer->TestConfiguration(data->layer, &config, &fail);
if (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, SDL_DFB_ERR("Error setting mode %dx%d-%x\n", mode->w, mode->h,
mode->format); mode->format);
return -1; return -1;
...@@ -453,18 +441,16 @@ DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode) ...@@ -453,18 +441,16 @@ DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
#if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2)
/* Need to call this twice ! */ /* Need to call this twice ! */
SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config)); SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config));
//SDL_DFB_CHECKERR(data->layer->SetSourceRectangle(data->layer, 0, 0, config.width, config.height));
#endif #endif
/* Double check */ /* Double check */
SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &rconfig)); SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &rconfig));
SDL_DFB_CHECKERR(data->layer-> SDL_DFB_CHECKERR(data->
SetCooperativeLevel(data->layer, DLSCL_SHARED)); layer->SetCooperativeLevel(data->layer, DLSCL_SHARED));
if ((config.width != rconfig.width) || if ((config.width != rconfig.width) || (config.height != rconfig.height)
(config.height != rconfig.height) || || ((mode->format != SDL_PIXELFORMAT_UNKNOWN)
((mode->format != SDL_PIXELFORMAT_UNKNOWN) && (config.pixelformat != rconfig.pixelformat))) {
&& (config.pixelformat != rconfig.pixelformat))) {
SDL_DFB_ERR("Error setting mode %dx%d-%x\n", mode->w, mode->h, SDL_DFB_ERR("Error setting mode %dx%d-%x\n", mode->w, mode->h,
mode->format); mode->format);
return -1; return -1;
...@@ -483,7 +469,7 @@ DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode) ...@@ -483,7 +469,7 @@ DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
void void
DirectFB_QuitModes(_THIS) DirectFB_QuitModes(_THIS)
{ {
DFB_DeviceData *devdata = (DFB_DeviceData *) _this->driverdata; //DFB_DeviceData *devdata = (DFB_DeviceData *) _this->driverdata;
SDL_DisplayMode tmode; SDL_DisplayMode tmode;
DFBResult ret; DFBResult ret;
int i; int i;
...@@ -502,13 +488,14 @@ DirectFB_QuitModes(_THIS) ...@@ -502,13 +488,14 @@ DirectFB_QuitModes(_THIS)
(DFB_DisplayData *) _this->displays[i].driverdata; (DFB_DisplayData *) _this->displays[i].driverdata;
if (dispdata->layer) { if (dispdata->layer) {
SDL_DFB_CHECK(dispdata->layer-> SDL_DFB_CHECK(dispdata->
SetCooperativeLevel(dispdata->layer, layer->SetCooperativeLevel(dispdata->layer,
DLSCL_ADMINISTRATIVE)); DLSCL_ADMINISTRATIVE));
SDL_DFB_CHECK(dispdata->layer-> SDL_DFB_CHECK(dispdata->
SetCursorOpacity(dispdata->layer, 0x00)); layer->SetCursorOpacity(dispdata->layer, 0x00));
SDL_DFB_CHECK(dispdata->layer-> SDL_DFB_CHECK(dispdata->
SetCooperativeLevel(dispdata->layer, DLSCL_SHARED)); layer->SetCooperativeLevel(dispdata->layer,
DLSCL_SHARED));
} }
SDL_DFB_RELEASE(dispdata->layer); SDL_DFB_RELEASE(dispdata->layer);
......
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
#include "../SDL_sysvideo.h" #include "../SDL_sysvideo.h"
#include "../../events/SDL_mouse_c.h" #include "../../events/SDL_mouse_c.h"
static SDL_Cursor *DirectFB_CreateCursor(SDL_Surface * surface, int hot_x, static SDL_Cursor *DirectFB_CreateCursor(SDL_Surface * surface,
int hot_y); int hot_x, int hot_y);
static int DirectFB_ShowCursor(SDL_Cursor * cursor); static int DirectFB_ShowCursor(SDL_Cursor * cursor);
static void DirectFB_MoveCursor(SDL_Cursor * cursor); static void DirectFB_MoveCursor(SDL_Cursor * cursor);
static void DirectFB_FreeCursor(SDL_Cursor * cursor); static void DirectFB_FreeCursor(SDL_Cursor * cursor);
...@@ -38,8 +38,8 @@ static void DirectFB_FreeMouse(SDL_Mouse * mouse); ...@@ -38,8 +38,8 @@ static void DirectFB_FreeMouse(SDL_Mouse * mouse);
static int id_mask; static int id_mask;
static DFBEnumerationResult static DFBEnumerationResult
EnumMice(DFBInputDeviceID device_id, EnumMice(DFBInputDeviceID device_id, DFBInputDeviceDescription desc,
DFBInputDeviceDescription desc, void *callbackdata) void *callbackdata)
{ {
DFB_DeviceData *devdata = callbackdata; DFB_DeviceData *devdata = callbackdata;
...@@ -132,20 +132,20 @@ DirectFB_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) ...@@ -132,20 +132,20 @@ DirectFB_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
dsc.height = surface->h; dsc.height = surface->h;
dsc.pixelformat = DSPF_ARGB; dsc.pixelformat = DSPF_ARGB;
SDL_DFB_CHECKERR(devdata->dfb-> SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc,
CreateSurface(devdata->dfb, &dsc, &curdata->surf)); &curdata->surf));
curdata->hotx = hot_x; curdata->hotx = hot_x;
curdata->hoty = hot_y; curdata->hoty = hot_y;
cursor->driverdata = curdata; cursor->driverdata = curdata;
SDL_DFB_CHECKERR(curdata->surf-> SDL_DFB_CHECKERR(curdata->surf->Lock(curdata->surf, DSLF_WRITE,
Lock(curdata->surf, DSLF_WRITE, (void *) &dest, &pitch)); (void *) &dest, &pitch));
/* Relies on the fact that this is only called with ARGB surface. */ /* Relies on the fact that this is only called with ARGB surface. */
p = surface->pixels; p = surface->pixels;
for (i = 0; i < surface->h; i++) for (i = 0; i < surface->h; i++)
memcpy((char *) dest + i * pitch, (char *) p + i * surface->pitch, memcpy((char *) dest + i * pitch,
4 * surface->w); (char *) p + i * surface->pitch, 4 * surface->w);
curdata->surf->Unlock(curdata->surf); curdata->surf->Unlock(curdata->surf);
return cursor; return cursor;
...@@ -162,7 +162,7 @@ DirectFB_ShowCursor(SDL_Cursor * cursor) ...@@ -162,7 +162,7 @@ DirectFB_ShowCursor(SDL_Cursor * cursor)
SDL_WindowID wid; SDL_WindowID wid;
wid = SDL_GetFocusWindow(); wid = SDL_GetFocusWindow();
if (wid < 0) if (wid <= 0)
return -1; return -1;
else { else {
SDL_Window *window = SDL_GetWindowFromID(wid); SDL_Window *window = SDL_GetWindowFromID(wid);
...@@ -179,7 +179,6 @@ DirectFB_ShowCursor(SDL_Cursor * cursor) ...@@ -179,7 +179,6 @@ DirectFB_ShowCursor(SDL_Cursor * cursor)
curdata->surf, curdata->hotx, curdata->surf, curdata->hotx,
curdata->hoty)); curdata->hoty));
/* fprintf(stdout, "Cursor is %s\n", cursor ? "on" : "off"); */
SDL_DFB_CHECKERR(dispdata->layer-> SDL_DFB_CHECKERR(dispdata->layer->
SetCooperativeLevel(dispdata->layer, SetCooperativeLevel(dispdata->layer,
DLSCL_ADMINISTRATIVE)); DLSCL_ADMINISTRATIVE));
...@@ -227,8 +226,9 @@ DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_WindowID windowID, int x, int y) ...@@ -227,8 +226,9 @@ DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_WindowID windowID, int x, int y)
int cx, cy; int cx, cy;
SDL_DFB_CHECKERR(windata->window->GetPosition(windata->window, &cx, &cy)); SDL_DFB_CHECKERR(windata->window->GetPosition(windata->window, &cx, &cy));
SDL_DFB_CHECKERR(dispdata->layer-> SDL_DFB_CHECKERR(dispdata->layer->WarpCursor(dispdata->layer,
WarpCursor(dispdata->layer, cx + x, cy + y)); cx + x + windata->client.x,
cy + y + windata->client.y));
error: error:
return; return;
......
...@@ -173,8 +173,8 @@ DirectFB_GL_CreateContext(_THIS, SDL_Window * window) ...@@ -173,8 +173,8 @@ DirectFB_GL_CreateContext(_THIS, SDL_Window * window)
SDL_DFB_CALLOC(context, 1, sizeof(*context)); SDL_DFB_CALLOC(context, 1, sizeof(*context));
SDL_DFB_CHECKERR(windata->surface-> SDL_DFB_CHECKERR(windata->surface->GetGL(windata->surface,
GetGL(windata->surface, &context->context)); &context->context));
if (!context->context) if (!context->context)
return NULL; return NULL;
...@@ -208,16 +208,9 @@ DirectFB_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) ...@@ -208,16 +208,9 @@ DirectFB_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
p->context->Unlock(p->context); p->context->Unlock(p->context);
if (windata) { if (windata) {
int cw, ch;
windata->gl_context = NULL; windata->gl_context = NULL;
/* Everything is unlocked, check for a resize */ /* Everything is unlocked, check for a resize */
SDL_DFB_CHECKERR(windata->surface-> DirectFB_AdjustWindowSurface(window);
GetSize(windata->surface, &cw, &ch));
if (cw != window->w || ch != window->h)
SDL_DFB_CHECKERR(windata->window->
ResizeSurface(windata->window, window->w,
window->h));
} }
if (ctx != NULL) { if (ctx != NULL) {
...@@ -266,8 +259,8 @@ DirectFB_GL_SwapWindow(_THIS, SDL_Window * window) ...@@ -266,8 +259,8 @@ DirectFB_GL_SwapWindow(_THIS, SDL_Window * window)
if (1 || windata->gl_context) { if (1 || windata->gl_context) {
/* SDL_DFB_CHECKERR(windata->gl_context->context->Unlock(windata->gl_context->context)); */ /* SDL_DFB_CHECKERR(windata->gl_context->context->Unlock(windata->gl_context->context)); */
SDL_DFB_CHECKERR(windata->surface-> SDL_DFB_CHECKERR(windata->surface->Flip(windata->surface, &region,
Flip(windata->surface, &region, DSFLIP_ONSYNC)); DSFLIP_ONSYNC));
/* SDL_DFB_CHECKERR(windata->gl_context->context->Lock(windata->gl_context->context)); */ /* SDL_DFB_CHECKERR(windata->gl_context->context->Lock(windata->gl_context->context)); */
} }
......
This diff is collapsed.
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <directfb.h> #include <directfb.h>
#include <directfb_version.h> #include <directfb_version.h>
#include <directfb_strings.h>
#include "SDL_video.h" #include "SDL_video.h"
#include "SDL_mouse.h" #include "SDL_mouse.h"
...@@ -55,8 +56,10 @@ static void DirectFB_VideoQuit(_THIS); ...@@ -55,8 +56,10 @@ static void DirectFB_VideoQuit(_THIS);
static int DirectFB_Available(void); static int DirectFB_Available(void);
static SDL_VideoDevice *DirectFB_CreateDevice(int devindex); static SDL_VideoDevice *DirectFB_CreateDevice(int devindex);
#if 0
static int DirectFB_SetDisplayGammaRamp(_THIS, Uint16 * ramp); static int DirectFB_SetDisplayGammaRamp(_THIS, Uint16 * ramp);
static int DirectFB_GetDisplayGammaRamp(_THIS, Uint16 * ramp); static int DirectFB_GetDisplayGammaRamp(_THIS, Uint16 * ramp);
#endif
VideoBootStrap DirectFB_bootstrap = { VideoBootStrap DirectFB_bootstrap = {
"directfb", "DirectFB", "directfb", "DirectFB",
...@@ -111,6 +114,7 @@ DirectFB_CreateDevice(int devindex) ...@@ -111,6 +114,7 @@ DirectFB_CreateDevice(int devindex)
device->CreateWindow = DirectFB_CreateWindow; device->CreateWindow = DirectFB_CreateWindow;
device->CreateWindowFrom = DirectFB_CreateWindowFrom; device->CreateWindowFrom = DirectFB_CreateWindowFrom;
device->SetWindowTitle = DirectFB_SetWindowTitle; device->SetWindowTitle = DirectFB_SetWindowTitle;
device->SetWindowIcon = DirectFB_SetWindowIcon;
device->SetWindowPosition = DirectFB_SetWindowPosition; device->SetWindowPosition = DirectFB_SetWindowPosition;
device->SetWindowSize = DirectFB_SetWindowSize; device->SetWindowSize = DirectFB_SetWindowSize;
device->ShowWindow = DirectFB_ShowWindow; device->ShowWindow = DirectFB_ShowWindow;
...@@ -145,6 +149,50 @@ DirectFB_CreateDevice(int devindex) ...@@ -145,6 +149,50 @@ DirectFB_CreateDevice(int devindex)
return (0); return (0);
} }
static const DirectFBSurfaceDrawingFlagsNames(drawing_flags);
static const DirectFBSurfaceBlittingFlagsNames(blitting_flags);
static const DirectFBAccelerationMaskNames(acceleration_mask);
static void
DirectFB_DeviceInformation(IDirectFB * dfb)
{
DFBGraphicsDeviceDescription desc;
int n;
dfb->GetDeviceDescription(dfb, &desc);
fprintf(LOG_CHANNEL, "DirectFB Device Information\n");
fprintf(LOG_CHANNEL, "===========================\n");
fprintf(LOG_CHANNEL, "Name: %s\n", desc.name);
fprintf(LOG_CHANNEL, "Vendor: %s\n", desc.vendor);
fprintf(LOG_CHANNEL, "Driver Name: %s\n", desc.driver.name);
fprintf(LOG_CHANNEL, "Driver Vendor: %s\n", desc.driver.vendor);
fprintf(LOG_CHANNEL, "Driver Version: %d.%d\n", desc.driver.major,
desc.driver.minor);
fprintf(LOG_CHANNEL, "\nVideo memoory: %d\n", desc.video_memory);
fprintf(LOG_CHANNEL, "\nBlitting flags:\n");
for (n = 0; blitting_flags[n].flag; n++) {
if (desc.blitting_flags & blitting_flags[n].flag)
printf(" %s\n", blitting_flags[n].name);
}
fprintf(LOG_CHANNEL, "\nDrawing flags:\n");
for (n = 0; drawing_flags[n].flag; n++) {
if (desc.drawing_flags & drawing_flags[n].flag)
printf(" %s\n", drawing_flags[n].name);
}
fprintf(LOG_CHANNEL, "\nAcceleration flags:\n");
for (n = 0; acceleration_mask[n].mask; n++) {
if (desc.acceleration_mask & acceleration_mask[n].mask)
printf(" %s\n", acceleration_mask[n].name);
}
}
static int static int
DirectFB_VideoInit(_THIS) DirectFB_VideoInit(_THIS)
{ {
...@@ -159,21 +207,21 @@ DirectFB_VideoInit(_THIS) ...@@ -159,21 +207,21 @@ DirectFB_VideoInit(_THIS)
/* avoid switching to the framebuffer when we /* avoid switching to the framebuffer when we
* are running X11 */ * are running X11 */
stemp = getenv(DFBENV_USE_X11_CHECK); stemp = SDL_getenv(DFBENV_USE_X11_CHECK);
if (stemp) if (stemp)
ret = atoi(stemp); ret = atoi(stemp);
else else
ret = 1; ret = 1;
if (ret) { if (ret) {
if (getenv("DISPLAY")) if (SDL_getenv("DISPLAY"))
DirectFBSetOption("system", "x11"); DirectFBSetOption("system", "x11");
else else
DirectFBSetOption("disable-module", "x11input"); DirectFBSetOption("disable-module", "x11input");
} }
devdata->use_linux_input = 1; /* default: on */ devdata->use_linux_input = 1; /* default: on */
stemp = getenv(DFBENV_USE_LINUX_INPUT); stemp = SDL_getenv(DFBENV_USE_LINUX_INPUT);
if (stemp) if (stemp)
devdata->use_linux_input = atoi(stemp); devdata->use_linux_input = atoi(stemp);
...@@ -182,25 +230,34 @@ DirectFB_VideoInit(_THIS) ...@@ -182,25 +230,34 @@ DirectFB_VideoInit(_THIS)
SDL_DFB_CHECKERR(DirectFBCreate(&dfb)); SDL_DFB_CHECKERR(DirectFBCreate(&dfb));
DirectFB_DeviceInformation(dfb);
devdata->use_yuv_underlays = 0; /* default: off */ devdata->use_yuv_underlays = 0; /* default: off */
stemp = getenv(DFBENV_USE_YUV_UNDERLAY); stemp = SDL_getenv(DFBENV_USE_YUV_UNDERLAY);
if (stemp) if (stemp)
devdata->use_yuv_underlays = atoi(stemp); devdata->use_yuv_underlays = atoi(stemp);
/* Create global Eventbuffer for axis events */ /* Create global Eventbuffer for axis events */
if (devdata->use_linux_input) { if (devdata->use_linux_input) {
SDL_DFB_CHECKERR(dfb-> SDL_DFB_CHECKERR(dfb->CreateInputEventBuffer(dfb, DICAPS_ALL,
CreateInputEventBuffer(dfb, DICAPS_ALL, DFB_TRUE,
DFB_TRUE, &devdata->events)); &devdata->events));
} else { } else {
SDL_DFB_CHECKERR(dfb-> SDL_DFB_CHECKERR(dfb->CreateInputEventBuffer(dfb, DICAPS_AXES
CreateInputEventBuffer(dfb, /*DICAPS_ALL */ ,
DICAPS_AXES /*DICAPS_ALL */ , DFB_TRUE,
DFB_TRUE, &devdata->events)); &devdata->events));
} }
devdata->initialized = 1; devdata->initialized = 1;
/* simple window manager support */
stemp = SDL_getenv(DFBENV_USE_WM);
if (stemp)
devdata->has_own_wm = atoi(stemp);
else
devdata->has_own_wm = 0;
devdata->dfb = dfb; devdata->dfb = dfb;
devdata->firstwin = NULL; devdata->firstwin = NULL;
...@@ -216,7 +273,6 @@ DirectFB_VideoInit(_THIS) ...@@ -216,7 +273,6 @@ DirectFB_VideoInit(_THIS)
DirectFB_InitMouse(_this); DirectFB_InitMouse(_this);
DirectFB_InitKeyboard(_this); DirectFB_InitKeyboard(_this);
return 0; return 0;
...@@ -245,6 +301,7 @@ DirectFB_VideoQuit(_THIS) ...@@ -245,6 +301,7 @@ DirectFB_VideoQuit(_THIS)
devdata->initialized = 0; devdata->initialized = 0;
} }
#if 0
static int static int
DirectFB_SetDisplayGammaRamp(_THIS, Uint16 * ramp) DirectFB_SetDisplayGammaRamp(_THIS, Uint16 * ramp)
{ {
...@@ -256,3 +313,4 @@ DirectFB_GetDisplayGammaRamp(_THIS, Uint16 * ramp) ...@@ -256,3 +313,4 @@ DirectFB_GetDisplayGammaRamp(_THIS, Uint16 * ramp)
{ {
return -1; return -1;
} }
#endif
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
#define DEBUG 0 #define DEBUG 0
#define LOG_CHANNEL stdout #define LOG_CHANNEL stdout
#if (DIRECTFB_MAJOR_VERSION == 0) && (DIRECTFB_MINOR_VERSION == 9) && (DIRECTFB_MICRO_VERSION < 23) #if (DIRECTFB_MAJOR_VERSION < 1)
#error "SDL_DIRECTFB: Please compile against libdirectfb version >=0.9.24" #error "SDL_DIRECTFB: Please compile against libdirectfb version >= 1.0.0"
#endif #endif
#if (DIRECTFB_MAJOR_VERSION >= 1) && (DIRECTFB_MINOR_VERSION >= 0) && (DIRECTFB_MICRO_VERSION >= 0 ) #if (DIRECTFB_MAJOR_VERSION >= 1) && (DIRECTFB_MINOR_VERSION >= 0) && (DIRECTFB_MICRO_VERSION >= 0 )
...@@ -56,11 +56,13 @@ ...@@ -56,11 +56,13 @@
#include "SDL_DirectFB_mouse.h" #include "SDL_DirectFB_mouse.h"
#include "SDL_DirectFB_opengl.h" #include "SDL_DirectFB_opengl.h"
#include "SDL_DirectFB_window.h" #include "SDL_DirectFB_window.h"
#include "SDL_DirectFB_WM.h"
#define DFBENV_USE_YUV_UNDERLAY "SDL_DIRECTFB_YUV_UNDERLAY" /* Default: off */ #define DFBENV_USE_YUV_UNDERLAY "SDL_DIRECTFB_YUV_UNDERLAY" /* Default: off */
#define DFBENV_USE_YUV_DIRECT "SDL_DIRECTFB_YUV_DIRECT" /* Default: off */ #define DFBENV_USE_YUV_DIRECT "SDL_DIRECTFB_YUV_DIRECT" /* Default: off */
#define DFBENV_USE_X11_CHECK "SDL_DIRECTFB_X11_CHECK" /* Default: on */ #define DFBENV_USE_X11_CHECK "SDL_DIRECTFB_X11_CHECK" /* Default: on */
#define DFBENV_USE_LINUX_INPUT "SDL_DIRECTFB_LINUX_INPUT" /* Default: on */ #define DFBENV_USE_LINUX_INPUT "SDL_DIRECTFB_LINUX_INPUT" /* Default: on */
#define DFBENV_USE_WM "SDL_DIRECTFB_WM" /* Default: off */
#define SDL_DFB_RELEASE(x) do { if ( x ) { x->Release(x); x = NULL; } } while (0) #define SDL_DFB_RELEASE(x) do { if ( x ) { x->Release(x); x = NULL; } } while (0)
#define SDL_DFB_FREE(x) do { if ( x ) { SDL_free(x); x = NULL; } } while (0) #define SDL_DFB_FREE(x) do { if ( x ) { SDL_free(x); x = NULL; } } while (0)
...@@ -88,6 +90,8 @@ ...@@ -88,6 +90,8 @@
ret = x; \ ret = x; \
if (ret != DFB_OK) { \ if (ret != DFB_OK) { \
fprintf(LOG_CHANNEL, "%s <%d>:\n\t", __FILE__, __LINE__ ); \ fprintf(LOG_CHANNEL, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
fprintf(LOG_CHANNEL, "\t%s\n", #x ); \
fprintf(LOG_CHANNEL, "\t%s\n", DirectFBErrorString (ret) ); \
SDL_SetError( #x, DirectFBErrorString (ret) ); \ SDL_SetError( #x, DirectFBErrorString (ret) ); \
} \ } \
} while (0) } while (0)
...@@ -116,7 +120,7 @@ ...@@ -116,7 +120,7 @@
/* Private display data */ /* Private display data */
#define SDL_DFB_DEVICEDATA(dev) DFB_DeviceData *devdata = (DFB_DeviceData *) ((dev)->driverdata) #define SDL_DFB_DEVICEDATA(dev) DFB_DeviceData *devdata = (dev ? (DFB_DeviceData *) ((dev)->driverdata) : NULL)
#define DFB_MAX_SCREENS 10 #define DFB_MAX_SCREENS 10
...@@ -138,6 +142,7 @@ struct _DFB_DeviceData ...@@ -138,6 +142,7 @@ struct _DFB_DeviceData
int use_yuv_underlays; int use_yuv_underlays;
int use_linux_input; int use_linux_input;
int has_own_wm;
/* OpenGL */ /* OpenGL */
void (*glFinish) (void); void (*glFinish) (void);
......
This diff is collapsed.
...@@ -24,25 +24,38 @@ ...@@ -24,25 +24,38 @@
#ifndef _SDL_directfb_window_h #ifndef _SDL_directfb_window_h
#define _SDL_directfb_window_h #define _SDL_directfb_window_h
#include "SDL_DirectFB_WM.h"
#define SDL_DFB_WINDOWDATA(win) DFB_WindowData *windata = ((win) ? (DFB_WindowData *) ((win)->driverdata) : NULL) #define SDL_DFB_WINDOWDATA(win) DFB_WindowData *windata = ((win) ? (DFB_WindowData *) ((win)->driverdata) : NULL)
typedef struct _DFB_WindowData DFB_WindowData; typedef struct _DFB_WindowData DFB_WindowData;
struct _DFB_WindowData struct _DFB_WindowData
{ {
IDirectFBSurface *surface; IDirectFBSurface *surface;
IDirectFBSurface *window_surface; /* only used with has_own_wm */
IDirectFBWindow *window; IDirectFBWindow *window;
DirectFB_GLContext *gl_context; DirectFB_GLContext *gl_context;
IDirectFBEventBuffer *eventbuffer; IDirectFBEventBuffer *eventbuffer;
DFBWindowID windowID; SDL_WindowID sdl_id;
DFB_WindowData *next; DFB_WindowData *next;
Uint8 opacity; Uint8 opacity;
SDL_WindowID id; DFBRectangle client;
DFBDimension size;
/* WM extras */
DFBRectangle restore;
int is_managed;
int wm_needs_redraw;
IDirectFBSurface *icon;
DFB_Theme theme;
}; };
extern int DirectFB_CreateWindow(_THIS, SDL_Window * window); extern int DirectFB_CreateWindow(_THIS, SDL_Window * window);
extern int DirectFB_CreateWindowFrom(_THIS, SDL_Window * window, extern int DirectFB_CreateWindowFrom(_THIS, SDL_Window * window,
const void *data); const void *data);
extern void DirectFB_SetWindowTitle(_THIS, SDL_Window * window); extern void DirectFB_SetWindowTitle(_THIS, SDL_Window * window);
extern void DirectFB_SetWindowIcon(_THIS, SDL_Window * window,
SDL_Surface * icon);
extern void DirectFB_SetWindowPosition(_THIS, SDL_Window * window); extern void DirectFB_SetWindowPosition(_THIS, SDL_Window * window);
extern void DirectFB_SetWindowSize(_THIS, SDL_Window * window); extern void DirectFB_SetWindowSize(_THIS, SDL_Window * window);
extern void DirectFB_ShowWindow(_THIS, SDL_Window * window); extern void DirectFB_ShowWindow(_THIS, SDL_Window * window);
...@@ -56,6 +69,8 @@ extern void DirectFB_DestroyWindow(_THIS, SDL_Window * window); ...@@ -56,6 +69,8 @@ extern void DirectFB_DestroyWindow(_THIS, SDL_Window * window);
extern SDL_bool DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window, extern SDL_bool DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window,
struct SDL_SysWMinfo *info); struct SDL_SysWMinfo *info);
extern void DirectFB_AdjustWindowSurface(SDL_Window * window);
#endif /* _SDL_directfb_window_h */ #endif /* _SDL_directfb_window_h */
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment