• 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
Sending keyboard events with unicode strings causes Pages/Keynote/Numbers to hang
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sending keyboard events with unicode strings causes Pages/Keynote/Numbers to hang


  • Subject: Sending keyboard events with unicode strings causes Pages/Keynote/Numbers to hang
  • From: Huy Phan <email@hidden>
  • Date: Sun, 12 Aug 2012 04:39:13 +0800

Hi all,

I'm having this weird issue after upgrading iWork on Mountain Lion.
I wrote a small app to monitor and modify user's keystrokes, it works fine with other applications except latest version of Pages. Every time I send keyboard events with unicode strings contain 2-byte unicode characters, Pages will hang.

My code to simulate keystrokes is just simple like this:

CGEventRef KeyHandler(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *refcon)
{

    ......

    CGEventRef keyEventDown = CGEventCreateKeyboardEvent( NULL, 1, true);
    CGEventRef keyEventUp = CGEventCreateKeyboardEvent(NULL, 1, false);

    CGEventKeyboardSetUnicodeString(keyEventDown, 1, unicodeString);
    CGEventKeyboardSetUnicodeString(keyEventUp, 1, unicodeString);

    CGEventTapPostEvent(proxy, keyEventDown);
    CGEventTapPostEvent(proxy, keyEventUp);

    CFRelease(keyEventDown);
    CFRelease(keyEventUp);

    ......

}

Pages doesn't hang if unicodeString contains only 1-byte unicode character.

I used gdb to debug Pages and noticed 2 infinite loops at that time, not sure if it's related to this issue.

0x91f7528c in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] () which waited for event with mask 0xffffffff 0x91f7528c in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] () which waited for event with mask 0x00000400


Does anybody know why this is happening ? Numbers and Keynote also have the same issue.

Thanks,
--
--huy
_______________________________________________

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

  • Follow-Ups:
    • Re: Sending keyboard events with unicode strings causes Pages/Keynote/Numbers to hang
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Core Graphics optimisation
  • Next by Date: Re: Core Graphics optimisation
  • Previous by thread: Re: Core Graphics optimisation
  • Next by thread: Re: Sending keyboard events with unicode strings causes Pages/Keynote/Numbers to hang
  • Index(es):
    • Date
    • Thread