Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
169 lines (134 loc) · 5.61 KB

SDL_DirectFB_video.h

File metadata and controls

169 lines (134 loc) · 5.61 KB
 
1
2
/*
SDL - Simple DirectMedia Layer
Jan 24, 2010
Jan 24, 2010
3
Copyright (C) 1997-2010 Sam Lantinga
4
5
This library is free software; you can redistribute it and/or
Feb 1, 2006
Feb 1, 2006
6
modify it under the terms of the GNU Lesser General Public
7
License as published by the Free Software Foundation; either
Feb 1, 2006
Feb 1, 2006
8
version 2.1 of the License, or (at your option) any later version.
9
10
11
12
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
Feb 1, 2006
Feb 1, 2006
13
Lesser General Public License for more details.
Feb 1, 2006
Feb 1, 2006
15
16
17
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
18
19
Sam Lantinga
Dec 14, 2001
Dec 14, 2001
20
slouken@libsdl.org
Feb 21, 2006
Feb 21, 2006
22
#include "SDL_config.h"
23
24
25
26
#ifndef _SDL_DirectFB_video_h
#define _SDL_DirectFB_video_h
Aug 31, 2008
Aug 31, 2008
27
28
#include "../SDL_sysvideo.h"
29
#include <directfb.h>
Aug 11, 2007
Aug 11, 2007
30
31
#include <directfb_version.h>
Aug 31, 2008
Aug 31, 2008
32
33
#include "SDL_mouse.h"
Jul 24, 2010
Jul 24, 2010
34
35
36
37
38
39
40
41
/* Set below to 1 to compile with (old) multi mice/keyboard api. Code left in
* in case we see this again ...
*/
#define USE_MULTI_API (0)
#define DEBUG 1
Aug 11, 2007
Aug 11, 2007
42
43
#define LOG_CHANNEL stdout
Jan 13, 2009
Jan 13, 2009
44
45
46
47
48
49
50
51
#define DFB_VERSIONNUM(X, Y, Z) \
((X)*1000 + (Y)*100 + (Z))
#define DFB_COMPILEDVERSION \
DFB_VERSIONNUM(DIRECTFB_MAJOR_VERSION, DIRECTFB_MINOR_VERSION, DIRECTFB_MICRO_VERSION)
#define DFB_VERSION_ATLEAST(X, Y, Z) \
(DFB_COMPILEDVERSION >= DFB_VERSIONNUM(X, Y, Z))
Aug 11, 2007
Aug 11, 2007
52
Jan 13, 2009
Jan 13, 2009
53
#if (DFB_VERSION_ATLEAST(1,0,0))
Jan 14, 2009
Jan 14, 2009
54
55
#define SDL_DIRECTFB_OPENGL 1
#include <directfbgl.h>
Jan 13, 2009
Jan 13, 2009
56
#else
Jan 14, 2009
Jan 14, 2009
57
#error "SDL_DIRECTFB: Please compile against libdirectfb version >= 1.0.0"
Aug 11, 2007
Aug 11, 2007
58
59
60
61
62
#endif
#if SDL_DIRECTFB_OPENGL
#include "SDL_loadso.h"
#endif
Aug 31, 2008
Aug 31, 2008
64
65
66
67
68
69
70
71
72
#include "SDL_DirectFB_events.h"
/*
* #include "SDL_DirectFB_gamma.h"
* #include "SDL_DirectFB_keyboard.h"
*/
#include "SDL_DirectFB_modes.h"
#include "SDL_DirectFB_mouse.h"
#include "SDL_DirectFB_opengl.h"
#include "SDL_DirectFB_window.h"
Jan 11, 2009
Jan 11, 2009
73
#include "SDL_DirectFB_WM.h"
Jan 4, 2009
Jan 4, 2009
75
76
77
78
#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_X11_CHECK "SDL_DIRECTFB_X11_CHECK" /* Default: on */
#define DFBENV_USE_LINUX_INPUT "SDL_DIRECTFB_LINUX_INPUT" /* Default: on */
Jan 14, 2009
Jan 14, 2009
79
#define DFBENV_USE_WM "SDL_DIRECTFB_WM" /* Default: off */
Aug 11, 2007
Aug 11, 2007
80
Jan 13, 2009
Jan 13, 2009
81
82
83
#define SDL_DFB_RELEASE(x) do { if ( (x) != NULL ) { x->Release(x); x = NULL; } } while (0)
#define SDL_DFB_FREE(x) do { if ( (x) != NULL ) { SDL_free(x); x = NULL; } } while (0)
#define SDL_DFB_UNLOCK(x) do { if ( (x) != NULL ) { x->Unlock(x); } } while (0)
Aug 11, 2007
Aug 11, 2007
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#if DEBUG
#define SDL_DFB_DEBUG(x...) do { fprintf(LOG_CHANNEL, "%s:", __FUNCTION__); fprintf(LOG_CHANNEL, x); } while (0)
#define SDL_DFB_DEBUGC(x...) do { fprintf(LOG_CHANNEL, x); } while (0)
#else
#define SDL_DFB_DEBUG(x...) do { } while (0)
#define SDL_DFB_DEBUGC(x...) do { } while (0)
#endif
#define SDL_DFB_CONTEXT "SDL_DirectFB"
#define SDL_DFB_ERR(x...) \
do { \
fprintf(LOG_CHANNEL, "%s: %s <%d>:\n\t", \
SDL_DFB_CONTEXT, __FILE__, __LINE__ ); \
fprintf(LOG_CHANNEL, x ); \
} while (0)
#define SDL_DFB_CHECK(x...) \
do { \
ret = x; \
if (ret != DFB_OK) { \
fprintf(LOG_CHANNEL, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
Jan 11, 2009
Jan 11, 2009
107
108
fprintf(LOG_CHANNEL, "\t%s\n", #x ); \
fprintf(LOG_CHANNEL, "\t%s\n", DirectFBErrorString (ret) ); \
Aug 11, 2007
Aug 11, 2007
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
SDL_SetError( #x, DirectFBErrorString (ret) ); \
} \
} while (0)
#define SDL_DFB_CHECKERR(x...) \
do { \
ret = x; \
if (ret != DFB_OK) { \
fprintf(LOG_CHANNEL, "%s <%d>:\n", __FILE__, __LINE__ ); \
fprintf(LOG_CHANNEL, "\t%s\n", #x ); \
fprintf(LOG_CHANNEL, "\t%s\n", DirectFBErrorString (ret) ); \
SDL_SetError( #x, DirectFBErrorString (ret) ); \
goto error; \
} \
} while (0)
#define SDL_DFB_CALLOC(r, n, s) \
do { \
r = SDL_calloc (n, s); \
if (!(r)) { \
fprintf( LOG_CHANNEL, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
SDL_OutOfMemory(); \
goto error; \
} \
} while (0)
134
135
136
/* Private display data */
Jan 11, 2009
Jan 11, 2009
137
#define SDL_DFB_DEVICEDATA(dev) DFB_DeviceData *devdata = (dev ? (DFB_DeviceData *) ((dev)->driverdata) : NULL)
Aug 11, 2007
Aug 11, 2007
138
139
140
141
142
#define DFB_MAX_SCREENS 10
typedef struct _DFB_DeviceData DFB_DeviceData;
struct _DFB_DeviceData
Jul 10, 2006
Jul 10, 2006
144
145
146
int initialized;
IDirectFB *dfb;
Dec 8, 2008
Dec 8, 2008
147
148
149
150
151
152
153
154
int num_mice;
int mouse_id[0x100];
int num_keyboard;
struct
{
int is_generic;
int id;
} keyboard[10];
Aug 11, 2007
Aug 11, 2007
155
DFB_WindowData *firstwin;
Jul 10, 2006
Jul 10, 2006
156
Aug 31, 2008
Aug 31, 2008
157
int use_yuv_underlays;
Jan 4, 2009
Jan 4, 2009
158
int use_linux_input;
Jan 11, 2009
Jan 11, 2009
159
int has_own_wm;
Aug 11, 2007
Aug 11, 2007
160
Aug 26, 2008
Aug 26, 2008
161
/* OpenGL */
Aug 11, 2007
Aug 11, 2007
162
163
void (*glFinish) (void);
void (*glFlush) (void);
Aug 31, 2008
Aug 31, 2008
165
166
/* global events */
IDirectFBEventBuffer *events;
Aug 11, 2007
Aug 11, 2007
167
};
Aug 31, 2002
Aug 31, 2002
168
169
#endif /* _SDL_DirectFB_video_h */