diff options
Diffstat (limited to 'dist/xcb-util/icccm')
-rw-r--r-- | dist/xcb-util/icccm/Makefile.am | 18 | ||||
-rw-r--r-- | dist/xcb-util/icccm/Makefile.in | 557 | ||||
-rw-r--r-- | dist/xcb-util/icccm/icccm.c | 717 | ||||
-rw-r--r-- | dist/xcb-util/icccm/xcb-icccm.pc.in | 11 | ||||
-rw-r--r-- | dist/xcb-util/icccm/xcb_icccm.h | 905 |
5 files changed, 2208 insertions, 0 deletions
diff --git a/dist/xcb-util/icccm/Makefile.am b/dist/xcb-util/icccm/Makefile.am new file mode 100644 index 000000000..9ad423891 --- /dev/null +++ b/dist/xcb-util/icccm/Makefile.am @@ -0,0 +1,18 @@ + +MAINTAINERCLEANFILES = Makefile.in + +lib_LTLIBRARIES = libxcb-icccm.la + +xcbinclude_HEADERS = xcb_icccm.h + +AM_CFLAGS = $(CWARNFLAGS) + +libxcb_icccm_la_SOURCES = icccm.c +libxcb_icccm_la_CPPFLAGS = $(XCB_CFLAGS) $(XCB_ATOM_CFLAGS) $(XCB_EVENT_CFLAGS) \ + $(XCB_PROPERTY_CFLAGS) +libxcb_icccm_la_LIBADD = $(XCB_LIBS) $(XCB_ATOM_LIBS) $(XCB_PROPERTY_LIBS) +libxcb_icccm_la_LDFLAGS = -version-info 1:0:0 + +pkgconfig_DATA = xcb-icccm.pc + +EXTRA_DIST = xcb-icccm.pc.in diff --git a/dist/xcb-util/icccm/Makefile.in b/dist/xcb-util/icccm/Makefile.in new file mode 100644 index 000000000..8be12cce7 --- /dev/null +++ b/dist/xcb-util/icccm/Makefile.in @@ -0,0 +1,557 @@ +# Makefile.in generated by automake 1.10.2 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@ +subdir = icccm +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/xcb-icccm.pc.in $(xcbinclude_HEADERS) +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = xcb-icccm.pc +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)$(pkgconfigdir)" \ + "$(DESTDIR)$(xcbincludedir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +am__DEPENDENCIES_1 = +libxcb_icccm_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_libxcb_icccm_la_OBJECTS = libxcb_icccm_la-icccm.lo +libxcb_icccm_la_OBJECTS = $(am_libxcb_icccm_la_OBJECTS) +libxcb_icccm_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libxcb_icccm_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ +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 = $(libxcb_icccm_la_SOURCES) +DIST_SOURCES = $(libxcb_icccm_la_SOURCES) +pkgconfigDATA_INSTALL = $(INSTALL_DATA) +DATA = $(pkgconfig_DATA) +xcbincludeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(xcbinclude_HEADERS) +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@ +CWARNFLAGS = @CWARNFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GPERF = @GPERF@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +M4 = @M4@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +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@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XCB_ATOM_CFLAGS = @XCB_ATOM_CFLAGS@ +XCB_ATOM_LIBS = @XCB_ATOM_LIBS@ +XCB_AUX_CFLAGS = @XCB_AUX_CFLAGS@ +XCB_AUX_LIBS = @XCB_AUX_LIBS@ +XCB_CFLAGS = @XCB_CFLAGS@ +XCB_EVENT_CFLAGS = @XCB_EVENT_CFLAGS@ +XCB_EVENT_LIBS = @XCB_EVENT_LIBS@ +XCB_ICCCM_CFLAGS = @XCB_ICCCM_CFLAGS@ +XCB_ICCCM_LIBS = @XCB_ICCCM_LIBS@ +XCB_LIBS = @XCB_LIBS@ +XCB_PROPERTY_CFLAGS = @XCB_PROPERTY_CFLAGS@ +XCB_PROPERTY_LIBS = @XCB_PROPERTY_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SHM_CFLAGS = @XCB_SHM_CFLAGS@ +XCB_SHM_LIBS = @XCB_SHM_LIBS@ +XPROTO_CFLAGS = @XPROTO_CFLAGS@ +XPROTO_LIBS = @XPROTO_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_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@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfigdir = @pkgconfigdir@ +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@ +xcbincludedir = @xcbincludedir@ +MAINTAINERCLEANFILES = Makefile.in +lib_LTLIBRARIES = libxcb-icccm.la +xcbinclude_HEADERS = xcb_icccm.h +AM_CFLAGS = $(CWARNFLAGS) +libxcb_icccm_la_SOURCES = icccm.c +libxcb_icccm_la_CPPFLAGS = $(XCB_CFLAGS) $(XCB_ATOM_CFLAGS) $(XCB_EVENT_CFLAGS) \ + $(XCB_PROPERTY_CFLAGS) + +libxcb_icccm_la_LIBADD = $(XCB_LIBS) $(XCB_ATOM_LIBS) $(XCB_PROPERTY_LIBS) +libxcb_icccm_la_LDFLAGS = -version-info 1:0:0 +pkgconfig_DATA = xcb-icccm.pc +EXTRA_DIST = xcb-icccm.pc.in +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(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) --foreign icccm/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign icccm/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: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +xcb-icccm.pc: $(top_builddir)/config.status $(srcdir)/xcb-icccm.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +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 +libxcb-icccm.la: $(libxcb_icccm_la_OBJECTS) $(libxcb_icccm_la_DEPENDENCIES) + $(libxcb_icccm_la_LINK) -rpath $(libdir) $(libxcb_icccm_la_OBJECTS) $(libxcb_icccm_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxcb_icccm_la-icccm.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 $@ $< + +libxcb_icccm_la-icccm.lo: icccm.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libxcb_icccm_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libxcb_icccm_la-icccm.lo -MD -MP -MF $(DEPDIR)/libxcb_icccm_la-icccm.Tpo -c -o libxcb_icccm_la-icccm.lo `test -f 'icccm.c' || echo '$(srcdir)/'`icccm.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libxcb_icccm_la-icccm.Tpo $(DEPDIR)/libxcb_icccm_la-icccm.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='icccm.c' object='libxcb_icccm_la-icccm.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libxcb_icccm_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libxcb_icccm_la-icccm.lo `test -f 'icccm.c' || echo '$(srcdir)/'`icccm.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" + @list='$(pkgconfig_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ + $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \ + done + +uninstall-pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgconfig_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \ + done +install-xcbincludeHEADERS: $(xcbinclude_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(xcbincludedir)" || $(MKDIR_P) "$(DESTDIR)$(xcbincludedir)" + @list='$(xcbinclude_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(xcbincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(xcbincludedir)/$$f'"; \ + $(xcbincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(xcbincludedir)/$$f"; \ + done + +uninstall-xcbincludeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(xcbinclude_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(xcbincludedir)/$$f'"; \ + rm -f "$(DESTDIR)$(xcbincludedir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(xcbincludedir)"; 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." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES 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-pkgconfigDATA install-xcbincludeHEADERS + +install-dvi: install-dvi-am + +install-exec-am: install-libLTLIBRARIES + +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-libLTLIBRARIES uninstall-pkgconfigDATA \ + uninstall-xcbincludeHEADERS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES 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-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-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-pkgconfigDATA install-ps install-ps-am install-strip \ + install-xcbincludeHEADERS 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-libLTLIBRARIES uninstall-pkgconfigDATA \ + uninstall-xcbincludeHEADERS + +# 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/dist/xcb-util/icccm/icccm.c b/dist/xcb-util/icccm/icccm.c new file mode 100644 index 000000000..d818d7e2a --- /dev/null +++ b/dist/xcb-util/icccm/icccm.c @@ -0,0 +1,717 @@ +/* + * Copyright © 2008 Arnaud Fontaine <arnau@debian.org> + * Copyright © 2007-2008 Vincent Torri <vtorri@univ-evry.fr> + * + * 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 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. + * + * Except as contained in this notice, the names of the authors or + * their institutions shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from the authors. + */ + +#include <stdlib.h> +#include <limits.h> +#include <string.h> + +#include "xcb_icccm.h" +#include "xcb_atom.h" + +xcb_get_property_cookie_t +xcb_get_text_property(xcb_connection_t *c, + xcb_window_t window, + xcb_atom_t property) +{ + return xcb_get_any_property(c, 0, window, property, UINT_MAX); +} + +xcb_get_property_cookie_t +xcb_get_text_property_unchecked(xcb_connection_t *c, + xcb_window_t window, + xcb_atom_t property) +{ + return xcb_get_any_property_unchecked(c, 0, window, property, UINT_MAX); +} + +uint8_t +xcb_get_text_property_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_get_text_property_reply_t *prop, + xcb_generic_error_t **e) +{ + xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie, e); + + if(!reply) + return 0; + + prop->_reply = reply; + prop->encoding = prop->_reply->type; + prop->format = prop->_reply->format; + prop->name_len = xcb_get_property_value_length(prop->_reply) * prop->format >> 3; + prop->name = xcb_get_property_value(prop->_reply); + + return 1; +} + +void xcb_get_text_property_reply_wipe(xcb_get_text_property_reply_t *prop) +{ + free(prop->_reply); +} + +/* WM_NAME */ + +void +xcb_set_wm_name_checked(xcb_connection_t *c, xcb_window_t window, + xcb_atom_t encoding, uint32_t name_len, + const char *name) +{ + xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window, WM_NAME, + encoding, 8, name_len, name); +} + +void +xcb_set_wm_name(xcb_connection_t *c, xcb_window_t window, xcb_atom_t encoding, + uint32_t name_len, const char *name) +{ + xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_NAME, encoding, 8, + name_len, name); +} + +xcb_get_property_cookie_t +xcb_get_wm_name(xcb_connection_t *c, + xcb_window_t window) +{ + return xcb_get_text_property(c, window, WM_NAME); +} + +xcb_get_property_cookie_t +xcb_get_wm_name_unchecked(xcb_connection_t *c, + xcb_window_t window) +{ + return xcb_get_text_property_unchecked(c, window, WM_NAME); +} + +uint8_t +xcb_get_wm_name_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_get_text_property_reply_t *prop, + xcb_generic_error_t **e) +{ + return xcb_get_text_property_reply(c, cookie, prop, e); +} + +void +xcb_watch_wm_name(xcb_property_handlers_t *prophs, uint32_t long_len, + xcb_generic_property_handler_t handler, void *data) +{ + xcb_property_set_handler(prophs, WM_NAME, long_len, handler, data); +} + +/* WM_ICON_NAME */ + +void +xcb_set_wm_icon_name_checked(xcb_connection_t *c, xcb_window_t window, + xcb_atom_t encoding, uint32_t name_len, + const char *name) +{ + xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window, WM_ICON_NAME, + encoding, 8, name_len, name); +} + +void +xcb_set_wm_icon_name(xcb_connection_t *c, xcb_window_t window, + xcb_atom_t encoding, uint32_t name_len, const char *name) +{ + xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_ICON_NAME, encoding, + 8, name_len, name); +} + +xcb_get_property_cookie_t +xcb_get_wm_icon_name(xcb_connection_t *c, + xcb_window_t window) +{ + return xcb_get_text_property(c, window, WM_ICON_NAME); +} + +xcb_get_property_cookie_t +xcb_get_wm_icon_name_unchecked(xcb_connection_t *c, + xcb_window_t window) +{ + return xcb_get_text_property_unchecked(c, window, WM_ICON_NAME); +} + +uint8_t +xcb_get_wm_icon_name_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_get_text_property_reply_t *prop, + xcb_generic_error_t **e) +{ + return xcb_get_text_property_reply(c, cookie, prop, e); +} + +void +xcb_watch_wm_icon_name(xcb_property_handlers_t *prophs, uint32_t long_len, + xcb_generic_property_handler_t handler, void *data) +{ + xcb_property_set_handler(prophs, WM_ICON_NAME, long_len, handler, data); +} + +/* WM_CLIENT_MACHINE */ + +void +xcb_set_wm_client_machine_checked(xcb_connection_t *c, xcb_window_t window, + xcb_atom_t encoding, uint32_t name_len, + const char *name) +{ + xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window, + WM_CLIENT_MACHINE, encoding, 8, name_len, name); +} + +void +xcb_set_wm_client_machine(xcb_connection_t *c, xcb_window_t window, + xcb_atom_t encoding, uint32_t name_len, + const char *name) +{ + xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_CLIENT_MACHINE, + encoding, 8, name_len, name); +} + +xcb_get_property_cookie_t +xcb_get_wm_client_machine(xcb_connection_t *c, + xcb_window_t window) +{ + return xcb_get_text_property(c, window, WM_CLIENT_MACHINE); +} + +xcb_get_property_cookie_t +xcb_get_wm_client_machine_unchecked(xcb_connection_t *c, + xcb_window_t window) +{ + return xcb_get_text_property_unchecked(c, window, WM_CLIENT_MACHINE); +} + +uint8_t +xcb_get_wm_client_machine_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_get_text_property_reply_t *prop, + xcb_generic_error_t **e) +{ + return xcb_get_text_property_reply(c, cookie, prop, e); +} + +void +xcb_watch_wm_client_machine(xcb_property_handlers_t *prophs, uint32_t long_len, + xcb_generic_property_handler_t handler, void *data) +{ + xcb_property_set_handler(prophs, WM_CLIENT_MACHINE, long_len, handler, data); +} + +/* WM_CLASS */ + +xcb_get_property_cookie_t +xcb_get_wm_class(xcb_connection_t *c, xcb_window_t window) +{ + return xcb_get_property(c, 0, window, WM_CLASS, STRING, 0L, 2048L); +} + +xcb_get_property_cookie_t +xcb_get_wm_class_unchecked(xcb_connection_t *c, xcb_window_t window) +{ + return xcb_get_property_unchecked(c, 0, window, WM_CLASS, STRING, 0L, 2048L); +} + +uint8_t +xcb_get_wm_class_from_reply(xcb_get_wm_class_reply_t *prop, + xcb_get_property_reply_t *reply) +{ + if(!reply || reply->type != STRING || reply->format != 8) + return 0; + + prop->_reply = reply; + prop->instance_name = (char *) xcb_get_property_value(prop->_reply); + + int name_len = strlen(prop->instance_name); + if(name_len == xcb_get_property_value_length(prop->_reply)) + name_len--; + + prop->class_name = prop->instance_name + name_len + 1; + + return 1; +} + +uint8_t +xcb_get_wm_class_reply(xcb_connection_t *c, xcb_get_property_cookie_t cookie, + xcb_get_wm_class_reply_t *prop, xcb_generic_error_t **e) +{ + xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie, e); + uint8_t ret = xcb_get_wm_class_from_reply(prop, reply); + /* if reply parsing failed, free the reply to avoid mem leak */ + if(!ret) + free(reply); + return ret; +} + +void xcb_get_wm_class_reply_wipe(xcb_get_wm_class_reply_t *prop) +{ + free(prop->_reply); +} + +/* WM_TRANSIENT_FOR */ + +xcb_get_property_cookie_t +xcb_get_wm_transient_for(xcb_connection_t *c, xcb_window_t window) +{ + return xcb_get_property(c, 0, window, WM_TRANSIENT_FOR, WINDOW, 0, 1); +} + +xcb_get_property_cookie_t +xcb_get_wm_transient_for_unchecked(xcb_connection_t *c, xcb_window_t window) +{ + return xcb_get_property_unchecked(c, 0, window, WM_TRANSIENT_FOR, WINDOW, 0, 1); +} + +uint8_t +xcb_get_wm_transient_for_from_reply(xcb_window_t *prop, + xcb_get_property_reply_t *reply) +{ + if(!reply || reply->type != WINDOW || reply->format != 32 || !reply->length) + return 0; + + *prop = *((xcb_window_t *) xcb_get_property_value(reply)); + + return 1; +} + +uint8_t +xcb_get_wm_transient_for_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_window_t *prop, + xcb_generic_error_t **e) +{ + xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie, e); + uint8_t ret = xcb_get_wm_transient_for_from_reply(prop, reply); + free(reply); + return ret; +} + +/* WM_SIZE_HINTS */ + +void +xcb_size_hints_set_position(xcb_size_hints_t *hints, int user_specified, + int32_t x, int32_t y) +{ + hints->flags &= ~(XCB_SIZE_HINT_US_POSITION | XCB_SIZE_HINT_P_POSITION); + if (user_specified) + hints->flags |= XCB_SIZE_HINT_US_POSITION; + else + hints->flags |= XCB_SIZE_HINT_P_POSITION; + hints->x = x; + hints->y = y; +} + +void +xcb_size_hints_set_size(xcb_size_hints_t *hints, int user_specified, + int32_t width, int32_t height) +{ + hints->flags &= ~(XCB_SIZE_HINT_US_SIZE | XCB_SIZE_HINT_P_SIZE); + if (user_specified) + hints->flags |= XCB_SIZE_HINT_US_SIZE; + else + hints->flags |= XCB_SIZE_HINT_P_SIZE; + hints->width = width; + hints->height = height; +} + +void +xcb_size_hints_set_min_size(xcb_size_hints_t *hints, int32_t min_width, + int32_t min_height) +{ + hints->flags |= XCB_SIZE_HINT_P_MIN_SIZE; + hints->min_width = min_width; + hints->min_height = min_height; +} + +void +xcb_size_hints_set_max_size(xcb_size_hints_t *hints, int32_t max_width, + int32_t max_height) +{ + hints->flags |= XCB_SIZE_HINT_P_MAX_SIZE; + hints->max_width = max_width; + hints->max_height = max_height; +} + +void +xcb_size_hints_set_resize_inc(xcb_size_hints_t *hints, int32_t width_inc, + int32_t height_inc) +{ + hints->flags |= XCB_SIZE_HINT_P_RESIZE_INC; + hints->width_inc = width_inc; + hints->height_inc = height_inc; +} + +void +xcb_size_hints_set_aspect(xcb_size_hints_t *hints, int32_t min_aspect_num, + int32_t min_aspect_den, int32_t max_aspect_num, + int32_t max_aspect_den) +{ + hints->flags |= XCB_SIZE_HINT_P_ASPECT; + hints->min_aspect_num = min_aspect_num; + hints->min_aspect_den = min_aspect_den; + hints->max_aspect_num = max_aspect_num; + hints->max_aspect_den = max_aspect_den; +} + +void +xcb_size_hints_set_base_size(xcb_size_hints_t *hints, int32_t base_width, + int32_t base_height) +{ + hints->flags |= XCB_SIZE_HINT_BASE_SIZE; + hints->base_width = base_width; + hints->base_height = base_height; +} + +void +xcb_size_hints_set_win_gravity(xcb_size_hints_t *hints, uint32_t win_gravity) +{ + hints->flags |= XCB_SIZE_HINT_P_WIN_GRAVITY; + hints->win_gravity = win_gravity; +} + +void +xcb_set_wm_size_hints_checked(xcb_connection_t *c, xcb_window_t window, + xcb_atom_t property, xcb_size_hints_t *hints) +{ + xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window, property, + WM_SIZE_HINTS, 32, sizeof(*hints) >> 2, hints); +} + +void +xcb_set_wm_size_hints(xcb_connection_t *c, xcb_window_t window, + xcb_atom_t property, xcb_size_hints_t *hints) +{ + xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, property, + WM_SIZE_HINTS, 32, sizeof(*hints) >> 2, hints); +} + +xcb_get_property_cookie_t +xcb_get_wm_size_hints(xcb_connection_t *c, xcb_window_t window, + xcb_atom_t property) +{ + /* NumPropSizeElements = 18 (ICCCM version 1). */ + return xcb_get_property(c, 0, window, property, WM_SIZE_HINTS, 0L, 18); +} + +xcb_get_property_cookie_t +xcb_get_wm_size_hints_unchecked(xcb_connection_t *c, xcb_window_t window, + xcb_atom_t property) +{ + return xcb_get_property_unchecked(c, 0, window, property, WM_SIZE_HINTS, + 0L, 18); +} + +uint8_t +xcb_get_wm_size_hints_from_reply(xcb_size_hints_t *hints, xcb_get_property_reply_t *reply) +{ + uint32_t flags; + + if(!reply) + return 0; + + int length = xcb_get_property_value_length(reply); + + if (!(reply->type == WM_SIZE_HINTS && + (reply->format == 8 || reply->format == 16 || + reply->format == 32) && + /* OldNumPropSizeElements = 15 (pre-ICCCM) */ + length >= 15)) + return 0; + + memcpy(hints, (xcb_size_hints_t *) xcb_get_property_value (reply), + length * reply->format >> 3); + + flags = (XCB_SIZE_HINT_US_POSITION | XCB_SIZE_HINT_US_SIZE | + XCB_SIZE_HINT_P_POSITION | XCB_SIZE_HINT_P_SIZE | + XCB_SIZE_HINT_P_MIN_SIZE | XCB_SIZE_HINT_P_MAX_SIZE | + XCB_SIZE_HINT_P_RESIZE_INC | XCB_SIZE_HINT_P_ASPECT); + + /* NumPropSizeElements = 18 (ICCCM version 1) */ + if(length >= 18) + flags |= (XCB_SIZE_HINT_BASE_SIZE | XCB_SIZE_HINT_P_WIN_GRAVITY); + else + { + hints->base_width = 0; + hints->base_height = 0; + hints->win_gravity = 0; + } + /* get rid of unwanted bits */ + hints->flags &= flags; + + return 1; +} + +uint8_t +xcb_get_wm_size_hints_reply(xcb_connection_t *c, xcb_get_property_cookie_t cookie, + xcb_size_hints_t *hints, xcb_generic_error_t **e) +{ + xcb_get_property_reply_t *reply = reply = xcb_get_property_reply(c, cookie, e); + uint8_t ret = xcb_get_wm_size_hints_from_reply(hints, reply); + free(reply); + return ret; +} + +/* WM_NORMAL_HINTS */ + +void +xcb_set_wm_normal_hints_checked(xcb_connection_t *c, xcb_window_t window, + xcb_size_hints_t *hints) +{ + xcb_set_wm_size_hints_checked(c, window, WM_NORMAL_HINTS, hints); +} + +void +xcb_set_wm_normal_hints(xcb_connection_t *c, xcb_window_t window, + xcb_size_hints_t *hints) +{ + xcb_set_wm_size_hints(c, window, WM_NORMAL_HINTS, hints); +} + +xcb_get_property_cookie_t +xcb_get_wm_normal_hints(xcb_connection_t *c, xcb_window_t window) +{ + return xcb_get_wm_size_hints(c, window, WM_NORMAL_HINTS); +} + +xcb_get_property_cookie_t +xcb_get_wm_normal_hints_unchecked(xcb_connection_t *c, xcb_window_t window) +{ + return xcb_get_wm_size_hints_unchecked(c, window, WM_NORMAL_HINTS); +} + +uint8_t +xcb_get_wm_normal_hints_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_size_hints_t *hints, + xcb_generic_error_t **e) +{ + return xcb_get_wm_size_hints_reply(c, cookie, hints, e); +} + +/* WM_HINTS */ + +uint32_t +xcb_wm_hints_get_urgency(xcb_wm_hints_t *hints) +{ + return (hints->flags & XCB_WM_HINT_X_URGENCY); +} + +void +xcb_wm_hints_set_input(xcb_wm_hints_t *hints, uint8_t input) +{ + hints->input = input; + hints->flags |= XCB_WM_HINT_INPUT; +} + +void +xcb_wm_hints_set_iconic(xcb_wm_hints_t *hints) +{ + hints->initial_state = XCB_WM_STATE_ICONIC; + hints->flags |= XCB_WM_HINT_STATE; +} + +void +xcb_wm_hints_set_normal(xcb_wm_hints_t *hints) +{ + hints->initial_state = XCB_WM_STATE_NORMAL; + hints->flags |= XCB_WM_HINT_STATE; +} + +void +xcb_wm_hints_set_withdrawn(xcb_wm_hints_t *hints) +{ + hints->initial_state = XCB_WM_STATE_WITHDRAWN; + hints->flags |= XCB_WM_HINT_STATE; +} + +void +xcb_wm_hints_set_none(xcb_wm_hints_t *hints) +{ + hints->flags &= ~XCB_WM_HINT_STATE; +} + +void +xcb_wm_hints_set_icon_pixmap(xcb_wm_hints_t *hints, xcb_pixmap_t icon_pixmap) +{ + hints->icon_pixmap = icon_pixmap; + hints->flags |= XCB_WM_HINT_ICON_PIXMAP; +} + +void +xcb_wm_hints_set_icon_mask(xcb_wm_hints_t *hints, xcb_pixmap_t icon_mask) +{ + hints->icon_mask = icon_mask; + hints->flags |= XCB_WM_HINT_ICON_MASK; +} + +void +xcb_wm_hints_set_icon_window(xcb_wm_hints_t *hints, xcb_window_t icon_window) +{ + hints->icon_window = icon_window; + hints->flags |= XCB_WM_HINT_ICON_WINDOW; +} + +void +xcb_wm_hints_set_window_group(xcb_wm_hints_t *hints, xcb_window_t window_group) +{ + hints->window_group = window_group; + hints->flags |= XCB_WM_HINT_WINDOW_GROUP; +} + +void +xcb_wm_hints_set_urgency(xcb_wm_hints_t *hints) +{ + hints->flags |= XCB_WM_HINT_X_URGENCY; +} + +void +xcb_set_wm_hints_checked(xcb_connection_t *c, xcb_window_t window, + xcb_wm_hints_t *hints) +{ + xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window, WM_HINTS, + WM_HINTS, 32, sizeof(*hints) >> 2, hints); +} + +void +xcb_set_wm_hints(xcb_connection_t *c, xcb_window_t window, + xcb_wm_hints_t *hints) +{ + xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_HINTS, WM_HINTS, 32, + sizeof(*hints) >> 2, hints); +} + +xcb_get_property_cookie_t xcb_get_wm_hints(xcb_connection_t *c, + xcb_window_t window) +{ + return xcb_get_property(c, 0, window, WM_HINTS, WM_HINTS, 0L, + XCB_NUM_WM_HINTS_ELEMENTS); +} + +xcb_get_property_cookie_t xcb_get_wm_hints_unchecked(xcb_connection_t *c, + xcb_window_t window) +{ + return xcb_get_property_unchecked(c, 0, window, WM_HINTS, WM_HINTS, 0L, + XCB_NUM_WM_HINTS_ELEMENTS); +} + +uint8_t +xcb_get_wm_hints_from_reply(xcb_wm_hints_t *hints, + xcb_get_property_reply_t *reply) +{ + if(!reply) + return 0; + + int length = xcb_get_property_value_length(reply); + + if ((reply->type != WM_HINTS) || + (length < (XCB_NUM_WM_HINTS_ELEMENTS - 1)) || + (reply->format != 32)) + return 0; + + memcpy(hints, (xcb_size_hints_t *) xcb_get_property_value(reply), + length * reply->format >> 3); + + if(length < XCB_NUM_WM_HINTS_ELEMENTS) + hints->window_group = XCB_NONE; + + return 1; +} + +uint8_t +xcb_get_wm_hints_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_wm_hints_t *hints, + xcb_generic_error_t **e) +{ + xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie, e); + int ret = xcb_get_wm_hints_from_reply(hints, reply); + free(reply); + return ret; +} + +/* WM_PROTOCOLS */ + +void +xcb_set_wm_protocols_checked(xcb_connection_t *c, xcb_atom_t wm_protocols, + xcb_window_t window, uint32_t list_len, + xcb_atom_t *list) +{ + xcb_change_property_checked(c, XCB_PROP_MODE_REPLACE, window, wm_protocols, + ATOM, 32, list_len, list); +} + +void +xcb_set_wm_protocols(xcb_connection_t *c, xcb_atom_t wm_protocols, + xcb_window_t window, uint32_t list_len, xcb_atom_t *list) +{ + xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, wm_protocols, ATOM, 32, + list_len, list); +} + +xcb_get_property_cookie_t +xcb_get_wm_protocols(xcb_connection_t *c, xcb_window_t window, + xcb_atom_t wm_protocol_atom) +{ + return xcb_get_property(c, 0, window, wm_protocol_atom, ATOM, 0, UINT_MAX); +} + +xcb_get_property_cookie_t +xcb_get_wm_protocols_unchecked(xcb_connection_t *c, + xcb_window_t window, + xcb_atom_t wm_protocol_atom) +{ + return xcb_get_property_unchecked(c, 0, window, wm_protocol_atom, ATOM, 0, + UINT_MAX); +} + +uint8_t +xcb_get_wm_protocols_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_get_wm_protocols_reply_t *protocols, + xcb_generic_error_t **e) +{ + xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie, e); + + if(!reply || reply->type != ATOM || reply->format != 32) + { + free(reply); + return 0; + } + + protocols->_reply = reply; + protocols->atoms_len = xcb_get_property_value_length(protocols->_reply); + protocols->atoms = (xcb_atom_t *) xcb_get_property_value(protocols->_reply); + + return 1; +} + +void +xcb_get_wm_protocols_reply_wipe(xcb_get_wm_protocols_reply_t *protocols) +{ + free(protocols->_reply); +} diff --git a/dist/xcb-util/icccm/xcb-icccm.pc.in b/dist/xcb-util/icccm/xcb-icccm.pc.in new file mode 100644 index 000000000..058656074 --- /dev/null +++ b/dist/xcb-util/icccm/xcb-icccm.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: XCB ICCCM library +Description: XCB ICCCM binding +Version: @PACKAGE_VERSION@ +Requires: xcb xcb-atom xcb-property +Libs: -L${libdir} -lxcb-icccm @LIBS@ +Cflags: -I${includedir} diff --git a/dist/xcb-util/icccm/xcb_icccm.h b/dist/xcb-util/icccm/xcb_icccm.h new file mode 100644 index 000000000..5358d899f --- /dev/null +++ b/dist/xcb-util/icccm/xcb_icccm.h @@ -0,0 +1,905 @@ +#ifndef __XCB_ICCCM_H__ +#define __XCB_ICCCM_H__ + +/* + * Copyright (C) 2008 Arnaud Fontaine <arnau@debian.org> + * Copyright (C) 2007-2008 Vincent Torri <vtorri@univ-evry.fr> + * + * 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 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. + * + * Except as contained in this notice, the names of the authors or + * their institutions shall not be used in advertising or otherwise to + * promote the sale, use or other dealings in this Software without + * prior written authorization from the authors. + */ + +/** + * @defgroup xcb__icccm_t XCB ICCCM Functions + * + * These functions allow easy handling of the protocol described in the + * Inter-Client Communication Conventions Manual. + * + * @{ + */ + +#include <xcb/xcb.h> +#include "xcb_property.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief TextProperty reply structure. + */ +typedef struct { + /** Store reply to avoid memory allocation, should normally not be + used directly */ + xcb_get_property_reply_t *_reply; + /** Encoding used */ + xcb_atom_t encoding; + /** Length of the name field above */ + uint32_t name_len; + /** Property value */ + char *name; + /** Format, may be 8, 16 or 32 */ + uint8_t format; +} xcb_get_text_property_reply_t; + +/** + * @brief Deliver a GetProperty request to the X server. + * @param c The connection to the X server. + * @param window Window X identifier. + * @param property Property atom to get. + * @return The request cookie. + * + * Allow to get a window property, in most case you might want to use + * above functions to get an ICCCM property for a given window. + */ +xcb_get_property_cookie_t xcb_get_text_property(xcb_connection_t *c, + xcb_window_t window, + xcb_atom_t property); + +/** + * @see xcb_get_text_property() + */ +xcb_get_property_cookie_t xcb_get_text_property_unchecked(xcb_connection_t *c, + xcb_window_t window, + xcb_atom_t property); + +/** + * @brief Fill given structure with the property value of a window. + * @param c The connection to the X server. + * @param cookie TextProperty request cookie. + * @param prop TextProperty reply which is to be filled. + * @param e Error if any. + * @return Return 1 on success, 0 otherwise. + * + * If the function return 0 (failure), the content of prop is unmodified and + * therefore the structure must not be wiped. + * + * The parameter e supplied to this function must be NULL if + * xcb_get_text_property_unchecked() is used. Otherwise, it stores + * the error if any. prop structure members should be freed by + * xcb_get_text_property_reply_wipe(). + */ +uint8_t xcb_get_text_property_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_get_text_property_reply_t *prop, + xcb_generic_error_t **e); + +/** + * @brief Wipe prop structure members previously allocated by + * xcb_get_text_property_reply(). + * @param prop prop structure whose members is going to be freed. + */ +void xcb_get_text_property_reply_wipe(xcb_get_text_property_reply_t *prop); + +/* WM_NAME */ + +/** + * @brief Deliver a SetProperty request to set WM_NAME property value. + * @param c The connection to the X server. + * @param window Window X identifier. + * @param encoding Encoding used for the data passed in the name parameter, the set property will also have this encoding as its type. + * @param name_len Length of name value to set. + * @param name Name value to set. + */ +void xcb_set_wm_name_checked(xcb_connection_t *c, + xcb_window_t window, + xcb_atom_t encoding, + uint32_t name_len, + const char *name); + +/** + * @see xcb_set_wm_name_checked() + */ +void xcb_set_wm_name(xcb_connection_t *c, xcb_window_t window, + xcb_atom_t encoding, uint32_t name_len, + const char *name); + +/** + * @brief Deliver a GetProperty request to the X server for WM_NAME. + * @param c The connection to the X server. + * @param window Window X identifier. + * @return The request cookie. + */ +xcb_get_property_cookie_t xcb_get_wm_name(xcb_connection_t *c, + xcb_window_t window); + +/** + * @see xcb_get_wm_name() + */ +xcb_get_property_cookie_t xcb_get_wm_name_unchecked(xcb_connection_t *c, + xcb_window_t window); + +/** + * @brief Fill given structure with the WM_NAME property of a window. + * @param c The connection to the X server. + * @param cookie Request cookie. + * @param prop WM_NAME property value. + * @param e Error if any. + * @see xcb_get_text_property_reply() + * @return Return 1 on success, 0 otherwise. + */ +uint8_t xcb_get_wm_name_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_get_text_property_reply_t *prop, + xcb_generic_error_t **e); + +/** + * @brief Set a callback on WM_NAME property changes. + * @param prophs Property handlers. + * @param long_len Length of data. + * @param handler The callback. + * @param data data given to the callback. + */ +void xcb_watch_wm_name(xcb_property_handlers_t *prophs, uint32_t long_len, + xcb_generic_property_handler_t handler, void *data); + +/* WM_ICON_NAME */ + +/** + * @brief Deliver a SetProperty request to set WM_ICON_NAME property value. + * @param c The connection to the X server. + * @param window Window X identifier. + * @param encoding Encoding used for the data passed in the name parameter, the set property will also have this encoding as its type. + * @param name_len Length of name value to set. + * @param name Name value to set. + */ +void xcb_set_wm_icon_name_checked(xcb_connection_t *c, xcb_window_t window, + xcb_atom_t encoding, uint32_t name_len, + const char *name); + +/** + * @see xcb_set_wm_icon_name_checked() + */ +void xcb_set_wm_icon_name(xcb_connection_t *c, xcb_window_t window, + xcb_atom_t encoding, uint32_t name_len, + const char *name); + +/** + * @brief Send request to get WM_ICON_NAME property of a window. + * @param c The connection to the X server. + * @param window Window X identifier. + * @return The request cookie. + */ +xcb_get_property_cookie_t xcb_get_wm_icon_name(xcb_connection_t *c, + xcb_window_t window); + +/** + * @see xcb_get_wm_icon_name() + */ +xcb_get_property_cookie_t xcb_get_wm_icon_name_unchecked(xcb_connection_t *c, + xcb_window_t window); + +/** + * @brief Fill given structure with the WM_ICON_NAME property of a window. + * @param c The connection to the X server. + * @param cookie Request cookie. + * @param prop WM_ICON_NAME property value. + * @param e Error if any. + * @see xcb_get_text_property_reply() + * @return Return 1 on success, 0 otherwise. + */ +uint8_t xcb_get_wm_icon_name_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_get_text_property_reply_t *prop, + xcb_generic_error_t **e); + +/** + * @brief Set a callback on WM_ICON_NAME property changes. + * @param prophs Property handlers. + * @param long_len Length of data. + * @param handler The callback. + * @param data data given to the callback. + */ +void xcb_watch_wm_icon_name(xcb_property_handlers_t *prophs, uint32_t long_len, + xcb_generic_property_handler_t handler, + void *data); + +/* WM_CLIENT_MACHINE */ + +/** + * @brief Deliver a SetProperty request to set WM_CLIENT_MACHINE property value. + * @param c The connection to the X server. + * @param window Window X identifier. + * @param encoding Encoding used for the data passed in the name parameter, the set property will also have this encoding as its type. + * @param name_len Length of name value to set. + * @param name Name value to set. + */ +void xcb_set_wm_client_machine_checked(xcb_connection_t *c, xcb_window_t window, + xcb_atom_t encoding, uint32_t name_len, + const char *name); + +/** + * @see xcb_set_wm_client_machine_checked() + */ +void xcb_set_wm_client_machine(xcb_connection_t *c, xcb_window_t window, + xcb_atom_t encoding, uint32_t name_len, + const char *name); + +/** + * @brief Send request to get WM_CLIENT_MACHINE property of a window. + * @param c The connection to the X server. + * @param window Window X identifier. + * @return The request cookie. + */ +xcb_get_property_cookie_t xcb_get_wm_client_machine(xcb_connection_t *c, + xcb_window_t window); + +/** + * @see xcb_get_wm_client_machine() + */ +xcb_get_property_cookie_t xcb_get_wm_client_machine_unchecked(xcb_connection_t *c, + xcb_window_t window); + +/** + * @brief Fill given structure with the WM_CLIENT_MACHINE property of a window. + * @param c The connection to the X server. + * @param cookie Request cookie. + * @param prop WM_CLIENT_MACHINE property value. + * @param e Error if any. + * @see xcb_get_text_property_reply() + * @return Return 1 on success, 0 otherwise. + */ +uint8_t xcb_get_wm_client_machine_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_get_text_property_reply_t *prop, + xcb_generic_error_t **e); + +/** + * @brief Set a callback on WM_CLIENT_MACHINE property changes. + * @param prophs Property handlers. + * @param long_len Length of data. + * @param handler The callback. + * @param data data given to the callback. + */ +void xcb_watch_wm_client_machine(xcb_property_handlers_t *prophs, + uint32_t long_len, + xcb_generic_property_handler_t handler, + void *data); + +/* WM_CLASS */ + +/** + * @brief WM_CLASS hint structure + */ +typedef struct { + /** Instance name */ + char *instance_name; + /** Class of application */ + char *class_name; + /** Store reply to avoid memory allocation, should normally not be + used directly */ + xcb_get_property_reply_t *_reply; +} xcb_get_wm_class_reply_t; + +/** + * @brief Deliver a GetProperty request to the X server for WM_CLASS. + * @param c The connection to the X server. + * @param window Window X identifier. + * @return The request cookie. + */ +xcb_get_property_cookie_t xcb_get_wm_class(xcb_connection_t *c, + xcb_window_t window); + +/** + * @see xcb_get_wm_class() + */ +xcb_get_property_cookie_t xcb_get_wm_class_unchecked(xcb_connection_t *c, + xcb_window_t window); + + +/** + * @brief Fill give structure with the WM_CLASS property of a window. + * @param prop The property structur to fill. + * @param reply The property request reply. + * @return Return 1 on success, 0 otherwise. + */ +uint8_t +xcb_get_wm_class_from_reply(xcb_get_wm_class_reply_t *prop, + xcb_get_property_reply_t *reply); + +/** + * @brief Fill given structure with the WM_CLASS property of a window. + * @param c The connection to the X server. + * @param cookie Request cookie. + * @param prop WM_CLASS property value. + * @param e Error if any. + * @return Return 1 on success, 0 otherwise. + * + * The parameter e supplied to this function must be NULL if + * xcb_get_wm_class_unchecked() is used. Otherwise, it stores the + * error if any. prop structure members should be freed by + * xcb_get_wm_class_reply_wipe(). + */ +uint8_t xcb_get_wm_class_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_get_wm_class_reply_t *prop, + xcb_generic_error_t **e); + +/** + * @brief Wipe prop structure members previously allocated by + * xcb_get_wm_class_reply(). + * @param prop prop structure whose members is going to be freed. + */ +void xcb_get_wm_class_reply_wipe(xcb_get_wm_class_reply_t *prop); + +/* WM_TRANSIENT_FOR */ + +/** + * @brief Send request to get WM_TRANSIENT_FOR property of a window. + * @param c The connection to the X server + * @param window Window X identifier. + * @return The request cookie. + */ +xcb_get_property_cookie_t xcb_get_wm_transient_for(xcb_connection_t *c, + xcb_window_t window); + +/** + * @see xcb_get_wm_transient_for_unchecked() + */ +xcb_get_property_cookie_t xcb_get_wm_transient_for_unchecked(xcb_connection_t *c, + xcb_window_t window); + +/** + * @brief Fill given window pointer with the WM_TRANSIENT_FOR property of a window. + * @param prop WM_TRANSIENT_FOR property value. + * @param reply The get property request reply. + * @return Return 1 on success, 0 otherwise. + */ +uint8_t +xcb_get_wm_transient_for_from_reply(xcb_window_t *prop, + xcb_get_property_reply_t *reply); +/** + * @brief Fill given structure with the WM_TRANSIENT_FOR property of a window. + * @param c The connection to the X server. + * @param cookie Request cookie. + * @param prop WM_TRANSIENT_FOR property value. + * @param e Error if any. + * @return Return 1 on success, 0 otherwise. + * + * The parameter e supplied to this function must be NULL if + * xcb_get_wm_transient_for_unchecked() is used. Otherwise, it stores + * the error if any. + */ +uint8_t xcb_get_wm_transient_for_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_window_t *prop, + xcb_generic_error_t **e); + +/* WM_SIZE_HINTS */ + +typedef enum { + XCB_SIZE_HINT_US_POSITION = 1 << 0, + XCB_SIZE_HINT_US_SIZE = 1 << 1, + XCB_SIZE_HINT_P_POSITION = 1 << 2, + XCB_SIZE_HINT_P_SIZE = 1 << 3, + XCB_SIZE_HINT_P_MIN_SIZE = 1 << 4, + XCB_SIZE_HINT_P_MAX_SIZE = 1 << 5, + XCB_SIZE_HINT_P_RESIZE_INC = 1 << 6, + XCB_SIZE_HINT_P_ASPECT = 1 << 7, + XCB_SIZE_HINT_BASE_SIZE = 1 << 8, + XCB_SIZE_HINT_P_WIN_GRAVITY = 1 << 9 +} xcb_size_hints_flags_t; + +/** + * @brief Size hints structure. + */ +typedef struct { + /** User specified flags */ + uint32_t flags; + /** User-specified position */ + int32_t x, y; + /** User-specified size */ + int32_t width, height; + /** Program-specified minimum size */ + int32_t min_width, min_height; + /** Program-specified maximum size */ + int32_t max_width, max_height; + /** Program-specified resize increments */ + int32_t width_inc, height_inc; + /** Program-specified minimum aspect ratios */ + int32_t min_aspect_num, min_aspect_den; + /** Program-specified maximum aspect ratios */ + int32_t max_aspect_num, max_aspect_den; + /** Program-specified base size */ + int32_t base_width, base_height; + /** Program-specified window gravity */ + uint32_t win_gravity; +} xcb_size_hints_t; + +/** + * @brief Set size hints to a given position. + * @param hints SIZE_HINTS structure. + * @param user_specified Is the size user-specified? + * @param x The X position. + * @param y The Y position. + */ +void xcb_size_hints_set_position(xcb_size_hints_t *hints, int user_specified, + int32_t x, int32_t y); + +/** + * @brief Set size hints to a given size. + * @param hints SIZE_HINTS structure. + * @param user_specified is the size user-specified? + * @param width The width. + * @param height The height. + */ +void xcb_size_hints_set_size(xcb_size_hints_t *hints, int user_specified, + int32_t width, int32_t height); + +/** + * @brief Set size hints to a given minimum size. + * @param hints SIZE_HINTS structure. + * @param width The minimum width. + * @param height The minimum height. + */ +void xcb_size_hints_set_min_size(xcb_size_hints_t *hints, int32_t min_width, + int32_t min_height); + +/** + * @brief Set size hints to a given maximum size. + * @param hints SIZE_HINTS structure. + * @param width The maximum width. + * @param height The maximum height. + */ +void xcb_size_hints_set_max_size(xcb_size_hints_t *hints, int32_t max_width, + int32_t max_height); + +/** + * @brief Set size hints to a given resize increments. + * @param hints SIZE_HINTS structure. + * @param width The resize increments width. + * @param height The resize increments height. + */ +void xcb_size_hints_set_resize_inc(xcb_size_hints_t *hints, int32_t width_inc, + int32_t height_inc); + +/** + * @brief Set size hints to a given aspect ratios. + * @param hints SIZE_HINTS structure. + * @param min_aspect_num The minimum aspect ratios for the width. + * @param min_aspect_den The minimum aspect ratios for the height. + * @param max_aspect_num The maximum aspect ratios for the width. + * @param max_aspect_den The maximum aspect ratios for the height. + */ +void xcb_size_hints_set_aspect(xcb_size_hints_t *hints, int32_t min_aspect_num, + int32_t min_aspect_den, int32_t max_aspect_num, + int32_t max_aspect_den); + +/** + * @brief Set size hints to a given base size. + * @param hints SIZE_HINTS structure. + * @param base_width Base width. + * @param base_height Base height. + */ +void xcb_size_hints_set_base_size(xcb_size_hints_t *hints, int32_t base_width, + int32_t base_height); + +/** + * @brief Set size hints to a given window gravity. + * @param hints SIZE_HINTS structure. + * @param win_gravity Window gravity value. + */ +void xcb_size_hints_set_win_gravity(xcb_size_hints_t *hints, + uint32_t win_gravity); + +/** + * @brief Deliver a ChangeProperty request to set a value to a given property. + * @param c The connection to the X server. + * @param window Window X identifier. + * @param property Property to set value for. + * @param hints Hints value to set. + */ +void xcb_set_wm_size_hints_checked(xcb_connection_t *c, xcb_window_t window, + xcb_atom_t property, xcb_size_hints_t *hints); + +/** + * @see xcb_set_wm_size_hints_checked() + */ +void xcb_set_wm_size_hints(xcb_connection_t *c, xcb_window_t window, + xcb_atom_t property, xcb_size_hints_t *hints); + +/** + * @brief Send request to get size hints structure for the named property. + * @param c The connection to the X server. + * @param window Window X identifier. + * @param property Specify the property name. + * @return The request cookie. + */ +xcb_get_property_cookie_t xcb_get_wm_size_hints(xcb_connection_t *c, + xcb_window_t window, + xcb_atom_t property); + +/** + * @see xcb_get_wm_size_hints() + */ +xcb_get_property_cookie_t xcb_get_wm_size_hints_unchecked(xcb_connection_t *c, + xcb_window_t window, + xcb_atom_t property); + +/** + * @brief Fill given structure with the size hints of the named property. + * @param c The connection to the X server. + * @param cookie Request cookie. + * @param hints Size hints structure. + * @param e Error if any. + * @return Return 1 on success, 0 otherwise. + * + * The parameter e supplied to this function must be NULL if + * xcb_get_wm_size_hints_unchecked() is used. Otherwise, it stores + * the error if any. The returned pointer should be freed. + */ +uint8_t xcb_get_wm_size_hints_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_size_hints_t *hints, + xcb_generic_error_t **e); + +/* WM_NORMAL_HINTS */ + +/** + * @brief Deliver a ChangeProperty request to set WM_NORMAL_HINTS property value. + * @param c The connection to the X server. + * @param window Window X identifier. + * @param hints Hints value to set. + */ +void xcb_set_wm_normal_hints_checked(xcb_connection_t *c, xcb_window_t window, + xcb_size_hints_t *hints); + +/** + * @see xcb_set_wm_normal_hints_checked() + */ +void xcb_set_wm_normal_hints(xcb_connection_t *c, xcb_window_t window, + xcb_size_hints_t *hints); + +/** + * @brief Send request to get WM_NORMAL_HINTS property of a window. + * @param c The connection to the X server. + * @param window Window X identifier. + * @return The request cookie. + */ +xcb_get_property_cookie_t xcb_get_wm_normal_hints(xcb_connection_t *c, + xcb_window_t window); + +/** + * @see xcb_get_wm_normal_hints() + */ +xcb_get_property_cookie_t xcb_get_wm_normal_hints_unchecked(xcb_connection_t *c, + xcb_window_t window); + +/** + * @brief Fill given structure with the WM_NORMAL_HINTS property of a window. + * @param hints WM_NORMAL_HINTS property value. + * @param reply The get property request reply. + * @return Return 1 on success, 0 otherwise. + */ +uint8_t +xcb_get_wm_size_hints_from_reply(xcb_size_hints_t *hints, + xcb_get_property_reply_t *reply); + +/** + * @brief Fill given structure with the WM_NORMAL_HINTS property of a window. + * @param c The connection to the X server. + * @param cookie Request cookie. + * @param hints WM_NORMAL_HINTS property value. + * @param e Error if any. + * @return Return 1 on success, 0 otherwise. + * + * The parameter e supplied to this function must be NULL if + * xcb_get_wm_normal_hints_unchecked() is used. Otherwise, it stores + * the error if any. The returned pointer should be freed. + */ +uint8_t xcb_get_wm_normal_hints_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_size_hints_t *hints, + xcb_generic_error_t **e); + +/* WM_HINTS */ + +/** + * @brief WM hints structure (may be extended in the future). + */ +typedef struct { + /** Marks which fields in this structure are defined */ + int32_t flags; + /** Does this application rely on the window manager to get keyboard + input? */ + uint32_t input; + /** See below */ + int32_t initial_state; + /** Pixmap to be used as icon */ + xcb_pixmap_t icon_pixmap; + /** Window to be used as icon */ + xcb_window_t icon_window; + /** Initial position of icon */ + int32_t icon_x, icon_y; + /** Icon mask bitmap */ + xcb_pixmap_t icon_mask; + /* Identifier of related window group */ + xcb_window_t window_group; +} xcb_wm_hints_t; + +/** Number of elements in this structure */ +#define XCB_NUM_WM_HINTS_ELEMENTS 9 + +/** + * @brief WM_HINTS window states. + */ +typedef enum { + XCB_WM_STATE_WITHDRAWN = 0, + XCB_WM_STATE_NORMAL = 1, + XCB_WM_STATE_ICONIC = 3 +} xcb_wm_state_t; + +typedef enum { + XCB_WM_HINT_INPUT = (1L << 0), + XCB_WM_HINT_STATE = (1L << 1), + XCB_WM_HINT_ICON_PIXMAP = (1L << 2), + XCB_WM_HINT_ICON_WINDOW = (1L << 3), + XCB_WM_HINT_ICON_POSITION = (1L << 4), + XCB_WM_HINT_ICON_MASK = (1L << 5), + XCB_WM_HINT_WINDOW_GROUP = (1L << 6), + XCB_WM_HINT_X_URGENCY = (1L << 8) +} xcb_wm_t; + +#define XCB_WM_ALL_HINTS (XCB_WM_HINT_INPUT | XCB_WM_HINT_STATE |\ + XCB_WM_HINT_ICON_PIXMAP | XCB_WM_HINT_ICON_WINDOW |\ + XCB_WM_HINT_ICON_POSITION | XCB_WM_HINT_ICON_MASK |\ + XCB_WM_HINT_WINDOW_GROUP) + +/** + * @brief Get urgency hint. + * @param hints WM_HINTS structure. + * @return Urgency hint value. + */ +uint32_t xcb_wm_hints_get_urgency(xcb_wm_hints_t *hints); + +/** + * @brief Set input focus. + * @param hints WM_HINTS structure. + * @param input Input focus. + */ +void xcb_wm_hints_set_input(xcb_wm_hints_t *hints, uint8_t input); + +/** + * @brief Set hints state to 'iconic'. + * @param hints WM_HINTS structure. + */ +void xcb_wm_hints_set_iconic(xcb_wm_hints_t *hints); + +/** + * @brief Set hints state to 'normal'. + * @param hints WM_HINTS structure. + */ +void xcb_wm_hints_set_normal(xcb_wm_hints_t *hints); + +/** + * @brief Set hints state to 'withdrawn'. + * @param hints WM_HINTS structure. + */ +void xcb_wm_hints_set_withdrawn(xcb_wm_hints_t *hints); + +/** + * @brief Set hints state to none. + * @param hints WM_HINTS structure. + */ +void xcb_wm_hints_set_none(xcb_wm_hints_t *hints); + +/** + * @brief Set pixmap to be used as icon. + * @param hints WM_HINTS structure. + * @param icon_pixmap Pixmap. + */ +void xcb_wm_hints_set_icon_pixmap(xcb_wm_hints_t *hints, + xcb_pixmap_t icon_pixmap); + +/** + * @brief Set icon mask bitmap. + * @param hints WM_HINTS structure. + * @param icon_mask Pixmap. + */ +void xcb_wm_hints_set_icon_mask(xcb_wm_hints_t *hints, xcb_pixmap_t icon_mask); + +/** + * @brief Set window identifier to be used as icon. + * @param hints WM_HINTS structure. + * @param icon_window Window X identifier. + */ +void xcb_wm_hints_set_icon_window(xcb_wm_hints_t *hints, + xcb_window_t icon_window); + +/** + * @brief Set identifier of related window group. + * @param hints WM_HINTS structure. + * @param window_group Window X identifier. + */ +void xcb_wm_hints_set_window_group(xcb_wm_hints_t *hints, + xcb_window_t window_group); + +/** + * @brief Set urgency hints flag. + * @param hints WM_HINTS structure. + */ +void xcb_wm_hints_set_urgency(xcb_wm_hints_t *hints); + +/** + * @brief Deliver a SetProperty request to set WM_HINTS property value. + * @param c The connection to the X server. + * @param window Window X identifier. + * @param hints Hints value to set. + */ +void xcb_set_wm_hints_checked(xcb_connection_t *c, xcb_window_t window, + xcb_wm_hints_t *hints); + +/** + * @see xcb_set_wm_hints_checked() + */ +void xcb_set_wm_hints(xcb_connection_t *c, xcb_window_t window, + xcb_wm_hints_t *hints); + +/** + * @brief Send request to get WM_HINTS property of a window. + * @param c The connection to the X server. + * @param window Window X identifier. + * @return The request cookie. + */ +xcb_get_property_cookie_t xcb_get_wm_hints(xcb_connection_t *c, + xcb_window_t window); + +/** + * @see xcb_get_wm_hints() + */ +xcb_get_property_cookie_t xcb_get_wm_hints_unchecked(xcb_connection_t *c, + xcb_window_t window); + +/** + * @brief Fill given structure with the WM_HINTS property of a window. + * @param hints WM_HINTS property value. + * @param reply The get property request reply. + * @return Return 1 on success, 0 otherwise. + */ +uint8_t +xcb_get_wm_hints_from_reply(xcb_wm_hints_t *hints, + xcb_get_property_reply_t *reply); + +/** + * @brief Fill given structure with the WM_HINTS property of a window. + * @param c The connection to the X server. + * @param cookie Request cookie. + * @param hints WM_HINTS property value. + * @param e Error if any. + * @return Return 1 on success, 0 otherwise. + * + * The parameter e supplied to this function must be NULL if + * xcb_get_wm_hints_unchecked() is used. Otherwise, it stores the + * error if any. The returned pointer should be freed. + */ +uint8_t xcb_get_wm_hints_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_wm_hints_t *hints, + xcb_generic_error_t **e); + +/* WM_PROTOCOLS */ + +/** + * @brief Deliver a SetProperty request to set WM_PROTOCOLS property value. + * @param c The connection to the X server. + * @param wm_protocols The WM_PROTOCOLS atom. + * @param window Window X identifier. + * @param list_len Atom list len. + * @param list Atom list. + */ +void xcb_set_wm_protocols_checked(xcb_connection_t *c, xcb_atom_t wm_protocols, + xcb_window_t window, uint32_t list_len, + xcb_atom_t *list); + +/** + * @see xcb_set_wm_protocols_checked() + */ +void xcb_set_wm_protocols(xcb_connection_t *c, xcb_atom_t wm_protocols, + xcb_window_t window, uint32_t list_len, + xcb_atom_t *list); + +/** + * @brief WM_PROTOCOLS structure. + */ +typedef struct { + /** Length of the atoms list */ + uint32_t atoms_len; + /** Atoms list */ + xcb_atom_t *atoms; + /** Store reply to avoid memory allocation, should normally not be + used directly */ + xcb_get_property_reply_t *_reply; +} xcb_get_wm_protocols_reply_t; + +/** + * @brief Send request to get WM_PROTOCOLS property of a given window. + * @param c The connection to the X server. + * @param window Window X identifier. + * @return The request cookie. + */ +xcb_get_property_cookie_t xcb_get_wm_protocols(xcb_connection_t *c, + xcb_window_t window, + xcb_atom_t wm_protocol_atom); + +/** + * @see xcb_get_wm_protocols() + */ +xcb_get_property_cookie_t xcb_get_wm_protocols_unchecked(xcb_connection_t *c, + xcb_window_t window, + xcb_atom_t wm_protocol_atom); + +/** + * @brief Fill the given structure with the WM_PROTOCOLS property of a window. + * @param c The connection to the X server. + * @param cookie Request cookie. + * @param protocols WM_PROTOCOLS property value. + * @param e Error if any. + * @return Return 1 on success, 0 otherwise. + * + * The parameter e supplied to this function must be NULL if + * xcb_get_wm_protocols_unchecked() is used. Otherwise, it stores the + * error if any. protocols structure members should be freed by + * xcb_get_wm_protocols_reply_wipe(). + */ +uint8_t xcb_get_wm_protocols_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_get_wm_protocols_reply_t *protocols, + xcb_generic_error_t **e); + +/** + * @brief Wipe protocols structure members previously allocated by + * xcb_get_wm_protocols_reply(). + * @param protocols protocols structure whose members is going to be freed. + */ +void xcb_get_wm_protocols_reply_wipe(xcb_get_wm_protocols_reply_t *protocols); + +#ifdef __cplusplus +} +#endif + +/** + * @} + */ + +#endif /* __XCB_ICCCM_H__ */ |