Commit a500eac1 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Vlad Zahorodnii
Browse files

screencast: Do not send events when moving the cursor outside the viewport

e.g. when we have two outputs


(cherry picked from commit 696abac4)
parent dae1abfd
Pipeline #196996 passed with stage
in 24 minutes and 13 seconds
......@@ -510,6 +510,10 @@ void ScreenCastStream::recordCursor()
return;
}
if (!m_cursor.viewport.contains(Cursors::self()->currentCursor()->pos()) && !m_cursor.visible) {
return;
}
m_pendingBuffer = pw_stream_dequeue_buffer(pwStream);
if (!m_pendingBuffer) {
return;
......@@ -517,6 +521,7 @@ void ScreenCastStream::recordCursor()
struct spa_buffer *spa_buffer = m_pendingBuffer->buffer;
spa_buffer->datas[0].chunk->size = 0;
sendCursorData(Cursors::self()->currentCursor(),
(spa_meta_cursor *)spa_buffer_find_meta_data(spa_buffer, SPA_META_Cursor, sizeof(spa_meta_cursor)));
addHeader(spa_buffer);
......@@ -640,8 +645,10 @@ void ScreenCastStream::sendCursorData(Cursor *cursor, spa_meta_cursor *spa_meta_
spa_meta_cursor->hotspot.x = -1;
spa_meta_cursor->hotspot.y = -1;
spa_meta_cursor->bitmap_offset = 0;
m_cursor.visible = false;
return;
}
m_cursor.visible = true;
const auto position = (cursor->pos() - m_cursor.viewport.topLeft()) * m_cursor.scale;
spa_meta_cursor->id = 1;
......
......@@ -112,6 +112,7 @@ private:
qint64 lastKey = 0;
QRect lastRect;
QScopedPointer<GLTexture> texture;
bool visible = false;
} m_cursor;
QRect cursorGeometry(Cursor *cursor) const;
......
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