comparison src/video/directfb/SDL_DirectFB_video.h @ 2737:140a7edcf2bd

Date: Sun, 31 Aug 2008 17:53:59 +0200 From: Couriersud Subject: Re: Updated DirectFB driver for SDL1.3 attached is a patch which brings the directfb driver in line with current svn. In addition: * driver now is in line with the structure of the X11 driver. This adds a couple of files. * driver now supports relative mouse movements
author Sam Lantinga <slouken@libsdl.org>
date Sun, 31 Aug 2008 16:04:32 +0000
parents e82a0e3e9b0e
children 99210400e8b9
comparison
equal deleted inserted replaced
2736:ae653575d4af 2737:140a7edcf2bd
22 #include "SDL_config.h" 22 #include "SDL_config.h"
23 23
24 #ifndef _SDL_DirectFB_video_h 24 #ifndef _SDL_DirectFB_video_h
25 #define _SDL_DirectFB_video_h 25 #define _SDL_DirectFB_video_h
26 26
27 #include "../SDL_sysvideo.h"
28
27 #include <directfb.h> 29 #include <directfb.h>
28 #include <directfb_version.h> 30 #include <directfb_version.h>
29 31
32 #include "SDL_mouse.h"
33
34 #define DEBUG 0
30 #define LOG_CHANNEL stdout 35 #define LOG_CHANNEL stdout
31 36
32 #if (DIRECTFB_MAJOR_VERSION == 0) && (DIRECTFB_MINOR_VERSION == 9) && (DIRECTFB_MICRO_VERSION < 23) 37 #if (DIRECTFB_MAJOR_VERSION == 0) && (DIRECTFB_MINOR_VERSION == 9) && (DIRECTFB_MICRO_VERSION < 23)
33 #error "SDL_DIRECTFB: Please compile against libdirectfb version >=0.9.24" 38 #error "SDL_DIRECTFB: Please compile against libdirectfb version >=0.9.24"
34 #endif 39 #endif
40 45
41 #if SDL_DIRECTFB_OPENGL 46 #if SDL_DIRECTFB_OPENGL
42 #include "SDL_loadso.h" 47 #include "SDL_loadso.h"
43 #endif 48 #endif
44 49
45 #include "SDL_mouse.h" 50 #include "SDL_DirectFB_events.h"
46 #include "../SDL_sysvideo.h" 51 /*
52 * #include "SDL_DirectFB_gamma.h"
53 * #include "SDL_DirectFB_keyboard.h"
54 */
55 #include "SDL_DirectFB_modes.h"
56 #include "SDL_DirectFB_mouse.h"
57 #include "SDL_DirectFB_opengl.h"
58 #include "SDL_DirectFB_window.h"
47 59
48 #define DEBUG 1 60 #define DFBENV_USE_YUV_UNDERLAY "SDL_DIRECTFB_YUV_UNDERLAY"
61 #define DFBENV_USE_YUV_DIRECT "SDL_DIRECTFB_YUV_DIRECT"
49 62
50 #define SDL_DFB_RELEASE(x) do { if ( x ) { x->Release(x); x = NULL; } } while (0) 63 #define SDL_DFB_RELEASE(x) do { if ( x ) { x->Release(x); x = NULL; } } while (0)
51 #define SDL_DFB_FREE(x) do { if ( x ) { SDL_free(x); x = NULL; } } while (0) 64 #define SDL_DFB_FREE(x) do { if ( x ) { SDL_free(x); x = NULL; } } while (0)
52 #define SDL_DFB_UNLOCK(x) do { if ( x ) { x->Unlock(x); } } while (0) 65 #define SDL_DFB_UNLOCK(x) do { if ( x ) { x->Unlock(x); } } while (0)
53 66
100 } while (0) 113 } while (0)
101 114
102 /* Private display data */ 115 /* Private display data */
103 116
104 #define SDL_DFB_DEVICEDATA(dev) DFB_DeviceData *devdata = (DFB_DeviceData *) ((dev)->driverdata) 117 #define SDL_DFB_DEVICEDATA(dev) DFB_DeviceData *devdata = (DFB_DeviceData *) ((dev)->driverdata)
105 #define SDL_DFB_WINDOWDATA(win) DFB_WindowData *windata = ((win) ? (DFB_WindowData *) ((win)->driverdata) : NULL)
106 #define SDL_DFB_DISPLAYDATA(dev, win) DFB_DisplayData *dispdata = ((win && dev) ? (DFB_DisplayData *) (dev)->displays[(win)->display].driverdata : NULL)
107
108 typedef struct _DFB_DisplayData DFB_DisplayData;
109 118
110 #define DFB_MAX_SCREENS 10 119 #define DFB_MAX_SCREENS 10
111 #define DFB_MAX_MODES 50
112
113 struct _DFB_DisplayData
114 {
115 IDirectFBDisplayLayer *layer;
116 DFBSurfacePixelFormat pixelformat;
117 //FIXME: support for multiple layer ...
118 DFBDisplayLayerID vidID;
119
120 int vidIDinuse;
121
122 int cw;
123 int ch;
124
125 int nummodes;
126 SDL_DisplayMode *modelist;
127
128 #if 0
129 WMcursor *last_cursor;
130 WMcursor *blank_cursor;
131 WMcursor *default_cursor;
132 #endif
133 };
134
135
136 typedef struct _DFB_WindowData DFB_WindowData;
137 struct _DFB_WindowData
138 {
139 IDirectFBSurface *surface;
140 IDirectFBPalette *palette;
141 IDirectFBWindow *window;
142 IDirectFBGL *gl_context;
143 IDirectFBEventBuffer *eventbuffer;
144 DFBWindowID windowID;
145 int id; /* SDL window id */
146 DFB_WindowData *next;
147 Uint8 opacity;
148 };
149 120
150 typedef struct _DFB_DeviceData DFB_DeviceData; 121 typedef struct _DFB_DeviceData DFB_DeviceData;
151 struct _DFB_DeviceData 122 struct _DFB_DeviceData
152 { 123 {
153 int initialized; 124 int initialized;
156 int mouse; 127 int mouse;
157 int keyboard; 128 int keyboard;
158 int kbdgeneric; 129 int kbdgeneric;
159 DFB_WindowData *firstwin; 130 DFB_WindowData *firstwin;
160 131
161 int numscreens; 132 int use_yuv_underlays;
162 DFBScreenID screenid[DFB_MAX_SCREENS];
163 DFBDisplayLayerID gralayer[DFB_MAX_SCREENS];
164 DFBDisplayLayerID vidlayer[DFB_MAX_SCREENS];
165
166 int aux; /* auxiliary integer for callbacks */
167 133
168 /* OpenGL */ 134 /* OpenGL */
169 void (*glFinish) (void); 135 void (*glFinish) (void);
170 void (*glFlush) (void); 136 void (*glFlush) (void);
171 };
172 137
173 struct SDL_GLDriverData 138 /* global events */
174 { 139 IDirectFBEventBuffer *events;
175 int gl_active; /* to stop switching drivers while we have a valid context */
176
177 #if SDL_DIRECTFB_OPENGL
178 IDirectFBGL *gl_context;
179 #endif /* SDL_DIRECTFB_OPENGL */
180 }; 140 };
181 141
182 #endif /* _SDL_DirectFB_video_h */ 142 #endif /* _SDL_DirectFB_video_h */