Bug 466276 - Cursor is not where it should be while using UI Scailing
Summary: Cursor is not where it should be while using UI Scailing
Status: REOPENED
Alias: None
Product: krfb
Classification: Applications
Component: general (other bugs)
Version First Reported In: 24.12.2
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: George Goldberg
URL:
Keywords: usability, wayland-only
: 471997 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-02-22 23:59 UTC by Matt Keith
Modified: 2025-05-26 16:48 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Keith 2023-02-22 23:59:52 UTC
SUMMARY
Krfb displays the cursor in the wrong place but the remote desktop's cursor is somewhere else when using UI Scaling. Once I reduced the UI Scaling to 100% it worked as expected


STEPS TO REPRODUCE
1. Use a single monitor on KDE/Wayland
2. Given a base resolution of 2256x1504. Scale to 200%
3. connect with krfb

OBSERVED RESULT
Your mouse cursor is in the wrong location

EXPECTED RESULT
Mouse cursor should reflect it's actual location

SOFTWARE/OS VERSIONS
Windows client using RealVNC and TigerVNC
Linux/KDE Plasma: 
KDE Plasma Version: 5.27.0
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION
I am using wayland as the compositor
Comment 1 Oleksandr Natalenko 2023-05-14 14:45:10 UTC
Can reproduce this on Arch with 23.01.1.
Comment 2 Oleksandr Natalenko 2023-05-14 14:46:19 UTC
(In reply to Oleksandr Natalenko from comment #1)
> 23.01.1.

23.04.1 of course
Comment 3 Damian Anlauf 2024-03-24 18:23:45 UTC
Just wanted to mention that this issue is still present in Krfb 24.02.1, which makes it impossible to hit targets (e.g., buttons) with the cursor.

Some additional information:
The mouse cursor position on client and Krfb server matches correctly while the cursor is in the top left corner of the screen (origin point; 0,0) but drifts away the further the cursor moves from there.
On 200% scaling, it is as if the client recognized the screen as having 4x as many pixels (e.g., 1920x1080 -> 3840x2160) with the same origin point of 0,0. E.g., if the cursor is, from the perspective of the client, positioned in the center of the screen, in actuality it is positioned in the absolute bottom right corner.

FWIW, I have encountered the exact same issue with the nightly version of the Rustdesk Flatpak on Plasma, which also utilizes the "org.freedesktop.portal.RemoteDesktop" portal, so the issue might lie somewhere upstream.

Operating System: Arch Linux 
KDE Plasma Version: 6.0.2
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.8.1-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-4790K CPU @ 4.00GHz
Memory: 30.3 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 980/PCIe/SSE2
Comment 4 tramonti.luca18 2024-09-02 16:49:12 UTC
Having the same problem, makes krfb unusable
Comment 5 Marco Gulino 2025-01-10 21:40:54 UTC
Same here, Arch Linux with Wayland
Comment 6 Oleksandr Natalenko 2025-01-17 08:30:30 UTC
*** Bug 471997 has been marked as a duplicate of this bug. ***
Comment 7 Bug Janitor Service 2025-04-28 17:39:52 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/krfb/-/merge_requests/86
Comment 8 gwdx 2025-04-29 18:37:50 UTC
Git commit 6379e0169d0e764b6a2855d66cbfda45940f17a3 by Wendi Gan.
Committed on 28/04/2025 at 17:25.
Pushed by alexeymin into branch 'master'.

Fix incorrect cursor position under display scaling

Issue:
When running Krfb on a computer with display scaling, the remote cursor position shown in the VNC client is incorrect.

Change:
Multiply the remote cursor position by devicePixelRatio.

M  +12   -1    krfb/framebuffer.cpp

https://invent.kde.org/network/krfb/-/commit/6379e0169d0e764b6a2855d66cbfda45940f17a3
Comment 9 Alexey Min 2025-04-29 18:48:15 UTC
Git commit 6653960849e6bfb70b67503b61e02cb48a0d2e6c by Alexey Minnekhanov, on behalf of Wendi Gan.
Committed on 29/04/2025 at 18:41.
Pushed by alexeymin into branch 'release/25.04'.

Fix incorrect cursor position under display scaling

Issue:
When running Krfb on a computer with display scaling, the remote cursor position shown in the VNC client is incorrect.

Change:
Multiply the remote cursor position by devicePixelRatio.

(cherry picked from commit 6379e0169d0e764b6a2855d66cbfda45940f17a3)

M  +12   -1    krfb/framebuffer.cpp

https://invent.kde.org/network/krfb/-/commit/6653960849e6bfb70b67503b61e02cb48a0d2e6c
Comment 10 Damian Anlauf 2025-05-15 14:55:33 UTC
I just tried the new version on Arch (25.04.1), which includes the fix, but the issue still persists for me. 
I'm running a 3840x2160 monitor with 150% scaling. 

Operating System: Arch Linux 
KDE Plasma Version: 6.3.5
KDE Frameworks Version: 6.14.0
Qt Version: 6.9.0
Kernel Version: 6.14.6-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-4790K CPU @ 4.00GHz
Memory: 30.3 GiB of RAM
Graphics Processor 1: AMD Radeon RX 5700 XT
Graphics Processor 2: Intel® HD Graphics 4600
Comment 11 Damian Anlauf 2025-05-17 14:42:36 UTC
Just tested it again on OpenSuse Tumbleweed. The same issue persists there as well, no matter which scaling I set it to (except for 100%, aka no scaling, of course).