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/SaWMan/samples/Makefile.am | 18 + Source/SaWMan/samples/Makefile.in | 499 ++++++++++++++++++++++ Source/SaWMan/samples/sample1.c | 135 ++++++ Source/SaWMan/samples/testman.c | 851 ++++++++++++++++++++++++++++++++++++++ Source/SaWMan/samples/testrun.c | 90 ++++ 5 files changed, 1593 insertions(+) create mode 100755 Source/SaWMan/samples/Makefile.am create mode 100755 Source/SaWMan/samples/Makefile.in create mode 100755 Source/SaWMan/samples/sample1.c create mode 100755 Source/SaWMan/samples/testman.c create mode 100755 Source/SaWMan/samples/testrun.c (limited to 'Source/SaWMan/samples') diff --git a/Source/SaWMan/samples/Makefile.am b/Source/SaWMan/samples/Makefile.am new file mode 100755 index 0000000..87fe02f --- /dev/null +++ b/Source/SaWMan/samples/Makefile.am @@ -0,0 +1,18 @@ +## Makefile.am for SaWMan/samples + +INCLUDES = \ + -I$(top_srcdir)/include \ + $(DFB_CFLAGS) + + +bin_PROGRAMS = sample1 testman testrun + + +sample1_SOURCES = sample1.c +sample1_LDADD = $(DFB_LIBS) ../src/libsawman.la + +testman_SOURCES = testman.c +testman_LDADD = $(DFB_LIBS) ../src/libsawman.la + +testrun_SOURCES = testrun.c +testrun_LDADD = $(DFB_LIBS) ../src/libsawman.la diff --git a/Source/SaWMan/samples/Makefile.in b/Source/SaWMan/samples/Makefile.in new file mode 100755 index 0000000..92e36d8 --- /dev/null +++ b/Source/SaWMan/samples/Makefile.in @@ -0,0 +1,499 @@ +# 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@ +bin_PROGRAMS = sample1$(EXEEXT) testman$(EXEEXT) testrun$(EXEEXT) +subdir = samples +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(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__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_sample1_OBJECTS = sample1.$(OBJEXT) +sample1_OBJECTS = $(am_sample1_OBJECTS) +am__DEPENDENCIES_1 = +sample1_DEPENDENCIES = $(am__DEPENDENCIES_1) ../src/libsawman.la +am_testman_OBJECTS = testman.$(OBJEXT) +testman_OBJECTS = $(am_testman_OBJECTS) +testman_DEPENDENCIES = $(am__DEPENDENCIES_1) ../src/libsawman.la +am_testrun_OBJECTS = testrun.$(OBJEXT) +testrun_OBJECTS = $(am_testrun_OBJECTS) +testrun_DEPENDENCIES = $(am__DEPENDENCIES_1) ../src/libsawman.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 = $(sample1_SOURCES) $(testman_SOURCES) $(testrun_SOURCES) +DIST_SOURCES = $(sample1_SOURCES) $(testman_SOURCES) \ + $(testrun_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +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 = @DFB_CFLAGS@ +DFB_LIBS = @DFB_LIBS@ +DSYMUTIL = @DSYMUTIL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +INCLUDEDIR = @INCLUDEDIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_AGE = @LT_AGE@ +LT_CURRENT = @LT_CURRENT@ +LT_RELEASE = @LT_RELEASE@ +LT_REVISION = @LT_REVISION@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MODULEDIR = @MODULEDIR@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +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@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SAWMAN_BINARY_AGE = @SAWMAN_BINARY_AGE@ +SAWMAN_INTERFACE_AGE = @SAWMAN_INTERFACE_AGE@ +SAWMAN_MAJOR_VERSION = @SAWMAN_MAJOR_VERSION@ +SAWMAN_MICRO_VERSION = @SAWMAN_MICRO_VERSION@ +SAWMAN_MINOR_VERSION = @SAWMAN_MINOR_VERSION@ +SAWMAN_VERSION = @SAWMAN_VERSION@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +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_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +INCLUDES = \ + -I$(top_srcdir)/include \ + $(DFB_CFLAGS) + +sample1_SOURCES = sample1.c +sample1_LDADD = $(DFB_LIBS) ../src/libsawman.la +testman_SOURCES = testman.c +testman_LDADD = $(DFB_LIBS) ../src/libsawman.la +testrun_SOURCES = testrun.c +testrun_LDADD = $(DFB_LIBS) ../src/libsawman.la +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 samples/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu samples/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-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 +sample1$(EXEEXT): $(sample1_OBJECTS) $(sample1_DEPENDENCIES) + @rm -f sample1$(EXEEXT) + $(LINK) $(sample1_OBJECTS) $(sample1_LDADD) $(LIBS) +testman$(EXEEXT): $(testman_OBJECTS) $(testman_DEPENDENCIES) + @rm -f testman$(EXEEXT) + $(LINK) $(testman_OBJECTS) $(testman_LDADD) $(LIBS) +testrun$(EXEEXT): $(testrun_OBJECTS) $(testrun_DEPENDENCIES) + @rm -f testrun$(EXEEXT) + $(LINK) $(testrun_OBJECTS) $(testrun_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testman.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testrun.Po@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 $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool 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-binPROGRAMS + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool ctags 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-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 \ + uninstall-binPROGRAMS + +# 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/SaWMan/samples/sample1.c b/Source/SaWMan/samples/sample1.c new file mode 100755 index 0000000..d0a2421 --- /dev/null +++ b/Source/SaWMan/samples/sample1.c @@ -0,0 +1,135 @@ +/* + (c) Copyright 2006-2007 directfb.org + + All rights reserved. + + Written by Denis Oliver Kropp . + + 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 + + +#define CHECK(x) \ + do { \ + DFBResult ret = (x); \ + if (ret != DFB_OK) { \ + DirectFBError(#x,ret); \ + goto out; \ + } \ + } while (0) + + +static DirectResult +start_request( void *context, + const char *name, + pid_t *ret_pid ) +{ + D_INFO( "SaWMan/Sample1: Start request for '%s'!\n", name ); + + return DFB_UNIMPLEMENTED; +} + +static DirectResult +stop_request( void *context, + pid_t pid, + FusionID caller ) +{ + D_INFO( "SaWMan/Sample1: Stop request from Fusion ID 0x%lx for pid %d!\n", caller, pid ); + + return DFB_OK; +} + +static DirectResult +process_added( void *context, + SaWManProcess *process ) +{ + D_INFO( "SaWMan/Sample1: Process added (%d) [%lu]!\n", process->pid, process->fusion_id ); + + return DFB_OK; +} + +static DirectResult +process_removed( void *context, + SaWManProcess *process ) +{ + D_INFO( "SaWMan/Sample1: Process removed (%d) [%lu]!\n", process->pid, process->fusion_id ); + + return DFB_OK; +} + + +static const SaWManCallbacks callbacks = { + Start: start_request, + Stop: stop_request, + ProcessAdded: process_added, + ProcessRemoved: process_removed +}; + + + +int +main( int argc, char** argv ) +{ + IDirectFB *dfb = NULL; + ISaWMan *saw = NULL; + ISaWManManager *manager = NULL; + + D_INFO( "SaWMan/Sample1: Initializing...\n" ); + + CHECK( DirectFBInit( &argc, &argv ) ); + + CHECK( DirectFBCreate( &dfb ) ); + + CHECK( SaWManCreate( &saw ) ); + + CHECK( saw->CreateManager( saw, &callbacks, NULL, &manager ) ); + + pause(); + + +out: + D_INFO( "SaWMan/Sample1: Shutting down...\n" ); + + if (manager) + manager->Release( manager ); + + if (saw) + saw->Release( saw ); + + if (dfb) + dfb->Release( dfb ); + + return 0; +} + diff --git a/Source/SaWMan/samples/testman.c b/Source/SaWMan/samples/testman.c new file mode 100755 index 0000000..d2af297 --- /dev/null +++ b/Source/SaWMan/samples/testman.c @@ -0,0 +1,851 @@ +/* + (c) Copyright 2006-2007 directfb.org + + All rights reserved. + + Written by Denis Oliver Kropp . + + 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 + +#define MAX_WINDOWS 4 +#define MAX_LAYOUTS 4 + +#define CHECK(x) \ + do { \ + DFBResult ret = (x); \ + if (ret != DFB_OK) { \ + DirectFBError(#x,ret); \ + goto out; \ + } \ + } while (0) + + +typedef struct __TestMan_TestManager TestManager; +typedef struct __TestMan_Layout Layout; +typedef struct __TestMan_Application Application; + +/**********************************************************************************************************************/ + +struct __TestMan_TestManager { + int magic; + + IDirectFB *dfb; + ISaWMan *saw; + ISaWManManager *manager; + + SaWManScalingMode scaling_mode; + + SaWManWindowHandle windows[MAX_WINDOWS]; + int num_windows; + SaWManWindowHandle focus_window; + + const Layout *layouts[MAX_LAYOUTS]; + int num_layouts; + int current_layout; + + DirectLink *applications; +}; + +struct __TestMan_Layout { + void *data; + + void (*Relayout) ( TestManager *tm, + void *layout_data ); + + void (*AddWindow) ( TestManager *tm, + void *layout_data, + SaWManWindowHandle window ); + + void (*RemoveWindow)( TestManager *tm, + void *layout_data, + SaWManWindowHandle window, + int index ); +}; + +struct __TestMan_Application { + DirectLink link; + + int magic; + + const char *name; + const char *program; + const char *args; + + bool started; + + long long start_time; + pid_t pid; + SaWManProcess *process; +}; + +/**********************************************************************************************************************/ + +static void +AddApplication( TestManager *tm, + const char *name, + const char *program, + const char *args ) +{ + Application *app; + + D_MAGIC_ASSERT( tm, TestManager ); + D_ASSERT( name != NULL ); + D_ASSERT( program != NULL ); + + app = D_CALLOC( 1, sizeof(Application) ); + if (!app) { + D_OOM(); + return; + } + + app->name = name; + app->program = program; + app->args = args; + + direct_list_append( &tm->applications, &app->link ); + + D_MAGIC_SET( app, Application ); +} + +static Application * +LookupApplication( TestManager *tm, + const char *name ) +{ + Application *app; + + D_MAGIC_ASSERT( tm, TestManager ); + D_ASSERT( name != NULL ); + + direct_list_foreach (app, tm->applications) { + D_MAGIC_ASSERT( app, Application ); + + if (!strcmp( app->name, name )) + return app; + } + + return NULL; +} + +static Application * +LookupApplicationByPID( TestManager *tm, + pid_t pid ) +{ + Application *app; + + D_MAGIC_ASSERT( tm, TestManager ); + + direct_list_foreach (app, tm->applications) { + D_MAGIC_ASSERT( app, Application ); + + if (app->pid == pid) + return app; + } + + return NULL; +} + +/**********************************************************************************************************************/ + +static void +MosaicRelayout( TestManager *tm, + void *layout_data ) +{ + int i; + int hcenter; + int vcenter; + ISaWManManager *manager; + DFBRectangle bounds[4]; + DFBDimension size; + + D_MAGIC_ASSERT( tm, TestManager ); + + if (!tm->num_windows) + return; + + manager = tm->manager; + D_ASSERT( manager != NULL ); + + manager->Lock( manager ); + + manager->GetSize( manager, DWSC_MIDDLE, &size ); + + hcenter = (size.w / 2) & ~1; + vcenter = size.h / 2; + + switch (tm->num_windows) { + case 0: + case 1: + bounds[0].x = 0; + bounds[0].y = 0; + bounds[0].w = size.w; + bounds[0].h = size.h; + + break; + + case 2: + bounds[0].x = 0; + bounds[0].y = 0; + bounds[0].w = hcenter; + bounds[0].h = size.h; + + bounds[1].x = hcenter; + bounds[1].y = 0; + bounds[1].w = size.w - hcenter; + bounds[1].h = size.h; + + break; + + case 3: + bounds[0].x = 0; + bounds[0].y = 0; + bounds[0].w = hcenter; + bounds[0].h = vcenter; + + bounds[1].x = 0; + bounds[1].y = vcenter; + bounds[1].w = hcenter; + bounds[1].h = size.h - vcenter; + + bounds[2].x = hcenter; + bounds[2].y = 0; + bounds[2].w = size.w - hcenter; + bounds[2].h = size.h; + + break; + + case 4: + bounds[0].x = 0; + bounds[0].y = 0; + bounds[0].w = hcenter; + bounds[0].h = vcenter; + + bounds[1].x = 0; + bounds[1].y = vcenter; + bounds[1].w = hcenter; + bounds[1].h = size.h - vcenter; + + bounds[2].x = hcenter; + bounds[2].y = 0; + bounds[2].w = size.w - hcenter; + bounds[2].h = vcenter; + + bounds[3].x = hcenter; + bounds[3].y = vcenter; + bounds[3].w = size.w - hcenter; + bounds[3].h = size.h - vcenter; + + break; + + default: + D_BUG( "invalid number of windows (%d)", tm->num_windows ); + break; + } + + for (i=0; inum_windows; i++) { + SaWManWindowHandle window = tm->windows[i]; + SaWManWindowConfig config; + SaWManWindowConfigFlags flags; + + flags = SWMCF_POSITION | SWMCF_SIZE; + config.bounds = bounds[i]; + manager->SetWindowConfig( manager, window, flags, &config ); + } + + manager->QueueUpdate( manager, DWSC_MIDDLE, NULL ); + + manager->Unlock( manager ); +} + +static void +MosaicAddWindow( TestManager *tm, + void *layout_data, + SaWManWindowHandle window ) +{ + ISaWManManager *manager; + + D_MAGIC_ASSERT( tm, TestManager ); + + manager = tm->manager; + D_ASSERT( manager != NULL ); + + manager->Lock( manager ); + + tm->windows[tm->num_windows++] = window; + + manager->InsertWindow( manager, window, SAWMAN_WINDOW_NONE, SWMWR_TOP ); + + MosaicRelayout( tm, layout_data ); + + manager->Unlock( manager ); +} + +static void +MosaicRemoveWindow( TestManager *tm, + void *layout_data, + SaWManWindowHandle window, + int index ) +{ + ISaWManManager *manager; + + D_MAGIC_ASSERT( tm, TestManager ); + + manager = tm->manager; + D_ASSERT( manager != NULL ); + + manager->Lock( manager ); + + /* Remove window from layout. */ + manager->RemoveWindow( manager, window ); + + MosaicRelayout( tm, layout_data ); + + manager->Unlock( manager ); +} + +static const Layout mosaic_layout = { + data: NULL, + Relayout: MosaicRelayout, + AddWindow: MosaicAddWindow, + RemoveWindow: MosaicRemoveWindow +}; + +/**********************************************************************************************************************/ + +static DFBResult +LayoutWindowAdd( TestManager *tm, + SaWManWindowHandle window ) +{ + const Layout *layout; + + D_MAGIC_ASSERT( tm, TestManager ); + + D_ASSERT( tm->current_layout >= 0 ); + D_ASSERT( tm->current_layout < tm->num_layouts ); + + layout = tm->layouts[tm->current_layout]; + + D_ASSERT( layout != NULL ); + D_ASSERT( layout->AddWindow != NULL ); + + if (tm->num_windows == MAX_WINDOWS) { + D_WARN( "maximum number (%d) of managed windows exceeded", MAX_WINDOWS ); + return DFB_LIMITEXCEEDED; + } + + /* Set some default borders. */ + //window->border_normal = 2; + //window->border_fullscreen = 4; + + /* Call the layout implementation. */ + layout->AddWindow( tm, layout->data, window ); + + return DFB_OK; +} + +static DFBResult +LayoutWindowRemove( TestManager *tm, + SaWManWindowHandle window ) +{ + int i; + const Layout *layout; + + D_MAGIC_ASSERT( tm, TestManager ); + + D_ASSERT( tm->current_layout >= 0 ); + D_ASSERT( tm->current_layout < tm->num_layouts ); + + layout = tm->layouts[tm->current_layout]; + + D_ASSERT( layout != NULL ); + D_ASSERT( layout->RemoveWindow != NULL ); + + for (i=0; inum_windows; i++) { + if (tm->windows[i] == window) + break; + } + + if (i == MAX_WINDOWS) { + D_BUG( "could not find window %lx", window ); + return DFB_BUG; + } + + /* Remove window from our own list of managed windows. */ + for (; inum_windows-1; i++) + tm->windows[i] = tm->windows[i+1]; + + tm->windows[i] = SAWMAN_WINDOW_NONE; + + tm->num_windows--; + + /* Call the layout implementation. */ + layout->RemoveWindow( tm, layout->data, window, i ); + + return DFB_OK; +} + +/**********************************************************************************************************************/ + +static DirectResult +start_request( void *context, + const char *name, + pid_t *ret_pid ) +{ + TestManager *tm = context; + Application *app; + pid_t pid; + const char *args[3]; + + D_INFO( "SaWMan/TestMan: Start request for '%s'!\n", name ); + + D_MAGIC_ASSERT( tm, TestManager ); + D_ASSERT( name != NULL ); + D_ASSERT( ret_pid != NULL ); + + app = LookupApplication( tm, name ); + if (!app) + return DFB_ITEMNOTFOUND; + + if (app->started && !waitpid( app->pid, NULL, WNOHANG )) { + D_DEBUG( "Already running '%s' (%d)!", name, app->pid ); + return DFB_BUSY; + } + + app->started = true; + + app->start_time = direct_clock_get_millis(); + + pid = vfork(); + + switch (pid) { + case -1: + perror("vfork"); + return DFB_FAILURE; + + case 0: + setsid(); + + args[0] = app->program; + args[1] = app->args; + args[2] = NULL; + + execvp( app->program, (char**) args ); + perror("execvp"); + _exit(0); + + default: + app->pid = pid; + break; + } + + *ret_pid = pid; + + return DFB_OK; +} + +static DirectResult +stop_request( void *context, + pid_t pid, + FusionID caller ) +{ + TestManager *tm = context; + Application *app; + + D_INFO( "SaWMan/TestMan: Stop request from Fusion ID 0x%lx for pid %d!\n", caller, pid ); + + D_MAGIC_ASSERT( tm, TestManager ); + + app = LookupApplicationByPID( tm, pid ); + if (!app) + return DFB_ITEMNOTFOUND; + + /* Already died before attaching? */ + if (waitpid( app->pid, NULL, WNOHANG )) { + app->started = false; + app->pid = 0; + + return DFB_OK; + } + + /* Not attached yet? */ + if (!app->process) { + D_ERROR( "Application with pid %d did not attach yet!\n", app->pid ); + return DFB_NOCONTEXT; + } + + /* FIXME: avoid signals */ + kill( app->pid, 9 ); + + return DFB_OK; +} + +static DirectResult +process_added( void *context, + SaWManProcess *process ) +{ + TestManager *tm = context; + Application *app; + + D_INFO( "SaWMan/TestMan: Process added (%d) [%lu]!\n", process->pid, process->fusion_id ); + + D_MAGIC_ASSERT( tm, TestManager ); + + app = LookupApplicationByPID( tm, process->pid ); + if (!app) + return DFB_ITEMNOTFOUND; + + if (app->process) { + D_BUG( "Already attached '%s' (%d)!", app->name, app->pid ); + return DFB_BUG; + } + + app->process = process; + + return DFB_OK; +} + +static DirectResult +process_removed( void *context, + SaWManProcess *process ) +{ + TestManager *tm = context; + Application *app; + + D_INFO( "SaWMan/TestMan: Process removed (%d) [%lu]!\n", process->pid, process->fusion_id ); + + D_MAGIC_ASSERT( tm, TestManager ); + + app = LookupApplicationByPID( tm, process->pid ); + if (!app) + return DFB_ITEMNOTFOUND; + + if (app->process != process) { + D_BUG( "Process mismatch %p != %p of '%s' (%d)!", app->process, process, app->name, app->pid ); + return DFB_BUG; + } + + if (waitpid( app->pid, NULL, 0 ) < 0) + perror("waitpid"); + + app->process = NULL; + app->started = false; + app->pid = 0; + + return DFB_OK; +} + +static DirectResult +input_filter( void *context, + DFBInputEvent *event ) +{ + int i; + TestManager *tm = context; + ISaWManManager *manager; + +// D_INFO( "SaWMan/TestMan: Input filter (%x)!\n", event->type ); + + D_MAGIC_ASSERT( tm, TestManager ); + + manager = tm->manager; + + D_ASSERT( manager != NULL ); + + manager->Lock( manager ); + + switch (event->type) { + case DIET_KEYPRESS: + switch (event->key_symbol) { + case DIKS_F9: + if (tm->num_windows > 1) { + for (i=0; inum_windows; i++) { + SaWManWindowHandle window = tm->windows[i]; + + if (window == tm->focus_window) { + window = tm->windows[(i+1) % tm->num_windows]; + + manager->SwitchFocus( manager, window ); + + break; + } + } + } + manager->Unlock( manager ); + return DFB_BUSY; + + case DIKS_F10: + if (tm->num_layouts > 1) { + const Layout *layout; + + if (++tm->current_layout == tm->num_layouts) + tm->current_layout = 0; + + layout = tm->layouts[tm->current_layout]; + + D_ASSERT( layout != NULL ); + D_ASSERT( layout->Relayout != NULL ); + + layout->Relayout( tm, layout->data ); + } + manager->Unlock( manager ); + return DFB_BUSY; + + case DIKS_F11: + tm->scaling_mode = (tm->scaling_mode == SWMSM_SMOOTH_SW) ? SWMSM_STANDARD : SWMSM_SMOOTH_SW; + manager->SetScalingMode( manager, tm->scaling_mode ); + manager->Unlock( manager ); + return DFB_BUSY; + + default: + break; + } + + case DIET_KEYRELEASE: + switch (event->key_symbol) { + case DIKS_F9: + case DIKS_F10: + case DIKS_F11: + manager->Unlock( manager ); + return DFB_BUSY; + + default: + break; + } + + default: + break; + } + + manager->Unlock( manager ); + return DFB_OK; +} + + +static DirectResult +window_preconfig( void *context, + SaWManWindowConfig *config ) +{ + D_INFO( "SaWMan/TestMan: Window preconfig (%d,%d-%dx%d)!\n", + DFB_RECTANGLE_VALS( &config->bounds ) ); + + return DFB_OK; +} + +static DirectResult +window_added( void *context, + SaWManWindowInfo *info ) +{ + DFBResult ret; + TestManager *tm = context; + + D_MAGIC_ASSERT( tm, TestManager ); + + D_INFO( "SaWMan/TestMan: Window added (%d,%d-%dx%d)!\n", + DFB_RECTANGLE_VALS( &info->config.bounds ) ); + + if (info->caps & DWCAPS_NODECORATION) + return DFB_NOIMPL; /* to let sawman insert the window */ + + /* Already showing window? (reattaching) */ + if (info->config.opacity) { + /* Activate scaling. */ + info->config.options |= DWOP_SCALE; + + ret = LayoutWindowAdd( tm, info->handle ); + if (ret) + return ret; + } + + return DFB_OK; +} + +static DirectResult +window_removed( void *context, + SaWManWindowInfo *info ) +{ + D_INFO( "SaWMan/TestMan: Window removed (%d,%d-%dx%d)!\n", + DFB_RECTANGLE_VALS( &info->config.bounds ) ); + + return DFB_OK; +} + +static DirectResult +window_reconfig( void *context, + SaWManWindowReconfig *reconfig ) +{ + DFBResult ret; + TestManager *tm = context; + SaWManWindowConfig *current; + SaWManWindowConfig *request; + + D_MAGIC_ASSERT( tm, TestManager ); + + if (reconfig->caps & DWCAPS_NODECORATION) + return DFB_OK; + + current = &reconfig->current; + request = &reconfig->request; + + if (reconfig->flags & SWMCF_POSITION) { + D_INFO( "SaWMan/TestMan: Window config - ignoring position (%d,%d)!\n", request->bounds.x, request->bounds.y ); + reconfig->flags &= ~SWMCF_POSITION; + } + + if (reconfig->flags & SWMCF_SIZE) { + D_INFO( "SaWMan/TestMan: Window config - ignoring size (%dx%d)!\n", request->bounds.w, request->bounds.h ); + reconfig->flags &= ~SWMCF_SIZE; + } + + if (reconfig->flags & SWMCF_STACKING) { + D_INFO( "SaWMan/TestMan: Window config - ignoring stacking (%d)!\n", request->stacking ); + reconfig->flags &= ~SWMCF_STACKING; + } + + if (reconfig->flags & SWMCF_OPACITY) { + /* Show? */ + if (request->opacity && !current->opacity) { + /* Activate scaling. */ + if ( !(reconfig->flags & SWMCF_OPTIONS) ) + request->options = 0; /* if a flag is not set, corresponding field may not be initialised */ + + reconfig->flags |= SWMCF_OPTIONS; + request->options |= DWOP_SCALE; + + ret = LayoutWindowAdd( tm, reconfig->handle ); + if (ret) + return ret; + } + /* Hide? */ + else if (!request->opacity && current->opacity) { + LayoutWindowRemove( tm, reconfig->handle ); + } + } + + return DFB_OK; +} + +static DirectResult +window_restack( void *context, + SaWManWindowHandle handle, + SaWManWindowHandle relative, + SaWManWindowRelation relation ) +{ + //~ if (window->caps & DWCAPS_NODECORATION) + //~ return DFB_OK; + + D_INFO( "SaWMan/TestMan: Window restack - refusing!\n" ); + + return DFB_ACCESSDENIED; +} + +static DirectResult +switch_focus( void *context, + SaWManWindowHandle window ) +{ + TestManager *tm = context; + + D_MAGIC_ASSERT( tm, TestManager ); + + D_INFO( "SaWMan/TestMan: Switching focus to %lx\n", window ); + + tm->focus_window = window; + + return DFB_OK; +} + +static const SaWManCallbacks callbacks = { + Start: start_request, + Stop: stop_request, + ProcessAdded: process_added, + ProcessRemoved: process_removed, + InputFilter: input_filter, + WindowPreConfig: window_preconfig, + WindowAdded: window_added, + WindowRemoved: window_removed, + WindowReconfig: window_reconfig, + WindowRestack: window_restack, + //~ StackResized + SwitchFocus: switch_focus +}; + + +int +main( int argc, char** argv ) +{ + TestManager tm; + + D_INFO( "SaWMan/TestMan: Initializing...\n" ); + + memset( &tm, 0, sizeof(tm) ); + + tm.layouts[tm.num_layouts++] = &mosaic_layout; + + D_MAGIC_SET( &tm, TestManager ); + + AddApplication( &tm, "Penguins", "df_andi", "--dfb:mode=640x480,force-windowed" ); + AddApplication( &tm, "Windows", "df_window", NULL ); + + + CHECK( DirectFBInit( &argc, &argv ) ); + + CHECK( DirectFBCreate( &tm.dfb ) ); + + CHECK( SaWManCreate( &tm.saw ) ); + + CHECK( tm.saw->CreateManager( tm.saw, &callbacks, &tm, &tm.manager ) ); + + pause(); + + +out: + D_INFO( "SaWMan/TestMan: Shutting down...\n" ); + + if (tm.manager) + tm.manager->Release( tm.manager ); + + if (tm.saw) + tm.saw->Release( tm.saw ); + + if (tm.dfb) + tm.dfb->Release( tm.dfb ); + + D_MAGIC_CLEAR( &tm ); + + return 0; +} + diff --git a/Source/SaWMan/samples/testrun.c b/Source/SaWMan/samples/testrun.c new file mode 100755 index 0000000..3256c8c --- /dev/null +++ b/Source/SaWMan/samples/testrun.c @@ -0,0 +1,90 @@ +/* + (c) Copyright 2006-2007 directfb.org + + All rights reserved. + + Written by Denis Oliver Kropp . + + 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 + + +#define CHECK(x) \ + do { \ + DFBResult ret = (x); \ + if (ret != DFB_OK) { \ + DirectFBError(#x,ret); \ + goto out; \ + } \ + } while (0) + + + +int +main( int argc, char** argv ) +{ + IDirectFB *dfb = NULL; + ISaWMan *saw = NULL; + pid_t pid; + + D_INFO( "SaWMan/TestRun: Initializing...\n" ); + + CHECK( DirectFBInit( &argc, &argv ) ); + + CHECK( DirectFBCreate( &dfb ) ); + + CHECK( SaWManCreate( &saw ) ); + + CHECK( saw->Start( saw, ((argc > 1) && argv[1]) ? argv[1] : "Test Application", &pid ) ); + + + D_INFO( "SaWMan/TestRun: New process has pid %d.\n", pid ); + + +// sleep( 2 ); +// CHECK( saw->Stop( saw, pid ) ); + + +out: + D_INFO( "SaWMan/TestRun: Shutting down...\n" ); + + if (saw) + saw->Release( saw ); + + if (dfb) + dfb->Release( dfb ); + + return 0; +} + -- cgit