Bug 399379

Summary: Mouse scroll doesn't work in UI comboboxes drop-down list
Product: [Applications] krita Reporter: Mykola Krachkovsky <w01dnick>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: halla, tysontanx, wbauer1
Priority: NOR Keywords: regression
Version: 4.1.3   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:

Description Mykola Krachkovsky 2018-10-04 14:58:10 UTC
Mouse wheel vertical scroll doesn't work in UI comboboxes drop-down lists. I'm not sure about every combo, but at least, every I've tried. Mouse scroll on closed combobox works as expected.


STEPS TO REPRODUCE
1. Open "Create new document" window.
2. Click on standard image size combo or color profile combo.
3. Try to use mouse scroll on dropped-down list.

OBSERVED RESULT
Nothing happens, list doesn't actually scroll.

EXPECTED RESULT
List should scroll as in other Qt/KDE programs.

SOFTWARE VERSIONS
KDE Plasma Version: 5.13.5
KDE Frameworks Version: 5.49.0
Qt Version: 5.11.1

ADDITIONAL INFORMATION
Other checked comboboxes: font face/style/size in text window, color profile combos in Krita setings.
Comment 1 Halla Rempt 2018-10-05 07:33:02 UTC
Hi Mykola,

While there certainly are places where the scrollwheel doesn't seem to work, and that might be krita-specific, in those places you mention in this report, the scrollwheel is not supposed to work. Those dropdowns do not have enough items to have a scrollbar, and without a scrollbar, there will be no scrolling.
Comment 2 Halla Rempt 2018-10-05 07:47:39 UTC
Notably, the scroll wheel should work in the brush preset docker and on those items you mention when the combobox isn't dropped down.
Comment 3 Halla Rempt 2018-10-05 08:23:52 UTC
Hm, I'm pretty sure that KisXi2EventFilter is the culprit here. Disabling it, though, makes Krita crash when trying to use the scrollwheel on one of the new image window widgets:

Thread 1 (Thread 0x7f2245e82d80 (LWP 14724)):
[KCrash Handler]
#6  0x00007f22453e686b in QWeakPointer<QObject>::~QWeakPointer (this=0x55f79d708d30, __in_chrg=<optimized out>) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qsharedpointer_impl.h:572
#7  QPointer<QWindow>::~QPointer (this=0x55f79d708d30, __in_chrg=<optimized out>) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qpointer.h:53
#8  QWindowSystemInterfacePrivate::UserEvent::~UserEvent (this=0x55f79d708d20, __in_chrg=<optimized out>) at /home/boud/dev/krita/libs/ui/input/wintab/qxcbconnection.cpp:502
#9  QWindowSystemInterfacePrivate::InputEvent::~InputEvent (this=0x55f79d708d20, __in_chrg=<optimized out>) at /home/boud/dev/krita/libs/ui/input/wintab/qxcbconnection.cpp:514
#10 QWindowSystemInterfacePrivate::WheelEvent::~WheelEvent (this=0x55f79d708d20, __in_chrg=<optimized out>) at /home/boud/dev/krita/libs/ui/input/wintab/qxcbconnection.cpp:549
#11 QWindowSystemInterfacePrivate::WheelEvent::~WheelEvent (this=0x55f79d708d20, __in_chrg=<optimized out>) at /home/boud/dev/krita/libs/ui/input/wintab/qxcbconnection.cpp:549
#12 0x00007f2243088ecf in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#13 0x00007f222c622edb in ?? () from /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#14 0x00007f2242b1adea in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#15 0x00007f2243a98ba7 in QDialog::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007f22453088d9 in KisMainWindow::slotFileNew (this=<optimized out>) at /home/boud/dev/krita/libs/ui/KisMainWindow.cpp:1467
#17 0x00007f2245317c35 in KisMainWindow::qt_static_metacall (_o=0x55f79a8a7c90, _c=<optimized out>, _id=<optimized out>, _a=0x7ffc6702f790) at /home/boud/dev/b-krita/libs/ui/kritaui_autogen/include/moc_KisMainWindow.cpp:302
#18 0x00007f2242b4bad5 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#19 0x00007f22438a3732 in QAction::triggered(bool) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#20 0x00007f22438a5d6c in QAction::activate(QAction::ActionEvent) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#21 0x00007f22438a66c1 in QAction::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#22 0x00007f22438a9e8c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#23 0x00007f22438b145f in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#24 0x00007f22452d0bf7 in KisApplication::notify (this=<optimized out>, receiver=0x55f79cde4c20, event=0x7ffc6702fab0) at /home/boud/dev/krita/libs/ui/KisApplication.cpp:610
#25 0x00007f2242b1cab8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#26 0x00007f22430d9397 in QShortcutMap::dispatchEvent(QKeyEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#27 0x00007f22430d946a in QShortcutMap::tryShortcut(QKeyEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#28 0x00007f224308cdd3 in QWindowSystemInterface::handleShortcutEvent(QWindow*, unsigned long, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString const&, bool, unsigned short) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#29 0x00007f22430aa947 in QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#30 0x00007f22430afe35 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#31 0x00007f2243088f0b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#32 0x00007f222c622edb in ?? () from /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#33 0x00007f2242b1adea in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#34 0x00007f2242b23fa0 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#35 0x000055f78fb7e09a in main (argc=<optimized out>, argv=0x7ffc670300b8) at /home/boud/dev/krita/krita/main.cc:435
Comment 4 Halla Rempt 2018-10-05 08:37:47 UTC
Okay, this actually has been fixed before, in 

