Skip to content
This repository was archived by the owner on Mar 28, 2026. It is now read-only.

Commit 8009e81

Browse files
committed
Delegate cursor auto-hide to jellyfin-web
Removes redundant native cursor hide timer. Now observe's jellyfin-web's mouseIdle class instead. Should fix intermittent failure to hide cursor when video is playing.
1 parent 6c7a37d commit 8009e81

File tree

4 files changed

+12
-16
lines changed

4 files changed

+12
-16
lines changed

native/nativeshell.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,18 @@ window.initCompleted = new Promise(async (resolve) => {
297297
window.sessionStorage.setItem("settingsDescriptions", JSON.stringify(jmpInfo.settingsDescriptions));
298298
}
299299
);
300+
301+
// Sync cursor visibility with jellyfin-web's mouse idle state
302+
const observer = new MutationObserver((mutations) => {
303+
for (const mutation of mutations) {
304+
if (mutation.attributeName === 'class') {
305+
const isIdle = document.body.classList.contains('mouseIdle');
306+
window.api.system.setCursorVisibility(!isIdle);
307+
}
308+
}
309+
});
310+
observer.observe(document.body, { attributes: true, attributeFilter: ['class'] });
311+
300312
resolve();
301313
});
302314

src/system/SystemComponent.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include "utils/Utils.h"
3232
#include "utils/Log.h"
3333

34-
#define MOUSE_TIMEOUT 5 * 1000
3534

3635
#define KONVERGO_PRODUCTID_DEFAULT 3
3736
#define KONVERGO_PRODUCTID_OPENELEC 4
@@ -58,10 +57,6 @@ QMap<SystemComponent::PlatformArch, QString> g_platformArchNames = {
5857
///////////////////////////////////////////////////////////////////////////////////////////////////
5958
SystemComponent::SystemComponent(QObject* parent) : ComponentBase(parent), m_platformType(platformTypeUnknown), m_platformArch(platformArchUnknown), m_doLogMessages(false), m_cursorVisible(true), m_scale(1), m_connectivityCheckReply(nullptr), m_resolveUrlReply(nullptr)
6059
{
61-
m_mouseOutTimer = new QTimer(this);
62-
m_mouseOutTimer->setSingleShot(true);
63-
connect(m_mouseOutTimer, &QTimer::timeout, [&] () { setCursorVisibility(false); });
64-
6560
m_connectivityRetryTimer = new QTimer(this);
6661
m_connectivityRetryTimer->setSingleShot(true);
6762
connect(m_connectivityRetryTimer, &QTimer::timeout, [this]() {
@@ -440,12 +435,10 @@ void SystemComponent::setCursorVisibility(bool visible)
440435
if (visible)
441436
{
442437
qApp->restoreOverrideCursor();
443-
m_mouseOutTimer->start(MOUSE_TIMEOUT);
444438
}
445439
else
446440
{
447441
qApp->setOverrideCursor(QCursor(Qt::BlankCursor));
448-
m_mouseOutTimer->stop();
449442
}
450443

451444
#ifdef Q_OS_MAC

src/system/SystemComponent.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ private Q_SLOTS:
131131
QSslConfiguration getSSLConfiguration();
132132
void setReplyTimeout(QNetworkReply* reply, int ms);
133133

134-
QTimer* m_mouseOutTimer;
135134
QNetworkAccessManager* m_networkManager;
136135
PlatformType m_platformType;
137136
PlatformArch m_platformArch;

src/ui/EventFilter.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
//
44

55
#include "EventFilter.h"
6-
#include "system/SystemComponent.h"
76
#include "settings/SettingsComponent.h"
87
#include "input/InputKeyboard.h"
98
#include <QQuickWindow>
@@ -119,8 +118,6 @@ bool EventFilter::eventFilter(QObject* watched, QEvent* event)
119118
return QObject::eventFilter(watched, event);
120119
}
121120

122-
SystemComponent& system = SystemComponent::Get();
123-
124121
// ignore mouse events if mouse is disabled
125122
if (SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "disablemouse").toBool() &&
126123
((event->type() == QEvent::MouseMove) ||
@@ -172,17 +169,12 @@ bool EventFilter::eventFilter(QObject* watched, QEvent* event)
172169
else
173170
m_currentKeyDown = false;
174171

175-
system.setCursorVisibility(false);
176172
if (kevent->spontaneous() && !kevent->isAutoRepeat())
177173
{
178174
InputKeyboard::Get().keyPress(keyName, keystatus);
179175
return true;
180176
}
181177
}
182-
else if (event->type() == QEvent::MouseMove)
183-
{
184-
system.setCursorVisibility(true);
185-
}
186178
else if (event->type() == QEvent::Wheel)
187179
{
188180
return true;

0 commit comments

Comments
 (0)