[X2Go-Commits] [x2gothinclient] 01/01: Allow Xinerama / XRandR setup via /proc/cmdline. (Closes: #726).

git-admin at x2go.org git-admin at x2go.org
Sat Jan 10 14:21:32 CET 2015


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2gothinclient.

commit 6b2702442c169f1b948eb3e1c5a563e580a35b8a
Author: Stefan Baur <X2Go-ML-1 at baur-itcs.de>
Date:   Sat Jan 10 14:17:40 2015 +0100

    Allow Xinerama / XRandR setup via /proc/cmdline. (Closes: #726).
---
 debian/changelog                    |    4 +++
 displaymanager/sbin/x2gothinclientd |   46 +++++++++++++++++++++++++++++++----
 2 files changed, 45 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 1aed61b..5f82a51 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -80,6 +80,10 @@ x2gothinclient (1.5.0.0-0x2go1) UNRELEASED; urgency=low
   * debian/copyright:
     + Use copyright-format 1.0.
 
+  [ Stefan Baur ]
+  * New upstream release (1.5.0.0):
+    - Allow Xinerama / XRandR setup via /proc/cmdline. (Closes: #726).
+
   [ Mark Pedersen-Cook ]
   * debian/po:
     + Add DebConf translation to Danish.
diff --git a/displaymanager/sbin/x2gothinclientd b/displaymanager/sbin/x2gothinclientd
index d05609e..6897d42 100755
--- a/displaymanager/sbin/x2gothinclientd
+++ b/displaymanager/sbin/x2gothinclientd
@@ -116,25 +116,61 @@ elsif ($pid == 0 )
 			# stay aligned.  This fix has been introduced for a certain make of wacom touch-sensitive
 			# displays.  If you have a touch-sensitive device that isn't affected by this, or that
 			# is negatively affected by this fix, please let us know so we can add a better detection.
+			# The fix is bypassed if a mouse device is detected.
+			# Note that you can manually override the behavior by passing a kernel parameter
+			# xinerama=above|below|same-as|left-of|right-of to override the autodetection.
+
+			# check if a xinerama kernel parameter is set
+			my $xrandrcmdtainted = `cat /proc/cmdline | tr ' ' '\n' | awk -F '=' '\$1 == "xinerama" { print \$2 }'`;
+			my $xrandrcmd;
+			if ($xrandrcmdtainted =~ /(^above$|^below$|^same-as$|^left-of$|^right-of$)/)
+			{
+				# if the parameter value matches one value of the defined set, use that
+				$xrandrcmd = $1;
+			}
+			else
+			{
+				# else default to "left-of", which was our standard behavior in previous versions
+				$xrandrcmd = "left-of";
+			}
+
+			# find out how many touch devices we have
+			my $touchdevicescount = `DISPLAY=:0 LANG=C xsetwacom --list devices | wc -l`;
+
+			# find out how many mouse devices we have
+			my $micecount = `find /dev/input -maxdepth 1 -name "mouse*" | wc -l`;
+
+			# declare two variables for the upcoming loop
 			my $this_display;
 			my $next_display;
-			my $touchdevicescount=`DISPLAY=:0 xsetwacom -d :0 --list devices | wc -l`;
 
+			# loop through the following code block for all connected display devices
 			foreach (`DISPLAY=:0 LANG=C xrandr 2>/dev/null | grep ' connected ' | cut -d ' ' -f1`)
 			{
-				$next_display = $_;
-				$next_display =~ s/\n//;
+				# assign a value to $next_display and remove newline from it
+				chomp ($next_display = $_);
+
+				# $this_display won't be defined until the second time the loop is executed, which is a
+				# neat way of running xrandr only if there are at least two connected display devices
 				if (defined($this_display))
 				{
-					if ($touchdevicescount > 0)
+					if (($touchdevicescount > 0) && ($micecount < 1) && ($xrandrcmdtainted eq ""))
 					{
+						# we have a touch device and no mice, and no xinerama parameter was set,
+						# so switch to clone view to make the touch device usable
 						`DISPLAY=:0 /usr/bin/xrandr --output $next_display --same-as $this_display`;
 					}
 					else
 					{
-						`DISPLAY=:0 /usr/bin/xrandr --output $next_display --left-of $this_display`;
+						# else use whatever is in $xrandrcmd (which is either our default of "left-of",
+						# or a valid xinerama kernel parameter value)
+						`DISPLAY=:0 /usr/bin/xrandr --output $next_display --$xrandrcmd $this_display`;
 					}
+
 				}
+
+				# now set $this_display -> every subsequent iteration of the loop will now enter the code block
+				# above where (defined($this_display)) is the conditional
 				$this_display = $next_display;
 			}
 		}

--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2gothinclient.git


More information about the x2go-commits mailing list