Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
wangwenx190 committed Jul 17, 2023
1 parent c1234ed commit 2cd4d13
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmake
Submodule cmake updated 1 files
+15 −5 utils.cmake
1 change: 1 addition & 0 deletions include/FramelessHelper/Core/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions src/core/utils_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 2cd4d13

Please sign in to comment.