Skip to content

Commit

Permalink
sync: from linuxdeepin/qt5platform-plugins
Browse files Browse the repository at this point in the history
Synchronize source files from linuxdeepin/qt5platform-plugins.

Source-pull-request: linuxdeepin/qt5platform-plugins#252
  • Loading branch information
deepin-ci-robot committed Aug 12, 2024
1 parent 3dcbbe4 commit 41c3c83
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions xcb/dnotitlebarwindowhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ DPP_BEGIN_NAMESPACE

QHash<const QWindow*, DNoTitlebarWindowHelper*> DNoTitlebarWindowHelper::mapped;

static QHash<DNoTitlebarWindowHelper*, QPointF> g_pressPoint;

DNoTitlebarWindowHelper::DNoTitlebarWindowHelper(QWindow *window, quint32 windowID)
: QObject(window)
, m_window(window)
Expand Down Expand Up @@ -75,6 +77,8 @@ DNoTitlebarWindowHelper::DNoTitlebarWindowHelper(QWindow *window, quint32 window

DNoTitlebarWindowHelper::~DNoTitlebarWindowHelper()
{
g_pressPoint.remove(this);

if (VtableHook::hasVtable(m_window)) {
VtableHook::resetVtable(m_window);
}
Expand Down Expand Up @@ -505,6 +509,7 @@ bool DNoTitlebarWindowHelper::windowEvent(QEvent *event)
// keeping the moving state, we can just reset ti back to normal.
if (event->type() == QEvent::MouseButtonPress) {
self->m_windowMoving = false;
g_pressPoint[this] = dynamic_cast<QMouseEvent*>(event)->globalPos();
}

if (is_mouse_move && !event->isAccepted()) {
Expand All @@ -514,6 +519,11 @@ bool DNoTitlebarWindowHelper::windowEvent(QEvent *event)
return ret;
}

QPointF delta = me->globalPos() - g_pressPoint[this];
if (delta.manhattanLength() < QGuiApplication::styleHints()->startDragDistance()) {
return ret;
}

if (!self->m_windowMoving && self->isEnableSystemMove(winId)) {
self->m_windowMoving = true;

Expand Down

0 comments on commit 41c3c83

Please sign in to comment.