#3305 Made Mac clients aware of brightness keys

This commit is contained in:
Jerry (Xinyu Hou) 2016-06-16 15:31:00 +00:00
parent 8058ed06a1
commit 1f78fe6f6d
2 changed files with 22 additions and 12 deletions

View File

@ -19,15 +19,17 @@
int convertKeyIDToNXKeyType(KeyID id) int convertKeyIDToNXKeyType(KeyID id)
{ {
// hidsystem/ev_keymap.h // hidsystem/ev_keymap.h
// NX_KEYTYPE_SOUND_UP 0 // NX_KEYTYPE_SOUND_UP 0
// NX_KEYTYPE_SOUND_DOWN 1 // NX_KEYTYPE_SOUND_DOWN 1
// NX_KEYTYPE_MUTE 7 // NX_KEYTYPE_BRIGHTNESS_UP 2
// NX_KEYTYPE_EJECT 14 // NX_KEYTYPE_BRIGHTNESS_DOWN 3
// NX_KEYTYPE_PLAY 16 // NX_KEYTYPE_MUTE 7
// NX_KEYTYPE_NEXT 17 // NX_KEYTYPE_EJECT 14
// NX_KEYTYPE_PREVIOUS 18 // NX_KEYTYPE_PLAY 16
// NX_KEYTYPE_FAST 19 // NX_KEYTYPE_NEXT 17
// NX_KEYTYPE_REWIND 20 // NX_KEYTYPE_PREVIOUS 18
// NX_KEYTYPE_FAST 19
// NX_KEYTYPE_REWIND 20
int type = -1; int type = -1;
switch (id) { switch (id) {
@ -37,6 +39,12 @@ int convertKeyIDToNXKeyType(KeyID id)
case kKeyAudioDown: case kKeyAudioDown:
type = 1; type = 1;
break; break;
case kKeyBrightnessUp:
type = 2;
break;
case kKeyBrightnessDown:
type = 3;
break;
case kKeyAudioMute: case kKeyAudioMute:
type = 7; type = 7;
break; break;

View File

@ -573,10 +573,12 @@ KeyState::fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton serverID)
if (keyItem == NULL) { if (keyItem == NULL) {
// a media key won't be mapped on mac, so we need to fake it in a // a media key won't be mapped on mac, so we need to fake it in a
// special way // special way
if (id == kKeyAudioDown || id == kKeyAudioUp || id == kKeyAudioMute || if (id == kKeyAudioDown || id == kKeyAudioUp ||
id == kKeyAudioMute || id == kKeyAudioPlay ||
id == kKeyAudioPrev || id == kKeyAudioNext || id == kKeyAudioPrev || id == kKeyAudioNext ||
id == kKeyAudioPlay) { id == kKeyBrightnessDown || id == kKeyBrightnessUp
LOG((CLOG_DEBUG "emulating media key")); ) {
LOG((CLOG_DEBUG1 "emulating media key"));
fakeMediaKey(id); fakeMediaKey(id);
} }