Do not hide controls in fullscreen while navigating it

This commit is contained in:
Rafostar
2020-09-09 22:56:11 +02:00
parent 0c5278e844
commit a9ac872c98

View File

@@ -53,9 +53,7 @@ var App = GObject.registerClass({
setHideCursorTimeout() setHideCursorTimeout()
{ {
if(this.hideCursorTimeout) this.clearTimeout('hideCursor');
GLib.source_remove(this.hideCursorTimeout);
this.hideCursorTimeout = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1, () => { this.hideCursorTimeout = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1, () => {
this.hideCursorTimeout = null; this.hideCursorTimeout = null;
@@ -68,19 +66,26 @@ var App = GObject.registerClass({
setHideControlsTimeout() setHideControlsTimeout()
{ {
if(this.hideControlsTimeout) this.clearTimeout('hideControls');
GLib.source_remove(this.hideControlsTimeout);
this.hideControlsTimeout = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 3, () => { this.hideControlsTimeout = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 3, () => {
this.hideControlsTimeout = null; this.hideControlsTimeout = null;
if(this.window.isFullscreen) if(this.window.isFullscreen && this.isCursorInPlayer)
this.interface.revealControls(false); this.interface.revealControls(false);
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;
}); });
} }
clearTimeout(name)
{
if(!this[`${name}Timeout`])
return;
GLib.source_remove(this[`${name}Timeout`]);
this[`${name}Timeout`] = null;
}
_buildUI() _buildUI()
{ {
this.window = new Window(this, APP_NAME); this.window = new Window(this, APP_NAME);
@@ -366,11 +371,18 @@ var App = GObject.registerClass({
_onPlayerEnterNotifyEvent(self, event) _onPlayerEnterNotifyEvent(self, event)
{ {
this.isCursorInPlayer = true; this.isCursorInPlayer = true;
this.setHideCursorTimeout();
if(this.window.isFullscreen)
this.setHideControlsTimeout();
} }
_onPlayerLeaveNotifyEvent(self, event) _onPlayerLeaveNotifyEvent(self, event)
{ {
this.isCursorInPlayer = false; this.isCursorInPlayer = false;
this.clearTimeout('hideCursor');
this.clearTimeout('hideControls');
} }
_onPlayerMotionNotifyEvent(self, event) _onPlayerMotionNotifyEvent(self, event)
@@ -383,8 +395,7 @@ var App = GObject.registerClass({
this.interface.revealControls(true); this.interface.revealControls(true);
} }
else if(this.hideControlsTimeout) { else if(this.hideControlsTimeout) {
GLib.source_remove(this.hideControlsTimeout); this.clearTimeout('hideControls');
this.hideControlsTimeout = null;
} }
if(!this.dragStartReady || this.window.isFullscreen) if(!this.dragStartReady || this.window.isFullscreen)