Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Updated the DirectFB support, from Couriersud

attached is a working directfb driver diff which works with the current
changes. There are a number of changes around it as well, e.g.
configure.in.

The directfb renderdriver right now still depends on a some "includes"
from src/video/directfb. That's why it is not yet moved to the new
render folder.
  • Loading branch information
slouken committed Feb 6, 2011
1 parent 4779d6b commit 8938cbf2a03704a76bea6d034b473962734080aa
@@ -71,9 +71,9 @@ works at least on all directfb supported platforms.
As of this writing 20100802 you need to pull Mesa from git and do the following:

------------------------
git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a
cd mesa
git clone git://anongit.freedesktop.org/git/mesa/mesa
cd mesa
git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a
------------------------

Edit configs/linux-directfb so that the Directories-section looks like
@@ -1312,8 +1312,7 @@ AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=n
video_directfb=no

DIRECTFB_REQUIRED_VERSION=1.0.0

AC_PATH_PROG(DIRECTFBCONFIG, directfb-config, no)
AC_PATH_PROGS(DIRECTFBCONFIG, directfb-config, no, [$prefix/bin:$PATH])
if test x$DIRECTFBCONFIG = xno; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if test x$PKG_CONFIG != xno; then
@@ -1353,13 +1352,15 @@ AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[
, enable_directfb_shared=yes)

AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB)
AC_DEFINE(SDL_VIDEO_RENDER_DIRECTFB)
SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"

