[X2Go-Commits] [telekinesis] 01/01: Future rework and improvements of SupportingServices
git-admin at x2go.org
git-admin at x2go.org
Thu Aug 28 13:02:29 CEST 2014
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository telekinesis.
commit 416baa8fbe665a49b4fbb2f8c06c6e964b94764a
Author: gznget <opensource at gznianguan.com>
Date: Thu Aug 28 12:59:31 2014 +0200
Future rework and improvements of SupportingServices
---
X2Go/Telekinesis/Client/Supporting_Services.pm | 31 ++++++++++-----------
client/bin/telekinesis-client | 35 +++++++++++++-----------
2 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/X2Go/Telekinesis/Client/Supporting_Services.pm b/X2Go/Telekinesis/Client/Supporting_Services.pm
index 3f6c7a2..b75aa6b 100644
--- a/X2Go/Telekinesis/Client/Supporting_Services.pm
+++ b/X2Go/Telekinesis/Client/Supporting_Services.pm
@@ -18,32 +18,29 @@
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
# Copyright (C) 2013-2014 Guangzhou Nianguan Electronics Technology Co.Ltd. <opensource at gznianguan.com>
+# Copyright (C) 2013-2014 Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
#
#################################################################################################################
package X2Go::Telekinesis::Client::Supporting_Services;
use strict;
use Exporter qw(import);
-
+use X11::Protocol;
our @EXPORT_OK = qw(getActiveWindowAndDTSIZE);
sub getActiveWindowAndDTSIZE {
- my $return;
- my $returnX;
- my $returnY;
- open(RUN, '-|', "xprop", '-root');
- while (<RUN>) {
- my $line = $_;
- $line =~ s/[\n\ ]//g;
- if ($line =~ /^_NET_ACTIVE_WINDOW\(WINDOW\):windowid#([a-z\d]{9})/) {
- $return = $1;
- } elsif ($line =~ /^_NET_DESKTOP_GEOMETRY\(CARDINAL\)\=([\d]{1,5})\,([\d]{1,5})$/) {
- $returnX = $1;
- $returnY = $2;
- }
- }
- close(RUN);
- return ($return,$returnX,$returnY);
+ my $x11 = X11::Protocol->new();
+ my $screen = 0;
+ my $width = $x11->{'screens'}[$screen]{'width_in_pixels'};
+ my $height = $x11->{'screens'}[$screen]{'height_in_pixels'};
+ $width =~ s/\D//g;
+ $height =~ s/\D//g;
+
+ my $focused_win;
+ ($focused_win, undef) = $x11->GetInputFocus;
+ $focused_win =~ s/\D//g;
+
+ return ($focused_win,$width,$height);
}
diff --git a/client/bin/telekinesis-client b/client/bin/telekinesis-client
index da0fdca..8bafc66 100644
--- a/client/bin/telekinesis-client
+++ b/client/bin/telekinesis-client
@@ -222,7 +222,6 @@ sub coreRunSTATEchanges {
dbugPrint("Connected?\nTrying to authenticate with:$wormholeToken");
print $TheWormhole "IDC|$wormholeToken|\n";
$TnW{'WormholeWatcher'} = Glib::IO->add_watch( fileno($TheWormhole), [qw/in hup err/], \&CShandleTheWormhole, $TheWormhole );
- Gtk2->main_iteration while Gtk2->events_pending;
} else {
#$TheWormhole->close;
#$TheWormhole= undef;
@@ -450,7 +449,7 @@ sub initBuiltInServices {
dbugPrint("Service STARTED");
$TeKiServices{'StateOfX2GoCliWin'}{'active'} = 1;
$TeKiServices{'StateOfX2GoCliWin'}{'loopCnt'} = 0;
- $TeKiServices{'StateOfX2GoCliWin'}{'glibTimeoutID'} = Glib::Timeout->add (30, \&runStateOfX2GoCliWin);# Make this configurable?
+ $TeKiServices{'StateOfX2GoCliWin'}{'glibTimeoutID'} = Glib::Timeout->add (50, \&runStateOfX2GoCliWin);# Make this configurable?
} else {
dbugPrint("Service already started...");
}
@@ -465,40 +464,44 @@ sub initBuiltInServices {
sub runStateOfX2GoCliWin {
if ($TeKiServices{'StateOfX2GoCliWin'}{'active'} eq 1) {
- unless ($TeKiServices{'StateOfX2GoCliWin'}{'heXid'}) {
+ unless ($TeKiServices{'StateOfX2GoCliWin'}{'DecWid'}) {
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'}{'DecWid'} = $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'};
+ ($TeKiServices{'StateOfX2GoCliWin'}{'ActiveWID'},$TeKiServices{'StateOfX2GoCliWin'}{'DeskW'},$TeKiServices{'StateOfX2GoCliWin'}{'DeskH'}) = getActiveWindowAndDTSIZE();
+ $TeKiServices{'StateOfX2GoCliWin'}{'loopCnt'} = 5;
+ } else {
+ $TeKiServices{'StateOfX2GoCliWin'}{'loopCnt'}--;
+ }
+ my $DeskW = $TeKiServices{'StateOfX2GoCliWin'}{'DeskW'};
+ my $DeskH = $TeKiServices{'StateOfX2GoCliWin'}{'DeskH'};
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'}) {
+ if ($TeKiServices{'StateOfX2GoCliWin'}{'ActiveWID'} eq $TeKiServices{'StateOfX2GoCliWin'}{'DecWid'}) {
$Visible = 1;
}
-#dbugPrint("SIZES: $DeskX x $DeskY $w x $h $relx, $rely, $ax,$ay");
- if (($w >= $DeskX) and ($h >= $DeskY)) {
- $FullScreen = 1;
+
+ if (($w >= $DeskW) and ($h >= $DeskH)) {
+ if (($relx == 0) and ($rely == 0)) {if (($ax == 0) and ($ay == 0)) {
+ $FullScreen = 1;
+ }}
}
+
if (
($TeKiServices{'StateOfX2GoCliWin'}{'data'}{'FullScreen'} ne $FullScreen) or
($TeKiServices{'StateOfX2GoCliWin'}{'data'}{'Visible'} ne $Visible) or
@@ -521,7 +524,7 @@ sub runStateOfX2GoCliWin {
} else {
$SendString = clups("0|$Visible|$ax|$ay|$h|$w");
}
-
+ dbugPrint("StateOfX2GoCW: A:$TeKiServices{'StateOfX2GoCliWin'}{'ActiveWID'} U:$TeKiServices{'StateOfX2GoCliWin'}{'DecWid'} S:$SendString");
foreach my $chanID (keys $TeKiServices{'StateOfX2GoCliWin'}{'clients'}) {
if ($CHANS{$chanID}{'sockclient'}) {
my $client = $CHANS{$chanID}{'sockclient'};
--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/telekinesis.git
More information about the x2go-commits
mailing list