Enable repeated Keyboard Event when key stays down
Enable repeated Keyboard Event when key stays down
- Subject: Enable repeated Keyboard Event when key stays down
- From: Simon Vanesse <email@hidden>
- Date: Tue, 30 Dec 2008 13:11:13 +0100
Hello,
I am currently improving the Wiiji source code (Wiiji is a open source
software that allows the use of a wiimote as a Joystick + keyboard
input on a mac).
I have checked everywhere in the forums / google and haven't found a
solution to have the keyboard repeat a keystroke when a key on the
wiimote stays down.
Here is the code executed when a keystroke up/down event is received.
Currently the key is not repeated but just outputted once :
// hid_key : key's number
// isPressed : True when key is down, false otherwise
static CGKeyCode hid_key;
static CGEventRef event = NULL;
CFRelease(CGEventCreate(NULL)); // Tiger's bug. see: http://www.cocoabuilder.com/archive/message/cocoa/2006/10/4/172206
event = CGEventCreateKeyboardEvent(NULL, hid_key, isPressed);
if(isPressed) {
CGEventSetType(event,kCGEventKeyDown); // Don't know if this is
necessary, the api tells it is a prerequisite before calling
CGEventSetIntegerValueField
CGEventSetIntegerValueField(event, kCGKeyboardEventAutorepeat,
(int64_t)1); // This should allow autorepeat, but doesn't work right now
}
CGEventPost(kCGHIDEventTap, event);
CFRelease(event);
Does anyone got this fixed before ?
Thanks for your answers,
Best,
Simon
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden