Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions OSXvnc-server/VNCServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
// This flag will try to change the modifier key state to the required set for the unicode key that came in
BOOL pressModsForKeys;
CGEventSourceRef vncSourceRef;
CGEventSourceRef specialKeysVncSourceRef;
CGEventTapLocation vncTapLocation;

TISInputSourceRef unicodeInputSource;
Expand Down
9 changes: 8 additions & 1 deletion OSXvnc-server/VNCServer.m
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ - (void) rfbRunning {
// Doesn't combine with any other sources
NSLog(@"Using Private Event Source");
vncSourceRef = CGEventSourceCreate(kCGEventSourceStatePrivate);
specialKeysVncSourceRef = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
break;
case 1:
// Combines only with other User Session Events
Expand Down Expand Up @@ -761,7 +762,13 @@ - (void) sendKeyEvent: (CGKeyCode) keyCode down: (BOOL) down modifiers: (CGEvent
CFRelease(event);
}
else {
CGEventRef event = CGEventCreateKeyboardEvent(vncSourceRef, keyCode, down);
CGEventRef event;
int specialKeysStartingFrom = 96;
if (specialKeysVncSourceRef != NULL && keyCode >= specialKeysStartingFrom){
event = CGEventCreateKeyboardEvent(specialKeysVncSourceRef, keyCode, down);
}else {
event = CGEventCreateKeyboardEvent(vncSourceRef, keyCode, down);
}

// The value of this function escapes me (since you still need to specify the keyCode for it to work
// CGEventKeyboardSetUnicodeString (event, 1, (const UniChar *) &keySym);
Expand Down