Handling composite keys

This is a cross between a howto and a feature request.

I just got a navKey (NavKey on tindie) and I dicovered that one could push at the same time the up/right, up/letft etc. keys by pushing midway between them. The navkey being driven by I2C, when I read it I get that two keys are pressed.

So here are a few questions:

  • how do I do to make lvgl understand that two (or more) keys are simultaneously pressed?
  • is there way to extend the set of special keys to include, say LV_KEY_UP_RIGHT?

I don’t see any way to do it in 6.1 or 7.0, but I see two potential ways of adding it for 7.1:

  • Change keycodes to work like a bitmask instead of a value. It would allow things like LV_KEY_UP | LV_KEY_RIGHT. This is the more flexible option, as it means any two keys can be combined.
  • Add special keys like you are suggesting. It’s less flexible because then you can’t combine things in the same manner.

It’d be a little bit tricky because there area some globals states which are related to currently being pressed key. For example pr_timestamp.