diff --git a/cmake b/cmake index 743c5a0e..2626fdcd 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 743c5a0ed048a964973d052798b46932ff0a32b1 +Subproject commit 2626fdcdd4f39e159f3afafc62f0e261152e954c diff --git a/include/FramelessHelper/Core/utils.h b/include/FramelessHelper/Core/utils.h index 2dc64fca..763e3996 100644 --- a/include/FramelessHelper/Core/utils.h +++ b/include/FramelessHelper/Core/utils.h @@ -145,6 +145,7 @@ FRAMELESSHELPER_CORE_API void bringWindowToFront(const WId windowId); [[nodiscard]] FRAMELESSHELPER_CORE_API QRect getWindowRestoreGeometry(const WId windowId); FRAMELESSHELPER_CORE_API void removeMicaWindow(const WId windowId); FRAMELESSHELPER_CORE_API void removeSysMenuHook(const WId windowId); +FRAMELESSHELPER_CORE_API quint64 queryMouseState(); #endif // Q_OS_WINDOWS #ifdef Q_OS_LINUX diff --git a/src/core/utils_win.cpp b/src/core/utils_win.cpp index c2607e96..0e2f5cfd 100644 --- a/src/core/utils_win.cpp +++ b/src/core/utils_win.cpp @@ -2464,4 +2464,31 @@ void Utils::removeSysMenuHook(const WId windowId) g_utilsHelper()->data.remove(windowId); } +quint64 Utils::queryMouseState() +{ + WPARAM result = 0; + if (GetKeyState(VK_LBUTTON) < 0) { + result |= MK_LBUTTON; + } + if (GetKeyState(VK_RBUTTON) < 0) { + result |= MK_RBUTTON; + } + if (GetKeyState(VK_SHIFT) < 0) { + result |= MK_SHIFT; + } + if (GetKeyState(VK_CONTROL) < 0) { + result |= MK_CONTROL; + } + if (GetKeyState(VK_MBUTTON) < 0) { + result |= MK_MBUTTON; + } + if (GetKeyState(VK_XBUTTON1) < 0) { + result |= MK_XBUTTON1; + } + if (GetKeyState(VK_XBUTTON2) < 0) { + result |= MK_XBUTTON2; + } + return result; +} + FRAMELESSHELPER_END_NAMESPACE