diff options
Diffstat (limited to 'src/wm-tester')
-rw-r--r-- | src/wm-tester/Makefile.am | 25 | ||||
-rw-r--r-- | src/wm-tester/Makefile.in | 574 | ||||
-rw-r--r-- | src/wm-tester/focus-window.c | 37 | ||||
-rw-r--r-- | src/wm-tester/main.c | 245 | ||||
-rw-r--r-- | src/wm-tester/test-gravity.c | 308 | ||||
-rw-r--r-- | src/wm-tester/test-resizing.c | 257 | ||||
-rw-r--r-- | src/wm-tester/test-size-hints.c | 136 |
7 files changed, 1582 insertions, 0 deletions
diff --git a/src/wm-tester/Makefile.am b/src/wm-tester/Makefile.am new file mode 100644 index 00000000..3d35c741 --- /dev/null +++ b/src/wm-tester/Makefile.am @@ -0,0 +1,25 @@ + +INCLUDES=@MARCO_CFLAGS@ + +wm_tester_SOURCES= \ + main.c + +test_gravity_SOURCES= \ + test-gravity.c + +focus_window_SOURCES= \ + focus-window.c + +test_resizing_SOURCES= \ + test-resizing.c + +test_size_hints_SOURCES= \ + test-size-hints.c + +noinst_PROGRAMS=wm-tester test-gravity test-resizing focus-window test-size-hints + +wm_tester_LDADD= @MARCO_LIBS@ +test_gravity_LDADD= @MARCO_LIBS@ +test_resizing_LDADD= @MARCO_LIBS@ +test_size_hints_LDADD= @MARCO_LIBS@ +focus_window_LDADD= @MARCO_LIBS@
\ No newline at end of file diff --git a/src/wm-tester/Makefile.in b/src/wm-tester/Makefile.in new file mode 100644 index 00000000..a23fe7f8 --- /dev/null +++ b/src/wm-tester/Makefile.in @@ -0,0 +1,574 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@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@ +noinst_PROGRAMS = wm-tester$(EXEEXT) test-gravity$(EXEEXT) \ + test-resizing$(EXEEXT) focus-window$(EXEEXT) \ + test-size-hints$(EXEEXT) +subdir = src/wm-tester +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 = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am_focus_window_OBJECTS = focus-window.$(OBJEXT) +focus_window_OBJECTS = $(am_focus_window_OBJECTS) +focus_window_DEPENDENCIES = +am_test_gravity_OBJECTS = test-gravity.$(OBJEXT) +test_gravity_OBJECTS = $(am_test_gravity_OBJECTS) +test_gravity_DEPENDENCIES = +am_test_resizing_OBJECTS = test-resizing.$(OBJEXT) +test_resizing_OBJECTS = $(am_test_resizing_OBJECTS) +test_resizing_DEPENDENCIES = +am_test_size_hints_OBJECTS = test-size-hints.$(OBJEXT) +test_size_hints_OBJECTS = $(am_test_size_hints_OBJECTS) +test_size_hints_DEPENDENCIES = +am_wm_tester_OBJECTS = main.$(OBJEXT) +wm_tester_OBJECTS = $(am_wm_tester_OBJECTS) +wm_tester_DEPENDENCIES = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +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 = $(focus_window_SOURCES) $(test_gravity_SOURCES) \ + $(test_resizing_SOURCES) $(test_size_hints_SOURCES) \ + $(wm_tester_SOURCES) +DIST_SOURCES = $(focus_window_SOURCES) $(test_gravity_SOURCES) \ + $(test_resizing_SOURCES) $(test_size_hints_SOURCES) \ + $(wm_tester_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ +ALL_CFLAGS = @ALL_CFLAGS@ +ALL_LIBS = @ALL_LIBS@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISTCHECK_CONFIGURE_FLAGS = @DISTCHECK_CONFIGURE_FLAGS@ +DLLTOOL = @DLLTOOL@ +DOC_USER_FORMATS = @DOC_USER_FORMATS@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDK_PIXBUF_CSOURCE = @GDK_PIXBUF_CSOURCE@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +GTK_API_VERSION = @GTK_API_VERSION@ +HELP_DIR = @HELP_DIR@ +HOST_ALIAS = @HOST_ALIAS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MARCO_CFLAGS = @MARCO_CFLAGS@ +MARCO_LIBS = @MARCO_LIBS@ +MARCO_MESSAGE_CFLAGS = @MARCO_MESSAGE_CFLAGS@ +MARCO_MESSAGE_LIBS = @MARCO_MESSAGE_LIBS@ +MARCO_WINDOW_DEMO_CFLAGS = @MARCO_WINDOW_DEMO_CFLAGS@ +MARCO_WINDOW_DEMO_LIBS = @MARCO_WINDOW_DEMO_LIBS@ +MATECONFTOOL = @MATECONFTOOL@ +MATECONF_SCHEMA_CONFIG_SOURCE = @MATECONF_SCHEMA_CONFIG_SOURCE@ +MATECONF_SCHEMA_FILE_DIR = @MATECONF_SCHEMA_FILE_DIR@ +MATEDIALOG = @MATEDIALOG@ +MATE_KEYBINDINGS_KEYSDIR = @MATE_KEYBINDINGS_KEYSDIR@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OMF_DIR = @OMF_DIR@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +XMKMF = @XMKMF@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +INCLUDES = @MARCO_CFLAGS@ +wm_tester_SOURCES = \ + main.c + +test_gravity_SOURCES = \ + test-gravity.c + +focus_window_SOURCES = \ + focus-window.c + +test_resizing_SOURCES = \ + test-resizing.c + +test_size_hints_SOURCES = \ + test-size-hints.c + +wm_tester_LDADD = @MARCO_LIBS@ +test_gravity_LDADD = @MARCO_LIBS@ +test_resizing_LDADD = @MARCO_LIBS@ +test_size_hints_LDADD = @MARCO_LIBS@ +focus_window_LDADD = @MARCO_LIBS@ +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 ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/wm-tester/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/wm-tester/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 +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +focus-window$(EXEEXT): $(focus_window_OBJECTS) $(focus_window_DEPENDENCIES) + @rm -f focus-window$(EXEEXT) + $(LINK) $(focus_window_OBJECTS) $(focus_window_LDADD) $(LIBS) +test-gravity$(EXEEXT): $(test_gravity_OBJECTS) $(test_gravity_DEPENDENCIES) + @rm -f test-gravity$(EXEEXT) + $(LINK) $(test_gravity_OBJECTS) $(test_gravity_LDADD) $(LIBS) +test-resizing$(EXEEXT): $(test_resizing_OBJECTS) $(test_resizing_DEPENDENCIES) + @rm -f test-resizing$(EXEEXT) + $(LINK) $(test_resizing_OBJECTS) $(test_resizing_LDADD) $(LIBS) +test-size-hints$(EXEEXT): $(test_size_hints_OBJECTS) $(test_size_hints_DEPENDENCIES) + @rm -f test-size-hints$(EXEEXT) + $(LINK) $(test_size_hints_OBJECTS) $(test_size_hints_LDADD) $(LIBS) +wm-tester$(EXEEXT): $(wm_tester_OBJECTS) $(wm_tester_DEPENDENCIES) + @rm -f wm-tester$(EXEEXT) + $(LINK) $(wm_tester_OBJECTS) $(wm_tester_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/focus-window.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-gravity.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-resizing.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-size-hints.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(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@ $(am__mv) $(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@ $(am__mv) $(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; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + 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; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + 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)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__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 "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$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: +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) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-noinstPROGRAMS \ + 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 + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +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-noinstPROGRAMS 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/src/wm-tester/focus-window.c b/src/wm-tester/focus-window.c new file mode 100644 index 00000000..dc33bd25 --- /dev/null +++ b/src/wm-tester/focus-window.c @@ -0,0 +1,37 @@ +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <stdio.h> +#include <stdlib.h> + +int main (int argc, char **argv) +{ + Display *d; + Window w; + const char *w_str; + char *end; + + if (argc != 2) + { + fprintf (stderr, "Usage: focus-window WINDOWID\n"); + exit (1); + } + + d = XOpenDisplay (NULL); + + w_str = argv[1]; + end = NULL; + + w = strtoul (w_str, &end, 16); + if (end == w_str) + { + fprintf (stderr, "Usage: focus-window WINDOWID\n"); + exit (1); + } + + printf ("Setting input focus to 0x%lx\n", w); + XSetInputFocus (d, w, RevertToPointerRoot, CurrentTime); + XFlush (d); + + return 0; +} + diff --git a/src/wm-tester/main.c b/src/wm-tester/main.c new file mode 100644 index 00000000..e56d6606 --- /dev/null +++ b/src/wm-tester/main.c @@ -0,0 +1,245 @@ +/* WM tester main() */ + +/* + * Copyright (C) 2001 Havoc Pennington + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#include <gtk/gtk.h> + +#include <stdlib.h> +#include <sys/types.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> + +static void set_up_the_evil (void); +static void set_up_icon_windows (void); + +static void +usage (void) +{ + g_print ("wm-tester [--evil] [--icon-windows]\n"); + exit (0); +} + +int +main (int argc, char **argv) +{ + int i; + gboolean do_evil; + gboolean do_icon_windows; + + gtk_init (&argc, &argv); + + do_evil = FALSE; + do_icon_windows = FALSE; + + i = 1; + while (i < argc) + { + const char *arg = argv[i]; + + if (strcmp (arg, "--help") == 0 || + strcmp (arg, "-h") == 0 || + strcmp (arg, "-?") == 0) + usage (); + else if (strcmp (arg, "--evil") == 0) + do_evil = TRUE; + else if (strcmp (arg, "--icon-windows") == 0) + do_icon_windows = TRUE; + else + usage (); + + ++i; + } + + /* Be sure some option was provided */ + if (! (do_evil || do_icon_windows)) + return 1; + + if (do_evil) + set_up_the_evil (); + + if (do_icon_windows) + set_up_icon_windows (); + + gtk_main (); + + return 0; +} + +static GSList *evil_windows = NULL; + +static gint +evil_timeout (gpointer data) +{ + int i; + int n_windows; + int len; + int create_count; + int destroy_count; + + len = g_slist_length (evil_windows); + + if (len > 35) + { + create_count = 2; + destroy_count = 5; + } + else + { + create_count = 5; + destroy_count = 5; + } + + /* Create some windows */ + n_windows = g_random_int_range (0, create_count); + + i = 0; + while (i < n_windows) + { + GtkWidget *w; + GtkWidget *c; + int t; + GtkWidget *parent; + + w = gtk_window_new (GTK_WINDOW_TOPLEVEL); + + gtk_widget_set_uposition (w, + g_random_int_range (0, + gdk_screen_width ()), + g_random_int_range (0, + gdk_screen_height ())); + + parent = NULL; + + /* set transient for random window (may create all kinds of weird cycles) */ + if (len > 0) + { + t = g_random_int_range (- (len / 3), len); + if (t >= 0) + { + parent = g_slist_nth_data (evil_windows, t); + + if (parent != NULL) + gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (parent)); + } + } + + if (parent != NULL) + c = gtk_button_new_with_label ("Evil Transient!"); + else + c = gtk_button_new_with_label ("Evil Window!"); + gtk_container_add (GTK_CONTAINER (w), c); + + gtk_widget_show_all (w); + + evil_windows = g_slist_prepend (evil_windows, w); + + ++i; + } + + /* Destroy some windows */ + if (len > destroy_count) + { + n_windows = g_random_int_range (0, destroy_count); + i = 0; + while (i < n_windows) + { + GtkWidget *w; + + w = g_slist_nth_data (evil_windows, + g_random_int_range (0, len)); + if (w) + { + --len; + evil_windows = g_slist_remove (evil_windows, w); + gtk_widget_destroy (w); + } + + ++i; + } + } + + return TRUE; +} + +static void +set_up_the_evil (void) +{ + g_timeout_add (400, evil_timeout, NULL); +} + +static void +set_up_icon_windows (void) +{ + int i; + int n_windows; + + /* Create some windows */ + n_windows = 9; + + i = 0; + while (i < n_windows) + { + GtkWidget *w; + GtkWidget *c; + GList *icons; + GdkPixbuf *pix; + + w = gtk_window_new (GTK_WINDOW_TOPLEVEL); + c = gtk_button_new_with_label ("Icon window"); + gtk_container_add (GTK_CONTAINER (w), c); + + icons = NULL; + + pix = gtk_widget_render_icon (w, + GTK_STOCK_SAVE, + GTK_ICON_SIZE_LARGE_TOOLBAR, + NULL); + + icons = g_list_append (icons, pix); + + if (i % 2) + { + pix = gtk_widget_render_icon (w, + GTK_STOCK_SAVE, + GTK_ICON_SIZE_DIALOG, + NULL); + icons = g_list_append (icons, pix); + } + + if (i % 3) + { + pix = gtk_widget_render_icon (w, + GTK_STOCK_SAVE, + GTK_ICON_SIZE_MENU, + NULL); + icons = g_list_append (icons, pix); + } + + gtk_window_set_icon_list (GTK_WINDOW (w), icons); + + g_list_foreach (icons, (GFunc) g_object_unref, NULL); + g_list_free (icons); + + gtk_widget_show_all (w); + + ++i; + } +} diff --git a/src/wm-tester/test-gravity.c b/src/wm-tester/test-gravity.c new file mode 100644 index 00000000..8e5b581c --- /dev/null +++ b/src/wm-tester/test-gravity.c @@ -0,0 +1,308 @@ +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <stdio.h> +#include <string.h> + +static int gravities[10] = { + NorthWestGravity, + NorthGravity, + NorthEastGravity, + WestGravity, + CenterGravity, + EastGravity, + SouthWestGravity, + SouthGravity, + SouthEastGravity, + StaticGravity +}; + +typedef struct +{ + int x, y, width, height; +} Rectangle; + +static Window windows[10]; +static int doubled[10] = { 0, }; +static Rectangle window_rects[10]; + +#define WINDOW_WIDTH 100 +#define WINDOW_HEIGHT 100 + +static int x_offset[3] = { 0, - WINDOW_WIDTH/2, -WINDOW_WIDTH }; +static int y_offset[3] = { 0, - WINDOW_HEIGHT/2, -WINDOW_HEIGHT }; +static double screen_x_fraction[3] = { 0, 0.5, 1.0 }; +static double screen_y_fraction[3] = { 0, 0.5, 1.0 }; +static int screen_width; +static int screen_height; + +static const char* +window_gravity_to_string (int gravity) +{ + switch (gravity) + { + case NorthWestGravity: + return "NorthWestGravity"; + case NorthGravity: + return "NorthGravity"; + case NorthEastGravity: + return "NorthEastGravity"; + case WestGravity: + return "WestGravity"; + case CenterGravity: + return "CenterGravity"; + case EastGravity: + return "EastGravity"; + case SouthWestGravity: + return "SouthWestGravity"; + case SouthGravity: + return "SouthGravity"; + case SouthEastGravity: + return "SouthEastGravity"; + case StaticGravity: + return "StaticGravity"; + default: + return "NorthWestGravity"; + } +} + +static void +calculate_position (int i, int doubled, int *x, int *y) +{ + if (i == 9) + { + *x = 150; + *y = 150; + } + else + { + int xoff = x_offset[i % 3]; + int yoff = y_offset[i / 3]; + if (doubled) + { + xoff *= 2; + yoff *= 2; + } + + *x = screen_x_fraction[i % 3] * screen_width + xoff; + *y = screen_y_fraction[i / 3] * screen_height + yoff; + } +} + +static int +find_window (Window window) +{ + int i; + for (i=0; i<10; i++) + { + if (windows[i] == window) + return i; + } + + return -1; +} + +typedef struct { + unsigned long flags; + unsigned long functions; + unsigned long decorations; + long input_mode; + unsigned long status; +} MotifWmHints, MwmHints; + +#define MWM_HINTS_FUNCTIONS (1L << 0) +#define MWM_HINTS_DECORATIONS (1L << 1) +#define MWM_HINTS_INPUT_MODE (1L << 2) +#define MWM_HINTS_STATUS (1L << 3) + +int main (int argc, char **argv) +{ + Display *d; + Window w; + XSizeHints hints; + int i; + int screen; + XEvent ev; + int noframes; + + if (argc > 1 && strcmp (argv[1], "--noframes") == 0) + noframes = 1; + else + noframes = 0; + + d = XOpenDisplay (NULL); + + screen = DefaultScreen (d); + screen_width = DisplayWidth (d, screen); + screen_height = DisplayHeight (d, screen); + + for (i=0; i<10; i++) + { + int x, y; + + calculate_position (i, doubled[i], &x, &y); + + w = XCreateSimpleWindow (d, RootWindow (d, screen), + x, y, WINDOW_WIDTH, WINDOW_HEIGHT, 0, + WhitePixel (d, screen), WhitePixel (d, screen)); + + windows[i] = w; + window_rects[i].x = x; + window_rects[i].y = y; + window_rects[i].width = WINDOW_WIDTH; + window_rects[i].height = WINDOW_HEIGHT; + + XSelectInput (d, w, ButtonPressMask | ExposureMask | StructureNotifyMask); + + hints.flags = USPosition | PMinSize | PMaxSize | PWinGravity; + + hints.min_width = WINDOW_WIDTH / 2; + hints.min_height = WINDOW_HEIGHT / 2; + +#if 1 + /* we constrain max size below the "doubled" size so that + * the WM will have to deal with constraints + * at the same time it's dealing with configure request + */ + hints.max_width = WINDOW_WIDTH * 2 - WINDOW_WIDTH / 2; + hints.max_height = WINDOW_HEIGHT * 2 - WINDOW_HEIGHT / 2; +#else + hints.max_width = WINDOW_WIDTH * 2 + WINDOW_WIDTH / 2; + hints.max_height = WINDOW_HEIGHT * 2 + WINDOW_HEIGHT / 2; +#endif + hints.win_gravity = gravities[i]; + + XSetWMNormalHints (d, w, &hints); + + XStoreName (d, w, window_gravity_to_string (hints.win_gravity)); + + if (noframes) + { + MotifWmHints mwm; + Atom mwm_atom; + + mwm.decorations = 0; + mwm.flags = MWM_HINTS_DECORATIONS; + + mwm_atom = XInternAtom (d, "_MOTIF_WM_HINTS", False); + + XChangeProperty (d, w, mwm_atom, mwm_atom, + 32, PropModeReplace, + (unsigned char *)&mwm, + sizeof (MotifWmHints)/sizeof (long)); + } + + XMapWindow (d, w); + } + + while (1) + { + XNextEvent (d, &ev); + + if (ev.xany.type == ConfigureNotify) + { + i = find_window (ev.xconfigure.window); + + if (i >= 0) + { + Window ignored; + + window_rects[i].width = ev.xconfigure.width; + window_rects[i].height = ev.xconfigure.height; + + XClearArea (d, windows[i], 0, 0, + ev.xconfigure.width, + ev.xconfigure.height, + True); + + if (!ev.xconfigure.send_event) + XTranslateCoordinates (d, windows[i], DefaultRootWindow (d), + 0, 0, + &window_rects[i].x, &window_rects[i].y, + &ignored); + else + { + window_rects[i].x = ev.xconfigure.x; + window_rects[i].y = ev.xconfigure.y; + } + } + } + else if (ev.xany.type == Expose) + { + i = find_window (ev.xexpose.window); + + if (i >= 0) + { + GC gc; + XGCValues values; + char buf[256]; + + values.foreground = BlackPixel (d, screen); + + gc = XCreateGC (d, windows[i], + GCForeground, &values); + + sprintf (buf, + "%d,%d", + window_rects[i].x, + window_rects[i].y); + + XDrawString (d, windows[i], gc, 10, 15, + buf, strlen (buf)); + + sprintf (buf, + "%dx%d", + window_rects[i].width, + window_rects[i].height); + + XDrawString (d, windows[i], gc, 10, 35, + buf, strlen (buf)); + + XFreeGC (d, gc); + } + } + else if (ev.xany.type == ButtonPress) + { + i = find_window (ev.xbutton.window); + + if (i >= 0) + { + /* Button 1 = move, 2 = resize, 3 = both at once */ + + if (ev.xbutton.button == Button1) + { + int x, y; + + calculate_position (i, doubled[i], &x, &y); + XMoveWindow (d, windows[i], x, y); + } + else if (ev.xbutton.button == Button2) + { + if (doubled[i]) + XResizeWindow (d, windows[i], WINDOW_WIDTH, WINDOW_HEIGHT); + else + XResizeWindow (d, windows[i], WINDOW_WIDTH*2, WINDOW_HEIGHT*2); + + doubled[i] = !doubled[i]; + } + else if (ev.xbutton.button == Button3) + { + int x, y; + + calculate_position (i, !doubled[i], &x, &y); + + if (doubled[i]) + XMoveResizeWindow (d, windows[i], x, y, WINDOW_WIDTH, WINDOW_HEIGHT); + else + XMoveResizeWindow (d, windows[i], x, y, WINDOW_WIDTH*2, WINDOW_HEIGHT*2); + + doubled[i] = !doubled[i]; + } + } + } + } + + /* This program has an infinite loop above so a return statement would + * just cause compiler warnings. + */ +} + diff --git a/src/wm-tester/test-resizing.c b/src/wm-tester/test-resizing.c new file mode 100644 index 00000000..f9481004 --- /dev/null +++ b/src/wm-tester/test-resizing.c @@ -0,0 +1,257 @@ +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <stdlib.h> +#include <glib.h> + +static void +calc_rects (XRectangle *rects, int width, int height) +{ + int w = (width - 21) / 3; + int h = (height - 21) / 3; + int i; + + i = 0; + while (i < 9) + { + rects[i].width = w; + rects[i].height = h; + ++i; + } + + /* NW */ + rects[0].x = 0; + rects[0].y = 0; + + /* N */ + rects[1].x = width / 2 - w / 2; + rects[1].y = 0; + + /* NE */ + rects[2].x = width - w; + rects[2].y = 0; + + /* E */ + rects[3].x = width - w; + rects[3].y = height / 2 - h / 2; + + /* SE */ + rects[4].x = width - w; + rects[4].y = height - h; + + /* S */ + rects[5].x = width / 2 - w / 2; + rects[5].y = height - h; + + /* SW */ + rects[6].x = 0; + rects[6].y = height - h; + + /* W */ + rects[7].x = 0; + rects[7].y = height / 2 - h / 2; + + /* Center */ + rects[8].x = width / 2 - w / 2; + rects[8].y = height / 2 - h / 2; +} + +static Bool +all_events (Display *display, + XEvent *event, + XPointer arg) +{ + return True; +} + +static void +get_size (Display *d, Drawable draw, + int *xp, int *yp, int *widthp, int *heightp) +{ + int x, y; + unsigned int width=0, height=0, border=0, depth=0; + Window root; + + XGetGeometry (d, draw, &root, &x, &y, &width, &height, &border, &depth); + + if (xp) + *xp = x; + if (yp) + *yp = y; + if (widthp) + *widthp = width; + if (*heightp) + *heightp = height; +} + +int +main (int argc, char **argv) +{ + Display *d; + Window w, cw; + XSizeHints hints; + int screen; + XEvent ev; + int x, y, width, height; + Pixmap pix; + GC gc; + XGCValues gc_vals; + XSetWindowAttributes set_attrs; + XWindowChanges changes; + XRectangle rects[9]; + gboolean redraw_pending; + unsigned int mask; + + d = XOpenDisplay (NULL); + + screen = DefaultScreen (d); + + /* Print some debug spew to show how StaticGravity works */ + w = XCreateSimpleWindow (d, RootWindow (d, screen), + 0, 0, 100, 100, 0, + WhitePixel (d, screen), + WhitePixel (d, screen)); + cw = XCreateSimpleWindow (d, w, + 0, 0, 100, 100, 0, + WhitePixel (d, screen), + WhitePixel (d, screen)); + set_attrs.win_gravity = StaticGravity; + + XChangeWindowAttributes (d, cw, + CWWinGravity, + &set_attrs); + + get_size (d, w, &x, &y, &width, &height); + + g_print ("Parent is %d,%d %d x %d before configuring parent\n", + x, y, width, height); + + get_size (d, cw, &x, &y, &width, &height); + + g_print ("Child is %d,%d %d x %d before configuring parent\n", + x, y, width, height); + + changes.x = 10; + changes.y = 10; + changes.width = 110; + changes.height = 110; + /* last mask wins */ + mask = CWX | CWY; + mask = CWWidth | CWHeight; + mask = CWX | CWY | CWWidth | CWHeight; + + XConfigureWindow (d, w, mask, &changes); + XSync (d, False); + + get_size (d, w, &x, &y, &width, &height); + + g_print ("Parent is %d,%d %d x %d after configuring parent\n", + x, y, width, height); + + get_size (d, cw, &x, &y, &width, &height); + + g_print ("Child is %d,%d %d x %d after configuring parent\n", + x, y, width, height); + + XDestroyWindow (d, w); + + /* The window that gets displayed */ + + x = 20; + y = 20; + width = 100; + height = 100; + + calc_rects (rects, width, height); + + w = XCreateSimpleWindow (d, RootWindow (d, screen), + x, y, width, height, 0, + WhitePixel (d, screen), + WhitePixel (d, screen)); + + set_attrs.bit_gravity = StaticGravity; + + XChangeWindowAttributes (d, w, + CWBitGravity, + &set_attrs); + + XSelectInput (d, w, + ButtonPressMask | ExposureMask | StructureNotifyMask); + + hints.flags = PMinSize; + + hints.min_width = 100; + hints.min_height = 100; + + XSetWMNormalHints (d, w, &hints); + XMapWindow (d, w); + + redraw_pending = FALSE; + while (1) + { + XNextEvent (d, &ev); + + switch (ev.xany.type) + { + case ButtonPress: + if (ev.xbutton.button == 3) + { + g_print ("Exiting on button 3 press\n"); + exit (0); + } + break; + + case ConfigureNotify: + x = ev.xconfigure.x; + y = ev.xconfigure.y; + width = ev.xconfigure.width; + height = ev.xconfigure.height; + + redraw_pending = TRUE; + break; + + case Expose: + redraw_pending = TRUE; + break; + + default: + break; + } + + /* Primitive event compression */ + if (XCheckIfEvent (d, &ev, all_events, NULL)) + { + XPutBackEvent (d, &ev); + } + else if (redraw_pending) + { + calc_rects (rects, width, height); + + pix = XCreatePixmap (d, w, width, height, + DefaultDepth (d, screen)); + + gc_vals.foreground = WhitePixel (d, screen); + + gc = XCreateGC (d, pix, GCForeground, &gc_vals); + + XFillRectangle (d, pix, gc, 0, 0, width, height); + + /* Draw rectangles at each gravity point */ + gc_vals.foreground = BlackPixel (d, screen); + XChangeGC (d, gc, GCForeground, &gc_vals); + + XFillRectangles (d, pix, gc, rects, G_N_ELEMENTS (rects)); + + XCopyArea (d, pix, w, gc, 0, 0, width, height, 0, 0); + + XFreePixmap (d, pix); + XFreeGC (d, gc); + + redraw_pending = FALSE; + } + } + + /* This program has an infinite loop above so a return statement would + * just cause compiler warnings. + */ +} + diff --git a/src/wm-tester/test-size-hints.c b/src/wm-tester/test-size-hints.c new file mode 100644 index 00000000..72f1b486 --- /dev/null +++ b/src/wm-tester/test-size-hints.c @@ -0,0 +1,136 @@ +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <stdlib.h> +#include <glib.h> + +static Bool +all_events (Display *display, + XEvent *event, + XPointer arg) +{ + return True; +} + +#if 0 +static void +get_size (Display *d, Drawable draw, + int *xp, int *yp, int *widthp, int *heightp) +{ + int x, y; + unsigned int width, height, border, depth; + Window root; + + XGetGeometry (d, draw, &root, &x, &y, &width, &height, &border, &depth); + + if (xp) + *xp = x; + if (yp) + *yp = y; + if (widthp) + *widthp = width; + if (*heightp) + *heightp = height; +} +#endif + +int +main (int argc, char **argv) +{ + Display *d; + Window zero_min_size; + XSizeHints hints; + int screen; + XEvent ev; + int x, y, width, height; + Pixmap pix; + GC gc; + XGCValues gc_vals; + gboolean redraw_pending; + + d = XOpenDisplay (NULL); + + screen = DefaultScreen (d); + + x = 0; + y = 0; + width = 100; + height = 100; + + zero_min_size = XCreateSimpleWindow (d, RootWindow (d, screen), + x, y, width, height, 0, + WhitePixel (d, screen), + WhitePixel (d, screen)); + + XSelectInput (d, zero_min_size, + ButtonPressMask | ExposureMask | StructureNotifyMask); + + hints.flags = PMinSize; + + hints.min_width = 0; + hints.min_height = 0; + + XSetWMNormalHints (d, zero_min_size, &hints); + XMapWindow (d, zero_min_size); + + redraw_pending = FALSE; + while (1) + { + XNextEvent (d, &ev); + + switch (ev.xany.type) + { + case ButtonPress: + if (ev.xbutton.button == 1) + { + g_print ("Exiting on button 1 press\n"); + exit (0); + } + break; + + case ConfigureNotify: + x = ev.xconfigure.x; + y = ev.xconfigure.y; + width = ev.xconfigure.width; + height = ev.xconfigure.height; + + redraw_pending = TRUE; + break; + + case Expose: + redraw_pending = TRUE; + break; + + default: + break; + } + + /* Primitive event compression */ + if (XCheckIfEvent (d, &ev, all_events, NULL)) + { + XPutBackEvent (d, &ev); + } + else if (redraw_pending) + { + pix = XCreatePixmap (d, zero_min_size, width, height, + DefaultDepth (d, screen)); + + gc_vals.foreground = WhitePixel (d, screen); + + gc = XCreateGC (d, pix, GCForeground, &gc_vals); + + XFillRectangle (d, pix, gc, 0, 0, width, height); + + XCopyArea (d, pix, zero_min_size, gc, 0, 0, width, height, 0, 0); + + XFreePixmap (d, pix); + XFreeGC (d, gc); + + redraw_pending = FALSE; + } + } + + /* This program has an infinite loop above so a return statement would + * just cause compiler warnings. + */ +} + |