Skip to content

Fix window drag on Wayland#902

Open
TheCodeSharman wants to merge 1 commit into
DreamSourceLab:masterfrom
TheCodeSharman:fix-wayland-window-management
Open

Fix window drag on Wayland#902
TheCodeSharman wants to merge 1 commit into
DreamSourceLab:masterfrom
TheCodeSharman:fix-wayland-window-management

Conversation

@TheCodeSharman

@TheCodeSharman TheCodeSharman commented Apr 12, 2026

Copy link
Copy Markdown

Summary

Fixes the title bar drag issue that affects DSView when running on any Wayland desktop, both as a native Qt Wayland client and via XWayland.

  • Title bar drag broken on Wayland (native and XWayland): The custom title bar used QWidget::move() to reposition the window. Wayland compositors silently ignore client-driven position changes, and this restriction is enforced even through the XWayland translation layer — so the bug affects both Qt-native and Qt-xcb modes. Fixed by calling QWindow::startSystemMove() instead, which delegates the move to the system via xdg_toplevel.move (Wayland) or _NET_WM_MOVERESIZE (X11). A single code path now handles native Wayland, XWayland, and traditional X11 sessions.

A null check on windowHandle() guards the rare case where the window hasn't been realised yet.

Platform

  • OS: Linux — verified on COSMIC (Pop!_OS) and GNOME 50 (NixOS 26.05)
  • Display server: Wayland — both native Qt Wayland client and Qt xcb plugin via XWayland
  • Qt version: 6.4.2+

Changes do not affect Windows or macOS builds (guarded by #ifndef _WIN32). Traditional X11 sessions also pick up the fix correctly via _NET_WM_MOVERESIZE.

Files changed

  • DSView/pv/toolbars/titlebar.cpp — added #include <QWindow> and replaced the broken move()-based drag with QWindow::startSystemMove() in mousePressEvent

Test plan

  • Build with Qt 6 on Linux
  • Drag the DSView window by its title bar on native Qt Wayland (QT_QPA_PLATFORM=wayland) — works
  • Drag the DSView window by its title bar via XWayland (QT_QPA_PLATFORM=xcb in a Wayland session) — works
  • Verify resizing from window edges still works
  • Verify on a traditional X11 session (no Wayland compositor)
  • Verify no regression on Windows or macOS builds (changes guarded by #ifndef _WIN32)

🤖 Generated with Claude Code

@TheCodeSharman TheCodeSharman changed the title Fix window drag and taskbar icon on Wayland Fix window drag on Wayland Apr 12, 2026
@TheCodeSharman TheCodeSharman force-pushed the fix-wayland-window-management branch from 8b53f7e to c9aeded Compare April 12, 2026 10:15
The custom title bar called QWidget::move() to reposition the window.
This fails on both:
  - Native Wayland: clients cannot set their own window position;
    the compositor silently ignores move() requests.
  - XWayland: although XWayland accepts the X11 move call, the Wayland
    compositor underneath still ignores client-driven positioning, so
    the behaviour is identical to native Wayland.

Fixed by calling QWindow::startSystemMove() instead, which delegates
the move to the system. On Wayland it sends xdg_toplevel.move; on X11
it sends _NET_WM_MOVERESIZE — both honoured by all modern compositors
and window managers. A single code path now handles native Wayland,
XWayland, and traditional X11 sessions.

A null check on windowHandle() guards the rare case where the window
hasn't been realised yet.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@TheCodeSharman TheCodeSharman force-pushed the fix-wayland-window-management branch from c9aeded to 5664a8f Compare June 24, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant