~eliasnaur/gio#432: 
key.InputOp set cannot represent minus key

In my calculator application (https://github.com/fjl/gio-demos/tree/master/giocalc), I would like to handle the "minus" key. However, since the minus sign is used in the key.Set syntax, it cannot be matched by Set.Contains, and events for this key are not delivered.

I think the minus key could be supported with this syntax:

op := key.InputOp{
    Set: "(Shift)-(Alt)-[-]",
}
Status
REPORTED
Submitter
~fjl
Assigned to
No-one
Submitted
5 months ago
Updated
5 months ago
Labels
No labels applied.

~whereswaldon 5 months ago

Thanks for pointing this out! I think these functions need to be taught some kind of escaping syntax to allow that, or maybe we simply need to check whether the final character is "-" and handle that differently. ~eliasnaur, do you have a preference on the approach?

~fjl 5 months ago*

Alternative idea: use another data structure for key sets. I'm suggesting this also because there are a few other problems with the current key.Set system being based on a string syntax:

  • it's not intuitive to work with when the declared key set is dynamic
  • the code to match keys must parse the set syntax every time
  • it does not support declaring listeners for modifier-only events (AFAIK)

~fjl 5 months ago

I'm happy to work out something better, but it'll take a while.

~eliasnaur 5 months ago

Several Gio users have expressed their dislike over the data structure. I'm happy to accept proposals for a replacement, thanks!

Register here or Log in to comment, or comment via email.