On Dec 3, 2013, at 9:46 PM, Abhijit Apte wrote:

> I've a view which is conforming to NSTextInput protocol which has the
> -setMarkedText: and -insertText: methods implemented in the view.

You should be using the NSTextInputClient protocol in modern code.

> If I switch the keyboard focus from a view in another window and give this
> view the keyboard focus, upon -keyDown: with Japanese input method (say),
> if I call [[self inputContext] handleEvent:event], the callbacks
> -setMarkedText: and -insertText: are not getting called at all.
> However, if I switch the app and activate the app back, the IME input works
> and I receive the callback.
> 
> Can anyone suggest what could be happening here?
> The responder chain seems to be the same in both the scenarios.

Are you overriding -[NSView inputContext]?  Perhaps you did it accidentally, if 
you created an inputContext property?

Try invoking [NSTextInputContext currentInputContext] either arbitrarily or 
instead of [self inputContext].  As I recall, it is within +currentInputContext 
that Cocoa deactivates that old input context and activates the new one (if the 
first responder of the key window has changed).

Regards,
Ken


_______________________________________________

Cocoa-dev mailing list ([email protected])

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

This email sent to [email protected]

Reply via email to