Re: Receiving unicode keyboard input
Re: Receiving unicode keyboard input
- Subject: Re: Receiving unicode keyboard input
- From: Aki Inoue <email@hidden>
- Date: Wed, 27 Jul 2011 12:27:57 -0700
Bill,
> Thanks for responding. The problem is that Safari or webkit does not implement this new spec correctly, i have filed a webkit bug and included a copy below.
OK. I cannot comment on the behavior since I'm not WebKit :-).
> I could try to do something clever to dance around this, but then if they change it i would have a deployed problem in the field.
I can recommend to try this approach, though.
> I was wondering if it is possible to create text events out of the NPAPI reported keydowns and then call interpretKeyEvents to receive the unicode string in a hidden window
The Unicode input process is a complex beast involving user interactions. So, you just cannot achieve it without showing UI.
Safari shows the auxiliary window for managing inputs when serving plugins.
In order to bypass the WebKit functionality, you need to have an NSView implementing NSTextInputClient protocol that works with NSTextInputContext.
> But in our stand-alone product (forget NPAPI for a second) we can't get interpretKeyEvents to deliver unicode, it just delivers the same string as keydown.
Yes, as mentioned above, you need to work with NSTextInputContext by conforming to NSTextInputClient.
Aki
On 2011/07/27, at 9:35, Bill Appleton wrote:
> Hi Aki,
>
> Thanks for responding. The problem is that Safari or webkit does not implement this new spec correctly, i have filed a webkit bug and included a copy below.
>
> I could try to do something clever to dance around this, but then if they change it i would have a deployed problem in the field.
>
> I was wondering if it is possible to create text events out of the NPAPI reported keydowns and then call interpretKeyEvents to receive the unicode string in a hidden window
>
> (in other words sidestep the browser dependent implementation of this)
>
> But in our stand-alone product (forget NPAPI for a second) we can't get interpretKeyEvents to deliver unicode, it just delivers the same string as keydown.
>
> It's supposed to deliver unicode, for like an option-e, e keypress, right? Or do we need to do more that use interpretKeyEvents to get unicode translations?
>
>
> Thanks in advance,
>
> Bill
>
>
>
>
>
>
>
>
> SAFARI BUG REPORT
>
> On Safari, typing the "g" key will generate a (1) key down event and then (2) a key up event with no call to NPCocoaEventTextInput
>
> --> this is wrong because i used the kNPEventStartIME flag, see FireFox behavior below
>
> On Safari, typing "option-e" and then "e" will generate (1) key up event and then (2) a NPCocoaEventTextInput event with "accented e", and then (3) a key up event
>
> --> this is wrong because there is a strange key up event sent at first, see FireFox behavior below
>
> Based on my understanding of the spec Safari or webkit is implementing this incorrectly
>
> https://wiki.mozilla.org/NPAPI:CocoaEventModel
>
> On FireFox, typing the "g" key will generate a (1) key down event and then (2) a NPCocoaEventTextInput with "g" and then NO key up event
> On FireFox, typing "option-e" and then "e" will generate (1) key down event, (2) a NPCocoaEventTextInput event with "accented e" and then NO key up event
>
>
>
>
>
>
>
>
>
>
>
>
>
> On Tue, Jul 26, 2011 at 4:12 PM, Aki Inoue <email@hidden> wrote:
> Bill,
>
> You cannot directly access the Cocoa text handling method inside the NPAPI plugins.
>
> Instead the NPAPI's Cocoa extension defines the composition handling logic by itself.
>
> Refer to the 'Text Input' section in this document <https://wiki.mozilla.org/NPAPI:CocoaEventModel>.
>
> Aki
>
> On 2011/07/23, at 8:59, Bill Appleton wrote:
>
> > Hi All,
> >
> > For an NPAPI plugin we need to receive Unicode keyboard input. We are
> > calling interpretKeyEvents and receiving the insertText message, but if I
> > type option-e (for example) we are not getting the accented-e character.
> >
> > Can anyone shed some light on the right way to get unicode characters?
> > Unfortunately we cannot use all the core Text stuff because (as mentioned)
> > this is an NPAPI plugin and we don't even have access to the output view or
> > window.
> >
> >
> > Best,
> >
> > Bill Appleton
> > _______________________________________________
> >
> > 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
>
>
_______________________________________________
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