Fix Windows Double Activation (#158)

Co-authored-by: Chris Rizzitello <crizzitello@ics.com>
main
crizzitello 2022-05-02 17:10:51 -04:00 committed by GitHub
parent fe898a97a3
commit bf21b4ad40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -56,7 +56,7 @@ bool UGlobalHotkeys::registerHotkey(const UKeySequence &keySeq, size_t id)
}
#endif
#if defined(Q_OS_WIN)
size_t winMod = 0;
size_t winMod = MOD_NOREPEAT;
size_t key = VK_F2;
for (size_t i = 0; i != keySeq.size(); i++) {
if (keySeq[i] == Qt::Key_Control) {
@ -72,7 +72,7 @@ bool UGlobalHotkeys::registerHotkey(const UKeySequence &keySeq, size_t id)
}
}
if (!RegisterHotKey((HWND)winId(), id, winMod + MOD_NOREPEAT, key)) {
if (!RegisterHotKey((HWND)winId(), id, winMod, key)) {
return false;
} else {
Registered.insert(id);
@ -164,8 +164,7 @@ void UGlobalHotkeys::onHotkeyPressed(size_t id)
#if defined(Q_OS_WIN)
bool UGlobalHotkeys::winEvent(MSG *message, RESULT_TYPE *result)
{
Q_UNUSED(result);
if (message->message == WM_HOTKEY) {
if (message->message == WM_HOTKEY && result == nullptr) {
size_t id = message->wParam;
Q_ASSERT(Registered.find(id) != Registered.end() && "Unregistered hotkey");
Q_EMIT activated(id);