lxqt / pcmanfm-qt

File manager and desktop icon manager (Qt port of PCManFM and libfm)
https://lxqt-project.org
GNU General Public License v2.0
414 stars 113 forks source link

Drag and drop not working under Wayland #1800

Closed HazelHex closed 1 year ago

HazelHex commented 1 year ago
Current Behavior

Hello! I'm running Gentoo under river WM. The drag and drop feature of pcmanfm-qt does not work for me at all. When I grab some file or folder nothing happens. E.g. I cannot drag'n'drop anything inside the same file view, or between the panels, or anywhere else outside. The cursor does not change, there is no indication, that the file is grabbed, etc. It is the same story with the lxqt-archiver. I should note that the only place, where DND works is the tab titles.

I also tested with the explicit pcmanfm-qt --platform wayland and the result is the same.

I also have tested this under DWL, which is another wlroots-based WM. There pcmanfm-qt crashes, when I try to grab something:

Jul 24 20:02:34 localhost kernel: pcmanfm-qt[16787]: segfault at 8 ip 00007f7fc7853a11 sp 00007fff5815a650 error 4 in libQt5Gui.so.5.15.10[7f7fc77de000+4c4000] likely on CPU 10 (core 5, socket 0)
Jul 24 20:02:34 localhost kernel: Code: 44 00 eb ac 64 48 8b 04 25 28 00 00 00 48 3b 44 24 10 75 0c 48 83 c4 18 5b 41 5c 41 5e 41 5f c3 e8 24 94 44 00 0f 1f 40 00 53 <48> 8b 46 08 48 89 fb 48 8b 80 a8 00 00 00 48 8b 48 10 48 85 c9 74
Jul 24 20:04:22 localhost kernel: pcmanfm-qt[16825]: segfault at 8 ip 00007f19eca53a11 sp 00007fff801768e0 error 4 in libQt5Gui.so.5.15.10[7f19ec9de000+4c4000] likely on CPU 1 (core 0, socket 0)
Jul 24 20:04:22 localhost kernel: Code: 44 00 eb ac 64 48 8b 04 25 28 00 00 00 48 3b 44 24 10 75 0c 48 83 c4 18 5b 41 5c 41 5e 41 5f c3 e8 24 94 44 00 0f 1f 40 00 53 <48> 8b 46 08 48 89 fb 48 8b 80 a8 00 00 00 48 8b 48 10 48 85 c9 74
Jul 24 20:04:37 localhost kernel: pcmanfm-qt[16845]: segfault at 8 ip 00007f09fa253a11 sp 00007ffdfd2c5b10 error 4 in libQt5Gui.so.5.15.10[7f09fa1de000+4c4000] likely on CPU 1 (core 0, socket 0)
Jul 24 20:04:37 localhost kernel: Code: 44 00 eb ac 64 48 8b 04 25 28 00 00 00 48 3b 44 24 10 75 0c 48 83 c4 18 5b 41 5c 41 5e 41 5f c3 e8 24 94 44 00 0f 1f 40 00 53 <48> 8b 46 08 48 89 fb 48 8b 80 a8 00 00 00 48 8b 48 10 48 85 c9 74
Jul 24 20:05:02 localhost kernel: pcmanfm-qt[16865]: segfault at 8 ip 00007fd85d253a11 sp 00007ffe626ab1a0 error 4 in libQt5Gui.so.5.15.10[7fd85d1de000+4c4000] likely on CPU 6 (core 3, socket 0)
Jul 24 20:05:02 localhost kernel: Code: 44 00 eb ac 64 48 8b 04 25 28 00 00 00 48 3b 44 24 10 75 0c 48 83 c4 18 5b 41 5c 41 5e 41 5f c3 e8 24 94 44 00 0f 1f 40 00 53 <48> 8b 46 08 48 89 fb 48 8b 80 a8 00 00 00 48 8b 48 10 48 85 c9 74

Interestingly enough, under DWL I see for a brief moment before the crash, that the file "grab rectangle" appears, so it reacts somehow.

