diff --git a/Makefile.in b/Makefile.in index 6d87739d45ce5231110946312725d1271f52568c..0c8428daef29a26976d659de4bce879da89722db 100644 --- a/Makefile.in +++ b/Makefile.in @@ -87,6 +87,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/config.h.in b/config.h.in index e2e726061487744c968d7e0931ba8e23cf2aa784..64d86692e6c68664b902e9a513fba47dc40f8d3f 100644 --- a/config.h.in +++ b/config.h.in @@ -15,6 +15,9 @@ /* Define to 1 if you have the `bind_textdomain_codeset' function. */ #undef HAVE_BIND_TEXTDOMAIN_CODESET +/* Define to enable compositor */ +#undef HAVE_COMPOSITOR + /* Define to 1 if you have the `daemon' function. */ #undef HAVE_DAEMON diff --git a/configure b/configure index 36c994149bd5cfbe1b065892524fc2b5a7efd896..2e989b76c7263b985bccc3ae155ff3a5698be73d 100755 --- a/configure +++ b/configure @@ -463,7 +463,7 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP build build_cpu build_vendor build_os host host_cpu host_vendor host_os LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL GETTEXT_PACKAGE USE_NLS MSGFMT GMSGFMT XGETTEXT CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLLIBS PO_IN_DATADIR_TRUE PO_IN_DATADIR_FALSE POFILES POSUB MKINSTALLDIRS localedir X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LIBX11_CFLAGS LIBX11_LDFLAGS LIBX11_LIBS LIBXPM_CFLAGS LIBXPM_LDFLAGS LIBXPM_LIBS PKG_CONFIG GTK_CFLAGS GTK_LIBS GTK_REQUIRED_VERSION LIBXFCE4MCS_CLIENT_CFLAGS LIBXFCE4MCS_CLIENT_LIBS LIBXFCE4MCS_CLIENT_REQUIRED_VERSION LIBXFCE4MCS_MANAGER_CFLAGS LIBXFCE4MCS_MANAGER_LIBS LIBXFCE4MCS_MANAGER_REQUIRED_VERSION LIBXFCE4UTIL_CFLAGS LIBXFCE4UTIL_LIBS LIBXFCE4UTIL_REQUIRED_VERSION LIBXFCEGUI4_CFLAGS LIBXFCEGUI4_LIBS LIBXFCEGUI4_REQUIRED_VERSION XFCE_MCS_MANAGER_CFLAGS XFCE_MCS_MANAGER_LIBS XFCE_MCS_MANAGER_REQUIRED_VERSION XFCE_MCS_MANAGER_PLUGINSDIR LIBSTARTUP_NOTIFICATION_CFLAGS LIBSTARTUP_NOTIFICATION_LIBS LIBSTARTUP_NOTIFICATION_REQUIRED_VERSION RANDR_LIBS LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP build build_cpu build_vendor build_os host host_cpu host_vendor host_os LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL GETTEXT_PACKAGE USE_NLS MSGFMT GMSGFMT XGETTEXT CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLLIBS PO_IN_DATADIR_TRUE PO_IN_DATADIR_FALSE POFILES POSUB MKINSTALLDIRS localedir X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LIBX11_CFLAGS LIBX11_LDFLAGS LIBX11_LIBS LIBXPM_CFLAGS LIBXPM_LDFLAGS LIBXPM_LIBS PKG_CONFIG GTK_CFLAGS GTK_LIBS GTK_REQUIRED_VERSION LIBXFCE4MCS_CLIENT_CFLAGS LIBXFCE4MCS_CLIENT_LIBS LIBXFCE4MCS_CLIENT_REQUIRED_VERSION LIBXFCE4MCS_MANAGER_CFLAGS LIBXFCE4MCS_MANAGER_LIBS LIBXFCE4MCS_MANAGER_REQUIRED_VERSION LIBXFCE4UTIL_CFLAGS LIBXFCE4UTIL_LIBS LIBXFCE4UTIL_REQUIRED_VERSION LIBXFCEGUI4_CFLAGS LIBXFCEGUI4_LIBS LIBXFCEGUI4_REQUIRED_VERSION XFCE_MCS_MANAGER_CFLAGS XFCE_MCS_MANAGER_LIBS XFCE_MCS_MANAGER_REQUIRED_VERSION XFCE_MCS_MANAGER_PLUGINSDIR LIBSTARTUP_NOTIFICATION_CFLAGS LIBSTARTUP_NOTIFICATION_LIBS LIBSTARTUP_NOTIFICATION_REQUIRED_VERSION RANDR_LIBS COMPOSITOR_CFLAGS COMPOSITOR_LIBS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1045,6 +1045,8 @@ Optional Features: Disable checking for startup notification library --enable-randr try to use the randr extension --disable-randr don't try to use the randr extension + --enable-compositor enable compositor in xfwm4 + --disable-compositor disable compositor in xfwm4 --enable-debug=yes|no|full Build with debugging support --disable-debug Include no debugging support default @@ -1822,7 +1824,7 @@ fi # Define the identity of the package. PACKAGE=xfwm4 - VERSION=4.1.10 + VERSION=4.1.11 cat >>confdefs.h <<_ACEOF @@ -5387,7 +5389,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5390 "configure"' > conftest.$ac_ext + echo '#line 5392 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -6481,7 +6483,7 @@ fi # Provide some information about the compiler. -echo "$as_me:6484:" \ +echo "$as_me:6486:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 @@ -7515,11 +7517,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7518: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7520: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7522: \$? = $ac_status" >&5 + echo "$as_me:7524: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -7748,11 +7750,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7751: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7753: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7755: \$? = $ac_status" >&5 + echo "$as_me:7757: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -7808,11 +7810,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7811: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7813: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7815: \$? = $ac_status" >&5 + echo "$as_me:7817: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9142,7 +9144,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 9145 "configure"' > conftest.$ac_ext + echo '#line 9147 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -10013,7 +10015,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 10016 "configure" +#line 10018 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10111,7 +10113,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 10114 "configure" +#line 10116 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12290,11 +12292,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12293: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12295: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:12297: \$? = $ac_status" >&5 + echo "$as_me:12299: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -12350,11 +12352,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:12353: $lt_compile\"" >&5) + (eval echo "\"\$as_me:12355: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:12357: \$? = $ac_status" >&5 + echo "$as_me:12359: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12861,7 +12863,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 12864 "configure"' > conftest.$ac_ext + echo '#line 12866 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -13732,7 +13734,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 13735 "configure" +#line 13737 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13830,7 +13832,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 13833 "configure" +#line 13835 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14657,11 +14659,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14660: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14662: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14664: \$? = $ac_status" >&5 + echo "$as_me:14666: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -14717,11 +14719,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14720: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14722: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14724: \$? = $ac_status" >&5 + echo "$as_me:14726: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16031,7 +16033,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 16034 "configure"' > conftest.$ac_ext + echo '#line 16036 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -16772,11 +16774,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16775: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16777: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16779: \$? = $ac_status" >&5 + echo "$as_me:16781: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -17005,11 +17007,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17008: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17010: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17012: \$? = $ac_status" >&5 + echo "$as_me:17014: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -17065,11 +17067,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17068: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17070: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:17072: \$? = $ac_status" >&5 + echo "$as_me:17074: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -18399,7 +18401,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 18402 "configure"' > conftest.$ac_ext + echo '#line 18404 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -19270,7 +19272,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 19273 "configure" +#line 19275 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -19368,7 +19370,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 19371 "configure" +#line 19373 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -24968,6 +24970,122 @@ fi fi +# Check whether --enable-compositor or --disable-compositor was given. +if test "${enable_compositor+set}" = set; then + enableval="$enable_compositor" + +else + enable_compositor=yes +fi; + +if test x"$enable_compositor" = x"yes"; then + if $PKG_CONFIG --exists xcomposite xfixes xdamage xrender 2> /dev/null; then + + succeeded=no + + if test -z "$PKG_CONFIG"; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + echo "$as_me:$LINENO: checking for xcomposite xfixes xdamage xrender" >&5 +echo $ECHO_N "checking for xcomposite xfixes xdamage xrender... $ECHO_C" >&6 + + if $PKG_CONFIG --exists "xcomposite xfixes xdamage xrender" ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + succeeded=yes + + echo "$as_me:$LINENO: checking COMPOSITOR_CFLAGS" >&5 +echo $ECHO_N "checking COMPOSITOR_CFLAGS... $ECHO_C" >&6 + COMPOSITOR_CFLAGS=`$PKG_CONFIG --cflags "xcomposite xfixes xdamage xrender"` + echo "$as_me:$LINENO: result: $COMPOSITOR_CFLAGS" >&5 +echo "${ECHO_T}$COMPOSITOR_CFLAGS" >&6 + + echo "$as_me:$LINENO: checking COMPOSITOR_LIBS" >&5 +echo $ECHO_N "checking COMPOSITOR_LIBS... $ECHO_C" >&6 + COMPOSITOR_LIBS=`$PKG_CONFIG --libs "xcomposite xfixes xdamage xrender"` + echo "$as_me:$LINENO: result: $COMPOSITOR_LIBS" >&5 +echo "${ECHO_T}$COMPOSITOR_LIBS" >&6 + else + COMPOSITOR_CFLAGS="" + COMPOSITOR_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + COMPOSITOR_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "xcomposite xfixes xdamage xrender"` + echo $COMPOSITOR_PKG_ERRORS + fi + + + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + : + else + { { echo "$as_me:$LINENO: error: Library requirements (xcomposite xfixes xdamage xrender) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5 +echo "$as_me: error: Library requirements (xcomposite xfixes xdamage xrender) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;} + { (exit 1); exit 1; }; } + fi + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_COMPOSITOR 1 +_ACEOF + + fi +fi + # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then @@ -25862,6 +25980,8 @@ s,@LIBSTARTUP_NOTIFICATION_CFLAGS@,$LIBSTARTUP_NOTIFICATION_CFLAGS,;t t s,@LIBSTARTUP_NOTIFICATION_LIBS@,$LIBSTARTUP_NOTIFICATION_LIBS,;t t s,@LIBSTARTUP_NOTIFICATION_REQUIRED_VERSION@,$LIBSTARTUP_NOTIFICATION_REQUIRED_VERSION,;t t s,@RANDR_LIBS@,$RANDR_LIBS,;t t +s,@COMPOSITOR_CFLAGS@,$COMPOSITOR_CFLAGS,;t t +s,@COMPOSITOR_LIBS@,$COMPOSITOR_LIBS,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF diff --git a/configure.ac b/configure.ac index 364aa70ef9f86bf8db5ace01d81d8017e4c9b5e1..afa7399bd6aba40b090b87ad6edcc53884fa6b48 100644 --- a/configure.ac +++ b/configure.ac @@ -7,7 +7,7 @@ AC_INIT([src/main.c]) AC_PREREQ(2.52) -AM_INIT_AUTOMAKE([xfwm4], [4.1.10]) +AM_INIT_AUTOMAKE([xfwm4], [4.1.11]) AM_CONFIG_HEADER([config.h]) @@ -80,6 +80,21 @@ if test x"$enable_randr" = x"yes"; then fi AC_SUBST([RANDR_LIBS]) +dnl +dnl Xcomposite and related extensions +dnl +AC_ARG_ENABLE([compositor], +AC_HELP_STRING([--enable-compositor], [enable compositor in xfwm4]) +AC_HELP_STRING([--disable-compositor], [disable compositor in xfwm4]), + [], [enable_compositor=yes]) + +if test x"$enable_compositor" = x"yes"; then + if $PKG_CONFIG --exists xcomposite xfixes xdamage xrender 2> /dev/null; then + PKG_CHECK_MODULES(COMPOSITOR, xcomposite >= 1.0 xfixes xdamage xrender) + AC_DEFINE([HAVE_COMPOSITOR], [1], [Define to enable compositor]) + fi +fi + dnl Check for debugging support BM_DEBUG_SUPPORT diff --git a/defaults/Makefile.in b/defaults/Makefile.in index 36e9b6fec4eee7fa4ce3fd5f48f9f46dca3b2b12..7a2e55ae54972c8dc5591acd2f388c7460d710ea 100644 --- a/defaults/Makefile.in +++ b/defaults/Makefile.in @@ -66,6 +66,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/doc/C/Makefile.in b/doc/C/Makefile.in index 8c8fbc659d483d76e74d4437e17af2cc4cfda59d..222203efe79fe26318b39a1be5a47111a1d8cab1 100644 --- a/doc/C/Makefile.in +++ b/doc/C/Makefile.in @@ -75,6 +75,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/doc/C/images/Makefile.in b/doc/C/images/Makefile.in index 682e6edc3690e7ebb37fd2c517dab60b5067a6ca..b76768c375c20b5c70e9e0c7e6ccfbeb61ba082f 100644 --- a/doc/C/images/Makefile.in +++ b/doc/C/images/Makefile.in @@ -66,6 +66,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/doc/Makefile.in b/doc/Makefile.in index 365ce5bf875da67a4861157d2b972b08845065c2..68064210ce54f191903fe5a325b72f87806db07d 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -73,6 +73,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/doc/fr/Makefile.in b/doc/fr/Makefile.in index 0fb88e05282c4e40cab854f8c7b1bd8c2ee79596..9f939acfb4f3db94585c73cc49114bbf5fd2b301 100644 --- a/doc/fr/Makefile.in +++ b/doc/fr/Makefile.in @@ -75,6 +75,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/doc/fr/images/Makefile.in b/doc/fr/images/Makefile.in index 93f241a3f57be375cae4faede544da7ef58e4a6b..ecd21b384b9be2de83f789d01a26b42b4683bc99 100644 --- a/doc/fr/images/Makefile.in +++ b/doc/fr/images/Makefile.in @@ -66,6 +66,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/doc/it/Makefile.in b/doc/it/Makefile.in index 0d9ba45bf484788d582f9235bfeacd9bf31e520a..02ccbc1b9f352f64375db9e710322b69309f6334 100644 --- a/doc/it/Makefile.in +++ b/doc/it/Makefile.in @@ -75,6 +75,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/doc/it/images/Makefile.in b/doc/it/images/Makefile.in index 0f35ad1b7c8be7cc835b9b6265df9dc23f16c76e..e6af2c642a71a0e48cbd3dfa074ea27f67abeccb 100644 --- a/doc/it/images/Makefile.in +++ b/doc/it/images/Makefile.in @@ -66,6 +66,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/icons/48x48/Makefile.in b/icons/48x48/Makefile.in index 67aaab14c1a728a0f1fc4d9c167a1a8324fa647f..04c0581ec3635d95b03313360824e4df2c09ab9f 100644 --- a/icons/48x48/Makefile.in +++ b/icons/48x48/Makefile.in @@ -66,6 +66,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/icons/Makefile.in b/icons/Makefile.in index d266c13b083103defda820f2a8d41c632887c379..cb3c47e6fa339f78ba2900ef46bd3493898c7c9a 100644 --- a/icons/Makefile.in +++ b/icons/Makefile.in @@ -71,6 +71,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/icons/scalable/Makefile.in b/icons/scalable/Makefile.in index c9386ea833ffa3a77f5cb9ee6e7d3a0bcc8f5c0c..6592e74171fac6ef542704c9b56cf530e68a6da4 100644 --- a/icons/scalable/Makefile.in +++ b/icons/scalable/Makefile.in @@ -66,6 +66,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/mcs-plugin/Makefile.in b/mcs-plugin/Makefile.in index d4e0fc19c63da650c8fee75e466ddf52e2c375ae..966a5a9e64a49340b5a582bb2dc7352e33678699 100644 --- a/mcs-plugin/Makefile.in +++ b/mcs-plugin/Makefile.in @@ -104,6 +104,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/src/Makefile.am b/src/Makefile.am index 5b80b122c59e62464ac619e6eb0a72601d5dea7a..6fa788031128253cd326adc682459406e8c4a77e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -56,22 +56,24 @@ xfwm4_SOURCES = \ workspaces.h xfwm4_CFLAGS = \ - @LIBSTARTUP_NOTIFICATION_CFLAGS@ \ @LIBX11_CFLAGS@ \ @LIBXFCE4MCS_CLIENT_CFLAGS@ \ @LIBXFCEGUI4_CFLAGS@ \ @LIBXPM_CFLAGS@ \ + @LIBSTARTUP_NOTIFICATION_CFLAGS@ \ + @COMPOSITOR_CFLAGS@ \ -I$(top_builddir)/common \ -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \ -DDATADIR=\"$(datadir)\" \ -DPACKAGE_DATADIR=\"$(pkgdatadir)\" xfwm4_LDADD = \ - @LIBSTARTUP_NOTIFICATION_LIBS@ \ @LIBX11_LIBS@ \ @LIBXFCE4MCS_CLIENT_LIBS@ \ @LIBXFCEGUI4_LIBS@ \ @LIBXPM_LIBS@ \ + @LIBSTARTUP_NOTIFICATION_LIBS@ \ + @COMPOSITOR_LIBS@ \ @RANDR_LIBS@ xfwm4_LDFLAGS = \ diff --git a/src/Makefile.in b/src/Makefile.in index 1c2c393a58fe2926e24af9e77d2d9d015e245a87..743fe692b04dc91849f2fcb37dbfd0b2a3e9725a 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -125,6 +125,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -315,22 +317,24 @@ xfwm4_SOURCES = \ workspaces.h xfwm4_CFLAGS = \ - @LIBSTARTUP_NOTIFICATION_CFLAGS@ \ @LIBX11_CFLAGS@ \ @LIBXFCE4MCS_CLIENT_CFLAGS@ \ @LIBXFCEGUI4_CFLAGS@ \ @LIBXPM_CFLAGS@ \ + @LIBSTARTUP_NOTIFICATION_CFLAGS@ \ + @COMPOSITOR_CFLAGS@ \ -I$(top_builddir)/common \ -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \ -DDATADIR=\"$(datadir)\" \ -DPACKAGE_DATADIR=\"$(pkgdatadir)\" xfwm4_LDADD = \ - @LIBSTARTUP_NOTIFICATION_LIBS@ \ @LIBX11_LIBS@ \ @LIBXFCE4MCS_CLIENT_LIBS@ \ @LIBXFCEGUI4_LIBS@ \ @LIBXPM_LIBS@ \ + @LIBSTARTUP_NOTIFICATION_LIBS@ \ + @COMPOSITOR_LIBS@ \ @RANDR_LIBS@ xfwm4_LDFLAGS = \ diff --git a/src/client.c b/src/client.c index 1b896f2a4e6e2a740b0f9e6e103b8b19f9a94711..27290395e5b73fde6dabf84e280120954f9faea4 100644 --- a/src/client.c +++ b/src/client.c @@ -1421,6 +1421,7 @@ clientFrame (DisplayInfo *display_info, Window w, gboolean recapture) c->y = attr.y; c->width = attr.width; c->height = attr.height; + c->visual = attr.visual; clientGetWMNormalHints (c, FALSE); c->old_x = c->x; @@ -1496,7 +1497,6 @@ clientFrame (DisplayInfo *display_info, Window w, gboolean recapture) /* Reparent will send us unmap/map events */ FLAG_SET (c->xfwm_flags, XFWM_FLAG_MAP_PENDING); } - c->ignore_unmap = 0; c->type = UNSET; c->type_atom = None; diff --git a/src/client.h b/src/client.h index ef0c0a4ca01fed5303ab32485b467469f8ce7d0a..59150257b357b5bfd11b60cf4d282ae7b5486d70 100644 --- a/src/client.h +++ b/src/client.h @@ -34,6 +34,13 @@ #include <X11/Xmd.h> #include <X11/cursorfont.h> #include <X11/extensions/shape.h> + +#ifdef HAVE_COMPOSITOR +#include <X11/extensions/Xcomposite.h> +#include <X11/extensions/Xdamage.h> +#include <X11/extensions/Xrender.h> +#endif /* HAVE_COMPOSITOR */ + #include <glib.h> #include <gtk/gtk.h> #include <libxfcegui4/libxfcegui4.h> @@ -208,6 +215,7 @@ struct _Client unsigned long win_layer; unsigned long serial; Atom type_atom; + Visual *visual; XSizeHints *size; XWMHints *wmhints; XClassHint class; @@ -245,10 +253,28 @@ struct _Client guint blink_timeout_id; /* Pixmap caching */ ClientPixmapCache pm_cache; + #ifdef HAVE_LIBSTARTUP_NOTIFICATION /* Startup notification */ char *startup_id; -#endif +#endif /* HAVE_LIBSTARTUP_NOTIFICATION */ + +#ifdef HAVE_COMPOSITOR + Damage damage; + XserverRegion last_painted_extents; + + Picture picture; + XserverRegion border_size; + +#if HAVE_NAME_WINDOW_PIXMAP + Pixmap name_window_pixmap; +#endif /* HAVE_NAME_WINDOW_PIXMAP */ + + unsigned int managed : 1; + unsigned int damaged : 1; + unsigned int viewable : 1; + +#endif /* HAVE_COMPOSITOR */ }; extern Client *clients; diff --git a/src/compositor.c b/src/compositor.c new file mode 100644 index 0000000000000000000000000000000000000000..3e5174460a4dcfa3bd29d1ac573181a820cf2f4d --- /dev/null +++ b/src/compositor.c @@ -0,0 +1,656 @@ +/* $Id$ + + 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA. + + xcompmgr - (c) 2003 Keith Packard + metacity - (c) 2003, 2004 Red Hat, Inc. + xfwm4 - (c) 2004 Olivier Fourdan + + */ + +/* THIS CODE IS NOT FINISHED YET, IT WON'T COMPILE, PLEASE BE PATIENT */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <glib.h> + +#include "display.h" +#include "client.h" +#include "frame.h" + +#ifdef HAVE_COMPOSITE_EXTENSIONS + +#define SHADOW_OFFSET 3 +#define FRAME_INTERVAL_MILLISECONDS ((int)(1000.0/40.0)) + +static void +compositorWindowFree (Client *c) +{ + Display *dpy; + + g_return_if_fail (c != NULL); + g_return_if_fail (c->damage != NULL); + + dpy = clientGetXDisplay (c); + g_return_if_fail (dpy != NULL); + + XDamageDestroy (dpy, c->damage); + +#if HAVE_NAME_WINDOW_PIXMAP + if (c->name_window_pixmap != None) + { + XFreePixmap (dpy, c->name_window_pixmap); + } +#endif +} + +static void +compositorRemoveRepairIdle (DisplayInfo *display) +{ + if (display_info->repair_idle != 0) + { + g_source_remove (display_info->repair_idle); + display_info->repair_idle = 0; + } + + if (display_info->repair_timeout != 0) + { + g_source_remove (display_info->repair_timeout); + display_info->repair_timeout = 0; + } +} + +static XserverRegion +compositorWindowExtents (Client *c) +{ + XRectangle r; + Display *dpy; + + g_return_if_fail (c != NULL); + + dpy = clientGetXDisplay (c); + g_return_if_fail (dpy != NULL); + + r.x = c->x; + r.y = c->y; + r.width = c->width; + r.height = c->height; + + r.width += SHADOW_OFFSET; + r.height += SHADOW_OFFSET; + + return XFixesCreateRegion (dpy, &r, 1); +} + +static void +compositorWindowGetPaintBounds (Client *c, int *x, int *y, int *w, int *h) +{ + g_return_if_fail (c != NULL); + +#ifdef HAVE_NAME_WINDOW_PIXMAP + if (c->name_window_pixmap != None) + { + *x = frameX(c); + *y = frameY(c); + *w = frameWidth(c); + *h = frameHeight(c); + } + else +#endif + { + *x = c->x + c->border_width; + *y = c->y + c->border_width; + *w = c->width; + *h = c->height; + } +} + +static void +compositorPaintScreen (ScreenInfo *screen_info, XserverRegion damage_region) +{ + XserverRegion region; + Picture buffer_picture; + Pixmap buffer_pixmap; + Display *dpy; + XRenderPictFormat *format; + GList *index; + GC gc; + gint screen_width; + gint screen_height; + Window xroot; + + dpy = myScreenGetXDisplay (screen_info); + screen_width = gdk_screen_get_width (screen_info->gscr); + screen_height = gdk_screen_get_height (screen_info->gscr); + screen_number = screen_info->screen; + xroot = screen_info->xroot; + + if (damage_region == None) + { + XRectangle r; + + r.x = 0; + r.y = 0; + r.width = screen_width; + r.height = screen_height; + region = XFixesCreateRegion (dpy, &r, 1); + } + else + { + region = XFixesCreateRegion (dpy, NULL, 0); + XFixesCopyRegion (dpy, region, damage_region); + } + + + buffer_pixmap = XCreatePixmap (dpy, xroot, screen_width, screen_height, + DefaultDepth (dpy, screen_number)); + + gc = XCreateGC (dpy, buffer_pixmap, 0, NULL); + XSetForeground (dpy, gc, WhitePixel (dpy, screen_info->screen)); + XFixesSetGCClipRegion (dpy, gc, 0, 0, region); + XFillRectangle (dpy, buffer_pixmap, gc, 0, 0, screen_width, screen_height); + format = XRenderFindVisualFormat (dpy, DefaultVisual (dpy, screen_number)); + buffer_picture = XRenderCreatePicture (dpy, buffer_pixmap, format, 0, 0); + XFixesSetPictureClipRegion (dpy, buffer_picture, 0, 0, region); + + for (index = screen_info->windows_stack; index; index = g_list_next (index)) + { + XRenderColor shadow_color; + Client *c = (Client *) index->data; + int x, y, w, h; + + shadow_color.red = 0; + shadow_color.green = 0; + shadow_color.blue = 0; + shadow_color.alpha = 0x90c0; + + if ((!c->viewable) || (c->picture == None)) + { + continue; + } + + if (c->last_painted_extents) + { + XFixesDestroyRegion (dpy, c->last_painted_extents); + } + c->last_painted_extents = compositorWindowExtents (c); + + compositorWindowGetPaintBounds (c, &x, &y, &w, &h); + if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_MOVING_RESIZING)) + { + + XRenderComposite (dpy, PictOpOver, c->picture, + screen_info->trans_picture, buffer_picture, + 0, 0, 0, 0, x, y, w, h); + } + else + { + /* Draw window normally */ + /* TBD: create a drop shadow */ + XRenderFillRectangle (dpy, PictOpOver, buffer_picture, + &shadow_color, + frameX(c) + SHADOW_OFFSET, + frameY(c) + SHADOW_OFFSET, + frameWidth(c), frameHeight(c)); + + XRenderComposite (dpy, PictOpSrc, c->picture, + None, buffer_picture, + 0, 0, 0, 0, x, y, w, h); + } + } + + /* Copy buffer to root window */ + XFixesSetPictureClipRegion (dpy, screen_info->root_picture, 0, 0, region); + /* XFixesSetPictureClipRegion (dpy, buffer_picture, 0, 0, None); */ + XRenderComposite (dpy, PictOpSrc, buffer_picture, None, + screen_info->root_picture, + 0, 0, 0, 0, 0, 0, screen_width, screen_height); + + XFixesDestroyRegion (dpy, region); + XFreePixmap (dpy, buffer_pixmap); + XRenderFreePicture (dpy, buffer_picture); + XFreeGC (dpy, gc); +} + +static void +compositorDoRepair (DisplayInfo *display_info) +{ + GSList *screens; + + g_return_val_if_fail (display_info, FALSE); + + for (screens = display_info->screens; screens; screens = g_slist_next (screens)) + { + ScreenInfo *screen_info = (ScreenInfo *) screens->data; + if (screen_info->damage_region != None) + { + compositorPaintScreen (screen_info, screen_info->damage_region); + XFixesDestroyRegion (display_info->dpy, screen_info->damage_region); + screen_info->damage_region = None; + } + } + compositorRemoveRepairIdle (display_info); +} + +static gboolean +compositorRepairIdleFunc (gpointer data) +{ + DisplayInfo *display_info = (DisplayInfo *) data; + + display_info->repair_idle = 0; + compositorDoRepair (display_info); + + return FALSE; +} + +static gboolean +compositorRepairTimeoutFunc (gpointer data) +{ + DisplayInfo *display_info = (DisplayInfo *) data; + + display_info->repair_timeout = 0; + compositorDoRepair (display_info); + + return FALSE; +} + +static void +compositorEnsureRepairIdle (DisplayInfo *display_info) +{ + if (display_info->repair_idle != 0) + { + return; + } + display_info->repair_idle = g_idle_add_full (G_PRIORITY_HIGH_IDLE, + compositorRepairIdleFunc, + display_info, NULL); + display_info->repair_timeout = g_timeout_add (FRAME_INTERVAL_MILLISECONDS, + compositorRepairTimeoutFunc, + display_info)); +} + +static void +compositorMergeAndDestroyDamageRegion (ScreenInfo *screen_info, XserverRegion region) +{ + DisplayInfo *display_info = screen_info->display_info; + + if (screen_info->damage_region != None) + { + XFixesUnionRegion (display_info->dpy, + screen_info->damage_region, + region, screen_info->damage_region); + XFixesDestroyRegion (display_info->dpy, region); + } + else + { + screen_info->damage_region = region; + } + + compositorEnsureRepairIdle (display_info); +} + +static void +compositorMergeDamageRegion (ScreenInfo *screen_info, XserverRegion region) +{ + DisplayInfo *display_info = screen_info->display_info; + + if (screen_info->damage_region != None) + { + screen_info->damage_region = XFixesCreateRegion (display_info->dpy, NULL, 0); + } + XFixesUnionRegion (display_info->dpy, + screen_info->damage_region, + region, screen_info->damage_region); + + compositorEnsureRepairIdle (display_info); +} + +static void +compositorHandleDamageNotify (DisplayInfo *display_info, XDamageNotifyEvent *ev) +{ + Client *c; + XserverRegion region; + + c = myDisplayGetClientFromWindow (display_info, ev->window, ANY); + if (!c) + { + return; + } + + region = XFixesCreateRegion (display_info->dpy, NULL, 0); + + gdk_error_trap_push (); + XDamageSubtract (display_info->dpy, c->damage, None, region); + gdk_error_trap_pop (); + + XFixesTranslateRegion (display_info->dpy, region, frameX (c), frameY (c)); + + compositorMergeAndDestroyDamageRegion (c->screen_info, region); +} + +static void +compositorHandleConfigureNotify (DisplayInfo *display_info, XConfigureEvent *ev) +{ + Client *c; + XserverRegion region; + + c = myDisplayGetClientFromWindow (display_info, ev->window, ANY); + if (!c) + { + return; + } + + if (c->screen_info->xroot != event->event) + { + return; + } + + if (c->last_painted_extents) + { + compositorMergeAndDestroyDamageRegion (screen_info, c->last_painted_extents); + c->last_painted_extents = None; + } + + region = compositorWindowExtents (c); + compositorMergeDamageRegion (screen_info, region); + XFixesDestroyRegion (display_info->dpy, region); +} + +static void +compositorHandleExpose (DisplayInfo *display_info, XExposeEvent *ev) +{ + ScreenInfo *screen_info = NULL; + XserverRegion region; + XRectangle r; + + screen_info = myDisplayGetScreenFromRoot (display_info, ev->window); + if (!(screen_info) || (screen_info->root_picture == None)) + { + return; + } + + r.x = 0; + r.y = 0; + r.width = gdk_screen_get_width (screen_info->gscr);; + r.height = gdk_screen_get_height (screen_info->gscr);; + region = XFixesCreateRegion (display_info->dpy, &r, 1); + + compositorMergeAndDestroyDamageRegion (screen_info, region); +} + +static void +compositorHandleMap (DisplayInfo *display_info, XMapEvent *ev) +{ + ScreenInfo *screen_info = NULL; + Client *c; + + screen_info = myDisplayGetScreenFromRoot (display_info, ev->event); + if (!(screen_info) || (screen_info->root_picture == None)) + { + return; + } + + c = myDisplayGetClientFromWindow (display_info, ev->window, ANY); + if (c) + { + c->viewable = TRUE; + } +} + +static void +compositorHandleUnmap (DisplayInfo *display_info, XUnmapEvent *ev) +{ + ScreenInfo *screen_info = NULL; + Client *c; + + screen_info = myDisplayGetScreenFromRoot (display_info, ev->event); + if (!(screen_info) || (screen_info->root_picture == None)) + { + return; + } + + c = myDisplayGetClientFromWindow (display_info, ev->window, ANY); + if (c) + { + c->viewable = FALSE; + + if (c->last_painted_extents) + { + compositorMergeAndDestroyDamageRegion (screen_info, c->last_painted_extents); + c->last_painted_extents = None; + } + } +} +#endif /* HAVE_COMPOSITE_EXTENSIONS */ + +void +compositorHandleEvent (DisplayInfo *display_info, XEvent *ev) +{ +#ifdef HAVE_COMPOSITE_EXTENSIONS + if (!(display_info->enable_compositor)) + { + return; + } + if (ev->type == (display_info->damage_event_base + XDamageNotify)) + { + compositorHandleDamageNotify (display_info, (XDamageNotifyEvent*) ev); + } + else if (ev->type == ConfigureNotify) + { + compositorHandleConfigureNotify (display_info, (XConfigureEvent*) ev); + } + else if (ev->type == Expose) + { + compositorHandleExpose (display_info, (XExposeEvent*) ev); + } + else if (ev->type == UnmapNotify) + { + compositorHandleUnmap (display_info, (XUnmapEvent*) ev); + } + else if (ev->type == MapNotify) + { + compositorHandleMap (display_info, (XMapEvent*) ev); + } +#endif /* HAVE_COMPOSITE_EXTENSIONS */ +} + +void +compositorAddWindow (Client *c, gboolean viewable) +{ +#ifdef HAVE_COMPOSITE_EXTENSIONS + Damage damage; + XRenderPictFormat *format; + XRenderPictureAttributes pa; + XserverRegion region; + DisplayInfo *display_info; + ScreenInfo *screen_info; + + g_return_if_fail (c != NULL); + + if (!(display_info->enable_compositor)) + { + return; + } + screen_info = c->screen_info; + display_info = screen_info->display_info; + + gdk_error_trap_push (); + damage = XDamageCreate (display_info->dpy, c->window, XDamageReportNonEmpty); + gdk_error_trap_pop (); + + if (damage == None) + { + return; + } + + c->damage = damage; +#if HAVE_NAME_WINDOW_PIXMAP + if (display_info->have_name_window_pixmap) + { + gdk_error_trap_push (); + c->name_window_pixmap = XCompositeNameWindowPixmap (display_info->dpy, + cwindow->window); + gdk_error_trap_pop (); + } +#endif /* HAVE_NAME_WINDOW_PIXMAP */ + + /* viewable == mapped for the root window, since root can't be unmapped */ + c->viewable = viewable; + + pa.subwindow_mode = IncludeInferiors; + + format = XRenderFindVisualFormat (display_info->dpy, c->visual); + c->picture = XRenderCreatePicture (display_info->dpy, +#if HAVE_NAME_WINDOW_PIXMAP + c->picture = XRenderCreatePicture (display_info->dpy, + (c->pixmap != None ? c->pixmap : c->window), + format, CPSubwindowMode, &pa); +#else + c->picture = XRenderCreatePicture (display_info->dpy, c->window, + format, CPSubwindowMode, &pa); +#endif /* HAVE_NAME_WINDOW_PIXMAP */ + + region = compositorWindowExtents (c); + compositorMergeAndDestroyDamageRegion (screen_info, region); +#endif /* HAVE_COMPOSITE_EXTENSIONS */ +} + +void +compositorRemoveWindow (Client *c) +{ +#ifdef HAVE_COMPOSITE_EXTENSIONS + DisplayInfo *display_info; + ScreenInfo *screen_info; + + g_return_if_fail (c != NULL); + + if (!(display_info->enable_compositor)) + { + return; + } + screen_info = c->screen_info; + display_info = screen_info->display_info; + + if (c->last_painted_extents) + { + compositorMergeAndDestroyDamageRegion (screen_info, + c->last_painted_extents); + c->last_painted_extents = None; + } +#endif /* HAVE_COMPOSITE_EXTENSIONS */ +} + +void +compositorManageScreen (ScreenInfo *screen_info) +{ +#ifdef HAVE_COMPOSITE_EXTENSIONS + DisplayInfo *display_info; + XRenderPictureAttributes pa; + XRectangle r; + XRenderColor c; + XRenderPictFormat *visual_format; + + if (!(display_info->enable_compositor)) + { + return; + } + + display_info = screen_info->display_info; + + XCompositeRedirectSubwindows (display_info->dpy, screen_info->xroot, CompositeRedirectManual); + pa.subwindow_mode = IncludeInferiors; + visual_format = XRenderFindVisualFormat (display_info->dpy, + DefaultVisual (display_info->dpy, + screen_info->screen)); + screen_info->root_picture = XRenderCreatePicture (display_info->dpy, screen_info->xroot, + visual_format, CPSubwindowMode, &pa); + + screen_info->trans_pixmap = XCreatePixmap (display_info->dpy, screen_info->xroot, 1, 1, 8); + + pa.repeat = True; + visual_format = XRenderFindStandardFormat (display_info->dpy, PictStandardA8); + screen_info->trans_picture = XRenderCreatePicture (display_info->dpy, screen_info->trans_pixmap, + visual_format, CPRepeat, &pa); + + c.red = c.green = c.blue = 0; + c.alpha = 0xc0c0; + XRenderFillRectangle (display_info->dpy, PictOpSrc, screen_info->trans_picture, &c, 0, 0, 1, 1); + + /* Damage the whole screen */ + r.x = 0; + r.y = 0; + r.width = gdk_screen_get_width (screen_info->gscr);; + r.height = gdk_screen_get_height (screen_info->gscr);; + compositorMergeAndDestroyDamageRegion (screen_info, XFixesCreateRegion (display_info->dpy, &r, 1)); +#endif /* HAVE_COMPOSITE_EXTENSIONS */ +} + +void +compositorUnmanageScreen (ScreenInfo *screen_info) +{ +#ifdef HAVE_COMPOSITE_EXTENSIONS + DisplayInfo *display_info; + GList *index; + + if (!(display_info->enable_compositor)) + { + return; + } + + display_info = screen_info->display_info; + + XRenderFreePicture (display_info->dpy, screen_info->root_picture); + screen_info->root_picture = None; + XRenderFreePicture (display_info->dpy, screen_info->trans_picture); + screen_info->trans_picture = None; + XFreePixmap (display_info->dpy, screen_info->trans_pixmap); + screen_info->trans_pixmap = None; + + for (index = screen_info->windows_stack; index; index = g_list_next (index)) + { + Client *c = (Client *) index->data; + compositorRemoveWindow (c); + } +#endif /* HAVE_COMPOSITE_EXTENSIONS */ +} + +void +compositorDamageClient (Client *c) +{ +#ifdef HAVE_COMPOSITE_EXTENSIONS + DisplayInfo *display_info; + ScreenInfo *screen_info; + Window xwindow; + + g_return_if_fail (c != NULL); + + if (!(display_info->enable_compositor)) + { + return; + } + + screen_info = c->screen_info; + display_info = screen_info->display_info; + + if (screen_info->root_picture == None) + { + return; + } + + compositorMergeAndDestroyDamageRegion (screen_info, compositorWindowExtents (c)); +#endif /* HAVE_COMPOSITE_EXTENSIONS */ +} diff --git a/src/display.c b/src/display.c index 1d21aa0e1dcee90820e46bf6ffa12e0bc9d37646..5c6283370e55a2d433a748957d13a294e1cffdf0 100644 --- a/src/display.c +++ b/src/display.c @@ -59,8 +59,58 @@ myDisplayInit (GdkDisplay *gdisplay) display->gdisplay = gdisplay; display->dpy = (Display *) gdk_x11_display_get_xdisplay (gdisplay); + XSetErrorHandler (handleXError); + +#ifdef HAVE_COMPOSITOR + if (!XCompositeQueryExtension (display->dpy, + &display->composite_event_base, + &display->composite_error_base)) + { + display->have_composite = FALSE; + display->composite_event_base = 0; + display->composite_error_base = 0; + } + else + { + display->have_composite = TRUE; + } + if (!XDamageQueryExtension (display->dpy, + &display->damage_event_base, + &display->damage_error_base)) + { + display->have_damage = FALSE; + display->damage_event_base = 0; + display->damage_error_base = 0; + } + else + { + display->have_damage = TRUE; + } + if (!XFixesQueryExtension (display->dpy, + &display->fixes_event_base, + &display->fixes_error_base)) + { + display->have_fixes = FALSE; + display->fixes_event_base = 0; + display->fixes_error_base = 0; + } + else + { + display->have_fixes = TRUE; + } + + display->repair_idle = 0; + display->repair_timeout = 0; + + display->enable_compositor = + (display->have_composite && display->have_damage && display->have_fixes); +#else /* HAVE_COMPOSITOR */ + display->enable_compositor = FALSE; +#endif /* HAVE_COMPOSITOR */ + display->shape = XShapeQueryExtension (display->dpy, &display->shape_event, &dummy); + display->root_cursor = XCreateFontCursor (display->dpy, XC_left_ptr); display->move_cursor = @@ -94,8 +144,6 @@ myDisplayInit (GdkDisplay *gdisplay) initGnomeHints (display->dpy); initNetHints (display->dpy); initKDEHints (display->dpy); - - XSetErrorHandler (handleXError); return display; } diff --git a/src/display.h b/src/display.h index a8dde1d5d9a5246f467792505aeed0841ad3ccd6..6b55903ef88cff4f850a67048593a03a2f28bd0a 100644 --- a/src/display.h +++ b/src/display.h @@ -28,6 +28,18 @@ #include <X11/Xlib.h> #include <X11/cursorfont.h> #include <X11/extensions/shape.h> + +#ifdef HAVE_COMPOSITOR +#include <X11/extensions/Xcomposite.h> +#include <X11/extensions/Xdamage.h> +#include <X11/extensions/Xrender.h> +#if COMPOSITE_MAJOR > 0 || COMPOSITE_MINOR >= 2 +#ifndef HAVE_NAME_WINDOW_PIXMAP +#define HAVE_NAME_WINDOW_PIXMAP 1 +#endif /* HAVE_NAME_WINDOW_PIXMAP */ +#endif /* COMPOSITE_MAJOR > 0 || COMPOSITE_MINOR >= 2 */ +#endif /* HAVE_COMPOSITOR */ + #include <gtk/gtk.h> #include <glib.h> #include <libxfcegui4/libxfcegui4.h> @@ -73,6 +85,28 @@ struct _DisplayInfo int dbl_click_time; int xgrabcount; int nb_screens; + gboolean enable_compositor; + +#ifdef HAVE_COMPOSITOR + int composite_error_base; + int composite_event_base; + int damage_error_base; + int damage_event_base; + int fixes_error_base; + int fixes_event_base; + + gboolean have_composite; + gboolean have_damage; + gboolean have_fixes; + + guint repair_idle; + guint repair_timeout; + +#if HAVE_NAME_WINDOW_PIXMAP + gboolean have_name_window_pixmap; +#endif /* HAVE_NAME_WINDOW_PIXMAP */ + +#endif /* HAVE_COMPOSITOR */ }; DisplayInfo * myDisplayInit (GdkDisplay *); diff --git a/src/main.c b/src/main.c index 52d7858980ffe9634bcd2e5e1d914a48d3a0ad46..f3fdc5ef0f256363d7925836670cf18bc0d40d96 100644 --- a/src/main.c +++ b/src/main.c @@ -57,7 +57,7 @@ #include "startup_notification.h" #include "spinning_cursor.h" -#define MAIN_EVENT_MASK\ +#define BASE_EVENT_MASK \ SubstructureNotifyMask|\ StructureNotifyMask|\ SubstructureRedirectMask|\ @@ -67,6 +67,12 @@ PropertyChangeMask|\ ColormapNotify +#ifdef HAVE_COMPOSITOR +#define MAIN_EVENT_MASK BASE_EVENT_MASK|ExposureMask +#else +#define MAIN_EVENT_MASK BASE_EVENT_MASK +#endif /* HAVE_COMPOSITOR */ + static DisplayInfo *display_info = NULL; gboolean xfwm4_quit = FALSE; gboolean xfwm4_reload = FALSE; @@ -207,6 +213,14 @@ initialize (int argc, char **argv) display_info = myDisplayInit (gdk_display_get_default ()); +#ifdef HAVE_COMPOSITOR + if (!display_info->enable_compositor) + { + g_warning (_("%s: Cannot find required extensions " + "for compositing manager"), g_get_prgname ()); + } +#endif /* HAVE_COMPOSITOR */ + initModifiers (display_info->dpy); act.sa_handler = handleSignal; diff --git a/src/screen.h b/src/screen.h index 0ee79fe5c2cca14af7d5f27ec8201f79f05831fb..93aa3af9518cc97117483f7c8695fca9fbcaf377 100644 --- a/src/screen.h +++ b/src/screen.h @@ -47,13 +47,6 @@ struct _ScreenInfo { -#ifdef HAVE_LIBSTARTUP_NOTIFICATION - /* Startup notification data, per screen */ - SnMonitorContext *sn_context; - GSList *startup_sequences; - guint startup_sequence_timeout; -#endif - /* The display this screen belongs to */ DisplayInfo *display_info; @@ -112,6 +105,20 @@ struct _ScreenInfo /* Per screen parameters */ XfwmParams *params; + +#ifdef HAVE_LIBSTARTUP_NOTIFICATION + /* Startup notification data, per screen */ + SnMonitorContext *sn_context; + GSList *startup_sequences; + guint startup_sequence_timeout; +#endif + +#ifdef HAVE_COMPOSITOR + XID root_picture; + XID damage_region; + XID trans_pixmap; + XID trans_picture; +#endif /* HAVE_COMPOSITOR */ }; ScreenInfo * myScreenInit (DisplayInfo *, diff --git a/themes/Makefile.in b/themes/Makefile.in index ade0673c8f8fce5c5410892e3092c2b77bcbbdf3..cdf85ba28245502bb236d5f5aff00110f353cd34 100644 --- a/themes/Makefile.in +++ b/themes/Makefile.in @@ -74,6 +74,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/themes/default-4.0/Makefile.in b/themes/default-4.0/Makefile.in index 5fd8d37ea996f10cf76f0767e22d10131334b0a3..40f8fe448a551f7d533faa575b7b17410d60f436 100644 --- a/themes/default-4.0/Makefile.in +++ b/themes/default-4.0/Makefile.in @@ -66,6 +66,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/themes/default.keys/Makefile.in b/themes/default.keys/Makefile.in index d0c511331408e46dba255a9950129e3a4fad4a74..b8efbeac0f64cb94fa6391beeb1a03db40ee4408 100644 --- a/themes/default.keys/Makefile.in +++ b/themes/default.keys/Makefile.in @@ -66,6 +66,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/themes/default/Makefile.in b/themes/default/Makefile.in index 866bf02edaa52da1395bbc9496f1012f65ec29dd..e4c7f707a81a4cbb7ce509e8e989ee63269c71ce 100644 --- a/themes/default/Makefile.in +++ b/themes/default/Makefile.in @@ -66,6 +66,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/themes/opta/Makefile.in b/themes/opta/Makefile.in index b5d68a303541c3a67366056629f0956d6a619e6d..ccd92ec38fbe7c9e11c79d81dc804714a7fffffd 100644 --- a/themes/opta/Makefile.in +++ b/themes/opta/Makefile.in @@ -66,6 +66,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/themes/symphony/Makefile.in b/themes/symphony/Makefile.in index d4a37c3dcb459493986d8da6757a4a8a3bd9d449..23565229b743f8ac6d4a72f3155a4ae6583a3249 100644 --- a/themes/symphony/Makefile.in +++ b/themes/symphony/Makefile.in @@ -66,6 +66,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/themes/waza/Makefile.in b/themes/waza/Makefile.in index 7ea673184400927852f196e9520a6171d694e0dc..a41e5a8eebbd02177500b18d6effb5660a86c9b7 100644 --- a/themes/waza/Makefile.in +++ b/themes/waza/Makefile.in @@ -66,6 +66,8 @@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +COMPOSITOR_CFLAGS = @COMPOSITOR_CFLAGS@ +COMPOSITOR_LIBS = @COMPOSITOR_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@