This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch gzng in repository mteleplayer. from b4e9dfe Make client mTP wait for X2Go window before starting new fc740e2 FS Zoom modes, redraw of paused mplayer when overlay becomes visible + some tabbing... new 0a11715 whitespace cleanup The 2 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: .../mteleplayer/bin/mteleplayer_clientside | 241 +++++++++--------- serverside/bin/mteleplayer | 256 +++++++++++--------- 2 files changed, 270 insertions(+), 227 deletions(-) -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/mteleplayer.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch gzng in repository mteleplayer. commit fc740e244ff2efbb054590636d8e530fad49bd31 Author: gznget <opensource@gznianguan.com> Date: Fri Sep 12 12:53:02 2014 +0200 FS Zoom modes, redraw of paused mplayer when overlay becomes visible + some tabbing... --- .../mteleplayer/bin/mteleplayer_clientside | 43 +++- serverside/bin/mteleplayer | 256 +++++++++++--------- 2 files changed, 171 insertions(+), 128 deletions(-) diff --git a/clientside/lib/telekinesis/client/applications/mteleplayer/bin/mteleplayer_clientside b/clientside/lib/telekinesis/client/applications/mteleplayer/bin/mteleplayer_clientside index 8798a1d..8971cf8 100755 --- a/clientside/lib/telekinesis/client/applications/mteleplayer/bin/mteleplayer_clientside +++ b/clientside/lib/telekinesis/client/applications/mteleplayer/bin/mteleplayer_clientside @@ -135,6 +135,7 @@ if (-S $TeKiLSockPath) { my %mpState; $mpState{'MediaERROR'} = 0; $mpState{'FakeFS'} = 0; +$mpState{'ZoomFS'} = 0; $mpState{'mediaPos'} = 0; $mpState{'mediaLength'} = 0; $mpState{'paused'} = 0; @@ -301,6 +302,16 @@ sub handleTheLocalSocket { mpCMD("volume $mpState{'volume'} 1"); } } + if ($1 =~ /^SET\|FSZOOM\|(\d)\|.*/) { + if ($1 eq 1) { + $mpState{'ZoomFS'} = 1; + } elsif ($1 eq 2) { + $mpState{'ZoomFS'} = 2; + } else { + $mpState{'ZoomFS'} = 0; + } + appDBugLog(" ZOOOOOOOM: $mpState{'ZoomFS'}"); + } if ($1 =~ /^XPOSTAT\|(\-?\d*)\|(\-?\d*)\|(\d*)\|(\d*)\|(\d)\|.*/) { doOverlayMagic('ssappwin',$1,$2,$3,$4,$5); } @@ -575,6 +586,7 @@ sub doOverlayMagic { my $changeVis = 0; my $reTogVis = 0; my $changePos = 0; + if ($doWHAT eq "init") { $olMagic{'CsSesWin_FS'} = 0; $olMagic{'CsSesWin_Vis'} = 0; @@ -705,18 +717,14 @@ appDBugLog("WTF:$olMagic{'CsSesWin_FS'} ne $_[1]"); $window->hide_all; } } else { -# if ($reTogVis eq 1) { -# if ($window->visible) { -# $window->hide_all; -# } -# } -# if ($olMagic{'CsSesWin_FS'} eq 1) { -# usleep(1000000); -# } unless ($window->visible) { $window->move($olMagic{'overlay_X'},$olMagic{'overlay_Y'}); + if ($mpState{'paused'} eq 1) { + $window->resize($olMagic{'SsAppWin_Wdt'},($olMagic{'SsAppWin_Hgt'}-1)); + } + $window->show_all; $window->resize($olMagic{'SsAppWin_Wdt'},$olMagic{'SsAppWin_Hgt'}); - $window->show_all; + $changePos = 1; } } @@ -731,7 +739,22 @@ appDBugLog("WTF:$olMagic{'CsSesWin_FS'} ne $_[1]"); } } - + if (($mpState{'ZoomFS'} > 0) and ($olMagic{'visible'} eq 1)) { + my $tmpHeight = $olMagic{'SsAppWin_Hgt'}; + my $tmpWidth = $olMagic{'SsAppWin_Wdt'}; + my $tmpX = $olMagic{'overlay_X'}; + my $tmpY = $olMagic{'overlay_Y'}; + my (undef, undef, $x2goWidth, $x2goHeight, undef) = $X2GoCliWin->get_geometry; + if ($mpState{'ZoomFS'} eq 1) { + $tmpHeight = $tmpWidth; + $tmpY = (($x2goHeight - $tmpWidth)/2); + } elsif ($mpState{'ZoomFS'} eq 2) { + $tmpWidth = ($tmpWidth * 2); + $tmpX = (($x2goWidth - $tmpWidth)/2); + } + $window->move($tmpX,$tmpY); + $window->resize($tmpWidth,$tmpHeight); + } } # OVERLAY MAGIC diff --git a/serverside/bin/mteleplayer b/serverside/bin/mteleplayer index ec77556..7eecd3f 100755 --- a/serverside/bin/mteleplayer +++ b/serverside/bin/mteleplayer @@ -885,120 +885,140 @@ sub changeAudioVolume { } sub eventBtnClickPlayPause { - appDBugLog("Clicked: Play/Pause"); - if ($PlayerStatus{'paused'} eq 1) { - appCOM("MPCMD|PLAY|"); - stateChangePAUSED(0); - } elsif ($PlayerStatus{'paused'} eq 0) { - appCOM("MPCMD|PAUSE|"); - stateChangePAUSED(1); - } + appDBugLog("Clicked: Play/Pause"); + if ($PlayerStatus{'paused'} eq 1) { + appCOM("MPCMD|PLAY|"); + stateChangePAUSED(0); + } elsif ($PlayerStatus{'paused'} eq 0) { + appCOM("MPCMD|PAUSE|"); + stateChangePAUSED(1); + } } sub stateChangePAUSED { - if ($_[0] eq 0) { - $PlayerStatus{'paused'} = 0; - $GTKS{'CTRLS'}{'BtnPlayPauseEBOX'}{'GFX'}->set_from_pixbuf($GTKS{'PixBUF'}{'ctrlsPauseBTN'}); - } elsif ($_[0] eq 1) { - $PlayerStatus{'paused'} = 1; - $GTKS{'CTRLS'}{'BtnPlayPauseEBOX'}{'GFX'}->set_from_pixbuf($GTKS{'PixBUF'}{'ctrlsPlayBTN'}); - } + if ($_[0] eq 0) { + $PlayerStatus{'paused'} = 0; + $GTKS{'CTRLS'}{'BtnPlayPauseEBOX'}{'GFX'}->set_from_pixbuf($GTKS{'PixBUF'}{'ctrlsPauseBTN'}); + } elsif ($_[0] eq 1) { + $PlayerStatus{'paused'} = 1; + $GTKS{'CTRLS'}{'BtnPlayPauseEBOX'}{'GFX'}->set_from_pixbuf($GTKS{'PixBUF'}{'ctrlsPlayBTN'}); + } } sub toggleFullScreen { - if ($PlayerStatus{'fullscreen'} eq 0) { - $GTKS{'MainAppWindow'}->fullscreen; - $GTKS{'CTRLS'}{'MAIN'}->hide_all; - $GTKS{'CTRLS'}{'TOPMENU'}->hide_all; - $PlayerStatus{'fullscreen'} = 1; - } elsif ($PlayerStatus{'fullscreen'} eq 1) { - $GTKS{'MainAppWindow'}->unfullscreen; - $GTKS{'CTRLS'}{'MAIN'}->show_all; - $GTKS{'CTRLS'}{'TOPMENU'}->show_all; - $PlayerStatus{'fullscreen'} = 0; - } - ($GTKS{'RelXpos'},$GTKS{'RelYpos'},undef) = getXWinPosNDim($GTKS{'MainAppWindow'}->window->XWINDOW); - checkDimPosNSend(1); + + if ($PlayerStatus{'fullscreen'} eq 0) { + if ($_[0] eq 1) { + appCOM("SET|FSZOOM|1|"); + } elsif ($_[0] eq 2) { + appCOM("SET|FSZOOM|2|"); + } else { + appCOM("SET|FSZOOM|0|"); + } + + $GTKS{'MainAppWindow'}->fullscreen; + $GTKS{'CTRLS'}{'MAIN'}->hide_all; + $GTKS{'CTRLS'}{'TOPMENU'}->hide_all; + $PlayerStatus{'fullscreen'} = 1; + + } elsif ($PlayerStatus{'fullscreen'} eq 1) { + appCOM("SET|FSZOOM|0|"); + $GTKS{'MainAppWindow'}->unfullscreen; + $GTKS{'CTRLS'}{'MAIN'}->show_all; + $GTKS{'CTRLS'}{'TOPMENU'}->show_all; + $PlayerStatus{'fullscreen'} = 0; + + } + + ($GTKS{'RelXpos'},$GTKS{'RelYpos'},undef) = getXWinPosNDim($GTKS{'MainAppWindow'}->window->XWINDOW); + checkDimPosNSend(1); + } ################################################################################################################################# # key press Event handler... sub keyPressHandler { - my ($widget,$event)= @_; - my %modMasks = getKeyModifiers($event->state()); - my $keyVal = $event->keyval(); - appDBugLog("KEY: $keyVal\n"); - if (($keyVal eq 32) or ($keyVal eq 80) or ($keyVal eq 112) or ($keyVal eq 65299)) {# PLAY/PAUSE - &eventBtnClickPlayPause; - } elsif (($keyVal eq 70) or ($keyVal eq 102)) {# Fullscreen toggler - &toggleFullScreen; - } elsif (($keyVal eq 81) or ($keyVal eq 113)) {# Quit application - &doSelfTerminate; - } elsif ($keyVal eq 65455) {# Audio Volume DOWN - changeAudioVolume("down"); - } elsif ($keyVal eq 65450) {# Audio Volume UP - changeAudioVolume("up"); - } elsif ($keyVal eq 65363) {# SEEK +10s or frame step - if ($modMasks{'ctrl'}) { - appCOM("MPCMD|FRAMESTEP|"); - appDBugLog("FRAMESTEP"); - } else { - appDBugLog("KEYSEEK +10"); - appCOM("MPCMD|KEYSEEK|10|"); - } - } elsif ($keyVal eq 65361) {# SEEK -10s - appCOM("MPCMD|KEYSEEK|-10|"); - } elsif ($keyVal eq 65362) {# SEEK +60s - appCOM("MPCMD|KEYSEEK|60|"); - } elsif ($keyVal eq 65364) {# SEEK -60s - appCOM("MPCMD|KEYSEEK|-60|"); - } - return FALSE; + my ($widget,$event)= @_; + my %modMasks = getKeyModifiers($event->state()); + my $keyVal = $event->keyval(); + appDBugLog("KEY: $keyVal\n"); + if (($keyVal eq 32) or ($keyVal eq 80) or ($keyVal eq 112) or ($keyVal eq 65299)) {# PLAY/PAUSE + &eventBtnClickPlayPause; + } elsif (($keyVal eq 70) or ($keyVal eq 102)) {# Fullscreen toggler + if ($modMasks{'ctrl'}) { + toggleFullScreen('1'); + } elsif ($modMasks{'shift'}) { + toggleFullScreen('2'); + } else { + toggleFullScreen('0'); + } + } elsif (($keyVal eq 81) or ($keyVal eq 113)) {# Quit application + &doSelfTerminate; + } elsif ($keyVal eq 65455) {# Audio Volume DOWN + changeAudioVolume("down"); + } elsif ($keyVal eq 65450) {# Audio Volume UP + changeAudioVolume("up"); + } elsif ($keyVal eq 65363) {# SEEK +10s or frame step + if ($modMasks{'ctrl'}) { + appCOM("MPCMD|FRAMESTEP|"); + appDBugLog("FRAMESTEP"); + } else { + appDBugLog("KEYSEEK +10"); + appCOM("MPCMD|KEYSEEK|10|"); + } + } elsif ($keyVal eq 65361) {# SEEK -10s + appCOM("MPCMD|KEYSEEK|-10|"); + } elsif ($keyVal eq 65362) {# SEEK +60s + appCOM("MPCMD|KEYSEEK|60|"); + } elsif ($keyVal eq 65364) {# SEEK -60s + appCOM("MPCMD|KEYSEEK|-60|"); + } + return FALSE; } sub getKeyModifiers { - my %mask; - my $modifiers = $_[0]; - if ($modifiers =~ /mod2-mask/) {$mask{'numlock'} = TRUE;} - if ($modifiers =~ /lock-mask/) {$mask{'capslock'} = TRUE;} - if (($modifiers =~ /mod4-mask/) or ($modifiers =~ /super-mask/)) {$mask{'redmond'} = TRUE;$mask{'windows'} = TRUE;} - if ($modifiers =~ /shift-mask/) {$mask{'shift'} = TRUE;} - if ($modifiers =~ /control-mask/) {$mask{'ctrl'} = TRUE;} - if ($modifiers =~ /mod1-mask/) {$mask{'alt'} = TRUE;} - if ($modifiers =~ /mod5-mask/) {$mask{'altgr'} = TRUE;} - if (($modifiers =~ /mod1-mask/) or ($modifiers =~ /mod5-mask/)) {$mask{'alts'} = TRUE;} -# if ($modifiers =~ //) {$mask{''} = TRUE;} - return %mask; + my %mask; + my $modifiers = $_[0]; + if ($modifiers =~ /mod2-mask/) {$mask{'numlock'} = TRUE;} + if ($modifiers =~ /lock-mask/) {$mask{'capslock'} = TRUE;} + if (($modifiers =~ /mod4-mask/) or ($modifiers =~ /super-mask/)) {$mask{'redmond'} = TRUE;$mask{'windows'} = TRUE;} + if ($modifiers =~ /shift-mask/) {$mask{'shift'} = TRUE;} + if ($modifiers =~ /control-mask/) {$mask{'ctrl'} = TRUE;} + if ($modifiers =~ /mod1-mask/) {$mask{'alt'} = TRUE;} + if ($modifiers =~ /mod5-mask/) {$mask{'altgr'} = TRUE;} + if (($modifiers =~ /mod1-mask/) or ($modifiers =~ /mod5-mask/)) {$mask{'alts'} = TRUE;} +# if ($modifiers =~ //) {$mask{''} = TRUE;} + return %mask; } ################################################################################################################################# # Load PixBUF sub loadToPixBUF { - my $pixName = sanitizer("anumazcsdaus",$_[0]); - my $pixPath = sanitizeFilePath($_[1]); - if ((-f $pixPath) and ($pixName)) { - $GTKS{'PixBUF'}{$pixName} = Gtk2::Gdk::Pixbuf->new_from_file ($pixPath) or appDBugLog("Unable to load $pixPath to PixBUF... Is it even a GFX file?"); - if ($GTKS{'PixBUF'}{$pixName}) { - appDBugLog("Loaded $pixPath to PixBUF..."); - return 1; - } else { - appDBugLog("Unable to load $pixPath to PixBUF..."); - return 0; - } - } else { - appDBugLog("Unable to load $pixPath to PixBUF..."); - return 0; - } + my $pixName = sanitizer("anumazcsdaus",$_[0]); + my $pixPath = sanitizeFilePath($_[1]); + if ((-f $pixPath) and ($pixName)) { + $GTKS{'PixBUF'}{$pixName} = Gtk2::Gdk::Pixbuf->new_from_file ($pixPath) or appDBugLog("Unable to load $pixPath to PixBUF... Is it even a GFX file?"); + if ($GTKS{'PixBUF'}{$pixName}) { + appDBugLog("Loaded $pixPath to PixBUF..."); + return 1; + } else { + appDBugLog("Unable to load $pixPath to PixBUF..."); + return 0; + } + } else { + appDBugLog("Unable to load $pixPath to PixBUF..."); + return 0; + } } ################################################################################################################################# # Just a sub to tuck away the menu tree somewhere in a tidy fassion.... sub theMenuTreeSUB { - my $action = 0; - my $menu_tree = [ + my $action = 0; + my $menu_tree = [ _Media => { item_type => '<Branch>', children => [ @@ -1043,45 +1063,45 @@ sub theMenuTreeSUB { } ], }, - ]; - return $menu_tree; + ]; + return $menu_tree; } ######################################################################################################## # File CHOOSER And file loading/enqueueing... (Though at the moment it just starts playback...) sub crankFileChooser { - my $fileFilter = Gtk2::FileFilter->new; - $fileFilter->set_name ("Media Files"); - $fileFilter->add_mime_type("audio/*"); - $fileFilter->add_mime_type("video/*"); - my $theFileChooser = Gtk2::FileChooserDialog->new ('Open media file...', undef, 'open', 'gtk-cancel' => 'cancel', 'gtk-ok' => 'ok'); - $theFileChooser->add_filter($fileFilter); - $theFileChooser->set_current_folder($PlayerStatus{'theOpenerDir'}); - if ($theFileChooser->run eq 'ok') { - my $playThisFile = $theFileChooser->get_filename; - if (-f $playThisFile) { - my $isItLoaded = mtpTeKiRemoteFileSetup("FILE:$playThisFile","$X2GoTKSHome/remote/appData/mteleplayer\_$selfSID"); - if ($isItLoaded ne 0) { - setOpenerDir($playThisFile); - actOnEnqueuedMEDIA($isItLoaded,"FILE",0); - } - } - } - $theFileChooser->destroy; + my $fileFilter = Gtk2::FileFilter->new; + $fileFilter->set_name ("Media Files"); + $fileFilter->add_mime_type("audio/*"); + $fileFilter->add_mime_type("video/*"); + my $theFileChooser = Gtk2::FileChooserDialog->new ('Open media file...', undef, 'open', 'gtk-cancel' => 'cancel', 'gtk-ok' => 'ok'); + $theFileChooser->add_filter($fileFilter); + $theFileChooser->set_current_folder($PlayerStatus{'theOpenerDir'}); + if ($theFileChooser->run eq 'ok') { + my $playThisFile = $theFileChooser->get_filename; + if (-f $playThisFile) { + my $isItLoaded = mtpTeKiRemoteFileSetup("FILE:$playThisFile","$X2GoTKSHome/remote/appData/mteleplayer\_$selfSID"); + if ($isItLoaded ne 0) { + setOpenerDir($playThisFile); + actOnEnqueuedMEDIA($isItLoaded,"FILE",0); + } + } + } + $theFileChooser->destroy; } sub setOpenerDir { - if ($_[0] eq 0) { - my $TheDIR = sanitizeDirPath($ENV{'PWD'}); - unless (-d $TheDIR) {$TheDIR = $UserHome;} - unless (-d $TheDIR) {$TheDIR = "";} - $PlayerStatus{'theOpenerDir'} = $TheDIR; - } else { - my $TheDIR = sanitizeDirPath(dirname(File::Spec->rel2abs($_[0]))); - if (-d $TheDIR) { - $PlayerStatus{'theOpenerDir'} = $TheDIR; - } - } + if ($_[0] eq 0) { + my $TheDIR = sanitizeDirPath($ENV{'PWD'}); + unless (-d $TheDIR) {$TheDIR = $UserHome;} + unless (-d $TheDIR) {$TheDIR = "";} + $PlayerStatus{'theOpenerDir'} = $TheDIR; + } else { + my $TheDIR = sanitizeDirPath(dirname(File::Spec->rel2abs($_[0]))); + if (-d $TheDIR) { + $PlayerStatus{'theOpenerDir'} = $TheDIR; + } + } } ######################################################################################################## # GET Media FILE Info -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/mteleplayer.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch gzng in repository mteleplayer. commit 0a117151b6111a2cc5c0f0558ccb7ce54f2490fb Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Sun Sep 14 21:49:01 2014 +0200 whitespace cleanup --- .../mteleplayer/bin/mteleplayer_clientside | 204 ++++++++++---------- 1 file changed, 102 insertions(+), 102 deletions(-) diff --git a/clientside/lib/telekinesis/client/applications/mteleplayer/bin/mteleplayer_clientside b/clientside/lib/telekinesis/client/applications/mteleplayer/bin/mteleplayer_clientside index 8971cf8..344c732 100755 --- a/clientside/lib/telekinesis/client/applications/mteleplayer/bin/mteleplayer_clientside +++ b/clientside/lib/telekinesis/client/applications/mteleplayer/bin/mteleplayer_clientside @@ -1,34 +1,34 @@ #!/usr/bin/perl -T ################################################################################################################# # -# mTelePlayer - A situation aware mediaplayer for the X2Go Terminal System. -# Copyright (C) 2013-2014 Guangzhou Nianguan Electronics Technology Co.Ltd. -# +# mTelePlayer - A situation aware mediaplayer for the X2Go Terminal System. +# Copyright (C) 2013-2014 Guangzhou Nianguan Electronics Technology Co.Ltd. +# # 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 of the License, 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., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -# -# -# Copyright (C) 2013-2014 Guangzhou Nianguan Electronics Technology Co.Ltd. +# +# +# Copyright (C) 2013-2014 Guangzhou Nianguan Electronics Technology Co.Ltd. # Guangzhou Nianguan Electronics Technology Co.Ltd. -# Jin Fu Building , #90 QiFuRoad, +# Jin Fu Building , #90 QiFuRoad, # Guangzhou, Guangdong, # People's Republic of China -# +# # Web: http://opensource.gznianguan.com/ # E-mail: <opensource@gznianguan.com> -# +# ################################################################################################################# # # Hopefully this code will give you some basic idea on how to write Telekinesis enabled applications. @@ -41,11 +41,11 @@ $ENV{'LANG'} = "C"; our $TEKIAPPDEBUG = 1; our $APPNAME = "mteleplayer"; our $APPVER = "0.0.3.0"; -use Glib qw/TRUE FALSE/; +use Glib qw/TRUE FALSE/; use IO::Socket::UNIX qw( SOCK_STREAM ); use Time::HiRes qw( usleep gettimeofday tv_interval clock_gettime clock_getres clock_nanosleep clock stat ); use X2Go::Telekinesis::Apps::AppCore qw(getTeKiPaths tkappDie appDBugLog getCmdFlags getBasicClientsideInfo epicFailPOP); -use X2Go::Telekinesis::CommonCore qw(tcDie sanitizer dbugPrint checkPID sanitizeFilePath sanitizeDirPath genRandSID clups); +use X2Go::Telekinesis::CommonCore qw(tcDie sanitizer dbugPrint checkPID sanitizeFilePath sanitizeDirPath genRandSID clups); use Gtk2; use Gtk2::Helper; use FileHandle; @@ -62,7 +62,7 @@ our $theLIBDIR = sanitizeDirPath("$TeKiPaths{'LIB'}/client/applications/mtelep ######################################################################################################## my $mpFH = FileHandle->new; -our %CmdFlags = getCmdFlags(@ARGV); +our %CmdFlags = getCmdFlags(@ARGV); our ($UserName,$UserHome,$X2GoSID,$X2GoSesHome,$X2GoTKSHome,$TeKiLSockPath) = getBasicClientsideInfo($CmdFlags{'X2GOSID'}); appDBugLog("-------------------------------------------\nStarting....."); @@ -127,9 +127,9 @@ my $mpCacheMinimum = 20.0; my $LocalSocket; if (-S $TeKiLSockPath) { - # We used to do connection stuff here... we still may want to do something here.... who knows... + # We used to do connection stuff here... we still may want to do something here.... who knows... } else { - appDBugLog("No Telekinesis local socket available at: $TeKiLSockPath\n\nIs Telekinesis even running?");doSelfTerminate(); + appDBugLog("No Telekinesis local socket available at: $TeKiLSockPath\n\nIs Telekinesis even running?");doSelfTerminate(); } my %mpState; @@ -142,7 +142,7 @@ $mpState{'paused'} = 0; $mpState{'noshow'} = 1; $mpState{'mute'} = 0; $mpState{'volume'} = 0;# Change this to get from server side! -$mpState{'osd'} = 0; +$mpState{'osd'} = 0; $mpState{'LASTINPUT'} = ""; $mpState{'prevSecond'} = 0; ###########################33 @@ -154,7 +154,7 @@ setMediaInfo(0); $sstatusi{'lastCOMtime'} = (time()+5);# Initiate "lastCOMtime" so we dont crash and burn before we ever get started... $sstatusi{'runState'} = "R"; ##################################### ##################################### ##################################### ##################################### -# The Main Gtk2 event loop +# The Main Gtk2 event loop Gtk2->init; my $window = Gtk2::Window->new('popup'); @@ -167,9 +167,9 @@ $ebox->modify_bg('normal',Gtk2::Gdk::Color->new(0x0000, 0x0000, 0x0000)); $vbox->pack_start($ebox, TRUE, TRUE, 0); $window->add($vbox); $vbox->set_border_width(0); -$window->set_decorated(0); -$window->set_keep_above(1); -$window->signal_connect(event => \&windowEvent); +$window->set_decorated(0); +$window->set_keep_above(1); +$window->signal_connect(event => \&windowEvent); $window->set_focus_on_map(FALSE); $window->set_accept_focus(FALSE); $window->show_all(); @@ -184,7 +184,7 @@ while ($X2GoCliWinID < 1) { my ($tmpSwXid,undef) = <SWXID>; close(SWXID); if ($tmpSwXid =~ /ID:(\d*)/) { - dbugPrint("session.window file OK ($1)"); + dbugPrint("session.window file OK ($1)"); my $gdkwin = $window->window; my $ourXid= $gdkwin->XWINDOW; $mTPWin = Gtk2::Gdk::Window->foreign_new($ourXid); @@ -194,7 +194,7 @@ while ($X2GoCliWinID < 1) { $mTPWin->set_accept_focus(0); } } else { - usleep(10000); + usleep(10000); } } @@ -205,9 +205,9 @@ $TnW{'timeoutRound'} = Glib::Timeout->add (1000, sub {appCOM("YO!");if ($sstatus $TnW{'transglitcpresistance'} = Glib::Timeout->add(100, \&connectionPresistance); $TnW{'mouseDeDodger'} = Glib::Timeout->add(100, sub {if ($olMagic{'dodgeMouse'} eq 1) {doOverlayMagic('dodgemouse',0);}1;}); -Gtk2->main; -# The Main Gtk2 event loop -##################################### ##################################### ##################################### ##################################### +Gtk2->main; +# The Main Gtk2 event loop +##################################### ##################################### ##################################### ##################################### appDBugLog("Execution came to a natural end..."); # Nothing but SUBS past this point.... @@ -222,53 +222,53 @@ sub connectionPresistance { my $time = time(); if ($sstatusi{'startTime'} < ($time-5) and ($sstatusi{'sockState'} ne 3)) { appDBugLog("Its been too long and we still dont have a connection?\nTime to give up!"); - doSelfTerminate(); + doSelfTerminate(); } - if (($sstatusi{'runState'} eq "R") and ($sstatusi{'sockState'} eq 0)) { + if (($sstatusi{'runState'} eq "R") and ($sstatusi{'sockState'} eq 0)) { if (($sstatusi{'sockState'} eq 0) and ( ! defined $LocalSocket)) { $sstatusi{'sockState'} = 1; appDBugLog("Attempting to initiate local socket connection..."); - if ($sstatusi{'sockRetryCnt'} > 0) {# If ther a momentary glitch we'd want to tolerate that but if thers a major problem.... - if ($sstatusi{'sockRetryCnt'} > 10) {# This is a silly attempt at avoiding endless loops when nothing is likely to ever change.. + if ($sstatusi{'sockRetryCnt'} > 0) {# If ther a momentary glitch we'd want to tolerate that but if thers a major problem.... + if ($sstatusi{'sockRetryCnt'} > 10) {# This is a silly attempt at avoiding endless loops when nothing is likely to ever change. appDBugLog("Too many retry attemps at opening the socket connection...\nThere is a problem bigger than just a sporadic glitch..."); - doSelfTerminate(); - } else { # And if thers a problem why not give it some time to hopefully recover - my $sleepTime = (($sstatusi{'sockRetryCnt'}*100000)*2);# For every attempt we wait a bit longer.... + doSelfTerminate(); + } else { # And if thers a problem why not give it some time to hopefully recover + my $sleepTime = (($sstatusi{'sockRetryCnt'}*100000)*2);# For every attempt we wait a bit longer... appDBugLog("Sleeping for: $sleepTime u"); usleep($sleepTime); } } - $sstatusi{'sockRetryCnt'}++; + $sstatusi{'sockRetryCnt'}++; - if (-S $TeKiLSockPath) { + if (-S $TeKiLSockPath) { $LocalSocket= IO::Socket::UNIX->new( Peer => $TeKiLSockPath, Type => SOCK_STREAM, Timeout => 10 ); } else { - appDBugLog("No Telekinesis local socket available at: $TeKiLSockPath\n\nIs Telekinesis even running?");doSelfTerminate(); + appDBugLog("No Telekinesis local socket available at: $TeKiLSockPath\n\nIs Telekinesis even running?");doSelfTerminate(); } - if (defined $LocalSocket) { + if (defined $LocalSocket) { $sstatusi{'sockRetryCnt'} = 0; $sstatusi{'sockState'} = 1; - appDBugLog("Connected to local socket!"); + appDBugLog("Connected to local socket!"); $TnW{'LocalSocketWatcher'} = Glib::IO->add_watch( fileno($LocalSocket), [qw/in hup err/], \&handleTheLocalSocket, $LocalSocket); print $LocalSocket "APP|INITC|mteleplayer|$selfSID|$slaveToken|\n"; } else { $sstatusi{'sockState'} = 0; appDBugLog("ERROR: Can't connect to local socket\nTrying to reconnect in a bit..."); - } + } - } + } } return 1; - } + } } ################################################################################################################################# -# Handle incomming stuff from the localsocket +# Handle incomming stuff from the localsocket sub handleTheLocalSocket { my ( $fd, $condition, $fh ) = @_; @@ -315,7 +315,7 @@ sub handleTheLocalSocket { if ($1 =~ /^XPOSTAT\|(\-?\d*)\|(\-?\d*)\|(\d*)\|(\d*)\|(\d)\|.*/) { doOverlayMagic('ssappwin',$1,$2,$3,$4,$5); } - + if ($1 =~ /^MPCMD\|PLAYMEDIA\|([0-9a-zA-Z]{24,64})\|([A-Z]{3,4})\|(\d*)\|(\d*)\|.*/) { @@ -337,16 +337,16 @@ sub handleTheLocalSocket { mpCMD("loadfile $theMediaFilePath"); if ($mpState{'FakeFS'} ne 1) {mpCMD("osd 0");} mpCMD("volume $mpState{'volume'} 1"); - mpCMD("pausing pause");# Load into a paused state + mpCMD("pausing pause");# Load into a paused state if ($StartSeek > 0) { mpCMD("seek $StartSeek 2"); } if ($StartPaused ne 1) { mpCMD("pause");# Unpause - } + } } - } - # elsif ($2 =~ /URL/) {$Type = "url";} + } + # elsif ($2 =~ /URL/) {$Type = "url";} } elsif ($1 =~ /^MPCMD\|FRAMESTEP\|/) { mpCMD("frame_step"); @@ -384,7 +384,7 @@ sub handleTheLocalSocket { appDBugLog($vmessage); doSelfTerminate(); } - appDBugLog("RMX:$saneData"); + appDBugLog("RMX:$saneData"); } } @@ -395,15 +395,15 @@ sub handleTheLocalSocket { $fh = undef; $sstatusi{'sockState'} = 0; return 0; - } + } } - + if ($fh) { return TRUE; } else { appDBugLog("The connection is closed!\n"); return FALSE; - } + } } @@ -421,8 +421,8 @@ sub do_mplayer{ $TnW{'mplayerIOwatcher'} = Gtk2::Helper->add_watch( $mpFH->fileno, 'in', sub {watch_mplayerOutput( $mpFH,$TnW{'mplayerIOwatcher'} );}); } -sub inList2Play { - appDBugLog("Do stuff at end of file or at next or prev button press"); +sub inList2Play { + appDBugLog("Do stuff at end of file or at next or prev button press"); mpCMD("pausing seek 0 2"); # Currently we're only supporting one file so just seek to 0 and pause.... return 1; } @@ -439,17 +439,17 @@ sub doPauseStuff { appDBugLog("UN-PAUSED"); $mpState{'paused'} = 0; appCOM("PAUSED|0|"); - } + } } return 1; -} +} sub doReportTimePos { my $currentTime = $_[0]; - my $lengthTime = $_[1]; + my $lengthTime = $_[1]; $currentTime =~ s/\.[\d]*$//g;$lengthTime =~ s/\.[\d]*$//g; appCOM("UPDATE|TIME|$currentTime|$lengthTime"); -} +} sub watch_mplayerOutput { my ($fh,$tag) = @_; @@ -465,7 +465,7 @@ sub watch_mplayerOutput { # ANSWERS if ($line =~ /^ID/) { ############################# - # GET MEDIA INFO + # GET MEDIA INFO if ($mediaINFO{'MEDIAINFOSET'} ne 1) { if ($line =~ /^ID_VIDEO_FORMAT\=(.*)$/) { $mediaINFO{'VIDEOFORMAT'} = $1; @@ -473,15 +473,15 @@ sub watch_mplayerOutput { $mediaINFO{'AUDIOFORMAT'} = $1; } elsif ($line =~ /^ID_LENGTH\=([\.\d]*)$/) { $mediaINFO{'LENGTH'} = $1; - } elsif ($line =~ /^ID_SEEKABLE\=1$/) { + } elsif ($line =~ /^ID_SEEKABLE\=1$/) { $mediaINFO{'SEEKABLE'} = 1; - } elsif ($line =~ /^ID_FILENAME\=(.*)$/) { + } elsif ($line =~ /^ID_FILENAME\=(.*)$/) { $mediaINFO{'FILENAME'} = $1; } } # GET MEDIA INFO ############################# - } elsif ($line =~ /^Playing(.*)$/) { + } elsif ($line =~ /^Playing(.*)$/) { appDBugLog("Playing: $1"); } elsif (($line =~ /======================================/) or ($line =~ /Starting playback\.\.\./)) { if ($mediaINFO{'MEDIAINFOSET'} ne 1) { @@ -499,11 +499,11 @@ sub watch_mplayerOutput { my $cacheB = $2;$cacheB =~ s/\D//g; appCOM("CACHING|$cacheP|$cacheB|"); } elsif ($line =~ /===== PAUSE =====/) { - doPauseStuff("pause"); + doPauseStuff("pause"); } elsif (($line =~ /^A:/) or ($line =~ /^V:/)) { - doPauseStuff("unpause"); + doPauseStuff("unpause"); if ($line =~ /^A:[\ \.\d]*V:([\ \.\d]*)/) {$mpState{'mediaPos'} = $1;} - elsif ($line =~ /^A:([\ \.\d]*)/) {$mpState{'mediaPos'} = $1;} + elsif ($line =~ /^A:([\ \.\d]*)/) {$mpState{'mediaPos'} = $1;} elsif ($line =~ /^V:[\ ]*([\.\d]*[\ ]*)/) {$mpState{'mediaPos'} = $1;} # $mpState{'mediaPos'} =~ s/\ //g; my ($newSecond,undef) = split(/\./,$mpState{'mediaPos'}); @@ -515,13 +515,13 @@ sub watch_mplayerOutput { if ($mpState{'mediaLength'} > 0) { if (($mpState{'mediaLength'}-1) <= $mpState{'mediaPos'}) { appDBugLog("LOADPOINT 1! $mpState{'mediaLength'} $mpState{'mediaPos'}"); - mpCMD("pausing frame_step"); - inList2Play("next"); + mpCMD("pausing frame_step"); + inList2Play("next"); } - } + } } } elsif ($line =~ /^Failed to open LIRC support/) {#DO NOTHING!! - } elsif (($line =~ /^Failed\ to\ open.*/) or ($line =~ /^File\ not\ found.*/)) { + } elsif (($line =~ /^Failed\ to\ open.*/) or ($line =~ /^File\ not\ found.*/)) { appDBugLog("NOT A FILE!\n $line"); # Do something HERE? } elsif ($line =~ /^Failed\ to\ recognize\ file\ format.*/) { @@ -558,7 +558,7 @@ sub setMediaInfo { foreach my $key (keys %mediaINFO) { appDBugLog("SET\t$key $mediaINFO{$key}"); } - + if ($mediaINFO{'VIDEOFORMAT'} eq 0) { $mediaINFO{'ONLYAUDIO'} = 1; appCOM("ONLYAUDIO|1|"); @@ -584,7 +584,7 @@ sub setMediaInfo { sub doOverlayMagic { my $doWHAT = lc($_[0]); my $changeVis = 0; - my $reTogVis = 0; + my $reTogVis = 0; my $changePos = 0; if ($doWHAT eq "init") { @@ -618,7 +618,7 @@ sub doOverlayMagic { } elsif ($doWHAT eq "csseswin") { appDBugLog("WTF:$olMagic{'CsSesWin_FS'} ne $_[1]"); - if ($olMagic{'CsSesWin_FS'} ne $_[1]) { + if ($olMagic{'CsSesWin_FS'} ne $_[1]) { if ($_[1] eq 1) { $olMagic{'CsSesWin_FS'} = 1; $reTogVis = 1; @@ -628,9 +628,9 @@ appDBugLog("WTF:$olMagic{'CsSesWin_FS'} ne $_[1]"); } else { appDBugLog("ERROR: Got wrong value '$_[1]' for CsSesWin_FS!"); } - } - - if ($olMagic{'CsSesWin_Vis'} ne $_[2]) { + } + + if ($olMagic{'CsSesWin_Vis'} ne $_[2]) { if ($_[2] eq 1) { $olMagic{'CsSesWin_Vis'} = 1; } elsif ($_[2] eq 0) { @@ -638,7 +638,7 @@ appDBugLog("WTF:$olMagic{'CsSesWin_FS'} ne $_[1]"); } else { appDBugLog("ERROR: Got wrong value '$_[2]' for CsSesWin_Vis!"); } - } + } if (($olMagic{'CsSesWin_aX'} ne $_[3]) or ($olMagic{'CsSesWin_aY'} ne $_[4])) { $olMagic{'CsSesWin_aX'} = $_[3]; @@ -665,7 +665,7 @@ appDBugLog("WTF:$olMagic{'CsSesWin_FS'} ne $_[1]"); $changePos = 1; } - if ($olMagic{'SsAppWin_Vis'} ne $_[5]) { + if ($olMagic{'SsAppWin_Vis'} ne $_[5]) { if ($_[5] eq 1) { $olMagic{'SsAppWin_Vis'} = 1; } elsif ($_[5] eq 0) { @@ -673,14 +673,14 @@ appDBugLog("WTF:$olMagic{'CsSesWin_FS'} ne $_[1]"); } else { appDBugLog("ERROR: Got wrong value '$_[5]' for SsAppWin_Vis!"); } - } + } } elsif ($doWHAT eq "onlyaudio") { if ($_[1] eq 1) { $olMagic{'onlyaudio'} = 1; } else { $olMagic{'onlyaudio'} = 0; } - } + } @@ -688,20 +688,20 @@ appDBugLog("WTF:$olMagic{'CsSesWin_FS'} ne $_[1]"); if (($olMagic{'SsAppWin_Vis'} eq 1) and ($olMagic{'CsSesWin_Vis'} eq 1)) { if ($olMagic{'visible'} eq 0) { - $olMagic{'visible'} = 1; + $olMagic{'visible'} = 1; $changeVis = 1; } } else { if ($olMagic{'visible'} eq 1) { - $olMagic{'visible'} = 0; + $olMagic{'visible'} = 0; $changeVis = 1; - } + } } } else { if ($olMagic{'visible'} eq 1) { - $olMagic{'visible'} = 0; + $olMagic{'visible'} = 0; $changeVis = 1; } @@ -722,7 +722,7 @@ appDBugLog("WTF:$olMagic{'CsSesWin_FS'} ne $_[1]"); if ($mpState{'paused'} eq 1) { $window->resize($olMagic{'SsAppWin_Wdt'},($olMagic{'SsAppWin_Hgt'}-1)); } - $window->show_all; + $window->show_all; $window->resize($olMagic{'SsAppWin_Wdt'},$olMagic{'SsAppWin_Hgt'}); $changePos = 1; @@ -747,27 +747,27 @@ appDBugLog("WTF:$olMagic{'CsSesWin_FS'} ne $_[1]"); my (undef, undef, $x2goWidth, $x2goHeight, undef) = $X2GoCliWin->get_geometry; if ($mpState{'ZoomFS'} eq 1) { $tmpHeight = $tmpWidth; - $tmpY = (($x2goHeight - $tmpWidth)/2); + $tmpY = (($x2goHeight - $tmpWidth)/2); } elsif ($mpState{'ZoomFS'} eq 2) { $tmpWidth = ($tmpWidth * 2); $tmpX = (($x2goWidth - $tmpWidth)/2); } $window->move($tmpX,$tmpY); $window->resize($tmpWidth,$tmpHeight); - } + } } # OVERLAY MAGIC ###################################################################### # Window Event stuff.... just in case we'd want to add more stuff... -sub windowEvent { - my ($mw, $event) = @_; - if ($event->state =~ /button\d\-mask/) { +sub windowEvent { + my ($mw, $event) = @_; + if ($event->state =~ /button\d\-mask/) { doOverlayMagic('dodgemouse',1); } elsif ($event->type =~ /key.*/) { my $type = $event->type; - my $keyval = $event->keyval(); + my $keyval = $event->keyval(); appDBugLog("=== === KEY EVENT: $type ($keyval) === ==="); sendKeyToWin($X2GoCliWinID,$keyval,$type); } @@ -777,14 +777,14 @@ sub sendKeyToWin { my $X11 = X11::Protocol->new; my $X11K = X11::Keyboard->new($X11); my $toWin = $_[0]; - my $theKey = $_[1]; - my $type = "KeyPress"; - if ($_[2] eq "key-release") { + my $theKey = $_[1]; + my $type = "KeyPress"; + if ($_[2] eq "key-release") { $type = "KeyRelease"; - } + } my $keyCode = $X11K->KeysymToKeycode($theKey); print "$theKey $keyCode\n"; - + my $event = $X11->pack_event( name => $type, detail => $keyCode, @@ -802,12 +802,12 @@ sub sendKeyToWin { ################################################################################################################################# # This sub, supposedly try to do a clean termination of the application... -sub doSelfTerminate { +sub doSelfTerminate { $window->hide_all; $runSTATE = "T"; appDBugLog("Self Terminating............\n"); - mpCMD("quit"); - usleep(100000); + mpCMD("quit"); + usleep(100000); if ($TnW{'timeoutRound'}) { Glib::Source->remove($TnW{'timeoutRound'}); @@ -822,7 +822,7 @@ sub doSelfTerminate { appDBugLog("Trying to kill PID: $cleanPID\n"); kill("KILL",$cleanPID); } - } + } } close(PS); @@ -831,10 +831,10 @@ sub doSelfTerminate { $LocalSocket = undef; } - Gtk2->main_quit; - exit; - return FALSE; + Gtk2->main_quit; + exit; + return FALSE; -} +} # And this should be the very end of everything!? ############################################################################################################################################## -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/mteleplayer.git