• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Enable repeated Keyboard Event when key stays down
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: iTunes Scripting Bridge examples?
  • Next by Date: Problem adding an entity to a to-many relationship
  • Previous by thread: agc error for object ... Deallocating a non-block
  • Next by thread: Problem adding an entity to a to-many relationship
  • Index(es):
    • Date
    • Thread