fix(wayland): use system move (#6573)
Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -612,7 +612,8 @@ void BaseWindow::mousePressEvent(QMouseEvent *event)
|
||||
return recursiveCheckMouseTracking(widget->parentWidget());
|
||||
};
|
||||
|
||||
if (!recursiveCheckMouseTracking(widget))
|
||||
if (!recursiveCheckMouseTracking(widget) &&
|
||||
!this->windowHandle()->startSystemMove())
|
||||
{
|
||||
this->moving = true;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "buttons/SvgButton.hpp"
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QWindow>
|
||||
|
||||
#include <chrono>
|
||||
|
||||
@@ -10,31 +11,23 @@ namespace chatterino {
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr FlagsEnum<BaseWindow::Flags> POPUP_FLAGS{
|
||||
#ifdef Q_OS_LINUX
|
||||
FlagsEnum<BaseWindow::Flags> popupFlags{
|
||||
BaseWindow::Dialog,
|
||||
#endif
|
||||
BaseWindow::EnableCustomFrame,
|
||||
};
|
||||
FlagsEnum<BaseWindow::Flags> popupFlagsCloseAutomatically{
|
||||
BaseWindow::Dialog,
|
||||
BaseWindow::EnableCustomFrame,
|
||||
};
|
||||
#else
|
||||
FlagsEnum<BaseWindow::Flags> popupFlags{
|
||||
BaseWindow::EnableCustomFrame,
|
||||
};
|
||||
FlagsEnum<BaseWindow::Flags> popupFlagsCloseAutomatically{
|
||||
constexpr FlagsEnum<BaseWindow::Flags> POPUP_FLAGS_CLOSE_AUTOMATICALLY{
|
||||
BaseWindow::EnableCustomFrame,
|
||||
BaseWindow::Frameless,
|
||||
BaseWindow::FramelessDraggable,
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
DraggablePopup::DraggablePopup(bool closeAutomatically, QWidget *parent)
|
||||
: BaseWindow(
|
||||
(closeAutomatically ? popupFlagsCloseAutomatically : popupFlags) |
|
||||
(closeAutomatically ? POPUP_FLAGS_CLOSE_AUTOMATICALLY : POPUP_FLAGS) |
|
||||
BaseWindow::DisableLayoutSave |
|
||||
BaseWindow::ClearBuffersOnDpiChange,
|
||||
parent)
|
||||
@@ -72,7 +65,8 @@ DraggablePopup::DraggablePopup(bool closeAutomatically, QWidget *parent)
|
||||
|
||||
void DraggablePopup::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::MouseButton::LeftButton)
|
||||
if (event->button() == Qt::MouseButton::LeftButton &&
|
||||
!this->windowHandle()->startSystemMove())
|
||||
{
|
||||
this->dragTimer_.start(std::chrono::milliseconds(17));
|
||||
this->startPosDrag_ = event->pos();
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <QKeySequence>
|
||||
#include <QMessageBox>
|
||||
#include <QSizeGrip>
|
||||
#include <QWindow>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
# include <Windows.h>
|
||||
@@ -232,6 +233,10 @@ bool OverlayWindow::eventFilter(QObject * /*object*/, QEvent *event)
|
||||
switch (event->type())
|
||||
{
|
||||
case QEvent::MouseButtonPress: {
|
||||
if (this->windowHandle()->startSystemMove())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
auto *evt = dynamic_cast<QMouseEvent *>(event);
|
||||
this->moving_ = true;
|
||||
this->moveOrigin_ = evt->globalPosition().toPoint();
|
||||
|
||||
Reference in New Issue
Block a user