From 92bcd8cbfb7393652d7b405766d0ff20e4c1274a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20Dous=20Herv=C3=A9?= Date: Tue, 28 Mar 2023 18:54:26 +0200 Subject: [PATCH 1/2] Added cursor hiding in fullscreen --- Classes/Session/TSSTSessionWindowController.m | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Classes/Session/TSSTSessionWindowController.m b/Classes/Session/TSSTSessionWindowController.m index e321a663..3b6bc999 100644 --- a/Classes/Session/TSSTSessionWindowController.m +++ b/Classes/Session/TSSTSessionWindowController.m @@ -304,6 +304,8 @@ - (void)mouseMoved:(NSEvent *)theEvent } [self refreshLoupePanel]; + + [self handleFullscreenCursorHiding]; } @@ -397,6 +399,15 @@ - (void)infoPanelSetupAtPoint:(NSPoint)point right: NSMaxX([[bar window] frame])]; } +- (void)handleFullscreenCursorHiding +{ + if ([[self window] isFullscreen]) + { + // Invalidate eventual previous timer to prevent cursor flickering + [mouseMovedTimer invalidate]; + mouseMovedTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(hideCursor) userInfo:nil repeats:NO]; + } +} #pragma mark - Actions @@ -1053,11 +1064,7 @@ - (NSURL *)fileURL - (void)hideCursor { mouseMovedTimer = nil; - - if([[self window] isFullscreen]) - { - [NSCursor setHiddenUntilMouseMoves: YES]; - } + [NSCursor setHiddenUntilMouseMoves: YES]; } From 034a176725884999067105afce5ade56d1446440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20Dous=20Herv=C3=A9?= Date: Tue, 28 Mar 2023 19:55:16 +0200 Subject: [PATCH 2/2] Invalidate timer before setting it to nil --- Classes/Session/TSSTSessionWindowController.m | 1 + 1 file changed, 1 insertion(+) diff --git a/Classes/Session/TSSTSessionWindowController.m b/Classes/Session/TSSTSessionWindowController.m index 3b6bc999..1b69da00 100644 --- a/Classes/Session/TSSTSessionWindowController.m +++ b/Classes/Session/TSSTSessionWindowController.m @@ -1063,6 +1063,7 @@ - (NSURL *)fileURL - (void)hideCursor { + [mouseMovedTimer invalidate]; mouseMovedTimer = nil; [NSCursor setHiddenUntilMouseMoves: YES]; }