commit eccae890400cfac7805c3b89d042d223ea9f5360
Author: Dmitry Kazakov <dimula73@gmail.com>, Fri Jan 22 00:50:48 2016 +0300 (2 years, 8 months ago)
Committer: Dmitry Kazakov <dimula73@gmail.com>, Fri Jan 22 00:50:48 2016 +0300 (2 years, 8 months ago)
Precedes: v2.99.88
Branches: <Expand>

Fix wheel events in Krita 3.0

In Qt 5.5 and later we are no longer subscribed to the synthesized
mouse/wheel events of the basic x11 protocol. Instead we process the
valuator-based events of XInput2. Therefore when overriding the events
processing by Qt, by should also reimplement resending the wheel events.

Fixes T1272

But it's broken again.
Comment 5 Halla Rempt 2018-10-05 09:34:39 UTC
Git commit 9a9f152724e0a9397b24eef53ca2ba4d9fde7cac by Boudewijn Rempt.
Committed on 05/10/2018 at 09:17.
Pushed by rempt into branch 'master'.

Add a cmake option to disable our own tablet support

Off by default, this makes it easier to check whether bugs are
caused by our fork of Qt's classes or to check whether Qt's tablet
support has improved.

M  +4    -0    CMakeLists.txt
A  +6    -0    config_use_qt_xcb.h.cmake
M  +7    -1    krita/main.cc
M  +8    -3    libs/ui/CMakeLists.txt
M  +0    -1    libs/ui/input/wintab/qxcbconnection.cpp

