Sophie

Sophie

distrib > Fedora > 18 > i386 > by-pkgid > 5d319bfea23b809120c657522b525927 > files > 2

compiz-manager-0.6.0-17.fc18.src.rpm

--- compiz-manager-0.6.0/compiz-manager	2011-01-19 19:08:08.540834340 +0000
+++ compiz-manager-0.6.0/compiz-manager.new2	2011-01-19 21:48:26.074954285 +0000
@@ -26,17 +26,20 @@
 # started, and start a default plugin and possibly window decorator.
 # 
 
+# differ between LIBDIR for x86 and x86_64, ppc and ppc64
+if [ `uname -m` = x86_64 -o `uname -m` = ppc64 ];then
+	ARCH_LIB=lib64
+else
+	ARCH_LIB=lib
+fi
 
-COMPIZ_BIN_PATH="/usr/local/bin/" # For window decorators and compiz
-PLUGIN_PATH="/usr/local/lib/compiz/" 
+COMPIZ_BIN_PATH="/usr/bin/" # For window decorators and compiz
+PLUGIN_PATH="/usr/$ARCH_LIB/compiz/" 
 GLXINFO="/usr/bin/glxinfo"
 KWIN="/usr/bin/kwin"
 MARCO="/usr/bin/marco"
 COMPIZ_NAME="compiz" # Final name for compiz (compiz.real) 
-
-# For Xgl LD_PRELOAD
-LIBGL_NVIDIA="/usr/lib/nvidia/libGL.so.1.2.xlibmesa"
-LIBGL_FGLRX="/usr/lib/fglrx/libGL.so.1.2.xlibmesa"
+LIBDIR=/usr/$ARCH_LIB/
 
 # Minimum amount of memory (in kilo bytes) that nVidia cards need
 # to be allowed to start
@@ -45,13 +48,18 @@
 NVIDIA_SETTINGS="nvidia-settings" # Assume it's in the path by default
 
 # For detecting what driver is in use, the + is for one or more /'s
-XORG_DRIVER_PATH="/usr/lib/xorg/modules/drivers/+"
+XORG_DRIVER_PATH="/usr/$ARCH_LIB/xorg/modules/+drivers/+"
 
-FALLBACKWM="${MARCO}"
+# FALLBACKWM should depend on the used desktop
+if [ -n "$KDE_FULL_SESSION" ]; then
+	FALLBACKWM="${KWIN}"
+else
+	FALLBACKWM="${MARCO}"
+fi
 FALLBACKWM_OPTIONS="--replace $@"
 
 # Driver whitelist
-WHITELIST="nvidia intel ati radeon i810"
+WHITELIST="nvidia intel ati radeon i810 nouveau fglrx"
 
 # blacklist based on the pci ids 
 # See http://wiki.compiz-fusion.org/Hardware/Blacklist for details
@@ -61,12 +69,12 @@
 BLACKLIST_PCIIDS="$T"
 unset T
 
-COMPIZ_OPTIONS="--ignore-desktop-hints --replace"
+COMPIZ_OPTIONS="--replace"
 COMPIZ_PLUGINS=""
 ENV=""
 
-# Use emerald by default if it exist
-USE_EMERALD="yes"
+# Don't use emerald by default (to avoid additional requirements)
+USE_EMERALD=${USE_EMERALD:-no}
 
 # No indirect by default
 INDIRECT="no"
@@ -177,19 +185,6 @@
 	fi
 }
 
-# Detects if Xgl is running
-check_xgl()
-{
-	verbose "Checking for Xgl: "
-	if xvinfo | grep -q Xgl ; then
-		verbose "present. \n"
-		return 0;
-	else
-		verbose "not present. \n"
-		return 1;
-	fi
-}
-
 # Check if the nVidia card has enough video ram to make sense
 check_nvidia_memory()
 {
@@ -262,14 +257,14 @@
 # check pciid blacklist
 have_blacklisted_pciid()
 {
-	OUTPUT=$(lspci -n)
+	OUTPUT=$(/sbin/lspci -n)
 	for ID in ${BLACKLIST_PCIIDS}; do
 		if echo "$OUTPUT" | egrep -q "$ID"; then
 			verbose "Blacklisted PCIID '$ID' found \n"
 			return 0
 		fi
 	done
-	OUTPUT=$(lspci -vn | grep -i VGA)
+	OUTPUT=$(/sbin/lspci -vn | grep -i VGA)
 	verbose "Detected PCI ID for VGA: $OUTPUT\n"
 	return 1
 }
@@ -282,16 +277,6 @@
 	if [ "$INDIRECT" = "yes" ]; then
 		ENV="$ENV LIBGL_ALWAYS_INDIRECT=1 "
 	fi
-	if check_xgl; then
-		if [ -f ${LIBGL_NVIDIA} ]; then
-			ENV="$ENV LD_PRELOAD=${LIBGL_NVIDIA}"
-			verbose "Enabling Xgl with nVidia drivers...\n"
-		fi
-		if [ -f ${LIBGL_FGLRX} ]; then
-			ENV="$ENV LD_PRELOAD=${LIBGL_FGLRX}"
-			verbose "Enabling Xgl with fglrx ATi drivers...\n"
-		fi
-	fi
 
 	ENV="$ENV FROM_WRAPPER=yes"
 
@@ -305,9 +290,6 @@
 	if [ $INDIRECT = "yes" ]; then
 		COMPIZ_OPTIONS="$COMPIZ_OPTIONS --indirect-rendering "
 	fi
-	if check_nvidia; then
-		COMPIZ_OPTIONS="$COMPIZ_OPTIONS --loose-binding"
-	fi
 }
 
 ####################
