1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-09 06:15:49 +02:00

Fix cursor staying on 'resize' when moved over minimum size video player

This commit is contained in:
chylex 2018-11-23 01:31:01 +01:00
parent 9414f372d7
commit e8de7266d0

View File

@ -10,6 +10,13 @@
namespace TweetDuck.Video{
sealed partial class FormPlayer : Form{
private bool IsCursorOverVideo{
get{
Point cursor = PointToClient(Cursor.Position);
return cursor.Y < tablePanel.Location.Y;
}
}
protected override bool ShowWithoutActivation => true;
private readonly IntPtr ownerHandle;
@ -197,6 +204,10 @@ private void timerSync_Tick(object sender, EventArgs e){
if (isCursorInside && !wasCursorInside){
wasCursorInside = true;
if (IsCursorOverVideo){
Cursor.Current = Cursors.Default;
}
}
else if (!isCursorInside && wasCursorInside){
wasCursorInside = false;
@ -313,26 +324,19 @@ private void StopVideo(){
internal sealed class MessageFilter : IMessageFilter{
private readonly FormPlayer form;
private bool IsCursorOverVideo{
get{
Point cursor = form.PointToClient(Cursor.Position);
return cursor.Y < form.tablePanel.Location.Y;
}
}
public MessageFilter(FormPlayer form){
this.form = form;
}
bool IMessageFilter.PreFilterMessage(ref Message m){
if (m.Msg == 0x0201){ // WM_LBUTTONDOWN
if (IsCursorOverVideo){
if (form.IsCursorOverVideo){
form.TogglePause();
return true;
}
}
else if (m.Msg == 0x0203){ // WM_LBUTTONDBLCLK
if (IsCursorOverVideo){
if (form.IsCursorOverVideo){
form.TogglePause();
form.Player.fullScreen = !form.Player.fullScreen;
return true;