From 7fe60435bce6595a9c58a9bfd8244d74b5320e96 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Tue, 15 Jan 2013 08:46:13 +0100 Subject: Import DirectFB141_2k11R3_beta5 --- Source/DirectFB/wm/unique/Makefile.am | 150 +++ Source/DirectFB/wm/unique/Makefile.in | 979 ++++++++++++++++ Source/DirectFB/wm/unique/classes/Makefile.am | 22 + Source/DirectFB/wm/unique/classes/Makefile.in | 527 +++++++++ Source/DirectFB/wm/unique/classes/foo.c | 232 ++++ Source/DirectFB/wm/unique/classes/frame.c | 53 + Source/DirectFB/wm/unique/classes/root.c | 206 ++++ Source/DirectFB/wm/unique/classes/window.c | 165 +++ Source/DirectFB/wm/unique/context.c | 711 ++++++++++++ Source/DirectFB/wm/unique/context.h | 134 +++ Source/DirectFB/wm/unique/data/Makefile.am | 31 + Source/DirectFB/wm/unique/data/Makefile.in | 420 +++++++ Source/DirectFB/wm/unique/data/foo_e.png | Bin 0 -> 121 bytes Source/DirectFB/wm/unique/data/foo_n.png | Bin 0 -> 173 bytes Source/DirectFB/wm/unique/data/foo_ne.png | Bin 0 -> 697 bytes Source/DirectFB/wm/unique/data/foo_nw.png | Bin 0 -> 530 bytes Source/DirectFB/wm/unique/data/foo_s.png | Bin 0 -> 169 bytes Source/DirectFB/wm/unique/data/foo_se.png | Bin 0 -> 782 bytes Source/DirectFB/wm/unique/data/foo_sw.png | Bin 0 -> 644 bytes Source/DirectFB/wm/unique/data/foo_w.png | Bin 0 -> 101 bytes Source/DirectFB/wm/unique/decoration.c | 190 +++ Source/DirectFB/wm/unique/decoration.h | 132 +++ Source/DirectFB/wm/unique/device.c | 495 ++++++++ Source/DirectFB/wm/unique/device.h | 139 +++ Source/DirectFB/wm/unique/devices/Makefile.am | 21 + Source/DirectFB/wm/unique/devices/Makefile.in | 525 +++++++++ Source/DirectFB/wm/unique/devices/keyboard.c | 192 ++++ Source/DirectFB/wm/unique/devices/pointer.c | 259 +++++ Source/DirectFB/wm/unique/devices/wheel.c | 182 +++ Source/DirectFB/wm/unique/input_channel.c | 206 ++++ Source/DirectFB/wm/unique/input_channel.h | 74 ++ Source/DirectFB/wm/unique/input_events.h | 114 ++ Source/DirectFB/wm/unique/input_switch.c | 776 +++++++++++++ Source/DirectFB/wm/unique/input_switch.h | 78 ++ Source/DirectFB/wm/unique/internal.h | 378 ++++++ Source/DirectFB/wm/unique/stret.c | 837 ++++++++++++++ Source/DirectFB/wm/unique/stret.h | 155 +++ Source/DirectFB/wm/unique/stret_iteration.c | 209 ++++ Source/DirectFB/wm/unique/stret_iteration.h | 68 ++ Source/DirectFB/wm/unique/stret_test.c | 153 +++ Source/DirectFB/wm/unique/test_color.c | 221 ++++ Source/DirectFB/wm/unique/test_foo.c | 288 +++++ Source/DirectFB/wm/unique/types.h | 53 + Source/DirectFB/wm/unique/unique.c | 1064 +++++++++++++++++ Source/DirectFB/wm/unique/uniquewm.c | 451 ++++++++ Source/DirectFB/wm/unique/uniquewm.h | 48 + Source/DirectFB/wm/unique/uwmdump.c | 267 +++++ Source/DirectFB/wm/unique/window.c | 1525 +++++++++++++++++++++++++ Source/DirectFB/wm/unique/window.h | 135 +++ 49 files changed, 12865 insertions(+) create mode 100755 Source/DirectFB/wm/unique/Makefile.am create mode 100755 Source/DirectFB/wm/unique/Makefile.in create mode 100755 Source/DirectFB/wm/unique/classes/Makefile.am create mode 100755 Source/DirectFB/wm/unique/classes/Makefile.in create mode 100755 Source/DirectFB/wm/unique/classes/foo.c create mode 100755 Source/DirectFB/wm/unique/classes/frame.c create mode 100755 Source/DirectFB/wm/unique/classes/root.c create mode 100755 Source/DirectFB/wm/unique/classes/window.c create mode 100755 Source/DirectFB/wm/unique/context.c create mode 100755 Source/DirectFB/wm/unique/context.h create mode 100755 Source/DirectFB/wm/unique/data/Makefile.am create mode 100755 Source/DirectFB/wm/unique/data/Makefile.in create mode 100755 Source/DirectFB/wm/unique/data/foo_e.png create mode 100755 Source/DirectFB/wm/unique/data/foo_n.png create mode 100755 Source/DirectFB/wm/unique/data/foo_ne.png create mode 100755 Source/DirectFB/wm/unique/data/foo_nw.png create mode 100755 Source/DirectFB/wm/unique/data/foo_s.png create mode 100755 Source/DirectFB/wm/unique/data/foo_se.png create mode 100755 Source/DirectFB/wm/unique/data/foo_sw.png create mode 100755 Source/DirectFB/wm/unique/data/foo_w.png create mode 100755 Source/DirectFB/wm/unique/decoration.c create mode 100755 Source/DirectFB/wm/unique/decoration.h create mode 100755 Source/DirectFB/wm/unique/device.c create mode 100755 Source/DirectFB/wm/unique/device.h create mode 100755 Source/DirectFB/wm/unique/devices/Makefile.am create mode 100755 Source/DirectFB/wm/unique/devices/Makefile.in create mode 100755 Source/DirectFB/wm/unique/devices/keyboard.c create mode 100755 Source/DirectFB/wm/unique/devices/pointer.c create mode 100755 Source/DirectFB/wm/unique/devices/wheel.c create mode 100755 Source/DirectFB/wm/unique/input_channel.c create mode 100755 Source/DirectFB/wm/unique/input_channel.h create mode 100755 Source/DirectFB/wm/unique/input_events.h create mode 100755 Source/DirectFB/wm/unique/input_switch.c create mode 100755 Source/DirectFB/wm/unique/input_switch.h create mode 100755 Source/DirectFB/wm/unique/internal.h create mode 100755 Source/DirectFB/wm/unique/stret.c create mode 100755 Source/DirectFB/wm/unique/stret.h create mode 100755 Source/DirectFB/wm/unique/stret_iteration.c create mode 100755 Source/DirectFB/wm/unique/stret_iteration.h create mode 100755 Source/DirectFB/wm/unique/stret_test.c create mode 100755 Source/DirectFB/wm/unique/test_color.c create mode 100755 Source/DirectFB/wm/unique/test_foo.c create mode 100755 Source/DirectFB/wm/unique/types.h create mode 100755 Source/DirectFB/wm/unique/unique.c create mode 100755 Source/DirectFB/wm/unique/uniquewm.c create mode 100755 Source/DirectFB/wm/unique/uniquewm.h create mode 100755 Source/DirectFB/wm/unique/uwmdump.c create mode 100755 Source/DirectFB/wm/unique/window.c create mode 100755 Source/DirectFB/wm/unique/window.h (limited to 'Source/DirectFB/wm/unique') diff --git a/Source/DirectFB/wm/unique/Makefile.am b/Source/DirectFB/wm/unique/Makefile.am new file mode 100755 index 0000000..3395c2f --- /dev/null +++ b/Source/DirectFB/wm/unique/Makefile.am @@ -0,0 +1,150 @@ +## Makefile.am for DirectFB/wm/unique + +SUBDIRS = classes data devices + +INCLUDES = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/wm \ + -I$(top_builddir)/wm + +bin_PROGRAMS = uwmdump + +noinst_PROGRAMS = test_color test_foo stret_test + + +uwmdump_SOURCES = uwmdump.c + +uwmdump_LDADD = \ + libuniquewm.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la + + +test_color_SOURCES = test_color.c + +test_color_LDADD = \ + libuniquewm.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la + + +test_foo_SOURCES = test_foo.c + +test_foo_LDADD = \ + libuniquewm.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la + + +stret_test_SOURCES = stret_test.c + +stret_test_LDADD = \ + libuniquewm.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/src/libdirectfb.la + + +# Set module installation directory +wmdir = $(MODULEDIR)/wm + +# Build wm module +wm_LTLIBRARIES = libdirectfbwm_unique.la + +if BUILD_STATIC +wm_DATA = libdirectfbwm_unique.o +endif + +libdirectfbwm_unique_la_SOURCES = \ + unique.c + +# Link module against uniquewm library +libdirectfbwm_unique_la_LIBADD = \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la \ + libuniquewm.la + +libdirectfbwm_unique_la_LDFLAGS = \ + -avoid-version \ + -module + +# Set header installation directory +includedir = @INCLUDEDIR@/unique + +# Install uniquewm's library header files +include_HEADERS = \ + context.h \ + decoration.h \ + device.h \ + input_channel.h \ + input_events.h \ + input_switch.h \ + stret.h \ + stret_iteration.h \ + types.h \ + uniquewm.h \ + window.h + +# Build uniquewm library +lib_LTLIBRARIES = libuniquewm.la + +libuniquewm_la_SOURCES = \ + context.c \ + decoration.c \ + device.c \ + input_channel.c \ + input_switch.c \ + internal.h \ + stret.c \ + stret_iteration.c \ + uniquewm.c \ + window.c + +libuniquewm_la_LIBADD = \ + classes/libunique_classes.la \ + devices/libunique_devices.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la + +libuniquewm_la_LDFLAGS = \ + -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ + -release $(LT_RELEASE) \ + $(DFB_LDFLAGS) + + +include $(top_srcdir)/rules/libobject.make + +# +## and now rebuild the static version with the *correct* object files +# +if BUILD_STATIC + +clean-local: + rm -f libuniquewm_fixed.a + +all-local: libuniquewm_fixed.a + +libuniquewm_fixed.a: .libs/libuniquewm.a + rm -f libuniquewm_fixed.a + ${AR} cru libuniquewm_fixed.a `find . -name "*.o" | grep -v '.libs'` + ${RANLIB} libuniquewm_fixed.a + cp -pf libuniquewm_fixed.a .libs/libuniquewm.a + +.libs/libuniquewm.a: libuniquewm.la + +else + +clean-local: + +all-local: + +endif diff --git a/Source/DirectFB/wm/unique/Makefile.in b/Source/DirectFB/wm/unique/Makefile.in new file mode 100755 index 0000000..23aeb55 --- /dev/null +++ b/Source/DirectFB/wm/unique/Makefile.in @@ -0,0 +1,979 @@ +# 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@ +bin_PROGRAMS = uwmdump$(EXEEXT) +noinst_PROGRAMS = test_color$(EXEEXT) test_foo$(EXEEXT) \ + stret_test$(EXEEXT) +DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(top_srcdir)/rules/libobject.make +subdir = wm/unique +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)$(libdir)" "$(DESTDIR)$(wmdir)" \ + "$(DESTDIR)$(bindir)" "$(DESTDIR)$(wmdir)" \ + "$(DESTDIR)$(includedir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +wmLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) $(wm_LTLIBRARIES) +libdirectfbwm_unique_la_DEPENDENCIES = \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la libuniquewm.la +am_libdirectfbwm_unique_la_OBJECTS = unique.lo +libdirectfbwm_unique_la_OBJECTS = \ + $(am_libdirectfbwm_unique_la_OBJECTS) +libdirectfbwm_unique_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libdirectfbwm_unique_la_LDFLAGS) $(LDFLAGS) -o $@ +libuniquewm_la_DEPENDENCIES = classes/libunique_classes.la \ + devices/libunique_devices.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la +am_libuniquewm_la_OBJECTS = context.lo decoration.lo device.lo \ + input_channel.lo input_switch.lo stret.lo stret_iteration.lo \ + uniquewm.lo window.lo +libuniquewm_la_OBJECTS = $(am_libuniquewm_la_OBJECTS) +libuniquewm_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libuniquewm_la_LDFLAGS) $(LDFLAGS) -o $@ +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) +am_stret_test_OBJECTS = stret_test.$(OBJEXT) +stret_test_OBJECTS = $(am_stret_test_OBJECTS) +stret_test_DEPENDENCIES = libuniquewm.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/src/libdirectfb.la +am_test_color_OBJECTS = test_color.$(OBJEXT) +test_color_OBJECTS = $(am_test_color_OBJECTS) +test_color_DEPENDENCIES = libuniquewm.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la +am_test_foo_OBJECTS = test_foo.$(OBJEXT) +test_foo_OBJECTS = $(am_test_foo_OBJECTS) +test_foo_DEPENDENCIES = libuniquewm.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la +am_uwmdump_OBJECTS = uwmdump.$(OBJEXT) +uwmdump_OBJECTS = $(am_uwmdump_OBJECTS) +uwmdump_DEPENDENCIES = libuniquewm.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la +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 = $(libdirectfbwm_unique_la_SOURCES) $(libuniquewm_la_SOURCES) \ + $(stret_test_SOURCES) $(test_color_SOURCES) \ + $(test_foo_SOURCES) $(uwmdump_SOURCES) +DIST_SOURCES = $(libdirectfbwm_unique_la_SOURCES) \ + $(libuniquewm_la_SOURCES) $(stret_test_SOURCES) \ + $(test_color_SOURCES) $(test_foo_SOURCES) $(uwmdump_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +wmDATA_INSTALL = $(INSTALL_DATA) +DATA = $(wm_DATA) +includeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(include_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +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@ + +# Set header installation directory +includedir = @INCLUDEDIR@/unique +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@ +SUBDIRS = classes data devices +INCLUDES = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/wm \ + -I$(top_builddir)/wm + +uwmdump_SOURCES = uwmdump.c +uwmdump_LDADD = \ + libuniquewm.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la + +test_color_SOURCES = test_color.c +test_color_LDADD = \ + libuniquewm.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la + +test_foo_SOURCES = test_foo.c +test_foo_LDADD = \ + libuniquewm.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la + +stret_test_SOURCES = stret_test.c +stret_test_LDADD = \ + libuniquewm.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/src/libdirectfb.la + + +# Set module installation directory +wmdir = $(MODULEDIR)/wm + +# Build wm module +wm_LTLIBRARIES = libdirectfbwm_unique.la +@BUILD_STATIC_TRUE@wm_DATA = libdirectfbwm_unique.o +libdirectfbwm_unique_la_SOURCES = \ + unique.c + + +# Link module against uniquewm library +libdirectfbwm_unique_la_LIBADD = \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la \ + libuniquewm.la + +libdirectfbwm_unique_la_LDFLAGS = \ + -avoid-version \ + -module + + +# Install uniquewm's library header files +include_HEADERS = \ + context.h \ + decoration.h \ + device.h \ + input_channel.h \ + input_events.h \ + input_switch.h \ + stret.h \ + stret_iteration.h \ + types.h \ + uniquewm.h \ + window.h + + +# Build uniquewm library +lib_LTLIBRARIES = libuniquewm.la +libuniquewm_la_SOURCES = \ + context.c \ + decoration.c \ + device.c \ + input_channel.c \ + input_switch.c \ + internal.h \ + stret.c \ + stret_iteration.c \ + uniquewm.c \ + window.c + +libuniquewm_la_LIBADD = \ + classes/libunique_classes.la \ + devices/libunique_devices.la \ + $(top_builddir)/lib/direct/libdirect.la \ + $(top_builddir)/lib/fusion/libfusion.la \ + $(top_builddir)/src/libdirectfb.la + +libuniquewm_la_LDFLAGS = \ + -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ + -release $(LT_RELEASE) \ + $(DFB_LDFLAGS) + +all: all-recursive + +.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 wm/unique/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu wm/unique/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-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_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-wmLTLIBRARIES: $(wm_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(wmdir)" || $(MKDIR_P) "$(DESTDIR)$(wmdir)" + @list='$(wm_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(wmLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(wmdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(wmLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(wmdir)/$$f"; \ + else :; fi; \ + done + +uninstall-wmLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(wm_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(wmdir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(wmdir)/$$p"; \ + done + +clean-wmLTLIBRARIES: + -test -z "$(wm_LTLIBRARIES)" || rm -f $(wm_LTLIBRARIES) + @list='$(wm_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 +libdirectfbwm_unique.la: $(libdirectfbwm_unique_la_OBJECTS) $(libdirectfbwm_unique_la_DEPENDENCIES) + $(libdirectfbwm_unique_la_LINK) -rpath $(wmdir) $(libdirectfbwm_unique_la_OBJECTS) $(libdirectfbwm_unique_la_LIBADD) $(LIBS) +libuniquewm.la: $(libuniquewm_la_OBJECTS) $(libuniquewm_la_DEPENDENCIES) + $(libuniquewm_la_LINK) -rpath $(libdir) $(libuniquewm_la_OBJECTS) $(libuniquewm_la_LIBADD) $(LIBS) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +stret_test$(EXEEXT): $(stret_test_OBJECTS) $(stret_test_DEPENDENCIES) + @rm -f stret_test$(EXEEXT) + $(LINK) $(stret_test_OBJECTS) $(stret_test_LDADD) $(LIBS) +test_color$(EXEEXT): $(test_color_OBJECTS) $(test_color_DEPENDENCIES) + @rm -f test_color$(EXEEXT) + $(LINK) $(test_color_OBJECTS) $(test_color_LDADD) $(LIBS) +test_foo$(EXEEXT): $(test_foo_OBJECTS) $(test_foo_DEPENDENCIES) + @rm -f test_foo$(EXEEXT) + $(LINK) $(test_foo_OBJECTS) $(test_foo_LDADD) $(LIBS) +uwmdump$(EXEEXT): $(uwmdump_OBJECTS) $(uwmdump_DEPENDENCIES) + @rm -f uwmdump$(EXEEXT) + $(LINK) $(uwmdump_OBJECTS) $(uwmdump_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/context.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decoration.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input_channel.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input_switch.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stret.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stret_iteration.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stret_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_color.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_foo.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unique.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uniquewm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uwmdump.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/window.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-wmDATA: $(wm_DATA) + @$(NORMAL_INSTALL) + test -z "$(wmdir)" || $(MKDIR_P) "$(DESTDIR)$(wmdir)" + @list='$(wm_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(wmDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(wmdir)/$$f'"; \ + $(wmDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(wmdir)/$$f"; \ + done + +uninstall-wmDATA: + @$(NORMAL_UNINSTALL) + @list='$(wm_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(wmdir)/$$f'"; \ + rm -f "$(DESTDIR)$(wmdir)/$$f"; \ + done +install-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" + @list='$(include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ + $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ + rm -f "$(DESTDIR)$(includedir)/$$f"; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + 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: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + 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: ctags-recursive $(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 + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) $(HEADERS) \ + all-local +install-binPROGRAMS: install-libLTLIBRARIES + +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(wmdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(wmdir)" "$(DESTDIR)$(includedir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +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-recursive + +clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libtool clean-local clean-noinstPROGRAMS \ + clean-wmLTLIBRARIES mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: install-includeHEADERS install-wmDATA \ + install-wmLTLIBRARIES + +install-dvi: install-dvi-recursive + +install-exec-am: install-binPROGRAMS install-libLTLIBRARIES + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \ + uninstall-libLTLIBRARIES uninstall-wmDATA \ + uninstall-wmLTLIBRARIES + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am all-local check check-am clean clean-binPROGRAMS \ + clean-generic clean-libLTLIBRARIES clean-libtool clean-local \ + clean-noinstPROGRAMS clean-wmLTLIBRARIES ctags ctags-recursive \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-includeHEADERS install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip install-wmDATA \ + install-wmLTLIBRARIES installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-includeHEADERS uninstall-libLTLIBRARIES \ + uninstall-wmDATA uninstall-wmLTLIBRARIES + +%.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) + +# +# + +@BUILD_STATIC_TRUE@clean-local: +@BUILD_STATIC_TRUE@ rm -f libuniquewm_fixed.a + +@BUILD_STATIC_TRUE@all-local: libuniquewm_fixed.a + +@BUILD_STATIC_TRUE@libuniquewm_fixed.a: .libs/libuniquewm.a +@BUILD_STATIC_TRUE@ rm -f libuniquewm_fixed.a +@BUILD_STATIC_TRUE@ ${AR} cru libuniquewm_fixed.a `find . -name "*.o" | grep -v '.libs'` +@BUILD_STATIC_TRUE@ ${RANLIB} libuniquewm_fixed.a +@BUILD_STATIC_TRUE@ cp -pf libuniquewm_fixed.a .libs/libuniquewm.a + +@BUILD_STATIC_TRUE@.libs/libuniquewm.a: libuniquewm.la + +@BUILD_STATIC_FALSE@clean-local: + +@BUILD_STATIC_FALSE@all-local: +# 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/wm/unique/classes/Makefile.am b/Source/DirectFB/wm/unique/classes/Makefile.am new file mode 100755 index 0000000..85b10d2 --- /dev/null +++ b/Source/DirectFB/wm/unique/classes/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for DirectFB/wm/unique/classes + +INCLUDES = \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/wm + +AM_CPPFLAGS = \ + -DMODULEDIR=\"@MODULEDIR@\" \ + -DSOPATH=\"@SOPATH@\" + + +noinst_LTLIBRARIES = libunique_classes.la + +libunique_classes_la_SOURCES = \ + foo.c \ + frame.c \ + root.c \ + window.c diff --git a/Source/DirectFB/wm/unique/classes/Makefile.in b/Source/DirectFB/wm/unique/classes/Makefile.in new file mode 100755 index 0000000..7a43f3e --- /dev/null +++ b/Source/DirectFB/wm/unique/classes/Makefile.in @@ -0,0 +1,527 @@ +# 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@ +subdir = wm/unique/classes +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +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 = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libunique_classes_la_LIBADD = +am_libunique_classes_la_OBJECTS = foo.lo frame.lo root.lo window.lo +libunique_classes_la_OBJECTS = $(am_libunique_classes_la_OBJECTS) +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 = $(libunique_classes_la_SOURCES) +DIST_SOURCES = $(libunique_classes_la_SOURCES) +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_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/wm + +AM_CPPFLAGS = \ + -DMODULEDIR=\"@MODULEDIR@\" \ + -DSOPATH=\"@SOPATH@\" + +noinst_LTLIBRARIES = libunique_classes.la +libunique_classes_la_SOURCES = \ + foo.c \ + frame.c \ + root.c \ + window.c + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(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 wm/unique/classes/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu wm/unique/classes/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 + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_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 +libunique_classes.la: $(libunique_classes_la_OBJECTS) $(libunique_classes_la_DEPENDENCIES) + $(LINK) $(libunique_classes_la_OBJECTS) $(libunique_classes_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/foo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frame.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/root.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/window.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 + +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) +installdirs: +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-libtool clean-noinstLTLIBRARIES \ + 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-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: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES 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-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip 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 + +# 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/wm/unique/classes/foo.c b/Source/DirectFB/wm/unique/classes/foo.c new file mode 100755 index 0000000..3eafdd1 --- /dev/null +++ b/Source/DirectFB/wm/unique/classes/foo.c @@ -0,0 +1,232 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 + +#include + +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_Foo, "UniQuE/Foo", "UniQuE's Foo Region Class" ); + +static DFBResult +foo_get_input( StretRegion *region, + void *region_data, + unsigned long arg, + int index, + int x, + int y, + UniqueInputChannel **ret_channel ) +{ + UniqueContext *context; + UniqueWindow *window = region_data; + + D_MAGIC_ASSERT( region, StretRegion ); + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( ret_channel != NULL ); + + D_DEBUG_AT( UniQuE_Foo, "foo_get_input( region %p, window %p, index %d, x %d, y %d )\n", + region, window, index, x, y ); + + switch (index) { + case UDCI_KEYBOARD: + case UDCI_WHEEL: + *ret_channel = window->channel; + break; + + case UDCI_POINTER: +// *ret_channel = window->channel; + *ret_channel = context->foo_channel; + break; + + default: + *ret_channel = NULL; + break; + } + + return DFB_OK; +} + +static void +foo_update( StretRegion *region, + void *region_data, + void *update_data, + unsigned long arg, + int x, + int y, + const DFBRegion *updates, + int num ) +{ + int i; + DFBRegion clip; + DFBDimension size; + bool visible; + WMShared *shared; + UniqueContext *context; + UniqueWindow *window = region_data; + CardState *state = update_data; + DFBSurfaceBlittingFlags flags = DSBLIT_NOFX; + + D_ASSERT( region != NULL ); + D_ASSERT( region_data != NULL ); + D_ASSERT( update_data != NULL ); + D_ASSERT( updates != NULL ); + + D_MAGIC_ASSERT( window, UniqueWindow ); + D_MAGIC_ASSERT( state, CardState ); + + shared = window->shared; + + D_MAGIC_ASSERT( shared, WMShared ); + D_ASSERT( shared->foo_surface != NULL ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + visible = D_FLAGS_IS_SET( window->flags, UWF_VISIBLE ); + + D_DEBUG_AT( UniQuE_Foo, "foo_update( region %p, window %p, visible %s, num %d )\n", + region, window, visible ? "yes" : "no", num ); +#if D_DEBUG_ENABLED + for (i=0; iopacity != 0xFF) { + flags |= DSBLIT_BLEND_COLORALPHA; + + /* Set opacity as blending factor. */ + if (state->color.a != window->opacity) { + state->color.a = window->opacity; + state->modified |= SMF_COLOR; + } + } + + /* Use colorizing if the color is not white. */ + if (context->color.r != 0xff || context->color.g != 0xff || context->color.b != 0xff) { + flags |= DSBLIT_COLORIZE; + + state->color.r = context->color.r; + state->color.g = context->color.g; + state->color.b = context->color.b; + + state->modified |= SMF_COLOR; + } + + /* Set blitting flags. */ + dfb_state_set_blitting_flags( state, flags ); + + /* Set blitting source. */ + state->source = shared->foo_surface; + state->modified |= SMF_SOURCE; + + switch (arg) { + case UFI_N: + case UFI_E: + case UFI_S: + case UFI_W: + clip = state->clip; + +/* for (i=0; ifoo_rects[arg]; + DFBRectangle dest = { x, y, size.w, size.h }; + + dfb_state_set_clip( state, &update ); + + dfb_gfxcard_stretchblit( &source, &dest, state ); + }*/ + for (i=0; ifoo_rects[arg]; + + dfb_state_set_clip( state, &update ); + + dfb_gfxcard_tileblit( &source, x, y, x + size.w - 1, y + size.h - 1, state ); + } + + dfb_state_set_clip( state, &clip ); + break; + + case UFI_NE: + case UFI_SE: + case UFI_SW: + case UFI_NW: + for (i=0; ifoo_rects[arg].x, shared->foo_rects[arg].y ); + + dfb_gfxcard_blit( &rect, x + updates[i].x1, y + updates[i].y1, state ); + } + break; + + default: + D_BUG( "invalid arg" ); + } + + /* Reset blitting source. */ + state->source = NULL; + state->modified |= SMF_SOURCE; +} + +const StretRegionClass unique_foo_region_class = { + .GetInput = foo_get_input, + .Update = foo_update, +}; + diff --git a/Source/DirectFB/wm/unique/classes/frame.c b/Source/DirectFB/wm/unique/classes/frame.c new file mode 100755 index 0000000..a07ad03 --- /dev/null +++ b/Source/DirectFB/wm/unique/classes/frame.c @@ -0,0 +1,53 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 + +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include + + +//D_DEBUG_DOMAIN( UniQuE_Frame, "UniQuE/Frame", "UniQuE's Frame Region Class" ); + +const StretRegionClass unique_frame_region_class = { + .GetInput = NULL, +}; + diff --git a/Source/DirectFB/wm/unique/classes/root.c b/Source/DirectFB/wm/unique/classes/root.c new file mode 100755 index 0000000..72dcf87 --- /dev/null +++ b/Source/DirectFB/wm/unique/classes/root.c @@ -0,0 +1,206 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_Root, "UniQuE/Root", "UniQuE's Root Region Class" ); + + +static void +root_update( StretRegion *region, + void *region_data, + void *update_data, + unsigned long arg, + int x, + int y, + const DFBRegion *updates, + int num ) +{ + int i; + CoreWindowStack *stack; + UniqueContext *context = region_data; + CardState *state = update_data; + + D_ASSERT( region != NULL ); + D_ASSERT( region_data != NULL ); + D_ASSERT( update_data != NULL ); + D_ASSERT( updates != NULL ); + + D_ASSERT( x == 0 ); + D_ASSERT( y == 0 ); + + D_MAGIC_ASSERT( context, UniqueContext ); + D_MAGIC_ASSERT( state, CardState ); + + stack = context->stack; + + D_ASSERT( stack != NULL ); + D_ASSERT( stack->bg.image != NULL || (stack->bg.mode != DLBM_IMAGE && + stack->bg.mode != DLBM_TILE) ); + + D_DEBUG_AT( UniQuE_Root, "root_update( region %p, num %d )\n", region, num ); +#if D_DEBUG_ENABLED + for (i=0; ibg.mode) { + case DLBM_COLOR: { + CoreSurface *dest = state->destination; + DFBColor *color = &stack->bg.color; + DFBRectangle rects[num]; + + /* Set the background color. */ + if (DFB_PIXELFORMAT_IS_INDEXED( dest->config.format )) + dfb_state_set_color_index( state, + dfb_palette_search( dest->palette, color->r, + color->g, color->b, color->a ) ); + else + dfb_state_set_color( state, color ); + + for (i=0; ibg.image; + + /* Set blitting source. */ + state->source = bg; + state->modified |= SMF_SOURCE; + + /* Set blitting flags. */ + dfb_state_set_blitting_flags( state, DSBLIT_NOFX ); + + /* Check the size of the background image. */ + if (bg->config.size.w == stack->width && bg->config.size.h == stack->height) { + for (i=0; iclip; + + for (i=0; iconfig.size.w, bg->config.size.h }; + DFBRectangle dst = { 0, 0, stack->width, stack->height }; + + /* Change clipping region. */ + dfb_state_set_clip( state, &updates[i] ); + + /* Stretch blit for non fitting background images. */ + dfb_gfxcard_stretchblit( &src, &dst, state ); + } + + /* Restore clipping region. */ + dfb_state_set_clip( state, &clip ); + } + + /* Reset blitting source. */ + state->source = NULL; + state->modified |= SMF_SOURCE; + + break; + } + + case DLBM_TILE: { + CoreSurface *bg = stack->bg.image; + DFBRegion clip = state->clip; + + /* Set blitting source. */ + state->source = bg; + state->modified |= SMF_SOURCE; + + /* Set blitting flags. */ + dfb_state_set_blitting_flags( state, DSBLIT_NOFX ); + + for (i=0; iconfig.size.w, bg->config.size.h }; + + /* Change clipping region. */ + dfb_state_set_clip( state, &updates[i] ); + + /* Tiled blit (aligned). */ + dfb_gfxcard_tileblit( &src, 0, 0, stack->width, stack->height, state ); + } + + /* Restore clipping region. */ + dfb_state_set_clip( state, &clip ); + + /* Reset blitting source. */ + state->source = NULL; + state->modified |= SMF_SOURCE; + + break; + } + + case DLBM_DONTCARE: + break; + + default: + D_BUG( "unknown background mode" ); + break; + } +} + +/* + * The root region is the desktop background. + */ +const StretRegionClass unique_root_region_class = { + .Update = root_update, +}; + diff --git a/Source/DirectFB/wm/unique/classes/window.c b/Source/DirectFB/wm/unique/classes/window.c new file mode 100755 index 0000000..db9cbaf --- /dev/null +++ b/Source/DirectFB/wm/unique/classes/window.c @@ -0,0 +1,165 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 + +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_Window, "UniQuE/WindowReg", "UniQuE's Window Region Class" ); + +static DFBResult +window_get_input( StretRegion *region, + void *region_data, + unsigned long arg, + int index, + int x, + int y, + UniqueInputChannel **ret_channel ) +{ + UniqueWindow *window = region_data; + + D_MAGIC_ASSERT( region, StretRegion ); + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( ret_channel != NULL ); + + D_DEBUG_AT( UniQuE_Window, "window_get_input( region %p, window %p, index %d, x %d, y %d )\n", + region, window, index, x, y ); + + *ret_channel = window->channel; + + return DFB_OK; +} + +static void +window_update( StretRegion *region, + void *region_data, + void *update_data, + unsigned long arg, + int x, + int y, + const DFBRegion *updates, + int num ) +{ + int i; + DFBSurfaceBlittingFlags flags = DSBLIT_NOFX; + UniqueWindow *window = region_data; + CardState *state = update_data; + bool alpha = arg; + bool visible; + + D_ASSERT( updates != NULL ); + + D_MAGIC_ASSERT( region, StretRegion ); + D_MAGIC_ASSERT( window, UniqueWindow ); + D_MAGIC_ASSERT( state, CardState ); + + D_ASSERT( window->surface != NULL ); + + visible = D_FLAGS_IS_SET( window->flags, UWF_VISIBLE ); + + D_DEBUG_AT( UniQuE_Window, "window_update( region %p, window %p, visible %s, num %d )\n", + region, window, visible ? "yes" : "no", num ); +#if D_DEBUG_ENABLED + for (i=0; ioptions & DWOP_ALPHACHANNEL)) + flags |= DSBLIT_BLEND_ALPHACHANNEL; + + /* Use global alpha blending. */ + if (window->opacity != 0xFF) { + flags |= DSBLIT_BLEND_COLORALPHA; + + /* Set opacity as blending factor. */ + if (state->color.a != window->opacity) { + state->color.a = window->opacity; + state->modified |= SMF_COLOR; + } + } + + /* Use source color keying. */ + if (window->options & DWOP_COLORKEYING) { + flags |= DSBLIT_SRC_COLORKEY; + + /* Set window color key. */ + dfb_state_set_src_colorkey( state, window->color_key ); + } + + /* Use automatic deinterlacing. */ + if (window->surface->config.caps & DSCAPS_INTERLACED) + flags |= DSBLIT_DEINTERLACE; + + /* Set blitting flags. */ + dfb_state_set_blitting_flags( state, flags ); + + /* Set blitting source. */ + state->source = window->surface; + state->modified |= SMF_SOURCE; + + for (i=0; isource = NULL; + state->modified |= SMF_SOURCE; +} + +const StretRegionClass unique_window_region_class = { + .GetInput = window_get_input, + .Update = window_update, +}; + diff --git a/Source/DirectFB/wm/unique/context.c b/Source/DirectFB/wm/unique/context.c new file mode 100755 index 0000000..cb77b39 --- /dev/null +++ b/Source/DirectFB/wm/unique/context.c @@ -0,0 +1,711 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include /* FIXME */ +#include +#include +#include +#include /* FIXME */ + +#include + +#include +#include + +#include +#include +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_Context, "UniQuE/Context", "UniQuE's Stack Context" ); + + +static const ReactionFunc unique_context_globals[] = { + _unique_wm_module_context_listener, + NULL +}; + +/**************************************************************************************************/ + +static void +context_destructor( FusionObject *object, bool zombie, void *ctx ) +{ + int i; + UniqueContext *context = (UniqueContext*) object; + + D_DEBUG_AT( UniQuE_Context, "destroying %p (stack %p)%s\n", + context, context->stack, zombie ? " (ZOMBIE)" : ""); + + D_ASSUME( fusion_vector_is_empty( &context->windows ) ); + + unique_context_notify( context, UCNF_DESTROYED ); + + unique_device_detach_global( context->devices[UDCI_POINTER], &context->cursor_reaction ); + + + unique_input_switch_drop( context->input_switch, context->foo_channel ); + + unique_input_channel_destroy( context->foo_channel ); + + unique_input_switch_destroy( context->input_switch ); + + + for (i=0; i<_UDCI_NUM; i++) + unique_device_destroy( context->devices[i] ); + + + while (fusion_vector_has_elements( &context->windows )) { + unique_window_destroy( fusion_vector_at( &context->windows, 0 ) ); + } + + stret_region_destroy( context->root ); + + + fusion_vector_destroy( &context->windows ); + + dfb_surface_unlink( &context->surface ); + + dfb_layer_region_unlink( &context->region ); + + D_MAGIC_CLEAR( context ); + + fusion_object_destroy( object ); +} + +FusionObjectPool * +unique_context_pool_create( const FusionWorld *world ) +{ + return fusion_object_pool_create( "UniQuE Context Pool", sizeof(UniqueContext), + sizeof(UniqueContextNotification), context_destructor, NULL, world ); +} + +/**************************************************************************************************/ + +static DFBEnumerationResult +connect_device( CoreInputDevice *source, + void *ctx ) +{ + UniqueDevice *device = ctx; + + D_MAGIC_ASSERT( device, UniqueDevice ); + + unique_device_connect( device, source ); + + return DFENUM_OK; +} + +static DFBResult +create_devices( CoreDFB *core, + UniqueContext *context, + WMShared *shared ) +{ + int i; + DFBResult ret; + + D_MAGIC_ASSERT( context, UniqueContext ); + D_MAGIC_ASSERT( shared, WMShared ); + + for (i=0; i<_UDCI_NUM; i++) { + DFBInputDeviceCapabilities caps; + + ret = unique_device_create( core, context, shared->device_classes[i], + context, &context->devices[i] ); + if (ret) + goto error; + + ret = unique_input_switch_add( context->input_switch, context->devices[i] ); + if (ret) + goto error_add; + + switch (i) { + case UDCI_POINTER: + caps = DICAPS_AXES | DICAPS_BUTTONS; + break; + + case UDCI_WHEEL: + caps = DICAPS_AXES; + break; + + case UDCI_KEYBOARD: + caps = DICAPS_KEYS; + break; + + default: + caps = DICAPS_ALL; + break; + } + + dfb_input_enumerate_devices( connect_device, context->devices[i], caps ); + } + + return DFB_OK; + + +error_add: + unique_device_destroy( context->devices[i] ); + +error: + while (--i >= 0) + unique_device_destroy( context->devices[i] ); + + return ret; +} + +/**************************************************************************************************/ + +DFBResult +unique_context_create( CoreDFB *core, + CoreWindowStack *stack, + CoreLayerRegion *region, + DFBDisplayLayerID layer_id, + WMShared *shared, + UniqueContext **ret_context ) +{ + int i; + DFBResult ret; + UniqueContext *context; + + D_ASSERT( stack != NULL ); + D_MAGIC_ASSERT( shared, WMShared ); + D_ASSERT( ret_context != NULL ); + + context = unique_wm_create_context(); + if (!context) + return DFB_FUSION; + + context->stack = stack; + context->shared = shared; + context->layer_id = layer_id; + context->color = (DFBColor) { 0xff, 0xa0, 0xd0, 0xf0 }; + context->shmpool = stack->shmpool; + + fusion_vector_init( &context->windows, 16, context->shmpool ); + + /* Create Root Region. */ + ret = stret_region_create( shared->region_classes[URCI_ROOT], context, 0, + SRF_ACTIVE | SRF_OUTPUT, _UNRL_NUM, + 0, 0, INT_MAX, INT_MAX, + NULL, 0, context->shmpool, &context->root ); + if (ret) + goto error; + + /* Link layer region. */ + ret = dfb_layer_region_link( &context->region, region ); + if (ret) + goto error; + + /* Get the region's surface. */ + ret = dfb_layer_region_get_surface( region, &context->surface ); + if (ret) + goto error; + + /* Make it global. */ + ret = dfb_surface_globalize( context->surface ); + if (ret) { + dfb_surface_unref( context->surface ); + goto error; + } + + D_MAGIC_SET( context, UniqueContext ); + + ret = unique_input_switch_create( context, &context->input_switch ); + if (ret) + goto error_switch; + + ret = create_devices( core, context, shared ); + if (ret) + goto error_devices; + + ret = unique_input_channel_create( core, context, &context->foo_channel ); + if (ret) + goto error_foo_channel; + + ret = unique_device_attach_global( context->devices[UDCI_POINTER], + UNIQUE_CURSOR_DEVICE_LISTENER, + context, &context->cursor_reaction ); + if (ret) + goto error_attach_cursor; + + /* Change global reaction lock. */ + fusion_object_set_lock( &context->object, &context->stack->context->lock ); + + /* Activate Object. */ + fusion_object_activate( &context->object ); + + /* Return new context. */ + *ret_context = context; + + return DFB_OK; + + +error_attach_cursor: + unique_input_channel_destroy( context->foo_channel ); + +error_foo_channel: + for (i=0; i<_UDCI_NUM; i++) + unique_device_destroy( context->devices[i] ); + +error_devices: + unique_input_switch_destroy( context->input_switch ); + +error_switch: + D_MAGIC_CLEAR( context ); + + dfb_surface_unlink( &context->surface ); + +error: + if (context->region) + dfb_layer_region_unlink( &context->region ); + + if (context->root) + stret_region_destroy( context->root ); + + fusion_vector_destroy( &context->windows ); + + fusion_object_destroy( &context->object ); + + return ret; +} + +DFBResult +unique_context_notify( UniqueContext *context, + UniqueContextNotificationFlags flags ) +{ + UniqueContextNotification notification; + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( flags != UCNF_NONE ); + + D_ASSERT( ! (flags & ~UCNF_ALL) ); + + notification.flags = flags; + notification.context = context; + + return unique_context_dispatch( context, ¬ification, unique_context_globals ); +} + +DFBResult +unique_context_set_active( UniqueContext *context, + bool active ) +{ + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSUME( context->active != active ); + + if (context->active == active) + return DFB_OK; + + context->active = active; + + if (active) + return dfb_windowstack_repaint_all( context->stack ); + + /* Force release of all pressed keys. */ + return unique_context_flush_keys( context ); +} + +DFBResult +unique_context_set_color( UniqueContext *context, + const DFBColor *color ) +{ + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( color != NULL ); + + context->color = *color; + + return dfb_windowstack_repaint_all( context->stack ); +} + +/* HACK: dumped in here for now, will move into cursor class */ +void +unique_draw_cursor( CoreWindowStack *stack, UniqueContext *context, CardState *state, DFBRegion *region ) +{ + DFBRectangle src; + DFBSurfaceBlittingFlags flags = DSBLIT_BLEND_ALPHACHANNEL; + + D_ASSERT( stack != NULL ); + D_MAGIC_ASSERT( context, UniqueContext ); + D_MAGIC_ASSERT( state, CardState ); + DFB_REGION_ASSERT( region ); + + D_ASSUME( stack->cursor.opacity > 0 ); + + /* Initialize source rectangle. */ + src.x = region->x1 - stack->cursor.x + stack->cursor.hot.x; + src.y = region->y1 - stack->cursor.y + stack->cursor.hot.y; + src.w = region->x2 - region->x1 + 1; + src.h = region->y2 - region->y1 + 1; + + /* Use global alpha blending. */ + if (stack->cursor.opacity != 0xFF) { + flags |= DSBLIT_BLEND_COLORALPHA; + + /* Set opacity as blending factor. */ + if (state->color.a != stack->cursor.opacity) { + state->color.a = stack->cursor.opacity; + state->modified |= SMF_COLOR; + } + } + + /* Different compositing methods depending on destination format. */ + if (flags & DSBLIT_BLEND_ALPHACHANNEL) { + if (DFB_PIXELFORMAT_HAS_ALPHA( state->destination->config.format )) { + /* + * Always use compliant Porter/Duff SRC_OVER, + * if the destination has an alpha channel. + * + * Cd = destination color (non-premultiplied) + * Ad = destination alpha + * + * Cs = source color (non-premultiplied) + * As = source alpha + * + * Ac = color alpha + * + * cd = Cd * Ad (premultiply destination) + * cs = Cs * As (premultiply source) + * + * The full equation to calculate resulting color and alpha (premultiplied): + * + * cx = cd * (1-As*Ac) + cs * Ac + * ax = Ad * (1-As*Ac) + As * Ac + */ + dfb_state_set_src_blend( state, DSBF_ONE ); + + /* Need to premultiply source with As*Ac or only with Ac? */ + if (! (stack->cursor.surface->config.caps & DSCAPS_PREMULTIPLIED)) + flags |= DSBLIT_SRC_PREMULTIPLY; + else if (flags & DSBLIT_BLEND_COLORALPHA) + flags |= DSBLIT_SRC_PREMULTCOLOR; + + /* Need to premultiply/demultiply destination? */ +// if (! (state->destination->caps & DSCAPS_PREMULTIPLIED)) +// flags |= DSBLIT_DST_PREMULTIPLY | DSBLIT_DEMULTIPLY; + } + else { + /* + * We can avoid DSBLIT_SRC_PREMULTIPLY for destinations without an alpha channel + * by using another blending function, which is more likely that it's accelerated + * than premultiplication at this point in time. + * + * This way the resulting alpha (ax) doesn't comply with SRC_OVER, + * but as the destination doesn't have an alpha channel it's no problem. + * + * As the destination's alpha value is always 1.0 there's no need for + * premultiplication. The resulting alpha value will also be 1.0 without + * exceptions, therefore no need for demultiplication. + * + * cx = Cd * (1-As*Ac) + Cs*As * Ac (still same effect as above) + * ax = Ad * (1-As*Ac) + As*As * Ac (wrong, but discarded anyways) + */ + if (stack->cursor.surface->config.caps & DSCAPS_PREMULTIPLIED) { + /* Need to premultiply source with Ac? */ + if (flags & DSBLIT_BLEND_COLORALPHA) + flags |= DSBLIT_SRC_PREMULTCOLOR; + + dfb_state_set_src_blend( state, DSBF_ONE ); + } + else + dfb_state_set_src_blend( state, DSBF_SRCALPHA ); + } + } + + /* Set blitting flags. */ + dfb_state_set_blitting_flags( state, flags ); + + /* Set blitting source. */ + state->source = stack->cursor.surface; + state->modified |= SMF_SOURCE; + + /* Blit from the window to the region being updated. */ + dfb_gfxcard_blit( &src, region->x1, region->y1, state ); + + /* Reset blitting source. */ + state->source = NULL; + state->modified |= SMF_SOURCE; +} + +DFBResult +unique_context_update( UniqueContext *context, + const DFBRegion *updates, + int num, + DFBSurfaceFlipFlags flags ) +{ + int i; + CoreLayer *layer; + CardState *state; + int count = 0; + DFBRegion root; + DFBRegion regions[num]; + DFBRegion cursor_inter; + + D_MAGIC_ASSERT( context, UniqueContext ); + D_ASSERT( context->stack != NULL ); + + D_ASSERT( updates != NULL ); + D_ASSERT( num > 0 ); + + if (!context->active) + return DFB_OK; + + D_DEBUG_AT( UniQuE_Context, "unique_context_update( num %d, flags 0x%08x )\n", num, flags ); + + layer = dfb_layer_at( context->layer_id ); + state = dfb_layer_state( layer ); + + root = DFB_REGION_INIT_FROM_RECTANGLE_VALS( 0, 0, context->width, context->height ); + + for (i=0; i No intersection with root!\n" ); + return DFB_OK; + } + + /* Set destination. */ + state->destination = context->surface; + state->modified |= SMF_DESTINATION; + + for (i=0; iroot, update, state ); + + /* Update cursor? */ + cursor_inter = context->cursor_region; + if (context->cursor_drawn && dfb_region_region_intersect( &cursor_inter, update )) { + DFBRectangle rect = DFB_RECTANGLE_INIT_FROM_REGION( &cursor_inter ); + + D_ASSUME( context->cursor_bs_valid ); + + dfb_gfx_copy_to( context->surface, context->cursor_bs, &rect, + rect.x - context->cursor_region.x1, + rect.y - context->cursor_region.y1, true ); + + unique_draw_cursor( context->stack, context, state, &cursor_inter ); + } + } + + /* Reset destination. */ + state->destination = NULL; + state->modified |= SMF_DESTINATION; + + /* Software cursor code relies on a valid back buffer. */ + if (context->stack->cursor.enabled) + flags |= DSFLIP_BLIT; + + /* Flip all updated regions. */ + for (i=0; iregion, update, flags ); + } + + return DFB_OK; +} + +DFBResult +unique_context_resize( UniqueContext *context, + int width, + int height ) +{ + D_MAGIC_ASSERT( context, UniqueContext ); + + context->width = width; + context->height = height; + + stret_region_resize( context->root, width, height ); + + return DFB_OK; +} + +DFBResult +unique_context_flush_keys( UniqueContext *context ) +{ + D_MAGIC_ASSERT( context, UniqueContext ); + + return DFB_OK; +} + +DFBResult +unique_context_window_at( UniqueContext *context, + int x, + int y, + UniqueWindow **ret_window ) +{ + int i; + CoreWindowStack *stack; + WMShared *shared; + UniqueWindow *window = NULL; + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( ret_window != NULL ); + + stack = context->stack; + shared = context->shared; + + D_ASSERT( stack != NULL ); + D_MAGIC_ASSERT( shared, WMShared ); + + if (stack->cursor.enabled) { + StretRegion *region; + + if (x < 0) + x = stack->cursor.x; + if (y < 0) + y = stack->cursor.y; + + region = stret_region_at( context->root, x, y, SRF_INPUT, SRCID_UNKNOWN ); + if (region && (region->clazz == shared->region_classes[URCI_FOO] || + region->clazz == shared->region_classes[URCI_WINDOW])) + { + window = stret_region_data( region ); + + D_MAGIC_ASSERT( window, UniqueWindow ); + } + } + else { + fusion_vector_foreach_reverse (window, i, context->windows) + if (window->opacity && !(window->options & DWOP_GHOST)) + break; + + if (i < 0) + window = NULL; + } + + D_MAGIC_ASSERT_IF( window, UniqueWindow ); + + *ret_window = window; + + return DFB_OK; +} + +DFBResult +unique_context_lookup_window( UniqueContext *context, + DFBWindowID window_id, + UniqueWindow **ret_window ) +{ + int i; + UniqueWindow *window = NULL; + + D_ASSERT( ret_window != NULL ); + + D_MAGIC_ASSERT( context, UniqueContext ); + + fusion_vector_foreach_reverse (window, i, context->windows) { + if (window->window->id == window_id) + break; + } + + *ret_window = window; + + return DFB_OK; +} + +DFBResult +unique_context_enum_windows( UniqueContext *context, + CoreWMWindowCallback callback, + void *callback_ctx ) +{ + int i; + UniqueWindow *window = NULL; + + D_ASSERT( callback != NULL ); + + D_MAGIC_ASSERT( context, UniqueContext ); + + fusion_vector_foreach_reverse (window, i, context->windows) { + if (callback( window->window, callback_ctx ) != DFENUM_OK) + break; + } + + return DFB_OK; +} + +/**************************************************************************************************/ + +ReactionResult +_unique_cursor_device_listener( const void *msg_data, + void *ctx ) +{ + const UniqueInputEvent *event = msg_data; + UniqueContext *context = ctx; + + D_ASSERT( event != NULL ); + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_DEBUG_AT( UniQuE_Context, "_unique_cursor_device_listener( %p, %p )\n", event, context ); + + switch (event->type) { + case UIET_MOTION: + dfb_windowstack_cursor_warp( context->stack, event->pointer.x, event->pointer.y ); + break; + + default: + break; + } + + return RS_OK; +} + diff --git a/Source/DirectFB/wm/unique/context.h b/Source/DirectFB/wm/unique/context.h new file mode 100755 index 0000000..5361caf --- /dev/null +++ b/Source/DirectFB/wm/unique/context.h @@ -0,0 +1,134 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 __UNIQUE__CONTEXT_H__ +#define __UNIQUE__CONTEXT_H__ + +#include + +#include + +#include + +#include + + +typedef enum { + UCNF_NONE = 0x00000000, + + UCNF_DESTROYED = 0x00000001, + + UCNF_WINDOW_ADDED = 0x00000010, + UCNF_WINDOW_REMOVED = 0x00000020, + + UCNF_ACTIVATE = 0x00000100, + UCNF_DEACTIVATE = 0x00000200, + + UCNF_RESIZE = 0x00001000, + + UCNF_WARP_CURSOR = 0x00010000, + + UCNF_ALL = 0x00011331 +} UniqueContextNotificationFlags; + +typedef struct { + UniqueContextNotificationFlags flags; + UniqueContext *context; + + DFBPoint pos; /* New cursor position (UCNF_WARP_CURSOR) */ + DFBDimension size; /* New root (desktop) size (UCNF_RESIZE) */ +} UniqueContextNotification; + + + +DFBResult unique_context_create ( CoreDFB *core, + CoreWindowStack *stack, + CoreLayerRegion *region, + DFBDisplayLayerID layer_id, + WMShared *shared, + UniqueContext **ret_context ); + +DFBResult unique_context_notify ( UniqueContext *context, + UniqueContextNotificationFlags flags ); + +DFBResult unique_context_set_active ( UniqueContext *context, + bool active ); + +DFBResult unique_context_set_color ( UniqueContext *context, + const DFBColor *color ); + + +DFBResult unique_context_update ( UniqueContext *context, + const DFBRegion *updates, + int num, + DFBSurfaceFlipFlags flags ); + +DFBResult unique_context_resize ( UniqueContext *context, + int width, + int height ); + +DFBResult unique_context_flush_keys ( UniqueContext *context ); + +DFBResult unique_context_window_at ( UniqueContext *context, + int x, + int y, + UniqueWindow **ret_window ); + +DFBResult unique_context_lookup_window( UniqueContext *context, + DFBWindowID window_id, + UniqueWindow **ret_window ); + +DFBResult unique_context_enum_windows ( UniqueContext *context, + CoreWMWindowCallback callback, + void *callback_ctx ); + +DFBResult unique_context_warp_cursor ( UniqueContext *context, + int x, + int y ); + + + +/* + * Creates a pool of context objects. + */ +FusionObjectPool *unique_context_pool_create( const FusionWorld *world ); + +/* + * Generates unique_context_ref(), unique_context_attach() etc. + */ +FUSION_OBJECT_METHODS( UniqueContext, unique_context ) + + +/* global reactions */ + +typedef enum { + UNIQUE_WM_MODULE_CONTEXT_LISTENER +} UNIQUE_CONTEXT_GLOBALS; + +#endif + diff --git a/Source/DirectFB/wm/unique/data/Makefile.am b/Source/DirectFB/wm/unique/data/Makefile.am new file mode 100755 index 0000000..cd63bfb --- /dev/null +++ b/Source/DirectFB/wm/unique/data/Makefile.am @@ -0,0 +1,31 @@ +## Makefile.am for DirectFB/wm/unique/data + +uniquedatadir = $(DATADIR)/unique + +all-local: foo.h + +clean-local: + rm -f foo.h + +EXTRA_DIST = \ + foo_n.png \ + foo_ne.png \ + foo_e.png \ + foo_se.png \ + foo_s.png \ + foo_sw.png \ + foo_w.png \ + foo_nw.png + +if CROSS_COMPILING + directfb_csource = $(DIRECTFB_CSOURCE) +else +if BUILD_TOOLS + directfb_csource = $(top_builddir)/tools/directfb-csource +else + directfb_csource = $(DIRECTFB_CSOURCE) +endif +endif + +foo.h: $(EXTRA_DIST) + $(directfb_csource) --name=foo $(EXTRA_DIST:%=$(srcdir)/%) > foo.h diff --git a/Source/DirectFB/wm/unique/data/Makefile.in b/Source/DirectFB/wm/unique/data/Makefile.in new file mode 100755 index 0000000..ad17ea8 --- /dev/null +++ b/Source/DirectFB/wm/unique/data/Makefile.in @@ -0,0 +1,420 @@ +# 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@ +subdir = wm/unique/data +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +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 = +SOURCES = +DIST_SOURCES = +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@ +uniquedatadir = $(DATADIR)/unique +EXTRA_DIST = \ + foo_n.png \ + foo_ne.png \ + foo_e.png \ + foo_se.png \ + foo_s.png \ + foo_sw.png \ + foo_w.png \ + foo_nw.png + +@BUILD_TOOLS_FALSE@@CROSS_COMPILING_FALSE@directfb_csource = $(DIRECTFB_CSOURCE) +@BUILD_TOOLS_TRUE@@CROSS_COMPILING_FALSE@directfb_csource = $(top_builddir)/tools/directfb-csource +@CROSS_COMPILING_TRUE@directfb_csource = $(DIRECTFB_CSOURCE) +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(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 wm/unique/data/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu wm/unique/data/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 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +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 all-local +installdirs: +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-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +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 -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am all-local check check-am clean clean-generic \ + clean-libtool clean-local distclean distclean-generic \ + distclean-libtool 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-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + uninstall uninstall-am + + +all-local: foo.h + +clean-local: + rm -f foo.h + +foo.h: $(EXTRA_DIST) + $(directfb_csource) --name=foo $(EXTRA_DIST:%=$(srcdir)/%) > foo.h +# 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/wm/unique/data/foo_e.png b/Source/DirectFB/wm/unique/data/foo_e.png new file mode 100755 index 0000000..db1d2d9 Binary files /dev/null and b/Source/DirectFB/wm/unique/data/foo_e.png differ diff --git a/Source/DirectFB/wm/unique/data/foo_n.png b/Source/DirectFB/wm/unique/data/foo_n.png new file mode 100755 index 0000000..ed915dc Binary files /dev/null and b/Source/DirectFB/wm/unique/data/foo_n.png differ diff --git a/Source/DirectFB/wm/unique/data/foo_ne.png b/Source/DirectFB/wm/unique/data/foo_ne.png new file mode 100755 index 0000000..0d94587 Binary files /dev/null and b/Source/DirectFB/wm/unique/data/foo_ne.png differ diff --git a/Source/DirectFB/wm/unique/data/foo_nw.png b/Source/DirectFB/wm/unique/data/foo_nw.png new file mode 100755 index 0000000..a411202 Binary files /dev/null and b/Source/DirectFB/wm/unique/data/foo_nw.png differ diff --git a/Source/DirectFB/wm/unique/data/foo_s.png b/Source/DirectFB/wm/unique/data/foo_s.png new file mode 100755 index 0000000..fe4e9ff Binary files /dev/null and b/Source/DirectFB/wm/unique/data/foo_s.png differ diff --git a/Source/DirectFB/wm/unique/data/foo_se.png b/Source/DirectFB/wm/unique/data/foo_se.png new file mode 100755 index 0000000..4e15605 Binary files /dev/null and b/Source/DirectFB/wm/unique/data/foo_se.png differ diff --git a/Source/DirectFB/wm/unique/data/foo_sw.png b/Source/DirectFB/wm/unique/data/foo_sw.png new file mode 100755 index 0000000..8cb7617 Binary files /dev/null and b/Source/DirectFB/wm/unique/data/foo_sw.png differ diff --git a/Source/DirectFB/wm/unique/data/foo_w.png b/Source/DirectFB/wm/unique/data/foo_w.png new file mode 100755 index 0000000..6e75788 Binary files /dev/null and b/Source/DirectFB/wm/unique/data/foo_w.png differ diff --git a/Source/DirectFB/wm/unique/decoration.c b/Source/DirectFB/wm/unique/decoration.c new file mode 100755 index 0000000..5b98dcd --- /dev/null +++ b/Source/DirectFB/wm/unique/decoration.c @@ -0,0 +1,190 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 + +#include + +#include +#include + +#include + +#include +#include /* FIXME */ +#include /* FIXME */ + +#include + +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_Decoration, "UniQuE/Decoration", "UniQuE's Decoration Object" ); + + +static const ReactionFunc unique_decoration_globals[] = { +/* _unique_foo_decoration_listener,*/ + NULL +}; + +/**************************************************************************************************/ + +static void +decoration_destructor( FusionObject *object, bool zombie, void *ctx ) +{ + UniqueDecoration *decoration = (UniqueDecoration*) object; + + D_MAGIC_ASSERT( decoration, UniqueDecoration ); + + D_DEBUG_AT( UniQuE_Decoration, "destroying %p%s\n", decoration, zombie ? " (ZOMBIE)" : ""); + + unique_window_unlink( &decoration->window ); + unique_context_unlink( &decoration->context ); + + D_MAGIC_CLEAR( decoration ); + + fusion_object_destroy( object ); +} + +FusionObjectPool * +unique_decoration_pool_create( const FusionWorld *world ) +{ + return fusion_object_pool_create( "UniQuE Decoration Pool", + sizeof(UniqueDecoration), + sizeof(UniqueDecorationNotification), + decoration_destructor, NULL, world ); +} + +/**************************************************************************************************/ + +DFBResult +unique_decoration_create( UniqueWindow *window, + UniqueDecorationFlags flags, + UniqueDecoration **ret_decoration ) +{ + DFBResult ret; + UniqueDecoration *decoration; + UniqueContext *context; + + D_ASSERT( window != NULL ); + D_ASSERT( D_FLAGS_ARE_IN( flags, UDF_ALL ) ); + D_ASSERT( ret_decoration != NULL ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + + /* Create a decoration object. */ + decoration = unique_wm_create_decoration(); + if (!decoration) + return DFB_FUSION; + + /* Initialize deocration data. */ + decoration->flags = flags; + + ret = unique_window_link( &decoration->window, window ); + if (ret) + goto error; + + ret = unique_context_link( &decoration->context, window->context ); + if (ret) + goto error; + + + D_MAGIC_SET( decoration, UniqueDecoration ); + + + /* Change global reaction lock. */ + fusion_object_set_lock( &decoration->object, &context->stack->context->lock ); + + /* activate object */ + fusion_object_activate( &decoration->object ); + + /* return the new decoration */ + *ret_decoration = decoration; + + return DFB_OK; + +error: + if (decoration->context) + unique_context_unlink( &decoration->context ); + + if (decoration->window) + unique_window_unlink( &decoration->window ); + + fusion_object_destroy( &decoration->object ); + + return ret; +} + +DFBResult +unique_decoration_destroy( UniqueDecoration *decoration ) +{ + D_MAGIC_ASSERT( decoration, UniqueDecoration ); + + D_FLAGS_SET( decoration->flags, UDF_DESTROYED ); + + unique_decoration_notify( decoration, UDNF_DESTROYED ); + + return DFB_OK; +} + +DFBResult +unique_decoration_notify( UniqueDecoration *decoration, + UniqueDecorationNotificationFlags flags ) +{ + UniqueDecorationNotification notification; + + D_MAGIC_ASSERT( decoration, UniqueDecoration ); + + D_ASSERT( flags != UDNF_NONE ); + + D_ASSERT( ! (flags & ~UDNF_ALL) ); + + notification.flags = flags; + notification.decoration = decoration; + + return unique_decoration_dispatch( decoration, ¬ification, unique_decoration_globals ); +} + +DFBResult +unique_decoration_update( UniqueDecoration *decoration, + const DFBRegion *region ) +{ + D_MAGIC_ASSERT( decoration, UniqueDecoration ); + + DFB_REGION_ASSERT_IF( region ); + + D_UNIMPLEMENTED(); + + return DFB_UNIMPLEMENTED; +} + diff --git a/Source/DirectFB/wm/unique/decoration.h b/Source/DirectFB/wm/unique/decoration.h new file mode 100755 index 0000000..47e9927 --- /dev/null +++ b/Source/DirectFB/wm/unique/decoration.h @@ -0,0 +1,132 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 __UNIQUE__DECORATION_H__ +#define __UNIQUE__DECORATION_H__ + +#include + +#include + +typedef enum { + UDF_NONE = 0x00000000, + + UDF_DESTROYED = 0x00000001, + + UDF_ALL = 0x00000001 +} UniqueDecorationFlags; + + +typedef enum { + UDNF_NONE = 0x00000000, + + UDNF_DESTROYED = 0x00000001, + + UDNF_ALL = 0x00000001 +} UniqueDecorationNotificationFlags; + +typedef struct { + UniqueDecorationNotificationFlags flags; + UniqueDecoration *decoration; +} UniqueDecorationNotification; + + +typedef enum { + UPOR_TOP_LEFT, + UPOR_TOP_MIDDLE, + UPOR_TOP_RIGHT, + UPOR_MIDDLE_LEFT, + UPOR_MIDDLE_MIDDLE, + UPOR_MIDDLE_RIGHT, + UPOR_BOTTOM_LEFT, + UPOR_BOTTOM_MIDDLE, + UPOR_BOTTOM_RIGHT +} UniquePointOfReference; + +typedef enum { + UDSM_BOTH_ABSOLUTE, + UDSM_BOTH_RELATIVE, + UDSM_ABSOLUTE_WIDTH, + UDSM_ABSOLUTE_HEIGHT +} UniqueDecorationSizeMode; + + +typedef struct { + const UniqueLayout *other; + UniquePointOfReference first; + UniquePointOfReference second; + DFBPoint offset; +} UniqueLayoutRelation; + +struct __UniQuE_UniqueLayout { + UniqueLayoutRelation origin; + UniqueLayoutRelation extent; + UniqueLayoutRelation optional; +}; + + + +DFBResult unique_decoration_create ( UniqueWindow *window, + UniqueDecorationFlags flags, + UniqueDecoration **ret_decoration ); + +DFBResult unique_decoration_destroy ( UniqueDecoration *decoration ); + + +DFBResult unique_decoration_notify ( UniqueDecoration *decoration, + UniqueDecorationNotificationFlags flags ); + + +DFBResult unique_decoration_update ( UniqueDecoration *decoration, + const DFBRegion *region ); + + +DFBResult unique_decoration_add_item( UniqueDecoration *decoration, + const UniqueLayout *layout, + UniqueDecorationItem **ret_item ); + +/* + * Creates a pool of decoration objects. + */ +FusionObjectPool *unique_decoration_pool_create( const FusionWorld *world ); + +/* + * Generates unique_decoration_ref(), unique_decoration_attach() etc. + */ +FUSION_OBJECT_METHODS( UniqueDecoration, unique_decoration ) + + +/* global reactions */ + +typedef enum { + UNIQUE_FOO_DECORATION_LISTENER +} UNIQUE_DECORATION_GLOBALS; + + +#endif + diff --git a/Source/DirectFB/wm/unique/device.c b/Source/DirectFB/wm/unique/device.c new file mode 100755 index 0000000..d6b5625 --- /dev/null +++ b/Source/DirectFB/wm/unique/device.c @@ -0,0 +1,495 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include + + +#define MAX_CLASSES 16 + + +D_DEBUG_DOMAIN( UniQuE_Device, "UniQuE/Device", "UniQuE's Devices" ); + + +static const ReactionFunc unique_device_globals[] = { + _unique_input_switch_device_listener, + _unique_cursor_device_listener, + NULL +}; + +/**************************************************************************************************/ + +typedef struct { + DirectLink link; + + int magic; + + DFBInputDeviceID source; + + GlobalReaction reaction; +} DeviceConnection; + +/**************************************************************************************************/ + +static void purge_connection( UniqueDevice *device, + DeviceConnection *connection ); + +/**************************************************************************************************/ + +static const UniqueDeviceClass *classes[MAX_CLASSES] = { NULL }; + +static pthread_mutex_t classes_lock = PTHREAD_MUTEX_INITIALIZER; +static int classes_count = 0; + +/**************************************************************************************************/ + +DFBResult +unique_device_class_register( const UniqueDeviceClass *clazz, + UniqueDeviceClassID *ret_id ) +{ + int i; + + D_DEBUG_AT( UniQuE_Device, "unique_device_class_register( %p )\n", clazz ); + + D_ASSERT( clazz != NULL ); + D_ASSERT( ret_id != NULL ); + + pthread_mutex_lock( &classes_lock ); + + if (classes_count == MAX_CLASSES) { + D_WARN( "too many classes" ); + pthread_mutex_unlock( &classes_lock ); + return DFB_LIMITEXCEEDED; + } + + classes_count++; + + for (i=0; i New class ID is %d.\n", i ); + + D_ASSERT( i < MAX_CLASSES ); + + *ret_id = i; + + pthread_mutex_unlock( &classes_lock ); + + return DFB_OK; +} + +DFBResult +unique_device_class_unregister( UniqueDeviceClassID id ) +{ + D_DEBUG_AT( UniQuE_Device, "unique_device_class_unregister( %d )\n", id ); + + pthread_mutex_lock( &classes_lock ); + + D_ASSERT( id >= 0 ); + D_ASSERT( id < MAX_CLASSES ); + D_ASSERT( classes[id] != NULL ); + + classes[id] = NULL; + + classes_count--; + + pthread_mutex_unlock( &classes_lock ); + + return DFB_OK; +} + +/**************************************************************************************************/ + +DFBResult +unique_device_create( CoreDFB *core, + UniqueContext *context, + UniqueDeviceClassID class_id, + void *ctx, + UniqueDevice **ret_device ) +{ + DFBResult ret; + UniqueDevice *device; + const UniqueDeviceClass *clazz; + + D_DEBUG_AT( UniQuE_Device, "unique_device_create( class %d )\n", class_id ); + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( class_id >= 0 ); + D_ASSERT( class_id < MAX_CLASSES ); + + clazz = classes[class_id]; + + D_ASSERT( clazz != NULL ); + D_ASSERT( ret_device != NULL ); + + /* Allocate device data. */ + device = SHCALLOC( context->shmpool, 1, sizeof(UniqueDevice) ); + if (!device) { + D_WARN( "out of (shared) memory" ); + return D_OOSHM(); + } + + /* Initialize device data. */ + device->context = context; + device->clazz = class_id; + device->ctx = ctx; + + /* Allocate private device data. */ + if (clazz->data_size) { + device->data = SHCALLOC( context->shmpool, 1, clazz->data_size ); + if (!device->data) { + ret = D_OOSHM(); + goto error; + } + } + + /* Create reactor for dispatching generated events. */ + device->reactor = fusion_reactor_new( sizeof(UniqueInputEvent), + "UniQuE Device", dfb_core_world(core) ); + if (!device->reactor) { + ret = DFB_FUSION; + goto error; + } + + fusion_reactor_set_lock( device->reactor, &context->stack->context->lock ); + + D_MAGIC_SET( device, UniqueDevice ); + + if (clazz->Initialize) { + ret = clazz->Initialize( device, device->data, device->ctx ); + if (ret) { + D_MAGIC_CLEAR( device ); + goto error; + } + } + + D_DEBUG_AT( UniQuE_Device, " -> device created (%p)\n", device ); + + *ret_device = device; + + return DFB_OK; + + +error: + if (device->reactor) + fusion_reactor_free( device->reactor ); + + if (device->data) + SHFREE( context->shmpool, device->data ); + + SHFREE( context->shmpool, device ); + + return ret; +} + +DFBResult +unique_device_destroy( UniqueDevice *device ) +{ + DirectLink *n; + DeviceConnection *connection; + UniqueContext *context; + const UniqueDeviceClass *clazz; + + D_MAGIC_ASSERT( device, UniqueDevice ); + + context = device->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( device->clazz >= 0 ); + D_ASSERT( device->clazz < MAX_CLASSES ); + + clazz = classes[device->clazz]; + + D_ASSERT( clazz != NULL ); + + D_DEBUG_AT( UniQuE_Device, "unique_device_destroy( %p )\n", device ); + + direct_list_foreach_safe (connection, n, device->connections) { + D_MAGIC_ASSERT( connection, DeviceConnection ); + + purge_connection( device, connection ); + } + + D_ASSERT( device->connections == NULL ); + + if (clazz->Shutdown) + clazz->Shutdown( device, device->data, device->ctx ); + + fusion_reactor_free( device->reactor ); + + if (device->data) + SHFREE( context->shmpool, device->data ); + + D_MAGIC_CLEAR( device ); + + SHFREE( context->shmpool, device ); + + return DFB_OK; +} + +DFBResult +unique_device_connect( UniqueDevice *device, + CoreInputDevice *source ) +{ + DFBResult ret; + WMShared *shared; + UniqueContext *context; + DeviceConnection *connection; + + D_MAGIC_ASSERT( device, UniqueDevice ); + + D_ASSERT( source != NULL ); + + D_ASSERT( device->clazz >= 0 ); + D_ASSERT( device->clazz < MAX_CLASSES ); + D_ASSERT( classes[device->clazz] != NULL ); + + context = device->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + shared = context->shared; + + D_MAGIC_ASSERT( shared, WMShared ); + + D_DEBUG_AT( UniQuE_Device, "unique_device_connect( %p, %p, ID %d )\n", + device, source, dfb_input_device_id( source ) ); + + /* Allocate connection structure. */ + connection = SHCALLOC( context->shmpool, 1, sizeof(DeviceConnection) ); + if (!connection) + return D_OOSHM(); + + /* Initialize connection structure. */ + connection->source = dfb_input_device_id( source ); + + /* Attach global reaction for processing events. */ + ret = dfb_input_attach_global( source, shared->device_listener, + device, &connection->reaction ); + if (ret) { + SHFREE( context->shmpool, connection ); + return ret; + } + + /* Add the new connection to the list. */ + direct_list_append( &device->connections, &connection->link ); + + D_MAGIC_SET( connection, DeviceConnection ); + + if (classes[device->clazz]->Connected) + classes[device->clazz]->Connected( device, device->data, device->ctx, source ); + + return DFB_OK; +} + +DFBResult +unique_device_disconnect( UniqueDevice *device, + CoreInputDevice *source ) +{ + DFBInputDeviceID source_id; + DeviceConnection *connection; + + D_MAGIC_ASSERT( device, UniqueDevice ); + + D_ASSERT( source != NULL ); + + D_ASSERT( device->clazz >= 0 ); + D_ASSERT( device->clazz < MAX_CLASSES ); + D_ASSERT( classes[device->clazz] != NULL ); + + source_id = dfb_input_device_id( source ); + + direct_list_foreach (connection, device->connections) { + D_MAGIC_ASSERT( connection, DeviceConnection ); + + if (connection->source == source_id) + break; + } + + if (!connection) { + D_WARN( "source not found amoung connections" ); + return DFB_ITEMNOTFOUND; + } + + purge_connection( device, connection ); + + return DFB_OK; +} + +DFBResult +unique_device_attach( UniqueDevice *device, + ReactionFunc func, + void *ctx, + Reaction *reaction ) +{ + D_MAGIC_ASSERT( device, UniqueDevice ); + + return fusion_reactor_attach( device->reactor, func, ctx, reaction ); +} + +DFBResult +unique_device_detach( UniqueDevice *device, + Reaction *reaction ) +{ + D_MAGIC_ASSERT( device, UniqueDevice ); + + return fusion_reactor_detach( device->reactor, reaction ); +} + +DFBResult +unique_device_attach_global( UniqueDevice *device, + int index, + void *ctx, + GlobalReaction *reaction ) +{ + D_MAGIC_ASSERT( device, UniqueDevice ); + + return fusion_reactor_attach_global( device->reactor, index, ctx, reaction ); +} + +DFBResult +unique_device_detach_global( UniqueDevice *device, + GlobalReaction *reaction ) +{ + D_MAGIC_ASSERT( device, UniqueDevice ); + + return fusion_reactor_detach_global( device->reactor, reaction ); +} + +DFBResult +unique_device_dispatch( UniqueDevice *device, + const UniqueInputEvent *event ) +{ + D_MAGIC_ASSERT( device, UniqueDevice ); + + return fusion_reactor_dispatch( device->reactor, event, true, unique_device_globals ); +} + +bool +unique_device_filter ( UniqueDeviceClassID class_id, + const UniqueInputEvent *event, + const UniqueInputEvent *filter ) +{ + const UniqueDeviceClass *clazz; + + D_ASSERT( class_id >= 0 ); + D_ASSERT( class_id < MAX_CLASSES ); + + D_ASSERT( event != NULL ); + D_ASSERT( filter != NULL ); + + clazz = classes[class_id]; + + D_ASSERT( clazz != NULL ); + + if (clazz->FilterEvent) + return clazz->FilterEvent( event, filter ); + + return false; +} + +/**************************************************************************************************/ + +ReactionResult +_unique_device_listener( const void *msg_data, + void *ctx ) +{ + const DFBInputEvent *event = msg_data; + UniqueDevice *device = ctx; + + D_ASSERT( event != NULL ); + + D_MAGIC_ASSERT( device, UniqueDevice ); + + D_ASSERT( device->clazz >= 0 ); + D_ASSERT( device->clazz < MAX_CLASSES ); + D_ASSERT( classes[device->clazz] != NULL ); + D_ASSERT( classes[device->clazz]->ProcessEvent != NULL ); + + classes[device->clazz]->ProcessEvent( device, device->data, device->ctx, event ); + + return RS_OK; +} + +/**************************************************************************************************/ + +static void +purge_connection( UniqueDevice *device, + DeviceConnection *connection ) +{ + CoreInputDevice *source; + UniqueContext *context; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( connection, DeviceConnection ); + + context = device->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + source = dfb_input_device_at( connection->source ); + + D_ASSERT( source != NULL ); + + /* Detach global reaction for processing events. */ + dfb_input_detach_global( source, &connection->reaction ); + + direct_list_remove( &device->connections, &connection->link ); + + if (classes[device->clazz]->Disconnected) + classes[device->clazz]->Disconnected( device, device->data, device->ctx, source ); + + D_MAGIC_CLEAR( connection ); + + SHFREE( context->shmpool, connection ); +} + diff --git a/Source/DirectFB/wm/unique/device.h b/Source/DirectFB/wm/unique/device.h new file mode 100755 index 0000000..d03aa82 --- /dev/null +++ b/Source/DirectFB/wm/unique/device.h @@ -0,0 +1,139 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 __UNIQUE__DEVICE_H__ +#define __UNIQUE__DEVICE_H__ + +#include + +#include + +#include + +#include + + +typedef struct { + int data_size; + + + DFBResult (*Initialize) ( UniqueDevice *device, + void *data, + void *ctx ); + + void (*Shutdown) ( UniqueDevice *device, + void *data, + void *ctx ); + + + void (*Connected) ( UniqueDevice *device, + void *data, + void *ctx, + CoreInputDevice *source ); + + void (*Disconnected)( UniqueDevice *device, + void *data, + void *ctx, + CoreInputDevice *source ); + + void (*ProcessEvent)( UniqueDevice *device, + void *data, + void *ctx, + const DFBInputEvent *event ); + + + bool (*FilterEvent) ( const UniqueInputEvent *event, + const UniqueInputEvent *filter ); +} UniqueDeviceClass; + +typedef unsigned int UniqueDeviceID; +typedef unsigned int UniqueDeviceClassID; + +typedef enum { + UDCI_POINTER, + UDCI_WHEEL, + UDCI_KEYBOARD, + + _UDCI_NUM +} UniqueDeviceClassIndex; + + +DFBResult unique_device_class_register ( const UniqueDeviceClass *clazz, + UniqueDeviceClassID *ret_id ); + +DFBResult unique_device_class_unregister( UniqueDeviceClassID id ); + + +DFBResult unique_device_create ( CoreDFB *core, + UniqueContext *context, + UniqueDeviceClassID class_id, + void *ctx, + UniqueDevice **ret_device ); + +DFBResult unique_device_destroy ( UniqueDevice *device ); + + +DFBResult unique_device_connect ( UniqueDevice *device, + CoreInputDevice *source ); + +DFBResult unique_device_disconnect ( UniqueDevice *device, + CoreInputDevice *source ); + +DFBResult unique_device_attach ( UniqueDevice *device, + ReactionFunc func, + void *ctx, + Reaction *reaction ); + +DFBResult unique_device_detach ( UniqueDevice *device, + Reaction *reaction ); + +DFBResult unique_device_attach_global( UniqueDevice *device, + int index, + void *ctx, + GlobalReaction *reaction ); + +DFBResult unique_device_detach_global( UniqueDevice *device, + GlobalReaction *reaction ); + +DFBResult unique_device_dispatch ( UniqueDevice *device, + const UniqueInputEvent *event ); + +bool unique_device_filter ( UniqueDeviceClassID class_id, + const UniqueInputEvent *event, + const UniqueInputEvent *filter ); + + +/* global reactions */ + +typedef enum { + UNIQUE_INPUT_SWITCH_DEVICE_LISTENER, + UNIQUE_CURSOR_DEVICE_LISTENER +} UNIQUE_DEVICE_GLOBALS; + +#endif + diff --git a/Source/DirectFB/wm/unique/devices/Makefile.am b/Source/DirectFB/wm/unique/devices/Makefile.am new file mode 100755 index 0000000..c42f697 --- /dev/null +++ b/Source/DirectFB/wm/unique/devices/Makefile.am @@ -0,0 +1,21 @@ +## Makefile.am for DirectFB/wm/unique/devices + +INCLUDES = \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/wm + +AM_CPPFLAGS = \ + -DMODULEDIR=\"@MODULEDIR@\" \ + -DSOPATH=\"@SOPATH@\" + + +noinst_LTLIBRARIES = libunique_devices.la + +libunique_devices_la_SOURCES = \ + pointer.c \ + wheel.c \ + keyboard.c diff --git a/Source/DirectFB/wm/unique/devices/Makefile.in b/Source/DirectFB/wm/unique/devices/Makefile.in new file mode 100755 index 0000000..baef097 --- /dev/null +++ b/Source/DirectFB/wm/unique/devices/Makefile.in @@ -0,0 +1,525 @@ +# 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@ +subdir = wm/unique/devices +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +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 = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libunique_devices_la_LIBADD = +am_libunique_devices_la_OBJECTS = pointer.lo wheel.lo keyboard.lo +libunique_devices_la_OBJECTS = $(am_libunique_devices_la_OBJECTS) +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 = $(libunique_devices_la_SOURCES) +DIST_SOURCES = $(libunique_devices_la_SOURCES) +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_builddir)/include \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/lib \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/wm + +AM_CPPFLAGS = \ + -DMODULEDIR=\"@MODULEDIR@\" \ + -DSOPATH=\"@SOPATH@\" + +noinst_LTLIBRARIES = libunique_devices.la +libunique_devices_la_SOURCES = \ + pointer.c \ + wheel.c \ + keyboard.c + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(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 wm/unique/devices/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu wm/unique/devices/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 + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_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 +libunique_devices.la: $(libunique_devices_la_OBJECTS) $(libunique_devices_la_DEPENDENCIES) + $(LINK) $(libunique_devices_la_OBJECTS) $(libunique_devices_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keyboard.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pointer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wheel.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 + +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) +installdirs: +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-libtool clean-noinstLTLIBRARIES \ + 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-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: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES 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-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip 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 + +# 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/wm/unique/devices/keyboard.c b/Source/DirectFB/wm/unique/devices/keyboard.c new file mode 100755 index 0000000..fa4b94a --- /dev/null +++ b/Source/DirectFB/wm/unique/devices/keyboard.c @@ -0,0 +1,192 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 + +#include + +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_Keyboard, "UniQuE/Keyboard", "UniQuE's Keyboard Device Class" ); + + +typedef struct { + int magic; +} KeyboardData; + +/**************************************************************************************************/ + +static DFBResult +keyboard_initialize( UniqueDevice *device, + void *data, + void *ctx ) +{ + KeyboardData *keyboard = data; + + D_MAGIC_ASSERT( device, UniqueDevice ); + + D_DEBUG_AT( UniQuE_Keyboard, "keyboard_initialize( %p, %p, %p )\n", device, data, ctx ); + + D_MAGIC_SET( keyboard, KeyboardData ); + + return DFB_OK; +} + +static void +keyboard_shutdown( UniqueDevice *device, + void *data, + void *ctx ) +{ + KeyboardData *keyboard = data; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( keyboard, KeyboardData ); + + D_DEBUG_AT( UniQuE_Keyboard, "keyboard_shutdown( %p, %p, %p )\n", device, data, ctx ); + + D_MAGIC_CLEAR( keyboard ); +} + +static void +keyboard_connected( UniqueDevice *device, + void *data, + void *ctx, + CoreInputDevice *source ) +{ + KeyboardData *keyboard = data; + + (void) keyboard; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( keyboard, KeyboardData ); + + D_ASSERT( source != NULL ); + + D_DEBUG_AT( UniQuE_Keyboard, "keyboard_connected( %p, %p, %p, %p )\n", + device, data, ctx, source ); +} + +static void +keyboard_disconnected( UniqueDevice *device, + void *data, + void *ctx, + CoreInputDevice *source ) +{ + KeyboardData *keyboard = data; + + (void) keyboard; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( keyboard, KeyboardData ); + + D_ASSERT( source != NULL ); + + D_DEBUG_AT( UniQuE_Keyboard, "keyboard_disconnected( %p, %p, %p, %p )\n", + device, data, ctx, source ); +} + +static void +keyboard_process_event( UniqueDevice *device, + void *data, + void *ctx, + const DFBInputEvent *event ) +{ + UniqueInputEvent evt; + KeyboardData *keyboard = data; + + (void) keyboard; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( keyboard, KeyboardData ); + + D_ASSERT( event != NULL ); + + D_DEBUG_AT( UniQuE_Keyboard, "keyboard_process_event( %p, %p, %p, %p ) <- type 0x%08x\n", + device, data, ctx, event, event->type ); + + switch (event->type) { + case DIET_KEYPRESS: + case DIET_KEYRELEASE: + evt.type = UIET_KEY; + + evt.keyboard.device_id = event->device_id; + evt.keyboard.press = (event->type == DIET_KEYPRESS); + evt.keyboard.key_code = event->key_code; + evt.keyboard.key_id = event->key_id; + evt.keyboard.key_symbol = event->key_symbol; + evt.keyboard.modifiers = event->modifiers; + evt.keyboard.locks = event->locks; + + unique_device_dispatch( device, &evt ); + break; + + default: + break; + } +} + +static bool +keyboard_filter_event( const UniqueInputEvent *event, + const UniqueInputEvent *filter ) +{ + D_ASSERT( event != NULL ); + D_ASSERT( filter != NULL ); + + D_DEBUG_AT( UniQuE_Keyboard, "keyboard_filter_event( %p, %p )\n", event, filter ); + + if (filter->keyboard.key_code != -1) + return (filter->keyboard.key_code == event->keyboard.key_code); + + return (event->keyboard.modifiers == filter->keyboard.modifiers && + event->keyboard.key_symbol == filter->keyboard.key_symbol); +} + + +const UniqueDeviceClass unique_keyboard_device_class = { + data_size: sizeof(KeyboardData), + + Initialize: keyboard_initialize, + Shutdown: keyboard_shutdown, + Connected: keyboard_connected, + Disconnected: keyboard_disconnected, + ProcessEvent: keyboard_process_event, + FilterEvent: keyboard_filter_event +}; + diff --git a/Source/DirectFB/wm/unique/devices/pointer.c b/Source/DirectFB/wm/unique/devices/pointer.c new file mode 100755 index 0000000..4434cba --- /dev/null +++ b/Source/DirectFB/wm/unique/devices/pointer.c @@ -0,0 +1,259 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 + +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_Pointer, "UniQuE/Pointer", "UniQuE's Pointer Device Class" ); + + +typedef struct { + int magic; + + int x; + int y; +} PointerData; + +/**************************************************************************************************/ + +static DFBResult +pointer_initialize( UniqueDevice *device, + void *data, + void *ctx ) +{ + PointerData *pointer = data; + + D_MAGIC_ASSERT( device, UniqueDevice ); + + D_DEBUG_AT( UniQuE_Pointer, "pointer_initialize( %p, %p, %p )\n", device, data, ctx ); + + D_MAGIC_SET( pointer, PointerData ); + + return DFB_OK; +} + +static void +pointer_shutdown( UniqueDevice *device, + void *data, + void *ctx ) +{ + PointerData *pointer = data; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( pointer, PointerData ); + + D_DEBUG_AT( UniQuE_Pointer, "pointer_shutdown( %p, %p, %p )\n", device, data, ctx ); + + D_MAGIC_CLEAR( pointer ); +} + +static void +pointer_connected( UniqueDevice *device, + void *data, + void *ctx, + CoreInputDevice *source ) +{ + PointerData *pointer = data; + + (void) pointer; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( pointer, PointerData ); + + D_ASSERT( source != NULL ); + + D_DEBUG_AT( UniQuE_Pointer, "pointer_connected( %p, %p, %p, %p )\n", + device, data, ctx, source ); +} + +static void +pointer_disconnected( UniqueDevice *device, + void *data, + void *ctx, + CoreInputDevice *source ) +{ + PointerData *pointer = data; + + (void) pointer; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( pointer, PointerData ); + + D_ASSERT( source != NULL ); + + D_DEBUG_AT( UniQuE_Pointer, "pointer_disconnected( %p, %p, %p, %p )\n", + device, data, ctx, source ); +} + +static void +pointer_process_event( UniqueDevice *device, + void *data, + void *ctx, + const DFBInputEvent *event ) +{ + UniqueInputEvent evt; + PointerData *pointer = data; + UniqueContext *context = ctx; + CoreWindowStack *stack; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( pointer, PointerData ); + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( event != NULL ); + + D_DEBUG_AT( UniQuE_Pointer, "pointer_process_event( %p, %p, %p, %p ) <- type 0x%08x\n", + device, data, ctx, event, event->type ); + + stack = context->stack; + + D_ASSERT( stack != NULL ); + + switch (event->type) { + case DIET_AXISMOTION: { + /*int x = pointer->x; + int y = pointer->y;*/ + int x = stack->cursor.x; + int y = stack->cursor.y; + + if (event->flags & DIEF_AXISREL) { + int rel = event->axisrel; + + /* handle cursor acceleration */ + if (rel > stack->cursor.threshold) + rel += (rel - stack->cursor.threshold) + * stack->cursor.numerator + / stack->cursor.denominator; + else if (rel < -stack->cursor.threshold) + rel += (rel + stack->cursor.threshold) + * stack->cursor.numerator + / stack->cursor.denominator; + + switch (event->axis) { + case DIAI_X: + x += rel; + break; + + case DIAI_Y: + y += rel; + break; + + default: + return; + } + } + else if (event->flags & DIEF_AXISABS) { + switch (event->axis) { + case DIAI_X: + x = event->axisabs; + break; + + case DIAI_Y: + y = event->axisabs; + break; + + default: + return; + } + } + else + return; + + if (x < 0) + x = 0; + else if (x >= context->width) + x = context->width - 1; + + if (y < 0) + y = 0; + else if (y >= context->height) + y = context->height - 1; + + if (x == pointer->x && y == pointer->y) + return; + + pointer->x = x; + pointer->y = y; + + evt.type = UIET_MOTION; + + evt.pointer.device_id = event->device_id; + evt.pointer.x = x; + evt.pointer.y = y; + evt.pointer.buttons = event->buttons; + + unique_device_dispatch( device, &evt ); + break; + } + + case DIET_BUTTONPRESS: + case DIET_BUTTONRELEASE: + evt.type = UIET_BUTTON; + + evt.pointer.device_id = event->device_id; + evt.pointer.press = (event->type == DIET_BUTTONPRESS); + evt.pointer.x = pointer->x; + evt.pointer.y = pointer->y; + evt.pointer.button = event->button; + evt.pointer.buttons = event->buttons; + + unique_device_dispatch( device, &evt ); + break; + + default: + break; + } +} + + +const UniqueDeviceClass unique_pointer_device_class = { + data_size: sizeof(PointerData), + + Initialize: pointer_initialize, + Shutdown: pointer_shutdown, + Connected: pointer_connected, + Disconnected: pointer_disconnected, + ProcessEvent: pointer_process_event +}; + diff --git a/Source/DirectFB/wm/unique/devices/wheel.c b/Source/DirectFB/wm/unique/devices/wheel.c new file mode 100755 index 0000000..3328d8f --- /dev/null +++ b/Source/DirectFB/wm/unique/devices/wheel.c @@ -0,0 +1,182 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 + +#include + +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_Wheel, "UniQuE/Wheel", "UniQuE's Wheel Device Class" ); + + +typedef struct { + int magic; +} WheelData; + +/**************************************************************************************************/ + +static DFBResult +wheel_initialize( UniqueDevice *device, + void *data, + void *ctx ) +{ + WheelData *wheel = data; + + D_MAGIC_ASSERT( device, UniqueDevice ); + + D_DEBUG_AT( UniQuE_Wheel, "wheel_initialize( %p, %p, %p )\n", device, data, ctx ); + + D_MAGIC_SET( wheel, WheelData ); + + return DFB_OK; +} + +static void +wheel_shutdown( UniqueDevice *device, + void *data, + void *ctx ) +{ + WheelData *wheel = data; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( wheel, WheelData ); + + D_DEBUG_AT( UniQuE_Wheel, "wheel_shutdown( %p, %p, %p )\n", device, data, ctx ); + + D_MAGIC_CLEAR( wheel ); +} + +static void +wheel_connected( UniqueDevice *device, + void *data, + void *ctx, + CoreInputDevice *source ) +{ + WheelData *wheel = data; + + (void) wheel; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( wheel, WheelData ); + + D_ASSERT( source != NULL ); + + D_DEBUG_AT( UniQuE_Wheel, "wheel_connected( %p, %p, %p, %p )\n", + device, data, ctx, source ); +} + +static void +wheel_disconnected( UniqueDevice *device, + void *data, + void *ctx, + CoreInputDevice *source ) +{ + WheelData *wheel = data; + + (void) wheel; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( wheel, WheelData ); + + D_ASSERT( source != NULL ); + + D_DEBUG_AT( UniQuE_Wheel, "wheel_disconnected( %p, %p, %p, %p )\n", + device, data, ctx, source ); +} + +static void +wheel_process_event( UniqueDevice *device, + void *data, + void *ctx, + const DFBInputEvent *event ) +{ + UniqueInputEvent evt; + WheelData *wheel = data; + + (void) wheel; + + D_MAGIC_ASSERT( device, UniqueDevice ); + D_MAGIC_ASSERT( wheel, WheelData ); + + D_ASSERT( event != NULL ); + + D_DEBUG_AT( UniQuE_Wheel, "wheel_process_event( %p, %p, %p, %p ) <- type 0x%08x\n", + device, data, ctx, event, event->type ); + + switch (event->type) { + case DIET_AXISMOTION: + switch (event->axis) { + case DIAI_Z: + evt.type = UIET_WHEEL; + + evt.wheel.device_id = event->device_id; + + if (event->flags & DIEF_AXISREL) + evt.wheel.value = -event->axisrel; + else if (event->flags & DIEF_AXISABS) + evt.wheel.value = event->axisabs; + else + break; + + unique_device_dispatch( device, &evt ); + break; + + default: + break; + } + break; + + default: + break; + } +} + + +const UniqueDeviceClass unique_wheel_device_class = { + data_size: sizeof(WheelData), + + Initialize: wheel_initialize, + Shutdown: wheel_shutdown, + Connected: wheel_connected, + Disconnected: wheel_disconnected, + ProcessEvent: wheel_process_event +}; + diff --git a/Source/DirectFB/wm/unique/input_channel.c b/Source/DirectFB/wm/unique/input_channel.c new file mode 100755 index 0000000..69dee79 --- /dev/null +++ b/Source/DirectFB/wm/unique/input_channel.c @@ -0,0 +1,206 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_InputChan, "UniQuE/InputChan", "UniQuE's Input Channel" ); + + +static const ReactionFunc unique_input_channel_globals[] = { + _unique_window_input_channel_listener, + NULL +}; + +/**************************************************************************************************/ + +DFBResult +unique_input_channel_create( CoreDFB *core, + UniqueContext *context, + UniqueInputChannel **ret_channel ) +{ + UniqueInputChannel *channel; + + D_DEBUG_AT( UniQuE_InputChan, "unique_input_channel_create( context %p )\n", context ); + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( ret_channel != NULL ); + + /* Allocate channel data. */ + channel = SHCALLOC( context->shmpool, 1, sizeof(UniqueInputChannel) ); + if (!channel) { + D_WARN( "out of (shared) memory" ); + return D_OOSHM(); + } + + /* Initialize channel data. */ + channel->context = context; + + /* Create reactor for dispatching events. */ + channel->reactor = fusion_reactor_new( sizeof(UniqueInputEvent), + "UniQuE Input Channel", dfb_core_world(core) ); + if (!channel->reactor) { + SHFREE( context->shmpool, channel ); + return DFB_FUSION; + } + + fusion_reactor_set_lock( channel->reactor, &context->stack->context->lock ); + + D_MAGIC_SET( channel, UniqueInputChannel ); + + D_DEBUG_AT( UniQuE_InputChan, " -> channel created (%p)\n", channel ); + + *ret_channel = channel; + + return DFB_OK; +} + +DFBResult +unique_input_channel_destroy( UniqueInputChannel *channel ) +{ + UniqueContext *context; + + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + context = channel->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_DEBUG_AT( UniQuE_InputChan, "unique_input_channel_destroy( %p )\n", channel ); + + fusion_reactor_free( channel->reactor ); + + D_MAGIC_CLEAR( channel ); + + SHFREE( context->shmpool, channel ); + + return DFB_OK; +} + + +DFBResult +unique_input_channel_attach( UniqueInputChannel *channel, + ReactionFunc func, + void *ctx, + Reaction *reaction ) +{ + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + return fusion_reactor_attach( channel->reactor, func, ctx, reaction ); +} + +DFBResult +unique_input_channel_detach( UniqueInputChannel *channel, + Reaction *reaction ) +{ + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + return fusion_reactor_detach( channel->reactor, reaction ); +} + +DFBResult +unique_input_channel_attach_global( UniqueInputChannel *channel, + int index, + void *ctx, + GlobalReaction *reaction ) +{ + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + return fusion_reactor_attach_global( channel->reactor, index, ctx, reaction ); +} + +DFBResult +unique_input_channel_detach_global( UniqueInputChannel *channel, + GlobalReaction *reaction ) +{ + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + return fusion_reactor_detach_global( channel->reactor, reaction ); +} + +DFBResult +unique_input_channel_dispatch( UniqueInputChannel *channel, + const UniqueInputEvent *event ) +{ + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + D_ASSERT( event != NULL ); + + D_DEBUG_AT( UniQuE_InputChan, "unique_input_channel_dispatch( %p, %p ) <- type 0x%08x\n", + channel, event, event->type ); + + switch (event->type) { + case UIET_MOTION: + D_DEBUG_AT( UniQuE_InputChan, " -> MOTION %d, %d, buttons 0x%04x\n", + event->pointer.x, event->pointer.y, event->pointer.buttons ); + break; + case UIET_BUTTON: + D_DEBUG_AT( UniQuE_InputChan, " -> BUTTON %d, %d, buttons 0x%04x, button %d, %s\n", + event->pointer.x, event->pointer.y, + event->pointer.buttons, event->pointer.button, + event->pointer.press ? "pressed" : "released" ); + break; + case UIET_WHEEL: + D_DEBUG_AT( UniQuE_InputChan, " -> WHEEL %d\n", event->wheel.value ); + break; + case UIET_KEY: + D_DEBUG_AT( UniQuE_InputChan, " -> KEY 0x%08x, modifiers 0x%04x, %s\n", + event->keyboard.key_symbol, event->keyboard.modifiers, + event->keyboard.press ? "pressed" : "released" ); + break; + case UIET_CHANNEL: + D_DEBUG_AT( UniQuE_InputChan, " -> CHANNEL %d, %d, index %d, %s\n", + event->channel.x, event->channel.y, event->channel.index, + event->channel.selected ? "selected" : "deselected" ); + break; + default: + D_DEBUG_AT( UniQuE_InputChan, " -> unknown type 0x%08x\n", event->type ); + break; + } + + return fusion_reactor_dispatch( channel->reactor, event, true, unique_input_channel_globals ); +} + diff --git a/Source/DirectFB/wm/unique/input_channel.h b/Source/DirectFB/wm/unique/input_channel.h new file mode 100755 index 0000000..a61b92e --- /dev/null +++ b/Source/DirectFB/wm/unique/input_channel.h @@ -0,0 +1,74 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 __UNIQUE__INPUT_CHANNEL_H__ +#define __UNIQUE__INPUT_CHANNEL_H__ + +#include + +#include + +#include +#include + + +DFBResult unique_input_channel_create ( CoreDFB *core, + UniqueContext *context, + UniqueInputChannel **ret_channel ); + +DFBResult unique_input_channel_destroy ( UniqueInputChannel *channel ); + + +DFBResult unique_input_channel_attach ( UniqueInputChannel *channel, + ReactionFunc func, + void *ctx, + Reaction *reaction ); + +DFBResult unique_input_channel_detach ( UniqueInputChannel *channel, + Reaction *reaction ); + +DFBResult unique_input_channel_attach_global( UniqueInputChannel *channel, + int index, + void *ctx, + GlobalReaction *reaction ); + +DFBResult unique_input_channel_detach_global( UniqueInputChannel *channel, + GlobalReaction *reaction ); + +DFBResult unique_input_channel_dispatch ( UniqueInputChannel *channel, + const UniqueInputEvent *event ); + + +/* global reactions */ + +typedef enum { + UNIQUE_WINDOW_INPUT_CHANNEL_LISTENER +} UNIQUE_INPUT_CHANNEL_GLOBALS; + +#endif + diff --git a/Source/DirectFB/wm/unique/input_events.h b/Source/DirectFB/wm/unique/input_events.h new file mode 100755 index 0000000..c0400bb --- /dev/null +++ b/Source/DirectFB/wm/unique/input_events.h @@ -0,0 +1,114 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 __UNIQUE__INPUT_EVENTS_H__ +#define __UNIQUE__INPUT_EVENTS_H__ + +#include + +#include +#include + +typedef enum { + UIET_NONE = 0x00000000, + + UIET_MOTION = 0x00000001, + UIET_BUTTON = 0x00000002, + + UIET_WHEEL = 0x00000010, + + UIET_KEY = 0x00000100, + + UIET_CHANNEL = 0x00001000, + + UIET_ALL = 0x00001113 +} UniqueInputEventType; + + +typedef struct { + UniqueInputEventType type; + + DFBInputDeviceID device_id; + + bool press; + + int x; + int y; + + DFBInputDeviceButtonIdentifier button; + + DFBInputDeviceButtonMask buttons; +} UniqueInputPointerEvent; + +typedef struct { + UniqueInputEventType type; + + DFBInputDeviceID device_id; + + int value; +} UniqueInputWheelEvent; + +typedef struct { + UniqueInputEventType type; + + DFBInputDeviceID device_id; + + bool press; + + int key_code; + DFBInputDeviceKeyIdentifier key_id; + DFBInputDeviceKeySymbol key_symbol; + + DFBInputDeviceModifierMask modifiers; + DFBInputDeviceLockState locks; +} UniqueInputKeyboardEvent; + +typedef struct { + UniqueInputEventType type; + + bool selected; + + UniqueDeviceClassIndex index; + + int x; + int y; +} UniqueInputChannelEvent; + + +union __UniQuE_UniqueInputEvent { + UniqueInputEventType type; + + UniqueInputPointerEvent pointer; + UniqueInputWheelEvent wheel; + UniqueInputKeyboardEvent keyboard; + UniqueInputChannelEvent channel; +}; + + +#endif + diff --git a/Source/DirectFB/wm/unique/input_switch.c b/Source/DirectFB/wm/unique/input_switch.c new file mode 100755 index 0000000..08fa0e2 --- /dev/null +++ b/Source/DirectFB/wm/unique/input_switch.c @@ -0,0 +1,776 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 + +#include + +#include +#include +#include + +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include + + + +D_DEBUG_DOMAIN( UniQuE_InpSw, "UniQuE/InpSwitch", "UniQuE's Input Switch" ); + + +typedef struct { + DirectLink link; + + int magic; + + UniqueDevice *device; + + GlobalReaction reaction; +} SwitchConnection; + +/**************************************************************************************************/ + +static void purge_connection( UniqueInputSwitch *input_switch, + SwitchConnection *connection ); + +static bool target_switch ( UniqueInputSwitch *input_switch, + UniqueDeviceClassIndex index, + UniqueInputChannel *channel ); + +static bool update_targets ( UniqueInputSwitch *input_switch ); + +/**************************************************************************************************/ + +DFBResult +unique_input_switch_create( UniqueContext *context, + UniqueInputSwitch **ret_switch ) +{ + int i; + WMShared *shared; + UniqueInputSwitch *input_switch; + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_create( context %p )\n", context ); + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( ret_switch != NULL ); + + shared = context->shared; + + D_MAGIC_ASSERT( shared, WMShared ); + + /* Allocate switch data. */ + input_switch = SHCALLOC( context->shmpool, 1, sizeof(UniqueInputSwitch) ); + if (!input_switch) { + D_WARN( "out of (shared) memory" ); + return D_OOSHM(); + } + + /* Initialize input_switch data. */ + input_switch->context = context; + + /* Set class ID of each target. */ + for (i=0; i<_UDCI_NUM; i++) + input_switch->targets[i].clazz = shared->device_classes[i]; + + D_MAGIC_SET( input_switch, UniqueInputSwitch ); + + D_DEBUG_AT( UniQuE_InpSw, " -> input_switch created (%p)\n", input_switch ); + + *ret_switch = input_switch; + + return DFB_OK; +} + +DFBResult +unique_input_switch_destroy( UniqueInputSwitch *input_switch ) +{ + int i; + DirectLink *n; + SwitchConnection *connection; + UniqueContext *context; + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + + context = input_switch->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_destroy( %p )\n", input_switch ); + + direct_list_foreach_safe (connection, n, input_switch->connections) { + D_MAGIC_ASSERT( connection, SwitchConnection ); + + purge_connection( input_switch, connection ); + } + + D_ASSERT( input_switch->connections == NULL ); + + for (i=0; i<_UDCI_NUM; i++) { + UniqueInputFilter *filter; + UniqueInputTarget *target = &input_switch->targets[i]; + + direct_list_foreach_safe (filter, n, target->filters) { + D_MAGIC_ASSERT( filter, UniqueInputFilter ); + D_MAGIC_ASSERT( filter->channel, UniqueInputChannel ); + + D_DEBUG_AT( UniQuE_InpSw, " -> filter %p, index %d, channel %p\n", + filter, filter->index, filter->channel ); + + direct_list_remove( &target->filters, &filter->link ); + + D_MAGIC_CLEAR( filter ); + + SHFREE( context->shmpool, filter ); + } + + D_ASSERT( target->filters == NULL ); + } + + D_MAGIC_CLEAR( input_switch ); + + SHFREE( context->shmpool, input_switch ); + + return DFB_OK; +} + +DFBResult +unique_input_switch_add( UniqueInputSwitch *input_switch, + UniqueDevice *device ) +{ + DFBResult ret; + SwitchConnection *connection; + UniqueContext *context; + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + D_MAGIC_ASSERT( device, UniqueDevice ); + + context = input_switch->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_add( %p, %p )\n", input_switch, device ); + + /* Allocate connection structure. */ + connection = SHCALLOC( context->shmpool, 1, sizeof(SwitchConnection) ); + if (!connection) { + D_WARN( "out of (shared) memory" ); + return D_OOSHM(); + } + + /* Initialize connection structure. */ + connection->device = device; + + /* Attach global reaction for processing events. */ + ret = unique_device_attach_global( device, UNIQUE_INPUT_SWITCH_DEVICE_LISTENER, + input_switch, &connection->reaction ); + if (ret) { + D_DERROR( ret, "UniQuE/InpSwitch: Could not attach global device reaction!\n" ); + SHFREE( context->shmpool, connection ); + return ret; + } + + /* Add the new connection to the list. */ + direct_list_append( &input_switch->connections, &connection->link ); + + D_MAGIC_SET( connection, SwitchConnection ); + + return DFB_OK; +} + +DFBResult +unique_input_switch_remove( UniqueInputSwitch *input_switch, + UniqueDevice *device ) +{ + SwitchConnection *connection; + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + D_MAGIC_ASSERT( device, UniqueDevice ); + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_remove( %p, %p )\n", input_switch, device ); + + direct_list_foreach (connection, input_switch->connections) { + D_MAGIC_ASSERT( connection, SwitchConnection ); + + if (connection->device == device) + break; + } + + if (!connection) { + D_WARN( "device not found amoung connections" ); + return DFB_ITEMNOTFOUND; + } + + purge_connection( input_switch, connection ); + + return DFB_OK; +} + +DFBResult +unique_input_switch_select( UniqueInputSwitch *input_switch, + UniqueDeviceClassIndex index, + UniqueInputChannel *channel ) +{ + UniqueInputTarget *target; + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_select( %p, %d, %p )\n", + input_switch, index, channel ); + + D_ASSERT( index >= 0 ); + D_ASSERT( index < _UDCI_NUM ); + + target = &input_switch->targets[index]; + + target->normal = channel; + + if (!target->fixed && !target->implicit) + target_switch( input_switch, index, channel ); + + return DFB_OK; +} + +DFBResult +unique_input_switch_set( UniqueInputSwitch *input_switch, + UniqueDeviceClassIndex index, + UniqueInputChannel *channel ) +{ + UniqueInputTarget *target; + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_set( %p, %d, %p )\n", + input_switch, index, channel ); + + D_ASSERT( index >= 0 ); + D_ASSERT( index < _UDCI_NUM ); + + target = &input_switch->targets[index]; + + if (target->fixed) + return DFB_BUSY; + + target->fixed = channel; + + target_switch( input_switch, index, channel ); + + return DFB_OK; +} + +DFBResult +unique_input_switch_unset( UniqueInputSwitch *input_switch, + UniqueDeviceClassIndex index, + UniqueInputChannel *channel ) +{ + UniqueInputTarget *target; + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_unset( %p, %d, %p )\n", + input_switch, index, channel ); + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + D_ASSERT( index >= 0 ); + D_ASSERT( index < _UDCI_NUM ); + + target = &input_switch->targets[index]; + + if (target->fixed != channel) + return DFB_ACCESSDENIED; + + target->fixed = NULL; + + + update_targets( input_switch ); + //target_switch( input_switch, index, target->normal ); + + return DFB_OK; +} + +DFBResult +unique_input_switch_set_filter( UniqueInputSwitch *input_switch, + UniqueDeviceClassIndex index, + UniqueInputChannel *channel, + const UniqueInputEvent *event, + UniqueInputFilter **ret_filter ) +{ + UniqueInputFilter *filter; + UniqueInputTarget *target; + UniqueContext *context; + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_set_filter( %p, %d, %p, %p )\n", + input_switch, index, channel, event ); + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + D_ASSERT( index >= 0 ); + D_ASSERT( index < _UDCI_NUM ); + + D_ASSERT( event != NULL ); + D_ASSERT( ret_filter != NULL ); + + context = input_switch->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + target = &input_switch->targets[index]; + + direct_list_foreach (filter, target->filters) { + D_MAGIC_ASSERT( filter, UniqueInputFilter ); + + if (unique_device_filter( target->clazz, event, &filter->filter )) + return DFB_BUSY; + } + + /* Allocate new filter. */ + filter = SHCALLOC( context->shmpool, 1, sizeof(UniqueInputFilter) ); + if (!filter) + return D_OOSHM(); + + filter->index = index; + filter->channel = channel; + filter->filter = *event; + + direct_list_append( &target->filters, &filter->link ); + + D_MAGIC_SET( filter, UniqueInputFilter ); + + *ret_filter = filter; + + return DFB_OK; +} + +DFBResult +unique_input_switch_unset_filter( UniqueInputSwitch *input_switch, + UniqueInputFilter *filter ) +{ + UniqueInputTarget *target; + UniqueContext *context; + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_unset_filter( %p, %p )\n", + input_switch, filter ); + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + D_MAGIC_ASSERT( filter, UniqueInputFilter ); + + context = input_switch->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( filter->index >= 0 ); + D_ASSERT( filter->index < _UDCI_NUM ); + + target = &input_switch->targets[filter->index]; + + direct_list_remove( &target->filters, &filter->link ); + + D_MAGIC_CLEAR( filter ); + + SHFREE( context->shmpool, filter ); + + return DFB_OK; +} + +DFBResult +unique_input_switch_drop( UniqueInputSwitch *input_switch, + UniqueInputChannel *channel ) +{ + int i; + UniqueContext *context; + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_drop( %p, %p )\n", input_switch, channel ); + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + context = input_switch->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + for (i=0; i<_UDCI_NUM; i++) { + DirectLink *n; + UniqueInputFilter *filter; + UniqueInputTarget *target = &input_switch->targets[i]; + + if (target->normal == channel) + target->normal = NULL; + + if (target->fixed == channel) + target->fixed = NULL; + + if (target->implicit == channel) + target->implicit = NULL; + + if (target->current == channel) + target->current = NULL; + + D_DEBUG_AT( UniQuE_InpSw, " -> index %d, filters %p\n", i, target->filters ); + + direct_list_foreach_safe (filter, n, target->filters) { + D_MAGIC_ASSERT( filter, UniqueInputFilter ); + D_MAGIC_ASSERT( filter->channel, UniqueInputChannel ); + + D_DEBUG_AT( UniQuE_InpSw, + " -> filter %p, channel %p\n", filter, filter->channel ); + + D_ASSUME( filter->channel != channel ); + + if (filter->channel == channel) { + direct_list_remove( &target->filters, &filter->link ); + + D_MAGIC_CLEAR( filter ); + + SHFREE( context->shmpool, filter ); + } + } + } + + if (!input_switch->targets[UDCI_POINTER].fixed) + update_targets( input_switch ); + + return DFB_OK; +} + +DFBResult +unique_input_switch_update( UniqueInputSwitch *input_switch, + UniqueInputChannel *channel ) +{ + int x, y, i; + StretRegion *region; + UniqueContext *context; + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + + x = input_switch->x; + y = input_switch->y; + + D_DEBUG_AT( UniQuE_InpSw, "unique_input_switch_update( %d, %d )\n", x, y ); + + context = input_switch->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + region = stret_region_at( context->root, x, y, SRF_INPUT, SRCID_UNKNOWN ); + if (region) { + for (i=0; i<_UDCI_NUM; i++) { + UniqueInputTarget *target = &input_switch->targets[i]; + + if (target->normal == channel) + stret_region_get_input( region, i, x, y, &target->normal ); + } + } + else { + for (i=0; i<_UDCI_NUM; i++) { + UniqueInputTarget *target = &input_switch->targets[i]; + + if (target->normal == channel) + target->normal = NULL; + } + } + + for (i=0; i<_UDCI_NUM; i++) { + UniqueInputTarget *target = &input_switch->targets[i]; + + target_switch( input_switch, i, target->fixed ? : target->implicit ? : target->normal ); + } + + return DFB_OK; +} + +/**************************************************************************************************/ + +static bool +target_switch( UniqueInputSwitch *input_switch, + UniqueDeviceClassIndex index, + UniqueInputChannel *channel ) +{ + UniqueInputEvent evt; + UniqueInputTarget *target; + UniqueInputChannel *current; + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + D_ASSERT( index >= 0 ); + D_ASSERT( index < _UDCI_NUM ); + + target = &input_switch->targets[index]; + + current = target->current; + + D_MAGIC_ASSERT_IF( channel, UniqueInputChannel ); + D_MAGIC_ASSERT_IF( current, UniqueInputChannel ); + + if (channel == current) + return false; + + D_DEBUG_AT( UniQuE_InpSw, "target_switch( index %d, x %d, y %d, channel %p )\n", + index, input_switch->x, input_switch->y, channel ); + + evt.type = UIET_CHANNEL; + + evt.channel.index = index; + evt.channel.x = input_switch->x; + evt.channel.y = input_switch->y; + + if (current) { + evt.channel.selected = false; + + unique_input_channel_dispatch( current, &evt ); + } + + target->current = channel; + + if (channel) { + evt.channel.selected = true; + + unique_input_channel_dispatch( channel, &evt ); + } + + return true; +} + +static void +target_dispatch( UniqueInputTarget *target, + const UniqueInputEvent *event ) +{ + UniqueInputFilter *filter; + UniqueInputChannel *channel; + + D_ASSERT( target != NULL ); + D_ASSERT( event != NULL ); + + channel = target->current; + + D_MAGIC_ASSERT_IF( channel, UniqueInputChannel ); + + + direct_list_foreach (filter, target->filters) { + D_MAGIC_ASSERT( filter, UniqueInputFilter ); + + if (unique_device_filter( target->clazz, event, &filter->filter )) { + channel = filter->channel; + + D_MAGIC_ASSERT( channel, UniqueInputChannel ); + + break; + } + } + + if (channel) + unique_input_channel_dispatch( channel, event ); + else + D_DEBUG_AT( UniQuE_InpSw, "target_dispatch( class %d ) " + "<- no selected channel, dropping event.\n", target->clazz ); +} + +static bool +update_targets( UniqueInputSwitch *input_switch ) +{ + int x, y, i; + StretRegion *region; + UniqueContext *context; + bool updated[_UDCI_NUM]; + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + + x = input_switch->x; + y = input_switch->y; + + D_DEBUG_AT( UniQuE_InpSw, "update_targets( %d, %d )\n", x, y ); + + context = input_switch->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + region = stret_region_at( context->root, x, y, SRF_INPUT, SRCID_UNKNOWN ); + if (region) { + for (i=0; i<_UDCI_NUM; i++) + stret_region_get_input( region, i, x, y, &input_switch->targets[i].normal ); + } + else { + for (i=0; i<_UDCI_NUM; i++) + input_switch->targets[i].normal = NULL; + } + + for (i=0; i<_UDCI_NUM; i++) { + UniqueInputTarget *target = &input_switch->targets[i]; + + updated[i] = target_switch( input_switch, i, + target->fixed ? : target->implicit ? : target->normal ); + } + + return updated[UDCI_POINTER]; +} + +ReactionResult +_unique_input_switch_device_listener( const void *msg_data, + void *ctx ) +{ + const UniqueInputEvent *event = msg_data; + UniqueInputSwitch *inpsw = ctx; + UniqueInputTarget *target = NULL; + UniqueContext *context; + + (void) event; + (void) inpsw; + + D_ASSERT( event != NULL ); + + D_MAGIC_ASSERT( inpsw, UniqueInputSwitch ); + + context = inpsw->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + if (dfb_windowstack_lock( context->stack )) + return RS_OK; + + if (!context->active) { + dfb_windowstack_unlock( context->stack ); + return RS_OK; + } + + D_DEBUG_AT( UniQuE_InpSw, "_unique_input_switch_device_listener( %p, %p )\n", + event, inpsw ); + + switch (event->type) { + case UIET_MOTION: + target = &inpsw->targets[UDCI_POINTER]; + + inpsw->x = event->pointer.x; + inpsw->y = event->pointer.y; + + if (!target->fixed && !target->implicit && update_targets( inpsw )) + break; + + target_dispatch( target, event ); + break; + + case UIET_BUTTON: + target = &inpsw->targets[UDCI_POINTER]; + + if (event->pointer.press && !target->implicit) { + D_DEBUG_AT( UniQuE_InpSw, " -> implicit pointer grab, %p\n", target->current ); + + target->implicit = target->current; + } + + target_dispatch( target, event ); + + if (!event->pointer.press && !event->pointer.buttons) { + D_ASSUME( target->implicit != NULL ); + + if (target->implicit) { + D_DEBUG_AT( UniQuE_InpSw, " -> implicit pointer ungrab, %p\n", target->implicit ); + + target->implicit = NULL; + + if (!target->fixed) + update_targets( inpsw ); + } + } + break; + + case UIET_WHEEL: + target_dispatch( &inpsw->targets[UDCI_WHEEL], event ); + break; + + case UIET_KEY: + target = &inpsw->targets[UDCI_KEYBOARD]; + + if (event->keyboard.press && !target->implicit) { + D_DEBUG_AT( UniQuE_InpSw, " -> implicit keyboard grab, %p\n", target->current ); + + target->implicit = target->current; + } + + target_dispatch( target, event ); + + if (!event->keyboard.press && !event->keyboard.modifiers) { + //D_ASSUME( target->implicit != NULL ); + + if (target->implicit) { + D_DEBUG_AT( UniQuE_InpSw, " -> implicit keyboard ungrab, %p\n", target->implicit ); + + if (!target->fixed) + target_switch( inpsw, UDCI_KEYBOARD, target->normal ); + + target->implicit = NULL; + } + } + break; + + default: + D_ONCE( "unknown event type" ); + break; + } + + dfb_windowstack_unlock( context->stack ); + + return RS_OK; +} + +/**************************************************************************************************/ + +static void +purge_connection( UniqueInputSwitch *input_switch, + SwitchConnection *connection ) +{ + UniqueContext *context; + + D_DEBUG_AT( UniQuE_InpSw, "purge_connection( %p, %p )\n", input_switch, connection ); + + D_MAGIC_ASSERT( input_switch, UniqueInputSwitch ); + D_MAGIC_ASSERT( connection, SwitchConnection ); + + context = input_switch->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + /* Detach global reaction for receiving events. */ + unique_device_detach_global( connection->device, &connection->reaction ); + + direct_list_remove( &input_switch->connections, &connection->link ); + + D_MAGIC_CLEAR( connection ); + + SHFREE( context->shmpool, connection ); +} + diff --git a/Source/DirectFB/wm/unique/input_switch.h b/Source/DirectFB/wm/unique/input_switch.h new file mode 100755 index 0000000..cccb8c6 --- /dev/null +++ b/Source/DirectFB/wm/unique/input_switch.h @@ -0,0 +1,78 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 __UNIQUE__INPUT_SWITCH_H__ +#define __UNIQUE__INPUT_SWITCH_H__ + +#include + +#include +#include + + +DFBResult unique_input_switch_create ( UniqueContext *context, + UniqueInputSwitch **ret_switch ); + +DFBResult unique_input_switch_destroy ( UniqueInputSwitch *input_switch ); + +DFBResult unique_input_switch_add ( UniqueInputSwitch *input_switch, + UniqueDevice *device ); + +DFBResult unique_input_switch_remove ( UniqueInputSwitch *input_switch, + UniqueDevice *device ); + +DFBResult unique_input_switch_select ( UniqueInputSwitch *input_switch, + UniqueDeviceClassIndex index, + UniqueInputChannel *channel ); + +DFBResult unique_input_switch_set ( UniqueInputSwitch *input_switch, + UniqueDeviceClassIndex index, + UniqueInputChannel *channel ); + +DFBResult unique_input_switch_unset ( UniqueInputSwitch *input_switch, + UniqueDeviceClassIndex index, + UniqueInputChannel *channel ); + +DFBResult unique_input_switch_set_filter ( UniqueInputSwitch *input_switch, + UniqueDeviceClassIndex index, + UniqueInputChannel *channel, + const UniqueInputEvent *event, + UniqueInputFilter **ret_filter ); + +DFBResult unique_input_switch_unset_filter( UniqueInputSwitch *input_switch, + UniqueInputFilter *filter ); + +DFBResult unique_input_switch_drop ( UniqueInputSwitch *input_switch, + UniqueInputChannel *channel ); + +DFBResult unique_input_switch_update ( UniqueInputSwitch *input_switch, + UniqueInputChannel *channel ); + + +#endif + diff --git a/Source/DirectFB/wm/unique/internal.h b/Source/DirectFB/wm/unique/internal.h new file mode 100755 index 0000000..0dbf9b4 --- /dev/null +++ b/Source/DirectFB/wm/unique/internal.h @@ -0,0 +1,378 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 __UNIQUE__INTERNAL_H__ +#define __UNIQUE__INTERNAL_H__ + +#include + +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + + +#define UNIQUE_WM_ABI_VERSION 12 + + +extern const StretRegionClass unique_root_region_class; +extern const StretRegionClass unique_frame_region_class; +extern const StretRegionClass unique_window_region_class; +extern const StretRegionClass unique_foo_region_class; + +extern const UniqueDeviceClass unique_pointer_device_class; +extern const UniqueDeviceClass unique_wheel_device_class; +extern const UniqueDeviceClass unique_keyboard_device_class; + +typedef enum { + URCI_ROOT, + URCI_FRAME, + URCI_WINDOW, + URCI_FOO, + + _URCI_NUM +} UniqueRegionClassIndex; + +typedef enum { + UFI_N, + UFI_NE, + UFI_E, + UFI_SE, + UFI_S, + UFI_SW, + UFI_W, + UFI_NW +} UniqueFooIndex; + +typedef ReactionResult (*UniqueWMContextNotify)( WMData *data, + const UniqueContextNotification *notification, + void *ctx ); + +typedef ReactionResult (*UniqueWMWindowNotify) ( WMData *data, + const UniqueWindowNotification *notification, + void *ctx ); + + +struct __UniQuE_WMData { + int module_abi; + + CoreDFB *core; + FusionWorld *world; + + WMShared *shared; + + UniqueWMContextNotify context_notify; + UniqueWMWindowNotify window_notify; +}; + +struct __UniQuE_WMShared { + int magic; + + FusionObjectPool *context_pool; + FusionObjectPool *decoration_pool; + FusionObjectPool *window_pool; + + StretRegionClassID region_classes[_URCI_NUM]; + UniqueDeviceClassID device_classes[_UDCI_NUM]; + + int device_listener; /* index of the registered global */ + + DFBInsets insets; + + DFBRectangle foo_rects[8]; + + CoreSurface *foo_surface; +}; + + +typedef enum { + UNRL_DESKTOP, /* Icons, redirected fullscreen apps (force-desktop) */ + UNRL_USER, /* User windows (all currently available stacking classes) */ + UNRL_SYSTEM, /* Dock/Panel, Glass, Expos?, Clipboard, Virtual Keyboard, IMs */ + UNRL_CURSOR, /* Cursor shape and attached objects, e.g. Drag'N'Drop */ + UNRL_SCREEN, /* Display Locking, Screensaver */ + + _UNRL_NUM +} UniqueRootLevel; + +typedef enum { + UNFL_BACKGROUND, /* Background for blended content, effects, decorations */ + UNFL_CONTENT, /* The actual DirectFB Window, i.e. its content */ + UNFL_FOREGROUND, /* Decorations, effects, any other content overlay */ + + _UNFL_NUM +} UniqueFrameLevel; + +typedef struct { + DirectLink link; + + DFBInputDeviceKeySymbol symbol; + DFBInputDeviceModifierMask modifiers; + + UniqueWindow *owner; +} GrabbedKey; + + +struct __UniQuE_UniqueContext { + FusionObject object; + + int magic; + + CoreWindowStack *stack; + WMShared *shared; + + CoreLayerRegion *region; + CoreSurface *surface; + + DFBDisplayLayerID layer_id; + + bool active; + + DFBColor color; + + int width; + int height; + + StretRegion *root; + + FusionVector windows; + + + UniqueInputSwitch *input_switch; + + UniqueDevice *devices[_UDCI_NUM]; + + GlobalReaction cursor_reaction; + + FusionSHMPoolShared *shmpool; + + UniqueInputChannel *foo_channel; + + CoreSurface *cursor_bs; /* backing store for region under cursor */ + bool cursor_bs_valid; + DFBRegion cursor_region; + bool cursor_drawn; +}; + +struct __UniQuE_UniqueWindow { + FusionObject object; + + int magic; + + CoreWindow *window; + UniqueContext *context; + WMShared *shared; + + CoreSurface *surface; + + UniqueInputChannel *channel; + GlobalReaction channel_reaction; + + DirectLink *filters; + + DFBWindowCapabilities caps; + + UniqueWindowFlags flags; + + StretRegion *frame; + StretRegion *region; + StretRegion *foos[8]; + DFBPoint foo_motion; + + DFBInsets insets; + + DFBRectangle bounds; /* absolute bounds of the content */ + DFBRectangle full; /* absolute bounds of the full frame */ + + int opacity; /* global alpha factor */ + + DFBWindowStackingClass stacking; /* level boundaries */ + int priority; /* derived from stacking class */ + + DFBWindowOptions options; /* flags for appearance/behaviour */ + DFBWindowEventType events; /* mask of enabled events */ + + u32 color_key; /* transparent pixel */ + DFBRegion opaque; /* region of the window forced to be opaque */ +}; + +struct __UniQuE_UniqueDecoration { + FusionObject object; + + int magic; + + UniqueWindow *window; + UniqueContext *context; + + UniqueDecorationFlags flags; +}; + +struct __UniQuE_UniqueDecorationItem { + const UniqueLayout *layout; + + DFBPoint pos; /* current offset from window origin */ + DFBDimension size; /* current dimensions */ +}; + +struct __UniQuE_StretRegion { + int magic; + + StretRegion *parent; /* Is NULL for the root region. */ + + int level; /* Level within the parent. */ + int index; /* Index within the level. */ + + int levels; /* Number of levels provided. */ + FusionVector *children; /* Children of each level. */ + + StretRegionFlags flags; /* Control appearance and activity. */ + + DFBRegion bounds; /* Relative to its parent. */ + + StretRegionClassID clazz; /* Region class (implementation) used for rendering etc. */ + + void *data; /* Optional private data of region class. */ + unsigned long arg; /* Optional argument for region class instance. */ + + FusionSHMPoolShared *shmpool; +}; + +struct __UniQuE_UniqueDevice { + int magic; + + UniqueContext *context; + + UniqueDeviceClassID clazz; /* Device class (implementation) used for processing etc. */ + + void *data; /* Optional private data of device class. */ + void *ctx; /* Optional context for device class instance. */ + + FusionReactor *reactor; /* UniqueInputEvent deployment */ + + DirectLink *connections; /* CoreInputDevice connections */ +}; + + +struct __UniQuE_UniqueInputFilter { + DirectLink link; + + int magic; + + UniqueDeviceClassIndex index; + + UniqueInputChannel *channel; + + UniqueInputEvent filter; +}; + +typedef struct { + UniqueDeviceClassID clazz; + + UniqueInputChannel *current; + + UniqueInputChannel *normal; + UniqueInputChannel *fixed; + + UniqueInputChannel *implicit; + + DirectLink *filters; +} UniqueInputTarget; + + +struct __UniQuE_UniqueInputSwitch { + int magic; + + UniqueContext *context; + + DirectLink *connections; /* UniqueDevice connections */ + + int x; + int y; + + UniqueInputTarget targets[_UDCI_NUM]; +}; + +struct __UniQuE_UniqueInputChannel { + int magic; + + UniqueContext *context; + + FusionReactor *reactor; /* UniqueInputEvent arrival */ +}; + + +DFBResult unique_wm_module_init ( CoreDFB *core, + WMData *data, + WMShared *shared, + bool master ); + +void unique_wm_module_deinit( WMData *data, + WMShared *shared, + bool master, + bool emergency ); + +UniqueContext *unique_wm_create_context( void ); +UniqueDecoration *unique_wm_create_decoration( void ); +UniqueWindow *unique_wm_create_window( void ); + +/* HACK: temporary, will move into cursor class */ +void unique_draw_cursor( CoreWindowStack *stack, UniqueContext *context, CardState *state, DFBRegion *region ); + + +/* global reactions */ +ReactionResult _unique_device_listener ( const void *msg_data, + void *ctx ); + +ReactionResult _unique_wm_module_context_listener ( const void *msg_data, + void *ctx ); + +ReactionResult _unique_wm_module_window_listener ( const void *msg_data, + void *ctx ); + +ReactionResult _unique_cursor_device_listener ( const void *msg_data, + void *ctx ); + +ReactionResult _unique_input_switch_device_listener ( const void *msg_data, + void *ctx ); + +ReactionResult _unique_window_input_channel_listener( const void *msg_data, + void *ctx ); + +#endif + diff --git a/Source/DirectFB/wm/unique/stret.c b/Source/DirectFB/wm/unique/stret.c new file mode 100755 index 0000000..0ae2326 --- /dev/null +++ b/Source/DirectFB/wm/unique/stret.c @@ -0,0 +1,837 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 + +#include +#include +#include + +#include +#include + +#include + +#include + +#include +#include +#include + + +#define MAX_CLASSES 16 + +D_DEBUG_DOMAIN( UniQuE_StReT, "UniQuE/StReT", "UniQuE's Stack Region Tree" ); + +/**************************************************************************************************/ + +static void +default_update( StretRegion *region, + void *region_data, + void *update_data, + unsigned long arg, + int x, + int y, + const DFBRegion *updates, + int num ) +{ + D_DEBUG_AT( UniQuE_StReT, "default_update( %p, %p, %p, %lu, %d, %d, %p, %d )\n", + region, region_data, update_data, arg, x, y, updates, num ); +} + +static const StretRegionClass default_class = { + .Update = default_update, +}; + +/**************************************************************************************************/ + +static const StretRegionClass *classes[MAX_CLASSES] = { &default_class, NULL }; + +static pthread_mutex_t classes_lock = PTHREAD_MUTEX_INITIALIZER; +static int classes_count = 1; + +/**************************************************************************************************/ + +DFBResult +stret_class_register( const StretRegionClass *clazz, + StretRegionClassID *ret_id ) +{ + int i; + + D_DEBUG_AT( UniQuE_StReT, "stret_class_register( %p )\n", clazz ); + + D_ASSERT( clazz != NULL ); + D_ASSERT( ret_id != NULL ); + + pthread_mutex_lock( &classes_lock ); + + if (classes_count == MAX_CLASSES) { + D_WARN( "too many classes" ); + pthread_mutex_unlock( &classes_lock ); + return DFB_LIMITEXCEEDED; + } + + classes_count++; + + for (i=0; i New class ID is %d.\n", i ); + + D_ASSERT( i < MAX_CLASSES ); + + *ret_id = i; + + pthread_mutex_unlock( &classes_lock ); + + return DFB_OK; +} + +DFBResult +stret_class_unregister( StretRegionClassID id ) +{ + D_DEBUG_AT( UniQuE_StReT, "stret_class_unregister( %d )\n", id ); + + pthread_mutex_lock( &classes_lock ); + + D_ASSERT( id >= 0 ); + D_ASSERT( id < MAX_CLASSES ); + D_ASSERT( classes[id] != NULL ); + + classes[id] = NULL; + + classes_count--; + + pthread_mutex_unlock( &classes_lock ); + + return DFB_OK; +} + + + +DFBResult +stret_region_create( StretRegionClassID class_id, + void *data, + unsigned long arg, + StretRegionFlags flags, + int levels, + int x, + int y, + int width, + int height, + StretRegion *parent, + int level, + FusionSHMPoolShared *pool, + StretRegion **ret_region ) +{ + int i; + StretRegion *region; + + D_DEBUG_AT( UniQuE_StReT, "stret_region_create( class %d, flags 0x%08x, %d,%d - %dx%d (%d), " + "parent %p [%d/%d] )\n", class_id, flags, x, y, width, height, levels, parent, + level, parent ? parent->levels-1 : 0 ); + + D_ASSERT( class_id >= 0 ); + D_ASSERT( class_id < MAX_CLASSES ); + D_ASSERT( classes[class_id] != NULL ); + + D_ASSERT( ! (flags & ~SRF_ALL) ); + + D_ASSERT( levels > 0 ); + D_ASSERT( width > 0 ); + D_ASSERT( height > 0 ); + + D_MAGIC_ASSERT_IF( parent, StretRegion ); + + if (parent) + D_ASSERT( level < parent->levels ); + + D_ASSERT( ret_region != NULL ); + + /* Allocate region data. */ + region = SHCALLOC( pool, 1, sizeof(StretRegion) + sizeof(FusionVector) * levels ); + if (!region) { + D_WARN( "out of (shared) memory" ); + return D_OOSHM(); + } + + /* Initialize region data. */ + region->parent = parent; + region->level = level; + region->levels = levels; + region->children = (FusionVector*)(region + 1); + region->flags = flags; + region->bounds = (DFBRegion) { x, y, x + width - 1, y + height - 1 }; + region->clazz = class_id; + region->data = data; + region->arg = arg; + region->shmpool = pool; + + /* Initialize levels. */ + for (i=0; ichildren[i], 4, pool ); + + + /* Add the region to its parent. */ + if (parent) { + FusionVector *children = &parent->children[level]; + + region->index = fusion_vector_size( children ); + + if (fusion_vector_add( children, region )) { + D_WARN( "out of (shared) memory" ); + SHFREE( pool, region ); + return D_OOSHM(); + } + } + + + D_MAGIC_SET( region, StretRegion ); + +#if D_DEBUG_ENABLED +{ + DFBRegion bounds; + + stret_region_get_abs( region, &bounds ); + + D_DEBUG_AT( UniQuE_StReT, " -> Index %d, absolute bounds: %d,%d - %dx%d\n", + region->index, DFB_RECTANGLE_VALS_FROM_REGION( &bounds ) ); +} +#endif + + *ret_region = region; + + return DFB_OK; +} + +DFBResult +stret_region_destroy( StretRegion *region ) +{ + int i; + int index; + StretRegion *parent; + StretRegion *child; + + D_MAGIC_ASSERT( region, StretRegion ); + + D_DEBUG_AT( UniQuE_StReT, + "stret_region_destroy( %d, %d - %dx%d, level %d, index %d )\n", + DFB_RECTANGLE_VALS_FROM_REGION( ®ion->bounds ), region->level, region->index ); + + parent = region->parent; + if (parent) { + FusionVector *children = &parent->children[region->level]; + + D_MAGIC_ASSERT( parent, StretRegion ); + + index = region->index; + + D_ASSERT( index >= 0 ); + D_ASSERT( index == fusion_vector_index_of( children, region ) ); + + fusion_vector_remove( children, index ); + + for (; indexindex = index; + } + } + + for (i=0; ilevels; i++) { + FusionVector *children = ®ion->children[i]; + + D_ASSUME( ! fusion_vector_has_elements( children ) ); + + fusion_vector_foreach( child, index, *children ) { + D_MAGIC_ASSERT( child, StretRegion ); + D_ASSERT( child->parent == region ); + + child->parent = NULL; + } + + fusion_vector_destroy( children ); + } + + D_MAGIC_CLEAR( region ); + + SHFREE( region->shmpool, region ); + + return DFB_OK; +} + + +DFBResult +stret_region_enable( StretRegion *region, + StretRegionFlags flags ) +{ + D_MAGIC_ASSERT( region, StretRegion ); + + region->flags |= flags; + + return DFB_OK; +} + +DFBResult +stret_region_disable( StretRegion *region, + StretRegionFlags flags ) +{ + D_MAGIC_ASSERT( region, StretRegion ); + + region->flags &= ~flags; + + return DFB_OK; +} + + +DFBResult +stret_region_move( StretRegion *region, + int dx, + int dy ) +{ + D_MAGIC_ASSERT( region, StretRegion ); + + dfb_region_translate( ®ion->bounds, dx, dy ); + + return DFB_OK; +} + +DFBResult +stret_region_resize( StretRegion *region, + int width, + int height ) +{ + D_MAGIC_ASSERT( region, StretRegion ); + + dfb_region_resize( ®ion->bounds, width, height ); + + return DFB_OK; +} + +DFBResult +stret_region_restack( StretRegion *region, + int index ) +{ + StretRegion *parent; + + D_MAGIC_ASSERT( region, StretRegion ); + + D_ASSUME( region->parent != NULL ); + + parent = region->parent; + if (parent) { + int old; + FusionVector *children = &parent->children[region->level]; + + D_MAGIC_ASSERT( parent, StretRegion ); + + old = region->index; + + D_ASSERT( old >= 0 ); + D_ASSERT( old == fusion_vector_index_of( children, region ) ); + + fusion_vector_move( children, old, index ); + + for (index = MIN(index,old); indexindex = index; + } + } + + return DFB_OK; +} + +void +stret_region_get_abs( StretRegion *region, + DFBRegion *ret_bounds ) +{ + DFBRegion bounds; + + D_MAGIC_ASSERT( region, StretRegion ); + + D_ASSERT( ret_bounds != NULL ); + + bounds = region->bounds; + + while (region->parent) { + StretRegion *parent = region->parent; + + D_MAGIC_ASSERT( parent, StretRegion ); + + dfb_region_translate( &bounds, parent->bounds.x1, parent->bounds.y1 ); + + region = parent; + } + + *ret_bounds = bounds; +} + +void +stret_region_get_size( StretRegion *region, + DFBDimension *ret_size ) +{ + D_MAGIC_ASSERT( region, StretRegion ); + + D_ASSERT( ret_size != NULL ); + + ret_size->w = region->bounds.x2 - region->bounds.x1 + 1; + ret_size->h = region->bounds.y2 - region->bounds.y1 + 1; +} + +DFBResult +stret_region_get_input( StretRegion *region, + int index, + int x, + int y, + UniqueInputChannel **ret_channel ) +{ + const StretRegionClass *clazz; + + D_MAGIC_ASSERT( region, StretRegion ); + + D_ASSERT( ret_channel != NULL ); + + D_ASSERT( region->clazz >= 0 ); + D_ASSERT( region->clazz < MAX_CLASSES ); + + clazz = classes[region->clazz]; + + D_ASSERT( clazz != NULL ); + + if (clazz->GetInput) + return clazz->GetInput( region, region->data, region->arg, index, x, y, ret_channel ); + + return DFB_UNSUPPORTED; +} + + +typedef struct { + int num; + int max; + DFBRegion *regions; + StretRegion *region; +} ClipOutContext; + +static void +clip_out( StretIteration *iteration, + ClipOutContext *context, + int x1, + int y1, + int x2, + int y2 ) +{ + StretRegion *region; + DFBRegion cutout; + DFBRegion area = { x1, y1, x2, y2 }; + + D_DEBUG_AT( UniQuE_StReT, " clip_out( %4d, %4d - %4dx%4d )\n", + DFB_RECTANGLE_VALS_FROM_REGION( &area ) ); + + D_ASSERT( x1 <= x2 ); + D_ASSERT( y1 <= y2 ); + + while (true) { + region = stret_iteration_next( iteration, &area ); + if (!region || region == context->region) { + context->num++; + + if (context->num <= context->max) { + DFBRegion *region = &context->regions[ context->num - 1 ]; + + D_DEBUG_AT( UniQuE_StReT, " (%2d) %4d, %4d - %4dx%4d\n", + context->num - 1, x1, y1, x2 - x1 + 1, y2 - y1 + 1 ); + + region->x1 = x1; + region->y1 = y1; + region->x2 = x2; + region->y2 = y2; + } + else + D_DEBUG_AT( UniQuE_StReT, " Maximum number of regions exceeded, dropping...\n" ); + + if (region) + stret_iteration_abort( iteration ); + + return; + } + + D_MAGIC_ASSERT( region, StretRegion ); + + if (D_FLAGS_ARE_SET( region->flags, SRF_OUTPUT | SRF_OPAQUE )) + break; + } + + cutout = DFB_REGION_INIT_TRANSLATED( ®ion->bounds, iteration->x0, iteration->y0 ); + + dfb_region_clip( &cutout, x1, y1, x2, y2 ); + + /* upper */ + if (cutout.y1 != y1) { + StretIteration fork = *iteration; + + clip_out( &fork, context, x1, y1, x2, cutout.y1 - 1 ); + } + + /* left */ + if (cutout.x1 != x1) { + StretIteration fork = *iteration; + + clip_out( &fork, context, x1, cutout.y1, cutout.x1 - 1, cutout.y2 ); + } + + /* right */ + if (cutout.x2 != x2) { + StretIteration fork = *iteration; + + clip_out( &fork, context, cutout.x2 + 1, cutout.y1, x2, cutout.y2 ); + } + + /* lower */ + if (cutout.y2 != y2) { + StretIteration fork = *iteration; + + clip_out( &fork, context, x1, cutout.y2 + 1, x2, y2 ); + } + + stret_iteration_abort( iteration ); +} + +DFBResult +stret_region_visible( StretRegion *region, + const DFBRegion *base, + bool children, + DFBRegion *ret_regions, + int max_num, + int *ret_num ) +{ + bool visible = true; + DFBRegion area; + ClipOutContext context; + StretIteration iteration; + StretRegion *root; + + int x0, y0; + + D_MAGIC_ASSERT( region, StretRegion ); + + DFB_REGION_ASSERT_IF( base ); + + D_ASSERT( ret_regions != NULL ); + D_ASSERT( max_num > 0 ); + D_ASSERT( ret_num != NULL ); + + if (base) { + D_DEBUG_AT( UniQuE_StReT, + "stret_region_visible( %d, %d - %dx%d of %d, %d - %dx%d )\n", + DFB_RECTANGLE_VALS_FROM_REGION( base ), + DFB_RECTANGLE_VALS_FROM_REGION( ®ion->bounds ) ); + + area = *base; + } + else { + D_DEBUG_AT( UniQuE_StReT, + "stret_region_visible( %d, %d - %dx%d )\n", + DFB_RECTANGLE_VALS_FROM_REGION( ®ion->bounds ) ); + + area.x1 = 0; + area.y1 = 0; + area.x2 = region->bounds.x2 - region->bounds.x1; + area.y2 = region->bounds.y2 - region->bounds.y1; + } + + + if (! D_FLAGS_IS_SET( region->flags, SRF_ACTIVE )) { + D_DEBUG_AT( UniQuE_StReT, " -> Region is not active and therefore invisible!\n" ); + + *ret_num = 0; + + return DFB_OK; + } + + + context.num = 0; + context.max = max_num; + context.regions = ret_regions; + context.region = region; + + x0 = region->bounds.x1; + y0 = region->bounds.y1; + + root = region; + + if (region->parent) { + int rx2; + int ry2; + StretRegion *parent = region->parent; + + do { + D_MAGIC_ASSERT( parent, StretRegion ); + + if (! D_FLAGS_IS_SET( parent->flags, SRF_ACTIVE )) { + D_DEBUG_AT( UniQuE_StReT, " -> At least one parent is not active!\n" ); + + *ret_num = 0; + + return DFB_OK; + } + + x0 += parent->bounds.x1; + y0 += parent->bounds.y1; + + rx2 = parent->bounds.x2; + ry2 = parent->bounds.y2; + + root = parent; + + visible = dfb_region_intersect( &area, - x0, - y0, rx2 - x0, ry2 - y0 ); + + parent = parent->parent; + } while (visible && parent); + } + else if (base) + visible = dfb_region_intersect( &area, 0, 0, region->bounds.x2, region->bounds.y2 ); + + + if (!visible) { + D_DEBUG_AT( UniQuE_StReT, " -> Region is fully clipped by ancestors!\n" ); + + *ret_num = 0; + + return DFB_OK; + } + + + stret_iteration_init( &iteration, root, children ? region : NULL ); + + clip_out( &iteration, &context, x0 + area.x1, y0 + area.y1, x0 + area.x2, y0 + area.y2 ); + + + *ret_num = context.num; + + if (context.num > context.max) { + D_DEBUG_AT( UniQuE_StReT, " -> Failed with %d/%d regions!\n", + context.num, context.max ); + + return DFB_LIMITEXCEEDED; + } + + D_DEBUG_AT( UniQuE_StReT, " -> Succeeded with %d/%d regions.\n", context.num, context.max ); + + return DFB_OK; +} + + +typedef struct { + StretIteration iteration; + void *update_data; +} UpdateContext; + +static void +region_update( UpdateContext *context, + int x1, + int y1, + int x2, + int y2 ) +{ + int x0, y0; + DFBRegion area = { x1, y1, x2, y2 }; + StretRegion *region; + + D_DEBUG_AT( UniQuE_StReT, " region_update( %4d, %4d - %4dx%4d )\n", + x1, y1, x2 - x1 + 1, y2 - y1 + 1 ); + + D_ASSERT( x1 <= x2 ); + D_ASSERT( y1 <= y2 ); + + while (true) { + region = stret_iteration_next( &context->iteration, &area ); + if (!region) + return; + + D_MAGIC_ASSERT( region, StretRegion ); + + if (D_FLAGS_IS_SET( region->flags, SRF_OUTPUT )) + break; + } + + x0 = context->iteration.x0; + y0 = context->iteration.y0; + + D_DEBUG_AT( UniQuE_StReT, " -> %4d, %4d - %4dx%4d @ %4d, %4d (class %d, index %d)\n", + DFB_RECTANGLE_VALS_FROM_REGION( ®ion->bounds ), + x0, y0, region->clazz, region->index ); + + dfb_region_clip( &area, DFB_REGION_VALS_TRANSLATED( ®ion->bounds, x0, y0 ) ); + + + + if (D_FLAGS_IS_SET( region->flags, SRF_OPAQUE )) { + /* upper */ + if (area.y1 != y1) { + UpdateContext fork = *context; + + region_update( &fork, x1, y1, x2, area.y1 - 1 ); + } + + /* left */ + if (area.x1 != x1) { + UpdateContext fork = *context; + + region_update( &fork, x1, area.y1, area.x1 - 1, area.y2 ); + } + + /* right */ + if (area.x2 != x2) { + UpdateContext fork = *context; + + region_update( &fork, area.x2 + 1, area.y1, x2, area.y2 ); + } + + /* lower */ + if (area.y2 != y2) { + UpdateContext fork = *context; + + region_update( &fork, x1, area.y2 + 1, x2, y2 ); + } + + stret_iteration_abort( &context->iteration ); + } + else + region_update( context, x1, y1, x2, y2 ); + + + x0 += region->bounds.x1; + y0 += region->bounds.y1; + + dfb_region_translate( &area, - x0, - y0 ); + + D_DEBUG_AT( UniQuE_StReT, " => %4d, %4d - %4dx%4d @ %4d, %4d (class %d, index %d)\n", + DFB_RECTANGLE_VALS_FROM_REGION( &area ), + x0, y0, region->clazz, region->index ); + + D_ASSERT( classes[region->clazz]->Update ); + + classes[region->clazz]->Update( region, region->data, context->update_data, + region->arg, x0, y0, &area, 1 ); +} + +DFBResult +stret_region_update( StretRegion *region, + const DFBRegion *clip, + void *update_data ) +{ + DFBRegion area; + UpdateContext context; + + D_MAGIC_ASSERT( region, StretRegion ); + + DFB_REGION_ASSERT_IF( clip ); + + if (clip) + D_DEBUG_AT( UniQuE_StReT, + "stret_region_update( %d, %d - %dx%d of %d, %d - %dx%d )\n", + DFB_RECTANGLE_VALS_FROM_REGION( clip ), + DFB_RECTANGLE_VALS_FROM_REGION( ®ion->bounds ) ); + else + D_DEBUG_AT( UniQuE_StReT, + "stret_region_update( %d, %d - %dx%d )\n", + DFB_RECTANGLE_VALS_FROM_REGION( ®ion->bounds ) ); + + if (! D_FLAGS_IS_SET( region->flags, SRF_ACTIVE )) { + D_DEBUG_AT( UniQuE_StReT, " -> Region is not active and therefore invisible.\n" ); + return DFB_OK; + } + + area.x1 = 0; + area.y1 = 0; + area.x2 = region->bounds.x2 - region->bounds.x1; + area.y2 = region->bounds.y2 - region->bounds.y1; + + if (clip && !dfb_region_region_intersect( &area, clip )) { + D_DEBUG_AT( UniQuE_StReT, " -> Region doesn't intersect with clip.\n" ); + return DFB_OK; + } + + + stret_iteration_init( &context.iteration, region, NULL ); + + context.update_data = update_data; + + region_update( &context, area.x1, area.y1, area.x2, area.y2 ); + + return DFB_OK; +} + +StretRegion * +stret_region_at( StretRegion *region, + int x, + int y, + StretRegionFlags flags, + StretRegionClassID class_id ) +{ + StretIteration iteration; + DFBRegion area = { x, y, x, y }; + + D_MAGIC_ASSERT( region, StretRegion ); + + D_DEBUG_AT( UniQuE_StReT, "stret_region_at( %p, %d, %d, 0x%08x )\n", region, x, y, flags ); + + if (! D_FLAGS_IS_SET( region->flags, SRF_ACTIVE )) { + D_DEBUG_AT( UniQuE_StReT, " -> Region is not active.\n" ); + return NULL; + } + + + stret_iteration_init( &iteration, region, NULL ); + + while ((region = stret_iteration_next( &iteration, &area )) != NULL) { + if (! D_FLAGS_ARE_SET( region->flags, flags )) + continue; + + if (class_id != SRCID_UNKNOWN && region->clazz != class_id) + continue; + + return region; + } + + return NULL; +} + +void * +stret_region_data( const StretRegion *region ) +{ + D_MAGIC_ASSERT( region, StretRegion ); + + return region->data; +} + diff --git a/Source/DirectFB/wm/unique/stret.h b/Source/DirectFB/wm/unique/stret.h new file mode 100755 index 0000000..01bcc97 --- /dev/null +++ b/Source/DirectFB/wm/unique/stret.h @@ -0,0 +1,155 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 __UNIQUE__STRET_H__ +#define __UNIQUE__STRET_H__ + +#include + +#include + +/* + * A 'StReT' is a Stack Region Tree. + */ + + +typedef enum { + SRF_NONE = 0x00000000, + + SRF_INPUT = 0x00000001, + SRF_OUTPUT = 0x00000002, + SRF_ACTIVE = 0x00000004, + + SRF_OPAQUE = 0x00000010, + SRF_SHAPED = 0x00000020, + + SRF_ALL = 0x00000037 +} StretRegionFlags; + + +typedef struct { + DFBResult (*GetInput)( StretRegion *region, + void *region_data, + unsigned long arg, + int index, + int x, + int y, + UniqueInputChannel **ret_channel ); + + void (*Update) ( StretRegion *region, + void *region_data, + void *update_data, + unsigned long arg, + int x, + int y, + const DFBRegion *updates, + int num ); +} StretRegionClass; + +typedef int StretRegionClassID; + +#define SRCID_UNKNOWN -1 +#define SRCID_DEFAULT 0 + + +DFBResult stret_class_register ( const StretRegionClass *clazz, + StretRegionClassID *ret_id ); + +DFBResult stret_class_unregister( StretRegionClassID id ); + + + +DFBResult stret_region_create ( StretRegionClassID class_id, + void *data, + unsigned long arg, + StretRegionFlags flags, + int levels, + int x, + int y, + int width, + int height, + StretRegion *parent, + int level, + FusionSHMPoolShared *pool, + StretRegion **ret_region ); + +DFBResult stret_region_destroy ( StretRegion *region ); + + +DFBResult stret_region_enable ( StretRegion *region, + StretRegionFlags flags ); + +DFBResult stret_region_disable ( StretRegion *region, + StretRegionFlags flags ); + + +DFBResult stret_region_move ( StretRegion *region, + int dx, + int dy ); + +DFBResult stret_region_resize ( StretRegion *region, + int width, + int height ); + +DFBResult stret_region_restack ( StretRegion *region, + int index ); + + +void stret_region_get_abs ( StretRegion *region, + DFBRegion *ret_bounds ); + +void stret_region_get_size ( StretRegion *region, + DFBDimension *ret_size ); + +DFBResult stret_region_get_input( StretRegion *region, + int index, + int x, + int y, + UniqueInputChannel **ret_channel ); + +DFBResult stret_region_visible ( StretRegion *region, + const DFBRegion *base, + bool children, + DFBRegion *ret_regions, + int max_num, + int *ret_num ); + +DFBResult stret_region_update ( StretRegion *region, + const DFBRegion *update, + void *update_data ); + +StretRegion *stret_region_at ( StretRegion *region, + int x, + int y, + StretRegionFlags flags, + StretRegionClassID class_id ); + +void *stret_region_data ( const StretRegion *region ); + +#endif + diff --git a/Source/DirectFB/wm/unique/stret_iteration.c b/Source/DirectFB/wm/unique/stret_iteration.c new file mode 100755 index 0000000..30c84e6 --- /dev/null +++ b/Source/DirectFB/wm/unique/stret_iteration.c @@ -0,0 +1,209 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 + +#include +#include + +#include + +#include +#include + +D_DEBUG_DOMAIN( UniQuE_StReT, "UniQuE/StReT", "UniQuE's Stack Region Tree" ); + +static inline bool +accept_region( StretRegion *region, int x0, int y0, const DFBRegion *clip ) +{ + if (!D_FLAGS_IS_SET( region->flags, SRF_ACTIVE )) + return false; + + if (!clip) + return true; + + return dfb_region_intersects( clip, DFB_REGION_VALS_TRANSLATED( ®ion->bounds, x0, y0 ) ); +} + +static inline bool +check_depth( int frame ) +{ + if (frame >= STRET_ITERATION_MAX_DEPTH) { + D_WARN( "refusing to exceed depth limit of %d", STRET_ITERATION_MAX_DEPTH ); + return false; + } + + return true; +} + +void +stret_iteration_init( StretIteration *iteration, StretRegion *region, StretRegion *abort_at ) +{ + D_ASSERT( iteration != NULL ); + + D_MAGIC_ASSERT( region, StretRegion ); + D_MAGIC_ASSERT_IF( abort_at, StretRegion ); + + D_DEBUG_AT( UniQuE_StReT, "stret_iteration_init()\n" ); + + iteration->frame = -1; + iteration->x0 = 0; + iteration->y0 = 0; + iteration->abort = abort_at; + + do { + int last_level = region->levels - 1; + int last_child = fusion_vector_size( ®ion->children[last_level] ) - 1; + + iteration->frame++; + + iteration->x0 += region->bounds.x1; + iteration->y0 += region->bounds.y1; + + iteration->stack[iteration->frame].region = region; + iteration->stack[iteration->frame].level = last_level; + iteration->stack[iteration->frame].index = last_child - 1; + + D_DEBUG_AT( UniQuE_StReT, " -> (%d) %p, last level %d, last index %d\n", + iteration->frame, region, last_level, last_child ); + + if (last_child >= 0) { + region = fusion_vector_at( ®ion->children[last_level], last_child ); + + D_MAGIC_ASSERT( region, StretRegion ); + } + } while (fusion_vector_size( ®ion->children[region->levels - 1] ) && check_depth( iteration->frame + 1 )); + + iteration->stack[iteration->frame].index++; + + D_MAGIC_SET( iteration, StretIteration ); +} + +StretRegion * +stret_iteration_next( StretIteration *iteration, + const DFBRegion *clip ) +{ + int index; + int level; + StretRegion *region; + + D_MAGIC_ASSERT( iteration, StretIteration ); + + DFB_REGION_ASSERT_IF( clip ); + + if (clip) + D_DEBUG_AT( UniQuE_StReT, "stret_iteration_next( %d, %d - %dx%d )\n", + DFB_RECTANGLE_VALS_FROM_REGION( clip ) ); + else + D_DEBUG_AT( UniQuE_StReT, "stret_iteration_next()\n" ); + + while (iteration->frame >= 0) { + StretIterationStackFrame *frame = &iteration->stack[iteration->frame]; + + region = frame->region; + level = frame->level; + index = frame->index--; + + D_MAGIC_ASSERT( region, StretRegion ); + + D_DEBUG_AT( UniQuE_StReT, " -> (%d) %p, level [%d/%d], index %d\n", + iteration->frame, region, level, region->levels - 1, index ); + + if (iteration->abort && region == iteration->abort) { + D_MAGIC_CLEAR( iteration ); + return NULL; + } + + if (index < 0) { + level = --frame->level; + + if (level < 0) { + iteration->frame--; + + iteration->x0 -= region->bounds.x1; + iteration->y0 -= region->bounds.y1; + + if (accept_region( region, iteration->x0, iteration->y0, clip )) + return region; + } + else { + frame->index = fusion_vector_size( ®ion->children[level] ) - 1; + } + } + else { + region = fusion_vector_at( ®ion->children[level], index ); + + D_MAGIC_ASSERT( region, StretRegion ); + + if (iteration->abort && region == iteration->abort) { + D_MAGIC_CLEAR( iteration ); + return NULL; + } + + if (accept_region( region, iteration->x0, iteration->y0, clip )) { + level = region->levels - 1; + + while (fusion_vector_is_empty( ®ion->children[level] )) { + if (level) + level--; + else + return region; + } + + if (check_depth( iteration->frame + 1 )) { + frame = &iteration->stack[++iteration->frame]; + + iteration->x0 += region->bounds.x1; + iteration->y0 += region->bounds.y1; + + frame->region = region; + frame->level = level; + frame->index = fusion_vector_size( ®ion->children[level] ) - 1; + + continue; + } + + return region; + } + } + } + + D_ASSUME( iteration->x0 == 0 ); + D_ASSUME( iteration->y0 == 0 ); + + D_MAGIC_CLEAR( iteration ); + + return NULL; +} + +void +stret_iteration_abort( StretIteration *iteration ) +{ + D_MAGIC_CLEAR( iteration ); +} + diff --git a/Source/DirectFB/wm/unique/stret_iteration.h b/Source/DirectFB/wm/unique/stret_iteration.h new file mode 100755 index 0000000..251280a --- /dev/null +++ b/Source/DirectFB/wm/unique/stret_iteration.h @@ -0,0 +1,68 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 __UNIQUE__STRET_ITERATION_H__ +#define __UNIQUE__STRET_ITERATION_H__ + +#include + +#include + + +#define STRET_ITERATION_MAX_DEPTH 4 + +typedef struct { + StretRegion *region; + int level; + int index; +} StretIterationStackFrame; + +typedef struct { + int magic; + + StretIterationStackFrame stack[STRET_ITERATION_MAX_DEPTH]; + int frame; + + int x0; + int y0; + + StretRegion *abort; +} StretIteration; + + +void stret_iteration_init ( StretIteration *iteration, + StretRegion *region, + StretRegion *abort_at ); + +StretRegion *stret_iteration_next ( StretIteration *iteration, + const DFBRegion *clip ); + +void stret_iteration_abort( StretIteration *iteration ); + +#endif + diff --git a/Source/DirectFB/wm/unique/stret_test.c b/Source/DirectFB/wm/unique/stret_test.c new file mode 100755 index 0000000..62839d0 --- /dev/null +++ b/Source/DirectFB/wm/unique/stret_test.c @@ -0,0 +1,153 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This file is subject to the terms and conditions of the MIT License: + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include + + +int +main( int argc, char *argv[] ) +{ + DirectResult ret; + FusionWorld *world; + StretRegion *root; + StretRegion *child[16]; + int child_num = 0; + StretIteration iteration; + DFBRegion clip; + FusionSHMPoolShared *pool; + + ret = fusion_enter( -1, 0, FER_ANY, &world ); + if (ret) + return -1; + + ret = fusion_shm_pool_create( world, "StReT Test Pool", 0x10000, direct_config->debug, &pool ); + if (ret) { + fusion_exit( world, false ); + return -1; + } + + D_INFO( "StReT/Test: Starting...\n" ); + + + ret = stret_region_create( 0, NULL, 0, SRF_ACTIVE, 2, 0, 0, 1000, 1000, NULL, 0, pool, &root ); + if (ret) { + D_DERROR( ret, "StReT/Test: Could not create root region!\n" ); + goto error_root; + } + else { + ret = stret_region_create( 0, NULL, 0, SRF_ACTIVE, 1, 10, 10, 100, 100, root, 1, pool, &child[child_num++] ); + if (ret) { + D_DERROR( ret, "StReT/Test: Could not create child region!\n" ); + goto error_child; + } + else { + ret = stret_region_create( 0, NULL, 0, SRF_ACTIVE, 1, 50, 50, 30, 30, child[0], 0, pool, &child[child_num++] ); + if (ret) { + D_DERROR( ret, "StReT/Test: Could not create child region!\n" ); + goto error_child; + } + + ret = stret_region_create( 0, NULL, 0, SRF_ACTIVE, 1, 20, 20, 30, 30, child[0], 0, pool, &child[child_num++] ); + if (ret) { + D_DERROR( ret, "StReT/Test: Could not create child region!\n" ); + goto error_child; + } + else { + ret = stret_region_create( 0, NULL, 0, SRF_ACTIVE, 1, 10, 10, 10, 10, child[2], 0, pool, &child[child_num++] ); + if (ret) { + D_DERROR( ret, "StReT/Test: Could not create child region!\n" ); + goto error_child; + } + + ret = stret_region_create( 0, NULL, 0, SRF_ACTIVE, 1, 20, 20, 10, 10, child[2], 0, pool, &child[child_num++] ); + if (ret) { + D_DERROR( ret, "StReT/Test: Could not create child region!\n" ); + goto error_child; + } + } + } + + ret = stret_region_create( 0, NULL, 0, SRF_ACTIVE, 1, 200, 10, 200, 200, root, 0, pool, &child[child_num++] ); + if (ret) { + D_DERROR( ret, "StReT/Test: Could not create child region!\n" ); + goto error_child; + } + } + + + + + stret_iteration_init( &iteration, root, NULL ); + + clip = (DFBRegion) { 50, 50, 200, 59 }; + + D_ASSERT( stret_iteration_next( &iteration, &clip ) == child[4] ); + //D_ASSERT( stret_iteration_next( &iteration, &clip ) == child[3] ); + D_ASSERT( stret_iteration_next( &iteration, &clip ) == child[2] ); + //D_ASSERT( stret_iteration_next( &iteration, &clip ) == child[1] ); + D_ASSERT( stret_iteration_next( &iteration, &clip ) == child[0] ); + D_ASSERT( stret_iteration_next( &iteration, &clip ) == child[5] ); + D_ASSERT( stret_iteration_next( &iteration, &clip ) == root ); + D_ASSERT( stret_iteration_next( &iteration, &clip ) == NULL ); + + + stret_region_destroy( child[child_num-1] ); + +error_child: + while (--child_num) + stret_region_destroy( child[child_num-1] ); + + stret_region_destroy( root ); + +error_root: + fusion_shm_pool_destroy( world, pool ); + + fusion_exit( world, false ); + + return 0; +} + diff --git a/Source/DirectFB/wm/unique/test_color.c b/Source/DirectFB/wm/unique/test_color.c new file mode 100755 index 0000000..66bedba --- /dev/null +++ b/Source/DirectFB/wm/unique/test_color.c @@ -0,0 +1,221 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This file is subject to the terms and conditions of the MIT License: + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include +#include + +#include + +#include +#include + +/*****************************************************************************/ + +static IDirectFB *dfb = NULL; + +static const char *filename = NULL; +static DFBBoolean color = DFB_FALSE; + + +/*****************************************************************************/ + +static DFBBoolean parse_command_line ( int argc, char *argv[] ); +static void set_color ( void ); + +/*****************************************************************************/ + +static UniqueContext *context; + +static bool +context_callback( FusionObjectPool *pool, + FusionObject *object, + void *ctx ) +{ + if (object->state != FOS_ACTIVE) + return true; + + context = (UniqueContext*) object; + if (unique_context_ref( context )) { + D_ERROR( "UniQuE/Test: unique_context_ref() failed!\n" ); + return true; + } + + return false; +} + +int +main( int argc, char *argv[] ) +{ + DFBResult ret; + + /* Initialize DirectFB including command line parsing. */ + ret = DirectFBInit( &argc, &argv ); + if (ret) { + DirectFBError( "DirectFBInit() failed", ret ); + return -1; + } + + /* Parse the command line. */ + if (!parse_command_line( argc, argv )) + return -2; + + /* Create the super interface. */ + ret = DirectFBCreate( &dfb ); + if (ret) { + DirectFBError( "DirectFBCreate() failed", ret ); + return -3; + } + + if (!unique_wm_running()) { + D_ERROR( "UniQuE/Test: This session doesn't run UniQuE!\n" ); + dfb->Release( dfb ); + return EXIT_FAILURE; + } + + unique_wm_enum_contexts( context_callback, NULL ); + + if (!context) { + D_ERROR( "UniQuE/Test: No context available!\n" ); + dfb->Release( dfb ); + return EXIT_FAILURE; + } + + /* Set the background according to the users wishes. */ + if (color) + set_color(); + + unique_context_unref( context ); + + /* Release the super interface. */ + dfb->Release( dfb ); + + return EXIT_SUCCESS; +} + +/*****************************************************************************/ + +static void +print_usage( const char *prg_name ) +{ + fprintf( stderr, + "\n" + "UniQuE Test Application (version %s)\n" + "\n" + "Usage: %s [options] \n" + "\n" + "Options:\n" + " -c, --color Set in AARRGGBB format (hexadecimal)\n" + " -h, --help Show this help message\n" + " -v, --version Print version information\n" + "\n", + DIRECTFB_VERSION, prg_name ); +} + +static DFBBoolean +parse_command_line( int argc, char *argv[] ) +{ + int n; + const char *prg_name = strrchr( argv[0], '/' ); + + if (prg_name) + prg_name++; + else + prg_name = argv[0]; + + for (n = 1; n < argc; n++) { + const char *a = argv[n]; + + if (*a != '-') { + if (!filename) { + filename = a; + continue; + } + else { + print_usage( prg_name ); + return DFB_FALSE; + } + } + if (strcmp (a, "-h") == 0 || strcmp (a, "--help") == 0) { + print_usage( prg_name ); + return DFB_FALSE; + } + if (strcmp (a, "-v") == 0 || strcmp (a, "--version") == 0) { + fprintf (stderr, "dfbg version %s\n", DIRECTFB_VERSION); + return DFB_FALSE; + } + if (strcmp (a, "-c") == 0 || strcmp (a, "--color") == 0) { + color = DFB_TRUE; + continue; + } + } + + if (!filename) { + print_usage( prg_name ); + return DFB_FALSE; + } + + return DFB_TRUE; +} + +static void +set_color( void ) +{ + DFBResult ret; + char *error; + u32 argb; + DFBColor color; + + if (*filename == '#') + filename++; + + argb = strtoul( filename, &error, 16 ); + + if (*error) { + fprintf( stderr, "Invalid characters in color string: '%s'\n", error ); + return; + } + + color.a = (argb & 0xFF000000) >> 24; + color.r = (argb & 0xFF0000) >> 16; + color.g = (argb & 0xFF00) >> 8; + color.b = (argb & 0xFF); + + ret = unique_context_set_color( context, &color ); + if (ret) + D_DERROR( ret, "UniQuE/Test: unique_context_set_color() failed!\n" ); +} + diff --git a/Source/DirectFB/wm/unique/test_foo.c b/Source/DirectFB/wm/unique/test_foo.c new file mode 100755 index 0000000..02bfc56 --- /dev/null +++ b/Source/DirectFB/wm/unique/test_foo.c @@ -0,0 +1,288 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This file is subject to the terms and conditions of the MIT License: + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include +#include +#include + +#include + +#include + +#include +#include + +#include +#include +#include +#include + +D_DEBUG_DOMAIN( UniQuE_TestFoo, "UniQuE/TestFoo", "UniQuE's Test Foo Application" ); + +/*****************************************************************************/ + +static IDirectFB *dfb = NULL; + +/*****************************************************************************/ + +static DFBBoolean parse_command_line( int argc, char *argv[] ); + +/*****************************************************************************/ + +static UniqueContext *context; + +static bool +context_callback( FusionObjectPool *pool, + FusionObject *object, + void *ctx ) +{ + if (object->state != FOS_ACTIVE) + return true; + + context = (UniqueContext*) object; + if (unique_context_ref( context )) { + D_ERROR( "UniQuE/Test: unique_context_ref() failed!\n" ); + return true; + } + + return false; +} + +static void +dispatch_motion( UniqueWindow *window, + const UniqueInputPointerEvent *event ) +{ + D_MAGIC_ASSERT( window, UniqueWindow ); + D_ASSERT( event != NULL ); + + if (event->buttons) { + CoreWindowConfig config; + + unique_window_get_config( window, &config ); + + config.bounds.x -= window->foo_motion.x - event->x; + config.bounds.y -= window->foo_motion.y - event->y; + + unique_window_set_config( window, &config, CWCF_POSITION ); + } + + window->foo_motion.x = event->x; + window->foo_motion.y = event->y; +} + +static void +dispatch_button( UniqueWindow *window, + const UniqueInputPointerEvent *event ) +{ + D_MAGIC_ASSERT( window, UniqueWindow ); + D_ASSERT( event != NULL ); + + if (event->press) + unique_window_restack( window, NULL, 1 ); +} + +static ReactionResult +foo_channel_listener( const void *msg_data, + void *ctx ) +{ + const UniqueInputEvent *event = msg_data; + UniqueContext *context = ctx; + CoreLayerRegion *region; + StretRegion *stret; + WMShared *shared; + static UniqueWindow *window; + + (void) context; + + D_ASSERT( event != NULL ); + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_DEBUG_AT( UniQuE_TestFoo, "foo_channel_listener( %p, %p )\n", event, context ); + + region = context->region; + D_ASSERT( region != NULL ); + D_ASSERT( region->context != NULL ); + + shared = context->shared; + D_MAGIC_ASSERT( shared, WMShared ); + + dfb_layer_context_lock( region->context ); + + switch (event->type) { + case UIET_MOTION: + case UIET_BUTTON: + /* FIXME: This is a workaround because of the global input channel used for all windows. */ + stret = stret_region_at( context->root, event->pointer.x, event->pointer.y, + SRF_INPUT, shared->region_classes[URCI_FOO] ); + if (stret) + window = stret->data; + else if (event->type == UIET_BUTTON && !event->pointer.buttons) + window = NULL; + + if (window) { + D_MAGIC_ASSERT( window, UniqueWindow ); + + if (event->type == UIET_MOTION) + dispatch_motion( window, &event->pointer ); + else + dispatch_button( window, &event->pointer ); + } + break; + + case UIET_WHEEL: + break; + + case UIET_KEY: + break; + + case UIET_CHANNEL: + break; + + default: + D_ONCE( "unknown event type" ); + break; + } + + dfb_layer_context_unlock( region->context ); + + return RS_OK; +} + + +int +main( int argc, char *argv[] ) +{ + DFBResult ret; + Reaction reaction; + + /* Initialize DirectFB including command line parsing. */ + ret = DirectFBInit( &argc, &argv ); + if (ret) { + DirectFBError( "DirectFBInit() failed", ret ); + return -1; + } + + /* Parse the command line. */ + if (!parse_command_line( argc, argv )) + return -2; + + /* Create the super interface. */ + ret = DirectFBCreate( &dfb ); + if (ret) { + DirectFBError( "DirectFBCreate() failed", ret ); + return -3; + } + + if (!unique_wm_running()) { + D_ERROR( "UniQuE/Test: This session doesn't run UniQuE!\n" ); + dfb->Release( dfb ); + return EXIT_FAILURE; + } + + unique_wm_enum_contexts( context_callback, NULL ); + + if (!context) { + D_ERROR( "UniQuE/Test: No context available!\n" ); + dfb->Release( dfb ); + return EXIT_FAILURE; + } + + + unique_input_channel_attach( context->foo_channel, foo_channel_listener, context, &reaction ); + + pause(); + + unique_input_channel_detach( context->foo_channel, &reaction ); + + unique_context_unref( context ); + + /* Release the super interface. */ + dfb->Release( dfb ); + + return EXIT_SUCCESS; +} + +/*****************************************************************************/ + +static void +print_usage( const char *prg_name ) +{ + fprintf( stderr, + "\n" + "UniQuE Foo Test (version %s)\n" + "\n" + "Usage: %s [options]\n" + "\n" + "Options:\n" + " -h, --help Show this help message\n" + " -v, --version Print version information\n" + "\n", + DIRECTFB_VERSION, prg_name ); +} + +static DFBBoolean +parse_command_line( int argc, char *argv[] ) +{ + int n; + const char *prg_name = strrchr( argv[0], '/' ); + + if (prg_name) + prg_name++; + else + prg_name = argv[0]; + + for (n = 1; n < argc; n++) { + const char *a = argv[n]; + + if (*a != '-') { + print_usage( prg_name ); + return DFB_FALSE; + } + if (strcmp (a, "-h") == 0 || strcmp (a, "--help") == 0) { + print_usage( prg_name ); + return DFB_FALSE; + } + if (strcmp (a, "-v") == 0 || strcmp (a, "--version") == 0) { + fprintf (stderr, "dfbg version %s\n", DIRECTFB_VERSION); + return DFB_FALSE; + } + } + + return DFB_TRUE; +} + diff --git a/Source/DirectFB/wm/unique/types.h b/Source/DirectFB/wm/unique/types.h new file mode 100755 index 0000000..221ae6b --- /dev/null +++ b/Source/DirectFB/wm/unique/types.h @@ -0,0 +1,53 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 __UNIQUE__TYPES_H__ +#define __UNIQUE__TYPES_H__ + + +typedef struct __UniQuE_UniqueContext UniqueContext; +typedef struct __UniQuE_UniqueDecoration UniqueDecoration; +typedef struct __UniQuE_UniqueDecorationItem UniqueDecorationItem; +typedef struct __UniQuE_UniqueDevice UniqueDevice; +typedef struct __UniQuE_UniqueLayout UniqueLayout; +typedef struct __UniQuE_UniqueWindow UniqueWindow; + +typedef struct __UniQuE_UniqueInputChannel UniqueInputChannel; +typedef union __UniQuE_UniqueInputEvent UniqueInputEvent; +typedef struct __UniQuE_UniqueInputFilter UniqueInputFilter; +typedef struct __UniQuE_UniqueInputSwitch UniqueInputSwitch; + + +typedef struct __UniQuE_StretRegion StretRegion; + + +typedef struct __UniQuE_WMData WMData; +typedef struct __UniQuE_WMShared WMShared; + +#endif + diff --git a/Source/DirectFB/wm/unique/unique.c b/Source/DirectFB/wm/unique/unique.c new file mode 100755 index 0000000..bb0c5ec --- /dev/null +++ b/Source/DirectFB/wm/unique/unique.c @@ -0,0 +1,1064 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include + +#include +#include +#include + + +D_DEBUG_DOMAIN( WM_Unique, "WM/UniQuE", "UniQuE - Universal Quark Emitter" ); + + +DFB_WINDOW_MANAGER( unique ); + +/**************************************************************************************************/ + +typedef struct { + int magic; + + CoreWindowStack *stack; + + UniqueContext *context; + + GlobalReaction context_reaction; +} StackData; + +typedef struct { + int magic; + + UniqueContext *context; + + UniqueWindow *window; + + GlobalReaction window_reaction; +} WindowData; + +/**************************************************************************************************/ + +static ReactionResult +context_notify( WMData *data, + const UniqueContextNotification *notification, + void *ctx ) +{ + StackData *stack_data = ctx; + + D_ASSERT( data != NULL ); + + D_ASSERT( notification != NULL ); + D_ASSERT( notification->context != NULL ); + + D_MAGIC_ASSERT( stack_data, StackData ); + + D_ASSERT( notification->context == stack_data->context ); + + D_MAGIC_ASSERT( stack_data->context, UniqueContext ); + + D_ASSERT( ! D_FLAGS_IS_SET( notification->flags, ~UCNF_ALL ) ); + + D_DEBUG_AT( WM_Unique, "context_notify( wm_data %p, stack_data %p )\n", data, stack_data ); + + if (notification->flags & UCNF_DESTROYED) { + D_DEBUG_AT( WM_Unique, " -> context destroyed.\n" ); + + if (notification->context == stack_data->context) + stack_data->context = NULL; + + return RS_REMOVE; + } + + return RS_OK; +} + +static ReactionResult +window_notify( WMData *data, + const UniqueWindowNotification *notification, + void *ctx ) +{ + WindowData *window_data = ctx; + + D_ASSERT( data != NULL ); + + D_ASSERT( notification != NULL ); + D_ASSERT( notification->window != NULL ); + + D_MAGIC_ASSERT( window_data, WindowData ); + + D_ASSERT( notification->window == window_data->window ); + + D_MAGIC_ASSERT( window_data->window, UniqueWindow ); + + D_ASSERT( ! D_FLAGS_IS_SET( notification->flags, ~UWNF_ALL ) ); + + D_DEBUG_AT( WM_Unique, "window_notify( wm_data %p, window_data %p )\n", data, window_data ); + + if (notification->flags & UWNF_DESTROYED) { + D_DEBUG_AT( WM_Unique, " -> window destroyed.\n" ); + + window_data->window = NULL; + + return RS_REMOVE; + } + + return RS_OK; +} + +/**************************************************************************************************/ + +static void +initialize_data( CoreDFB *core, WMData *data, WMShared *shared ) +{ + D_ASSERT( data != NULL ); + + /* Initialize local data. */ + data->core = core; + data->world = dfb_core_world( core ); + data->shared = shared; + data->module_abi = UNIQUE_WM_ABI_VERSION; + + /* Set module callbacks. */ + data->context_notify = context_notify; + data->window_notify = window_notify; +} + +/**************************************************************************************************/ + +static void +wm_get_info( CoreWMInfo *info ) +{ + info->version.major = 0; + info->version.minor = 4; + info->version.binary = UNIQUE_WM_ABI_VERSION; + + snprintf( info->name, DFB_CORE_WM_INFO_NAME_LENGTH, "UniQuE" ); + snprintf( info->vendor, DFB_CORE_WM_INFO_VENDOR_LENGTH, "Denis Oliver Kropp" ); + + info->wm_data_size = sizeof(WMData); + info->wm_shared_size = sizeof(WMShared); + info->stack_data_size = sizeof(StackData); + info->window_data_size = sizeof(WindowData); +} + +static DFBResult +wm_initialize( CoreDFB *core, void *wm_data, void *shared_data ) +{ + WMData *data = wm_data; + WMShared *shared = shared_data; + + D_DEBUG_AT( WM_Unique, "wm_initialize()\n" ); + + initialize_data( core, data, shared ); + + D_MAGIC_SET( shared, WMShared ); + + return unique_wm_module_init( core, data, shared, true ); +} + +static DFBResult +wm_join( CoreDFB *core, void *wm_data, void *shared_data ) +{ + WMData *data = wm_data; + WMShared *shared = shared_data; + + D_DEBUG_AT( WM_Unique, "wm_join()\n" ); + + initialize_data( core, data, shared ); + + return unique_wm_module_init( core, data, shared, false ); +} + +static DFBResult +wm_shutdown( bool emergency, void *wm_data, void *shared_data ) +{ + WMShared *shared = shared_data; + + (void) shared; + + D_DEBUG_AT( WM_Unique, "wm_shutdown()\n" ); + + unique_wm_module_deinit( wm_data, shared_data, true, emergency ); + + D_MAGIC_CLEAR( shared ); + + return DFB_OK; +} + +static DFBResult +wm_leave( bool emergency, void *wm_data, void *shared_data ) +{ + D_DEBUG_AT( WM_Unique, "wm_leave()\n" ); + + unique_wm_module_deinit( wm_data, shared_data, false, emergency ); + + return DFB_OK; +} + +static DFBResult +wm_suspend( void *wm_data, void *shared_data ) +{ + D_DEBUG_AT( WM_Unique, "wm_suspend()\n" ); + + return DFB_OK; +} + +static DFBResult +wm_resume( void *wm_data, void *shared_data ) +{ + D_DEBUG_AT( WM_Unique, "wm_resume()\n" ); + + return DFB_OK; +} + +static DFBResult +wm_post_init( void *wm_data, void *shared_data ) +{ + D_DEBUG_AT( WM_Unique, "wm_post_init()\n" ); + + return DFB_OK; +} + +/**************************************************************************************************/ + +static DFBResult +wm_init_stack( CoreWindowStack *stack, + void *wm_data, + void *stack_data ) +{ + DFBResult ret; + StackData *data = stack_data; + WMData *wmdata = wm_data; + CoreLayerContext *context; + CoreLayerRegion *region; + + D_ASSERT( stack != NULL ); + D_ASSERT( stack->context != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + + context = stack->context; + + D_ASSERT( context != NULL ); + + ret = dfb_layer_context_get_primary_region( context, true, ®ion ); + if (ret) { + D_DERROR( ret, "WM/UniQuE: Could not get the primary region!\n" ); + return ret; + } + + /* Create the unique context. */ + ret = unique_context_create( wmdata->core, stack, region, context->layer_id, + wmdata->shared, &data->context ); + dfb_layer_region_unref( region ); + if (ret) { + D_DERROR( ret, "WM/UniQuE: Could not create the context!\n" ); + return ret; + } + + /* Attach the global context listener. */ + ret = unique_context_attach_global( data->context, + UNIQUE_WM_MODULE_CONTEXT_LISTENER, + data, &data->context_reaction ); + if (ret) { + unique_context_unref( data->context ); + D_DERROR( ret, "WM/UniQuE: Could not attach global context listener!\n" ); + return ret; + } + + /* Inherit all local references from the layer context. */ + ret = unique_context_inherit( data->context, context ); + unique_context_unref( data->context ); + if (ret) { + unique_context_detach_global( data->context, &data->context_reaction ); + D_DERROR( ret, "WM/UniQuE: Could not inherit from layer context!\n" ); + return ret; + } + + + + data->stack = stack; + + D_MAGIC_SET( data, StackData ); + + return DFB_OK; +} + +static DFBResult +wm_close_stack( CoreWindowStack *stack, + void *wm_data, + void *stack_data ) +{ + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + D_ASSUME( data->context == NULL ); + + if (data->context) + unique_context_detach_global( data->context, &data->context_reaction ); + + D_MAGIC_CLEAR( data ); + + return DFB_OK; +} + +static DFBResult +wm_set_active( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + bool active ) +{ + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + D_DEBUG_AT( WM_Unique, "%s( stack %p, wm_data %p, stack_data %p, %sactive )\n", + __FUNCTION__, stack, wm_data, stack_data, active ? "" : "in" ); + + if (!data->context) { + D_ASSERT( !active ); + return DFB_OK; + } + + return unique_context_set_active( data->context, active ); +} + +static DFBResult +wm_resize_stack( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + int width, + int height ) +{ + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + if (!data->context) + return DFB_DESTROYED; + + return unique_context_resize( data->context, width, height ); +} + +static DFBResult +wm_process_input( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + const DFBInputEvent *event ) +{ + StackData *data = stack_data; + + (void) data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( event != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + return DFB_OK; +} + +static DFBResult +wm_flush_keys( CoreWindowStack *stack, + void *wm_data, + void *stack_data ) +{ + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + if (!data->context) + return DFB_DESTROYED; + + return unique_context_flush_keys( data->context ); +} + +static DFBResult +wm_window_at( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + int x, + int y, + CoreWindow **ret_window ) +{ + DFBResult ret; + UniqueWindow *window; + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( ret_window != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + if (!data->context) + return DFB_DESTROYED; + + ret = unique_context_window_at( data->context, x, y, &window ); + if (ret) + return ret; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + *ret_window = window->window; + + return DFB_OK; +} + +static DFBResult +wm_window_lookup( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + DFBWindowID window_id, + CoreWindow **ret_window ) +{ + DFBResult ret; + UniqueWindow *window; + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( ret_window != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + if (!data->context) + return DFB_DESTROYED; + + ret = unique_context_lookup_window( data->context, window_id, &window ); + if (ret) + return ret; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + *ret_window = window->window; + + return DFB_OK; +} + +static DFBResult +wm_enum_windows( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWMWindowCallback callback, + void *callback_ctx ) +{ + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( callback != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + if (!data->context) + return DFB_DESTROYED; + + return unique_context_enum_windows( data->context, callback, callback_ctx ); +} + +/**************************************************************************************************/ + +static DFBResult +wm_get_insets( CoreWindowStack *stack, + CoreWindow *window, + DFBInsets *insets ) +{ + if( insets ) { + insets->l=0; + insets->t=0; + insets->r=0; + insets->b=0; + } + return DFB_OK; +} + +static DFBResult +wm_preconfigure_window( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWindow *window, + void *window_data ) +{ + return DFB_OK; +} + +static DFBResult +wm_set_window_property( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWindow *window, + void *window_data, + const char *key, + void *value, + void **ret_old_value ) +{ + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( key != NULL ); + + fusion_object_set_property((FusionObject*)window, + key,value,ret_old_value); + return DFB_OK; +} + +static DFBResult +wm_get_window_property( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWindow *window, + void *window_data, + const char *key, + void **ret_value ) +{ + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( key != NULL ); + D_ASSERT( ret_value != NULL ); + + *ret_value=fusion_object_get_property((FusionObject*)window,key); + return DFB_OK; +} + + +static DFBResult +wm_remove_window_property( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWindow *window, + void *window_data, + const char *key, + void **ret_value ) +{ + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( key != NULL ); + + fusion_object_remove_property((FusionObject*)window,key,ret_value); + return DFB_OK; +} + +static DFBResult +wm_add_window( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWindow *window, + void *window_data ) +{ + DFBResult ret; + StackData *sdata = stack_data; + WindowData *data = window_data; + WMData *wmdata = wm_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + + D_MAGIC_ASSERT( sdata, StackData ); + D_MAGIC_ASSERT( sdata->context, UniqueContext ); + + data->context = sdata->context; + + /* Create the unique window. */ + ret = unique_window_create( wmdata->core, window, data->context, + window->caps, &window->config, &data->window ); + if (ret) { + D_DERROR( ret, "WM/UniQuE: Could not create window!\n" ); + return ret; + } + + /* Attach the global window listener. */ + ret = unique_window_attach_global( data->window, + UNIQUE_WM_MODULE_WINDOW_LISTENER, + data, &data->window_reaction ); + if (ret) { + unique_window_unref( data->window ); + D_DERROR( ret, "WM/UniQuE: Could not attach global window listener!\n" ); + return ret; + } + + /* Inherit all local references from the layer window. */ + ret = unique_window_inherit( data->window, window ); + unique_window_unref( data->window ); + if (ret) { + unique_window_detach_global( data->window, &data->window_reaction ); + D_DERROR( ret, "WM/UniQuE: Could not inherit from core window!\n" ); + return ret; + } + + unique_window_get_config( data->window, &window->config ); + + + D_MAGIC_SET( data, WindowData ); + + return DFB_OK; +} + +static DFBResult +wm_remove_window( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreWindow *window, + void *window_data ) +{ + WindowData *data = window_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + D_ASSERT( window != NULL ); + D_ASSERT( window_data != NULL ); + + D_MAGIC_ASSERT( data, WindowData ); + +// D_ASSUME( data->window == NULL ); + + if (data->window) + unique_window_detach_global( data->window, &data->window_reaction ); + + D_MAGIC_CLEAR( data ); + + return DFB_OK; +} + +static DFBResult +wm_set_window_config( CoreWindow *window, + void *wm_data, + void *window_data, + const CoreWindowConfig *config, + CoreWindowConfigFlags flags ) +{ + DFBResult ret; + WindowData *data = window_data; + + D_ASSERT( window != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( config != NULL ); + + D_MAGIC_ASSERT( data, WindowData ); + + if (!data->window) + return DFB_DESTROYED; + + ret = unique_window_set_config( data->window, config, flags ); + + unique_window_get_config( data->window, &window->config ); + + return ret; +} + +static DFBResult +wm_restack_window( CoreWindow *window, + void *wm_data, + void *window_data, + CoreWindow *relative, + void *relative_data, + int relation ) +{ + WindowData *data = window_data; + WindowData *rel_data = relative_data; + + D_ASSERT( window != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( window_data != NULL ); + + D_MAGIC_ASSERT( data, WindowData ); + + D_ASSERT( relative == NULL || relative_data != NULL ); + + D_ASSERT( relative == NULL || relative == window || relation != 0); + + if (!data->window) + return DFB_DESTROYED; + + return unique_window_restack( data->window, rel_data ? rel_data->window : NULL, relation ); +} + +static DFBResult +wm_grab( CoreWindow *window, + void *wm_data, + void *window_data, + CoreWMGrab *grab ) +{ + WindowData *data = window_data; + + D_ASSERT( window != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( grab != NULL ); + + D_MAGIC_ASSERT( data, WindowData ); + + if (!data->window) + return DFB_DESTROYED; + + return unique_window_grab( data->window, grab ); +} + +static DFBResult +wm_ungrab( CoreWindow *window, + void *wm_data, + void *window_data, + CoreWMGrab *grab ) +{ + WindowData *data = window_data; + + D_ASSERT( window != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( window_data != NULL ); + D_ASSERT( grab != NULL ); + + D_MAGIC_ASSERT( data, WindowData ); + + if (!data->window) + return DFB_DESTROYED; + + return unique_window_ungrab( data->window, grab ); +} + +static DFBResult +wm_request_focus( CoreWindow *window, + void *wm_data, + void *window_data ) +{ + WindowData *data = window_data; + + D_ASSERT( window != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( window_data != NULL ); + + D_MAGIC_ASSERT( data, WindowData ); + + if (!data->window) + return DFB_DESTROYED; + + return unique_window_request_focus( data->window ); +} + +/**************************************************************************************************/ + +static DFBResult +wm_update_stack( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + const DFBRegion *region, + DFBSurfaceFlipFlags flags ) +{ + StackData *data = stack_data; + + D_ASSERT( stack != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + + DFB_REGION_ASSERT( region ); + + D_MAGIC_ASSERT( data, StackData ); + + if (!data->context) + return DFB_DESTROYED; + + return unique_context_update( data->context, region, 1, flags ); +} + +static DFBResult +wm_update_window( CoreWindow *window, + void *wm_data, + void *window_data, + const DFBRegion *region, + DFBSurfaceFlipFlags flags ) +{ + WindowData *data = window_data; + + D_ASSERT( window != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( window_data != NULL ); + + DFB_REGION_ASSERT_IF( region ); + + D_MAGIC_ASSERT( data, WindowData ); + + if (!data->window) + return DFB_DESTROYED; + + return unique_window_update( data->window, region, flags ); +} + +/**************************************************************************************************/ + +/* HACK: implementation dumped in here for now, will move into context */ +static DFBResult +wm_update_cursor( CoreWindowStack *stack, + void *wm_data, + void *stack_data, + CoreCursorUpdateFlags flags ) +{ + DFBResult ret; + DFBRegion old_region; + WMData *wmdata = wm_data; + StackData *data = stack_data; + bool restored = false; + CoreLayer *layer; + CoreLayerRegion *region; + CardState *state; + CoreSurface *surface; + UniqueContext *context; + + D_ASSERT( stack != NULL ); + D_ASSERT( stack->context != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( stack_data != NULL ); + + D_MAGIC_ASSERT( data, StackData ); + + context = data->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + /* Optimize case of invisible cursor moving. */ + if (!(flags & ~(CCUF_POSITION | CCUF_SHAPE)) && (!stack->cursor.opacity || !stack->cursor.enabled)) { + context->cursor_bs_valid = false; + return DFB_OK; + } + + layer = dfb_layer_at( context->layer_id ); + state = &layer->state; + region = context->region; + surface = context->surface; + + D_ASSERT( region != NULL ); + D_ASSERT( surface != NULL ); + + if (flags & CCUF_ENABLE) { + CoreSurface *cursor_bs; + DFBSurfaceCapabilities caps = DSCAPS_NONE; + + dfb_surface_caps_apply_policy( stack->cursor.policy, &caps ); + + D_ASSERT( context->cursor_bs == NULL ); + + /* Create the cursor backing store surface. */ + ret = dfb_surface_create_simple( wmdata->core, stack->cursor.size.w, stack->cursor.size.h, + region->config.format, caps, CSTF_SHARED | CSTF_CURSOR, + 0, /* FIXME: no shared cursor objects, no cursor id */ + NULL, &cursor_bs ); + if (ret) { + D_ERROR( "WM/Default: Failed creating backing store for cursor!\n" ); + return ret; + } + + ret = dfb_surface_globalize( cursor_bs ); + D_ASSERT( ret == DFB_OK ); + + /* Ensure valid back buffer for now. + * FIXME: Keep a flag to know when back/front have been swapped and need a sync. + */ + switch (region->config.buffermode) { + case DLBM_BACKVIDEO: + case DLBM_TRIPLE: + dfb_gfx_copy( surface, surface, NULL ); + break; + + default: + break; + } + + context->cursor_bs = cursor_bs; + } + else { + D_ASSERT( context->cursor_bs != NULL ); + + /* restore region under cursor */ + if (context->cursor_drawn) { + DFBRectangle rect = { 0, 0, + context->cursor_region.x2 - context->cursor_region.x1 + 1, + context->cursor_region.y2 - context->cursor_region.y1 + 1 }; + + D_ASSERT( stack->cursor.opacity || (flags & CCUF_OPACITY) ); + D_ASSERT( context->cursor_bs_valid ); + + dfb_gfx_copy_to( context->cursor_bs, surface, &rect, + context->cursor_region.x1, context->cursor_region.y1, false ); + + context->cursor_drawn = false; + + old_region = context->cursor_region; + restored = true; + } + + if (flags & CCUF_SIZE) { + ret = dfb_surface_reformat( context->cursor_bs, + stack->cursor.size.w, stack->cursor.size.h, + context->cursor_bs->config.format ); + if (ret) { + D_ERROR( "WM/Default: Failed resizing backing store for cursor!\n" ); + return ret; + } + } + } + + if (flags & (CCUF_ENABLE | CCUF_POSITION | CCUF_SIZE | CCUF_OPACITY)) { + context->cursor_bs_valid = false; + + context->cursor_region.x1 = stack->cursor.x - stack->cursor.hot.x; + context->cursor_region.y1 = stack->cursor.y - stack->cursor.hot.y; + context->cursor_region.x2 = context->cursor_region.x1 + stack->cursor.size.w - 1; + context->cursor_region.y2 = context->cursor_region.y1 + stack->cursor.size.h - 1; + + if (!dfb_region_intersect( &context->cursor_region, 0, 0, stack->width - 1, stack->height - 1 )) { + D_BUG( "invalid cursor region" ); + return DFB_BUG; + } + } + + D_ASSERT( context->cursor_bs != NULL ); + + if (flags & CCUF_DISABLE) { + dfb_surface_unlink( &context->cursor_bs ); + } + else if (stack->cursor.opacity) { + /* backup region under cursor */ + if (!context->cursor_bs_valid) { + DFBRectangle rect = DFB_RECTANGLE_INIT_FROM_REGION( &context->cursor_region ); + + D_ASSERT( !context->cursor_drawn ); + + /* FIXME: this requires using blitted flipping all the time, + but fixing it seems impossible, for now DSFLIP_BLIT is forced + in repaint_stack() when the cursor is enabled. */ + dfb_gfx_copy_to( surface, context->cursor_bs, &rect, 0, 0, true ); + + context->cursor_bs_valid = true; + } + + /* Set destination. */ + state->destination = surface; + state->modified |= SMF_DESTINATION; + + /* Set clipping region. */ + dfb_state_set_clip( state, &context->cursor_region ); + + /* draw cursor */ + unique_draw_cursor( stack, context, state, &context->cursor_region ); + + /* Reset destination. */ + state->destination = NULL; + state->modified |= SMF_DESTINATION; + + context->cursor_drawn = true; + + if (restored) { + if (dfb_region_region_intersects( &old_region, &context->cursor_region )) + dfb_region_region_union( &old_region, &context->cursor_region ); + else + dfb_layer_region_flip_update( region, &context->cursor_region, DSFLIP_BLIT ); + + dfb_layer_region_flip_update( region, &old_region, DSFLIP_BLIT ); + } + else + dfb_layer_region_flip_update( region, &context->cursor_region, DSFLIP_BLIT ); + } + else if (restored) + dfb_layer_region_flip_update( region, &old_region, DSFLIP_BLIT ); + + return DFB_OK; +} + diff --git a/Source/DirectFB/wm/unique/uniquewm.c b/Source/DirectFB/wm/unique/uniquewm.c new file mode 100755 index 0000000..8247556 --- /dev/null +++ b/Source/DirectFB/wm/unique/uniquewm.c @@ -0,0 +1,451 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 + +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include + + +D_DEBUG_DOMAIN( UniQuE_WM, "UniQuE/WM", "UniQuE - Universal Quark Emitter" ); + +/**************************************************************************************************/ + +static CoreDFB *dfb_core; +static WMData *wm_data; +static WMShared *wm_shared; + +/**************************************************************************************************/ + +static const StretRegionClass *region_classes[_URCI_NUM] = { + &unique_root_region_class, + &unique_frame_region_class, + &unique_window_region_class, + &unique_foo_region_class +}; + +static DFBResult register_region_classes ( WMShared *shared, + bool master ); + +static DFBResult unregister_region_classes( WMShared *shared ); + +/**************************************************************************************************/ + +static const UniqueDeviceClass *device_classes[_UDCI_NUM] = { + &unique_pointer_device_class, + &unique_wheel_device_class, + &unique_keyboard_device_class +}; + +static DFBResult register_device_classes ( WMShared *shared, + bool master ); + +static DFBResult unregister_device_classes( WMShared *shared ); + +/**************************************************************************************************/ + +static DFBResult +load_foo( CoreDFB *core, WMShared *shared ) +{ + DFBResult ret; + + D_ASSERT( core != NULL ); + + D_MAGIC_ASSERT( shared, WMShared ); + + ret = dfb_surface_create_simple( core, foo_desc.width, foo_desc.height, foo_desc.pixelformat, + DSCAPS_NONE, CSTF_SHARED, 0, NULL, &shared->foo_surface ); + if (ret) { + D_DERROR( ret, "UniQuE/WM: Could not create %dx%d surface for border tiles!\n", + foo_desc.width, foo_desc.height ); + return ret; + } + + ret = dfb_surface_write_buffer( shared->foo_surface, CSBR_BACK, + foo_desc.preallocated[0].data, foo_desc.preallocated[0].pitch, NULL ); + if (ret) + D_DERROR( ret, "UniQuE/WM: Could not write to %dx%d surface for border tiles!\n", + foo_desc.width, foo_desc.height ); + + dfb_surface_globalize( shared->foo_surface ); + + return DFB_OK; +} + +static void +unload_foo( WMShared *shared ) +{ + D_MAGIC_ASSERT( shared, WMShared ); + + dfb_surface_unlink( &shared->foo_surface ); +} + +/**************************************************************************************************/ + +DFBResult +unique_wm_module_init( CoreDFB *core, WMData *data, WMShared *shared, bool master ) +{ + DFBResult ret; + + D_DEBUG_AT( UniQuE_WM, "unique_wm_init( core %p, data %p, shared %p, %s )\n", + core, data, shared, master ? "master" : "slave" ); + + D_ASSERT( core != NULL ); + D_ASSERT( data != NULL ); + D_ASSERT( data->context_notify != NULL ); + D_ASSERT( data->window_notify != NULL ); + + D_MAGIC_ASSERT( shared, WMShared ); + + D_ASSERT( dfb_core == NULL ); + D_ASSERT( wm_data == NULL ); + D_ASSERT( wm_shared == NULL ); + + if (data->module_abi != UNIQUE_WM_ABI_VERSION) { + D_ERROR( "UniQuE/WM: Module ABI version (%d) does not match %d!\n", + data->module_abi, UNIQUE_WM_ABI_VERSION ); + return DFB_VERSIONMISMATCH; + } + + ret = register_region_classes( shared, master ); + if (ret) + return ret; + + ret = register_device_classes( shared, master ); + if (ret) + goto error_device; + + if (master) { + int i; + + ret = load_foo( core, shared ); + if (ret) + goto error_foo; + + ret = dfb_input_add_global( _unique_device_listener, &shared->device_listener ); + if (ret) + goto error_global; + + shared->context_pool = unique_context_pool_create( data->world ); + shared->decoration_pool = unique_decoration_pool_create( data->world ); + shared->window_pool = unique_window_pool_create( data->world ); + + shared->insets.l = foo[UFI_W].rect.w; + shared->insets.t = foo[UFI_N].rect.h; + shared->insets.r = foo[UFI_E].rect.w; + shared->insets.b = foo[UFI_S].rect.h; + + for (i=0; i<8; i++) + shared->foo_rects[i] = foo[i].rect; + } + else + dfb_input_set_global( _unique_device_listener, shared->device_listener ); + + dfb_core = core; + wm_data = data; + wm_shared = shared; + + return DFB_OK; + +error_global: + unload_foo( shared ); + +error_foo: + unregister_device_classes( shared ); + +error_device: + unregister_region_classes( shared ); + + return ret; +} + +void +unique_wm_module_deinit( WMData *data, WMShared *shared, bool master, bool emergency ) +{ + D_DEBUG_AT( UniQuE_WM, "unique_wm_deinit( %s%s ) <- core %p, data %p, shared %p\n", + master ? "master" : "slave", emergency ? ", emergency" : "", + dfb_core, wm_data, wm_shared ); + + D_ASSERT( dfb_core != NULL ); + D_ASSERT( wm_data != NULL ); + D_ASSERT( wm_data == data ); + + D_MAGIC_ASSERT( shared, WMShared ); + D_ASSERT( wm_shared == shared ); + + if (master) { + fusion_object_pool_destroy( shared->window_pool, data->world ); + fusion_object_pool_destroy( shared->decoration_pool, data->world ); + fusion_object_pool_destroy( shared->context_pool, data->world ); + } + + unregister_device_classes( shared ); + unregister_region_classes( shared ); + + if (master) + unload_foo( wm_shared ); + + dfb_core = NULL; + wm_data = NULL; + wm_shared = NULL; +} + +ReactionResult +_unique_wm_module_context_listener( const void *msg_data, + void *ctx ) +{ + const UniqueContextNotification *notification = msg_data; + + D_ASSERT( wm_data != NULL ); + D_ASSERT( wm_data->context_notify != NULL ); + + D_ASSERT( notification != NULL ); + + D_ASSERT( ! D_FLAGS_IS_SET( notification->flags, ~UCNF_ALL ) ); + + D_DEBUG_AT( UniQuE_WM, "%s( context %p, flags 0x%08x )\n", + __FUNCTION__, notification->context, notification->flags ); + + return wm_data->context_notify( wm_data, notification, ctx ); +} + +ReactionResult +_unique_wm_module_window_listener ( const void *msg_data, + void *ctx ) +{ + const UniqueWindowNotification *notification = msg_data; + + D_ASSERT( wm_data != NULL ); + D_ASSERT( wm_data->window_notify != NULL ); + + D_ASSERT( notification != NULL ); + + D_ASSERT( ! D_FLAGS_IS_SET( notification->flags, ~UWNF_ALL ) ); + + D_DEBUG_AT( UniQuE_WM, "%s( window %p, flags 0x%08x )\n", + __FUNCTION__, notification->window, notification->flags ); + + return wm_data->window_notify( wm_data, notification, ctx ); +} + +UniqueContext * +unique_wm_create_context( void ) +{ + D_ASSERT( dfb_core != NULL ); + D_ASSERT( wm_data != NULL ); + D_MAGIC_ASSERT( wm_shared, WMShared ); + D_ASSERT( wm_shared->context_pool != NULL ); + + return (UniqueContext*) fusion_object_create( wm_shared->context_pool, wm_data->world ); +} + +UniqueDecoration * +unique_wm_create_decoration( void ) +{ + D_ASSERT( dfb_core != NULL ); + D_ASSERT( wm_data != NULL ); + D_MAGIC_ASSERT( wm_shared, WMShared ); + D_ASSERT( wm_shared->decoration_pool != NULL ); + + return (UniqueDecoration*) fusion_object_create( wm_shared->decoration_pool, wm_data->world ); +} + +UniqueWindow * +unique_wm_create_window( void ) +{ + D_ASSERT( dfb_core != NULL ); + D_ASSERT( wm_data != NULL ); + D_MAGIC_ASSERT( wm_shared, WMShared ); + D_ASSERT( wm_shared->window_pool != NULL ); + + return (UniqueWindow*) fusion_object_create( wm_shared->window_pool, wm_data->world ); +} + +/**************************************************************************************************/ + +bool +unique_wm_running( void ) +{ + if (dfb_core) { + if (!wm_data || !wm_shared) { + D_BUG( "partly initialized module (%p,%p,%p)", dfb_core, wm_data, wm_shared ); + return false; + } + + return true; + } + + return false; +} + +DirectResult +unique_wm_enum_contexts( FusionObjectCallback callback, + void *ctx ) +{ + D_ASSERT( dfb_core != NULL ); + D_ASSERT( wm_data != NULL ); + D_MAGIC_ASSERT( wm_shared, WMShared ); + D_ASSERT( wm_shared->context_pool != NULL ); + + return fusion_object_pool_enum( wm_shared->context_pool, callback, ctx ); +} + +DirectResult +unique_wm_enum_windows( FusionObjectCallback callback, + void *ctx ) +{ + D_ASSERT( dfb_core != NULL ); + D_ASSERT( wm_data != NULL ); + D_MAGIC_ASSERT( wm_shared, WMShared ); + D_ASSERT( wm_shared->context_pool != NULL ); + + return fusion_object_pool_enum( wm_shared->window_pool, callback, ctx ); +} + +/**************************************************************************************************/ + +static DFBResult +register_region_classes( WMShared *shared, + bool master ) +{ + int i; + DFBResult ret; + StretRegionClassID class_id; + + D_MAGIC_ASSERT( shared, WMShared ); + + for (i=0; i<_URCI_NUM; i++) { + ret = stret_class_register( region_classes[i], &class_id ); + if (ret) { + D_DERROR( ret, "UniQuE/WM: Failed to register region class %d!\n", i ); + + goto error; + } + + if (master) + shared->region_classes[i] = class_id; + else if (shared->region_classes[i] != class_id) { + D_ERROR( "UniQuE/WM: Class IDs mismatch (%d/%d)!\n", + class_id, shared->region_classes[i] ); + + stret_class_unregister( class_id ); + + ret = DFB_VERSIONMISMATCH; + goto error; + } + } + + return DFB_OK; + +error: + while (--i >= 0) + stret_class_unregister( shared->region_classes[i] ); + + return ret; +} + +static DFBResult +unregister_region_classes( WMShared *shared ) +{ + int i; + + D_MAGIC_ASSERT( shared, WMShared ); + + for (i=_URCI_NUM-1; i>=0; i--) + stret_class_unregister( shared->region_classes[i] ); + + return DFB_OK; +} + +static DFBResult +register_device_classes( WMShared *shared, + bool master ) +{ + int i; + DFBResult ret; + UniqueDeviceClassID class_id; + + D_MAGIC_ASSERT( shared, WMShared ); + + for (i=0; i<_UDCI_NUM; i++) { + ret = unique_device_class_register( device_classes[i], &class_id ); + if (ret) { + D_DERROR( ret, "UniQuE/WM: Failed to register device class %d!\n", i ); + + goto error; + } + + if (master) + shared->device_classes[i] = class_id; + else if (shared->device_classes[i] != class_id) { + D_ERROR( "UniQuE/WM: Class IDs mismatch (%d/%d)!\n", + class_id, shared->device_classes[i] ); + + unique_device_class_unregister( class_id ); + + ret = DFB_VERSIONMISMATCH; + goto error; + } + } + + return DFB_OK; + +error: + while (--i >= 0) + unique_device_class_unregister( shared->device_classes[i] ); + + return ret; +} + +static DFBResult +unregister_device_classes( WMShared *shared ) +{ + int i; + + D_MAGIC_ASSERT( shared, WMShared ); + + for (i=_UDCI_NUM-1; i>=0; i--) + unique_device_class_unregister( shared->device_classes[i] ); + + return DFB_OK; +} + diff --git a/Source/DirectFB/wm/unique/uniquewm.h b/Source/DirectFB/wm/unique/uniquewm.h new file mode 100755 index 0000000..9b1913b --- /dev/null +++ b/Source/DirectFB/wm/unique/uniquewm.h @@ -0,0 +1,48 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 __UNIQUE__UNIQUEWM_H__ +#define __UNIQUE__UNIQUEWM_H__ + +#include +#include + +#include + + +bool unique_wm_running ( void ); + +DirectResult unique_wm_enum_contexts( FusionObjectCallback callback, + void *ctx ); + +DirectResult unique_wm_enum_windows ( FusionObjectCallback callback, + void *ctx ); + + +#endif + diff --git a/Source/DirectFB/wm/unique/uwmdump.c b/Source/DirectFB/wm/unique/uwmdump.c new file mode 100755 index 0000000..811d344 --- /dev/null +++ b/Source/DirectFB/wm/unique/uwmdump.c @@ -0,0 +1,267 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + This file is subject to the terms and conditions of the MIT License: + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include +#include + +#include + +#include + +#include +#include + +#include +#include + +#include +#include +#include + + +static void +print_usage( const char *prg_name ) +{ + fprintf( stderr, + "\n" + "UniQuE Dump (version %s)\n" + "\n" + "Usage: %s [options]\n" + "\n" + "Options:\n" + " -h, --help Show this help message\n" + " -v, --version Print version information\n" + "\n", + DIRECTFB_VERSION, prg_name ); +} + +static DFBBoolean +parse_command_line( int argc, char *argv[] ) +{ + int n; + const char *prg_name = strrchr( argv[0], '/' ); + + if (prg_name) + prg_name++; + else + prg_name = argv[0]; + + for (n = 1; n < argc; n++) { + const char *a = argv[n]; + + if (*a != '-') { + print_usage( prg_name ); + return DFB_FALSE; + } + if (strcmp (a, "-h") == 0 || strcmp (a, "--help") == 0) { + print_usage( prg_name ); + return DFB_FALSE; + } + if (strcmp (a, "-v") == 0 || strcmp (a, "--version") == 0) { + fprintf (stderr, "dfbg version %s\n", DIRECTFB_VERSION); + return DFB_FALSE; + } + } + + return DFB_TRUE; +} + +static bool +window_callback( UniqueWindow *window ) +{ + int refs; + DirectResult ret; + DFBRectangle *bounds = &window->bounds; + + if (window->object.state != FOS_ACTIVE) + return true; + + ret = fusion_ref_stat( &window->object.ref, &refs ); + if (ret) { + printf( "Fusion error %d!\n", ret ); + return false; + } + +#if FUSION_BUILD_MULTI + printf( "0x%08x : ", window->object.ref.multi.id ); +#else + printf( "N/A : " ); +#endif + + printf( "%3d ", refs ); + + + printf( "%4d, %4d ", bounds->x, bounds->y ); + + printf( "%4d x %4d ", bounds->w, bounds->h ); + + printf( "0x%02x ", window->opacity ); + + printf( "%5d ", dfb_window_id( window->window ) ); + + switch (window->stacking) { + case DWSC_UPPER: + printf( "^ " ); + break; + case DWSC_MIDDLE: + printf( "- " ); + break; + case DWSC_LOWER: + printf( "v " ); + break; + default: + printf( "? " ); + break; + } + + if (D_FLAGS_IS_SET( window->flags, UWF_VISIBLE )) + printf( "VISIBLE " ); + + if (D_FLAGS_IS_SET( window->flags, UWF_DECORATED )) + printf( "DECORATED " ); + + if (D_FLAGS_IS_SET( window->flags, UWF_DESTROYED )) + printf( "DESTROYED " ); + + + printf( "\n" ); + + return true; +} + +static bool +context_callback( FusionObjectPool *pool, + FusionObject *object, + void *ctx ) +{ + int refs; + DirectResult ret; + UniqueContext *context = (UniqueContext*) object; + + if (object->state != FOS_ACTIVE) + return true; + + ret = fusion_ref_stat( &object->ref, &refs ); + if (ret) { + printf( "Fusion error %d!\n", ret ); + return false; + } + + printf( "\n" + "-------[ Contexts ]-------\n" + "Reference . Refs Windows\n" + "--------------------------\n" ); + +#if FUSION_BUILD_MULTI + printf( "0x%08x : ", object->ref.multi.id ); +#else + printf( "N/A : " ); +#endif + + printf( "%3d ", refs ); + + printf( "%2d ", fusion_vector_size( &context->windows ) ); + + printf( "\n" ); + + + ret = dfb_windowstack_lock( context->stack ); + if (ret) { + D_DERROR( ret, "UniQuE/Dump: Could not lock window stack!\n" ); + return true; + } + + if (fusion_vector_has_elements( &context->windows )) { + int index; + UniqueWindow *window; + + printf( "\n" + "-----------------------------------[ Windows ]------------------------------------\n" ); + printf( "Reference . Refs X Y Width Height Opacity ID Flags\n" ); + printf( "----------------------------------------------------------------------------------\n" ); + + fusion_vector_foreach_reverse( window, index, context->windows ) + window_callback( window ); + } + + dfb_windowstack_unlock( context->stack ); + + printf( "\n" ); + + return true; +} + +int +main( int argc, char *argv[] ) +{ + DFBResult ret; + CoreDFB *core; + + /* Initialize DirectFB including command line parsing. */ + ret = DirectFBInit( &argc, &argv ); + if (ret) { + DirectFBError( "DirectFBInit() failed", ret ); + return -1; + } + + /* Parse the command line. */ + if (!parse_command_line( argc, argv )) + return -2; + + /* Create the super interface. */ + ret = dfb_core_create( &core ); + if (ret) { + DirectFBError( "dfb_core_create() failed", ret ); + return -3; + } + + if (!unique_wm_running()) { + D_ERROR( "UniQuE/Dump: This session doesn't run UniQuE!\n" ); + dfb_core_destroy( core, false ); + return EXIT_FAILURE; + } + + + unique_wm_enum_contexts( context_callback, NULL ); + + + /* Release the super interface. */ + dfb_core_destroy( core, false ); + + return EXIT_SUCCESS; +} + diff --git a/Source/DirectFB/wm/unique/window.c b/Source/DirectFB/wm/unique/window.c new file mode 100755 index 0000000..eed319c --- /dev/null +++ b/Source/DirectFB/wm/unique/window.c @@ -0,0 +1,1525 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 + +#include + +#include +#include + +#include +#include + +#include +#include /* FIXME */ +#include +#include +#include /* FIXME */ +#include + +#include +#include + +#include +#include +#include +#include +#include + + +D_DEBUG_DOMAIN( UniQuE_Window, "UniQuE/Window", "UniQuE's Window" ); + + +static const ReactionFunc unique_window_globals[] = { + _unique_wm_module_window_listener, + NULL +}; + +/**************************************************************************************************/ + +typedef struct { + DirectLink link; + + int magic; + + DFBInputDeviceKeySymbol symbol; + DFBInputDeviceModifierMask modifiers; + + UniqueInputFilter *filter; +} KeyFilter; + +/**************************************************************************************************/ + +static DFBResult add_key_filter ( UniqueWindow *window, + DFBInputDeviceKeySymbol symbol, + DFBInputDeviceModifierMask modifiers, + UniqueInputFilter *filter ); + +static DFBResult remove_key_filter ( UniqueWindow *window, + DFBInputDeviceKeySymbol symbol, + DFBInputDeviceModifierMask modifiers ); + +static void remove_all_filters( UniqueWindow *window ); + +/**************************************************************************************************/ + +static DFBResult create_regions ( UniqueWindow *window ); + +static void insert_window ( UniqueContext *context, + UniqueWindow *window ); + +static void remove_window ( UniqueWindow *window ); + +static void update_foo_frame( UniqueWindow *window, + UniqueContext *context, + WMShared *shared ); + +static DFBResult update_window ( UniqueWindow *window, + const DFBRegion *region, + DFBSurfaceFlipFlags flags, + bool complete ); + +static void update_flags ( UniqueWindow *window ); + +static void set_opacity ( UniqueWindow *window, + u8 opacity ); + +static DFBResult move_window ( UniqueWindow *window, + int dx, + int dy ); + +static DFBResult resize_window ( UniqueWindow *window, + int width, + int height ); + +static DFBResult restack_window ( UniqueWindow *window, + UniqueWindow *relative, + int relation, + DFBWindowStackingClass stacking ); + +/**************************************************************************************************/ + +static inline int get_priority( DFBWindowCapabilities caps, DFBWindowStackingClass stacking ); + +/**************************************************************************************************/ + +static void +window_destructor( FusionObject *object, bool zombie, void *ctx ) +{ + int i; + UniqueContext *context; + UniqueWindow *window = (UniqueWindow*) object; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_DEBUG_AT( UniQuE_Window, "destroying %p (%dx%d - %dx%d)%s\n", + window, DFB_RECTANGLE_VALS( &window->bounds ), zombie ? " (ZOMBIE)" : ""); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + + D_FLAGS_SET( window->flags, UWF_DESTROYED ); + + unique_window_notify( window, UWNF_DESTROYED ); + + + set_opacity( window, 0 ); + + remove_window( window ); + + for (i=0; i<8; i++) { + if (window->foos[i]) + stret_region_destroy( window->foos[i] ); + } + + stret_region_destroy( window->region ); + + stret_region_destroy( window->frame ); + + + remove_all_filters( window ); + + unique_input_switch_drop( context->input_switch, window->channel ); + + unique_input_channel_detach_global( window->channel, &window->channel_reaction ); + + unique_input_channel_destroy( window->channel ); + + + if (window->surface) + dfb_surface_unlink( &window->surface ); + + unique_context_unlink( &window->context ); + + dfb_window_unlink( &window->window ); + + D_MAGIC_CLEAR( window ); + + fusion_object_destroy( object ); +} + +FusionObjectPool * +unique_window_pool_create( const FusionWorld *world ) +{ + return fusion_object_pool_create( "UniQuE Window Pool", sizeof(UniqueWindow), + sizeof(UniqueWindowNotification), window_destructor, NULL, world ); +} + +/**************************************************************************************************/ + +DFBResult +unique_window_create( CoreDFB *core, + CoreWindow *window, + UniqueContext *context, + DFBWindowCapabilities caps, + const CoreWindowConfig *config, + UniqueWindow **ret_window ) +{ + DFBResult ret; + UniqueWindow *uniwin; + WMShared *shared; + CoreSurface *surface; + DFBRectangle bounds; + + D_ASSERT( window != NULL ); + D_ASSERT( ret_window != NULL ); + + D_MAGIC_ASSERT( context, UniqueContext ); + + shared = context->shared; + + D_MAGIC_ASSERT( shared, WMShared ); + + surface = dfb_window_surface( window ); + + D_ASSERT( surface != NULL || (caps & DWCAPS_INPUTONLY)); + + uniwin = unique_wm_create_window(); + if (!uniwin) + return DFB_FUSION; + + bounds = config->bounds; + + /*if (bounds.x == 0 && bounds.y == 0) { + bounds.x = (context->width - bounds.w) / 2; + bounds.y = (context->height - bounds.h) / 2; + }*/ + + /* Initialize window data. */ + uniwin->shared = context->shared; + + uniwin->caps = caps; + uniwin->flags = UWF_NONE; + + uniwin->bounds = bounds; + uniwin->opacity = config->opacity; + uniwin->stacking = config->stacking; + uniwin->priority = get_priority( caps, config->stacking ); + uniwin->options = config->options; + uniwin->events = config->events; + uniwin->color_key = config->color_key; + uniwin->opaque = config->opaque; + + if (dfb_config->decorations && ! (caps & (DWCAPS_INPUTONLY | DWCAPS_NODECORATION))) { + uniwin->flags |= UWF_DECORATED; + uniwin->insets = shared->insets; + } + + dfb_rectangle_from_rectangle_plus_insets( &uniwin->full, &uniwin->bounds, &uniwin->insets ); + + ret = dfb_window_link( &uniwin->window, window ); + if (ret) + goto error; + + ret = unique_context_link( &uniwin->context, context ); + if (ret) + goto error; + + if (surface) { + ret = dfb_surface_link( &uniwin->surface, surface ); + if (ret) + goto error; + } + + + ret = unique_input_channel_create( core, context, &uniwin->channel ); + if (ret) + goto error; + + ret = unique_input_channel_attach_global( uniwin->channel, + UNIQUE_WINDOW_INPUT_CHANNEL_LISTENER, + uniwin, &uniwin->channel_reaction ); + if (ret) + goto error; + + + D_MAGIC_SET( uniwin, UniqueWindow ); + + ret = create_regions( uniwin ); + if (ret) { + D_MAGIC_CLEAR( uniwin ); + goto error; + } + + + /* Change global reaction lock. */ + fusion_object_set_lock( &uniwin->object, &context->stack->context->lock ); + + /* activate object */ + fusion_object_activate( &uniwin->object ); + + /* Actually add the window to the stack. */ + insert_window( context, uniwin ); + + /* Possibly switch focus to the new window. */ + //unique_context_update_focus( context ); + + /* return the new context */ + *ret_window = uniwin; + + return DFB_OK; + +error: + if (uniwin->channel_reaction.attached) + unique_input_channel_detach_global( uniwin->channel, &uniwin->channel_reaction ); + + if (uniwin->channel) + unique_input_channel_destroy( uniwin->channel ); + + if (uniwin->surface) + dfb_surface_unlink( &uniwin->surface ); + + if (uniwin->context) + unique_context_unlink( &uniwin->context ); + + if (uniwin->window) + dfb_window_unlink( &uniwin->window ); + + fusion_object_destroy( &uniwin->object ); + + return ret; +} + +DFBResult +unique_window_close( UniqueWindow *window ) +{ + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_UNIMPLEMENTED(); + + return DFB_OK; +} + +DFBResult +unique_window_destroy( UniqueWindow *window ) +{ + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_UNIMPLEMENTED(); + + return DFB_OK; +} + +DFBResult +unique_window_notify( UniqueWindow *window, + UniqueWindowNotificationFlags flags ) +{ + UniqueWindowNotification notification; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( flags != UWNF_NONE ); + + D_ASSERT( ! (flags & ~UWNF_ALL) ); + + notification.flags = flags; + notification.window = window; + + return unique_window_dispatch( window, ¬ification, unique_window_globals ); +} + +DFBResult +unique_window_update( UniqueWindow *window, + const DFBRegion *region, + DFBSurfaceFlipFlags flags ) +{ + D_MAGIC_ASSERT( window, UniqueWindow ); + + DFB_REGION_ASSERT_IF( region ); + + return update_window( window, region, flags, false ); +} + +DFBResult +unique_window_post_event( UniqueWindow *window, + DFBWindowEvent *event ) +{ + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( event != NULL ); + + if (!D_FLAGS_IS_SET( window->events, event->type )) + return DFB_OK; + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + dfb_window_post_event( window->window, event ); + + return DFB_OK; +} + +DFBResult +unique_window_set_config( UniqueWindow *window, + const CoreWindowConfig *config, + CoreWindowConfigFlags flags ) +{ + D_MAGIC_ASSERT( window, UniqueWindow ); + + if (flags & CWCF_OPTIONS) { + window->options = config->options; + update_flags( window ); + } + + if (flags & CWCF_EVENTS) + window->events = config->events; + + if (flags & CWCF_COLOR) + return DFB_UNSUPPORTED; + + if (flags & CWCF_COLOR_KEY) + window->color_key = config->color_key; + + if (flags & CWCF_OPAQUE) + window->opaque = config->opaque; + + if (flags & CWCF_OPACITY && !config->opacity) + set_opacity( window, config->opacity ); + + if (flags & CWCF_POSITION) + move_window( window, + config->bounds.x - window->bounds.x, + config->bounds.y - window->bounds.y ); + + if (flags & CWCF_STACKING) + restack_window( window, window, 0, config->stacking ); + + if (flags & CWCF_OPACITY && config->opacity) + set_opacity( window, config->opacity ); + + if (flags & CWCF_SIZE) + return resize_window( window, config->bounds.w, config->bounds.h ); + + return DFB_OK; +} + +DFBResult +unique_window_get_config( UniqueWindow *window, + CoreWindowConfig *config ) +{ + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( config != NULL ); + + config->bounds = window->bounds; + config->opacity = window->opacity; + config->stacking = window->stacking; + config->options = window->options; + config->events = window->events; + config->color_key = window->color_key; + config->opaque = window->opaque; + + return DFB_OK; +} + + +DFBResult +unique_window_restack( UniqueWindow *window, + UniqueWindow *relative, + int relation ) +{ + D_MAGIC_ASSERT( window, UniqueWindow ); + + return restack_window( window, relative, relation, window->stacking ); +} + + +DFBResult +unique_window_grab( UniqueWindow *window, + const CoreWMGrab *grab ) +{ + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + switch (grab->target) { + case CWMGT_KEYBOARD: + return unique_input_switch_set( context->input_switch, + UDCI_KEYBOARD, window->channel ); + + case CWMGT_POINTER: + return unique_input_switch_set( context->input_switch, + UDCI_POINTER, window->channel ); + + case CWMGT_KEY: { + DFBResult ret; + UniqueInputEvent event; + UniqueInputFilter *filter; + + event.keyboard.key_code = -1; + event.keyboard.key_symbol = grab->symbol; + event.keyboard.modifiers = grab->modifiers; + + ret = unique_input_switch_set_filter( context->input_switch, UDCI_KEYBOARD, + window->channel, &event, &filter ); + if (ret) { + D_DERROR( ret, "UniQuE/Window: Could not set input filter for key grab!\n" ); + return ret; + } + + ret = add_key_filter( window, grab->symbol, grab->modifiers, filter ); + if (ret) { + unique_input_switch_unset_filter( context->input_switch, filter ); + return ret; + } + + break; + } + + default: + D_BUG( "unknown grab target" ); + break; + } + + return DFB_OK; +} + +DFBResult +unique_window_ungrab( UniqueWindow *window, + const CoreWMGrab *grab ) +{ + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + switch (grab->target) { + case CWMGT_KEYBOARD: + return unique_input_switch_unset( context->input_switch, + UDCI_KEYBOARD, window->channel ); + + case CWMGT_POINTER: + return unique_input_switch_unset( context->input_switch, + UDCI_POINTER, window->channel ); + + case CWMGT_KEY: + return remove_key_filter( window, grab->symbol, grab->modifiers ); + + default: + D_BUG( "unknown grab target" ); + break; + } + + return DFB_OK; +} + +DFBResult +unique_window_request_focus( UniqueWindow *window ) +{ + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + return unique_input_switch_select( context->input_switch, UDCI_KEYBOARD, window->channel ); +} + +/**************************************************************************************************/ + +static DFBResult +add_key_filter( UniqueWindow *window, + DFBInputDeviceKeySymbol symbol, + DFBInputDeviceModifierMask modifiers, + UniqueInputFilter *filter ) +{ + KeyFilter *key; + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + key = SHCALLOC( context->shmpool, 1, sizeof(KeyFilter) ); + if (!key) + return D_OOSHM(); + + key->symbol = symbol; + key->modifiers = modifiers; + key->filter = filter; + + direct_list_append( &window->filters, &key->link ); + + D_MAGIC_SET( key, KeyFilter ); + + return DFB_OK; +} + +static DFBResult +remove_key_filter( UniqueWindow *window, + DFBInputDeviceKeySymbol symbol, + DFBInputDeviceModifierMask modifiers ) +{ + KeyFilter *key; + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + direct_list_foreach (key, window->filters) { + D_MAGIC_ASSERT( key, KeyFilter ); + + if (key->symbol == symbol && key->modifiers == modifiers) + break; + } + + if (!key) + return DFB_ITEMNOTFOUND; + + unique_input_switch_unset_filter( context->input_switch, key->filter ); + + direct_list_remove( &window->filters, &key->link ); + + D_MAGIC_CLEAR( key ); + + SHFREE( context->shmpool, key ); + + return DFB_OK; +} + +static void +remove_all_filters( UniqueWindow *window ) +{ + DirectLink *n; + KeyFilter *key; + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + direct_list_foreach_safe (key, n, window->filters) { + D_MAGIC_ASSERT( key, KeyFilter ); + + unique_input_switch_unset_filter( context->input_switch, key->filter ); + + D_MAGIC_CLEAR( key ); + + SHFREE( context->shmpool, key ); + } + + window->filters = NULL; +} + +/**************************************************************************************************/ + +static void +dispatch_motion( UniqueWindow *window, + const UniqueInputEvent *event ) +{ + DFBWindowEvent evt; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( event != NULL ); + + evt.type = DWET_MOTION; + evt.cx = event->pointer.x; + evt.cy = event->pointer.y; + evt.x = event->pointer.x - window->bounds.x; + evt.y = event->pointer.y - window->bounds.y; + evt.buttons = event->pointer.buttons; + + dfb_window_post_event( window->window, &evt ); +} + +static void +dispatch_button( UniqueWindow *window, + const UniqueInputEvent *event ) +{ + DFBWindowEvent evt; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( event != NULL ); + + evt.type = event->pointer.press ? DWET_BUTTONDOWN : DWET_BUTTONUP; + evt.cx = event->pointer.x; + evt.cy = event->pointer.y; + evt.x = event->pointer.x - window->bounds.x; + evt.y = event->pointer.y - window->bounds.y; + evt.button = event->pointer.button; + evt.buttons = event->pointer.buttons; + + dfb_window_post_event( window->window, &evt ); +} + +static void +dispatch_wheel( UniqueWindow *window, + const UniqueInputEvent *event ) +{ + DFBWindowEvent evt; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( event != NULL ); + + evt.type = DWET_WHEEL; + evt.step = event->wheel.value; + + dfb_window_post_event( window->window, &evt ); +} + +static void +dispatch_key( UniqueWindow *window, + const UniqueInputEvent *event ) +{ + DFBWindowEvent evt; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( event != NULL ); + + evt.type = event->keyboard.press ? DWET_KEYDOWN : DWET_KEYUP; + evt.key_code = event->keyboard.key_code; + evt.key_id = event->keyboard.key_id; + evt.key_symbol = event->keyboard.key_symbol; + evt.modifiers = event->keyboard.modifiers; + evt.locks = event->keyboard.locks; + + dfb_window_post_event( window->window, &evt ); +} + +static void +dispatch_channel( UniqueWindow *window, + const UniqueInputEvent *event ) +{ + DFBWindowEvent evt; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( event != NULL ); + + switch (event->channel.index) { + case UDCI_POINTER: + evt.type = event->channel.selected ? DWET_ENTER : DWET_LEAVE; + break; + + case UDCI_KEYBOARD: + evt.type = event->channel.selected ? DWET_GOTFOCUS : DWET_LOSTFOCUS; + break; + + default: + return; + } + + evt.cx = event->channel.x; + evt.cy = event->channel.y; + evt.x = event->channel.x - window->bounds.x; + evt.y = event->channel.y - window->bounds.y; + + dfb_window_post_event( window->window, &evt ); +} + +ReactionResult +_unique_window_input_channel_listener( const void *msg_data, + void *ctx ) +{ + const UniqueInputEvent *event = msg_data; + UniqueWindow *window = ctx; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( event != NULL ); + + D_DEBUG_AT( UniQuE_Window, "_unique_window_input_channel_listener( %p, %p )\n", + event, window ); + + switch (event->type) { + case UIET_MOTION: + dispatch_motion( window, event ); + break; + + case UIET_BUTTON: + dispatch_button( window, event ); + break; + + case UIET_WHEEL: + dispatch_wheel( window, event ); + break; + + case UIET_KEY: + dispatch_key( window, event ); + break; + + case UIET_CHANNEL: + dispatch_channel( window, event ); + break; + + default: + D_ONCE( "unknown event type" ); + break; + } + + return RS_OK; +} + +/**************************************************************************************************/ + +static inline int +get_priority( DFBWindowCapabilities caps, DFBWindowStackingClass stacking ) +{ + switch (stacking) { + case DWSC_UPPER: + return 1; + + case DWSC_MIDDLE: + return 0; + + case DWSC_LOWER: + return -1; + + default: + D_BUG( "unknown stacking class" ); + break; + } + + return 0; +} + +static inline int +get_index( UniqueWindow *window ) +{ + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( fusion_vector_contains( &context->windows, window ) ); + + return fusion_vector_index_of( &context->windows, window ); +} + +static DFBResult +update_window( UniqueWindow *window, + const DFBRegion *region, + DFBSurfaceFlipFlags flags, + bool complete ) +{ + DFBRegion regions[32]; + int num_regions; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + DFB_REGION_ASSERT_IF( region ); + + if (complete || stret_region_visible( window->region, region, true, regions, 32, &num_regions )) { + if (region) { + DFBRegion area = DFB_REGION_INIT_TRANSLATED( region, + window->bounds.x, + window->bounds.y ); + + unique_context_update( window->context, &area, 1, flags ); + } + else { + DFBRegion area = DFB_REGION_INIT_FROM_RECTANGLE( &window->bounds ); + unique_context_update( window->context, &area, 1, flags ); + } + } + else if (num_regions > 0) + unique_context_update( window->context, regions, num_regions, flags ); + + return DFB_OK; +} + +static DFBResult +update_frame( UniqueWindow *window, + const DFBRegion *region, + DFBSurfaceFlipFlags flags, + bool complete ) +{ + DFBRegion regions[32]; + int num_regions; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + DFB_REGION_ASSERT_IF( region ); + + if (complete || stret_region_visible( window->frame, region, true, regions, 32, &num_regions )) { + if (region) { + DFBRegion area = DFB_REGION_INIT_TRANSLATED( region, + window->full.x, + window->full.y ); + + unique_context_update( window->context, &area, 1, flags ); + } + else { + DFBRegion area = DFB_REGION_INIT_FROM_RECTANGLE( &window->full ); + unique_context_update( window->context, &area, 1, flags ); + } + } + else if (num_regions > 0) + unique_context_update( window->context, regions, num_regions, flags ); + + return DFB_OK; +} + +/**************************************************************************************************/ +/**************************************************************************************************/ + +static void +insert_window( UniqueContext *context, + UniqueWindow *window ) +{ + int index; + UniqueWindow *other; + + D_MAGIC_ASSERT( context, UniqueContext ); + D_MAGIC_ASSERT( window, UniqueWindow ); + + /* + * Iterate from bottom to top, + * stopping at the first window with a higher priority. + */ + fusion_vector_foreach (other, index, context->windows) { + D_MAGIC_ASSERT( other, UniqueWindow ); + + if (other->priority > window->priority) + break; + } + + /* Insert the window at the acquired position. */ + fusion_vector_insert( &context->windows, window, index ); + + stret_region_restack( window->frame, index ); +} + +static void +remove_window( UniqueWindow *window ) +{ + int index; + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + D_ASSERT( fusion_vector_contains( &context->windows, window ) ); + + index = fusion_vector_index_of( &context->windows, window ); + + fusion_vector_remove( &context->windows, index ); +} + +/**************************************************************************************************/ + +static DFBResult +move_window( UniqueWindow *window, + int dx, + int dy ) +{ + DFBWindowEvent evt; + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + dfb_rectangle_translate( &window->bounds, dx, dy ); + dfb_rectangle_translate( &window->full, dx, dy ); + + stret_region_move( window->frame, dx, dy ); + + if (D_FLAGS_IS_SET( window->flags, UWF_VISIBLE )) { + DFBRegion region = { 0, 0, window->full.w - 1, window->full.h - 1 }; + + if (dx > 0) + region.x1 -= dx; + else if (dx < 0) + region.x2 -= dx; + + if (dy > 0) + region.y1 -= dy; + else if (dy < 0) + region.y2 -= dy; + + update_frame( window, ®ion, DSFLIP_NONE, false ); + } + + /* Send new position */ + evt.type = DWET_POSITION; + evt.x = window->bounds.x; + evt.y = window->bounds.y; + + unique_window_post_event( window, &evt ); + + return DFB_OK; +} + +static DFBResult +resize_window( UniqueWindow *window, + int width, + int height ) +{ + DFBResult ret; + DFBWindowEvent evt; + int ow; + int oh; + UniqueContext *context; + WMShared *shared; + DFBRectangle *sizes; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_ASSERT( width > 0 ); + D_ASSERT( height > 0 ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + shared = context->shared; + + D_MAGIC_ASSERT( shared, WMShared ); + + sizes = shared->foo_rects; + + if (width > 4096 || height > 4096) + return DFB_LIMITEXCEEDED; + + if (window->surface) { + ret = dfb_surface_reformat( window->surface, width, height, window->surface->config.format ); + if (ret) + return ret; + } + + ow = window->bounds.w; + oh = window->bounds.h; + + window->bounds.w = width; + window->bounds.h = height; + + window->full.w += width - ow; + window->full.h += height - oh; + + stret_region_resize( window->frame, window->full.w, window->full.h ); + stret_region_resize( window->region, window->bounds.w, window->bounds.h ); + + update_foo_frame( window, window->context, window->shared ); + + if (D_FLAGS_IS_SET( window->flags, UWF_VISIBLE )) { + int dw = ow - width; + int dh = oh - height; + + if (D_FLAGS_IS_SET( window->flags, UWF_DECORATED )) { + int bw = dw - sizes[UFI_NE].w + sizes[UFI_E].w; + int bh = dh - sizes[UFI_SW].h + sizes[UFI_S].h; + DFBInsets *in = &window->insets; + + if (bw < 0) { + DFBRegion region = { in->l + width + bw, 0, in->l + width - 1, in->t - 1 }; + + update_frame( window, ®ion, 0, false ); + } + + if (bh < 0) { + DFBRegion region = { 0, in->t + height + bh, in->l - 1, in->t + height - 1 }; + + update_frame( window, ®ion, 0, false ); + } + + if (dw < 0) + dw = 0; + + if (dh < 0) + dh = 0; + + dw += in->r; + dh += in->b; + + if (dw > 0) { + DFBRegion region = { in->l + width, 0, in->l + width + dw - 1, in->t + height - 1 }; + + update_frame( window, ®ion, 0, false ); + } + + if (dh > 0) { + DFBRegion region = { 0, in->t + height, in->l + width + dw - 1, in->t + height + dh - 1 }; + + update_frame( window, ®ion, 0, false ); + } + } + else { + if (dw < 0) + dw = 0; + + if (dh < 0) + dh = 0; + + if (dw > 0) { + DFBRegion region = { width, 0, width + dw - 1, height - 1 }; + + update_frame( window, ®ion, 0, false ); + } + + if (dh > 0) { + DFBRegion region = { 0, height, width + dw - 1, height + dh - 1 }; + + update_frame( window, ®ion, 0, false ); + } + } + } + + /* Send new size */ + evt.type = DWET_SIZE; + evt.w = window->bounds.w; + evt.h = window->bounds.h; + + unique_window_post_event( window, &evt ); + + unique_input_switch_update( context->input_switch, window->channel ); + //unique_context_update_focus( context ); + + return DFB_OK; +} + +static DFBResult +restack_window( UniqueWindow *window, + UniqueWindow *relative, + int relation, + DFBWindowStackingClass stacking ) +{ + int old; + int index; + int priority; + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + D_MAGIC_ASSERT_IF( relative, UniqueWindow ); + + D_ASSERT( relative == NULL || relative == window || relation != 0); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + /* Change stacking class. */ + if (stacking != window->stacking) { + window->stacking = stacking; + window->priority = get_priority( window->caps, stacking ); + } + + /* Get the (new) priority. */ + priority = window->priority; + + /* Get the old index. */ + old = get_index( window ); + + /* Calculate the desired index. */ + if (relative) { + index = get_index( relative ); + + if (relation > 0) { + if (old < index) + index--; + } + else if (relation < 0) { + if (old > index) + index++; + } + + index += relation; + + if (index < 0) + index = 0; + else if (index > fusion_vector_size( &context->windows ) - 1) + index = fusion_vector_size( &context->windows ) - 1; + } + else if (relation) + index = fusion_vector_size( &context->windows ) - 1; + else + index = 0; + + /* Assure window won't be above any window with a higher priority. */ + while (index > 0) { + int below = (old < index) ? index : index - 1; + UniqueWindow *other = fusion_vector_at( &context->windows, below ); + + D_MAGIC_ASSERT( other, UniqueWindow ); + + if (priority < other->priority) + index--; + else + break; + } + + /* Assure window won't be below any window with a lower priority. */ + while (index < fusion_vector_size( &context->windows ) - 1) { + int above = (old > index) ? index : index + 1; + UniqueWindow *other = fusion_vector_at( &context->windows, above ); + + D_MAGIC_ASSERT( other, UniqueWindow ); + + if (priority > other->priority) + index++; + else + break; + } + + /* Return if index hasn't changed. */ + if (index == old) + return DFB_OK; + + /* Actually change the stacking order now. */ + fusion_vector_move( &context->windows, old, index ); + + stret_region_restack( window->frame, index ); + + update_frame( window, NULL, DSFLIP_NONE, (index < old) ); + + if (index < old) + unique_input_switch_update( context->input_switch, window->channel ); + + return DFB_OK; +} + +static void +set_opacity( UniqueWindow *window, + u8 opacity ) +{ + u8 old; + UniqueContext *context; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + old = window->opacity; + + if (!dfb_config->translucent_windows && opacity) + opacity = 0xFF; + + if (old != opacity) { + bool show = !old && opacity; + bool hide = old && !opacity; + + window->opacity = opacity; + + if (show) { + stret_region_enable( window->frame, SRF_ACTIVE ); + + D_FLAGS_SET( window->flags, UWF_VISIBLE ); + } + + if (hide) + D_FLAGS_CLEAR( window->flags, UWF_VISIBLE ); + + if (! (window->options & (DWOP_ALPHACHANNEL | DWOP_COLORKEYING))) { + if (opacity == 0xff && old != 0xff) + stret_region_enable( window->region, SRF_OPAQUE ); + else if (opacity != 0xff && old == 0xff) + stret_region_disable( window->region, SRF_OPAQUE ); + } + + update_frame( window, NULL, DSFLIP_NONE, false ); + + + /* Check focus after window appeared or disappeared */ + if (/*show ||*/ hide) + unique_input_switch_update( context->input_switch, window->channel ); +// unique_context_update_focus( context ); + + /* If window disappeared... */ + if (hide) { + stret_region_disable( window->frame, SRF_ACTIVE ); + + /* Ungrab pointer/keyboard, release focus */ + unique_input_switch_drop( context->input_switch, window->channel ); + } + } +} + +/**************************************************************************************************/ + +static void +foo_rects( UniqueWindow *window, + UniqueContext *context, + WMShared *shared, + DFBRectangle *ret_rects ) +{ + int width; + int height; + DFBRectangle *sizes; + + D_MAGIC_ASSERT( window, UniqueWindow ); + D_MAGIC_ASSERT( context, UniqueContext ); + + D_MAGIC_ASSERT( shared, WMShared ); + D_ASSERT( ret_rects != NULL ); + + width = window->full.w; + height = window->full.h; + + sizes = shared->foo_rects; + + if (width <= sizes[UFI_NW].w + sizes[UFI_NE].w) + width = sizes[UFI_NW].w + sizes[UFI_NE].w + 1; + + if (width <= sizes[UFI_SW].w + sizes[UFI_SE].w) + width = sizes[UFI_SW].w + sizes[UFI_SE].w + 1; + + if (height <= sizes[UFI_NW].h + sizes[UFI_SW].h) + height = sizes[UFI_NW].h + sizes[UFI_SW].h + 1; + + if (height <= sizes[UFI_NE].h + sizes[UFI_SE].h) + height = sizes[UFI_NE].h + sizes[UFI_SE].h + 1; + + ret_rects[UFI_N].x = sizes[UFI_NW].w; + ret_rects[UFI_N].y = 0; + ret_rects[UFI_N].w = width - sizes[UFI_NW].w - sizes[UFI_NE].w; + ret_rects[UFI_N].h = sizes[UFI_N].h; + + ret_rects[UFI_NE].x = width - sizes[UFI_NE].w; + ret_rects[UFI_NE].y = 0; + ret_rects[UFI_NE].w = sizes[UFI_NE].w; + ret_rects[UFI_NE].h = sizes[UFI_NE].h; + + ret_rects[UFI_E].x = width - sizes[UFI_E].w; + ret_rects[UFI_E].y = sizes[UFI_NE].h; + ret_rects[UFI_E].w = sizes[UFI_E].w; + ret_rects[UFI_E].h = height - sizes[UFI_NE].h - sizes[UFI_SE].h; + + ret_rects[UFI_SE].x = width - sizes[UFI_SE].w; + ret_rects[UFI_SE].y = height - sizes[UFI_SE].h; + ret_rects[UFI_SE].w = sizes[UFI_SE].w; + ret_rects[UFI_SE].h = sizes[UFI_SE].h; + + ret_rects[UFI_S].x = sizes[UFI_SW].w; + ret_rects[UFI_S].y = height - sizes[UFI_S].h; + ret_rects[UFI_S].w = width - sizes[UFI_SE].w - sizes[UFI_SW].w; + ret_rects[UFI_S].h = sizes[UFI_S].h; + + ret_rects[UFI_SW].x = 0; + ret_rects[UFI_SW].y = height - sizes[UFI_SW].h; + ret_rects[UFI_SW].w = sizes[UFI_SW].w; + ret_rects[UFI_SW].h = sizes[UFI_SW].h; + + ret_rects[UFI_W].x = 0; + ret_rects[UFI_W].y = sizes[UFI_NW].h; + ret_rects[UFI_W].w = sizes[UFI_W].w; + ret_rects[UFI_W].h = height - sizes[UFI_NW].h - sizes[UFI_SW].h; + + ret_rects[UFI_NW].x = 0; + ret_rects[UFI_NW].y = 0; + ret_rects[UFI_NW].w = sizes[UFI_NW].w; + ret_rects[UFI_NW].h = sizes[UFI_NW].h; +} + +static void +update_foo_frame( UniqueWindow *window, + UniqueContext *context, + WMShared *shared ) +{ + int i; + DFBRectangle rects[8]; + + D_MAGIC_ASSERT( window, UniqueWindow ); + D_MAGIC_ASSERT( context, UniqueContext ); + D_MAGIC_ASSERT( shared, WMShared ); + + if (!window->foos[0]) + return; + + foo_rects( window, context, shared, rects ); + + for (i=0; i<8; i++) + window->foos[i]->bounds = DFB_REGION_INIT_FROM_RECTANGLE( &rects[i] ); +} + +static void +update_flags( UniqueWindow *window ) +{ + int i; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + if (! (window->options & DWOP_GHOST)) { + if (window->foos[0]) { + for (i=0; i<8; i++) + window->foos[i]->flags |= SRF_INPUT; + } + + window->region->flags |= SRF_INPUT; + } + else { + if (window->foos[0]) { + for (i=0; i<8; i++) + window->foos[i]->flags &= ~SRF_INPUT; + } + + window->region->flags &= ~SRF_INPUT; + } +} + +static DFBResult +create_foos( UniqueWindow *window, + UniqueContext *context, + WMShared *shared ) +{ + int i; + DFBResult ret; + DFBRectangle rects[8]; + StretRegionFlags flags = SRF_ACTIVE | SRF_OUTPUT; + + D_MAGIC_ASSERT( window, UniqueWindow ); + D_MAGIC_ASSERT( context, UniqueContext ); + D_MAGIC_ASSERT( shared, WMShared ); + + + foo_rects( window, context, shared, rects ); + + if (! (window->options & DWOP_GHOST)) + flags |= SRF_INPUT; + + for (i=0; i<8; i++) { + ret = stret_region_create( shared->region_classes[URCI_FOO], window, i, flags, 1, + DFB_RECTANGLE_VALS( &rects[i] ), + window->frame, UNFL_FOREGROUND, + context->shmpool, &window->foos[i] ); + if (ret) + goto error; + } + + return DFB_OK; + +error: + for (--i; i>0; --i) + stret_region_destroy( window->foos[i] ); + + return ret; +} + +static DFBResult +create_regions( UniqueWindow *window ) +{ + DFBResult ret; + UniqueContext *context; + WMShared *shared; + StretRegionFlags flags = SRF_ACTIVE; + + D_MAGIC_ASSERT( window, UniqueWindow ); + + context = window->context; + + D_MAGIC_ASSERT( context, UniqueContext ); + + shared = context->shared; + + D_MAGIC_ASSERT( shared, WMShared ); + + if (! (window->options & DWOP_GHOST)) + flags |= SRF_INPUT; + + if (! (window->caps & DWCAPS_INPUTONLY)) + flags |= SRF_OUTPUT; + + if (window->options & DWOP_SHAPED) + flags |= SRF_SHAPED; + + /* Frame */ + ret = stret_region_create( shared->region_classes[URCI_FRAME], window, 0, SRF_NONE, _UNFL_NUM, + DFB_RECTANGLE_VALS( &window->full ), + context->root, UNRL_USER, context->shmpool, &window->frame ); + if (ret) + return ret; + + /* Content */ + ret = stret_region_create( shared->region_classes[URCI_WINDOW], window, true, flags, 1, + window->insets.l, window->insets.t, + window->bounds.w, window->bounds.h, + window->frame, UNFL_CONTENT, context->shmpool, &window->region ); + if (ret) { + stret_region_destroy( window->frame ); + return ret; + } + + /* Foos */ + if (D_FLAGS_IS_SET( window->flags, UWF_DECORATED )) { + ret = create_foos( window, context, shared ); + if (ret) { + stret_region_destroy( window->region ); + stret_region_destroy( window->frame ); + return ret; + } + } + + return DFB_OK; +} + diff --git a/Source/DirectFB/wm/unique/window.h b/Source/DirectFB/wm/unique/window.h new file mode 100755 index 0000000..be75e96 --- /dev/null +++ b/Source/DirectFB/wm/unique/window.h @@ -0,0 +1,135 @@ +/* + (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 , + Andreas Hundt , + Sven Neumann , + Ville Syrjälä and + Claudio Ciccani . + + 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 __UNIQUE__WINDOW_H__ +#define __UNIQUE__WINDOW_H__ + +#include +#include + +#include + + +typedef enum { + UWF_NONE = 0x00000000, + + UWF_VISIBLE = 0x00000001, + UWF_DECORATED = 0x00000002, + + UWF_DESTROYED = 0x00000010, + + UWF_ALL = 0x00000013 +} UniqueWindowFlags; + + +typedef enum { + UWNF_NONE = 0x00000000, + + UWNF_DESTROYED = 0x00000001, + + UWNF_UPDATE = 0x00000010, + + UWNF_ALL = 0x00000011 +} UniqueWindowNotificationFlags; + +typedef struct { + UniqueWindowNotificationFlags flags; + UniqueWindow *window; + + DFBRegion update; +} UniqueWindowNotification; + + + +DFBResult unique_window_create ( CoreDFB *core, + CoreWindow *window, + UniqueContext *context, + DFBWindowCapabilities caps, + const CoreWindowConfig *config, + UniqueWindow **ret_window ); + +DFBResult unique_window_close ( UniqueWindow *window ); + +DFBResult unique_window_destroy ( UniqueWindow *window ); + + +DFBResult unique_window_notify ( UniqueWindow *window, + UniqueWindowNotificationFlags flags ); + + +DFBResult unique_window_update ( UniqueWindow *window, + const DFBRegion *region, + DFBSurfaceFlipFlags flags ); + +DFBResult unique_window_post_event ( UniqueWindow *window, + DFBWindowEvent *event ); + +DFBResult unique_window_set_config ( UniqueWindow *window, + const CoreWindowConfig *config, + CoreWindowConfigFlags flags ); + +DFBResult unique_window_get_config ( UniqueWindow *window, + CoreWindowConfig *config ); + + +DFBResult unique_window_restack ( UniqueWindow *window, + UniqueWindow *relative, + int relation ); + + +DFBResult unique_window_grab ( UniqueWindow *window, + const CoreWMGrab *grab ); + +DFBResult unique_window_ungrab ( UniqueWindow *window, + const CoreWMGrab *grab ); + +DFBResult unique_window_request_focus( UniqueWindow *window ); + + + + +/* + * Creates a pool of window objects. + */ +FusionObjectPool *unique_window_pool_create( const FusionWorld *world ); + +/* + * Generates unique_window_ref(), unique_window_attach() etc. + */ +FUSION_OBJECT_METHODS( UniqueWindow, unique_window ) + + +/* global reactions */ + +typedef enum { + UNIQUE_WM_MODULE_WINDOW_LISTENER +} UNIQUE_WINDOW_GLOBALS; + + +#endif + -- cgit