From 9208a8eb0ed1db94d7ded7545ed55c1bb3937d0f Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 22 Jun 2022 03:04:20 +0200 Subject: [PATCH] screencasting: Properly disable the cursor when it exits the viewport Otherwise it would glitch --- src/plugins/screencast/screencaststream.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/screencast/screencaststream.cpp b/src/plugins/screencast/screencaststream.cpp index 998690ad88..ae2270ef3c 100644 --- a/src/plugins/screencast/screencaststream.cpp +++ b/src/plugins/screencast/screencaststream.cpp @@ -639,10 +639,19 @@ QRect ScreenCastStream::cursorGeometry(Cursor *cursor) const void ScreenCastStream::sendCursorData(Cursor *cursor, spa_meta_cursor *spa_meta_cursor) { - if (!cursor || !spa_meta_cursor || !m_cursor.viewport.contains(cursor->pos())) { + if (!cursor || !spa_meta_cursor) { return; } + if (!m_cursor.viewport.contains(cursor->pos())) { + spa_meta_cursor->id = 0; + spa_meta_cursor->position.x = -1; + spa_meta_cursor->position.y = -1; + spa_meta_cursor->hotspot.x = -1; + spa_meta_cursor->hotspot.y = -1; + spa_meta_cursor->bitmap_offset = 0; + return; + } const auto position = (cursor->pos() - m_cursor.viewport.topLeft()) * m_cursor.scale; spa_meta_cursor->id = 1;