Skip to content

Commit bfcafa4

Browse files
committed
Remove keyCodeRequiresSystemDefinedEvent and use new keycodes.
1 parent 7a4d90c commit bfcafa4

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

src/keypress.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,6 @@
2929
#endif
3030

3131
#if defined(IS_MACOSX)
32-
bool keyCodeRequiresSystemDefinedEvent(MMKeyCode code) {
33-
return code == NX_KEYTYPE_SOUND_UP ||
34-
code == NX_KEYTYPE_SOUND_DOWN ||
35-
code == NX_KEYTYPE_MUTE ||
36-
code == NX_KEYTYPE_PLAY ||
37-
code == NX_KEYTYPE_BRIGHTNESS_UP ||
38-
code == NX_KEYTYPE_BRIGHTNESS_DOWN ||
39-
code == NX_KEYTYPE_PLAY ||
40-
code == NX_KEYTYPE_PREVIOUS ||
41-
code == NX_KEYTYPE_NEXT ||
42-
code == NX_KEYTYPE_ILLUMINATION_UP ||
43-
code == NX_KEYTYPE_ILLUMINATION_DOWN ||
44-
code == NX_KEYTYPE_ILLUMINATION_TOGGLE;
45-
}
4632
static io_connect_t _getAuxiliaryKeyDriver(void)
4733
{
4834
static mach_port_t sEventDrvrRef = 0;
@@ -123,7 +109,9 @@ void win32KeyEvent(int key, MMKeyFlags flags)
123109
void toggleKeyCode(MMKeyCode code, const bool down, MMKeyFlags flags)
124110
{
125111
#if defined(IS_MACOSX)
126-
if (keyCodeRequiresSystemDefinedEvent(code)) {
112+
/* The media keys all have 1000 added to them to help us detect them. */
113+
if (code >= 1000) {
114+
code = code - 1000; /* Get the real keycode. */
127115
NXEventData event;
128116
kern_return_t kr;
129117
IOGPoint loc = { 0, 0 };

0 commit comments

Comments
 (0)