Input Methods

Philipp Brüschweiler blei42 at gmail.com
Tue Jul 10 06:49:16 PDT 2012


Hi Jan,

Thanks for your answer. I have finally managed to get something going,
using a wl_keyboard_grab. This seems to work, but has the problem that
it completely grabs the text_model until the text_model gets
deactivated. I have looked at wl_keyboard_set_focus a bit, and it
seems to me that for further work, the input method system would have
to be integrated into wayland so as to make sure that the focused
surface doesn't loose focus but the key events still get redirected to
the input method. Does this sound correct or am I missing something?

Cheers
Philipp

On Tue, Jul 10, 2012 at 3:24 PM, Jan Arne Petersen
<jpetersen at openismus.com> wrote:
> 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
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list