2001-09-04 22:53:46 +00:00
|
|
|
/*
|
|
|
|
SDL - Simple DirectMedia Layer
|
2008-12-08 00:27:32 +00:00
|
|
|
Copyright (C) 1997-2009 Sam Lantinga
|
2001-09-04 22:53:46 +00:00
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
2006-02-01 06:32:25 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
2001-09-04 22:53:46 +00:00
|
|
|
License as published by the Free Software Foundation; either
|
2006-02-01 06:32:25 +00:00
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
2001-09-04 22:53:46 +00:00
|
|
|
|
|
|
|
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
|
2006-02-01 06:32:25 +00:00
|
|
|
Lesser General Public License for more details.
|
2001-09-04 22:53:46 +00:00
|
|
|
|
2006-02-01 06:32:25 +00:00
|
|
|
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
|
2001-09-04 22:53:46 +00:00
|
|
|
|
|
|
|
Sam Lantinga
|
2001-12-14 12:38:15 +00:00
|
|
|
slouken@libsdl.org
|
2001-09-04 22:53:46 +00:00
|
|
|
*/
|
2006-02-21 08:46:50 +00:00
|
|
|
#include "SDL_config.h"
|
2001-09-04 22:53:46 +00:00
|
|
|
|
|
|
|
#ifndef _SDL_DirectFB_video_h
|
|
|
|
#define _SDL_DirectFB_video_h
|
|
|
|
|
2008-08-31 16:04:32 +00:00
|
|
|
#include "../SDL_sysvideo.h"
|
|
|
|
|
2001-09-04 22:53:46 +00:00
|
|
|
#include <directfb.h>
|
2007-08-11 21:51:19 +00:00
|
|
|
#include <directfb_version.h>
|
|
|
|
|
2008-08-31 16:04:32 +00:00
|
|
|
#include "SDL_mouse.h"
|
|
|
|
|
|
|
|
#define DEBUG 0
|
2007-08-11 21:51:19 +00:00
|
|
|
#define LOG_CHANNEL stdout
|
|
|
|
|
|
|
|
#if (DIRECTFB_MAJOR_VERSION == 0) && (DIRECTFB_MINOR_VERSION == 9) && (DIRECTFB_MICRO_VERSION < 23)
|
|
|
|
#error "SDL_DIRECTFB: Please compile against libdirectfb version >=0.9.24"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (DIRECTFB_MAJOR_VERSION >= 1) && (DIRECTFB_MINOR_VERSION >= 0) && (DIRECTFB_MICRO_VERSION >= 0 )
|
|
|
|
#define SDL_DIRECTFB_OPENGL 1
|
|
|
|
#include <directfbgl.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if SDL_DIRECTFB_OPENGL
|
|
|
|
#include "SDL_loadso.h"
|
|
|
|
#endif
|
2001-09-04 22:53:46 +00:00
|
|
|
|
2008-08-31 16:04:32 +00:00
|
|
|
#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"
|
2001-09-04 22:53:46 +00:00
|
|
|
|
2009-01-04 23:43:33 +00:00
|
|
|
#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 */
|
2007-08-11 21:51:19 +00:00
|
|
|
|
|
|
|
#define SDL_DFB_RELEASE(x) do { if ( x ) { x->Release(x); x = NULL; } } while (0)
|
|
|
|
#define SDL_DFB_FREE(x) do { if ( x ) { SDL_free(x); x = NULL; } } while (0)
|
|
|
|
#define SDL_DFB_UNLOCK(x) do { if ( x ) { x->Unlock(x); } } while (0)
|
|
|
|
|
|
|
|
#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__ ); \
|
|
|
|
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)
|
2001-09-04 22:53:46 +00:00
|
|
|
|
|
|
|
/* Private display data */
|
|
|
|
|
2007-08-11 21:51:19 +00:00
|
|
|
#define SDL_DFB_DEVICEDATA(dev) DFB_DeviceData *devdata = (DFB_DeviceData *) ((dev)->driverdata)
|
|
|
|
|
|
|
|
#define DFB_MAX_SCREENS 10
|
|
|
|
|
|
|
|
typedef struct _DFB_DeviceData DFB_DeviceData;
|
|
|
|
struct _DFB_DeviceData
|
2001-09-04 22:53:46 +00:00
|
|
|
{
|
2006-07-10 21:04:37 +00:00
|
|
|
int initialized;
|
|
|
|
|
|
|
|
IDirectFB *dfb;
|
2008-12-08 00:52:12 +00:00
|
|
|
int num_mice;
|
|
|
|
int mouse_id[0x100];
|
|
|
|
int num_keyboard;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
int is_generic;
|
|
|
|
int id;
|
|
|
|
} keyboard[10];
|
2007-08-11 21:51:19 +00:00
|
|
|
DFB_WindowData *firstwin;
|
2006-07-10 21:04:37 +00:00
|
|
|
|
2008-08-31 16:04:32 +00:00
|
|
|
int use_yuv_underlays;
|
2009-01-04 23:43:33 +00:00
|
|
|
int use_linux_input;
|
2007-08-11 21:51:19 +00:00
|
|
|
|
2008-08-26 02:32:45 +00:00
|
|
|
/* OpenGL */
|
2007-08-11 21:51:19 +00:00
|
|
|
void (*glFinish) (void);
|
|
|
|
void (*glFlush) (void);
|
2001-09-04 22:53:46 +00:00
|
|
|
|
2008-08-31 16:04:32 +00:00
|
|
|
/* global events */
|
|
|
|
IDirectFBEventBuffer *events;
|
2007-08-11 21:51:19 +00:00
|
|
|
};
|
2002-08-31 04:13:28 +00:00
|
|
|
|
2001-09-04 22:53:46 +00:00
|
|
|
#endif /* _SDL_DirectFB_video_h */
|