Commit 43caf253 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Fix mouse pointer disappearing after using zoom effect on X11

Currently, the Cursors::currentCursorChanged signal is wired to the
updateCursor() function which calls xcb_xfixes_hide_cursor() or
xcb_xfixes_show_cursor() depending if the cursor is hidden. However, the
currentCursorChanged signal can be emitted if the cursor changed, e.g. a
new pixmap attached, or its visibility status changes.

The zoom effect hides the pointer, but when user hovers ui elements, it
will most likely change and result in more than one xcb_xfixes_hide_cursor()

It appears like xcb_xfixes_hide_cursor() is implemented as a reference
counter, i.e. if xcb_xfixes_hide_cursor() is called two times, then you
must call xcb_xfixes_show_cursor() two times as well.

This change adds a dedicated signal to indicate whether the cursor is
hidden to avoid calling xcb_xfixes_hide_cursor() multiple times while
the screen is scaled.

BUG: 448537

(cherry picked from commit 0ad239a9)
parent 75462970
Pipeline #135632 passed with stage
in 14 minutes and 16 seconds
......@@ -72,6 +72,7 @@ DrmOutput::DrmOutput(DrmPipeline *pipeline)
connect(Cursors::self(), &Cursors::currentCursorChanged, this, &DrmOutput::updateCursor);
connect(Cursors::self(), &Cursors::hiddenChanged, this, &DrmOutput::updateCursor);
connect(Cursors::self(), &Cursors::positionChanged, this, &DrmOutput::moveCursor);
......@@ -142,8 +142,7 @@ bool X11StandalonePlatform::initialize()
if (Xcb::Extensions::self()->isRandrAvailable()) {
m_randrEventFilter.reset(new XrandrEventFilter(this));
connect(Cursors::self(), &Cursors::currentCursorChanged, this, &X11StandalonePlatform::updateCursor);
connect(Cursors::self(), &Cursors::hiddenChanged, this, &X11StandalonePlatform::updateCursor);
return true;
......@@ -67,7 +67,7 @@ void Cursors::hideCursor()
if (m_cursorHideCounter == 1) {
Q_EMIT currentCursorChanged(m_currentCursor);
Q_EMIT hiddenChanged();
......@@ -75,7 +75,7 @@ void Cursors::showCursor()
if (m_cursorHideCounter == 0) {
Q_EMIT currentCursorChanged(m_currentCursor);
Q_EMIT hiddenChanged();
......@@ -280,6 +280,7 @@ public:
void currentCursorChanged(Cursor* cursor);
void hiddenChanged();
void positionChanged(Cursor* cursor, const QPoint &position);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment