Date: Mon, 17 Nov 2003 21:59:24 -0800
authorSam Lantinga <slouken@libsdl.org>
Sun, 04 Jan 2004 15:57:16 +0000
changeset 767d9e79e31a7b7
parent 766 ed57c876700d
child 768 de1b2c3063b9
Date: Mon, 17 Nov 2003 21:59:24 -0800
From: Pete Shinners
Subject: [SDL] directfb cursor patch

here is a quick and dirty patch that allows directfb to change the
visibility of the cursor. this display backend still has no way to change
the actual cursor shape, but being able to set the cursor visibility is a
simple change that should offer some benefits.

the code was largely based on the cursor code for other sdl backends. and
this documentation.
http://directfb.org/documentation/DirectFB_Reference/IDirectFBDisplayLayer_SetCursorOpacity.html
src/video/directfb/SDL_DirectFB_video.c
     1.1 --- a/src/video/directfb/SDL_DirectFB_video.c	Sun Jan 04 15:48:44 2004 +0000
     1.2 +++ b/src/video/directfb/SDL_DirectFB_video.c	Sun Jan 04 15:57:16 2004 +0000
     1.3 @@ -52,6 +52,11 @@
     1.4  #include "SDL_DirectFB_events.h"
     1.5  #include "SDL_DirectFB_yuv.h"
     1.6  
     1.7 +/* The implementation dependent data for the window manager cursor */
     1.8 +struct WMcursor {
     1.9 +	int unused;
    1.10 +};
    1.11 +
    1.12  
    1.13  /* Initialization/Query functions */
    1.14  static int DirectFB_VideoInit(_THIS, SDL_PixelFormat *vformat);
    1.15 @@ -73,6 +78,7 @@
    1.16  static int DirectFB_SetHWColorKey(_THIS, SDL_Surface *surface, Uint32 key);
    1.17  static int DirectFB_SetHWAlpha(_THIS, SDL_Surface *surface, Uint8 alpha);
    1.18  static int DirectFB_FlipHWSurface(_THIS, SDL_Surface *surface);
    1.19 +static int DirectFB_ShowWMCursor(_THIS, WMcursor *cursor);
    1.20  
    1.21  /* Various screen update functions available */
    1.22  static void DirectFB_DirectUpdate(_THIS, int numrects, SDL_Rect *rects);
    1.23 @@ -139,6 +145,7 @@
    1.24    device->UnlockHWSurface = DirectFB_UnlockHWSurface;
    1.25    device->FlipHWSurface = DirectFB_FlipHWSurface;
    1.26    device->FreeHWSurface = DirectFB_FreeHWSurface;
    1.27 +  device->ShowWMCursor = DirectFB_ShowWMCursor;
    1.28    device->SetCaption = NULL;
    1.29    device->SetIcon = NULL;
    1.30    device->IconifyWindow = NULL;
    1.31 @@ -1143,6 +1150,21 @@
    1.32    HIDDEN->initialized = 0;
    1.33  }
    1.34  
    1.35 +
    1.36 +int DirectFB_ShowWMCursor(_THIS, WMcursor *cursor)
    1.37 +{
    1.38 +  /* We can only hide or show the default cursor */
    1.39 +  if ( cursor == NULL )
    1.40 +    {
    1.41 +      SetCursorOpacity(HIDDEN->layer, 0);
    1.42 +    }
    1.43 +    else
    1.44 +    {
    1.45 +      SetCursorOpacity(HIDDEN->layer, 256);
    1.46 +    }
    1.47 +  return 1;
    1.48 +}
    1.49 +
    1.50  void DirectFB_FinalQuit(void) 
    1.51  {
    1.52  }