try to cover right-mod keys under MacOS I guess

This commit is contained in:
Arisotura 2021-04-25 11:34:56 +02:00
parent 9d9865d256
commit 185c97f4ef
1 changed files with 6 additions and 1 deletions

View File

@ -226,7 +226,6 @@ bool HotkeyPressed(int id) { return HotkeyPress & (1<<id); }
bool HotkeyReleased(int id) { return HotkeyRelease & (1<<id); }
// TODO: MacOS version of this!
// distinguish between left and right modifier keys (Ctrl, Alt, Shift)
// Qt provides no real cross-platform way to do this, so here we go
// for Windows and Linux we can distinguish via scancodes (but both
@ -237,6 +236,12 @@ bool IsRightModKey(QKeyEvent* event)
quint32 scan = event->nativeScanCode();
return (scan == 0x11D || scan == 0x138 || scan == 0x36);
}
#elifdef __APPLE__
bool IsRightModKey(QKeyEvent* event)
{
quint32 scan = event->nativeVirtualKey();
return (scan == 0x37 || scan == 0x3A || scan == 0x3C || scan == 0x3E);
}
#else
bool IsRightModKey(QKeyEvent* event)
{