Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Enable repeated Keyboard Event when key stays down



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.