DirectFB driver update
authorSam Lantinga
Mon, 14 Mar 2011 23:13:33 -0700
changeset 5488c20436fd5627
parent 5487 ad3abbbe0381
child 5489 e0c63a55b67d
DirectFB driver update

Couriersud to Sam

the attached patch brings the DirectFB driver back in line with recent
SDL 1.3 developments.
src/video/directfb/SDL_DirectFB_modes.c
src/video/directfb/SDL_DirectFB_modes.h
src/video/directfb/SDL_DirectFB_mouse.c
src/video/directfb/SDL_DirectFB_opengl.c
src/video/directfb/SDL_DirectFB_render.c
src/video/directfb/SDL_DirectFB_shape.c
src/video/directfb/SDL_DirectFB_shape.h
src/video/directfb/SDL_DirectFB_video.c
src/video/directfb/SDL_DirectFB_video.h
src/video/directfb/SDL_DirectFB_window.c
src/video/directfb/SDL_DirectFB_window.h
     1.1 --- a/src/video/directfb/SDL_DirectFB_modes.c	Mon Mar 14 23:04:52 2011 -0700
     1.2 +++ b/src/video/directfb/SDL_DirectFB_modes.c	Mon Mar 14 23:13:33 2011 -0700
     1.3 @@ -386,11 +386,11 @@
     1.4          SDL_VideoDisplay *display = &_this->displays[i];
     1.5          DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
     1.6  
     1.7 -        SDL_GetDesktopDisplayModeForDisplay(display, &tmode);
     1.8 +        SDL_GetDesktopDisplayMode(i, &tmode);
     1.9          tmode.format = SDL_PIXELFORMAT_UNKNOWN;
    1.10          DirectFB_SetDisplayMode(_this, display, &tmode);
    1.11  
    1.12 -        SDL_GetDesktopDisplayModeForDisplay(display, &tmode);
    1.13 +        SDL_GetDesktopDisplayMode(i, &tmode);
    1.14          DirectFB_SetDisplayMode(_this, display, &tmode);
    1.15  
    1.16          if (dispdata->layer) {
     2.1 --- a/src/video/directfb/SDL_DirectFB_modes.h	Mon Mar 14 23:04:52 2011 -0700
     2.2 +++ b/src/video/directfb/SDL_DirectFB_modes.h	Mon Mar 14 23:13:33 2011 -0700
     2.3 @@ -30,7 +30,7 @@
     2.4  
     2.5  #include "../SDL_sysvideo.h"
     2.6  
     2.7 -#define SDL_DFB_DISPLAYDATA(win)  DFB_DisplayData *dispdata = ((win) ? (DFB_DisplayData *) (win)->display->driverdata : NULL)
     2.8 +#define SDL_DFB_DISPLAYDATA(win)  DFB_DisplayData *dispdata = ((win) ? (DFB_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata : NULL)
     2.9  
    2.10  typedef struct _DFB_DisplayData DFB_DisplayData;
    2.11  struct _DFB_DisplayData
     3.1 --- a/src/video/directfb/SDL_DirectFB_mouse.c	Mon Mar 14 23:04:52 2011 -0700
     3.2 +++ b/src/video/directfb/SDL_DirectFB_mouse.c	Mon Mar 14 23:13:33 2011 -0700
     3.3 @@ -24,21 +24,239 @@
     3.4  */
     3.5  
     3.6  #include "SDL_config.h"
     3.7 +#include "SDL_assert.h"
     3.8  
     3.9  #include "SDL_DirectFB_video.h"
    3.10 +#include "SDL_DirectFB_mouse.h"
    3.11 +#include "SDL_DirectFB_modes.h"
    3.12 +#include "SDL_DirectFB_window.h"
    3.13  
    3.14  #include "../SDL_sysvideo.h"
    3.15  #include "../../events/SDL_mouse_c.h"
    3.16  
    3.17 -#if USE_MULTI_API
    3.18 +static SDL_Cursor *DirectFB_CreateDefaultCursor(void);
    3.19  static SDL_Cursor *DirectFB_CreateCursor(SDL_Surface * surface,
    3.20                                           int hot_x, int hot_y);
    3.21  static int DirectFB_ShowCursor(SDL_Cursor * cursor);
    3.22  static void DirectFB_MoveCursor(SDL_Cursor * cursor);
    3.23  static void DirectFB_FreeCursor(SDL_Cursor * cursor);
    3.24 +static void DirectFB_WarpMouse(SDL_Window * window, int x, int y);
    3.25 +static void DirectFB_FreeMouse(SDL_Mouse * mouse);
    3.26 +
    3.27 +static const char *arrow[] = {
    3.28 +    /* pixels */
    3.29 +    "X                               ",
    3.30 +    "XX                              ",
    3.31 +    "X.X                             ",
    3.32 +    "X..X                            ",
    3.33 +    "X...X                           ",
    3.34 +    "X....X                          ",
    3.35 +    "X.....X                         ",
    3.36 +    "X......X                        ",
    3.37 +    "X.......X                       ",
    3.38 +    "X........X                      ",
    3.39 +    "X.....XXXXX                     ",
    3.40 +    "X..X..X                         ",
    3.41 +    "X.X X..X                        ",
    3.42 +    "XX  X..X                        ",
    3.43 +    "X    X..X                       ",
    3.44 +    "     X..X                       ",
    3.45 +    "      X..X                      ",
    3.46 +    "      X..X                      ",
    3.47 +    "       XX                       ",
    3.48 +    "                                ",
    3.49 +    "                                ",
    3.50 +    "                                ",
    3.51 +    "                                ",
    3.52 +    "                                ",
    3.53 +    "                                ",
    3.54 +    "                                ",
    3.55 +    "                                ",
    3.56 +    "                                ",
    3.57 +    "                                ",
    3.58 +    "                                ",
    3.59 +    "                                ",
    3.60 +    "                                ",
    3.61 +};
    3.62 +
    3.63 +static SDL_Cursor *
    3.64 +DirectFB_CreateDefaultCursor(void)
    3.65 +{
    3.66 +    SDL_VideoDevice *dev = SDL_GetVideoDevice();
    3.67 +
    3.68 +    SDL_DFB_DEVICEDATA(dev);
    3.69 +    DFB_CursorData *curdata;
    3.70 +    DFBResult ret;
    3.71 +    DFBSurfaceDescription dsc;
    3.72 +    SDL_Cursor *cursor;
    3.73 +    Uint32 *dest;
    3.74 +    Uint32 *p;
    3.75 +    int pitch, i, j;
    3.76 +
    3.77 +    SDL_DFB_ALLOC_CLEAR( cursor, sizeof(*cursor));
    3.78 +    SDL_DFB_ALLOC_CLEAR(curdata, sizeof(*curdata));
    3.79 +
    3.80 +    dsc.flags =
    3.81 +        DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
    3.82 +    dsc.caps = DSCAPS_VIDEOONLY;
    3.83 +    dsc.width = 32;
    3.84 +    dsc.height = 32;
    3.85 +    dsc.pixelformat = DSPF_ARGB;
    3.86 +
    3.87 +    SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc,
    3.88 +                                                 &curdata->surf));
    3.89 +    curdata->hotx = 0;
    3.90 +    curdata->hoty = 0;
    3.91 +    cursor->driverdata = curdata;
    3.92 +
    3.93 +    SDL_DFB_CHECKERR(curdata->surf->Lock(curdata->surf, DSLF_WRITE,
    3.94 +                                         (void *) &dest, &pitch));
    3.95 +
    3.96 +    /* Relies on the fact that this is only called with ARGB surface. */
    3.97 +    for (i = 0; i < 32; i++)
    3.98 +    {
    3.99 +        for (j = 0; j < 32; j++)
   3.100 +        {
   3.101 +        	switch (arrow[i][j])
   3.102 +        	{
   3.103 +        	case ' ': dest[j] = 0x00000000; break;
   3.104 +        	case '.': dest[j] = 0xffffffff; break;
   3.105 +        	case 'X': dest[j] = 0xff000000; break;
   3.106 +        	}
   3.107 +        }
   3.108 +        dest += (pitch >> 2);
   3.109 +    }
   3.110 +
   3.111 +    curdata->surf->Unlock(curdata->surf);
   3.112 +    return cursor;
   3.113 +  error:
   3.114 +    return NULL;
   3.115 +}
   3.116 +
   3.117 +/* Create a cursor from a surface */
   3.118 +static SDL_Cursor *
   3.119 +DirectFB_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
   3.120 +{
   3.121 +    SDL_VideoDevice *dev = SDL_GetVideoDevice();
   3.122 +
   3.123 +    SDL_DFB_DEVICEDATA(dev);
   3.124 +    DFB_CursorData *curdata;
   3.125 +    DFBResult ret;
   3.126 +    DFBSurfaceDescription dsc;
   3.127 +    SDL_Cursor *cursor;
   3.128 +    Uint32 *dest;
   3.129 +    Uint32 *p;
   3.130 +    int pitch, i;
   3.131 +
   3.132 +    SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
   3.133 +    SDL_assert(surface->pitch == surface->w * 4);
   3.134 +
   3.135 +    SDL_DFB_ALLOC_CLEAR( cursor, sizeof(*cursor));
   3.136 +    SDL_DFB_ALLOC_CLEAR(curdata, sizeof(*curdata));
   3.137 +
   3.138 +    dsc.flags =
   3.139 +        DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
   3.140 +    dsc.caps = DSCAPS_VIDEOONLY;
   3.141 +    dsc.width = surface->w;
   3.142 +    dsc.height = surface->h;
   3.143 +    dsc.pixelformat = DSPF_ARGB;
   3.144 +
   3.145 +    SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc,
   3.146 +                                                 &curdata->surf));
   3.147 +    curdata->hotx = hot_x;
   3.148 +    curdata->hoty = hot_y;
   3.149 +    cursor->driverdata = curdata;
   3.150 +
   3.151 +    SDL_DFB_CHECKERR(curdata->surf->Lock(curdata->surf, DSLF_WRITE,
   3.152 +                                         (void *) &dest, &pitch));
   3.153 +
   3.154 +    p = surface->pixels;
   3.155 +    for (i = 0; i < surface->h; i++)
   3.156 +        memcpy((char *) dest + i * pitch,
   3.157 +               (char *) p + i * surface->pitch, 4 * surface->w);
   3.158 +
   3.159 +    curdata->surf->Unlock(curdata->surf);
   3.160 +    return cursor;
   3.161 +  error:
   3.162 +    return NULL;
   3.163 +}
   3.164 +
   3.165 +/* Show the specified cursor, or hide if cursor is NULL */
   3.166 +static int
   3.167 +DirectFB_ShowCursor(SDL_Cursor * cursor)
   3.168 +{
   3.169 +    SDL_DFB_CURSORDATA(cursor);
   3.170 +    DFBResult ret;
   3.171 +    SDL_Window *window;
   3.172 +
   3.173 +    window = SDL_GetFocusWindow();
   3.174 +    if (!window)
   3.175 +        return -1;
   3.176 +    else {
   3.177 +        SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
   3.178 +
   3.179 +        if (display) {
   3.180 +            DFB_DisplayData *dispdata =
   3.181 +                (DFB_DisplayData *) display->driverdata;
   3.182 +            DFB_WindowData *windata = (DFB_WindowData *) window->driverdata;
   3.183 +
   3.184 +            if (cursor)
   3.185 +                SDL_DFB_CHECKERR(windata->dfbwin->
   3.186 +                                 SetCursorShape(windata->dfbwin,
   3.187 +                                                curdata->surf, curdata->hotx,
   3.188 +                                                curdata->hoty));
   3.189 +
   3.190 +            SDL_DFB_CHECKERR(dispdata->layer->
   3.191 +                             SetCooperativeLevel(dispdata->layer,
   3.192 +                                                 DLSCL_ADMINISTRATIVE));
   3.193 +            SDL_DFB_CHECKERR(dispdata->layer->
   3.194 +                             SetCursorOpacity(dispdata->layer,
   3.195 +                                              cursor ? 0xC0 : 0x00));
   3.196 +            SDL_DFB_CHECKERR(dispdata->layer->
   3.197 +                             SetCooperativeLevel(dispdata->layer,
   3.198 +                                                 DLSCL_SHARED));
   3.199 +        }
   3.200 +    }
   3.201 +
   3.202 +    return 0;
   3.203 +  error:
   3.204 +    return -1;
   3.205 +}
   3.206 +
   3.207 +/* Free a window manager cursor */
   3.208 +static void
   3.209 +DirectFB_FreeCursor(SDL_Cursor * cursor)
   3.210 +{
   3.211 +    SDL_DFB_CURSORDATA(cursor);
   3.212 +
   3.213 +    SDL_DFB_RELEASE(curdata->surf);
   3.214 +    SDL_DFB_FREE(cursor->driverdata);
   3.215 +    SDL_DFB_FREE(cursor);
   3.216 +}
   3.217 +
   3.218 +/* Warp the mouse to (x,y) */
   3.219 +static void
   3.220 +DirectFB_WarpMouse(SDL_Window * window, int x, int y)
   3.221 +{
   3.222 +    SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
   3.223 +    DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
   3.224 +    DFB_WindowData *windata = (DFB_WindowData *) window->driverdata;
   3.225 +    DFBResult ret;
   3.226 +    int cx, cy;
   3.227 +
   3.228 +    SDL_DFB_CHECKERR(windata->dfbwin->GetPosition(windata->dfbwin, &cx, &cy));
   3.229 +    SDL_DFB_CHECKERR(dispdata->layer->WarpCursor(dispdata->layer,
   3.230 +                                                 cx + x + windata->client.x,
   3.231 +                                                 cy + y + windata->client.y));
   3.232 +
   3.233 +  error:
   3.234 +    return;
   3.235 +}
   3.236 +
   3.237 +#if USE_MULTI_API
   3.238 +
   3.239  static void DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_Window * window,
   3.240                                 int x, int y);
   3.241 -static void DirectFB_FreeMouse(SDL_Mouse * mouse);
   3.242  
   3.243  static int id_mask;
   3.244  
   3.245 @@ -112,93 +330,6 @@
   3.246      }
   3.247  }
   3.248  
   3.249 -/* Create a cursor from a surface */
   3.250 -static SDL_Cursor *
   3.251 -DirectFB_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
   3.252 -{
   3.253 -    SDL_VideoDevice *dev = SDL_GetVideoDevice();
   3.254 -
   3.255 -    SDL_DFB_DEVICEDATA(dev);
   3.256 -    DFB_CursorData *curdata;
   3.257 -    DFBResult ret;
   3.258 -    DFBSurfaceDescription dsc;
   3.259 -    SDL_Cursor *cursor;
   3.260 -    Uint32 *dest;
   3.261 -    Uint32 *p;
   3.262 -    int pitch, i;
   3.263 -
   3.264 -    SDL_DFB_ALLOC_CLEAR(cursor, 1, sizeof(*cursor));
   3.265 -    SDL_DFB_ALLOC_CLEAR(curdata, 1, sizeof(*curdata));
   3.266 -
   3.267 -    dsc.flags =
   3.268 -        DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
   3.269 -    dsc.caps = DSCAPS_VIDEOONLY;
   3.270 -    dsc.width = surface->w;
   3.271 -    dsc.height = surface->h;
   3.272 -    dsc.pixelformat = DSPF_ARGB;
   3.273 -
   3.274 -    SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc,
   3.275 -                                                 &curdata->surf));
   3.276 -    curdata->hotx = hot_x;
   3.277 -    curdata->hoty = hot_y;
   3.278 -    cursor->driverdata = curdata;
   3.279 -
   3.280 -    SDL_DFB_CHECKERR(curdata->surf->Lock(curdata->surf, DSLF_WRITE,
   3.281 -                                         (void *) &dest, &pitch));
   3.282 -
   3.283 -    /* Relies on the fact that this is only called with ARGB surface. */
   3.284 -    p = surface->pixels;
   3.285 -    for (i = 0; i < surface->h; i++)
   3.286 -        memcpy((char *) dest + i * pitch,
   3.287 -               (char *) p + i * surface->pitch, 4 * surface->w);
   3.288 -
   3.289 -    curdata->surf->Unlock(curdata->surf);
   3.290 -    return cursor;
   3.291 -  error:
   3.292 -    return NULL;
   3.293 -}
   3.294 -
   3.295 -/* Show the specified cursor, or hide if cursor is NULL */
   3.296 -static int
   3.297 -DirectFB_ShowCursor(SDL_Cursor * cursor)
   3.298 -{
   3.299 -    SDL_DFB_CURSORDATA(cursor);
   3.300 -    DFBResult ret;
   3.301 -    SDL_Window *window;
   3.302 -
   3.303 -    window = SDL_GetFocusWindow();
   3.304 -    if (!window)
   3.305 -        return -1;
   3.306 -    else {
   3.307 -        SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
   3.308 -
   3.309 -        if (display) {
   3.310 -            DFB_DisplayData *dispdata =
   3.311 -                (DFB_DisplayData *) display->driverdata;
   3.312 -            DFB_WindowData *windata = (DFB_WindowData *) window->driverdata;
   3.313 -
   3.314 -            if (cursor)
   3.315 -                SDL_DFB_CHECKERR(windata->window->
   3.316 -                                 SetCursorShape(windata->dfbwin,
   3.317 -                                                curdata->surf, curdata->hotx,
   3.318 -                                                curdata->hoty));
   3.319 -
   3.320 -            SDL_DFB_CHECKERR(dispdata->layer->
   3.321 -                             SetCooperativeLevel(dispdata->layer,
   3.322 -                                                 DLSCL_ADMINISTRATIVE));
   3.323 -            SDL_DFB_CHECKERR(dispdata->layer->
   3.324 -                             SetCursorOpacity(dispdata->layer,
   3.325 -                                              cursor ? 0xC0 : 0x00));
   3.326 -            SDL_DFB_CHECKERR(dispdata->layer->
   3.327 -                             SetCooperativeLevel(dispdata->layer,
   3.328 -                                                 DLSCL_SHARED));
   3.329 -        }
   3.330 -    }
   3.331 -
   3.332 -    return 0;
   3.333 -  error:
   3.334 -    return -1;
   3.335 -}
   3.336  
   3.337  /* This is called when a mouse motion event occurs */
   3.338  static void
   3.339 @@ -207,17 +338,6 @@
   3.340  
   3.341  }
   3.342  
   3.343 -/* Free a window manager cursor */
   3.344 -static void
   3.345 -DirectFB_FreeCursor(SDL_Cursor * cursor)
   3.346 -{
   3.347 -    SDL_DFB_CURSORDATA(cursor);
   3.348 -
   3.349 -    SDL_DFB_RELEASE(curdata->surf);
   3.350 -    SDL_DFB_FREE(cursor->driverdata);
   3.351 -    SDL_DFB_FREE(cursor);
   3.352 -}
   3.353 -
   3.354  /* Warp the mouse to (x,y) */
   3.355  static void
   3.356  DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_Window * window, int x, int y)
   3.357 @@ -251,6 +371,17 @@
   3.358  {
   3.359      SDL_DFB_DEVICEDATA(_this);
   3.360  
   3.361 +    SDL_Mouse *mouse = SDL_GetMouse();
   3.362 +    SDL_Cursor *cursor;
   3.363 +
   3.364 +    mouse->CreateCursor = DirectFB_CreateCursor;
   3.365 +    mouse->ShowCursor = DirectFB_ShowCursor;
   3.366 +    mouse->WarpMouse = DirectFB_WarpMouse;
   3.367 +    mouse->FreeCursor = DirectFB_FreeCursor;
   3.368 +
   3.369 +    cursor = DirectFB_CreateDefaultCursor();
   3.370 +    mouse->cursors = mouse->cur_cursor = cursor;
   3.371 +
   3.372      devdata->num_mice = 1;
   3.373  }
   3.374  
     4.1 --- a/src/video/directfb/SDL_DirectFB_opengl.c	Mon Mar 14 23:04:52 2011 -0700
     4.2 +++ b/src/video/directfb/SDL_DirectFB_opengl.c	Mon Mar 14 23:13:33 2011 -0700
     4.3 @@ -26,6 +26,7 @@
     4.4  #include "SDL_DirectFB_video.h"
     4.5  
     4.6  #if SDL_DIRECTFB_OPENGL
     4.7 +
     4.8  #include "SDL_DirectFB_opengl.h"
     4.9  #include "SDL_DirectFB_window.h"
    4.10  
     5.1 --- a/src/video/directfb/SDL_DirectFB_render.c	Mon Mar 14 23:04:52 2011 -0700
     5.2 +++ b/src/video/directfb/SDL_DirectFB_render.c	Mon Mar 14 23:13:33 2011 -0700
     5.3 @@ -22,10 +22,11 @@
     5.4      SDL1.3 DirectFB driver by couriersud@arcor.de
     5.5  	
     5.6  */
     5.7 -#include "SDL_DirectFB_video.h"
     5.8 +//#include "SDL_DirectFB_video.h"
     5.9  #include "SDL_DirectFB_window.h"
    5.10  #include "SDL_DirectFB_modes.h"
    5.11  
    5.12 +#include "SDL_syswm.h"
    5.13  #include "SDL_DirectFB_shape.h"
    5.14  
    5.15  #include "../SDL_sysvideo.h"
    5.16 @@ -33,6 +34,21 @@
    5.17  //#include "../SDL_rect_c.h"
    5.18  //#include "../SDL_yuv_sw_c.h"
    5.19  
    5.20 +#ifndef DFB_VERSION_ATLEAST
    5.21 +
    5.22 +#define DFB_VERSIONNUM(X, Y, Z)						\
    5.23 +	((X)*1000 + (Y)*100 + (Z))
    5.24 +
    5.25 +#define DFB_COMPILEDVERSION \
    5.26 +	DFB_VERSIONNUM(DIRECTFB_MAJOR_VERSION, DIRECTFB_MINOR_VERSION, DIRECTFB_MICRO_VERSION)
    5.27 +
    5.28 +#define DFB_VERSION_ATLEAST(X, Y, Z) \
    5.29 +	(DFB_COMPILEDVERSION >= DFB_VERSIONNUM(X, Y, Z))
    5.30 +
    5.31 +#define SDL_DFB_CHECK(x)	x
    5.32 +
    5.33 +#endif
    5.34 +
    5.35  /* the following is not yet tested ... */
    5.36  #define USE_DISPLAY_PALETTE			(0)
    5.37  
    5.38 @@ -87,7 +103,7 @@
    5.39  static int DirectFB_RenderDrawRects(SDL_Renderer * renderer,
    5.40  		const SDL_Rect ** rects, int count);
    5.41  static int DirectFB_RenderFillRects(SDL_Renderer * renderer,
    5.42 -		const SDL_Rect ** rects, int count);
    5.43 +		const SDL_Rect * rects, int count);
    5.44  static int DirectFB_RenderCopy(SDL_Renderer * renderer,
    5.45                                 SDL_Texture * texture,
    5.46                                 const SDL_Rect * srcrect,
    5.47 @@ -100,6 +116,9 @@
    5.48                       Uint32 format, void * pixels, int pitch);
    5.49  static int DirectFB_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect,
    5.50                        Uint32 format, const void * pixels, int pitch);
    5.51 +static int DirectFB_UpdateViewport(SDL_Renderer * renderer);
    5.52 +
    5.53 +static int PrepareDraw(SDL_Renderer * renderer);
    5.54  
    5.55  
    5.56  #define SDL_DFB_WINDOWSURFACE(win)  IDirectFBSurface *destsurf = ((DFB_WindowData *) ((win)->driverdata))->surface;
    5.57 @@ -185,11 +204,29 @@
    5.58  #endif
    5.59  }
    5.60  
    5.61 +static inline IDirectFBSurface *get_dfb_surface(SDL_Window *window)
    5.62 +{
    5.63 +	SDL_SysWMinfo wm_info;
    5.64 +	SDL_VERSION(&wm_info.version);
    5.65 +	SDL_GetWindowWMInfo(window, &wm_info);
    5.66 +
    5.67 +	return wm_info.info.dfb.surface;
    5.68 +}
    5.69 +
    5.70 +static inline IDirectFBWindow *get_dfb_window(SDL_Window *window)
    5.71 +{
    5.72 +	SDL_SysWMinfo wm_info;
    5.73 +	SDL_VERSION(&wm_info.version);
    5.74 +	SDL_GetWindowWMInfo(window, &wm_info);
    5.75 +
    5.76 +	return wm_info.info.dfb.window;
    5.77 +}
    5.78 +
    5.79  static void
    5.80  SetBlendMode(DirectFB_RenderData * data, int blendMode,
    5.81               DirectFB_TextureData * source)
    5.82  {
    5.83 -    SDL_DFB_WINDOWSURFACE(data->window);
    5.84 +	IDirectFBSurface *destsurf = get_dfb_surface(data->window);
    5.85  
    5.86      //FIXME: check for format change
    5.87      if (1 || data->lastBlendMode != blendMode) {
    5.88 @@ -290,17 +327,23 @@
    5.89  int
    5.90  DirectFB_RenderClear(SDL_Renderer * renderer)
    5.91  {
    5.92 -    SDL_DFB_RENDERERDATA(renderer);
    5.93 +    DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
    5.94 +	IDirectFBSurface *destsurf = get_dfb_surface(data->window);
    5.95  
    5.96      DirectFB_ActivateRenderer(renderer);
    5.97  
    5.98 +    PrepareDraw(renderer);
    5.99 +
   5.100 +    destsurf->Clear(destsurf, renderer->r, renderer->g, renderer->b, renderer->a);
   5.101 +
   5.102 +
   5.103      return 0;
   5.104  }
   5.105  
   5.106  SDL_Renderer *
   5.107  DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags)
   5.108  {
   5.109 -    SDL_DFB_WINDOWDATA(window);
   5.110 +	IDirectFBSurface *winsurf = get_dfb_surface(window);
   5.111      SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
   5.112      SDL_Renderer *renderer = NULL;
   5.113      DirectFB_RenderData *data = NULL;
   5.114 @@ -323,6 +366,7 @@
   5.115      renderer->RenderDrawLines = DirectFB_RenderDrawLines;
   5.116      /* SetDrawColor - no needed */
   5.117      renderer->RenderFillRects = DirectFB_RenderFillRects;
   5.118 +
   5.119      /* RenderDrawEllipse - no reference implementation yet */
   5.120      /* RenderFillEllipse - no reference implementation yet */
   5.121      renderer->RenderCopy = DirectFB_RenderCopy;
   5.122 @@ -334,6 +378,7 @@
   5.123      
   5.124      renderer->DestroyTexture = DirectFB_DestroyTexture;
   5.125      renderer->DestroyRenderer = DirectFB_DestroyRenderer;
   5.126 +    renderer->UpdateViewport = DirectFB_UpdateViewport;
   5.127  
   5.128  #if 0
   5.129      renderer->QueryTexturePixels = DirectFB_QueryTexturePixels;
   5.130 @@ -362,8 +407,7 @@
   5.131      } else
   5.132          data->flipflags |= DSFLIP_ONSYNC;
   5.133  
   5.134 -    SDL_DFB_CHECKERR(windata->surface->
   5.135 -                     GetCapabilities(windata->surface, &scaps));
   5.136 +    SDL_DFB_CHECKERR(winsurf->GetCapabilities(winsurf, &scaps));
   5.137  
   5.138  #if 0
   5.139      if (scaps & DSCAPS_DOUBLE)
   5.140 @@ -378,7 +422,7 @@
   5.141  
   5.142  #if 0
   5.143      /* Set up a palette watch on the display palette */
   5.144 -    if (display->palette) {
   5.145 +    if (display-> palette) {
   5.146          SDL_AddPaletteWatch(display->palette, DisplayPaletteChanged, data);
   5.147      }
   5.148  #endif
   5.149 @@ -394,12 +438,14 @@
   5.150  static void
   5.151  DirectFB_ActivateRenderer(SDL_Renderer * renderer)
   5.152  {
   5.153 +
   5.154      SDL_DFB_RENDERERDATA(renderer);
   5.155      SDL_Window *window = renderer->window;
   5.156      SDL_DFB_WINDOWDATA(window);
   5.157  
   5.158 -    if (renddata->size_changed || windata->wm_needs_redraw) {
   5.159 -        DirectFB_AdjustWindowSurface(window);
   5.160 +    if (renddata->size_changed /*|| windata->wm_needs_redraw*/) {
   5.161 +        //DirectFB_AdjustWindowSurface(window);
   5.162 +    	renddata->size_changed = SDL_FALSE;
   5.163      }
   5.164  }
   5.165  
   5.166 @@ -839,7 +885,7 @@
   5.167  PrepareDraw(SDL_Renderer * renderer)
   5.168  {
   5.169      DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
   5.170 -    SDL_DFB_WINDOWSURFACE(data->window);
   5.171 +	IDirectFBSurface *destsurf = get_dfb_surface(data->window);
   5.172  
   5.173      Uint8 r, g, b, a;
   5.174  
   5.175 @@ -875,7 +921,7 @@
   5.176                                  const SDL_Point * points, int count)
   5.177  {
   5.178      DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
   5.179 -    SDL_DFB_WINDOWSURFACE(data->window);
   5.180 +	IDirectFBSurface *destsurf = get_dfb_surface(data->window);
   5.181      int i;
   5.182  
   5.183      DirectFB_ActivateRenderer(renderer);
   5.184 @@ -892,7 +938,7 @@
   5.185                                 const SDL_Point * points, int count)
   5.186  {
   5.187      DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
   5.188 -    SDL_DFB_WINDOWSURFACE(data->window);
   5.189 +	IDirectFBSurface *destsurf = get_dfb_surface(data->window);
   5.190      int i;
   5.191  
   5.192      DirectFB_ActivateRenderer(renderer);
   5.193 @@ -915,7 +961,7 @@
   5.194  DirectFB_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count)
   5.195  {
   5.196      DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
   5.197 -    SDL_DFB_WINDOWSURFACE(data->window);
   5.198 +	IDirectFBSurface *destsurf = get_dfb_surface(data->window);
   5.199      int i;
   5.200  
   5.201      DirectFB_ActivateRenderer(renderer);
   5.202 @@ -932,10 +978,10 @@
   5.203  }
   5.204  
   5.205  static int
   5.206 -DirectFB_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count)
   5.207 +DirectFB_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect * rects, int count)
   5.208  {
   5.209      DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
   5.210 -    SDL_DFB_WINDOWSURFACE(data->window);
   5.211 +	IDirectFBSurface *destsurf = get_dfb_surface(data->window);
   5.212      int i;
   5.213  
   5.214      DirectFB_ActivateRenderer(renderer);
   5.215 @@ -943,8 +989,8 @@
   5.216      PrepareDraw(renderer);
   5.217  
   5.218      for (i=0; i<count; i++)
   5.219 -    	SDL_DFB_CHECKERR(destsurf->FillRectangle(destsurf, rects[i]->x, rects[i]->y,
   5.220 -    			rects[i]->w, rects[i]->h));
   5.221 +    	SDL_DFB_CHECKERR(destsurf->FillRectangle(destsurf, rects[i].x, rects[i].y,
   5.222 +    			rects[i].w, rects[i].h));
   5.223  
   5.224      return 0;
   5.225    error:
   5.226 @@ -956,7 +1002,7 @@
   5.227                      const SDL_Rect * srcrect, const SDL_Rect * dstrect)
   5.228  {
   5.229      DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
   5.230 -    SDL_DFB_WINDOWSURFACE(data->window);
   5.231 +	IDirectFBSurface *destsurf = get_dfb_surface(data->window);
   5.232      DirectFB_TextureData *texturedata =
   5.233          (DirectFB_TextureData *) texture->driverdata;
   5.234      Uint8 alpha, r, g, b;
   5.235 @@ -966,6 +1012,7 @@
   5.236      if (texturedata->display) {
   5.237          int px, py;
   5.238          SDL_Window *window = renderer->window;
   5.239 +    	IDirectFBWindow *dfbwin = get_dfb_window(window);
   5.240          SDL_DFB_WINDOWDATA(window);
   5.241          SDL_VideoDisplay *display = texturedata->display;
   5.242          DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
   5.243 @@ -975,7 +1022,7 @@
   5.244                                                        srcrect->x, srcrect->y,
   5.245                                                        srcrect->w,
   5.246                                                        srcrect->h));
   5.247 -        SDL_DFB_CHECK(windata->dfbwin->GetPosition(windata->dfbwin, &px, &py));
   5.248 +        dfbwin->GetPosition(dfbwin, &px, &py);
   5.249          px += windata->client.x;
   5.250          py += windata->client.y;
   5.251          SDL_DFB_CHECKERR(dispdata->
   5.252 @@ -1129,7 +1176,7 @@
   5.253  DirectFB_DestroyRenderer(SDL_Renderer * renderer)
   5.254  {
   5.255      DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
   5.256 -    SDL_VideoDisplay *display = renderer->SDL_GetDisplayForWindow(window);
   5.257 +    SDL_VideoDisplay *display = SDL_GetDisplayForWindow(data->window);
   5.258  
   5.259  #if 0
   5.260      if (display->palette) {
   5.261 @@ -1144,32 +1191,47 @@
   5.262  }
   5.263  
   5.264  static int
   5.265 +DirectFB_UpdateViewport(SDL_Renderer * renderer)
   5.266 +{
   5.267 +  	IDirectFBSurface *winsurf = get_dfb_surface(renderer->window);
   5.268 +  	DFBRegion dreg;
   5.269 +
   5.270 +  	dreg.x1 = renderer->viewport.x;
   5.271 +  	dreg.y1 = renderer->viewport.y;
   5.272 +  	dreg.x2 = dreg.x1 + renderer->viewport.w - 1;
   5.273 +  	dreg.y2 = dreg.y1 + renderer->viewport.h - 1;
   5.274 +
   5.275 +  	winsurf->SetClip(winsurf, &dreg);
   5.276 +    return 0;
   5.277 +}
   5.278 +
   5.279 +static int
   5.280  DirectFB_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
   5.281                       Uint32 format, void * pixels, int pitch)
   5.282  {
   5.283 -    SDL_Window *window = renderer->window;
   5.284 -    SDL_DFB_WINDOWDATA(window);
   5.285      Uint32 sdl_format;
   5.286     	void * laypixels;
   5.287     	int laypitch;
   5.288    	DFBSurfacePixelFormat dfb_format;
   5.289 +  	IDirectFBSurface *winsurf = get_dfb_surface(renderer->window);
   5.290  
   5.291      DirectFB_ActivateRenderer(renderer);
   5.292  
   5.293 -    SDL_DFB_CHECK(windata->surface->GetPixelFormat(windata->surface, &dfb_format));
   5.294 +    winsurf->GetPixelFormat(winsurf, &dfb_format);
   5.295      sdl_format = DirectFB_DFBToSDLPixelFormat(dfb_format);
   5.296 -    SDL_DFB_CHECK(windata->surface->Lock(windata->surface, DSLF_READ, (void **) &laypixels, &laypitch));
   5.297 +    winsurf->Lock(winsurf, DSLF_READ, (void **) &laypixels, &laypitch);
   5.298      
   5.299      laypixels += (rect->y * laypitch + rect->x * SDL_BYTESPERPIXEL(sdl_format) );
   5.300      SDL_ConvertPixels(rect->w, rect->h,
   5.301                        sdl_format, laypixels, laypitch,
   5.302                        format, pixels, pitch);
   5.303  
   5.304 -    SDL_DFB_CHECK(windata->surface->Unlock(windata->surface));
   5.305 +    winsurf->Unlock(winsurf);
   5.306      
   5.307      return 0;
   5.308  }
   5.309  
   5.310 +#if 0
   5.311  static int
   5.312  DirectFB_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect,
   5.313                        Uint32 format, const void * pixels, int pitch)
   5.314 @@ -1195,6 +1257,6 @@
   5.315  
   5.316      return 0;
   5.317  }
   5.318 -
   5.319 +#endif
   5.320  
   5.321  /* vi: set ts=4 sw=4 expandtab: */
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/src/video/directfb/SDL_DirectFB_shape.c	Mon Mar 14 23:13:33 2011 -0700
     6.3 @@ -0,0 +1,134 @@
     6.4 +/*
     6.5 +    SDL - Simple DirectMedia Layer
     6.6 +    Copyright (C) 1997-2010 Sam Lantinga
     6.7 +
     6.8 +    This library is free software; you can redistribute it and/or
     6.9 +    modify it under the terms of the GNU Lesser General Public
    6.10 +    License as published by the Free Software Foundation; either
    6.11 +    version 2.1 of the License, or (at your option) any later version.
    6.12 +
    6.13 +    This library is distributed in the hope that it will be useful,
    6.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    6.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    6.16 +    Lesser General Public License for more details.
    6.17 +
    6.18 +    You should have received a copy of the GNU Lesser General Public
    6.19 +    License along with this library; if not, write to the Free Software
    6.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    6.21 +
    6.22 +    Sam Lantinga
    6.23 +    slouken@libsdl.org
    6.24 +
    6.25 +    SDL1.3 DirectFB driver by couriersud@arcor.de
    6.26 +	
    6.27 +*/
    6.28 +
    6.29 +#include "SDL_assert.h"
    6.30 +#include "SDL_DirectFB_video.h"
    6.31 +#include "SDL_DirectFB_shape.h"
    6.32 +#include "SDL_DirectFB_window.h"
    6.33 +
    6.34 +#include "../SDL_shape_internals.h"
    6.35 +
    6.36 +SDL_Window*
    6.37 +DirectFB_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) {
    6.38 +    return SDL_CreateWindow(title,x,y,w,h,flags /*| SDL_DFB_WINDOW_SHAPED */);
    6.39 +}
    6.40 +
    6.41 +SDL_WindowShaper*
    6.42 +DirectFB_CreateShaper(SDL_Window* window) {
    6.43 +    SDL_WindowShaper* result = NULL;
    6.44 +
    6.45 +    result = malloc(sizeof(SDL_WindowShaper));
    6.46 +    result->window = window;
    6.47 +    result->mode.mode = ShapeModeDefault;
    6.48 +    result->mode.parameters.binarizationCutoff = 1;
    6.49 +    result->userx = result->usery = 0;
    6.50 +    SDL_ShapeData* data = SDL_malloc(sizeof(SDL_ShapeData));
    6.51 +    result->driverdata = data;
    6.52 +    data->surface = NULL;
    6.53 +    window->shaper = result;
    6.54 +    int resized_properly = DirectFB_ResizeWindowShape(window);
    6.55 +    SDL_assert(resized_properly == 0);
    6.56 +
    6.57 +    return result;
    6.58 +}
    6.59 +
    6.60 +int
    6.61 +DirectFB_ResizeWindowShape(SDL_Window* window) {
    6.62 +    SDL_ShapeData* data = window->shaper->driverdata;
    6.63 +    SDL_assert(data != NULL);
    6.64 +        
    6.65 +    if (window->x != -1000) 
    6.66 +    {
    6.67 +		window->shaper->userx = window->x;
    6.68 +		window->shaper->usery = window->y;
    6.69 +    }
    6.70 +    SDL_SetWindowPosition(window,-1000,-1000);
    6.71 +    
    6.72 +    return 0;
    6.73 +}
    6.74 +    
    6.75 +int
    6.76 +DirectFB_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode) {
    6.77 + 
    6.78 +    if(shaper == NULL || shape == NULL || shaper->driverdata == NULL)
    6.79 +        return -1;
    6.80 +    if(shape->format->Amask == 0 && SDL_SHAPEMODEALPHA(shape_mode->mode))
    6.81 +        return -2;
    6.82 +    if(shape->w != shaper->window->w || shape->h != shaper->window->h)
    6.83 +        return -3;
    6.84 +
    6.85 +    {
    6.86 +        SDL_VideoDisplay *display = SDL_GetDisplayForWindow(shaper->window);
    6.87 +        SDL_DFB_DEVICEDATA(display->device);
    6.88 +     	Uint32 *pixels;
    6.89 +     	Sint32 pitch;
    6.90 +     	Uint32 h,w;
    6.91 +     	Uint8  *src, *bitmap;
    6.92 +        DFBSurfaceDescription dsc;
    6.93 +
    6.94 +        SDL_ShapeData *data = shaper->driverdata;
    6.95 +
    6.96 +        SDL_DFB_RELEASE(data->surface);
    6.97 +
    6.98 +        dsc.flags = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
    6.99 +        dsc.width = shape->w;
   6.100 +        dsc.height = shape->h;
   6.101 +        dsc.caps = DSCAPS_PREMULTIPLIED;
   6.102 +        dsc.pixelformat = DSPF_ARGB;
   6.103 +
   6.104 +        SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc, &data->surface));
   6.105 +
   6.106 +        /* Assume that shaper->alphacutoff already has a value, because SDL_SetWindowShape() should have given it one. */
   6.107 +        SDL_DFB_ALLOC_CLEAR(bitmap, shape->w * shape->h);
   6.108 +        SDL_CalculateShapeBitmap(shaper->mode,shape,bitmap,1);
   6.109 +
   6.110 +    	src = bitmap;
   6.111 +
   6.112 +        SDL_DFB_CHECK(data->surface->Lock(data->surface, DSLF_WRITE | DSLF_READ, (void **) &pixels, &pitch));
   6.113 +
   6.114 +    	h = shaper->window->h;
   6.115 +    	while (h--) {
   6.116 +    		for (w = 0; w < shaper->window->w; w++) {
   6.117 +    			if (*src)
   6.118 +    				pixels[w] = 0xFFFFFFFF;
   6.119 +    			else
   6.120 +    				pixels[w] = 0;
   6.121 +    			src++;
   6.122 +
   6.123 +    		}
   6.124 +    		pixels += (pitch >> 2);
   6.125 +    	}
   6.126 +        SDL_DFB_CHECK(data->surface->Unlock(data->surface));
   6.127 +    	SDL_DFB_FREE(bitmap);
   6.128 +
   6.129 +    	/* FIXME: Need to call this here - Big ?? */
   6.130 +    	DirectFB_WM_RedrawLayout(SDL_GetDisplayForWindow(shaper->window)->device, shaper->window);
   6.131 +    }
   6.132 +    
   6.133 +    return 0;
   6.134 +error:
   6.135 +	return -1;
   6.136 +}
   6.137 +
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/src/video/directfb/SDL_DirectFB_shape.h	Mon Mar 14 23:13:33 2011 -0700
     7.3 @@ -0,0 +1,43 @@
     7.4 +/*
     7.5 +    SDL - Simple DirectMedia Layer
     7.6 +    Copyright (C) 1997-2010 Sam Lantinga
     7.7 +
     7.8 +    This library is free software; you can redistribute it and/or
     7.9 +    modify it under the terms of the GNU Lesser General Public
    7.10 +    License as published by the Free Software Foundation; either
    7.11 +    version 2.1 of the License, or (at your option) any later version.
    7.12 +
    7.13 +    This library is distributed in the hope that it will be useful,
    7.14 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.15 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    7.16 +    Lesser General Public License for more details.
    7.17 +
    7.18 +    You should have received a copy of the GNU Lesser General Public
    7.19 +    License along with this library; if not, write to the Free Software
    7.20 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    7.21 +
    7.22 +    Sam Lantinga
    7.23 +    slouken@libsdl.org
    7.24 +
    7.25 +    SDL1.3 DirectFB driver by couriersud@arcor.de
    7.26 +	
    7.27 +*/
    7.28 +
    7.29 +#ifndef _SDL_DirectFB_shape_h
    7.30 +#define _SDL_DirectFB_shape_h
    7.31 +
    7.32 +#include <directfb.h>
    7.33 +
    7.34 +#include "../SDL_sysvideo.h"
    7.35 +#include "SDL_shape.h"
    7.36 +
    7.37 +typedef struct {
    7.38 +	IDirectFBSurface *surface;
    7.39 +} SDL_ShapeData;
    7.40 +
    7.41 +extern SDL_Window* DirectFB_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags);
    7.42 +extern SDL_WindowShaper* DirectFB_CreateShaper(SDL_Window* window);
    7.43 +extern int DirectFB_ResizeWindowShape(SDL_Window* window);
    7.44 +extern int DirectFB_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode);	
    7.45 +
    7.46 +#endif /* _SDL_DirectFB_shape_h */
     8.1 --- a/src/video/directfb/SDL_DirectFB_video.c	Mon Mar 14 23:04:52 2011 -0700
     8.2 +++ b/src/video/directfb/SDL_DirectFB_video.c	Mon Mar 14 23:13:33 2011 -0700
     8.3 @@ -133,6 +133,10 @@
     8.4      device->DestroyWindow = DirectFB_DestroyWindow;
     8.5      device->GetWindowWMInfo = DirectFB_GetWindowWMInfo;
     8.6  
     8.7 +    /* Not supported by DFB, for completeness */
     8.8 +    device->SetWindowGammaRamp = DirectFB_SetWindowGammaRamp;
     8.9 +    device->GetWindowGammaRamp = DirectFB_GetWindowGammaRamp;
    8.10 +
    8.11  #if SDL_DIRECTFB_OPENGL
    8.12      device->GL_LoadLibrary = DirectFB_GL_LoadLibrary;
    8.13      device->GL_GetProcAddress = DirectFB_GL_GetProcAddress;
    8.14 @@ -168,34 +172,34 @@
    8.15  
    8.16      dfb->GetDeviceDescription(dfb, &desc);
    8.17  
    8.18 -    SDL_DFB_LOG( "DirectFB Device Information\n");
    8.19 -    SDL_DFB_LOG( "===========================\n");
    8.20 -    SDL_DFB_LOG( "Name:           %s\n", desc.name);
    8.21 -    SDL_DFB_LOG( "Vendor:         %s\n", desc.vendor);
    8.22 -    SDL_DFB_LOG( "Driver Name:    %s\n", desc.driver.name);
    8.23 -    SDL_DFB_LOG( "Driver Vendor:  %s\n", desc.driver.vendor);
    8.24 -    SDL_DFB_LOG( "Driver Version: %d.%d\n", desc.driver.major,
    8.25 +    SDL_DFB_LOG( "DirectFB Device Information");
    8.26 +    SDL_DFB_LOG( "===========================");
    8.27 +    SDL_DFB_LOG( "Name:           %s", desc.name);
    8.28 +    SDL_DFB_LOG( "Vendor:         %s", desc.vendor);
    8.29 +    SDL_DFB_LOG( "Driver Name:    %s", desc.driver.name);
    8.30 +    SDL_DFB_LOG( "Driver Vendor:  %s", desc.driver.vendor);
    8.31 +    SDL_DFB_LOG( "Driver Version: %d.%d", desc.driver.major,
    8.32              desc.driver.minor);
    8.33  
    8.34 -    SDL_DFB_LOG( "\nVideo memoory:  %d\n", desc.video_memory);
    8.35 +    SDL_DFB_LOG( "Video memoory:  %d", desc.video_memory);
    8.36  
    8.37 -    SDL_DFB_LOG( "\nBlitting flags:\n");
    8.38 +    SDL_DFB_LOG( "Blitting flags:");
    8.39      for (n = 0; blitting_flags[n].flag; n++) {
    8.40          if (desc.blitting_flags & blitting_flags[n].flag)
    8.41 -            SDL_DFB_LOG( "    %s\n", blitting_flags[n].name);
    8.42 +            SDL_DFB_LOG( "    %s", blitting_flags[n].name);
    8.43      }
    8.44  
    8.45 -    SDL_DFB_LOG( "\nDrawing flags:\n");
    8.46 +    SDL_DFB_LOG( "Drawing flags:");
    8.47      for (n = 0; drawing_flags[n].flag; n++) {
    8.48          if (desc.drawing_flags & drawing_flags[n].flag)
    8.49 -            SDL_DFB_LOG( "    %s\n", drawing_flags[n].name);
    8.50 +            SDL_DFB_LOG( "    %s", drawing_flags[n].name);
    8.51      }
    8.52  
    8.53  
    8.54 -    SDL_DFB_LOG( "\nAcceleration flags:\n");
    8.55 +    SDL_DFB_LOG( "Acceleration flags:");
    8.56      for (n = 0; acceleration_mask[n].mask; n++) {
    8.57          if (desc.acceleration_mask & acceleration_mask[n].mask)
    8.58 -            SDL_DFB_LOG( "    %s\n", acceleration_mask[n].name);
    8.59 +            SDL_DFB_LOG( "    %s", acceleration_mask[n].name);
    8.60      }
    8.61  
    8.62  
     9.1 --- a/src/video/directfb/SDL_DirectFB_video.h	Mon Mar 14 23:04:52 2011 -0700
     9.2 +++ b/src/video/directfb/SDL_DirectFB_video.h	Mon Mar 14 23:13:33 2011 -0700
     9.3 @@ -45,7 +45,9 @@
     9.4  	(DFB_COMPILEDVERSION >= DFB_VERSIONNUM(X, Y, Z))
     9.5  
     9.6  #if (DFB_VERSION_ATLEAST(1,0,0))
     9.7 +#ifdef SDL_VIDEO_OPENGL
     9.8  #define SDL_DIRECTFB_OPENGL 1
     9.9 +#endif
    9.10  #else
    9.11  #error "SDL_DIRECTFB: Please compile against libdirectfb version >= 1.0.0"
    9.12  #endif
    9.13 @@ -93,7 +95,7 @@
    9.14  
    9.15  #define SDL_DFB_LOG(x...) 							\
    9.16  	do {											\
    9.17 -		fprintf(LOG_CHANNEL, SDL_DFB_CONTEXT);		\
    9.18 +		fprintf(LOG_CHANNEL, "%s: ", SDL_DFB_CONTEXT);		\
    9.19          fprintf(LOG_CHANNEL, x ); 					\
    9.20  		fprintf(LOG_CHANNEL, "\n");					\
    9.21  	} while (0)
    10.1 --- a/src/video/directfb/SDL_DirectFB_window.c	Mon Mar 14 23:04:52 2011 -0700
    10.2 +++ b/src/video/directfb/SDL_DirectFB_window.c	Mon Mar 14 23:13:33 2011 -0700
    10.3 @@ -489,6 +489,20 @@
    10.4      }
    10.5  }
    10.6  
    10.7 +int
    10.8 +DirectFB_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp)
    10.9 +{
   10.10 +    SDL_Unsupported();
   10.11 +    return -1;
   10.12 +}
   10.13 +
   10.14 +int
   10.15 +DirectFB_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp)
   10.16 +{
   10.17 +    SDL_Unsupported();
   10.18 +    return -1;
   10.19 +}
   10.20 +
   10.21  void
   10.22  DirectFB_AdjustWindowSurface(SDL_Window * window)
   10.23  {
    11.1 --- a/src/video/directfb/SDL_DirectFB_window.h	Mon Mar 14 23:04:52 2011 -0700
    11.2 +++ b/src/video/directfb/SDL_DirectFB_window.h	Mon Mar 14 23:13:33 2011 -0700
    11.3 @@ -78,6 +78,10 @@
    11.4  extern SDL_bool DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window,
    11.5                                           struct SDL_SysWMinfo *info);
    11.6  
    11.7 +extern int DirectFB_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp);
    11.8 +extern int DirectFB_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp);
    11.9 +
   11.10 +
   11.11  extern void DirectFB_AdjustWindowSurface(SDL_Window * window);
   11.12  
   11.13  #endif /* _SDL_directfb_window_h */