Bug 504546

Summary: In wayland, "Mirror View Around Cursor" action only uses mouse's last position but not tablet's
Product: [Applications] krita Reporter: Ming Chuan <ming>
Component: * UnknownAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: NixOS   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Ming Chuan 2025-05-19 21:03:22 UTC
SUMMARY

When running krita in X11 mode, the "Mirror View Around Cursor" action always flips the canvas around the axis that tablet pen is currently pointing at. However, when running krita in wayland natively, it flips around the position where the mouse pointed at last time before tablet is used.

Perhaps 

STEPS TO REPRODUCE
1. Move the mouse cursor close to the left of screen
2. Use drawing tablet pen to move the cursor to the middle of the screen (tablet operating in absolute position mode)
3. Execute "Mirror View Around Cursor" action. Observe that the canvas is flipped around the left of the screen

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Linux NixOS hyprland
Qt Version: 6.9.0
Krita git hash: master branch at 2025-05-16 (e29803b8f4d858148c6268805812c24557e2e4c9)

ADDITIONAL INFORMATION

If failed to repro in other wayland compositor, this bug could be specific to Hyprland, due to the way mouse pointer and tablet pointer logic is handled (somehow mouse pointer position won't be updated to the tablet pen's position in krita). If that's the case I can inspect further.

If this is a general wayland issue, maybe "Mirror View Around Cursor" could be updated to also take tablet pen's position into account, as that's most like what users want and expect
Comment 1 Ming Chuan 2025-05-19 21:43:59 UTC
Note that in reproduction step 1, the mouse should be moved close the left edge of canvas, but not all the way to the left and hover over krita's toolbox UI. If the mouse is hovering over toolbox UI befure drawing tablet pen is used, the canvas flip action is still wrong but it's wrong in some less obvious way.
Comment 2 Dmitry Kazakov 2026-02-14 16:25:52 UTC
Git commit 228b821a90c989521c812c52fd86fd899d7c33b0 by Dmitry Kazakov.
Committed on 14/02/2026 at 16:25.
Pushed by dkazakov into branch 'transition.now/qt6'.

[qt][wayland] Implement handling of tablet events in QWaylandCursor

That fixes the work of QCursor::pos() when the user utilizes
a tablet device.
Related: bug 515618

M  +1    -1    ext_qt/CMakeLists.txt

https://invent.kde.org/packaging/krita-deps-management/-/commit/228b821a90c989521c812c52fd86fd899d7c33b0
Comment 3 Bug Janitor Service 2026-02-14 16:47:23 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/2647
Comment 4 Dmitry Kazakov 2026-02-14 16:54:21 UTC
Git commit db9704829ea1b0a3a5591a5ba1b4d8142d8125a0 by Dmitry Kazakov.
Committed on 14/02/2026 at 16:54.
Pushed by dkazakov into branch 'master'.

Remove the usage of QCursor::pos() where we can

The real fix for QCursor::pos() will land separately into our version of
Qt6, but this patch will just make it work a little better with the vanilla Qt.

In a lot of cases we do already have the cursor position in the event
object, so we don't need to request it from QCursor.

M  +49   -4    libs/flake/KoPointerEvent.cpp
M  +3    -0    libs/flake/KoPointerEvent.h
M  +9    -28   libs/ui/input/KisPopupWidgetAction.cpp
M  +1    -1    libs/ui/kis_popup_palette.cpp
M  +1    -1    libs/ui/tool/kis_tool_freehand.cc
M  +5    -3    libs/ui/widgets/KoDualColorButton.cpp
M  +1    -1    plugins/tools/tool_transform2/kis_liquify_transform_strategy.cpp

https://invent.kde.org/graphics/krita/-/commit/db9704829ea1b0a3a5591a5ba1b4d8142d8125a0
Comment 5 Dmitry Kazakov 2026-02-14 16:55:44 UTC
Git commit 43bc97d92636f79ddcbb916fbfa5f6f993209ca9 by Dmitry Kazakov.
Committed on 14/02/2026 at 16:55.
Pushed by dkazakov into branch 'krita/6.0'.

Remove the usage of QCursor::pos() where we can

The real fix for QCursor::pos() will land separately into our version of
Qt6, but this patch will just make it work a little better with the vanilla Qt.

In a lot of cases we do already have the cursor position in the event
object, so we don't need to request it from QCursor.

M  +49   -4    libs/flake/KoPointerEvent.cpp
M  +3    -0    libs/flake/KoPointerEvent.h
M  +9    -28   libs/ui/input/KisPopupWidgetAction.cpp
M  +1    -1    libs/ui/kis_popup_palette.cpp
M  +1    -1    libs/ui/tool/kis_tool_freehand.cc
M  +5    -3    libs/ui/widgets/KoDualColorButton.cpp
M  +1    -1    plugins/tools/tool_transform2/kis_liquify_transform_strategy.cpp

https://invent.kde.org/graphics/krita/-/commit/43bc97d92636f79ddcbb916fbfa5f6f993209ca9