Force xcb platform on Wayland to fix tab drag indicators#1041
Conversation
Qt Advanced Docking System positions its drop-indicator overlays as top-level Qt::Tool windows using mapToGlobal() + move() to absolute global coordinates. Wayland does not let clients position top-level windows, so during a tab drag the indicators appear at wrong locations. ADS upstream has documented this limitation and recommends running through XWayland. Set QT_QPA_PLATFORM=xcb;wayland on Linux Wayland sessions so the app runs through XWayland where the positioning works correctly. The semicolon-separated form falls back to wayland on systems without xcb. Honor an explicit user-set QT_QPA_PLATFORM, and provide NOTEPADNEXT_FORCE_NATIVE_WAYLAND=1 as an opt-out.
|
So if I understand this correctly:
CC: @Twig6943 |
|
@aniro howd u get dark theme?. |
|
I didnt know of such issues it seemed to work good enough on my sysyem |
|
It is just something I stumbled upon and got an LLM to fix. Please treat it as a bug report with some details on the particular code that breaks. |
|
Is the Wayland issue purely visual? Or does it affect the user's ability to drag and drop? |
Will let you know when I get home |
|
It is not only visual. Snapping to the edges works (if you know where to point). Placing an editor tab inside another tab by spitting it - does not (using "crosshair" elements in the middle). |
|
Also, if you resize the window, things get completely broken. Here is the screen recording: |
Video_2026-05-09_02-44-33.mp4 |
Video_2026-05-09_02-48-01.mp4 |
|
Supporting Linux is becoming quite tedious. Multiple distribution mechanisms, windows managers, OS versions and any combination of these. Even when trying to isolate it to a common windows manager, things are not trivial. Ultimately as suggested in the ADS repository this is a Qt issue. For now, if someone uses Wayland, let them deal with Qt's support. If they do not like how it behaves, they can manually set I do appreciate the input and discussion. |


Summary
Qt Advanced Docking System positions its drop-indicator overlays (the cross of split-direction buttons and the highlighted preview rectangles) as top-level
Qt::Toolwindows usingmapToGlobal()+move()to absolute global coordinates. Wayland does not let clients position top-level windows, so during a tab drag the indicators appear at wrong locations across the screen, making the dock UX effectively unusable on Wayland.ADS upstream has documented this limitation and officially recommends running through XWayland. The newer ADS releases (4.5.0) still don't fix it.
This PR sets
QT_QPA_PLATFORM=xcb;waylandon Linux Wayland sessions inmain.cppbefore constructingQApplication, so the app runs through XWayland where the positioning works correctly. The semicolon-separated form is Qt 6 syntax for a fallback list: Qt tries xcb first and falls back to wayland on systems where the xcb plugin is unavailable, so it stays safe on minimal containers.The override only kicks in when:
QT_QPA_PLATFORMis not already set by the user (their explicit choice always wins), andNOTEPADNEXT_FORCE_NATIVE_WAYLANDis not set.The Wayland platform plugin is still bundled with the AppImage (added in #1022), so users who set
NOTEPADNEXT_FORCE_NATIVE_WAYLAND=1still get a working app, just with the original misaligned indicators during tab drags.Test plan
NOTEPADNEXT_FORCE_NATIVE_WAYLAND=1 ./NotepadNextreproduces the original misalignment, confirming the escape hatch works.QT_QPA_PLATFORM=wayland ./NotepadNexthonors the explicit user setting.XDG_SESSION_TYPE=wayland/WAYLAND_DISPLAY).#ifdef Q_OS_LINUX).