AC_MSG_CHECKING(for directfb dynamic loading support)
directfb_shared=no
directfb_lib=[`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]

directfb_lib=[`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS"`]
# | sed 's/.*\/\(.*\)/\1/; q'`]
AC_MSG_WARN("directfb $directfb_lib")
if test x$have_loadso != xyes && \
test x$enable_directfb_shared = xyes; then
AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
@@ -279,6 +279,7 @@
#undef SDL_VIDEO_RENDER_D3D
#undef SDL_VIDEO_RENDER_OGL
#undef SDL_VIDEO_RENDER_OGL_ES
#undef SDL_VIDEO_RENDER_DIRECTFB

/* Enable OpenGL support */
#undef SDL_VIDEO_OPENGL
@@ -77,7 +77,7 @@ struct SDL_SysWMinfo;
#endif /* defined(SDL_VIDEO_DRIVER_X11) */

#if defined(SDL_VIDEO_DRIVER_DIRECTFB)
#include <directfb/directfb.h>
#include <directfb.h>
#endif

#if defined(SDL_VIDEO_DRIVER_COCOA)
@@ -52,6 +52,9 @@ static const SDL_RenderDriver *render_drivers[] = {
#endif
#if SDL_VIDEO_RENDER_OGL_ES
&GL_ES_RenderDriver,
#endif
#if SDL_VIDEO_RENDER_DIRECTFB
&DirectFB_RenderDriver,
#endif
&SW_RenderDriver
};
@@ -127,6 +127,9 @@ extern SDL_RenderDriver GL_RenderDriver;
#if SDL_VIDEO_RENDER_OGL_ES
extern SDL_RenderDriver GL_ES_RenderDriver;
#endif
#if SDL_VIDEO_RENDER_DIRECTFB
extern SDL_RenderDriver DirectFB_RenderDriver;
#endif
extern SDL_RenderDriver SW_RenderDriver;

#endif /* _SDL_sysrender_h */
@@ -18,14 +18,13 @@
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
//#include "SDL_syswm.h"
//#include "../SDL_sysvideo.h"
//#include "../../events/SDL_keyboard_c.h"
SDL1.3 DirectFB driver by couriersud@arcor.de
*/

#include "SDL_DirectFB_video.h"
#include "SDL_DirectFB_window.h"

#include "../../events/SDL_windowevents_c.h"

@@ -127,6 +126,11 @@ DirectFB_WM_RedrawLayout(_THIS, SDL_Window * window)
if (!windata->is_managed || (window->flags & SDL_WINDOW_FULLSCREEN))
return;

SDL_DFB_CHECK(s->SetSrcBlendFunction(s, DSBF_ONE));
SDL_DFB_CHECK(s->SetDstBlendFunction(s, DSBF_ZERO));
SDL_DFB_CHECK(s->SetDrawingFlags(s, DSDRAW_NOFX));
SDL_DFB_CHECK(s->SetBlittingFlags(s, DSBLIT_NOFX));

LoadFont(_this, window);
//s->SetDrawingFlags(s, DSDRAW_BLEND);
s->SetColor(s, COLOR_EXPAND(t->frame_color));
@@ -181,8 +185,10 @@ DFBResult
DirectFB_WM_GetClientSize(_THIS, SDL_Window * window, int *cw, int *ch)
{
SDL_DFB_WINDOWDATA(window);
IDirectFBWindow *dfbwin = windata->dfbwin;

SDL_DFB_CHECK(windata->window->GetSize(windata->window, cw, ch));
SDL_DFB_CHECK(dfbwin->GetSize(dfbwin, cw, ch));
dfbwin->GetSize(dfbwin, cw, ch);
*cw -= windata->theme.left_size + windata->theme.right_size;
*ch -=
windata->theme.top_size + windata->theme.caption_size +
@@ -197,6 +203,9 @@ DirectFB_WM_AdjustWindowLayout(SDL_Window * window, int flags, int w, int h)

if (!windata->is_managed)
windata->theme = theme_none;
else if (flags & SDL_WINDOW_BORDERLESS)
//desc.caps |= DWCAPS_NODECORATION;)
windata->theme = theme_none;
else if (flags & SDL_WINDOW_FULLSCREEN) {
windata->theme = theme_none;
} else if (flags & SDL_WINDOW_MAXIMIZED) {
@@ -220,37 +229,6 @@ DirectFB_WM_AdjustWindowLayout(SDL_Window * window, int flags, int w, int h)
windata->theme.caption_size + windata->theme.bottom_size;
}

void
DirectFB_WM_MaximizeWindow(_THIS, SDL_Window * window)
{
SDL_DFB_WINDOWDATA(window);
SDL_VideoDisplay *display = window->display;

SDL_DFB_CHECK(windata->window->GetPosition(windata->window,
&windata->restore.x, &windata->restore.y));
SDL_DFB_CHECK(windata->window->GetSize(windata->window, &windata->restore.w,
&windata->restore.h));

DirectFB_WM_AdjustWindowLayout(window, window->flags | SDL_WINDOW_MAXIMIZED, display->current_mode.w, display->current_mode.h) ;

SDL_DFB_CHECK(windata->window->MoveTo(windata->window, 0, 0));
SDL_DFB_CHECK(windata->window->Resize(windata->window,
display->current_mode.w, display->current_mode.h));
}

void
DirectFB_WM_RestoreWindow(_THIS, SDL_Window * window)
{
SDL_DFB_WINDOWDATA(window);

DirectFB_WM_AdjustWindowLayout(window, window->flags & ~(SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED),
windata->restore.w, windata->restore.h);

SDL_DFB_CHECK(windata->window->Resize(windata->window, windata->restore.w,
windata->restore.h));
SDL_DFB_CHECK(windata->window->MoveTo(windata->window, windata->restore.x,
windata->restore.y));
}

enum
{
@@ -307,20 +285,20 @@ WMPos(DFB_WindowData * p, int x, int y)
return pos;
}

static int wm_grab;
static int wm_lastx;
static int wm_lasty;

int
DirectFB_WM_ProcessEvent(_THIS, SDL_Window * window, DFBWindowEvent * evt)
{
SDL_DFB_DEVICEDATA(_this);
SDL_DFB_WINDOWDATA(window);
DFB_WindowData *gwindata = ((devdata->grabbed_window) ? (DFB_WindowData *) ((devdata->grabbed_window)->driverdata) : NULL);
IDirectFBWindow *dfbwin = windata->dfbwin;
DFBWindowOptions wopts;

if (!windata->is_managed)
return 0;

SDL_DFB_CHECK(dfbwin->GetOptions(dfbwin, &wopts));

switch (evt->type) {
case DWET_BUTTONDOWN:
if (evt->buttons & DIBM_LEFT) {
@@ -329,59 +307,99 @@ DirectFB_WM_ProcessEvent(_THIS, SDL_Window * window, DFBWindowEvent * evt)
case WM_POS_NONE:
return 0;
case WM_POS_CLOSE:
wm_grab = WM_POS_NONE;
windata->wm_grab = WM_POS_NONE;
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_CLOSE, 0,
0);
return 1;
case WM_POS_MAX:
wm_grab = WM_POS_NONE;
if (window->flags & SDL_WINDOW_MAXIMIZED) {
SDL_RestoreWindow(window);
} else {
SDL_MaximizeWindow(window);
}
windata->wm_grab = WM_POS_NONE;
if (window->flags & SDL_WINDOW_MAXIMIZED) {
SDL_RestoreWindow(window);
} else {
SDL_MaximizeWindow(window);
}
return 1;
case WM_POS_CAPTION:
DirectFB_RaiseWindow(_this, window);
if (!(wopts & DWOP_KEEP_STACKING)) {
DirectFB_RaiseWindow(_this, window);
}
if (window->flags & SDL_WINDOW_MAXIMIZED)
return 1;
/* fall through */
default:
wm_grab = pos;
windata->wm_grab = pos;
if (gwindata != NULL)
SDL_DFB_CHECK(gwindata->window->UngrabPointer(gwindata->window));
SDL_DFB_CHECK(windata->window->GrabPointer(windata->window));
wm_lastx = evt->cx;
wm_lasty = evt->cy;
SDL_DFB_CHECK(gwindata->dfbwin->UngrabPointer(gwindata->dfbwin));
SDL_DFB_CHECK(dfbwin->GrabPointer(dfbwin));
windata->wm_lastx = evt->cx;
windata->wm_lasty = evt->cy;
}
}
return 1;
case DWET_BUTTONUP:
if (!windata->wm_grab)
return 0;
if (!(evt->buttons & DIBM_LEFT)) {
if (windata->wm_grab & (WM_POS_RIGHT | WM_POS_BOTTOM)) {
int dx = evt->cx - windata->wm_lastx;
int dy = evt->cy - windata->wm_lasty;

if (!(wopts & DWOP_KEEP_SIZE)) {
int cw, ch;
if ((windata->wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_BOTTOM)
dx = 0;
else if ((windata->wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_RIGHT)
dy = 0;
SDL_DFB_CHECK(dfbwin->GetSize(dfbwin, &cw, &ch));

/* necessary to trigger an event - ugly*/
SDL_DFB_CHECK(dfbwin->DisableEvents(dfbwin, DWET_ALL));
SDL_DFB_CHECK(dfbwin->Resize(dfbwin, cw + dx + 1, ch + dy));
SDL_DFB_CHECK(dfbwin->EnableEvents(dfbwin, DWET_ALL));

SDL_DFB_CHECK(dfbwin->Resize(dfbwin, cw + dx, ch + dy));
}
}
SDL_DFB_CHECK(dfbwin->UngrabPointer(dfbwin));
if (gwindata != NULL)
SDL_DFB_CHECK(gwindata->dfbwin->GrabPointer(gwindata->dfbwin));
windata->wm_grab = WM_POS_NONE;
return 1;
}
break;
case DWET_MOTION:
if (!wm_grab)
if (!windata->wm_grab)
return 0;
if (evt->buttons & DIBM_LEFT) {
int dx = evt->cx - wm_lastx;
int dy = evt->cy - wm_lasty;
int cw, ch;

if (wm_grab & WM_POS_CAPTION)
SDL_DFB_CHECK(windata->window->Move(windata->window, dx, dy));
if (wm_grab & (WM_POS_RIGHT | WM_POS_BOTTOM)) {
if ((wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_BOTTOM)
dx = 0;
else if ((wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_RIGHT)
dy = 0;
SDL_DFB_CHECK(windata->window->GetSize(windata->window, &cw, &ch));
SDL_DFB_CHECK(windata->window->Resize(windata->window, cw + dx, ch + dy));
int dx = evt->cx - windata->wm_lastx;
int dy = evt->cy - windata->wm_lasty;

if (windata->wm_grab & WM_POS_CAPTION) {
if (!(wopts & DWOP_KEEP_POSITION))
SDL_DFB_CHECK(dfbwin->Move(dfbwin, dx, dy));
}
wm_lastx = evt->cx;
wm_lasty = evt->cy;
return 1;
if (windata->wm_grab & (WM_POS_RIGHT | WM_POS_BOTTOM)) {
if (!(wopts & DWOP_KEEP_SIZE)) {
int cw, ch;

/* Make sure all events are disabled for this operation ! */
SDL_DFB_CHECK(dfbwin->DisableEvents(dfbwin, DWET_ALL));

if ((windata->wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_BOTTOM)
dx = 0;
else if ((windata->wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_RIGHT)
dy = 0;

SDL_DFB_CHECK(dfbwin->GetSize(dfbwin, &cw, &ch));
SDL_DFB_CHECK(dfbwin->Resize(dfbwin, cw + dx, ch + dy));

SDL_DFB_CHECK(dfbwin->EnableEvents(dfbwin, DWET_ALL));
}
}
windata->wm_lastx = evt->cx;
windata->wm_lasty = evt->cy;
return 1;
}
SDL_DFB_CHECK(windata->window->UngrabPointer(windata->window));
if (gwindata != NULL)
SDL_DFB_CHECK(gwindata->window->GrabPointer(gwindata->window));
wm_grab = WM_POS_NONE;
break;
case DWET_KEYDOWN:
break;
@@ -392,3 +410,4 @@ DirectFB_WM_ProcessEvent(_THIS, SDL_Window * window, DFBWindowEvent * evt)
}
return 0;
}

@@ -18,12 +18,16 @@
Sam Lantinga
slouken@libsdl.org
SDL1.3 DirectFB driver by couriersud@arcor.de
*/
#include "SDL_config.h"

#ifndef _SDL_directfb_wm_h
#define _SDL_directfb_wm_h

#include "SDL_DirectFB_video.h"

typedef struct _DFB_Theme DFB_Theme;
struct _DFB_Theme
{
@@ -42,8 +46,6 @@ struct _DFB_Theme
};

extern void DirectFB_WM_AdjustWindowLayout(SDL_Window * window, int flags, int w, int h);
extern void DirectFB_WM_MaximizeWindow(_THIS, SDL_Window * window);
extern void DirectFB_WM_RestoreWindow(_THIS, SDL_Window * window);
extern void DirectFB_WM_RedrawLayout(_THIS, SDL_Window * window);

extern int DirectFB_WM_ProcessEvent(_THIS, SDL_Window * window,
@@ -18,7 +18,11 @@
Sam Lantinga
slouken@libsdl.org
SDL1.3 DirectFB driver by couriersud@arcor.de
*/

#include "SDL_config.h"

#include "SDL_DirectFB_video.h"
@@ -41,6 +45,7 @@ static struct _SDL_DirectFB_Symbols
#define DFB_SYM(ret, name, args, al, func) ret name args { func SDL_DirectFB_Symbols.name al ; }
DFB_SYMS
#undef DFB_SYM

static void *handle = NULL;

int
@@ -55,7 +60,7 @@ SDL_DirectFB_LoadLibrary(void)
#define DFB_SYM(ret, name, args, al, func) if (!(SDL_DirectFB_Symbols.name = SDL_LoadFunction(handle, # name))) retval = 0;
DFB_SYMS
#undef DFB_SYM
if (!
if (!
(SDL_DirectFB_Symbols.directfb_major_version =
SDL_LoadFunction(handle, "directfb_major_version")))
retval = 0;

0 comments on commit 8938cbf

Please sign in to comment.