diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e181ffd1..fa7f1627 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -162,9 +162,9 @@ if(CMAKE_COMPILER_IS_GNUCXX OR IS_CLANG_BUILD) endif() if(OPTION_QTQUICK) - target_link_libraries(kddockwidgets PUBLIC Qt5::Widgets Qt5::Quick Qt5::QuickControls2 kddockwidgets_multisplitter) + target_link_libraries(kddockwidgets PUBLIC Qt5::Widgets Qt5::Quick Qt5::QuickControls2 kddockwidgets_multisplitter PRIVATE Qt5::GuiPrivate) else() - target_link_libraries(kddockwidgets PUBLIC Qt5::Widgets kddockwidgets_multisplitter) + target_link_libraries(kddockwidgets PUBLIC Qt5::Widgets kddockwidgets_multisplitter PRIVATE Qt5::GuiPrivate) endif() if(NOT WIN32 AND NOT APPLE) diff --git a/src/private/WidgetResizeHandler.cpp b/src/private/WidgetResizeHandler.cpp index ede8803a..73d6739f 100644 --- a/src/private/WidgetResizeHandler.cpp +++ b/src/private/WidgetResizeHandler.cpp @@ -26,6 +26,7 @@ #include #if defined(Q_OS_WIN) +# include # include # include # if defined(Q_CC_MSVC) @@ -247,9 +248,11 @@ bool WidgetResizeHandler::handleWindowsNativeEvent(FloatingWindow *w, const QByt } else if (!hasFixedWidth && xPos <= rect.right && xPos >= rect.right - borderWidth) { *result = HTRIGHT; } else { - const QRect htCaptionRect = w->dragRect(); // The rect on which we allow for Windows to do a native drag - if (yPos >= htCaptionRect.top() && yPos <= htCaptionRect.bottom() && xPos >= htCaptionRect.left() && xPos <= htCaptionRect.right()) { - QWidget *hoveredWidget = qApp->widgetAt(QPoint(xPos, yPos)); + const QPoint globalPosQt = QHighDpi::fromNativePixels(QPoint(xPos, yPos), w->windowHandle()); + + const QRect htCaptionRect = w->dragRect(); // The rect on which we allow for Windows to do Ba native drag + if (globalPosQt.y() >= htCaptionRect.top() && globalPosQt.y() <= htCaptionRect.bottom() && globalPosQt.x() >= htCaptionRect.left() && globalPosQt.x() <= htCaptionRect.right()) { + QWidget *hoveredWidget = qApp->widgetAt(globalPosQt); if (!qobject_cast(hoveredWidget)) { // User clicked on the title bar, let's allow it, so we get Aero-Snap. *result = HTCAPTION;