@@ -38,10 +38,12 @@ public partial class MainForm : Form
38
38
int _lastCursorChanged ;
39
39
int _lastCycleFullscreen ;
40
40
int _taskbarButtonCreatedMessage ;
41
+ int _cursorAutohide = 1000 ;
41
42
42
43
bool _contextMenuIsReady ;
43
44
bool _wasMaximized ;
44
45
bool _maxSizeSet ;
46
+ bool _isCursorVisible = true ;
45
47
46
48
public MainForm ( )
47
49
{
@@ -68,9 +70,9 @@ public MainForm()
68
70
69
71
Player . Init ( Handle , true ) ;
70
72
71
- // bool methods not working correctly
72
- Player . ObserveProperty ( "window-maximized " , PropChangeWindowMaximized ) ;
73
- Player . ObserveProperty ( "window-minimized " , PropChangeWindowMinimized ) ;
73
+ Player . ObserveProperty ( "window-maximized" , PropChangeWindowMaximized ) ; // bool methods not working correctly
74
+ Player . ObserveProperty ( "window-minimized " , PropChangeWindowMinimized ) ; // bool methods not working correctly
75
+ Player . ObserveProperty ( "cursor-autohide " , PropChangeCursorAutohide ) ;
74
76
75
77
Player . ObservePropertyBool ( "border" , PropChangeBorder ) ;
76
78
Player . ObservePropertyBool ( "fullscreen" , PropChangeFullscreen ) ;
@@ -1252,8 +1254,7 @@ void CursorTimer_Tick(object sender, EventArgs e)
1252
1254
_lastCursorPosition = MousePosition ;
1253
1255
_lastCursorChanged = Environment . TickCount ;
1254
1256
}
1255
- else if ( ( Environment . TickCount - _lastCursorChanged > 1500 ||
1256
- Environment . TickCount - _lastCursorChanged > 5000 ) &&
1257
+ else if ( ( Environment . TickCount - _lastCursorChanged > _cursorAutohide ) &&
1257
1258
ClientRectangle . Contains ( PointToClient ( MousePosition ) ) &&
1258
1259
ActiveForm == this && ! ContextMenu . IsVisible && ! IsMouseInOsc ( ) )
1259
1260
@@ -1312,6 +1313,18 @@ void PropChangeWindowMinimized()
1312
1313
} ) ;
1313
1314
}
1314
1315
1316
+ void PropChangeCursorAutohide ( )
1317
+ {
1318
+ string strValue = Player . GetPropertyString ( "cursor-autohide" ) ;
1319
+
1320
+ if ( strValue == "no" )
1321
+ _cursorAutohide = 0 ;
1322
+ else if ( strValue == "always" )
1323
+ _cursorAutohide = - 1 ;
1324
+ else if ( int . TryParse ( strValue , out var intValue ) )
1325
+ _cursorAutohide = intValue ;
1326
+ }
1327
+
1315
1328
void PropChangeBorder ( bool enabled ) {
1316
1329
Player . Border = enabled ;
1317
1330
@@ -1478,20 +1491,18 @@ protected override void OnKeyDown(KeyEventArgs e)
1478
1491
base . OnKeyDown ( e ) ;
1479
1492
}
1480
1493
1481
- static bool _isCursorVisible = true ;
1482
-
1483
- static void ShowCursor ( )
1494
+ void ShowCursor ( )
1484
1495
{
1485
- if ( ! _isCursorVisible )
1496
+ if ( ! _isCursorVisible && _cursorAutohide != - 1 )
1486
1497
{
1487
1498
Cursor . Show ( ) ;
1488
1499
_isCursorVisible = true ;
1489
1500
}
1490
1501
}
1491
1502
1492
- static void HideCursor ( )
1503
+ void HideCursor ( )
1493
1504
{
1494
- if ( _isCursorVisible )
1505
+ if ( _isCursorVisible && _cursorAutohide != 0 )
1495
1506
{
1496
1507
Cursor . Hide ( ) ;
1497
1508
_isCursorVisible = false ;
0 commit comments