Expected Behavior

The drag and drop feature to work as expected under Wayland with wlroots-based WMs.

Steps to Reproduce (for bugs)
  1. WLR_NO_HARDWARE_CURSORS=1 WLR_RENDERER=vulkan dbus-run-session -- river
  2. Start the pcmanfm-qt file manager
  3. Try to grab any file or folder
  4. Observe that nothing happens
System Information

Packages: app-arch/lxqt-archiver-0.8.0::gentoo dev-qt/linguist-tools-5.15.10::gentoo dev-qt/qtconcurrent-5.15.10::gentoo dev-qt/qtcore-5.15.10::gentoo dev-qt/qtdbus-5.15.10::gentoo dev-qt/qtdeclarative-5.15.10-r2::gentoo dev-qt/qtgui-5.15.10::gentoo dev-qt/qtnetwork-5.15.10-r2::gentoo dev-qt/qtpaths-5.15.10::gentoo dev-qt/qtsvg-5.15.10::gentoo dev-qt/qttest-5.15.10::gentoo dev-qt/qtwayland-5.15.10-r1::gentoo dev-qt/qtwaylandscanner-5.15.10::gentoo dev-qt/qtwidgets-5.15.10-r1::gentoo dev-qt/qtx11extras-5.15.10::gentoo dev-qt/qtxml-5.15.10::gentoo dev-util/lxqt-build-tools-0.13.0::gentoo x11-libs/libfm-qt-1.3.0::gentoo x11-misc/pcmanfm-qt-1.3.0::gentoo x11-misc/qt5ct-1.7::gentoo

stefonarch commented 1 year ago

I'm using pcmanfm-qt some months under labwc and wayfire and DND works fine everewhere, so I think there is something in river or dwl or gentoo. Can you test under labwc?

tsujan commented 1 year ago

Not reproducible here either.

Under Wayland (Wayfire and Plasma-Wayland), I've not only tested the Qt5-based pcmanfm-qt but also used the Qt6 branch (because of Qt6's better Wayland support).

The problem you see has another cause. I guess you should encounter similar issues with all Qt apps. You could add more info to this page if you like.

tsujan commented 1 year ago

The drag and drop feature to work as expected under Wayland with wlroots-based WMs.

Oh, sorry, this caught my attention in the last minute. It proves that the problem in not in pcmanfm-qt.

stefonarch commented 1 year ago

I updated yesterday my system and DND was broken in pcmanfm-qt 1.3 and 2.0 now too, recompiling fixed it for 1.3.* but not for the qt6 version

tsujan commented 1 year ago

recompiling fixed it for 1.3.* but not for the qt6 version

I think you just replaced the Qt6 version with the Qt5 one by recompilation.

Yes, after seeing your comment, I saw the problem in Wayfire too (with Qt6), but not just in pcmanfm-qt. Arqiver's DND didn't work either (Qt6 again). Then I logged into Plasma-Wayland: pcmanfm-qt's DND worked, but Arqiver's only worked intermittently. DND worked under Wayfire and Plasma-Wayland with Qt5 apps.

Something has changed about Wayland. Since I hadn't touched my installed Wayfire, I guess its recompilation might be needed. However, there's nothing we can do about this. Someone has messed up with DND in a basic library related to Wayland.

stefonarch commented 1 year ago

I think you just replaced the Qt6 version with the Qt5 one by recompilation.

I don't remember exactly if I tested with qt5 before recompiling, so this is probably true.

DND works under wayland still fine with gtk apps and qt5 but not with qt6 (lximage-qt, pcmanfm-qt) after that upgrade:

2023-07-28T08:42:31+0200] [ALPM] upgraded qt6-translations (6.5.1-1 -> 6.5.2-1)
[2023-07-28T08:42:32+0200] [ALPM] upgraded qt6-base (6.5.1-5 -> 6.5.2-1)
[2023-07-28T08:42:32+0200] [ALPM] upgraded python-pyqt6-sip (13.5.1-2 -> 13.5.2-1)
[2023-07-28T08:42:32+0200] [ALPM] upgraded python-pyqt6 (6.5.1-1 -> 6.5.2-1)
[2023-07-28T08:42:32+0200] [ALPM] upgraded qt6-5compat (6.5.1-2 -> 6.5.2-1)
[2023-07-28T08:42:33+0200] [ALPM] upgraded qt6-declarative (6.5.1-2 -> 6.5.2-1)
[2023-07-28T08:42:33+0200] [ALPM] upgraded qt6-imageformats (6.5.1-1 -> 6.5.2-1)
[2023-07-28T08:42:33+0200] [ALPM] upgraded qt6-multimedia-ffmpeg (6.5.1-1 -> 6.5.2-1)
[2023-07-28T08:42:34+0200] [ALPM] upgraded qt6-multimedia (6.5.1-1 -> 6.5.2-1)
[2023-07-28T08:42:34+0200] [ALPM] upgraded qt6-positioning (6.5.1-1 -> 6.5.2-1)
[2023-07-28T08:42:34+0200] [ALPM] upgraded qt6-quicktimeline (6.5.1-1 -> 6.5.2-1)
[2023-07-28T08:42:35+0200] [ALPM] upgraded qt6-quick3d (6.5.1-1 -> 6.5.2-1)
[2023-07-28T08:42:35+0200] [ALPM] upgraded qt6-serialport (6.5.1-1 -> 6.5.2-1)
[2023-07-28T08:42:35+0200] [ALPM] upgraded qt6-shadertools (6.5.1-1 -> 6.5.2-1)
[2023-07-28T08:42:35+0200] [ALPM] upgraded qt6-svg (6.5.1-1 -> 6.5.2-1)
[2023-07-28T08:42:35+0200] [ALPM] upgraded qt6-tools (6.5.1-1 -> 6.5.2-1)
[2023-07-28T08:42:35+0200] [ALPM] upgraded qt6-wayland (6.5.1-1 -> 6.5.2-1)
tsujan commented 1 year ago

Yes, it should be about Qt 6.5.1 -> 6.5.2. I'll investigate it when I completely get rid of this nasty influenza I've got.

tsujan commented 1 year ago

OK, the Qt6 issue is a serious regression in Qt 6.5.2. I was able to reproduce it with a simple test widget too. Qt 6.5.2 isn't usable under Wayland.

stefonarch commented 1 year ago

Any bug report open about that?

tsujan commented 1 year ago

Any bug report open about that?

I didn't search for it because I didn't expect to find any, considering that KDE is still based on Qt5.

HazelHex commented 1 year ago

Can you test under labwc?

Just tried under freshly compiled Labwc, DND does not work (only for tabs). I should note that official stable Qt in Gentoo is still v5.15.10, not 6.

I guess you should encounter similar issues with all Qt apps

Well, I've just tested under KeepassXC and spotify-qt and seems that you're right. Drag operations do not work there either. Can you advice what can be done about it, or if I should somehow debug this under the Qt's debug mode?

Tested under the Xwayland session: QT_QPA_PLATFORM=xcb pcmanfm-qt DND works, so when I left-click and drag a file to a folder, the pop-up menu appears asking me what I want to do with the file.

tsujan commented 1 year ago

This page contains two totally different reports, both of which are about problems outside pcmanfm-qt.

Can you advice what can be done about it

I think you'll have more luck if you search in pages about Labwc or report the problem there. Your problem isn't caused by Qt.

In contrast, the Qt6 problem is caused by a regression in Qt6 and can be seen under all Wayland compositors.

HazelHex commented 1 year ago

This page contains two totally different reports

Well, seems that my part of this issue is related to wlroots or my Gentoo/Qt setup. Thank you anyway!

tsujan commented 1 year ago

As for the the second report (about Qt6), it makes no difference which Qt6 app is running: A crash can be created by repeating drag-and-drop, and the backtrace is always the same, whether under a compositor like Wayfire, or from inside Weston running under an LXQt session:

#0  0x00007f8b079112a5 in QDrag::dragCursor(Qt::DropAction) const () at /usr/lib/libQt6Gui.so.6
#1  0x00007f8b079124dd in QBasicDrag::updateCursor(Qt::DropAction) () at /usr/lib/libQt6Gui.so.6
#2  0x00007f8b0339e914 in  () at /usr/lib/qt6/plugins/platforms/../../../libQt6WaylandClient.so.6
#3  0x00007f8b06f9134a in  () at /usr/lib/libQt6Core.so.6
#4  0x00007f8b033a045f in non-virtual thunk to QtWaylandClient::QWaylandDataSource::data_source_target(QString const&)
    () at /usr/lib/qt6/plugins/platforms/../../../libQt6WaylandClient.so.6
#5  0x00007f8b0338feb4 in QtWayland::wl_data_source::handle_target(void*, wl_data_source*, char const*) ()
    at /usr/lib/qt6/plugins/platforms/../../../libQt6WaylandClient.so.6
#6  0x00007f8b0688f4f6 in  () at /usr/lib/libffi.so.8
#7  0x00007f8b0688bf5e in  () at /usr/lib/libffi.so.8
#8  0x00007f8b0688eb73 in ffi_call () at /usr/lib/libffi.so.8
#9  0x00007f8b068a4645 in  () at /usr/lib/qt6/plugins/platforms/../../../libwayland-client.so.0
#10 0x00007f8b068a4e73 in  () at /usr/lib/qt6/plugins/platforms/../../../libwayland-client.so.0
#11 0x00007f8b068a513c in wl_display_dispatch_queue_pending ()
    at /usr/lib/qt6/plugins/platforms/../../../libwayland-client.so.0
#12 0x00007f8b0335e906 in  () at /usr/lib/qt6/plugins/platforms/../../../libQt6WaylandClient.so.6
#13 0x00007f8b06f91543 in  () at /usr/lib/libQt6Core.so.6
#14 0x00007f8b071327dc in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /usr/lib/libQt6Core.so.6
#15 0x00007f8b06f45623 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Core.so.6
#16 0x00007f8b06f3f1f8 in QCoreApplication::exec() () at /usr/lib/libQt6Core.so.6
#17 0x000055ebab59f729 in main ()
tsujan commented 1 year ago

The only related report I've found so far is https://bugs.kde.org/show_bug.cgi?id=473170. Its backreace is similar to the above one.

EDIT: Apparently, it'll be fixed in Qt 6.6, although their patch didn't re-enable DND in any Qt6 app in my tests; it just prevented the crash.

Chiitoo commented 1 year ago

Some of https://bugs.gentoo.org/910562 might be related too.

tsujan commented 1 year ago

Some of https://bugs.gentoo.org/910562 might be related too.

Thanks for the the link! The backtrace at https://bugs.gentoo.org/910562#c2 is the same as the above but against Qt5.. The interesting thing is that not only the Gentoo report is about Qt5, but also KDE devs talk about fixing it in Qt5 (in addition to Qt6). That's while I see the issue only with Qt6. So, I think there may be more than one cause.

EDIT: Or perhaps the fix for Qt5 is already in Arch, while the fix for Qt6 will come with Qt 6.6.

HazelHex commented 1 year ago

Just came by to say, that after Gentoo's Qt5 update 5.15.10-r1 (dev-qt/qtwayland-5.15.10-r4) the drag and drop functionality works in all my Qt5 apps, as it should, including PCManFM-Qt.

tsujan commented 1 year ago

That shows that the fix for Qt5 was already in Arch. But the issue exists in Qt 6.5.X (with all Qt6 apps, including the Qt6 branch of pcmanfm-qt).

EDIT: @HazelHex's last comment also shows that, contrary to what I thought at https://github.com/lxqt/pcmanfm-qt/issues/1800#issuecomment-1663353797, this page was about one problem, although in both Qt5 and Qt6.

tsujan commented 1 year ago

Qt6's DND problem under Wayland is fixed in qt6-base 6.5.3-1 from Arch, as tested by @stefonarch and me.