From 0dfb39cfcb969426c3502748dd6b8137b6a7250b Mon Sep 17 00:00:00 2001 From: evgeny Date: Tue, 8 Sep 2026 02:47:59 +0300 Subject: [PATCH] =?UTF-8?q?chatgui:=20=D0=B3=D0=B8=D0=B1=D1=80=D0=B8=D0=B4?= =?UTF-8?q?=D0=BD=D1=8B=D0=B9=20resize=20=E2=80=94=20=D0=BD=D0=B0=D1=82?= =?UTF-8?q?=D0=B8=D0=B2=D0=BD=D1=8B=D0=B9=20=D0=BD=D0=B0=20Wayland=20(?= =?UTF-8?q?=D0=BA=D1=80=D0=B0=D0=B9=20=D1=82=D1=8F=D0=BD=D0=B5=D1=82=D1=81?= =?UTF-8?q?=D1=8F),=20=D1=80=D1=83=D1=87=D0=BD=D0=BE=D0=B9=20=D1=81=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=BF=D0=BE=D1=80=D1=86=D0=B8=D0=B5=D0=B9=20?= =?UTF-8?q?=D0=BD=D0=B0=20X11/Windows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/chatgui/src/videoplayer_window.cpp | 31 ++++++++++++++++++++++-- tools/chatgui/src/videoplayer_window.h | 1 + 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/tools/chatgui/src/videoplayer_window.cpp b/tools/chatgui/src/videoplayer_window.cpp index c28e33f3..4d89cefb 100644 --- a/tools/chatgui/src/videoplayer_window.cpp +++ b/tools/chatgui/src/videoplayer_window.cpp @@ -61,6 +61,10 @@ static QPoint mouseGlobalPos(const QMouseEvent* e) { #endif } +static bool isWaylandPlatform() { + return QGuiApplication::platformName() == QLatin1String("wayland"); +} + /* Слайдер перемотки: клик по любому месту шкалы = прыжок к позиции (нативно через стиль). */ class SeekSliderStyle : public QProxyStyle { public: @@ -309,7 +313,12 @@ void VideoPlayerWindow::mousePressEvent(QMouseEvent* e) { } ResizeMode m = hitTestResize(e->pos()); if (m != ResizeNone) { - beginResize(m, mouseGlobalPos(e)); + if (isWaylandPlatform()) { + /* Wayland: позицию окна задаёт композитор — только нативный resize тянет край */ + if (windowHandle()) windowHandle()->startSystemResize(edgesForMode(m)); + } else { + beginResize(m, mouseGlobalPos(e)); + } } else { if (windowHandle()) windowHandle()->startSystemMove(); } @@ -350,7 +359,11 @@ bool VideoPlayerWindow::eventFilter(QObject* obj, QEvent* ev) { QPoint gp = mouseGlobalPos(me); if (t == QEvent::MouseButtonPress && me->button() == Qt::LeftButton) { - beginResize(m, gp); + if (isWaylandPlatform()) { + if (windowHandle()) windowHandle()->startSystemResize(edgesForMode(m)); + } else { + beginResize(m, gp); + } return true; } if (t == QEvent::MouseMove && m_resizeMode != ResizeNone && (me->buttons() & Qt::LeftButton)) { @@ -410,6 +423,20 @@ void VideoPlayerWindow::updateResizeCursor(const QPoint& pos) { } } +Qt::Edges VideoPlayerWindow::edgesForMode(ResizeMode m) { + switch (m) { + case ResizeLeft: return Qt::LeftEdge; + case ResizeRight: return Qt::RightEdge; + case ResizeTop: return Qt::TopEdge; + case ResizeBottom: return Qt::BottomEdge; + case ResizeTopLeft: return Qt::TopEdge | Qt::LeftEdge; + case ResizeTopRight: return Qt::TopEdge | Qt::RightEdge; + case ResizeBottomLeft: return Qt::BottomEdge | Qt::LeftEdge; + case ResizeBottomRight: return Qt::BottomEdge | Qt::RightEdge; + default: return {}; + } +} + void VideoPlayerWindow::beginResize(ResizeMode m, const QPoint& globalPos) { m_resizeMode = m; m_resizeStartGeom = geometry(); diff --git a/tools/chatgui/src/videoplayer_window.h b/tools/chatgui/src/videoplayer_window.h index b2c05e5c..1edbf74e 100644 --- a/tools/chatgui/src/videoplayer_window.h +++ b/tools/chatgui/src/videoplayer_window.h @@ -77,6 +77,7 @@ private: void updateResizeCursor(const QPoint& localPos); void applyResize(const QPoint& globalPos); void beginResize(ResizeMode m, const QPoint& globalPos); + static Qt::Edges edgesForMode(ResizeMode m); VideoRenderWidget* m_render = nullptr; QWidget* m_controls = nullptr;