windows: Port system move support

This commit is contained in:
Sergio Martins
2022-05-30 23:42:41 +01:00
parent 9881e0488f
commit f9df3c5872
5 changed files with 18 additions and 3 deletions

View File

@@ -11,6 +11,8 @@
#include "Window.h"
#include <QDebug>
using namespace KDDockWidgets;
Window::~Window() = default;
@@ -34,3 +36,9 @@ int Window::maxHeight() const
{
return maxSize().height();
}
void Window::startSystemMove()
{
qFatal("Not needed in this platform");
}

View File

@@ -92,6 +92,7 @@ public:
virtual QSize minSize() const = 0;
virtual QSize maxSize() const = 0;
virtual QPoint fromNativePixels(QPoint) const = 0;
virtual void startSystemMove();
int minWidth() const;
int minHeight() const;

View File

@@ -292,7 +292,7 @@ void StateDragging::onEntry()
const bool needsUndocking = !q->m_draggable->isWindow();
q->m_windowBeingDragged = q->m_draggable->makeWindow();
if (q->m_windowBeingDragged) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) && defined(Q_OS_WIN_TODO)
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) && defined(Q_OS_WIN)
if (!q->m_nonClientDrag && KDDockWidgets::usesNativeDraggingAndResizing()) {
// Started as a client move, as the dock widget was docked,
// but now that we're dragging it as a floating window, switch to native drag, so we can still get aero-snap
@@ -301,7 +301,7 @@ void StateDragging::onEntry()
q->m_windowBeingDragged.reset();
q->m_windowBeingDragged = fw->makeWindow();
QWindow *window = fw->window();
Window::Ptr window = fw->view()->window();
if (needsUndocking) {
// Position the window before the drag start, otherwise if you move mouse too fast there will be an offset
@@ -901,7 +901,7 @@ ViewWrapper::Ptr DragController::qtTopLevelUnderCursor() const
return nullptr;
}
}
#endif // Q_OS_WIN_TODO
#endif // Q_OS_WIN
} else if (linksToXLib() && isXCB()) {
bool ok = false;
const Window::List orderedWindows = KDDockWidgets::orderedWindows(ok);

View File

@@ -145,3 +145,8 @@ QPoint Window_qt::fromNativePixels(QPoint nativePos) const
{
return QHighDpi::fromNativePixels(nativePos, m_window.data());
}
void Window_qt::startSystemMove()
{
m_window->startSystemMove();
}

View File

@@ -50,6 +50,7 @@ public:
QSize minSize() const override;
QSize maxSize() const override;
QPoint fromNativePixels(QPoint) const override;
void startSystemMove() override;
protected:
QPointer<QWindow> m_window;