diff options
Diffstat (limited to 'Source/DirectFB/systems/vnc')
-rwxr-xr-x | Source/DirectFB/systems/vnc/Makefile.am | 55 | ||||
-rwxr-xr-x | Source/DirectFB/systems/vnc/Makefile.in | 682 | ||||
-rwxr-xr-x | Source/DirectFB/systems/vnc/primary.c | 993 | ||||
-rwxr-xr-x | Source/DirectFB/systems/vnc/primary.h | 50 | ||||
-rwxr-xr-x | Source/DirectFB/systems/vnc/vnc.c | 313 | ||||
-rwxr-xr-x | Source/DirectFB/systems/vnc/vnc.h | 86 | ||||
-rwxr-xr-x | Source/DirectFB/systems/vnc/vncinput.c | 128 |
7 files changed, 2307 insertions, 0 deletions
diff --git a/Source/DirectFB/systems/vnc/Makefile.am b/Source/DirectFB/systems/vnc/Makefile.am new file mode 100755 index 0000000..025bf6a --- /dev/null +++ b/Source/DirectFB/systems/vnc/Makefile.am @@ -0,0 +1,55 @@ +## Makefile.am for DirectFB/systems/vnc + +INCLUDES = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/src \ + $(VNC_CFLAGS) + +systemsdir = $(MODULEDIR)/systems + +if BUILD_STATIC +systems_DATA = libdirectfb_vnc.o +endif + +systems_LTLIBRARIES = libdirectfb_vnc.la + +inputdriversdir = $(MODULEDIR)/inputdrivers + +if BUILD_STATIC +inputdrivers_DATA = libdirectfb_vncinput.o +endif +inputdrivers_LTLIBRARIES = libdirectfb_vncinput.la + +libdirectfb_vnc_la_LDFLAGS = \ + $(VNC_LIBS) \ + -avoid-version \ + -module + +libdirectfb_vnc_la_SOURCES = \ + primary.c \ + primary.h \ + vnc.c \ + vnc.h + +libdirectfb_vnc_la_LIBADD = \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la + +libdirectfb_vncinput_la_LDFLAGS = \ + $(VNC_LIBS) \ + -avoid-version \ + -module + +libdirectfb_vncinput_la_SOURCES = \ + vncinput.c + +libdirectfb_vncinput_la_LIBADD = \ + $(top_builddir)/src/libdirectfb.la + + +include $(top_srcdir)/rules/libobject.make + diff --git a/Source/DirectFB/systems/vnc/Makefile.in b/Source/DirectFB/systems/vnc/Makefile.in new file mode 100755 index 0000000..f509745 --- /dev/null +++ b/Source/DirectFB/systems/vnc/Makefile.in @@ -0,0 +1,682 @@ +# 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/vnc +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)$(inputdriversdir)" \ + "$(DESTDIR)$(systemsdir)" "$(DESTDIR)$(inputdriversdir)" \ + "$(DESTDIR)$(systemsdir)" +inputdriversLTLIBRARIES_INSTALL = $(INSTALL) +systemsLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(inputdrivers_LTLIBRARIES) $(systems_LTLIBRARIES) +libdirectfb_vnc_la_DEPENDENCIES = \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la +am_libdirectfb_vnc_la_OBJECTS = primary.lo vnc.lo +libdirectfb_vnc_la_OBJECTS = $(am_libdirectfb_vnc_la_OBJECTS) +libdirectfb_vnc_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libdirectfb_vnc_la_LDFLAGS) $(LDFLAGS) -o $@ +libdirectfb_vncinput_la_DEPENDENCIES = \ + $(top_builddir)/src/libdirectfb.la +am_libdirectfb_vncinput_la_OBJECTS = vncinput.lo +libdirectfb_vncinput_la_OBJECTS = \ + $(am_libdirectfb_vncinput_la_OBJECTS) +libdirectfb_vncinput_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libdirectfb_vncinput_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_vnc_la_SOURCES) \ + $(libdirectfb_vncinput_la_SOURCES) +DIST_SOURCES = $(libdirectfb_vnc_la_SOURCES) \ + $(libdirectfb_vncinput_la_SOURCES) +inputdriversDATA_INSTALL = $(INSTALL_DATA) +systemsDATA_INSTALL = $(INSTALL_DATA) +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 \ + $(VNC_CFLAGS) + +systemsdir = $(MODULEDIR)/systems +@BUILD_STATIC_TRUE@systems_DATA = libdirectfb_vnc.o +systems_LTLIBRARIES = libdirectfb_vnc.la +inputdriversdir = $(MODULEDIR)/inputdrivers +@BUILD_STATIC_TRUE@inputdrivers_DATA = libdirectfb_vncinput.o +inputdrivers_LTLIBRARIES = libdirectfb_vncinput.la +libdirectfb_vnc_la_LDFLAGS = \ + $(VNC_LIBS) \ + -avoid-version \ + -module + +libdirectfb_vnc_la_SOURCES = \ + primary.c \ + primary.h \ + vnc.c \ + vnc.h + +libdirectfb_vnc_la_LIBADD = \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la + +libdirectfb_vncinput_la_LDFLAGS = \ + $(VNC_LIBS) \ + -avoid-version \ + -module + +libdirectfb_vncinput_la_SOURCES = \ + vncinput.c + +libdirectfb_vncinput_la_LIBADD = \ + $(top_builddir)/src/libdirectfb.la + +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/vnc/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu systems/vnc/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-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_vnc.la: $(libdirectfb_vnc_la_OBJECTS) $(libdirectfb_vnc_la_DEPENDENCIES) + $(libdirectfb_vnc_la_LINK) -rpath $(systemsdir) $(libdirectfb_vnc_la_OBJECTS) $(libdirectfb_vnc_la_LIBADD) $(LIBS) +libdirectfb_vncinput.la: $(libdirectfb_vncinput_la_OBJECTS) $(libdirectfb_vncinput_la_DEPENDENCIES) + $(libdirectfb_vncinput_la_LINK) -rpath $(inputdriversdir) $(libdirectfb_vncinput_la_OBJECTS) $(libdirectfb_vncinput_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)/vnc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vncinput.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-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)$(inputdriversdir)" "$(DESTDIR)$(systemsdir)" "$(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-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-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-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-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-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-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/vnc/primary.c b/Source/DirectFB/systems/vnc/primary.c new file mode 100755 index 0000000..17de20e --- /dev/null +++ b/Source/DirectFB/systems/vnc/primary.c @@ -0,0 +1,993 @@ +/* + (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 <dlfcn.h> + +#include <directfb.h> +#include <directfb_util.h> + +#include <fusion/fusion.h> +#include <fusion/shmalloc.h> + +#include <core/core.h> +#include <core/coredefs.h> +#include <core/coretypes.h> +#include <core/gfxcard.h> +#include <core/layers.h> +#include <core/palette.h> +#include <core/state.h> +#include <core/surface.h> +#include <core/system.h> +#include <core/input.h> + +#include <gfx/convert.h> +#include <gfx/util.h> + +#include <misc/conf.h> + +#include <direct/memcpy.h> +#include <direct/messages.h> +#include <direct/thread.h> + +#include <rfb/rfb.h> +#include <rfb/keysym.h> +#include "vnc.h" +#include "primary.h" + + +D_DEBUG_DOMAIN( VNC_Layer, "VNC/Layer", "VNC Layer" ); + +/**********************************************************************************************************************/ + +/******************************************************************************/ +/*VNC server setup*/ +/* Here we create a structure so that every client has it's own pointer */ + +typedef struct ClientData { + DFBVNC *vnc; + int oldButtonMask; + int oldx,oldy; +} ClientData; + +static void process_key_event(rfbBool down, rfbKeySym key, struct _rfbClientRec* cl); +static void process_pointer_event(int buttonMask, int x, int y, struct _rfbClientRec* cl); +static bool translate_key(rfbKeySym key, DFBInputEvent *evt ); +static void clientgone(rfbClientPtr cl); +static enum rfbNewClientAction newclient(rfbClientPtr cl); + +extern CoreInputDevice *vncInputDevice; + +/******************************************************************************/ + +static DFBResult +primaryInitScreen( CoreScreen *screen, + CoreGraphicsDevice *device, + void *driver_data, + void *screen_data, + DFBScreenDescription *description ) +{ + int argc = 0; + char **argv = NULL; + DFBVNC *vnc = driver_data; + DFBVNCShared *shared = vnc->shared; + + /* Set the screen capabilities. */ + description->caps = DSCCAPS_NONE; + + /* Set the screen name. */ + direct_snputs( description->name, "VNC Primary Screen", DFB_SCREEN_DESC_NAME_LENGTH ); + + /* + * Allocate shared memory for RFB screen frame buffer + */ + shared->screen_buffer = SHCALLOC( dfb_core_shmpool_data(vnc->core), 2 * shared->screen_size.h, 4 * shared->screen_size.w ); + if (!shared->screen_buffer) + return D_OOSHM(); + + + /* Set video mode */ + vnc->rfb_screen = rfbGetScreen( &argc, argv, shared->screen_size.w, shared->screen_size.h, 8, 3, 4 ); + if (!vnc->rfb_screen) { + D_ERROR( "DirectFB/VNC: rfbGetScreen( %dx%d, 8, 3, 4 ) failed!\n", shared->screen_size.w, shared->screen_size.h ); + SHFREE( dfb_core_shmpool_data(vnc->core), shared->screen_buffer ); + return DFB_FAILURE; + } + + vnc->rfb_screen->screenData = vnc; + + rfbNewFramebuffer( vnc->rfb_screen, shared->screen_buffer, shared->screen_size.w, shared->screen_size.h, 8, 3, 4 ); + + vnc->rfb_screen->serverFormat.redShift = 16; + vnc->rfb_screen->serverFormat.greenShift = 8; + vnc->rfb_screen->serverFormat.blueShift = 0; + vnc->rfb_screen->serverFormat.redMax = 255; + vnc->rfb_screen->serverFormat.greenMax = 255; + vnc->rfb_screen->serverFormat.blueMax = 255; + + + /* Connect key handler */ + + vnc->rfb_screen->kbdAddEvent = process_key_event; + vnc->rfb_screen->ptrAddEvent = process_pointer_event; + vnc->rfb_screen->newClientHook = newclient; + vnc->rfb_screen->autoPort = TRUE; + + /* Initialize VNC */ + + rfbInitServer(vnc->rfb_screen); + + if (vnc->rfb_screen->listenSock == -1) { + D_ERROR( "DirectFB/VNC: rfbInitServer() failed to initialize listening socket!\n" ); + SHFREE( dfb_core_shmpool_data(vnc->core), shared->screen_buffer ); + return DFB_FAILURE; + } + + + DFBResult ret; + CoreSurfaceConfig config; + + config.flags = CSCONF_SIZE | CSCONF_FORMAT | CSCONF_CAPS | CSCONF_PREALLOCATED; + config.size.w = shared->screen_size.w; + config.size.h = shared->screen_size.h; + config.format = DSPF_ARGB; + config.caps = DSCAPS_SYSTEMONLY | DSCAPS_DOUBLE;// | DSCAPS_SHARED; + config.preallocated[0].addr = shared->screen_buffer; + config.preallocated[0].pitch = shared->screen_size.w * 4; + config.preallocated[1].addr = shared->screen_buffer + shared->screen_size.w * 4 * shared->screen_size.h; + config.preallocated[1].pitch = shared->screen_size.w * 4; + + ret = dfb_surface_create( vnc->core, &config, CSTF_PREALLOCATED, 0, NULL, &shared->screen_surface ); + if (ret) { + D_DERROR( ret, "DirectFB/VNC: Could not create preallocated screen surface!\n" ); + SHFREE( dfb_core_shmpool_data(vnc->core), shared->screen_buffer ); + return ret; + } + + + rfbRunEventLoop( vnc->rfb_screen, -1, TRUE ); + + return DFB_OK; +} +/* +static DFBResult +primaryShutdownScreen( CoreScreen *screen, + void *driver_data, + void *screen_data ) +{ + DFBVNC *vnc = driver_data; + + rfbScreenCleanup( vnc->rfb_screen ); + + SHFREE( dfb_core_shmpool_data(vnc->core), vnc->shared->screen_buffer ); + + return DFB_OK; +} +*/ +static DFBResult +primaryGetScreenSize( CoreScreen *screen, + void *driver_data, + void *screen_data, + int *ret_width, + int *ret_height ) +{ + DFBVNC *vnc = driver_data; + + *ret_width = vnc->shared->screen_size.w; + *ret_height = vnc->shared->screen_size.h; + + return DFB_OK; +} + +static const ScreenFuncs _vncPrimaryScreenFuncs = { + .InitScreen = primaryInitScreen, +// .ShutdownScreen = primaryShutdownScreen, + .GetScreenSize = primaryGetScreenSize, +}; + +const ScreenFuncs *vncPrimaryScreenFuncs = &_vncPrimaryScreenFuncs; + +/******************************************************************************/ + +static int +primaryLayerDataSize( void ) +{ + return sizeof(VNCLayerData); +} + +static int +primaryRegionDataSize( void ) +{ + return 0; +} + +static DFBResult +primaryInitLayer( CoreLayer *layer, + void *driver_data, + void *layer_data, + DFBDisplayLayerDescription *description, + DFBDisplayLayerConfig *config, + DFBColorAdjustment *adjustment ) +{ + DFBVNC *vnc = driver_data; + VNCLayerData *data = layer_data; + const char *name; + + D_DEBUG( "DirectFB/VNC: primaryInitLayer\n"); + + char *names[] = { "Primary", "Secondary", "Tertiary" }; + + if (vnc->layer_count < 3) + name = names[vnc->layer_count]; + else + name = "Other"; + + data->layer_id = vnc->layer_count; + + vnc->shared->layer_data[vnc->layer_count++] = data; + + + /* set capabilities and type */ + description->caps = DLCAPS_SURFACE | DLCAPS_SCREEN_LOCATION | DLCAPS_ALPHACHANNEL | DLCAPS_OPACITY; + description->type = DLTF_GRAPHICS; + + /* set name */ + snprintf( description->name, + DFB_DISPLAY_LAYER_DESC_NAME_LENGTH, "VNC %s Layer", name ); + + /* fill out the default configuration */ + config->flags = DLCONF_WIDTH | DLCONF_HEIGHT | + DLCONF_PIXELFORMAT | DLCONF_BUFFERMODE; + config->buffermode = DLBM_FRONTONLY; + config->width = vnc->shared->screen_size.w; + config->height = vnc->shared->screen_size.h; + + 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_RGB32; + + 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: + case DLBM_TRIPLE: + break; + + default: + fail |= CLRCF_BUFFERMODE; + break; + } + + if (config->options & ~(DLOP_ALPHACHANNEL | DLOP_OPACITY)) + 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 +UpdateScreen( DFBVNC *vnc, + const DFBRectangle *update ) +{ + DFBVNCShared *shared = vnc->shared; + DFBRegion clip = { 0, 0, shared->screen_size.w - 1, shared->screen_size.h - 1 }; + CardState state; + unsigned int i; + + D_DEBUG_AT( VNC_Layer, "%s()\n", __FUNCTION__ ); + + if (update) { + if (!dfb_region_rectangle_intersect( &clip, update )) { + D_DEBUG_AT( VNC_Layer, " -> update not intersecting with screen area!\n" ); + return DFB_OK; + } + } + + dfb_state_init( &state, vnc->core ); + + state.destination = shared->screen_surface; + state.clip = clip; + state.src_blend = DSBF_ONE; + state.dst_blend = DSBF_INVSRCALPHA; + + // FIXME: optimize out clear + DFBRectangle rect = { + 0, 0, shared->screen_size.w, shared->screen_size.h + }; + + dfb_gfxcard_fillrectangles( &rect, 1, &state ); + + + for (i=0; i<VNC_MAX_LAYERS; i++) { + VNCLayerData *data = shared->layer_data[i]; + + if (data->surface) { + DFBRectangle src = data->config.source; + DFBRectangle dst = data->config.dest; + + state.modified |= SMF_SOURCE | SMF_BLITTING_FLAGS; + state.source = data->surface; + + /* emulate missing hw layer clipping */ + if (dst.x + dst.w > shared->screen_size.w || dst.y + dst.h > shared->screen_size.h) + return DFB_ACCESSDENIED; + + + if (data->config.options & DLOP_ALPHACHANNEL) { + state.blittingflags = DSBLIT_BLEND_ALPHACHANNEL; + + if (!(data->surface->config.caps & DSCAPS_PREMULTIPLIED)) + state.blittingflags |= DSBLIT_SRC_PREMULTIPLY; + } + else + state.blittingflags = DSBLIT_NOFX; + + if ((data->config.options & DLOP_OPACITY) && data->config.opacity != 0xff) { + state.blittingflags |= DSBLIT_BLEND_COLORALPHA; + + if (data->surface->config.caps & DSCAPS_PREMULTIPLIED) + state.blittingflags |= DSBLIT_SRC_PREMULTCOLOR; + + + state.modified |= SMF_COLOR; + state.color.a = data->config.opacity; + } + + dfb_gfxcard_stretchblit( &src, &dst, &state ); + } + } + + state.destination = NULL; + state.source = NULL; + + dfb_state_destroy( &state ); + + + dfb_back_to_front_copy( shared->screen_surface, &clip ); + + + dfb_gfxcard_sync(); + + DirectResult ret; + DFBVNCMarkRectAsModified mark; + + mark.region = clip; + + ret = fusion_call_execute( &shared->call, FCEF_ONEWAY, + (int)((clip.x1 << 16) | clip.x2), + (void*)(long)((clip.y1 << 16) | clip.y2), + NULL ); + if (ret) { + D_DERROR( ret, "DirectFB/VNC: fusion_call_execute2() failed!\n" ); + return ret; + } + + 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 *left_lock ) +{ + DFBVNC *vnc = driver_data; + VNCLayerData *data = layer_data; + + D_DEBUG_AT( VNC_Layer, "%s()\n", __FUNCTION__ ); + + data->config = *config; + + if (updated & CLRCF_OPACITY) + D_DEBUG_AT( VNC_Layer, " -> opacity %d\n", config->opacity ); + + dfb_surface_link( &vnc->shared->layer_data[data->layer_id]->surface, surface ); + + if (data->shown) + return UpdateScreen( vnc, NULL ); + else + D_DEBUG_AT( VNC_Layer, " -> not shown\n" ); + + return DFB_OK; +} + +static DFBResult +primaryRemoveRegion( CoreLayer *layer, + void *driver_data, + void *layer_data, + void *region_data ) +{ + DFBVNC *vnc = driver_data; + VNCLayerData *data = layer_data; + + D_DEBUG_AT( VNC_Layer, "%s()\n", __FUNCTION__ ); + + D_DEBUG_AT( VNC_Layer, " -> setting shown to false\n" ); + + data->shown = false; + + dfb_surface_unlink( &vnc->shared->layer_data[data->layer_id]->surface ); + + return UpdateScreen( vnc, NULL ); +} + +static DFBResult +primaryFlipRegion( CoreLayer *layer, + void *driver_data, + void *layer_data, + void *region_data, + CoreSurface *surface, + DFBSurfaceFlipFlags flags, + CoreSurfaceBufferLock *left_lock ) +{ + DFBVNC *vnc = driver_data; + VNCLayerData *data = layer_data; + + D_DEBUG_AT( VNC_Layer, "%s()\n", __FUNCTION__ ); + + dfb_surface_flip( surface, false ); + + D_DEBUG_AT( VNC_Layer, " -> setting shown to true\n" ); + + data->shown = true; + + return UpdateScreen( vnc, &data->config.dest ); +} + +static DFBResult +primaryUpdateRegion( CoreLayer *layer, + void *driver_data, + void *layer_data, + void *region_data, + CoreSurface *surface, + const DFBRegion *left_update, + CoreSurfaceBufferLock *left_lock ) +{ + DFBVNC *vnc = driver_data; + VNCLayerData *data = layer_data; + + DFBRectangle update = data->config.dest; + + D_DEBUG_AT( VNC_Layer, "%s()\n", __FUNCTION__ ); + + if (left_update) { + DFBRegion screen_update = { + left_update->x1 + data->config.dest.x, + left_update->y1 + data->config.dest.y, + left_update->x2 + data->config.dest.x, + left_update->y2 + data->config.dest.y + }; + + D_DEBUG_AT( VNC_Layer, " -> update %d,%d-%dx%d\n", DFB_RECTANGLE_VALS_FROM_REGION(&screen_update) ); + + if (!dfb_rectangle_intersect_by_region( &update, &screen_update )) { + D_DEBUG_AT( VNC_Layer, " -> no intersection with %d,%d-%dx%d!\n", DFB_RECTANGLE_VALS( &data->config.dest ) ); + + return DFB_OK; + } + } + + D_DEBUG_AT( VNC_Layer, " -> setting shown to true\n" ); + + data->shown = true; + + return UpdateScreen( vnc, &update ); +} + +static DFBResult +primaryAllocateSurface( CoreLayer *layer, + void *driver_data, + void *layer_data, + void *region_data, + CoreLayerRegionConfig *config, + CoreSurface **ret_surface ) +{ + DFBVNC *vnc = driver_data; + CoreSurfaceConfig conf; + + conf.flags = CSCONF_SIZE | CSCONF_FORMAT | CSCONF_CAPS; + conf.size.w = config->width; + conf.size.h = config->height; + conf.format = config->format; + conf.caps = DSCAPS_SYSTEMONLY; + + if (config->buffermode != DLBM_FRONTONLY) + conf.caps |= DSCAPS_DOUBLE; + + return dfb_surface_create( vnc->core, &conf, CSTF_LAYER, DLID_PRIMARY, NULL, ret_surface ); +} + +static DFBResult +primaryReallocateSurface( CoreLayer *layer, + void *driver_data, + void *layer_data, + void *region_data, + CoreLayerRegionConfig *config, + CoreSurface *surface ) +{ + DFBResult ret; + CoreSurfaceConfig conf; + + conf.flags = CSCONF_SIZE | CSCONF_FORMAT | CSCONF_CAPS; + conf.size.w = config->width; + conf.size.h = config->height; + conf.format = config->format; + conf.caps = DSCAPS_SYSTEMONLY; + + if (config->buffermode != DLBM_FRONTONLY) + conf.caps |= DSCAPS_DOUBLE; + + ret = dfb_surface_reconfig( surface, &conf ); + if (ret) + return ret; + + if (DFB_PIXELFORMAT_IS_INDEXED(config->format) && !surface->palette) { + DFBResult ret; + CorePalette *palette; + + ret = dfb_palette_create( NULL, /* FIXME */ + 1 << DFB_COLOR_BITS_PER_PIXEL( config->format ), + &palette ); + if (ret) + return ret; + + if (config->format == DSPF_LUT8) + dfb_palette_generate_rgb332_map( palette ); + + dfb_surface_set_palette( surface, palette ); + + dfb_palette_unref( palette ); + } + + return DFB_OK; +} + +static const DisplayLayerFuncs _vncPrimaryLayerFuncs = { + .LayerDataSize = primaryLayerDataSize, + .RegionDataSize = primaryRegionDataSize, + .InitLayer = primaryInitLayer, + + .TestRegion = primaryTestRegion, + .AddRegion = primaryAddRegion, + .SetRegion = primarySetRegion, + .RemoveRegion = primaryRemoveRegion, + .FlipRegion = primaryFlipRegion, + .UpdateRegion = primaryUpdateRegion, + + .AllocateSurface = primaryAllocateSurface, + .ReallocateSurface = primaryReallocateSurface, +}; + +const DisplayLayerFuncs *vncPrimaryLayerFuncs = &_vncPrimaryLayerFuncs; + + +/**********************************************************************************************************************/ + +/** + VNC Server setup +**/ + +static void +clientgone(rfbClientPtr cl) +{ + D_FREE( cl->clientData ); +} + +static enum rfbNewClientAction +newclient(rfbClientPtr cl) +{ + ClientData *cd; + DFBVNC *vnc = cl->screen->screenData; + + cd = D_CALLOC( 1, sizeof(ClientData) ); + if (!cd) { + D_OOM(); + return RFB_CLIENT_REFUSE; + } + + cd->vnc = vnc; + + cl->clientData = cd; + cl->clientGoneHook = clientgone; + + return RFB_CLIENT_ACCEPT; +} + +static void +send_button_event( DFBInputDeviceButtonIdentifier button, + bool press ) +{ + if (vncInputDevice) { + DFBInputEvent evt; + + evt.flags = DIEF_NONE; + evt.type = press ? DIET_BUTTONPRESS : DIET_BUTTONRELEASE; + evt.button = button; + + dfb_input_dispatch( vncInputDevice, &evt ); + } +} + +static void +process_pointer_event(int buttonMask, int x, int y, rfbClientPtr cl) +{ + if (vncInputDevice) { + ClientData *cd = cl->clientData; + DFBInputEvent evt; + + evt.type = DIET_AXISMOTION; + evt.flags = DIEF_AXISABS | DIEF_MIN | DIEF_MAX; + + if (cd->oldx != x) { + cd->oldx = x; + + evt.axis = DIAI_X; + evt.axisabs = x; + evt.min = 0; + evt.max = cd->vnc->shared->screen_size.w - 1; + + dfb_input_dispatch( vncInputDevice, &evt ); + } + + if (cd->oldy != y) { + cd->oldy = y; + + evt.axis = DIAI_Y; + evt.axisabs = y; + evt.min = 0; + evt.max = cd->vnc->shared->screen_size.h - 1; + + dfb_input_dispatch( vncInputDevice, &evt ); + } + + if (buttonMask != cd->oldButtonMask) { + if ((buttonMask & (1 << 0)) != (cd->oldButtonMask & (1 << 0))) + send_button_event( DIBI_LEFT, !!(buttonMask & (1 << 0)) ); + + if ((buttonMask & (1 << 1)) != (cd->oldButtonMask & (1 << 1))) + send_button_event( DIBI_MIDDLE, !!(buttonMask & (1 << 1)) ); + + if ((buttonMask & (1 << 2)) != (cd->oldButtonMask & (1 << 2))) + send_button_event( DIBI_RIGHT, !!(buttonMask & (1 << 2)) ); + + cd->oldButtonMask = buttonMask; + } + } + + rfbDefaultPtrAddEvent(buttonMask,x,y,cl); +} + +/* + * declaration of private data + */ +static void +process_key_event(rfbBool down, rfbKeySym key, rfbClientPtr cl) +{ + if (vncInputDevice) { + DFBInputEvent evt; + + if (down) + evt.type = DIET_KEYPRESS; + else + evt.type = DIET_KEYRELEASE; + + if (translate_key( key, &evt )) + dfb_input_dispatch( vncInputDevice, &evt ); + } +} + + +static bool +translate_key(rfbKeySym key, DFBInputEvent *evt ) +{ + /* Unicode */ + if (key <= 0xf000) { + evt->flags = DIEF_KEYSYMBOL; + evt->key_symbol = key; + return true; + } + + /* Dead keys */ + /* todo */ + + /* Numeric keypad */ + if (key >= XK_KP_0 && key <= XK_KP_9) { + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_KP_0 + key - XK_KP_0; + return true; + } + + /* Function keys */ + if (key >= XK_F1 && key <= XK_F11) { + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_F1 + key - XK_F1; + return true; + } + + switch (key) { + /* Numeric keypad */ + case XK_KP_Decimal: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_KP_DECIMAL; + break; + + case XK_KP_Separator: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_KP_SEPARATOR; + break; + + case XK_KP_Divide: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_KP_DIV; + break; + + case XK_KP_Multiply: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_KP_MULT; + break; + + case XK_KP_Subtract: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_KP_MINUS; + break; + + case XK_KP_Add: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_KP_PLUS; + break; + + case XK_KP_Enter: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_KP_ENTER; + break; + + case XK_KP_Equal: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_KP_EQUAL; + break; + + + /* Arrows + Home/End pad */ + case XK_Up: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_UP; + break; + + case XK_Down: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_DOWN; + break; + + case XK_Right: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_RIGHT; + break; + + case XK_Left: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_LEFT; + break; + + case XK_Insert: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_INSERT; + break; + + case XK_Delete: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_DELETE; + break; + + case XK_Home: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_HOME; + break; + + case XK_End: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_END; + break; + + case XK_Page_Up: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_PAGE_UP; + break; + + case XK_Page_Down: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_PAGE_DOWN; + break; + + + /* Key state modifier keys */ + case XK_Num_Lock: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_NUM_LOCK; + break; + + case XK_Caps_Lock: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_CAPS_LOCK; + break; + + case XK_Scroll_Lock: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_SCROLL_LOCK; + break; + + case XK_Shift_R: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_SHIFT_R; + break; + + case XK_Shift_L: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_SHIFT_L; + break; + + case XK_Control_R: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_CONTROL_R; + break; + + case XK_Control_L: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_CONTROL_L; + break; + + case XK_Alt_R: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_ALT_R; + break; + + case XK_Alt_L: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_ALT_L; + break; + + case XK_Meta_R: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_META_R; + break; + + case XK_Meta_L: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_META_L; + break; + + case XK_Super_L: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_SUPER_L; + break; + + case XK_Super_R: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_SUPER_R; + break; + + case XK_Hyper_L: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_HYPER_L; + break; + + case XK_Hyper_R: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_HYPER_R; + break; + + /*case ??: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_ALTGR; + break;*/ + + case XK_BackSpace: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_BACKSPACE; + break; + + case XK_Tab: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_HYPER_L; + break; + + case XK_Return: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_ENTER; + break; + + case XK_Escape: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_ESCAPE; + break; + + case XK_Pause: + evt->flags = DIEF_KEYID; + evt->key_id = DIKI_PAUSE; + break; + + /* Miscellaneous function keys */ + case XK_Help: + evt->flags = DIEF_KEYSYMBOL; + evt->key_symbol = DIKS_HELP; + break; + + case XK_Print: + evt->flags = DIEF_KEYSYMBOL; + evt->key_symbol = DIKS_PRINT; + break; + + case XK_Break: + evt->flags = DIEF_KEYSYMBOL; + evt->key_symbol = DIKS_BREAK; + break; + + default: + return false; + } + + return true; +} + diff --git a/Source/DirectFB/systems/vnc/primary.h b/Source/DirectFB/systems/vnc/primary.h new file mode 100755 index 0000000..6c981b9 --- /dev/null +++ b/Source/DirectFB/systems/vnc/primary.h @@ -0,0 +1,50 @@ +/* + (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 const ScreenFuncs *vncPrimaryScreenFuncs; +extern const DisplayLayerFuncs *vncPrimaryLayerFuncs; + +FusionCallHandlerResult +dfb_vnc_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/vnc/vnc.c b/Source/DirectFB/systems/vnc/vnc.c new file mode 100755 index 0000000..1277ad3 --- /dev/null +++ b/Source/DirectFB/systems/vnc/vnc.c @@ -0,0 +1,313 @@ +/* + (c) Copyright 2001-2010 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 <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 <direct/messages.h> + +#include <rfb/rfb.h> +#include "vnc.h" +#include "primary.h" + +#include <core/core_system.h> + + +DFB_CORE_SYSTEM( vnc ) + + +static DFBVNC *dfb_vnc; + +static FusionCallHandlerResult +VNC_Dispatch( int caller, + int call_arg, + void *call_ptr, + void *ctx, + unsigned int serial, + int *ret_val ); + +/**********************************************************************************************************************/ + +static void +system_get_info( CoreSystemInfo *info ) +{ + info->type = CORE_VNC; + + snprintf( info->name, DFB_CORE_SYSTEM_INFO_NAME_LENGTH, "VNC" ); +} + +static DFBResult +system_initialize( CoreDFB *core, void **data ) +{ + D_ASSERT( dfb_vnc == NULL ); + + dfb_vnc = (DFBVNC*) D_CALLOC( 1, sizeof(DFBVNC) ); + if (!dfb_vnc) + return D_OOM(); + + dfb_vnc->core = core; + + dfb_vnc->shared = (DFBVNCShared*) SHCALLOC( dfb_core_shmpool(core), 1, sizeof(DFBVNCShared) ); + if (!dfb_vnc->shared) { + D_FREE( dfb_vnc ); + return D_OOSHM(); + } + + dfb_vnc->shared->screen_size.w = dfb_config->mode.width ? dfb_config->mode.width : 1280; + dfb_vnc->shared->screen_size.h = dfb_config->mode.height ? dfb_config->mode.height : 720; + + fusion_call_init( &dfb_vnc->shared->call, VNC_Dispatch, dfb_vnc, dfb_core_world(core) ); + + dfb_vnc->screen = dfb_screens_register( NULL, dfb_vnc, (void*) vncPrimaryScreenFuncs ); + + dfb_vnc->layer[0] = dfb_layers_register( dfb_vnc->screen, dfb_vnc, vncPrimaryLayerFuncs ); + dfb_vnc->layer[1] = dfb_layers_register( dfb_vnc->screen, dfb_vnc, vncPrimaryLayerFuncs ); + + fusion_arena_add_shared_field( dfb_core_arena( core ), "vnc", dfb_vnc->shared ); + + *data = dfb_vnc; + + return DFB_OK; +} + +static DFBResult +system_join( CoreDFB *core, void **data ) +{ + void *ret; + + D_ASSERT( dfb_vnc == NULL ); + + fusion_arena_get_shared_field( dfb_core_arena( core ), "vnc", &ret ); + + dfb_vnc = (DFBVNC*) D_CALLOC( 1, sizeof(DFBVNC) ); + if (!dfb_vnc) + return D_OOM(); + + dfb_vnc->core = core; + + dfb_vnc->shared = ret; + + dfb_vnc->screen = dfb_screens_register( NULL, dfb_vnc, (void*) vncPrimaryScreenFuncs ); + + dfb_vnc->layer[0] = dfb_layers_register( dfb_vnc->screen, dfb_vnc, vncPrimaryLayerFuncs ); + dfb_vnc->layer[1] = dfb_layers_register( dfb_vnc->screen, dfb_vnc, vncPrimaryLayerFuncs ); + + *data = dfb_vnc; + + return DFB_OK; +} + +static DFBResult +system_shutdown( bool emergency ) +{ + D_ASSERT( dfb_vnc != NULL ); + + fusion_call_destroy( &dfb_vnc->shared->call ); + + SHFREE( dfb_core_shmpool(dfb_vnc->core), dfb_vnc->shared ); + + D_FREE( dfb_vnc ); + dfb_vnc = NULL; + + return DFB_OK; +} + +static DFBResult +system_leave( bool emergency ) +{ + D_ASSERT( dfb_vnc != NULL ); + + D_FREE( dfb_vnc ); + dfb_vnc = NULL; + + return DFB_OK; +} + +static DFBResult +system_suspend( void ) +{ + return DFB_UNIMPLEMENTED; +} + +static DFBResult +system_resume( void ) +{ + return DFB_UNIMPLEMENTED; +} + + +static int +system_get_accelerator( void ) +{ + return -1; +} + +static VideoMode * +system_get_modes( void ) +{ + return NULL; +} + +static VideoMode * +system_get_current_mode( void ) +{ + return NULL; +} + + +static volatile void * +system_map_mmio( unsigned int offset, + int length ) +{ + return NULL; +} + +static void +system_unmap_mmio( volatile void *addr, + int length ) +{ +} + +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; +} + +/**********************************************************************************************************************/ + +static int +VNC_Dispatch_MarkRectAsModified( DFBVNC *vnc, + DFBVNCMarkRectAsModified *mark ) +{ + rfbMarkRectAsModified( vnc->rfb_screen, mark->region.x1, mark->region.y1, mark->region.x2 + 1, mark->region.y2 + 1 ); + + return 0; +} + +static FusionCallHandlerResult +VNC_Dispatch( int caller, + int call_arg, + void *call_ptr, + void *ctx, + unsigned int serial, + int *ret_val ) +{ + DFBVNC *vnc = ctx; + + DFBVNCMarkRectAsModified modified; + + modified.region.x1 = call_arg >> 16; + modified.region.x2 = call_arg & 0xffff; + + modified.region.y1 = (long)call_ptr >> 16; + modified.region.y2 = (long)call_ptr & 0xffff; + + *ret_val = VNC_Dispatch_MarkRectAsModified( vnc, &modified ); + + return FCHR_RETURN; +} + diff --git a/Source/DirectFB/systems/vnc/vnc.h b/Source/DirectFB/systems/vnc/vnc.h new file mode 100755 index 0000000..9184aab --- /dev/null +++ b/Source/DirectFB/systems/vnc/vnc.h @@ -0,0 +1,86 @@ +/* + (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 __VNC__VNC_H__ +#define __VNC__VNC_H__ + +#include <directfb.h> + +#include <rfb/rfb.h> + +#include <fusion/call.h> +#include <fusion/lock.h> + +#include <core/layers.h> +#include <core/screens.h> + +#define VNC_MAX_LAYERS 2 + +typedef struct { + bool shown; + CoreLayerRegionConfig config; + + DFBDisplayLayerID layer_id; + + CoreSurface *surface; +} VNCLayerData; + + +typedef struct { + FusionCall call; + + DFBDimension screen_size; + void *screen_buffer; + CoreSurface *screen_surface; + + VNCLayerData *layer_data[VNC_MAX_LAYERS]; +} DFBVNCShared; + +typedef struct { + DFBVNCShared *shared; + + CoreDFB *core; + + CoreScreen *screen; + CoreLayer *layer[VNC_MAX_LAYERS]; + + rfbScreenInfoPtr rfb_screen; + + unsigned int layer_count; +} DFBVNC; + +typedef enum { + VNC_MARK_RECT_AS_MODIFIED, +} DFBVNCCall; + +typedef struct { + DFBRegion region; +} DFBVNCMarkRectAsModified; + +#endif + diff --git a/Source/DirectFB/systems/vnc/vncinput.c b/Source/DirectFB/systems/vnc/vncinput.c new file mode 100755 index 0000000..e693bba --- /dev/null +++ b/Source/DirectFB/systems/vnc/vncinput.c @@ -0,0 +1,128 @@ +/* + 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 <directfb.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 <core/input_driver.h> + +DFB_INPUT_DRIVER( vncinput ) + + +CoreInputDevice *vncInputDevice = 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_VNC) + 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, "VNC Input Driver" ); + snprintf ( info->vendor, + DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH, "Leonard Schneider" ); + + 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 ) +{ + vncInputDevice = device; + + /* set device name */ + snprintf( info->desc.name, + DFB_INPUT_DEVICE_DESC_NAME_LENGTH, "VNC Input" ); + + /* set device vendor */ + snprintf( info->desc.vendor, + DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "VNC" ); + + /* 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; + + /* set private data pointer */ + /* *driver_data = device;*/ + + 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 ) +{ +} + |