https://commits.kde.org/krita/9a9f152724e0a9397b24eef53ca2ba4d9fde7cac
Comment 6 Mykola Krachkovsky 2018-10-05 09:36:10 UTC
(In reply to Boudewijn Rempt from comment #1)
> While there certainly are places where the scrollwheel doesn't seem to work
Anyway, good to know it's reproduced.
> Those dropdowns do not have enough items to have a scrollbar,
> and without a scrollbar, there will be no scrolling.
Well, I have 17 items in standard image size list and about 80-90 items in color profiles, so there is scroll bar. And I have a lot of fonts. Maybe that depends on installation.

(In reply to Boudewijn Rempt from comment #2)
> Notably, the scroll wheel should work in the brush preset docker
Yes, it works, sorry, haven't checked, as I usually use favorites without actual scroll there.
> and on those items you mention when the combobox isn't dropped down.
Yes, I've mentioned that ;)

(In reply to Boudewijn Rempt from comment #4)
> Okay, this actually has been fixed before, in 
> commit eccae890400cfac7805c3b89d042d223ea9f5360
> ...
> But it's broken again.
It's not totally broken though, T1272 says about canvas zoom/scrolling, which works fine for me. Just combobox drop-down lists broken. Maybe this case was not fixed with that commit?
Comment 7 Halla Rempt 2018-10-05 09:52:05 UTC
 I guess it wasn't fixed -- I think it's been broken since Krita 3.0 was first released, which was when we ported to Qt5.
Comment 8 Halla Rempt 2018-10-07 14:16:43 UTC
So, building Krita with Qt's xcb implementation seems to actually fix most problems. We just need to decided whether that's safe enough...
Comment 9 Halla Rempt 2018-10-11 09:17:09 UTC
Git commit d4a806433f71929e3e08ec46862138ea2b362f4d by Boudewijn Rempt.
Committed on 11/10/2018 at 09:16.
Pushed by rempt into branch 'master'.

Enable Qt's xcb on Linux

So we can generate builds that people can test with their tablets

M  +1    -0    packaging/linux/appimage/build-krita.sh

https://commits.kde.org/krita/d4a806433f71929e3e08ec46862138ea2b362f4d
Comment 10 Halla Rempt 2018-10-11 09:20:26 UTC
Please test https://binary-factory.kde.org/job/Krita_Nightly_Appimage_Build/ build 250 when it's done.
Comment 11 Halla Rempt 2018-10-16 07:43:39 UTC
*** Bug 392342 has been marked as a duplicate of this bug. ***
Comment 12 Mykola Krachkovsky 2018-10-16 11:50:42 UTC
(In reply to Boudewijn Rempt from comment #10)
> Please test https://binary-factory.kde.org/job/Krita_Nightly_Appimage_Build/
> build 250 when it's done.

Sorry, forgot to comment. Scroll in combos drop-downs works with build 250 appimage.
Comment 13 Halla Rempt 2018-10-16 12:10:41 UTC
Right, then we definitely know that our xcb imlpementation is broken...
Comment 14 Mykola Krachkovsky 2018-10-16 14:13:40 UTC
I've looked through commit eccae890400cfac7805c3b89d042d223ea9f5360 and thought that one place looks suspiciously as drop-down is in fact separate window, I've tried to comment out check if current window is a modal window and scroll works.

This 'if':
https://cgit.kde.org/krita.git/tree/libs/ui/input/wintab/qxcbconnection.cpp#n778

So I believe, condition should be slightly more complex. Adding just "QGuiApplication::modalWindow() != window->parent()" didn't work for me.
Comment 15 Mykola Krachkovsky 2018-10-16 15:41:59 UTC
Adding `QGuiApplication::modalWindow() != window->parent(QWindow::IncludeTransients)` fixed problem for me:
https://build.opensuse.org/package/view_file/home:NickLion:kf5/krita/krita-no-window-check.patch

Maybe using just transientParent() is better, I'm not sure.
Comment 16 Halla Rempt 2018-11-27 09:06:37 UTC
Thanks! I'd missed your patch -- I really need to find a better way to stay on top of bugzilla...
Comment 17 Halla Rempt 2018-11-27 09:14:27 UTC
Git commit 4457ff710c48412833d1c84bb9a57c8be9f9fe95 by Boudewijn Rempt.
Committed on 27/11/2018 at 09:13.
Pushed by rempt into branch 'krita/4.1'.

Patch by Mykola Krachkovsky (w01dnick@gmail.com), thanks!

M  +6    -5    libs/ui/input/wintab/qxcbconnection.cpp

https://commits.kde.org/krita/4457ff710c48412833d1c84bb9a57c8be9f9fe95
Comment 18 Halla Rempt 2018-11-27 09:16:47 UTC
Git commit 2b5f1caa6882617c3654a6219fff9ac81d8aaace by Boudewijn Rempt.
Committed on 27/11/2018 at 09:14.
Pushed by rempt into branch 'master'.

Patch by Mykola Krachkovsky (w01dnick@gmail.com), thanks!

M  +6    -5    libs/ui/input/wintab/qxcbconnection.cpp

https://commits.kde.org/krita/2b5f1caa6882617c3654a6219fff9ac81d8aaace
Comment 19 Wolfgang Bauer 2018-11-27 18:14:28 UTC
Unfortunately this fix requires Qt 5.9 and breaks compilation with lower versions...

From the docs:
QWindow *QWindow::parent(QWindow::AncestorMode mode) const

Returns the parent window, if any.

If mode is IncludeTransients, then the transient parent is returned if there is no parent.

A window without a parent is known as a top level window.

This function was introduced in Qt 5.9.
Comment 20 Halla Rempt 2018-11-27 19:36:01 UTC
Aw... We can either ifdef around it, or up the minimum Qt to 5.9. I'm fine with either, 5.9 is the current LTS in any case.
Comment 21 Mykola Krachkovsky 2018-11-27 19:48:32 UTC
(In reply to Boudewijn Rempt from comment #20)
> Aw... We can either ifdef around it, or up the minimum Qt to 5.9. I'm fine
> with either, 5.9 is the current LTS in any case.

There is no need, just use `transientParent()` (present in 5.6) instead of `parent(QWindow::IncludeTransients)`.
Comment 22 Wolfgang Bauer 2018-11-27 22:16:52 UTC
(In reply to Mykola Krachkovsky from comment #21)
> (In reply to Boudewijn Rempt from comment #20)
> > Aw... We can either ifdef around it, or up the minimum Qt to 5.9. I'm fine
> > with either, 5.9 is the current LTS in any case.
> 
> There is no need, just use `transientParent()` (present in 5.6) instead of
> `parent(QWindow::IncludeTransients)`.

Indeed. I just tried that, and it fixes the problem as well.
Comment 23 Halla Rempt 2018-11-28 09:16:57 UTC
Git commit 9c7d30bca00792b28cb007d6668dc9ad303b0653 by Boudewijn Rempt.
Committed on 28/11/2018 at 09:16.
Pushed by rempt into branch 'master'.

Fix build with Qt 5.6

M  +2    -1    libs/ui/input/wintab/qxcbconnection.cpp

https://commits.kde.org/krita/9c7d30bca00792b28cb007d6668dc9ad303b0653
Comment 24 Halla Rempt 2018-11-28 09:23:54 UTC
Git commit 7fabd9fd83b1e3a17c496b244f9875af56b4851b by Boudewijn Rempt.
Committed on 28/11/2018 at 09:23.
Pushed by rempt into branch 'krita/4.1'.

Fix build with Qt 5.6

M  +2    -1    libs/ui/input/wintab/qxcbconnection.cpp

https://commits.kde.org/krita/7fabd9fd83b1e3a17c496b244f9875af56b4851b
Comment 25 Halla Rempt 2019-02-08 14:36:21 UTC
Git commit 4d20adf1d448ed7d4fd711af8cd9bebc47aa853a by Boudewijn Rempt.
Committed on 08/02/2019 at 14:17.
Pushed by rempt into branch 'krita/4.1'.

Add a cmake option to disable our own tablet support

Off by default, this makes it easier to check whether bugs are
caused by our fork of Qt's classes or to check whether Qt's tablet
support has improved.

M  +4    -0    CMakeLists.txt
A  +6    -0    config_use_qt_xcb.h.cmake
M  +7    -1    krita/main.cc
M  +8    -3    libs/ui/CMakeLists.txt
M  +0    -1    libs/ui/input/wintab/qxcbconnection.cpp

https://commits.kde.org/krita/4d20adf1d448ed7d4fd711af8cd9bebc47aa853a