~fjl


#432 key.InputOp set cannot represent minus key 5 months ago

Comment by ~fjl on ~eliasnaur/gio

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

#432 key.InputOp set cannot represent minus key 5 months ago

Comment by ~fjl on ~eliasnaur/gio

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)

#432 key.InputOp set cannot represent minus key 5 months ago

Ticket created by ~fjl on ~eliasnaur/gio

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)-[-]",
}