[xkbcommon] How to distinguish left-shift and right-shift
Wander Lairson Costa
wander.lairson at gmail.com
Thu Sep 26 04:49:24 PDT 2013
2013/9/25 Ran Benita <ran234 at gmail.com>:
> On Tue, Sep 24, 2013 at 08:02:30PM -0300, Wander Lairson Costa wrote:
>> Hi,
>>
>
> Hi,
>
>> I am working for some time porting Blender to wayland [1] and I am now
>> adding keyboard handing support. For that, I am following weston
>> clients code as reference and using libxkbcommon.
>>
>> To make a long history short, I need to differentiate left-shift and
>> right-shift modifiers, but I didn't figure out how to do that with
>> libxkbcommon. I printed all modifiers names and there is just one
>> "Shift" modifier, there aren't "LShift" and "RShift" like there are
>> for control and alt key modifiers.
>
> I'm afraid we have no way to do that. We currently only expose the 8 old
> X11 modifiers, which only have Shift. There are also what's called
> virtual modifiers, which I have some pending work to expose, but these
> *too* don't have separate RShift and LShift modifiers (as opposed to
> e.g. LControl and RControl) - that's in current xkeyboard-config, which
> is the project where all the keyboard data is maintained. And there was
> some sensible resistence to addings these, for example here:
> https://bugs.freedesktop.org/show_bug.cgi?id=50935#c18
>
> Of course, X11/XKB is in exactly the same boat here, so I from a quick
> look I found that what the blender X11 backend does (as far as I can
> see), is that it gets the key state with the XQueryKeymap(3) request,
> and then sees if the left/right *keys* are down. That's not entirely
> correct purely speaking, but I guess it works in 99.9999% percent of the
> cases. So I can only suggest you do the same for now for Wayland.
>
> But... xkbcommon doesn't (and prefereably won't) expose an equivalent of
> XQueryKeymap itself, and the Wayland protocol only provides it on the
> wl_keyboard enter event (with the 'keys' field). So unfortunatly what
> you have do is get/reset this array on wl_keyboard enter event, and
> keep it updated manually on the client side on key events. That should
> work... Unless someone has a better idea!
>
Initially I thought to handle this in the key event (maybe only for
shift key). I just don't which would be the best solution...
> Sorry!
> Ran
>
>>
>> [1] https://github.com/walac/blender-wayland
>>
>> --
>> Best Regards,
>> Wander Lairson Costa
>> _______________________________________________
>> wayland-devel mailing list
>> wayland-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
--
Best Regards,
Wander Lairson Costa
More information about the wayland-devel
mailing list