From c9aeded7d621264c82b7646ed34c04697812e2cd 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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Wayland with Qt 6+, DSView runs as a native Wayland client rather than through XWayland. The custom title bar called move() directly to reposition the window, but Wayland compositors ignore move() calls from clients — window position is managed exclusively by the compositor. Fixed by detecting Wayland at runtime and calling QWindow::startSystemMove() instead, which sends the appropriate compositor request. 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..39c19e23 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 (QGuiApplication::platformName() == "wayland") { + 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); }