From 5664a8f4ecdce15349fd9f34bea788c7ac4d43f7 Mon Sep 17 00:00:00 2001 From: Michael Sharman Date: Sun, 12 Apr 2026 20:15:31 +1000 Subject: [PATCH] Fix window drag on Wayland and XWayland MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- DSView/pv/toolbars/titlebar.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/DSView/pv/toolbars/titlebar.cpp b/DSView/pv/toolbars/titlebar.cpp index 79ef01b5..18166e78 100644 --- a/DSView/pv/toolbars/titlebar.cpp +++ b/DSView/pv/toolbars/titlebar.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include "../config/appconfig.h" #include "../appcontrol.h" @@ -225,22 +226,29 @@ void TitleBar::mousePressEvent(QMouseEvent* event) bool bClick = (x >= 6 && y >= 5 && x <= width() - 6); //top window need resize hit check if (!bTopWidow || bClick ){ - _is_draging = true; +#ifndef _WIN32 + if (window()->windowHandle()) { + window()->windowHandle()->startSystemMove(); + event->accept(); + return; + } +#endif + _is_draging = true; - _clickPos = event->globalPos(); + _clickPos = event->globalPos(); if (_titleParent != NULL){ _oldPos = _titleParent->GetParentPos(); } else{ - _oldPos = _parent->pos(); + _oldPos = _parent->pos(); } _is_done_moved = false; - + event->accept(); return; - } + } } QWidget::mousePressEvent(event); }