[X2Go-Commits] [mteleplayer] 01/02: FS Zoom modes, redraw of paused mplayer when overlay becomes visible + some tabbing...

git-admin at x2go.org git-admin at x2go.org
Sun Sep 14 21:49:57 CEST 2014


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 at 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


More information about the x2go-commits mailing list