cursor-autohide support #702
This commit is contained in:
@@ -4,10 +4,11 @@
|
||||
- Polish translation fixed. German, Turkish and Japanese translation updated.
|
||||
French translation added! Thanks to the translation team!
|
||||
- Support of relative folders from command line.
|
||||
- Support for the mpv option `cursor-autohide` has been added.
|
||||
- A issue with the support of the mpv property `title-bar` has been fixed,
|
||||
at the moment this is most useful for users of the popular uosc user script,
|
||||
the mpv built-in OSC doesn't fully support it yet.
|
||||
- Set `media-controls=yes`.
|
||||
- Set `media-controls=yes` by default.
|
||||
|
||||
|
||||
# v7.1.1.1 Beta (2024-07-20)
|
||||
|
||||
@@ -637,6 +637,7 @@ https://mpv.io/manual/master/#window
|
||||
**mpv.net has currently implemented the following window properties:**
|
||||
|
||||
- [border](https://mpv.io/manual/master/#options-border)
|
||||
- [cursor-autohide](https://mpv.io/manual/master/#options-cursor-autohide)
|
||||
- [fullscreen](https://mpv.io/manual/master/#options-fullscreen)
|
||||
- [keepaspect-window](https://mpv.io/manual/master/#options-keepaspect-window)
|
||||
- [ontop](https://mpv.io/manual/master/#options-ontop)
|
||||
|
||||
2
src/MpvNet.Windows/WinForms/MainForm.Designer.cs
generated
2
src/MpvNet.Windows/WinForms/MainForm.Designer.cs
generated
@@ -38,7 +38,7 @@ partial class MainForm
|
||||
// CursorTimer
|
||||
//
|
||||
CursorTimer.Enabled = true;
|
||||
CursorTimer.Interval = 1000;
|
||||
CursorTimer.Interval = 500;
|
||||
CursorTimer.Tick += CursorTimer_Tick;
|
||||
//
|
||||
// ProgressTimer
|
||||
|
||||
@@ -38,10 +38,12 @@ public partial class MainForm : Form
|
||||
int _lastCursorChanged;
|
||||
int _lastCycleFullscreen;
|
||||
int _taskbarButtonCreatedMessage;
|
||||
int _cursorAutohide = 1000;
|
||||
|
||||
bool _contextMenuIsReady;
|
||||
bool _wasMaximized;
|
||||
bool _maxSizeSet;
|
||||
bool _isCursorVisible = true;
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
@@ -68,9 +70,9 @@ public partial class MainForm : Form
|
||||
|
||||
Player.Init(Handle, true);
|
||||
|
||||
// bool methods not working correctly
|
||||
Player.ObserveProperty("window-maximized", PropChangeWindowMaximized);
|
||||
Player.ObserveProperty("window-minimized", PropChangeWindowMinimized);
|
||||
Player.ObserveProperty("window-maximized", PropChangeWindowMaximized); // bool methods not working correctly
|
||||
Player.ObserveProperty("window-minimized", PropChangeWindowMinimized); // bool methods not working correctly
|
||||
Player.ObserveProperty("cursor-autohide", PropChangeCursorAutohide);
|
||||
|
||||
Player.ObservePropertyBool("border", PropChangeBorder);
|
||||
Player.ObservePropertyBool("fullscreen", PropChangeFullscreen);
|
||||
@@ -1252,8 +1254,7 @@ public partial class MainForm : Form
|
||||
_lastCursorPosition = MousePosition;
|
||||
_lastCursorChanged = Environment.TickCount;
|
||||
}
|
||||
else if ((Environment.TickCount - _lastCursorChanged > 1500 ||
|
||||
Environment.TickCount - _lastCursorChanged > 5000) &&
|
||||
else if ((Environment.TickCount - _lastCursorChanged > _cursorAutohide) &&
|
||||
ClientRectangle.Contains(PointToClient(MousePosition)) &&
|
||||
ActiveForm == this && !ContextMenu.IsVisible && !IsMouseInOsc())
|
||||
|
||||
@@ -1312,6 +1313,18 @@ public partial class MainForm : Form
|
||||
});
|
||||
}
|
||||
|
||||
void PropChangeCursorAutohide()
|
||||
{
|
||||
string strValue = Player.GetPropertyString("cursor-autohide");
|
||||
|
||||
if (strValue == "no")
|
||||
_cursorAutohide = 0;
|
||||
else if (strValue == "always")
|
||||
_cursorAutohide = -1;
|
||||
else if (int.TryParse(strValue, out var intValue))
|
||||
_cursorAutohide = intValue;
|
||||
}
|
||||
|
||||
void PropChangeBorder(bool enabled) {
|
||||
Player.Border = enabled;
|
||||
|
||||
@@ -1478,20 +1491,18 @@ public partial class MainForm : Form
|
||||
base.OnKeyDown(e);
|
||||
}
|
||||
|
||||
static bool _isCursorVisible = true;
|
||||
|
||||
static void ShowCursor()
|
||||
void ShowCursor()
|
||||
{
|
||||
if (!_isCursorVisible)
|
||||
if (!_isCursorVisible && _cursorAutohide != -1)
|
||||
{
|
||||
Cursor.Show();
|
||||
_isCursorVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
static void HideCursor()
|
||||
void HideCursor()
|
||||
{
|
||||
if (_isCursorVisible)
|
||||
if (_isCursorVisible && _cursorAutohide != 0)
|
||||
{
|
||||
Cursor.Hide();
|
||||
_isCursorVisible = false;
|
||||
|
||||
Reference in New Issue
Block a user