fix multiple issues found by user

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2022-10-02 20:17:52 +08:00
parent ac9a05209e
commit c0ce7b0f48
2 changed files with 12 additions and 5 deletions

View File

@ -56,15 +56,14 @@ win32 {
$$CORE_SRC_DIR/utils_win.cpp \ $$CORE_SRC_DIR/utils_win.cpp \
$$CORE_SRC_DIR/registrykey.cpp \ $$CORE_SRC_DIR/registrykey.cpp \
$$CORE_SRC_DIR/winverhelper.cpp $$CORE_SRC_DIR/winverhelper.cpp
LIBS += -luser32 -lgdi32 LIBS += -luser32 -lgdi32 -lshell32
} }
unix:!macx { unix:!macx {
CONFIG += link_pkgconfig CONFIG += link_pkgconfig
PKGCONFIG += gtk+-3.0 PKGCONFIG += gtk+-3.0 xcb
DEFINES += GDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_6 DEFINES += GDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_6
SOURCES += $$CORE_SRC_DIR/utils_linux.cpp SOURCES += $$CORE_SRC_DIR/utils_linux.cpp
#LIBS += -lxcb # TODO
} }
macx { macx {

View File

@ -38,6 +38,7 @@
#include <QtGui/qwindow.h> #include <QtGui/qwindow.h>
#include <QtGui/qpalette.h> #include <QtGui/qpalette.h>
#include <QtWidgets/qwidget.h> #include <QtWidgets/qwidget.h>
#include <QtWidgets/qapplication.h>
#include <framelessmanager.h> #include <framelessmanager.h>
#include <framelessconfig_p.h> #include <framelessconfig_p.h>
#include <utils.h> #include <utils.h>
@ -552,7 +553,7 @@ bool FramelessWidgetsHelperPrivate::isInSystemButtons(const QPoint &pos, SystemB
return false; return false;
} }
bool FramelessWidgetsHelperPrivate::isInTitleBarDraggableArea(const QPoint &pos) const bool FramelessWidgetsHelperPrivate::isInTitleBarDraggableArea(const QPoint &localPos) const
{ {
const WidgetsHelperData data = getWindowData(); const WidgetsHelperData data = getWindowData();
if (!data.titleBarWidget) { if (!data.titleBarWidget) {
@ -597,7 +598,14 @@ bool FramelessWidgetsHelperPrivate::isInTitleBarDraggableArea(const QPoint &pos)
} }
} }
} }
return region.contains(pos); if (!region.contains(localPos)) {
return false;
}
const QPoint globalPos = m_window->mapToGlobal(localPos);
// Don't move the window if the user is dragging something above the title bar widget,
// according to the Qt documentation, QApplication::widgetAt() can be slow, but we really
// can't avoid calling it here.
return (QApplication::widgetAt(globalPos) == data.titleBarWidget);
} }
bool FramelessWidgetsHelperPrivate::shouldIgnoreMouseEvents(const QPoint &pos) const bool FramelessWidgetsHelperPrivate::shouldIgnoreMouseEvents(const QPoint &pos) const