Input Methods
Jan Arne Petersen
jpetersen at openismus.com
Tue Jul 10 06:24:07 PDT 2012
Hi,
On 07/09/2012 06:32 PM, Philipp wrote:
> I have been thinking about trying to implement a simple composing
> input method (like for example pinyin). I read
> http://blog.jpetersen.org/2012/06/20/text-input-method-support-in-wayland/
> and https://wiki.maliit.org/Wayland_Input_Method_System_Proposal but I
> didn't manage to understand how composing input methods are supposed
> to work, specifically there is no mention about how keyboard input is
> going to be handled. I'm not sure if I overlooked something, or if
> this part is not specified yet.
The handling of keyboard input is not described in the above linked
proposal yet. I would like to fix that issue in future iterations of my
input method for Wayland work.
> I thought about the problem a bit and in my opinion the cleanest
> solution would be the following: An input method can request direct
> keyboard input; if it does so, then the keyboard input that would flow
> to the application in focus is instead redirected to the input method,
> otherwise the keyboard input is sent to the application as normal.
> Does this sound reasonable?
Yes, that is also my idea. Having requests in the input_method interface
to get key events from the compositor to the input method.
> Now I'm trying to hack in redirection of keyboard input to the active
> input method iff there is an input method that requested keyboard
> input and there is an active text model. I think I identified the
> points where I would have to do that (e.g. in text_model_activate
> etc.).
An active text_model would be assigned to a wl_seat (which is a keyboard
focus). One needs to take the keyboard focus and surface assigned to the
text_model into account to deactivate the text_model when the surface
looses focus, for example when the surface is unmapped. See
wl_keyboard_set_focus calls where focus could get lost.
> My question is: how do redirect the keyboard input? I'm a bit
> lost in a huge tangle of pointers and messages and requests, it would
> be great if I could get a pointer or two (hur hur) to get started in
> the right direction.
The easiest would be to assign a wl_keyboard_grab to the wl_keyboard
belonging to that wl_seat, than one gets the key events and modifiers.
Additionally one would be interested in the keymap.
Regards
Jan Arne Petersen
More information about the wayland-devel
mailing list