@@ -335,32 +317,27 @@
 	INDIRECT="yes";
 fi
 
-# if we run under Xgl, we can skip some tests here
-if ! check_xgl; then
-	# if vesa or vga are in use, do not even try glxinfo (LP#119341)
-	if ! running_under_whitelisted_driver || have_blacklisted_pciid; then
-		abort_with_fallback_wm
-	fi
-	# check if we have the required bits to run compiz and if not, 
-	# fallback
-	if ! check_tfp || ! check_npot_texture || ! check_composite || ! check_texture_size; then
-		abort_with_fallback_wm
-	fi
+# if vesa or vga are in use, do not even try glxinfo (LP#119341)
+if ! running_under_whitelisted_driver || have_blacklisted_pciid; then
+	abort_with_fallback_wm
+fi
+# check if we have the required bits to run compiz and if not, 
+# fallback
+if ! check_tfp || ! check_npot_texture || ! check_composite || ! check_texture_size; then
+	abort_with_fallback_wm
+fi
 
-	if check_nvidia && ! check_nvidia_memory; then
-		abort_with_fallback_wm
-	fi
+if check_nvidia && ! check_nvidia_memory; then
+	abort_with_fallback_wm
+fi
 
-	if ! check_fbconfig; then
-		abort_with_fallback_wm
-	fi
+if ! check_fbconfig; then
+	abort_with_fallback_wm
 fi
 
-# load the ccp plugin if present and fallback to plain gconf if not
+# load the ccp plugin if present
 if [ -f ${PLUGIN_PATH}libccp.so ]; then
 	COMPIZ_PLUGINS="$COMPIZ_PLUGINS ccp"
-elif [ -f ${PLUGIN_PATH}libgconf.so ]; then
-	COMPIZ_PLUGINS="$COMPIZ_PLUGINS glib gconf"
 fi
 
 # get environment
@@ -374,10 +351,17 @@
 elif [ -x ${COMPIZ_BIN_PATH}gtk-window-decorator ] && [ -n "$GNOME_DESKTOP_SESSION_ID" ]; then
 	verbose "Starting gtk-window-decorator\n"
 	${COMPIZ_BIN_PATH}gtk-window-decorator --replace &
-elif [ -x ${COMPIZ_BIN_PATH}kde-window-decorator ] && [ -n "$KDE_FULL_SESSION" ]; then
-	verbose "Starting kde-window-decorator\n"
-	${COMPIZ_BIN_PATH}kde-window-decorator --replace &
+elif [ -x ${COMPIZ_BIN_PATH}kde4-window-decorator ] && [ -n "$KDE_FULL_SESSION" ]; then
+	verbose "Starting kde4-window-decorator\n"
+	${COMPIZ_BIN_PATH}kde4-window-decorator --replace &
 	FALLBACKWM="${KWIN}"
+elif [ -x ${COMPIZ_BIN_PATH}emerald ]; then
+	verbose "Starting emerald\n"
+	${COMPIZ_BIN_PATH}emerald --replace &
+# Abort completely instead of having no window decoration
+elif [ ! -x ${COMPIZ_BIN_PATH}gtk-window-decorator ] && [ ! -x ${COMPIZ_BIN_PATH}kde4-window-decorator ] && [ ! -x ${COMPIZ_BIN_PATH}emerald ]; then
+	echo "No decoration manager found. Aborting..."
+	exit 1
 fi
 
 ${COMPIZ_BIN_PATH}${COMPIZ_NAME} $COMPIZ_OPTIONS "$@" $COMPIZ_PLUGINS || exec $FALLBACKWM $FALLBACKWM_OPTIONS