Updated for DirectFB 0.9.9
authorSam Lantinga <slouken@libsdl.org>
Tue, 26 Feb 2002 14:38:53 +0000
changeset 2863ea69fd0b095
parent 285 e5a489f0288c
child 287 e4bd0cf95506
Updated for DirectFB 0.9.9
configure.in
src/video/directfb/SDL_DirectFB_events.c
src/video/directfb/SDL_DirectFB_video.c
src/video/directfb/SDL_DirectFB_video.h
     1.1 --- a/configure.in	Fri Feb 22 17:39:11 2002 +0000
     1.2 +++ b/configure.in	Tue Feb 26 14:38:53 2002 +0000
     1.3 @@ -748,7 +748,7 @@
     1.4                  AC_MSG_ERROR([*** pkg-config too old; version 0.5 or better required.])
     1.5              fi
     1.6  
     1.7 -            DIRECTFB_REQUIRED_VERSION=0.9.8
     1.8 +            DIRECTFB_REQUIRED_VERSION=0.9.9
     1.9  
    1.10              if $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb ; then
    1.11                  DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
     2.1 --- a/src/video/directfb/SDL_DirectFB_events.c	Fri Feb 22 17:39:11 2002 +0000
     2.2 +++ b/src/video/directfb/SDL_DirectFB_events.c	Tue Feb 26 14:38:53 2002 +0000
     2.3 @@ -56,7 +56,8 @@
     2.4  {
     2.5    DFBInputEvent evt;
     2.6  
     2.7 -  while (HIDDEN->inputbuffer->GetEvent (HIDDEN->inputbuffer, &evt) == DFB_OK)
     2.8 +  while (HIDDEN->eventbuffer->GetEvent (HIDDEN->eventbuffer,
     2.9 +                                        DFB_EVENT (&evt)) == DFB_OK)
    2.10      {
    2.11        SDL_keysym keysym;
    2.12  
     3.1 --- a/src/video/directfb/SDL_DirectFB_video.c	Fri Feb 22 17:39:11 2002 +0000
     3.2 +++ b/src/video/directfb/SDL_DirectFB_video.c	Tue Feb 26 14:38:53 2002 +0000
     3.3 @@ -304,7 +304,7 @@
     3.4    DFBCardCapabilities    caps;
     3.5    IDirectFBDisplayLayer *layer;
     3.6    DFBDisplayLayerConfig  dlc;
     3.7 -  IDirectFBInputBuffer  *inputbuffer;
     3.8 +  IDirectFBEventBuffer  *eventbuffer;
     3.9  
    3.10  
    3.11    ret = DirectFBInit (NULL, NULL);
    3.12 @@ -329,11 +329,10 @@
    3.13        return -1;
    3.14      }
    3.15  
    3.16 -  ret = dfb->CreateInputBuffer (dfb, DICAPS_BUTTONS | DICAPS_AXIS | DICAPS_KEYS,
    3.17 -                                &inputbuffer);
    3.18 +  ret = dfb->CreateEventBuffer (dfb, DICAPS_ALL, &eventbuffer);
    3.19    if (ret)
    3.20      {
    3.21 -      SetDirectFBerror ("dfb->CreateInputBuffer", ret);
    3.22 +      SetDirectFBerror ("dfb->CreateEventBuffer", ret);
    3.23        layer->Release (layer);
    3.24        dfb->Release (dfb);
    3.25        return -1;
    3.26 @@ -395,7 +394,7 @@
    3.27    HIDDEN->initialized = 1;
    3.28    HIDDEN->dfb         = dfb;
    3.29    HIDDEN->layer       = layer;
    3.30 -  HIDDEN->inputbuffer = inputbuffer;
    3.31 +  HIDDEN->eventbuffer = eventbuffer;
    3.32  
    3.33    return 0;
    3.34  }
    3.35 @@ -691,34 +690,48 @@
    3.36  
    3.37  static void DirectFB_WindowedUpdate(_THIS, int numrects, SDL_Rect *rects)
    3.38  {
    3.39 +  DFBRegion         region;
    3.40 +  int               i;
    3.41 +  int               region_valid = 0;
    3.42    IDirectFBSurface *surface = this->screen->hwdata->surface;
    3.43 -  DFBRegion region = { rects->x, rects->y,
    3.44 -                       rects->x + rects->w - 1,
    3.45 -                       rects->y + rects->h - 1 };
    3.46  
    3.47 -  while (--numrects)
    3.48 +  for (i=0; i<numrects; ++i)
    3.49      {
    3.50        int x2, y2;
    3.51  
    3.52 -      rects++;
    3.53 +      if ( ! rects[i].w ) /* Clipped? */
    3.54 +        continue;
    3.55  
    3.56 -      if (rects->x < region.x1)
    3.57 -        region.x1 = rects->x;
    3.58 +      x2 = rects[i].x + rects[i].w - 1;
    3.59 +      y2 = rects[i].y + rects[i].h - 1;
    3.60  
    3.61 -      if (rects->y < region.y1)
    3.62 -        region.y1 = rects->y;
    3.63 +      if (region_valid)
    3.64 +        {
    3.65 +          if (rects[i].x < region.x1)
    3.66 +            region.x1 = rects[i].x;
    3.67  
    3.68 -      x2 = rects->x + rects->w - 1;
    3.69 -      y2 = rects->y + rects->h - 1;
    3.70 +          if (rects[i].y < region.y1)
    3.71 +            region.y1 = rects[i].y;
    3.72  
    3.73 -      if (x2 > region.x2)
    3.74 -        region.x2 = x2;
    3.75 +          if (x2 > region.x2)
    3.76 +            region.x2 = x2;
    3.77  
    3.78 -      if (y2 > region.y2)
    3.79 -        region.y2 = y2;
    3.80 +          if (y2 > region.y2)
    3.81 +            region.y2 = y2;
    3.82 +        }
    3.83 +      else
    3.84 +        {
    3.85 +            region.x1 = rects[i].x;
    3.86 +            region.y1 = rects[i].y;
    3.87 +            region.x2 = x2;
    3.88 +            region.y2 = y2;
    3.89 +
    3.90 +            region_valid = 1;
    3.91 +        }
    3.92      }
    3.93  
    3.94 -  surface->Flip (surface, &region, DSFLIP_WAITFORSYNC);
    3.95 +  if (region_valid)
    3.96 +    surface->Flip (surface, &region, DSFLIP_WAITFORSYNC);
    3.97  }
    3.98  
    3.99  int DirectFB_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
   3.100 @@ -731,7 +744,7 @@
   3.101  {
   3.102    int i, j;
   3.103  
   3.104 -  HIDDEN->inputbuffer->Release (HIDDEN->inputbuffer);
   3.105 +  HIDDEN->eventbuffer->Release (HIDDEN->eventbuffer);
   3.106    HIDDEN->layer->Release (HIDDEN->layer);
   3.107    HIDDEN->dfb->Release (HIDDEN->dfb);
   3.108  
     4.1 --- a/src/video/directfb/SDL_DirectFB_video.h	Fri Feb 22 17:39:11 2002 +0000
     4.2 +++ b/src/video/directfb/SDL_DirectFB_video.h	Tue Feb 26 14:38:53 2002 +0000
     4.3 @@ -43,7 +43,7 @@
     4.4  
     4.5    IDirectFB             *dfb;
     4.6    IDirectFBDisplayLayer *layer;
     4.7 -  IDirectFBInputBuffer  *inputbuffer;
     4.8 +  IDirectFBEventBuffer  *eventbuffer;
     4.9  
    4.10  #define NUM_MODELISTS	4		/* 8, 16, 24, and 32 bits-per-pixel */
    4.11    int SDL_nummodes[NUM_MODELISTS];