summaryrefslogtreecommitdiff
path: root/Source/DirectFB/systems/sdl
diff options
context:
space:
mode:
Diffstat (limited to 'Source/DirectFB/systems/sdl')
-rwxr-xr-xSource/DirectFB/systems/sdl/Makefile.am86
-rwxr-xr-xSource/DirectFB/systems/sdl/Makefile.in773
-rwxr-xr-xSource/DirectFB/systems/sdl/primary.c669
-rwxr-xr-xSource/DirectFB/systems/sdl/primary.h49
-rwxr-xr-xSource/DirectFB/systems/sdl/sdl.c396
-rwxr-xr-xSource/DirectFB/systems/sdl/sdl.h70
-rwxr-xr-xSource/DirectFB/systems/sdl/sdl_surface_pool.c349
-rwxr-xr-xSource/DirectFB/systems/sdl/sdlgfx.c302
-rwxr-xr-xSource/DirectFB/systems/sdl/sdlinput.c571
9 files changed, 3265 insertions, 0 deletions
diff --git a/Source/DirectFB/systems/sdl/Makefile.am b/Source/DirectFB/systems/sdl/Makefile.am
new file mode 100755
index 0000000..728362e
--- /dev/null
+++ b/Source/DirectFB/systems/sdl/Makefile.am
@@ -0,0 +1,86 @@
+## Makefile.am for DirectFB/systems/sdl
+
+INCLUDES = \
+ -I$(top_srcdir)/include \
+ -I$(top_builddir)/include \
+ -I$(top_builddir)/lib \
+ -I$(top_srcdir)/lib \
+ -I$(top_srcdir)/src \
+ $(SDL_CFLAGS)
+
+
+systemsdir = $(MODULEDIR)/systems
+
+if BUILD_STATIC
+systems_DATA = libdirectfb_sdl.o
+endif
+
+systems_LTLIBRARIES = libdirectfb_sdl.la
+
+
+inputdriversdir = $(MODULEDIR)/inputdrivers
+
+if BUILD_STATIC
+inputdrivers_DATA = libdirectfb_sdlinput.o
+endif
+
+inputdrivers_LTLIBRARIES = libdirectfb_sdlinput.la
+
+
+gfxdriversdir = $(MODULEDIR)/gfxdrivers
+
+if BUILD_STATIC
+gfxdrivers_DATA = libdirectfb_sdlgraphics.o
+endif
+
+gfxdrivers_LTLIBRARIES = libdirectfb_sdlgraphics.la
+
+
+libdirectfb_sdl_la_LDFLAGS = \
+ -avoid-version \
+ -module
+
+libdirectfb_sdl_la_SOURCES = \
+ primary.c \
+ primary.h \
+ sdl.c \
+ sdl.h \
+ sdl_surface_pool.c
+
+libdirectfb_sdl_la_LIBADD = \
+ $(top_builddir)/lib/direct/libdirect.la \
+ $(top_builddir)/lib/fusion/libfusion.la \
+ $(top_builddir)/src/libdirectfb.la \
+ $(SDL_LIBS)
+
+
+libdirectfb_sdlinput_la_LDFLAGS = \
+ -avoid-version \
+ -module
+
+libdirectfb_sdlinput_la_SOURCES = \
+ sdlinput.c
+
+libdirectfb_sdlinput_la_LIBADD = \
+ $(top_builddir)/lib/direct/libdirect.la \
+ $(top_builddir)/lib/fusion/libfusion.la \
+ $(top_builddir)/src/libdirectfb.la \
+ $(SDL_LIBS)
+
+
+libdirectfb_sdlgraphics_la_LDFLAGS = \
+ -avoid-version \
+ -module
+
+libdirectfb_sdlgraphics_la_SOURCES = \
+ sdlgfx.c
+
+libdirectfb_sdlgraphics_la_LIBADD = \
+ $(top_builddir)/lib/direct/libdirect.la \
+ $(top_builddir)/lib/fusion/libfusion.la \
+ $(top_builddir)/src/libdirectfb.la \
+ $(SDL_LIBS)
+
+
+include $(top_srcdir)/rules/libobject.make
+
diff --git a/Source/DirectFB/systems/sdl/Makefile.in b/Source/DirectFB/systems/sdl/Makefile.in
new file mode 100755
index 0000000..e628cd6
--- /dev/null
+++ b/Source/DirectFB/systems/sdl/Makefile.in
@@ -0,0 +1,773 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/rules/libobject.make
+subdir = systems/sdl
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/as-ac-expand.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(gfxdriversdir)" \
+ "$(DESTDIR)$(inputdriversdir)" "$(DESTDIR)$(systemsdir)" \
+ "$(DESTDIR)$(gfxdriversdir)" "$(DESTDIR)$(inputdriversdir)" \
+ "$(DESTDIR)$(systemsdir)"
+gfxdriversLTLIBRARIES_INSTALL = $(INSTALL)
+inputdriversLTLIBRARIES_INSTALL = $(INSTALL)
+systemsLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(gfxdrivers_LTLIBRARIES) $(inputdrivers_LTLIBRARIES) \
+ $(systems_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libdirectfb_sdl_la_DEPENDENCIES = \
+ $(top_builddir)/lib/direct/libdirect.la \
+ $(top_builddir)/lib/fusion/libfusion.la \
+ $(top_builddir)/src/libdirectfb.la $(am__DEPENDENCIES_1)
+am_libdirectfb_sdl_la_OBJECTS = primary.lo sdl.lo sdl_surface_pool.lo
+libdirectfb_sdl_la_OBJECTS = $(am_libdirectfb_sdl_la_OBJECTS)
+libdirectfb_sdl_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libdirectfb_sdl_la_LDFLAGS) $(LDFLAGS) -o $@
+libdirectfb_sdlgraphics_la_DEPENDENCIES = \
+ $(top_builddir)/lib/direct/libdirect.la \
+ $(top_builddir)/lib/fusion/libfusion.la \
+ $(top_builddir)/src/libdirectfb.la $(am__DEPENDENCIES_1)
+am_libdirectfb_sdlgraphics_la_OBJECTS = sdlgfx.lo
+libdirectfb_sdlgraphics_la_OBJECTS = \
+ $(am_libdirectfb_sdlgraphics_la_OBJECTS)
+libdirectfb_sdlgraphics_la_LINK = $(LIBTOOL) --tag=CC \
+ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(AM_CFLAGS) $(CFLAGS) $(libdirectfb_sdlgraphics_la_LDFLAGS) \
+ $(LDFLAGS) -o $@
+libdirectfb_sdlinput_la_DEPENDENCIES = \
+ $(top_builddir)/lib/direct/libdirect.la \
+ $(top_builddir)/lib/fusion/libfusion.la \
+ $(top_builddir)/src/libdirectfb.la $(am__DEPENDENCIES_1)
+am_libdirectfb_sdlinput_la_OBJECTS = sdlinput.lo
+libdirectfb_sdlinput_la_OBJECTS = \
+ $(am_libdirectfb_sdlinput_la_OBJECTS)
+libdirectfb_sdlinput_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libdirectfb_sdlinput_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libdirectfb_sdl_la_SOURCES) \
+ $(libdirectfb_sdlgraphics_la_SOURCES) \
+ $(libdirectfb_sdlinput_la_SOURCES)
+DIST_SOURCES = $(libdirectfb_sdl_la_SOURCES) \
+ $(libdirectfb_sdlgraphics_la_SOURCES) \
+ $(libdirectfb_sdlinput_la_SOURCES)
+gfxdriversDATA_INSTALL = $(INSTALL_DATA)
+inputdriversDATA_INSTALL = $(INSTALL_DATA)
+systemsDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(gfxdrivers_DATA) $(inputdrivers_DATA) $(systems_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+ASFLAGS = @ASFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIR = @DATADIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DFB_CFLAGS_OMIT_FRAME_POINTER = @DFB_CFLAGS_OMIT_FRAME_POINTER@
+DFB_INTERNAL_CFLAGS = @DFB_INTERNAL_CFLAGS@
+DFB_LDFLAGS = @DFB_LDFLAGS@
+DFB_SMOOTH_SCALING = @DFB_SMOOTH_SCALING@
+DIRECTFB_BINARY_AGE = @DIRECTFB_BINARY_AGE@
+DIRECTFB_CSOURCE = @DIRECTFB_CSOURCE@
+DIRECTFB_INTERFACE_AGE = @DIRECTFB_INTERFACE_AGE@
+DIRECTFB_MAJOR_VERSION = @DIRECTFB_MAJOR_VERSION@
+DIRECTFB_MICRO_VERSION = @DIRECTFB_MICRO_VERSION@
+DIRECTFB_MINOR_VERSION = @DIRECTFB_MINOR_VERSION@
+DIRECTFB_VERSION = @DIRECTFB_VERSION@
+DIRECT_BUILD_DEBUG = @DIRECT_BUILD_DEBUG@
+DIRECT_BUILD_DEBUGS = @DIRECT_BUILD_DEBUGS@
+DIRECT_BUILD_GETTID = @DIRECT_BUILD_GETTID@
+DIRECT_BUILD_NETWORK = @DIRECT_BUILD_NETWORK@
+DIRECT_BUILD_STDBOOL = @DIRECT_BUILD_STDBOOL@
+DIRECT_BUILD_TEXT = @DIRECT_BUILD_TEXT@
+DIRECT_BUILD_TRACE = @DIRECT_BUILD_TRACE@
+DSYMUTIL = @DSYMUTIL@
+DYNLIB = @DYNLIB@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+FREETYPE_PROVIDER = @FREETYPE_PROVIDER@
+FUSION_BUILD_KERNEL = @FUSION_BUILD_KERNEL@
+FUSION_BUILD_MULTI = @FUSION_BUILD_MULTI@
+FUSION_MESSAGE_SIZE = @FUSION_MESSAGE_SIZE@
+GIF_PROVIDER = @GIF_PROVIDER@
+GREP = @GREP@
+HAVE_LINUX = @HAVE_LINUX@
+INCLUDEDIR = @INCLUDEDIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTERNALINCLUDEDIR = @INTERNALINCLUDEDIR@
+JPEG_PROVIDER = @JPEG_PROVIDER@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBJPEG = @LIBJPEG@
+LIBOBJS = @LIBOBJS@
+LIBPNG = @LIBPNG@
+LIBPNG_CONFIG = @LIBPNG_CONFIG@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_AGE = @LT_AGE@
+LT_BINARY = @LT_BINARY@
+LT_CURRENT = @LT_CURRENT@
+LT_RELEASE = @LT_RELEASE@
+LT_REVISION = @LT_REVISION@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MAN2HTML = @MAN2HTML@
+MKDIR_P = @MKDIR_P@
+MODULEDIR = @MODULEDIR@
+MODULEDIRNAME = @MODULEDIRNAME@
+NMEDIT = @NMEDIT@
+OBJEXT = @OBJEXT@
+OSX_LIBS = @OSX_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PNG_PROVIDER = @PNG_PROVIDER@
+RANLIB = @RANLIB@
+RUNTIME_SYSROOT = @RUNTIME_SYSROOT@
+SDL_CFLAGS = @SDL_CFLAGS@
+SDL_LIBS = @SDL_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOPATH = @SOPATH@
+STRIP = @STRIP@
+SYSCONFDIR = @SYSCONFDIR@
+SYSFS_LIBS = @SYSFS_LIBS@
+THREADFLAGS = @THREADFLAGS@
+THREADLIB = @THREADLIB@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+VERSION = @VERSION@
+VNC_CFLAGS = @VNC_CFLAGS@
+VNC_CONFIG = @VNC_CONFIG@
+VNC_LIBS = @VNC_LIBS@
+X11_CFLAGS = @X11_CFLAGS@
+X11_LIBS = @X11_LIBS@
+ZLIB_LIBS = @ZLIB_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+INCLUDES = \
+ -I$(top_srcdir)/include \
+ -I$(top_builddir)/include \
+ -I$(top_builddir)/lib \
+ -I$(top_srcdir)/lib \
+ -I$(top_srcdir)/src \
+ $(SDL_CFLAGS)
+
+systemsdir = $(MODULEDIR)/systems
+@BUILD_STATIC_TRUE@systems_DATA = libdirectfb_sdl.o
+systems_LTLIBRARIES = libdirectfb_sdl.la
+inputdriversdir = $(MODULEDIR)/inputdrivers
+@BUILD_STATIC_TRUE@inputdrivers_DATA = libdirectfb_sdlinput.o
+inputdrivers_LTLIBRARIES = libdirectfb_sdlinput.la
+gfxdriversdir = $(MODULEDIR)/gfxdrivers
+@BUILD_STATIC_TRUE@gfxdrivers_DATA = libdirectfb_sdlgraphics.o
+gfxdrivers_LTLIBRARIES = libdirectfb_sdlgraphics.la
+libdirectfb_sdl_la_LDFLAGS = \
+ -avoid-version \
+ -module
+
+libdirectfb_sdl_la_SOURCES = \
+ primary.c \
+ primary.h \
+ sdl.c \
+ sdl.h \
+ sdl_surface_pool.c
+
+libdirectfb_sdl_la_LIBADD = \
+ $(top_builddir)/lib/direct/libdirect.la \
+ $(top_builddir)/lib/fusion/libfusion.la \
+ $(top_builddir)/src/libdirectfb.la \
+ $(SDL_LIBS)
+
+libdirectfb_sdlinput_la_LDFLAGS = \
+ -avoid-version \
+ -module
+
+libdirectfb_sdlinput_la_SOURCES = \
+ sdlinput.c
+
+libdirectfb_sdlinput_la_LIBADD = \
+ $(top_builddir)/lib/direct/libdirect.la \
+ $(top_builddir)/lib/fusion/libfusion.la \
+ $(top_builddir)/src/libdirectfb.la \
+ $(SDL_LIBS)
+
+libdirectfb_sdlgraphics_la_LDFLAGS = \
+ -avoid-version \
+ -module
+
+libdirectfb_sdlgraphics_la_SOURCES = \
+ sdlgfx.c
+
+libdirectfb_sdlgraphics_la_LIBADD = \
+ $(top_builddir)/lib/direct/libdirect.la \
+ $(top_builddir)/lib/fusion/libfusion.la \
+ $(top_builddir)/src/libdirectfb.la \
+ $(SDL_LIBS)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/rules/libobject.make $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu systems/sdl/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu systems/sdl/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-gfxdriversLTLIBRARIES: $(gfxdrivers_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(gfxdriversdir)" || $(MKDIR_P) "$(DESTDIR)$(gfxdriversdir)"
+ @list='$(gfxdrivers_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(gfxdriversLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(gfxdriversdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(gfxdriversLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(gfxdriversdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-gfxdriversLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(gfxdrivers_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(gfxdriversdir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(gfxdriversdir)/$$p"; \
+ done
+
+clean-gfxdriversLTLIBRARIES:
+ -test -z "$(gfxdrivers_LTLIBRARIES)" || rm -f $(gfxdrivers_LTLIBRARIES)
+ @list='$(gfxdrivers_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+install-inputdriversLTLIBRARIES: $(inputdrivers_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(inputdriversdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdriversdir)"
+ @list='$(inputdrivers_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputdriversLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(inputdriversdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(inputdriversLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(inputdriversdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-inputdriversLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(inputdrivers_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(inputdriversdir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(inputdriversdir)/$$p"; \
+ done
+
+clean-inputdriversLTLIBRARIES:
+ -test -z "$(inputdrivers_LTLIBRARIES)" || rm -f $(inputdrivers_LTLIBRARIES)
+ @list='$(inputdrivers_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+install-systemsLTLIBRARIES: $(systems_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(systemsdir)" || $(MKDIR_P) "$(DESTDIR)$(systemsdir)"
+ @list='$(systems_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(systemsLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(systemsdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(systemsLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(systemsdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-systemsLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(systems_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(systemsdir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(systemsdir)/$$p"; \
+ done
+
+clean-systemsLTLIBRARIES:
+ -test -z "$(systems_LTLIBRARIES)" || rm -f $(systems_LTLIBRARIES)
+ @list='$(systems_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libdirectfb_sdl.la: $(libdirectfb_sdl_la_OBJECTS) $(libdirectfb_sdl_la_DEPENDENCIES)
+ $(libdirectfb_sdl_la_LINK) -rpath $(systemsdir) $(libdirectfb_sdl_la_OBJECTS) $(libdirectfb_sdl_la_LIBADD) $(LIBS)
+libdirectfb_sdlgraphics.la: $(libdirectfb_sdlgraphics_la_OBJECTS) $(libdirectfb_sdlgraphics_la_DEPENDENCIES)
+ $(libdirectfb_sdlgraphics_la_LINK) -rpath $(gfxdriversdir) $(libdirectfb_sdlgraphics_la_OBJECTS) $(libdirectfb_sdlgraphics_la_LIBADD) $(LIBS)
+libdirectfb_sdlinput.la: $(libdirectfb_sdlinput_la_OBJECTS) $(libdirectfb_sdlinput_la_DEPENDENCIES)
+ $(libdirectfb_sdlinput_la_LINK) -rpath $(inputdriversdir) $(libdirectfb_sdlinput_la_OBJECTS) $(libdirectfb_sdlinput_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/primary.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdl.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdl_surface_pool.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdlgfx.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sdlinput.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-gfxdriversDATA: $(gfxdrivers_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(gfxdriversdir)" || $(MKDIR_P) "$(DESTDIR)$(gfxdriversdir)"
+ @list='$(gfxdrivers_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(gfxdriversDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(gfxdriversdir)/$$f'"; \
+ $(gfxdriversDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(gfxdriversdir)/$$f"; \
+ done
+
+uninstall-gfxdriversDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(gfxdrivers_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(gfxdriversdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(gfxdriversdir)/$$f"; \
+ done
+install-inputdriversDATA: $(inputdrivers_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(inputdriversdir)" || $(MKDIR_P) "$(DESTDIR)$(inputdriversdir)"
+ @list='$(inputdrivers_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(inputdriversDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(inputdriversdir)/$$f'"; \
+ $(inputdriversDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(inputdriversdir)/$$f"; \
+ done
+
+uninstall-inputdriversDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(inputdrivers_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(inputdriversdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(inputdriversdir)/$$f"; \
+ done
+install-systemsDATA: $(systems_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(systemsdir)" || $(MKDIR_P) "$(DESTDIR)$(systemsdir)"
+ @list='$(systems_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(systemsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(systemsdir)/$$f'"; \
+ $(systemsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(systemsdir)/$$f"; \
+ done
+
+uninstall-systemsDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(systems_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(systemsdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(systemsdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(gfxdriversdir)" "$(DESTDIR)$(inputdriversdir)" "$(DESTDIR)$(systemsdir)" "$(DESTDIR)$(gfxdriversdir)" "$(DESTDIR)$(inputdriversdir)" "$(DESTDIR)$(systemsdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-gfxdriversLTLIBRARIES \
+ clean-inputdriversLTLIBRARIES clean-libtool \
+ clean-systemsLTLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-gfxdriversDATA install-gfxdriversLTLIBRARIES \
+ install-inputdriversDATA install-inputdriversLTLIBRARIES \
+ install-systemsDATA install-systemsLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-gfxdriversDATA uninstall-gfxdriversLTLIBRARIES \
+ uninstall-inputdriversDATA uninstall-inputdriversLTLIBRARIES \
+ uninstall-systemsDATA uninstall-systemsLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-gfxdriversLTLIBRARIES clean-inputdriversLTLIBRARIES \
+ clean-libtool clean-systemsLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am \
+ install-gfxdriversDATA install-gfxdriversLTLIBRARIES \
+ install-html install-html-am install-info install-info-am \
+ install-inputdriversDATA install-inputdriversLTLIBRARIES \
+ install-man install-pdf install-pdf-am install-ps \
+ install-ps-am install-strip install-systemsDATA \
+ install-systemsLTLIBRARIES installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-gfxdriversDATA \
+ uninstall-gfxdriversLTLIBRARIES uninstall-inputdriversDATA \
+ uninstall-inputdriversLTLIBRARIES uninstall-systemsDATA \
+ uninstall-systemsLTLIBRARIES
+
+%.o: .libs/%.a %.la
+ rm -f $<.tmp/*.o
+ if test -d $<.tmp; then rmdir $<.tmp; fi
+ mkdir $<.tmp
+ (cd $<.tmp && $(AR) x ../../$<)
+ $(LD) -o $@ -r $<.tmp/*.o
+ rm -f $<.tmp/*.o && rmdir $<.tmp
+
+.PHONY: $(LTLIBRARIES:%.la=.libs/%.a)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Source/DirectFB/systems/sdl/primary.c b/Source/DirectFB/systems/sdl/primary.c
new file mode 100755
index 0000000..94c0fb7
--- /dev/null
+++ b/Source/DirectFB/systems/sdl/primary.c
@@ -0,0 +1,669 @@
+/*
+ (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
+ (c) Copyright 2000-2004 Convergence (integrated media) GmbH
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>,
+ Andreas Hundt <andi@fischlustig.de>,
+ Sven Neumann <neo@directfb.org>,
+ Ville Syrjälä <syrjala@sci.fi> and
+ Claudio Ciccani <klan@users.sf.net>.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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
+ Lesser General Public License for more details.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <config.h>
+
+#include <stdio.h>
+
+#include <directfb.h>
+
+#include <fusion/fusion.h>
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+#include <core/palette.h>
+#include <core/surface.h>
+#include <core/surface_buffer.h>
+#include <core/system.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+#include <misc/util.h>
+
+#include <direct/debug.h>
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+
+#include <SDL.h>
+
+#include "sdl.h"
+#include "primary.h"
+
+D_DEBUG_DOMAIN( SDL_Screen, "SDL/Screen", "SDL System Screen" );
+D_DEBUG_DOMAIN( SDL_Updates, "SDL/Updates", "SDL System Screen Updates" );
+
+/******************************************************************************/
+
+static DFBResult update_screen( int x, int y, int w, int h );
+
+/******************************************************************************/
+
+static DFBResult
+primaryInitScreen( CoreScreen *screen,
+ CoreGraphicsDevice *device,
+ void *driver_data,
+ void *screen_data,
+ DFBScreenDescription *description )
+{
+ /* Set the screen capabilities. */
+ description->caps = DSCCAPS_NONE;
+
+ /* Set the screen name. */
+ snprintf( description->name,
+ DFB_SCREEN_DESC_NAME_LENGTH, "SDL Primary Screen" );
+
+ return DFB_OK;
+}
+
+static DFBResult
+primaryGetScreenSize( CoreScreen *screen,
+ void *driver_data,
+ void *screen_data,
+ int *ret_width,
+ int *ret_height )
+{
+ D_ASSERT( dfb_sdl != NULL );
+
+ if (dfb_sdl->primary) {
+ *ret_width = dfb_sdl->primary->config.size.w;
+ *ret_height = dfb_sdl->primary->config.size.w;
+ }
+ else {
+ if (dfb_config->mode.width)
+ *ret_width = dfb_config->mode.width;
+ else
+ *ret_width = 640;
+
+ if (dfb_config->mode.height)
+ *ret_height = dfb_config->mode.height;
+ else
+ *ret_height = 480;
+ }
+
+ return DFB_OK;
+}
+
+ScreenFuncs sdlPrimaryScreenFuncs = {
+ .InitScreen = primaryInitScreen,
+ .GetScreenSize = primaryGetScreenSize,
+};
+
+/******************************************************************************/
+
+static void * ScreenUpdateLoop( DirectThread *thread, void *arg );
+
+/******************************************************************************/
+
+static int
+primaryLayerDataSize( void )
+{
+ return 0;
+}
+
+static int
+primaryRegionDataSize( void )
+{
+ return 0;
+}
+
+static DFBResult
+primaryInitLayer( CoreLayer *layer,
+ void *driver_data,
+ void *layer_data,
+ DFBDisplayLayerDescription *description,
+ DFBDisplayLayerConfig *config,
+ DFBColorAdjustment *adjustment )
+{
+ /* set capabilities and type */
+ description->caps = DLCAPS_SURFACE;
+ description->type = DLTF_GRAPHICS;
+
+ /* set name */
+ snprintf( description->name,
+ DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "SDL Primary Layer" );
+
+ /* fill out the default configuration */
+ config->flags = DLCONF_WIDTH | DLCONF_HEIGHT |
+ DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE;
+ config->buffermode = DLBM_FRONTONLY;
+
+ if (dfb_config->mode.width)
+ config->width = dfb_config->mode.width;
+ else
+ config->width = 640;
+
+ if (dfb_config->mode.height)
+ config->height = dfb_config->mode.height;
+ else
+ config->height = 480;
+
+ if (dfb_config->mode.format != DSPF_UNKNOWN)
+ config->pixelformat = dfb_config->mode.format;
+ else if (dfb_config->mode.depth > 0)
+ config->pixelformat = dfb_pixelformat_for_depth( dfb_config->mode.depth );
+ else
+ config->pixelformat = DSPF_RGB16;
+
+ /* Initialize update lock and condition. */
+ pthread_mutex_init( &dfb_sdl->update.lock, NULL );
+ pthread_cond_init( &dfb_sdl->update.cond, NULL );
+
+ /* Start update thread. */
+ dfb_sdl->update.thread = direct_thread_create( DTT_OUTPUT, ScreenUpdateLoop, NULL, "Screen Update" );
+ if (!dfb_sdl->update.thread)
+ return DFB_FAILURE;
+
+ return DFB_OK;
+}
+
+static DFBResult
+primaryTestRegion( CoreLayer *layer,
+ void *driver_data,
+ void *layer_data,
+ CoreLayerRegionConfig *config,
+ CoreLayerRegionConfigFlags *failed )
+{
+ CoreLayerRegionConfigFlags fail = 0;
+
+ switch (config->buffermode) {
+ case DLBM_FRONTONLY:
+ case DLBM_BACKSYSTEM:
+ case DLBM_BACKVIDEO:
+ break;
+
+ default:
+ fail |= CLRCF_BUFFERMODE;
+ break;
+ }
+
+ if (config->options)
+ fail |= CLRCF_OPTIONS;
+
+ if (failed)
+ *failed = fail;
+
+ if (fail)
+ return DFB_UNSUPPORTED;
+
+ return DFB_OK;
+}
+
+static DFBResult
+primaryAddRegion( CoreLayer *layer,
+ void *driver_data,
+ void *layer_data,
+ void *region_data,
+ CoreLayerRegionConfig *config )
+{
+ return DFB_OK;
+}
+
+static DFBResult
+primarySetRegion( CoreLayer *layer,
+ void *driver_data,
+ void *layer_data,
+ void *region_data,
+ CoreLayerRegionConfig *config,
+ CoreLayerRegionConfigFlags updated,
+ CoreSurface *surface,
+ CorePalette *palette,
+ CoreSurfaceBufferLock *lock )
+{
+ if (surface) {
+ pthread_mutex_lock( &dfb_sdl->update.lock );
+ dfb_sdl->primary = surface;
+ dfb_sdl->update.pending = false;
+ pthread_mutex_unlock( &dfb_sdl->update.lock );
+ }
+
+ if (palette)
+ dfb_sdl_set_palette( palette );
+
+ return DFB_OK;
+}
+
+static DFBResult
+primaryRemoveRegion( CoreLayer *layer,
+ void *driver_data,
+ void *layer_data,
+ void *region_data )
+{
+ D_DEBUG_AT( SDL_Updates, "%s( %p )\n", __FUNCTION__, layer );
+
+ D_DEBUG_AT( SDL_Updates, " -> locking sdl lock...\n" );
+
+ fusion_skirmish_prevail( &dfb_sdl->lock );
+
+ D_DEBUG_AT( SDL_Updates, " -> setting primary to NULL...\n" );
+
+ dfb_sdl->primary = NULL;
+
+ D_DEBUG_AT( SDL_Updates, " -> unlocking sdl lock...\n" );
+
+ fusion_skirmish_dismiss( &dfb_sdl->lock );
+
+ D_DEBUG_AT( SDL_Updates, " -> done.\n" );
+
+ return DFB_OK;
+}
+
+static DFBResult
+primaryFlipRegion( CoreLayer *layer,
+ void *driver_data,
+ void *layer_data,
+ void *region_data,
+ CoreSurface *surface,
+ DFBSurfaceFlipFlags flags,
+ CoreSurfaceBufferLock *lock )
+{
+ dfb_surface_flip( surface, false );
+
+ return dfb_sdl_update_screen( dfb_sdl_core, NULL );
+}
+
+static DFBResult
+primaryUpdateRegion( CoreLayer *layer,
+ void *driver_data,
+ void *layer_data,
+ void *region_data,
+ CoreSurface *surface,
+ const DFBRegion *update,
+ CoreSurfaceBufferLock *lock )
+{
+ if (update) {
+ DFBRegion region = *update;
+
+ return dfb_sdl_update_screen( dfb_sdl_core, &region );
+ }
+
+ return dfb_sdl_update_screen( dfb_sdl_core, NULL );
+}
+
+DisplayLayerFuncs sdlPrimaryLayerFuncs = {
+ .LayerDataSize = primaryLayerDataSize,
+ .RegionDataSize = primaryRegionDataSize,
+ .InitLayer = primaryInitLayer,
+
+ .TestRegion = primaryTestRegion,
+ .AddRegion = primaryAddRegion,
+ .SetRegion = primarySetRegion,
+ .RemoveRegion = primaryRemoveRegion,
+ .FlipRegion = primaryFlipRegion,
+ .UpdateRegion = primaryUpdateRegion,
+};
+
+/******************************************************************************/
+
+static DFBResult
+update_screen( int x, int y, int w, int h )
+{
+#if 0
+ int i, n;
+ void *dst;
+ void *src;
+ DFBResult ret;
+ CoreSurface *surface;
+ CoreSurfaceBuffer *buffer;
+ CoreSurfaceBufferLock lock;
+ u16 *src16, *dst16;
+ u8 *src8;
+#endif
+
+ D_DEBUG_AT( SDL_Updates, "%s( %d, %d, %d, %d )\n", __FUNCTION__, x, y, w, h );
+
+ D_DEBUG_AT( SDL_Updates, " -> locking sdl lock...\n" );
+
+ fusion_skirmish_prevail( &dfb_sdl->lock );
+#if 0
+ surface = dfb_sdl->primary;
+ D_MAGIC_ASSERT_IF( surface, CoreSurface );
+
+ D_DEBUG_AT( SDL_Updates, " -> primary is %p\n", surface );
+
+ if (!surface) {
+ D_DEBUG_AT( SDL_Updates, " -> unlocking sdl lock...\n" );
+ fusion_skirmish_dismiss( &dfb_sdl->lock );
+ D_DEBUG_AT( SDL_Updates, " -> done.\n" );
+ return DFB_OK;
+ }
+
+ buffer = dfb_surface_get_buffer( surface, CSBR_FRONT );
+
+ D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+ D_DEBUG_AT( SDL_Updates, " -> locking sdl surface...\n" );
+
+ if (SDL_LockSurface( screen ) < 0) {
+ D_ERROR( "DirectFB/SDL: "
+ "Couldn't lock the display surface: %s\n", SDL_GetError() );
+ fusion_skirmish_dismiss( &dfb_sdl->lock );
+ return DFB_FAILURE;
+ }
+
+ D_DEBUG_AT( SDL_Updates, " -> locking dfb surface...\n" );
+
+ ret = dfb_surface_buffer_lock( buffer, CSAF_CPU_READ, &lock );
+ if (ret) {
+ D_ERROR( "DirectFB/SDL: Couldn't lock layer surface: %s\n",
+ DirectFBErrorString( ret ) );
+ SDL_UnlockSurface(screen);
+ fusion_skirmish_dismiss( &dfb_sdl->lock );
+ return ret;
+ }
+
+ src = lock.addr;
+ dst = screen->pixels;
+
+ src += DFB_BYTES_PER_LINE( surface->config.format, x ) + y * lock.pitch;
+ dst += DFB_BYTES_PER_LINE( surface->config.format, x ) + y * screen->pitch;
+
+ D_DEBUG_AT( SDL_Updates, " -> copying pixels...\n" );
+
+ switch (screen->format->BitsPerPixel) {
+ case 16:
+ dfb_convert_to_rgb16( surface->config.format,
+ src, lock.pitch, surface->config.size.h,
+ dst, screen->pitch, w, h );
+ break;
+
+ default:
+ direct_memcpy( dst, src, DFB_BYTES_PER_LINE( surface->config.format, w ) );
+ }
+
+ D_DEBUG_AT( SDL_Updates, " -> unlocking dfb surface...\n" );
+
+ dfb_surface_buffer_unlock( &lock );
+
+ D_DEBUG_AT( SDL_Updates, " -> unlocking sdl surface...\n" );
+
+ SDL_UnlockSurface( screen );
+#endif
+ D_DEBUG_AT( SDL_Updates, " -> calling SDL_UpdateRect()...\n" );
+
+ SDL_UpdateRect( dfb_sdl->screen, x, y, w, h );
+
+ D_DEBUG_AT( SDL_Updates, " -> unlocking sdl lock...\n" );
+
+ fusion_skirmish_dismiss( &dfb_sdl->lock );
+
+ D_DEBUG_AT( SDL_Updates, " -> done.\n" );
+
+ return DFB_OK;
+}
+
+static void *
+ScreenUpdateLoop( DirectThread *thread, void *arg )
+{
+ pthread_mutex_lock( &dfb_sdl->update.lock );
+
+ D_DEBUG_AT( SDL_Updates, "Entering %s()...\n", __FUNCTION__ );
+
+ while (!dfb_sdl->update.quit) {
+ if (dfb_sdl->update.pending) {
+ DFBRectangle update = DFB_RECTANGLE_INIT_FROM_REGION( &dfb_sdl->update.region );
+
+ dfb_sdl->update.pending = false;
+
+ D_DEBUG_AT( SDL_Updates, "Got update %d,%d - %dx%d...\n", DFB_RECTANGLE_VALS( &update ) );
+
+ pthread_mutex_unlock( &dfb_sdl->update.lock );
+
+
+ update_screen( update.x, update.y, update.w, update.h );
+
+
+ pthread_mutex_lock( &dfb_sdl->update.lock );
+ }
+ else
+ pthread_cond_wait( &dfb_sdl->update.cond, &dfb_sdl->update.lock );
+ }
+
+ D_DEBUG_AT( SDL_Updates, "Returning from %s()...\n", __FUNCTION__ );
+
+ pthread_mutex_unlock( &dfb_sdl->update.lock );
+
+ return NULL;
+}
+
+/******************************************************************************/
+
+typedef enum {
+ SDL_SET_VIDEO_MODE,
+ SDL_UPDATE_SCREEN,
+ SDL_SET_PALETTE
+} DFBSDLCall;
+
+static inline int
+get_pixelformat_target_depth( DFBSurfacePixelFormat format )
+{
+ switch (format) {
+ case DSPF_NV16:
+ return 16;
+
+ default:
+ break;
+ }
+
+ return DFB_BITS_PER_PIXEL( format );
+}
+
+static DFBResult
+dfb_sdl_set_video_mode_handler( CoreSurfaceConfig *config )
+{
+ int depth = get_pixelformat_target_depth( config->format );
+ Uint32 flags = SDL_HWSURFACE | SDL_RESIZABLE;// | SDL_ASYNCBLIT | SDL_FULLSCREEN;
+ SDL_Surface *screen;
+
+ if (config->caps & DSCAPS_FLIPPING)
+ flags |= SDL_DOUBLEBUF;
+
+ fusion_skirmish_prevail( &dfb_sdl->lock );
+
+ D_DEBUG_AT( SDL_Screen, " -> SDL_SetVideoMode( %dx%d, %d, 0x%08x )\n",
+ config->size.w, config->size.h, DFB_BITS_PER_PIXEL(config->format), flags );
+
+ /* Set video mode */
+ screen = SDL_SetVideoMode( config->size.w, config->size.h, depth, flags );
+ if (!screen) {
+ D_ERROR( "DirectFB/SDL: Couldn't set %dx%dx%d video mode: %s\n",
+ config->size.w, config->size.h, depth, SDL_GetError());
+
+ fusion_skirmish_dismiss( &dfb_sdl->lock );
+
+ return DFB_FAILURE;
+ }
+
+ dfb_sdl->screen = screen;
+
+ /* Hide SDL's cursor */
+ SDL_ShowCursor( SDL_DISABLE );
+
+ fusion_skirmish_dismiss( &dfb_sdl->lock );
+
+ return DFB_OK;
+}
+
+static DFBResult
+dfb_sdl_update_screen_handler( const DFBRegion *region )
+{
+ DFBRegion update;
+ CoreSurface *surface = dfb_sdl->primary;
+
+ DFB_REGION_ASSERT_IF( region );
+
+ if (region)
+ update = *region;
+ else {
+ update.x1 = 0;
+ update.y1 = 0;
+ update.x2 = surface->config.size.w - 1;
+ update.y2 = surface->config.size.h - 1;
+ }
+
+#if 0
+ pthread_mutex_lock( &dfb_sdl->update.lock );
+
+ if (dfb_sdl->update.pending)
+ dfb_region_region_union( &dfb_sdl->update.region, &update );
+ else {
+ dfb_sdl->update.region = update;
+ dfb_sdl->update.pending = true;
+ }
+
+ pthread_cond_signal( &dfb_sdl->update.cond );
+
+ pthread_mutex_unlock( &dfb_sdl->update.lock );
+#else
+ if (surface->config.caps & DSCAPS_FLIPPING)
+ SDL_Flip( dfb_sdl->screen );
+ else
+ SDL_UpdateRect( dfb_sdl->screen, DFB_RECTANGLE_VALS_FROM_REGION(&update) );
+#endif
+
+ return DFB_OK;
+}
+
+static DFBResult
+dfb_sdl_set_palette_handler( CorePalette *palette )
+{
+ unsigned int i;
+ SDL_Color colors[palette->num_entries];
+
+ for (i=0; i<palette->num_entries; i++) {
+ colors[i].r = palette->entries[i].r;
+ colors[i].g = palette->entries[i].g;
+ colors[i].b = palette->entries[i].b;
+ }
+
+ fusion_skirmish_prevail( &dfb_sdl->lock );
+
+ SDL_SetColors( dfb_sdl->screen, colors, 0, palette->num_entries );
+
+ fusion_skirmish_dismiss( &dfb_sdl->lock );
+
+ return DFB_OK;
+}
+
+FusionCallHandlerResult
+dfb_sdl_call_handler( int caller,
+ int call_arg,
+ void *call_ptr,
+ void *ctx,
+ unsigned int serial,
+ int *ret_val )
+{
+ switch (call_arg) {
+ case SDL_SET_VIDEO_MODE:
+ *ret_val = dfb_sdl_set_video_mode_handler( call_ptr );
+ break;
+
+ case SDL_UPDATE_SCREEN:
+ *ret_val = dfb_sdl_update_screen_handler( call_ptr );
+ break;
+
+ case SDL_SET_PALETTE:
+ *ret_val = dfb_sdl_set_palette_handler( call_ptr );
+ break;
+
+ default:
+ D_BUG( "unknown call" );
+ *ret_val = DFB_BUG;
+ break;
+ }
+
+ return FCHR_RETURN;
+}
+
+DFBResult
+dfb_sdl_set_video_mode( CoreDFB *core, CoreSurfaceConfig *config )
+{
+ int ret;
+ CoreSurfaceConfig *tmp = NULL;
+
+ D_ASSERT( config != NULL );
+
+ if (dfb_core_is_master( core ))
+ return dfb_sdl_set_video_mode_handler( config );
+
+ if (!fusion_is_shared( dfb_core_world(core), config )) {
+ tmp = SHMALLOC( dfb_core_shmpool(core), sizeof(CoreSurfaceConfig) );
+ if (!tmp)
+ return D_OOSHM();
+
+ direct_memcpy( tmp, config, sizeof(CoreSurfaceConfig) );
+ }
+
+ fusion_call_execute( &dfb_sdl->call, FCEF_NONE, SDL_SET_VIDEO_MODE,
+ tmp ? tmp : config, &ret );
+
+ if (tmp)
+ SHFREE( dfb_core_shmpool(core), tmp );
+
+ return ret;
+}
+
+DFBResult
+dfb_sdl_update_screen( CoreDFB *core, DFBRegion *region )
+{
+ int ret;
+ DFBRegion *tmp = NULL;
+
+ if (dfb_core_is_master( core ))
+ return dfb_sdl_update_screen_handler( region );
+
+ if (region) {
+ tmp = SHMALLOC( dfb_core_shmpool(core), sizeof(DFBRegion) );
+ if (!tmp)
+ return D_OOSHM();
+
+ direct_memcpy( tmp, region, sizeof(DFBRegion) );
+ }
+
+ fusion_call_execute( &dfb_sdl->call, FCEF_NONE, SDL_UPDATE_SCREEN, tmp ? tmp : region, &ret );
+
+ if (tmp)
+ SHFREE( dfb_core_shmpool(core), tmp );
+
+ return DFB_OK;
+}
+
+DFBResult
+dfb_sdl_set_palette( CorePalette *palette )
+{
+ int ret;
+
+ fusion_call_execute( &dfb_sdl->call, FCEF_NONE, SDL_SET_PALETTE, palette, &ret );
+
+ return ret;
+}
+
diff --git a/Source/DirectFB/systems/sdl/primary.h b/Source/DirectFB/systems/sdl/primary.h
new file mode 100755
index 0000000..faa34d2
--- /dev/null
+++ b/Source/DirectFB/systems/sdl/primary.h
@@ -0,0 +1,49 @@
+/*
+ (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
+ (c) Copyright 2000-2004 Convergence (integrated media) GmbH
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>,
+ Andreas Hundt <andi@fischlustig.de>,
+ Sven Neumann <neo@directfb.org>,
+ Ville Syrjälä <syrjala@sci.fi> and
+ Claudio Ciccani <klan@users.sf.net>.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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
+ Lesser General Public License for more details.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __SDL__PRIMARY_H__
+#define __SDL__PRIMARY_H__
+
+#include <fusion/call.h>
+
+#include <core/layers.h>
+#include <core/screens.h>
+
+extern ScreenFuncs sdlPrimaryScreenFuncs;
+extern DisplayLayerFuncs sdlPrimaryLayerFuncs;
+
+FusionCallHandlerResult
+dfb_sdl_call_handler( int caller,
+ int call_arg,
+ void *call_ptr,
+ void *ctx,
+ unsigned int serial,
+ int *ret_val );
+
+#endif
+
diff --git a/Source/DirectFB/systems/sdl/sdl.c b/Source/DirectFB/systems/sdl/sdl.c
new file mode 100755
index 0000000..8ecc4ca
--- /dev/null
+++ b/Source/DirectFB/systems/sdl/sdl.c
@@ -0,0 +1,396 @@
+/*
+ (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
+ (c) Copyright 2000-2004 Convergence (integrated media) GmbH
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>,
+ Andreas Hundt <andi@fischlustig.de>,
+ Sven Neumann <neo@directfb.org>,
+ Ville Syrjälä <syrjala@sci.fi> and
+ Claudio Ciccani <klan@users.sf.net>.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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
+ Lesser General Public License for more details.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <directfb.h>
+
+#include <direct/memcpy.h>
+#include <direct/messages.h>
+#include <direct/thread.h>
+
+#include <fusion/arena.h>
+#include <fusion/shmalloc.h>
+
+#include <core/core.h>
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/layers.h>
+#include <core/palette.h>
+#include <core/surface.h>
+#include <core/system.h>
+
+#include <gfx/convert.h>
+
+#include <misc/conf.h>
+
+#include <SDL.h>
+
+#include "sdl.h"
+#include "primary.h"
+
+#include <core/core_system.h>
+
+DFB_CORE_SYSTEM( sdl )
+
+
+DFBSDL *dfb_sdl = NULL;
+CoreDFB *dfb_sdl_core = NULL;
+
+extern const SurfacePoolFuncs sdlSurfacePoolFuncs;
+
+static DFBResult dfb_fbdev_read_modes( void );
+
+
+static void
+system_get_info( CoreSystemInfo *info )
+{
+ info->type = CORE_SDL;
+ info->caps = CSCAPS_ACCELERATION;
+
+ snprintf( info->name, DFB_CORE_SYSTEM_INFO_NAME_LENGTH, "SDL" );
+}
+
+static DFBResult
+system_initialize( CoreDFB *core, void **data )
+{
+ char *driver;
+ CoreScreen *screen;
+
+ D_ASSERT( dfb_sdl == NULL );
+
+ dfb_sdl = (DFBSDL*) SHCALLOC( dfb_core_shmpool(core), 1, sizeof(DFBSDL) );
+ if (!dfb_sdl) {
+ D_ERROR( "DirectFB/SDL: Couldn't allocate shared memory!\n" );
+ return D_OOSHM();
+ }
+
+ dfb_sdl_core = core;
+
+ dfb_fbdev_read_modes(); /* use same mode list as a fake */
+
+ driver = getenv( "SDL_VIDEODRIVER" );
+ if (driver && !strcasecmp( driver, "directfb" )) {
+ D_INFO( "DirectFB/SDL: SDL_VIDEODRIVER is 'directfb', unsetting it.\n" );
+ unsetenv( "SDL_VIDEODRIVER" );
+ }
+
+ /* Initialize SDL */
+ if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
+ D_ERROR( "DirectFB/SDL: Couldn't initialize SDL: %s\n", SDL_GetError() );
+
+ SHFREE( dfb_core_shmpool(core), dfb_sdl );
+ dfb_sdl = NULL;
+
+ return DFB_INIT;
+ }
+
+ fusion_skirmish_init( &dfb_sdl->lock, "SDL System", dfb_core_world(core) );
+
+ fusion_call_init( &dfb_sdl->call, dfb_sdl_call_handler, NULL, dfb_core_world(core) );
+
+ screen = dfb_screens_register( NULL, NULL, &sdlPrimaryScreenFuncs );
+
+ dfb_layers_register( screen, NULL, &sdlPrimaryLayerFuncs );
+
+ fusion_arena_add_shared_field( dfb_core_arena( core ), "sdl", dfb_sdl );
+
+ dfb_surface_pool_initialize( core, &sdlSurfacePoolFuncs, &dfb_sdl->sdl_pool );
+
+ *data = dfb_sdl;
+
+ return DFB_OK;
+}
+
+static DFBResult
+system_join( CoreDFB *core, void **data )
+{
+ void *ret;
+ CoreScreen *screen;
+
+ D_ASSERT( dfb_sdl == NULL );
+
+ fusion_arena_get_shared_field( dfb_core_arena( core ), "sdl", &ret );
+
+ dfb_sdl = ret;
+ dfb_sdl_core = core;
+
+ screen = dfb_screens_register( NULL, NULL, &sdlPrimaryScreenFuncs );
+
+ dfb_layers_register( screen, NULL, &sdlPrimaryLayerFuncs );
+
+ dfb_surface_pool_join( core, dfb_sdl->sdl_pool, &sdlSurfacePoolFuncs );
+
+ *data = dfb_sdl;
+
+ return DFB_OK;
+}
+
+static DFBResult
+system_shutdown( bool emergency )
+{
+ FusionSHMPoolShared *pool;
+
+ D_ASSERT( dfb_sdl != NULL );
+
+ /* Stop update thread. */
+ if (dfb_sdl->update.thread) {
+ if (!emergency) {
+ dfb_sdl->update.quit = true;
+
+ pthread_cond_signal( &dfb_sdl->update.cond );
+
+ direct_thread_join( dfb_sdl->update.thread );
+ }
+
+ direct_thread_destroy( dfb_sdl->update.thread );
+ }
+
+ dfb_surface_pool_destroy( dfb_sdl->sdl_pool );
+
+ fusion_call_destroy( &dfb_sdl->call );
+
+ fusion_skirmish_prevail( &dfb_sdl->lock );
+
+ SDL_Quit();
+
+ fusion_skirmish_destroy( &dfb_sdl->lock );
+
+ pool = dfb_core_shmpool(dfb_sdl_core);
+
+ while (dfb_sdl->modes) {
+ VideoMode *next = dfb_sdl->modes->next;
+
+ SHFREE( pool, dfb_sdl->modes );
+
+ dfb_sdl->modes = next;
+ }
+
+ SHFREE( pool, dfb_sdl );
+ dfb_sdl = NULL;
+ dfb_sdl_core = NULL;
+
+ return DFB_OK;
+}
+
+static DFBResult
+system_leave( bool emergency )
+{
+ D_ASSERT( dfb_sdl != NULL );
+
+ dfb_sdl = NULL;
+ dfb_sdl_core = NULL;
+
+ return DFB_OK;
+}
+
+static DFBResult
+system_suspend( void )
+{
+ return DFB_UNIMPLEMENTED;
+}
+
+static DFBResult
+system_resume( void )
+{
+ return DFB_UNIMPLEMENTED;
+}
+
+static volatile void *
+system_map_mmio( unsigned int offset,
+ int length )
+{
+ return NULL;
+}
+
+static void
+system_unmap_mmio( volatile void *addr,
+ int length )
+{
+}
+
+static int
+system_get_accelerator( void )
+{
+ return -1;
+}
+
+static VideoMode *
+system_get_modes( void )
+{
+ return dfb_sdl->modes;
+}
+
+static VideoMode *
+system_get_current_mode( void )
+{
+ return NULL;
+}
+
+static DFBResult
+system_thread_init( void )
+{
+ return DFB_OK;
+}
+
+static bool
+system_input_filter( CoreInputDevice *device,
+ DFBInputEvent *event )
+{
+ return false;
+}
+
+static unsigned long
+system_video_memory_physical( unsigned int offset )
+{
+ return 0;
+}
+
+static void *
+system_video_memory_virtual( unsigned int offset )
+{
+ return NULL;
+}
+
+static unsigned int
+system_videoram_length( void )
+{
+ return 0;
+}
+
+static unsigned long
+system_aux_memory_physical( unsigned int offset )
+{
+ return 0;
+}
+
+static void *
+system_aux_memory_virtual( unsigned int offset )
+{
+ return NULL;
+}
+
+static unsigned int
+system_auxram_length( void )
+{
+ return 0;
+}
+
+static void
+system_get_busid( int *ret_bus, int *ret_dev, int *ret_func )
+{
+ return;
+}
+
+static void
+system_get_deviceid( unsigned int *ret_vendor_id,
+ unsigned int *ret_device_id )
+{
+ return;
+}
+
+
+/*
+ * parses video modes in /etc/fb.modes and stores them in dfb_fbdev->shared->modes
+ * (to be replaced by DirectFB's own config system
+ */
+static DFBResult dfb_fbdev_read_modes( void )
+{
+ FILE *fp;
+ char line[80],label[32],value[16];
+ int geometry=0, timings=0;
+ int dummy;
+ VideoMode temp_mode;
+ VideoMode *m = dfb_sdl->modes;
+
+ if (!(fp = fopen("/etc/fb.modes","r")))
+ return errno2result( errno );
+
+ while (fgets(line,79,fp)) {
+ if (sscanf(line, "mode \"%31[^\"]\"",label) == 1) {
+ memset( &temp_mode, 0, sizeof(VideoMode) );
+ geometry = 0;
+ timings = 0;
+ while (fgets(line,79,fp) && !(strstr(line,"endmode"))) {
+ if (5 == sscanf(line," geometry %d %d %d %d %d", &temp_mode.xres, &temp_mode.yres, &dummy, &dummy, &temp_mode.bpp)) {
+ geometry = 1;
+ }
+ else if (7 == sscanf(line," timings %d %d %d %d %d %d %d", &temp_mode.pixclock, &temp_mode.left_margin, &temp_mode.right_margin,
+ &temp_mode.upper_margin, &temp_mode.lower_margin, &temp_mode.hsync_len, &temp_mode.vsync_len)) {
+ timings = 1;
+ }
+ else if (1 == sscanf(line, " hsync %15s",value) && 0 == strcasecmp(value,"high")) {
+ temp_mode.hsync_high = 1;
+ }
+ else if (1 == sscanf(line, " vsync %15s",value) && 0 == strcasecmp(value,"high")) {
+ temp_mode.vsync_high = 1;
+ }
+ else if (1 == sscanf(line, " csync %15s",value) && 0 == strcasecmp(value,"high")) {
+ temp_mode.csync_high = 1;
+ }
+ else if (1 == sscanf(line, " laced %15s",value) && 0 == strcasecmp(value,"true")) {
+ temp_mode.laced = 1;
+ }
+ else if (1 == sscanf(line, " double %15s",value) && 0 == strcasecmp(value,"true")) {
+ temp_mode.doubled = 1;
+ }
+ else if (1 == sscanf(line, " gsync %15s",value) && 0 == strcasecmp(value,"true")) {
+ temp_mode.sync_on_green = 1;
+ }
+ else if (1 == sscanf(line, " extsync %15s",value) && 0 == strcasecmp(value,"true")) {
+ temp_mode.external_sync = 1;
+ }
+ else if (1 == sscanf(line, " bcast %15s",value) && 0 == strcasecmp(value,"true")) {
+ temp_mode.broadcast = 1;
+ }
+ }
+ if (geometry && timings) {
+ if (!m) {
+ dfb_sdl->modes = SHCALLOC( dfb_core_shmpool(dfb_sdl_core), 1, sizeof(VideoMode) );
+ m = dfb_sdl->modes;
+ }
+ else {
+ m->next = SHCALLOC( dfb_core_shmpool(dfb_sdl_core), 1, sizeof(VideoMode) );
+ m = m->next;
+ }
+ direct_memcpy (m, &temp_mode, sizeof(VideoMode));
+ D_DEBUG( "DirectFB/FBDev: %20s %4dx%4d %s%s\n", label, temp_mode.xres, temp_mode.yres,
+ temp_mode.laced ? "interlaced " : "", temp_mode.doubled ? "doublescan" : "" );
+ }
+ }
+ }
+
+ fclose (fp);
+
+ return DFB_OK;
+}
+
diff --git a/Source/DirectFB/systems/sdl/sdl.h b/Source/DirectFB/systems/sdl/sdl.h
new file mode 100755
index 0000000..2ed9ef6
--- /dev/null
+++ b/Source/DirectFB/systems/sdl/sdl.h
@@ -0,0 +1,70 @@
+/*
+ (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
+ (c) Copyright 2000-2004 Convergence (integrated media) GmbH
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>,
+ Andreas Hundt <andi@fischlustig.de>,
+ Sven Neumann <neo@directfb.org>,
+ Ville Syrjälä <syrjala@sci.fi> and
+ Claudio Ciccani <klan@users.sf.net>.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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
+ Lesser General Public License for more details.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __SDL__SDL_H__
+#define __SDL__SDL_H__
+
+#include <fusion/call.h>
+#include <fusion/lock.h>
+
+#include <core/surface_pool.h>
+#include <core/system.h>
+
+typedef struct {
+ FusionSkirmish lock;
+ FusionCall call;
+
+ CoreSurface *primary;
+ CoreSurfacePool *sdl_pool;
+
+ struct {
+ pthread_mutex_t lock;
+ pthread_cond_t cond;
+
+ DirectThread *thread;
+
+ bool pending;
+ DFBRegion region;
+
+ bool quit;
+ } update;
+
+ VideoMode *modes; /* linked list of valid video modes */
+
+ SDL_Surface *screen;
+} DFBSDL;
+
+extern DFBSDL *dfb_sdl;
+extern CoreDFB *dfb_sdl_core;
+
+DFBResult dfb_sdl_set_video_mode( CoreDFB *core, CoreSurfaceConfig *config );
+DFBResult dfb_sdl_update_screen( CoreDFB *core, DFBRegion *region );
+DFBResult dfb_sdl_set_palette( CorePalette *palette );
+
+#endif
+
diff --git a/Source/DirectFB/systems/sdl/sdl_surface_pool.c b/Source/DirectFB/systems/sdl/sdl_surface_pool.c
new file mode 100755
index 0000000..d1b8703
--- /dev/null
+++ b/Source/DirectFB/systems/sdl/sdl_surface_pool.c
@@ -0,0 +1,349 @@
+/*
+ (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
+ (c) Copyright 2000-2004 Convergence (integrated media) GmbH
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>,
+ Andreas Hundt <andi@fischlustig.de>,
+ Sven Neumann <neo@directfb.org>,
+ Ville Syrjälä <syrjala@sci.fi> and
+ Claudio Ciccani <klan@users.sf.net>.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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
+ Lesser General Public License for more details.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <config.h>
+
+#include <SDL.h>
+
+#include <direct/debug.h>
+#include <direct/mem.h>
+
+#include <core/surface_pool.h>
+
+#include <gfx/convert.h>
+
+#include <directfb_util.h>
+
+#include "sdl.h"
+
+D_DEBUG_DOMAIN( SDL_Pool, "SDL/Pool", "SDL Surface Pool" );
+
+/**********************************************************************************************************************/
+
+typedef struct {
+} SDLPoolData;
+
+typedef struct {
+ int magic;
+
+ SDL_Surface *sdl_surf;
+} SDLAllocationData;
+
+/**********************************************************************************************************************/
+
+static int
+sdlPoolDataSize( void )
+{
+ return sizeof(SDLPoolData);
+}
+
+static int
+sdlAllocationDataSize( void )
+{
+ return sizeof(SDLAllocationData);
+}
+
+static DFBResult
+sdlInitPool( CoreDFB *core,
+ CoreSurfacePool *pool,
+ void *pool_data,
+ void *pool_local,
+ void *system_data,
+ CoreSurfacePoolDescription *ret_desc )
+{
+ D_DEBUG_AT( SDL_Pool, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( pool, CoreSurfacePool );
+ D_ASSERT( ret_desc != NULL );
+
+ ret_desc->caps = CSPCAPS_NONE;
+ ret_desc->access[CSAID_CPU] = CSAF_READ | CSAF_WRITE;
+ ret_desc->access[CSAID_GPU] = CSAF_READ | CSAF_WRITE;
+ ret_desc->types = CSTF_LAYER | CSTF_WINDOW | CSTF_CURSOR | CSTF_FONT | CSTF_SHARED | CSTF_EXTERNAL;
+ ret_desc->priority = CSPP_PREFERED;
+
+ snprintf( ret_desc->name, DFB_SURFACE_POOL_DESC_NAME_LENGTH, "SDL" );
+
+ return DFB_OK;
+}
+
+static DFBResult
+sdlDestroyPool( CoreSurfacePool *pool,
+ void *pool_data,
+ void *pool_local )
+{
+ D_DEBUG_AT( SDL_Pool, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( pool, CoreSurfacePool );
+
+ return DFB_OK;
+}
+
+static DFBResult
+sdlTestConfig( CoreSurfacePool *pool,
+ void *pool_data,
+ void *pool_local,
+ CoreSurfaceBuffer *buffer,
+ const CoreSurfaceConfig *config )
+{
+ D_DEBUG_AT( SDL_Pool, "%s()\n", __FUNCTION__ );
+
+ switch (config->format) {
+ case DSPF_A8:
+ case DSPF_RGB16:
+ case DSPF_RGB32:
+ case DSPF_ARGB:
+ break;
+
+ default:
+ return DFB_UNSUPPORTED;
+ }
+
+ return DFB_OK;
+}
+
+static DFBResult
+sdlAllocateBuffer( CoreSurfacePool *pool,
+ void *pool_data,
+ void *pool_local,
+ CoreSurfaceBuffer *buffer,
+ CoreSurfaceAllocation *allocation,
+ void *alloc_data )
+{
+ DFBResult ret;
+ CoreSurface *surface;
+ SDLAllocationData *alloc = alloc_data;
+
+ D_DEBUG_AT( SDL_Pool, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( pool, CoreSurfacePool );
+ D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+
+ surface = buffer->surface;
+ D_MAGIC_ASSERT( surface, CoreSurface );
+
+ if (surface->type & CSTF_LAYER) {
+ dfb_sdl->screen = NULL; /* clear? */
+
+ ret = dfb_sdl_set_video_mode( dfb_sdl_core, &surface->config );
+ if (ret) {
+ D_DERROR( ret, "SDL/Surface: dfb_sdl_set_video_mode() failed!\n" );
+ return ret;
+ }
+
+ D_ASSERT( dfb_sdl->screen != NULL );
+
+ if (!dfb_sdl->screen) {
+ D_ERROR( "SDL/Surface: No screen surface!?\n" );
+ return DFB_BUG;
+ }
+
+ alloc->sdl_surf = dfb_sdl->screen;
+
+ D_DEBUG_AT( SDL_Pool, " -> screen surface %dx%d, %d, 0x%08x, pitch %d\n",
+ dfb_sdl->screen->w, dfb_sdl->screen->h, dfb_sdl->screen->format->BitsPerPixel,
+ dfb_sdl->screen->flags, dfb_sdl->screen->pitch );
+
+ allocation->flags |= CSALF_ONEFORALL;
+ }
+ else {
+ DFBSurfacePixelFormat format = surface->config.format;
+ Uint32 flags = SDL_HWSURFACE;// | SDL_ASYNCBLIT | SDL_FULLSCREEN;
+ Uint32 rmask;
+ Uint32 gmask;
+ Uint32 bmask;
+ Uint32 amask;
+
+ if (surface->config.caps & DSCAPS_FLIPPING)
+ flags |= SDL_DOUBLEBUF;
+
+ switch (format) {
+ case DSPF_A8:
+ rmask = 0x00;
+ gmask = 0x00;
+ bmask = 0x00;
+ amask = 0xff;
+ break;
+
+ case DSPF_RGB16:
+ rmask = 0xf800;
+ gmask = 0x07e0;
+ bmask = 0x001f;
+ amask = 0x0000;
+ break;
+
+ case DSPF_RGB32:
+ rmask = 0x00ff0000;
+ gmask = 0x0000ff00;
+ bmask = 0x000000ff;
+ amask = 0x00000000;
+ break;
+
+ case DSPF_ARGB:
+ rmask = 0x00ff0000;
+ gmask = 0x0000ff00;
+ bmask = 0x000000ff;
+ amask = 0xff000000;
+ break;
+
+ default:
+ D_ERROR( "SDL/Surface: %s() has no support for %s!\n",
+ __FUNCTION__, dfb_pixelformat_name(format) );
+ return DFB_UNSUPPORTED;
+ }
+
+ D_DEBUG_AT( SDL_Pool, " -> SDL_CreateRGBSurface( 0x%08x, "
+ "%dx%d, %d, 0x%08x, 0x%08x, 0x%08x, 0x%08x )\n",
+ flags, surface->config.size.w, surface->config.size.h,
+ DFB_BITS_PER_PIXEL(format), rmask, gmask, bmask, amask );
+
+ alloc->sdl_surf = SDL_CreateRGBSurface( flags,
+ surface->config.size.w,
+ surface->config.size.h,
+ DFB_BITS_PER_PIXEL(format),
+ rmask, gmask, bmask, amask );
+ if (!alloc->sdl_surf) {
+ D_ERROR( "SDL/Surface: SDL_CreateRGBSurface( 0x%08x, "
+ "%dx%d, %d, 0x%08x, 0x%08x, 0x%08x, 0x%08x ) failed!\n",
+ flags, surface->config.size.w, surface->config.size.h,
+ DFB_BITS_PER_PIXEL(format), rmask, gmask, bmask, amask );
+
+ return DFB_FAILURE;
+ }
+ }
+
+ D_MAGIC_SET( alloc, SDLAllocationData );
+
+ return DFB_OK;
+}
+
+static DFBResult
+sdlDeallocateBuffer( CoreSurfacePool *pool,
+ void *pool_data,
+ void *pool_local,
+ CoreSurfaceBuffer *buffer,
+ CoreSurfaceAllocation *allocation,
+ void *alloc_data )
+{
+ SDLAllocationData *alloc = alloc_data;
+
+ D_DEBUG_AT( SDL_Pool, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( pool, CoreSurfacePool );
+ D_MAGIC_ASSERT( buffer, CoreSurfaceBuffer );
+ D_MAGIC_ASSERT( alloc, SDLAllocationData );
+
+ SDL_FreeSurface( alloc->sdl_surf );
+
+ D_MAGIC_CLEAR( alloc );
+
+ return DFB_OK;
+}
+
+static DFBResult
+sdlLock( CoreSurfacePool *pool,
+ void *pool_data,
+ void *pool_local,
+ CoreSurfaceAllocation *allocation,
+ void *alloc_data,
+ CoreSurfaceBufferLock *lock )
+{
+ SDLAllocationData *alloc = alloc_data;
+ SDL_Surface *sdl_surf;
+
+// D_DEBUG_AT( SDL_Pool, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( pool, CoreSurfacePool );
+ D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+ D_MAGIC_ASSERT( alloc, SDLAllocationData );
+ D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+ sdl_surf = alloc->sdl_surf;
+ D_ASSERT( sdl_surf != NULL );
+
+ if (SDL_MUSTLOCK( sdl_surf ) && SDL_LockSurface( sdl_surf )) {
+ D_ERROR( "SDL/Surface: SDL_LockSurface() on a %dx%dx surface failed!\n", sdl_surf->w, sdl_surf->h );
+ return DFB_FAILURE;
+ }
+
+ D_ASSUME( sdl_surf->pixels != NULL );
+ if (!sdl_surf->pixels)
+ return DFB_UNSUPPORTED;
+
+ D_ASSERT( sdl_surf->pitch > 0 );
+
+ lock->addr = sdl_surf->pixels;
+ lock->pitch = sdl_surf->pitch;
+ lock->offset = sdl_surf->offset;
+ lock->handle = sdl_surf;
+
+ return DFB_OK;
+}
+
+static DFBResult
+sdlUnlock( CoreSurfacePool *pool,
+ void *pool_data,
+ void *pool_local,
+ CoreSurfaceAllocation *allocation,
+ void *alloc_data,
+ CoreSurfaceBufferLock *lock )
+{
+ SDLAllocationData *alloc = alloc_data;
+ SDL_Surface *sdl_surf;
+
+// D_DEBUG_AT( SDL_Pool, "%s()\n", __FUNCTION__ );
+
+ D_MAGIC_ASSERT( pool, CoreSurfacePool );
+ D_MAGIC_ASSERT( allocation, CoreSurfaceAllocation );
+ D_MAGIC_ASSERT( alloc, SDLAllocationData );
+ D_MAGIC_ASSERT( lock, CoreSurfaceBufferLock );
+
+ sdl_surf = alloc->sdl_surf;
+ D_ASSERT( sdl_surf != NULL );
+
+ if (SDL_MUSTLOCK( sdl_surf ))
+ SDL_UnlockSurface( sdl_surf );
+
+ return DFB_OK;
+}
+
+const SurfacePoolFuncs sdlSurfacePoolFuncs = {
+ .PoolDataSize = sdlPoolDataSize,
+ .AllocationDataSize = sdlAllocationDataSize,
+ .InitPool = sdlInitPool,
+ .DestroyPool = sdlDestroyPool,
+
+ .TestConfig = sdlTestConfig,
+
+ .AllocateBuffer = sdlAllocateBuffer,
+ .DeallocateBuffer = sdlDeallocateBuffer,
+
+ .Lock = sdlLock,
+ .Unlock = sdlUnlock,
+};
+
diff --git a/Source/DirectFB/systems/sdl/sdlgfx.c b/Source/DirectFB/systems/sdl/sdlgfx.c
new file mode 100755
index 0000000..811d545
--- /dev/null
+++ b/Source/DirectFB/systems/sdl/sdlgfx.c
@@ -0,0 +1,302 @@
+/*
+ (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
+ (c) Copyright 2000-2004 Convergence (integrated media) GmbH
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>,
+ Andreas Hundt <andi@fischlustig.de>,
+ Sven Neumann <neo@directfb.org>,
+ Ville Syrjälä <syrjala@sci.fi> and
+ Claudio Ciccani <klan@users.sf.net>.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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
+ Lesser General Public License for more details.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <config.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#include <directfb.h>
+
+#include <SDL.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+
+#include <core/state.h>
+#include <core/gfxcard.h>
+#include <core/windows.h>
+#include <core/layers.h>
+#include <core/screens.h>
+#include <core/surface.h>
+
+#include <gfx/convert.h>
+
+#include <core/graphics_driver.h>
+
+DFB_GRAPHICS_DRIVER( sdlgraphics )
+
+#include "sdl.h"
+
+/* FIXME: support for destination color keying */
+
+#define SDL_DRAWING_FLAGS \
+ (DSDRAW_NOFX)
+
+#define SDL_DRAWING_FUNCTIONS \
+ (DFXL_FILLRECTANGLE)
+
+#define SDL_BLITTING_FLAGS \
+ (DSBLIT_SRC_COLORKEY)
+
+#define SDL_BLITTING_FUNCTIONS \
+ (DFXL_BLIT)
+
+D_DEBUG_DOMAIN( SDL_GFX, "SDL/Graphics", "SDL Graphics" );
+
+typedef struct {
+} SDLDriverData;
+
+typedef struct {
+ SDL_Surface *dest;
+ SDL_Surface *source;
+
+ u32 color;
+
+ bool color_valid;
+ bool key_valid;
+} SDLDeviceData;
+
+
+static DFBResult sdlEngineSync( void *drv, void *dev )
+{
+ return DFB_OK;
+}
+
+static void sdlCheckState( void *drv, void *dev,
+ CardState *state, DFBAccelerationMask accel )
+{
+ /* check destination format first */
+ switch (state->destination->config.format) {
+ case DSPF_RGB16:
+ case DSPF_RGB32:
+ break;
+ default:
+ return;
+ }
+
+ if (DFB_DRAWING_FUNCTION( accel )) {
+ /* if there are no other drawing flags than the supported */
+ if (state->drawingflags & ~SDL_DRAWING_FLAGS)
+ return;
+
+ state->accel |= SDL_DRAWING_FUNCTIONS;
+ }
+ else {
+ /* if there are no other blitting flags than the supported
+ and the source and destination formats are the same */
+ if (state->blittingflags & ~SDL_BLITTING_FLAGS)
+ return;
+
+ /* check source format */
+ switch (state->source->config.format) {
+ case DSPF_RGB16:
+ case DSPF_RGB32:
+ break;
+ default:
+ return;
+ }
+
+ state->accel |= SDL_BLITTING_FUNCTIONS;
+ }
+}
+
+static void sdlSetState( void *drv, void *dev, GraphicsDeviceFuncs *funcs,
+ CardState *state, DFBAccelerationMask accel )
+{
+ SDLDeviceData *sdev = (SDLDeviceData*) dev;
+
+ sdev->dest = state->dst.handle;
+ sdev->source = state->src.handle;
+
+ if (state->mod_hw & (SMF_SOURCE | SMF_BLITTING_FLAGS | SMF_SRC_COLORKEY))
+ sdev->key_valid = false;
+
+ if (state->mod_hw & (SMF_DESTINATION | SMF_COLOR))
+ sdev->color_valid = false;
+
+ switch (accel) {
+ case DFXL_FILLRECTANGLE:
+ if (!sdev->color_valid) {
+ switch (state->destination->config.format) {
+ case DSPF_RGB16:
+ case DSPF_RGB32:
+ sdev->color = dfb_color_to_pixel( state->destination->config.format,
+ state->color.r,
+ state->color.g,
+ state->color.b );
+ break;
+
+ default:
+ D_BUG( "unexpected format" );
+ }
+
+ sdev->color_valid = true;
+ }
+
+ state->set |= SDL_DRAWING_FUNCTIONS;
+ break;
+
+ case DFXL_BLIT:
+ if (!sdev->key_valid) {
+ SDL_SetColorKey( sdev->source,
+ (state->blittingflags &
+ DSBLIT_SRC_COLORKEY) ? SDL_SRCCOLORKEY : 0,
+ state->src_colorkey | 0xff000000 );
+
+ sdev->key_valid = true;
+ }
+
+ state->set |= SDL_BLITTING_FUNCTIONS;
+ break;
+
+ default:
+ D_BUG("unexpected acceleration" );
+ break;
+ }
+
+ state->mod_hw = 0;
+}
+
+static bool sdlFillRectangle( void *drv, void *dev, DFBRectangle *rect )
+{
+ SDLDeviceData *sdev = (SDLDeviceData*) dev;
+ SDL_Rect dr;
+
+ dr.x = rect->x;
+ dr.y = rect->y;
+ dr.w = rect->w;
+ dr.h = rect->h;
+
+ return SDL_FillRect( sdev->dest, &dr, sdev->color ) == 0;
+}
+
+static bool sdlBlit( void *drv, void *dev, DFBRectangle *rect, int dx, int dy )
+{
+ SDLDeviceData *sdev = (SDLDeviceData*) dev;
+ SDL_Rect sr, dr;
+
+ D_DEBUG_AT( SDL_GFX, "%s()\n", __FUNCTION__ );
+
+ sr.x = rect->x;
+ sr.y = rect->y;
+ sr.w = rect->w;
+ sr.h = rect->h;
+
+ dr.x = dx;
+ dr.y = dy;
+ dr.w = rect->w;
+ dr.h = rect->h;
+
+ return SDL_BlitSurface( sdev->source, &sr, sdev->dest, &dr ) == 0;
+}
+
+
+/* exported symbols */
+
+static int
+driver_probe( CoreGraphicsDevice *device )
+{
+ return dfb_system_type() == CORE_SDL;
+}
+
+static void
+driver_get_info( CoreGraphicsDevice *device,
+ GraphicsDriverInfo *info )
+{
+ /* fill driver info structure */
+ snprintf( info->name,
+ DFB_GRAPHICS_DRIVER_INFO_NAME_LENGTH,
+ "SDL Graphics Driver" );
+
+ snprintf( info->vendor,
+ DFB_GRAPHICS_DRIVER_INFO_VENDOR_LENGTH,
+ "directfb.org" );
+
+ info->version.major = 0;
+ info->version.minor = 1;
+
+ info->driver_data_size = sizeof (SDLDriverData);
+ info->device_data_size = sizeof (SDLDeviceData);
+}
+
+static DFBResult
+driver_init_driver( CoreGraphicsDevice *device,
+ GraphicsDeviceFuncs *funcs,
+ void *driver_data,
+ void *device_data,
+ CoreDFB *core )
+{
+ /* fill acceleration function table */
+ funcs->EngineSync = sdlEngineSync;
+ funcs->CheckState = sdlCheckState;
+ funcs->SetState = sdlSetState;
+
+ funcs->FillRectangle = sdlFillRectangle;
+ funcs->Blit = sdlBlit;
+
+ return DFB_OK;
+}
+
+static DFBResult
+driver_init_device( CoreGraphicsDevice *device,
+ GraphicsDeviceInfo *device_info,
+ void *driver_data,
+ void *device_data )
+{
+ /* fill device info */
+ snprintf( device_info->name,
+ DFB_GRAPHICS_DEVICE_INFO_NAME_LENGTH, "Graphics" );
+
+ snprintf( device_info->vendor,
+ DFB_GRAPHICS_DEVICE_INFO_VENDOR_LENGTH, "SDL" );
+
+
+ device_info->caps.flags = CCF_READSYSMEM;
+ device_info->caps.accel = SDL_DRAWING_FUNCTIONS |
+ SDL_BLITTING_FUNCTIONS;
+ device_info->caps.drawing = SDL_DRAWING_FLAGS;
+ device_info->caps.blitting = SDL_BLITTING_FLAGS;
+
+ return DFB_OK;
+}
+
+static void
+driver_close_device( CoreGraphicsDevice *device,
+ void *driver_data,
+ void *device_data )
+{
+}
+
+static void
+driver_close_driver( CoreGraphicsDevice *device,
+ void *driver_data )
+{
+}
+
diff --git a/Source/DirectFB/systems/sdl/sdlinput.c b/Source/DirectFB/systems/sdl/sdlinput.c
new file mode 100755
index 0000000..4b94b14
--- /dev/null
+++ b/Source/DirectFB/systems/sdl/sdlinput.c
@@ -0,0 +1,571 @@
+/*
+ (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org)
+ (c) Copyright 2000-2004 Convergence (integrated media) GmbH
+
+ All rights reserved.
+
+ Written by Denis Oliver Kropp <dok@directfb.org>,
+ Andreas Hundt <andi@fischlustig.de>,
+ Sven Neumann <neo@directfb.org>,
+ Ville Syrjälä <syrjala@sci.fi> and
+ Claudio Ciccani <klan@users.sf.net>.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ 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
+ Lesser General Public License for more details.
+
+ 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <config.h>
+
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <directfb.h>
+
+#include <SDL.h>
+
+#include <core/coredefs.h>
+#include <core/coretypes.h>
+#include <core/input.h>
+#include <core/system.h>
+
+#include <direct/mem.h>
+#include <direct/thread.h>
+
+#include "sdl.h"
+
+#include <core/input_driver.h>
+
+
+DFB_INPUT_DRIVER( sdlinput )
+
+/*
+ * declaration of private data
+ */
+typedef struct {
+ CoreInputDevice *device;
+ DirectThread *thread;
+ DFBSDL *dfb_sdl;
+ int stop;
+} SDLInputData;
+
+
+static DFBInputEvent motionX = {
+ .type = DIET_UNKNOWN,
+ .axisabs = 0,
+};
+
+static DFBInputEvent motionY = {
+ .type = DIET_UNKNOWN,
+ .axisabs = 0,
+};
+
+static void
+motion_compress( int x, int y )
+{
+ if (motionX.axisabs != x) {
+ motionX.type = DIET_AXISMOTION;
+ motionX.flags = DIEF_AXISABS;
+ motionX.axis = DIAI_X;
+ motionX.axisabs = x;
+ }
+
+ if (motionY.axisabs != y) {
+ motionY.type = DIET_AXISMOTION;
+ motionY.flags = DIEF_AXISABS;
+ motionY.axis = DIAI_Y;
+ motionY.axisabs = y;
+ }
+}
+
+static void
+motion_realize( SDLInputData *data )
+{
+ if (motionX.type != DIET_UNKNOWN) {
+ if (motionY.type != DIET_UNKNOWN) {
+ /* let DirectFB know two events are coming */
+ motionX.flags |= DIEF_FOLLOW;
+ }
+
+ dfb_input_dispatch( data->device, &motionX );
+
+ motionX.type = DIET_UNKNOWN;
+ }
+
+ if (motionY.type != DIET_UNKNOWN) {
+ dfb_input_dispatch( data->device, &motionY );
+
+ motionY.type = DIET_UNKNOWN;
+ }
+}
+
+static bool
+translate_key( SDLKey key, DFBInputEvent *evt )
+{
+ evt->flags = DIEF_KEYID;
+ /* Numeric keypad */
+ if (key >= SDLK_KP0 && key <= SDLK_KP9) {
+ evt->key_id = DIKI_KP_0 + key - SDLK_KP0;
+ return true;
+ }
+
+ /* Function keys */
+ if (key >= SDLK_F1 && key <= SDLK_F12) {
+ evt->key_id = DIKI_F1 + key - SDLK_F1;
+ return true;
+ }
+
+ /* letter keys */
+ if (key >= SDLK_a && key <= SDLK_z) {
+ evt->key_id = DIKI_A + key - SDLK_a;
+ return true;
+ }
+
+ if (key >= SDLK_0 && key <= SDLK_9) {
+ evt->key_id = DIKI_0 + key - SDLK_0;
+ return true;
+ }
+
+ switch (key) {
+ case SDLK_QUOTE:
+ evt->key_id = DIKI_QUOTE_RIGHT;
+ return true;
+ case SDLK_BACKQUOTE:
+ evt->key_id = DIKI_QUOTE_LEFT;
+ return true;
+ case SDLK_COMMA:
+ evt->key_id = DIKI_COMMA;
+ return true;
+ case SDLK_MINUS:
+ evt->key_id = DIKI_MINUS_SIGN;
+ return true;
+ case SDLK_PERIOD:
+ evt->key_id = DIKI_PERIOD;
+ return true;
+ case SDLK_SLASH:
+ evt->key_id = DIKI_SLASH;
+ return true;
+ case SDLK_SEMICOLON:
+ evt->key_id = DIKI_SEMICOLON;
+ return true;
+ case SDLK_LESS:
+ evt->key_id = DIKI_LESS_SIGN;
+ return true;
+ case SDLK_EQUALS:
+ evt->key_id = DIKI_EQUALS_SIGN;
+ return true;
+ case SDLK_LEFTBRACKET:
+ evt->key_id = DIKI_BRACKET_LEFT;
+ return true;
+ case SDLK_RIGHTBRACKET:
+ evt->key_id = DIKI_BRACKET_RIGHT;
+ return true;
+ case SDLK_BACKSLASH:
+ evt->key_id = DIKI_BACKSLASH;
+ return true;
+ /* Numeric keypad */
+ case SDLK_KP_PERIOD:
+ evt->key_id = DIKI_KP_DECIMAL;
+ return true;
+
+ case SDLK_KP_DIVIDE:
+ evt->key_id = DIKI_KP_DIV;
+ return true;
+
+ case SDLK_KP_MULTIPLY:
+ evt->key_id = DIKI_KP_MULT;
+ return true;
+
+ case SDLK_KP_MINUS:
+ evt->key_id = DIKI_KP_MINUS;
+ return true;
+ case SDLK_KP_PLUS:
+ evt->key_id = DIKI_KP_PLUS;
+ return true;
+ case SDLK_KP_ENTER:
+ evt->key_id = DIKI_KP_ENTER;
+ return true;
+
+ case SDLK_KP_EQUALS:
+ evt->key_id = DIKI_KP_EQUAL;
+ return true;
+ case SDLK_ESCAPE:
+ evt->key_id = DIKI_ESCAPE;
+ return true;
+ case SDLK_TAB:
+ evt->key_id = DIKI_TAB;
+ return true;
+ case SDLK_RETURN:
+ evt->key_id = DIKI_ENTER;
+ return true;
+ case SDLK_SPACE:
+ evt->key_id = DIKI_SPACE;
+ return true;
+ case SDLK_BACKSPACE:
+ evt->key_id = DIKI_BACKSPACE;
+ return true;
+ case SDLK_INSERT:
+ evt->key_id = DIKI_INSERT;
+ return true;
+ case SDLK_DELETE:
+ evt->key_id = DIKI_DELETE;
+ return true;
+ case SDLK_PRINT:
+ evt->key_id = DIKI_PRINT;
+ return true;
+ case SDLK_PAUSE:
+ evt->key_id = DIKI_PAUSE;
+ return true;
+ /* Arrows + Home/End pad */
+ case SDLK_UP:
+ evt->key_id = DIKI_UP;
+ return true;
+
+ case SDLK_DOWN:
+ evt->key_id = DIKI_DOWN;
+ return true;
+
+ case SDLK_RIGHT:
+ evt->key_id = DIKI_RIGHT;
+ return true;
+ case SDLK_LEFT:
+ evt->key_id = DIKI_LEFT;
+ return true;
+ case SDLK_HOME:
+ evt->key_id = DIKI_HOME;
+ return true;
+ case SDLK_END:
+ evt->key_id = DIKI_END;
+ return true;
+
+ case SDLK_PAGEUP:
+ evt->key_id = DIKI_PAGE_UP;
+ return true;
+
+ case SDLK_PAGEDOWN:
+ evt->key_id = DIKI_PAGE_DOWN;
+ return true;
+
+
+ /* Key state modifier keys */
+ case SDLK_NUMLOCK:
+ evt->key_id = DIKI_NUM_LOCK;
+ return true;
+
+ case SDLK_CAPSLOCK:
+ evt->key_id = DIKI_CAPS_LOCK;
+ return true;
+ case SDLK_SCROLLOCK:
+ evt->key_id = DIKI_SCROLL_LOCK;
+ return true;
+ case SDLK_RSHIFT:
+ evt->key_id = DIKI_SHIFT_R;
+ return true;
+
+ case SDLK_LSHIFT:
+ evt->key_id = DIKI_SHIFT_L;
+ return true;
+ case SDLK_RCTRL:
+ evt->key_id = DIKI_CONTROL_R;
+ return true;
+
+ case SDLK_LCTRL:
+ evt->key_id = DIKI_CONTROL_L;
+ return true;
+
+ case SDLK_RALT:
+ evt->key_id = DIKI_ALT_R;
+ return true;
+
+ case SDLK_LALT:
+ evt->key_id = DIKI_ALT_L;
+ return true;
+
+ case SDLK_RMETA:
+ evt->key_id = DIKI_META_R;
+ return true;
+
+ case SDLK_LMETA:
+ evt->key_id = DIKI_META_L;
+ return true;
+
+ case SDLK_LSUPER:
+ evt->key_id = DIKI_SUPER_L;
+ return true;
+
+ case SDLK_RSUPER:
+ evt->key_id = DIKI_SUPER_R;
+ return true;
+
+ case SDLK_MODE:
+ evt->key_id = DIKI_ALT_R;
+ evt->flags |= DIEF_KEYSYMBOL;
+ evt->key_symbol = DIKS_ALTGR;
+ return true;
+ default:
+ break;
+ }
+
+ evt->flags = DIEF_NONE;
+ return false;
+}
+
+/*
+ * Input thread reading from device.
+ * Generates events on incoming data.
+ */
+static void*
+sdlEventThread( DirectThread *thread, void *driver_data )
+{
+ SDLInputData *data = (SDLInputData*) driver_data;
+ DFBSDL *dfb_sdl = data->dfb_sdl;
+
+ while (!data->stop) {
+ DFBInputEvent evt;
+ SDL_Event event;
+
+ fusion_skirmish_prevail( &dfb_sdl->lock );
+
+ /* Check for events */
+ while ( SDL_PollEvent(&event) ) {
+ fusion_skirmish_dismiss( &dfb_sdl->lock );
+
+ switch (event.type) {
+ case SDL_MOUSEMOTION:
+ motion_compress( event.motion.x, event.motion.y );
+ break;
+
+ case SDL_MOUSEBUTTONUP:
+ case SDL_MOUSEBUTTONDOWN:
+ motion_realize( data );
+
+ if (event.type == SDL_MOUSEBUTTONDOWN)
+ evt.type = DIET_BUTTONPRESS;
+ else
+ evt.type = DIET_BUTTONRELEASE;
+
+ evt.flags = DIEF_NONE;
+
+ switch (event.button.button) {
+ case SDL_BUTTON_LEFT:
+ evt.button = DIBI_LEFT;
+ break;
+ case SDL_BUTTON_MIDDLE:
+ evt.button = DIBI_MIDDLE;
+ break;
+ case SDL_BUTTON_RIGHT:
+ evt.button = DIBI_RIGHT;
+ break;
+ case SDL_BUTTON_WHEELUP:
+ case SDL_BUTTON_WHEELDOWN:
+ if (event.type != SDL_MOUSEBUTTONDOWN) {
+ fusion_skirmish_prevail( &dfb_sdl->lock );
+ continue;
+ }
+ evt.type = DIET_AXISMOTION;
+ evt.flags = DIEF_AXISREL;
+ evt.axis = DIAI_Z;
+ if (event.button.button == SDL_BUTTON_WHEELUP)
+ evt.axisrel = -1;
+ else
+ evt.axisrel = 1;
+ break;
+ default:
+ fusion_skirmish_prevail( &dfb_sdl->lock );
+ continue;
+ }
+
+ dfb_input_dispatch( data->device, &evt );
+ break;
+
+ case SDL_KEYUP:
+ case SDL_KEYDOWN:
+ if (event.type == SDL_KEYDOWN)
+ evt.type = DIET_KEYPRESS;
+ else
+ evt.type = DIET_KEYRELEASE;
+
+ /* Get a key id first */
+ translate_key( event.key.keysym.sym, &evt );
+
+ /* If SDL provided a symbol, use it */
+ if (event.key.keysym.unicode) {
+ evt.flags |= DIEF_KEYSYMBOL;
+ evt.key_symbol = event.key.keysym.unicode;
+
+ /**
+ * Hack to translate the Control+[letter]
+ * combination to
+ * Modifier: CONTROL, Key Symbol: [letter]
+ * A side effect here is that Control+Backspace
+ * produces Control+h
+ */
+ if (evt.modifiers == DIMM_CONTROL &&
+ evt.key_symbol >= 1 && evt.key_symbol <= ('z'-'a'+1))
+ {
+ evt.key_symbol += 'a'-1;
+ }
+ }
+
+ dfb_input_dispatch( data->device, &evt );
+ break;
+ case SDL_QUIT:
+ evt.type = DIET_KEYPRESS;
+ evt.flags = DIEF_KEYSYMBOL;
+ evt.key_symbol = DIKS_ESCAPE;
+
+ dfb_input_dispatch( data->device, &evt );
+
+ evt.type = DIET_KEYRELEASE;
+ evt.flags = DIEF_KEYSYMBOL;
+ evt.key_symbol = DIKS_ESCAPE;
+
+ dfb_input_dispatch( data->device, &evt );
+ break;
+
+ default:
+ break;
+ }
+
+ fusion_skirmish_prevail( &dfb_sdl->lock );
+ }
+
+ fusion_skirmish_dismiss( &dfb_sdl->lock );
+
+ motion_realize( data );
+
+ usleep(10000);
+
+ direct_thread_testcancel( thread );
+ }
+
+ return NULL;
+}
+
+/* exported symbols */
+
+/*
+ * Return the number of available devices.
+ * Called once during initialization of DirectFB.
+ */
+static int
+driver_get_available( void )
+{
+ if (dfb_system_type() == CORE_SDL)
+ return 1;
+
+ return 0;
+}
+
+/*
+ * Fill out general information about this driver.
+ * Called once during initialization of DirectFB.
+ */
+static void
+driver_get_info( InputDriverInfo *info )
+{
+ /* fill driver info structure */
+ snprintf ( info->name,
+ DFB_INPUT_DRIVER_INFO_NAME_LENGTH, "SDL Input Driver" );
+ snprintf ( info->vendor,
+ DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH, "Denis Oliver Kropp" );
+
+ info->version.major = 0;
+ info->version.minor = 1;
+}
+
+/*
+ * Open the device, fill out information about it,
+ * allocate and fill private data, start input thread.
+ * Called during initialization, resuming or taking over mastership.
+ */
+static DFBResult
+driver_open_device( CoreInputDevice *device,
+ unsigned int number,
+ InputDeviceInfo *info,
+ void **driver_data )
+{
+ SDLInputData *data;
+ DFBSDL *dfb_sdl = dfb_system_data();
+
+ fusion_skirmish_prevail( &dfb_sdl->lock );
+
+ SDL_EnableUNICODE( true );
+
+ SDL_EnableKeyRepeat( 250, 40 );
+
+ fusion_skirmish_dismiss( &dfb_sdl->lock );
+
+ /* set device name */
+ snprintf( info->desc.name,
+ DFB_INPUT_DEVICE_DESC_NAME_LENGTH, "SDL Input" );
+
+ /* set device vendor */
+ snprintf( info->desc.vendor,
+ DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "SDL" );
+
+ /* set one of the primary input device IDs */
+ info->prefered_id = DIDID_KEYBOARD;
+
+ /* set type flags */
+ info->desc.type = DIDTF_JOYSTICK | DIDTF_KEYBOARD | DIDTF_MOUSE;
+
+ /* set capabilities */
+ info->desc.caps = DICAPS_ALL;
+
+
+ /* allocate and fill private data */
+ data = D_CALLOC( 1, sizeof(SDLInputData) );
+
+ data->device = device;
+ data->dfb_sdl = dfb_sdl;
+
+ /* start input thread */
+ data->thread = direct_thread_create( DTT_INPUT, sdlEventThread, data, "SDL Input" );
+
+ /* set private data pointer */
+ *driver_data = data;
+
+ return DFB_OK;
+}
+
+/*
+ * Fetch one entry from the device's keymap if supported.
+ */
+static DFBResult
+driver_get_keymap_entry( CoreInputDevice *device,
+ void *driver_data,
+ DFBInputDeviceKeymapEntry *entry )
+{
+ return DFB_UNSUPPORTED;
+}
+/*
+ * End thread, close device and free private data.
+ */
+static void
+driver_close_device( void *driver_data )
+{
+ SDLInputData *data = (SDLInputData*) driver_data;
+
+ /* stop input thread */
+ data->stop = 1;
+
+ direct_thread_join( data->thread );
+ direct_thread_destroy( data->thread );
+
+ /* free private data */
+ D_FREE ( data );
+}
+