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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to