Bug 410940 - Mouse scroll lagging when stylus above wacom tablet
Summary: Mouse scroll lagging when stylus above wacom tablet
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 4.2.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-15 15:09 UTC by spikestheraccon
Modified: 2019-09-13 09:59 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description spikestheraccon 2019-08-15 15:09:28 UTC
SUMMARY
I'm left-handed and I use mouse and tablet at the same time. But zooming with mouse wheel is problematic then I use tablet. Also I use 2 OS - Windows 10 and Linux(Manjaro)and there is no such problem on windows 10. This problem case any linux distro and any krita version

STEPS TO REPRODUCE
1. Take mouse and stylus
2. Hold the stylus over the tablet
3. Try to zoom with mouse wheel

Sorry for my bad english, I'm russian.


OBSERVED RESULT

Lag zooming with mouse wheel 

EXPECTED RESULT

Normal zoom
Comment 1 Dmitry Kazakov 2019-08-15 15:35:49 UTC
Hi, spikestheraccon!

There should be no wheel-zoom at all when the tablet is in proximity. Krita disables mouse completely when tablet is active. The reason is, the tablet also sends mouse events, so we cannot distinguish, which events come from the real mouse, and which are generated by the tablet. Are you sure that mouse works at all, when you tablet in the proximity?

And do you know about Ctrl+Space+tablet-click gesture for zooming?

===

Когда активен планшет, мышь отключается полностью. Это сделано из-за того, что планшет тоже генерирует события от якобы мыши и мы не можем из никак различить. Вы уверены, что мышь вообще работает, когда стилус находится в зоне приема планшета?

Вы знаете о существовании специальногго жеста для зума на планшете: Ctrl+Space+tablet-click?
Comment 2 spikestheraccon 2019-08-15 16:45:37 UTC
(In reply to Dmitry Kazakov from comment #1)
> Hi, spikestheraccon!
> 
> There should be no wheel-zoom at all when the tablet is in proximity. Krita
> disables mouse completely when tablet is active. The reason is, the tablet
> also sends mouse events, so we cannot distinguish, which events come from
> the real mouse, and which are generated by the tablet. Are you sure that
> mouse works at all, when you tablet in the proximity?
> 
> And do you know about Ctrl+Space+tablet-click gesture for zooming?
> 
> ===
> 
> Когда активен планшет, мышь отключается полностью. Это сделано из-за того,
> что планшет тоже генерирует события от якобы мыши и мы не можем из никак
> различить. Вы уверены, что мышь вообще работает, когда стилус находится в
> зоне приема планшета?
> 
> Вы знаете о существовании специальногго жеста для зума на планшете:
> Ctrl+Space+tablet-click?

Да, я этим активно пользуюсь на windows, и этот лаг не дает мне спокойно рисовать в Крите на linux, причем этот прием я использую и в других программах (Aseprite, SAI), про комбинацию ctrl+space+клик знаю, но использовать неудобно. Значит лаг невозможно исправить?
Comment 3 Bug Janitor Service 2019-08-16 04:33:10 UTC
Thanks for your comment!

Automatically switching the status of this bug to REPORTED so that the KDE team
knows that the bug is ready to get confirmed.

In the future you may also do this yourself when providing needed information.
Comment 4 Dmitry Kazakov 2019-08-16 07:20:17 UTC
Можете приложить видео лага? Я не очень понимаю, почему колесо мыши у вас вообще работает при наличии планшета в зоне действия. Все события мыши должны просто игнорироваться и сочетание не должно работать вообще.
Comment 5 spikestheraccon 2019-08-16 12:44:29 UTC
(In reply to Dmitry Kazakov from comment #4)
> Можете приложить видео лага? Я не очень понимаю, почему колесо мыши у вас
> вообще работает при наличии планшета в зоне действия. Все события мыши
> должны просто игнорироваться и сочетание не должно работать вообще.

Демонстрация работы мыши и планшета одновременно на Windows

https://drive.google.com/file/d/1bAj0WAEfKPiesWhj1kBKS7FL9Qp2PfAO/view?usp=drivesdk

Демонстрация бага зума на Linux и демонстрация работы этого же зума в Aseprite

https://drive.google.com/file/d/1--DCVt-b-UqE--sIcxZQcI2PvCb2Q84r/view?usp=drivesdk
Comment 6 Dmitry Kazakov 2019-08-16 14:41:26 UTC
Спасибо за видео!

Looks like it is a Windows-specific bug. 

1) Mouse events are not completely disabled when the table in a proximity.
2) Perhaps, we should enable wheel events in tablet proximity?
Comment 7 Dmitry Kazakov 2019-08-16 16:15:11 UTC
Git commit 7fee359c6add17b48ecee8f9b4054333c9585a28 by Dmitry Kazakov.
Committed on 16/08/2019 at 16:14.
Pushed by dkazakov into branch 'master'.

Fix lost scroll events when tablet is in the proximity

If there is a really heavy flow of events, the OS will start compressing
wheel events into bigger deltas. So we should do multiple zoom actions,
not one. It might fix the problem on Windows, but it will *not* fix the
problem on Linux, because on Linux XCB just drops all the MOTION events
for the mouse-wheel subdevice and sends DEVICE_CHANGED events instead.
And there is no easy way to generate QWheelEvent from DEVICE_CHANGED
event.

M  +11   -4    libs/ui/input/kis_input_manager.cpp

https://invent.kde.org/kde/krita/commit/7fee359c6add17b48ecee8f9b4054333c9585a28
Comment 8 Dmitry Kazakov 2019-08-16 16:26:57 UTC
Okay, the but should now be fixed:

Windows: works fine
Linux: works better, but still lags a lot

On Linux it is not possible to fix the problem completely without adding a lot of hacks into Qt's QXCBConnection code. The problem is that XCB just drops some XCB_MOTION events for the mouse's scroll wheel, when the tablet is present and sends updates using DEVICE_CHANGED events (XCB_INPUT_REASON_SLAVE_SWITCH). And it is very difficult to generate QWheelEvent from a device-changed event (it lacks windows handle, screen position and modifiers).
Comment 9 Dmitry Kazakov 2019-08-16 16:28:30 UTC
Добрый вечер!

Завтра днем (в 12:00 МСК) будет доступна тестовая сборка с этим исправление вот тут: https://binary-factory.kde.org/job/Krita_Nightly_Windows_Build/

Пожалуйста, протестируйте и переоткройте (REOPENED) багу, если проблема все еще будет присутствовать.
Comment 10 spikestheraccon 2019-08-17 19:11:38 UTC
(In reply to Dmitry Kazakov from comment #9)
> Добрый вечер!
> 
> Завтра днем (в 12:00 МСК) будет доступна тестовая сборка с этим исправление
> вот тут: https://binary-factory.kde.org/job/Krita_Nightly_Windows_Build/
> 
> Пожалуйста, протестируйте и переоткройте (REOPENED) багу, если проблема все
> еще будет присутствовать.

Windows build works fine. There is no lag on it. So, it possible fix lag on linux?
Comment 11 spikestheraccon 2019-08-17 19:37:21 UTC
Я ошиблась, на последнем билде на windows появился баг с панаромированием и иногда даже зумом. 

Подробнее я показала его на видео

https://drive.google.com/open?id=1-3o9KexoVtN8IbUkawErtbDhaWgr29-8
Comment 12 Dmitry Kazakov 2019-08-21 10:46:26 UTC
Git commit bec98dc13e6190708916781aa8f0559ee0c1610e by Dmitry Kazakov.
Committed on 21/08/2019 at 10:46.
Pushed by dkazakov into branch 'master'.

Fix severe zoom jumps when zooming with a touchpad

Every time we decrement accumulatedScrollDelta we should decrement
it with DefaultDeltasPerStep, not with 1's :)

M  +3    -1    libs/ui/input/kis_input_manager.cpp

https://invent.kde.org/kde/krita/commit/bec98dc13e6190708916781aa8f0559ee0c1610e
Comment 13 Dmitry Kazakov 2019-09-13 09:59:57 UTC
Git commit 35bd69e82ce24d8339599943768b36166c2ff1e6 by Dmitry Kazakov.
Committed on 13/09/2019 at 09:06.
Pushed by dkazakov into branch 'krita/4.2'.

Fix lost scroll events when tablet is in the proximity

If there is a really heavy flow of events, the OS will start compressing
wheel events into bigger deltas. So we should do multiple zoom actions,
not one. It might fix the problem on Windows, but it will *not* fix the
problem on Linux, because on Linux XCB just drops all the MOTION events
for the mouse-wheel subdevice and sends DEVICE_CHANGED events instead.
And there is no easy way to generate QWheelEvent from DEVICE_CHANGED
event.

M  +11   -4    libs/ui/input/kis_input_manager.cpp

https://invent.kde.org/kde/krita/commit/35bd69e82ce24d8339599943768b36166c2ff1e6