1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-09 23:34:06 +02:00

Make Escape key in video player exit fullscreen or close the player

This commit is contained in:
chylex 2017-08-27 21:03:57 +02:00
parent 42f4d97d5d
commit 445e6fcec0

View File

@ -65,11 +65,7 @@ private void pipe_DataIn(object sender, DuplexPipe.PipeReadEventArgs e){
break;
case "die":
timerSync.Stop();
Visible = false;
pipe.Write("rip");
Close();
StopVideo();
break;
}
}
@ -197,6 +193,17 @@ private bool HandleKey(Keys key){
TogglePause();
return true;
case Keys.Escape:
if (Player.fullScreen){
Player.fullScreen = false;
NativeMethods.SetForegroundWindow(ownerHandle);
return true;
}
else{
StopVideo();
return true;
}
default:
return false;
}
@ -216,6 +223,14 @@ private void TogglePause(){
Marshal.ReleaseComObject(controls);
}
private void StopVideo(){
timerSync.Stop();
Visible = false;
pipe.Write("rip");
Close();
}
internal class MessageFilter : IMessageFilter{
private readonly FormPlayer form;