Skip to content

Force xcb platform on Wayland to fix tab drag indicators#1041

Open
aniro wants to merge 1 commit intodail8859:masterfrom
aniro:wayland-xcb-fallback
Open

Force xcb platform on Wayland to fix tab drag indicators#1041
aniro wants to merge 1 commit intodail8859:masterfrom
aniro:wayland-xcb-fallback

Conversation

@aniro
Copy link
Copy Markdown

@aniro aniro commented May 5, 2026

Disclosure: This pull request was authored by an LLM (Claude Opus 4.7) under my direction. I have built it locally, reproduced the bug before the change, verified the fix on my Wayland session, and confirmed both escape hatches behave as documented. Maintainer review is welcome and expected; please push back on anything that doesn't match the project's conventions.

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::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 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;wayland on Linux Wayland sessions in main.cpp before constructing QApplication, 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_PLATFORM is not already set by the user (their explicit choice always wins), and
  • The opt-out NOTEPADNEXT_FORCE_NATIVE_WAYLAND is not set.

The Wayland platform plugin is still bundled with the AppImage (added in #1022), so users who set NOTEPADNEXT_FORCE_NATIVE_WAYLAND=1 still get a working app, just with the original misaligned indicators during tab drags.

Test plan

  • Reproduced the misalignment on Wayland (GNOME) before the change: drop indicators rendered far outside the dock area during tab drag.
  • Built and ran with the change on the same Wayland session: drop indicators now align correctly with the dock area, and split-on-drop works as on X11.
  • Verified NOTEPADNEXT_FORCE_NATIVE_WAYLAND=1 ./NotepadNext reproduces the original misalignment, confirming the escape hatch works.
  • Verified QT_QPA_PLATFORM=wayland ./NotepadNext honors the explicit user setting.
  • X11 sessions: no behavioral change expected (the block is gated on XDG_SESSION_TYPE=wayland / WAYLAND_DISPLAY).
  • Non-Linux platforms: no behavioral change (entire block is #ifdef Q_OS_LINUX).

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.
@aniro
Copy link
Copy Markdown
Author

aniro commented May 5, 2026

before:
Screenshot From 2026-05-05 02-27-09
after:
Screenshot From 2026-05-05 04-05-00

@dail8859
Copy link
Copy Markdown
Owner

dail8859 commented May 5, 2026

So if I understand this correctly:

CC: @Twig6943

@dail8859 dail8859 added the linux Related specifically to Linux-based OSs label May 5, 2026
@Twig6943
Copy link
Copy Markdown
Contributor

Twig6943 commented May 5, 2026

@aniro howd u get dark theme?.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linux Related specifically to Linux-based OSs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants