This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository telekinesis. from 16709f7 add COPYING file new be2bca6 Rework of "Supporting Services" The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: X2Go/Telekinesis/Client/Supporting_Services.pm | 60 +------------ client/bin/telekinesis-client | 107 ++++++++++++++++-------- 2 files changed, 71 insertions(+), 96 deletions(-) -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/telekinesis.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository telekinesis. commit be2bca6d3da02f7886a964609b91058849b715ea Author: gznget <opensource@gznianguan.com> Date: Tue Aug 26 09:58:14 2014 +0200 Rework of "Supporting Services" --- X2Go/Telekinesis/Client/Supporting_Services.pm | 60 +------------ client/bin/telekinesis-client | 107 ++++++++++++++++-------- 2 files changed, 71 insertions(+), 96 deletions(-) diff --git a/X2Go/Telekinesis/Client/Supporting_Services.pm b/X2Go/Telekinesis/Client/Supporting_Services.pm index a9a511c..3f6c7a2 100644 --- a/X2Go/Telekinesis/Client/Supporting_Services.pm +++ b/X2Go/Telekinesis/Client/Supporting_Services.pm @@ -24,32 +24,9 @@ package X2Go::Telekinesis::Client::Supporting_Services; use strict; use Exporter qw(import); -our @EXPORT_OK = qw(getStateOfX2GoClientWindow); +our @EXPORT_OK = qw(getActiveWindowAndDTSIZE); - - -sub getStateOfX2GoClientWindow { # Hopefully one day, this polling junk can be replaced with the Client window reporting events and states to our local socket. - my $X2GoSID = $_[0]; # On dedicated thin clients we're not doing this anyway and on any reasonably new system - my $Visible = 0; # the resource usage is not really an issue... at all... - my $FullScreen = 0; - my $DeskX = 0; - my $DeskY = 0; - my ($rx,$ry,$ax,$ay,$h,$w,$wID,$mapState) = getXWinPosNDim("X2GO-$X2GoSID"); - if ($mapState eq 1) {# If the window is mapped... - my ($ActiveWID,$cDeskX,$cDeskY)= getActiveWindowAndDTSIZE();# Get active window and desktop size - $DeskX = $cDeskX;$DeskY = $cDeskY; - if ($ActiveWID eq $wID) {# if the active window is the X2Go client window... - $Visible = 1;# At this point were both mapped and we're the active window.... so unlikely anything else is obscuring... (except our stuff) - } - } else { - if (($h eq 1) and ($w eq 1)) { - $FullScreen = 1; - } - } - return ($Visible,$ax,$ay,$h,$w,$DeskX,$DeskY,$FullScreen); -} - sub getActiveWindowAndDTSIZE { my $return; my $returnX; @@ -70,38 +47,3 @@ sub getActiveWindowAndDTSIZE { } - - -sub getXWinPosNDim { - my $NAME = $_[0]; - my %Xpos; - $Xpos{'mapstate'} = 0; - open(RUN, '-|', "xwininfo", '-shape', '-name',$NAME); - while (<RUN>) { - my $line = $_; - $line =~ s/[\n\ ]//g; - if ($line =~ /^Width:(\d{1,5})$/) { - $Xpos{'width'} = $1; - } elsif ($line =~ /^Height:(\d{1,5})$/) { - $Xpos{'height'} = $1; - } elsif ($line =~ /^Absoluteupper-leftX:([\-\d]{1,5})$/) { - $Xpos{'absupleftx'} = $1; - } elsif ($line =~ /^Absoluteupper-leftY:([\-\d]{1,5})$/) { - $Xpos{'absuplefty'} = $1; - } elsif ($line =~ /^Relativeupper-leftX:([\-\d]{1,5})$/) { - $Xpos{'relupleftx'} = $1; - } elsif ($line =~ /^Relativeupper-leftY:([\-\d]{1,5})$/) { - $Xpos{'reluplefty'} = $1; - } elsif ($line =~ /^xwininfo:Windowid:([a-z\d]{9})\"$NAME\"$/) { - $Xpos{'wID'} = $1; - } elsif ($line =~ /^MapState:IsViewable$/) { - $Xpos{'mapstate'} = 1; - } - - } - close(RUN); - return ($Xpos{'relupleftx'},$Xpos{'reluplefty'},$Xpos{'absupleftx'},$Xpos{'absuplefty'},$Xpos{'height'},$Xpos{'width'},$Xpos{'wID'},$Xpos{'mapstate'}); -} - - - diff --git a/client/bin/telekinesis-client b/client/bin/telekinesis-client index cbd9a0a..da0fdca 100644 --- a/client/bin/telekinesis-client +++ b/client/bin/telekinesis-client @@ -33,7 +33,7 @@ use File::Path qw(make_path remove_tree); use IO::Socket::UNIX qw( SOCK_STREAM SOMAXCONN ); use Gtk2; use X2Go::Telekinesis::CoreSupport qw(versionCompCheck getConnectToken premZealot getCmdFlags dbugPrint tcDie sanitizeDirPath sanitizeFilePath sanitizer checkPID genRandSID genRandToken clups);; -use X2Go::Telekinesis::Client::Supporting_Services qw(getStateOfX2GoClientWindow); +use X2Go::Telekinesis::Client::Supporting_Services qw(getActiveWindowAndDTSIZE); my $TeKiCVersion = "0.0.6.2"; $ENV{'PATH'} = "/bin:/usr/bin"; @SIG{qw( INT TERM HUP )} = \&doSelfTerminate; # @@ -449,7 +449,8 @@ sub initBuiltInServices { if ($TeKiServices{'StateOfX2GoCliWin'}{'active'} ne 1) { dbugPrint("Service STARTED"); $TeKiServices{'StateOfX2GoCliWin'}{'active'} = 1; - $TeKiServices{'StateOfX2GoCliWin'}{'glibTimeoutID'} = Glib::Timeout->add (300, \&runStateOfX2GoCliWin);# Make this configurable? + $TeKiServices{'StateOfX2GoCliWin'}{'loopCnt'} = 0; + $TeKiServices{'StateOfX2GoCliWin'}{'glibTimeoutID'} = Glib::Timeout->add (30, \&runStateOfX2GoCliWin);# Make this configurable? } else { dbugPrint("Service already started..."); } @@ -463,41 +464,73 @@ sub initBuiltInServices { } sub runStateOfX2GoCliWin { - if ($TeKiServices{'StateOfX2GoCliWin'}{'active'} eq 1) { - my ($Visible,$ax,$ay,$h,$w,$DeskX,$DeskY,$FullScreen) = getStateOfX2GoClientWindow($X2GoSID); - if ( - ($TeKiServices{'StateOfX2GoCliWin'}{'data'}{'FullScreen'} ne $FullScreen) or - ($TeKiServices{'StateOfX2GoCliWin'}{'data'}{'Visible'} ne $Visible) or - ($TeKiServices{'StateOfX2GoCliWin'}{'data'}{'ax'} ne $ax) or - ($TeKiServices{'StateOfX2GoCliWin'}{'data'}{'ay'} ne $ay) or - ($TeKiServices{'StateOfX2GoCliWin'}{'data'}{'h'} ne $h) or - ($TeKiServices{'StateOfX2GoCliWin'}{'data'}{'w'} ne $w) or - ($_[0] eq 1) - ) { - - $TeKiServices{'StateOfX2GoCliWin'}{'data'}{'FullScreen'} = $FullScreen; - $TeKiServices{'StateOfX2GoCliWin'}{'data'}{'Visible'} = $Visible; - $TeKiServices{'StateOfX2GoCliWin'}{'data'}{'ax'} = $ax; - $TeKiServices{'StateOfX2GoCliWin'}{'data'}{'ay'} = $ay; - $TeKiServices{'StateOfX2GoCliWin'}{'data'}{'h'} = $h; - $TeKiServices{'StateOfX2GoCliWin'}{'data'}{'w'} = $w; - my $SendString = "1|1|0|0|0|0"; - if ($FullScreen eq 1) { - # Default And Asuming we're thin client mode in which case we should never get this far anyhow.... - } else { - $SendString = clups("0|$Visible|$ax|$ay|$h|$w"); - } -# print "Change: $SendString\n"; -#print Dumper($TeKiServices{'StateOfX2GoCliWin'}{'clients'}),"\n"; - foreach my $chanID (keys $TeKiServices{'StateOfX2GoCliWin'}{'clients'}) { -# print "Wants window state: $chanID\n"; - if ($CHANS{$chanID}{'sockclient'}) { - my $client = $CHANS{$chanID}{'sockclient'}; - sayToClient($client,"CORE|SERVICES|X2GOWINDOWSTATE|$SendString|"); - } - } - } - } + if ($TeKiServices{'StateOfX2GoCliWin'}{'active'} eq 1) { + unless ($TeKiServices{'StateOfX2GoCliWin'}{'heXid'}) { + if (-f "$X2GoSesHome/session.window") { + open(SWXID,"$X2GoSesHome/session.window"); + my ($tmpSwXid,undef) = <SWXID>; + close(SWXID); + if ($tmpSwXid =~ /ID:(\d*)/) { + dbugPrint("session.window file OK ($1)"); + $TeKiServices{'StateOfX2GoCliWin'}{'heXid'} = sprintf("0x%x",$1); + $TeKiServices{'StateOfX2GoCliWin'}{'theWindow'} = Gtk2::Gdk::Window->foreign_new($1); + } + } + } + + if ($TeKiServices{'StateOfX2GoCliWin'}{'theWindow'}) { +# dbugPrint("theWindow is OK"); + if ($TeKiServices{'StateOfX2GoCliWin'}{'loopCnt'} < 1) { + dbugPrint("GET ACTIVE WINDOW INFO!"); + ($TeKiServices{'StateOfX2GoCliWin'}{'ActiveWID'},$TeKiServices{'StateOfX2GoCliWin'}{'DeskX'},$TeKiServices{'StateOfX2GoCliWin'}{'DeskY'}) = getActiveWindowAndDTSIZE(); + $TeKiServices{'StateOfX2GoCliWin'}{'loopCnt'} = 8; + } else {$TeKiServices{'StateOfX2GoCliWin'}{'loopCnt'}--;} + my $DeskX = $TeKiServices{'StateOfX2GoCliWin'}{'DeskX'}; + my $DeskY = $TeKiServices{'StateOfX2GoCliWin'}{'DeskY'}; + + my $FullScreen = 0; + my $Visible = 0; + my ($ax,$ay) = $TeKiServices{'StateOfX2GoCliWin'}{'theWindow'}->get_origin; + my ($relx, $rely, $w, $h, undef) = $TeKiServices{'StateOfX2GoCliWin'}{'theWindow'}->get_geometry; + if ($TeKiServices{'StateOfX2GoCliWin'}{'ActiveWID'} eq $TeKiServices{'StateOfX2GoCliWin'}{'heXid'}) { + $Visible = 1; + } +#dbugPrint("SIZES: $DeskX x $DeskY $w x $h $relx, $rely, $ax,$ay"); + if (($w >= $DeskX) and ($h >= $DeskY)) { + $FullScreen = 1; + } + if ( + ($TeKiServices{'StateOfX2GoCliWin'}{'data'}{'FullScreen'} ne $FullScreen) or + ($TeKiServices{'StateOfX2GoCliWin'}{'data'}{'Visible'} ne $Visible) or + ($TeKiServices{'StateOfX2GoCliWin'}{'data'}{'ax'} ne $ax) or + ($TeKiServices{'StateOfX2GoCliWin'}{'data'}{'ay'} ne $ay) or + ($TeKiServices{'StateOfX2GoCliWin'}{'data'}{'h'} ne $h) or + ($TeKiServices{'StateOfX2GoCliWin'}{'data'}{'w'} ne $w) or + ($_[0] eq 1) + ) { + + $TeKiServices{'StateOfX2GoCliWin'}{'data'}{'FullScreen'} = $FullScreen; + $TeKiServices{'StateOfX2GoCliWin'}{'data'}{'Visible'} = $Visible; + $TeKiServices{'StateOfX2GoCliWin'}{'data'}{'ax'} = $ax; + $TeKiServices{'StateOfX2GoCliWin'}{'data'}{'ay'} = $ay; + $TeKiServices{'StateOfX2GoCliWin'}{'data'}{'h'} = $h; + $TeKiServices{'StateOfX2GoCliWin'}{'data'}{'w'} = $w; + my $SendString = "1|1|0|0|0|0"; + if ($FullScreen eq 1) { + # Default And Asuming we're thin client mode in which case we should never get this far anyhow.... + } else { + $SendString = clups("0|$Visible|$ax|$ay|$h|$w"); + } + + foreach my $chanID (keys $TeKiServices{'StateOfX2GoCliWin'}{'clients'}) { + if ($CHANS{$chanID}{'sockclient'}) { + my $client = $CHANS{$chanID}{'sockclient'}; + sayToClient($client,"CORE|SERVICES|X2GOWINDOWSTATE|$SendString|"); + } + } + } + } + } # Insert cleanup routine at the end.... return 1; } -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/telekinesis.git