Nidium icon indicating copy to clipboard operation
Nidium copied to clipboard

Fix issue 89

Open cookiengineer opened this issue 7 years ago • 0 comments

Because it was impossible to follow what was going on, this pull-request contains a re-layout of the inlined matrix in chunks of 32 (8x4), so that later indexes that need to be replaced can be easily counted through.

The below code already fixes:

  • [x] insert key fires 45
  • [x] delete key fires 46
  • [x] F1-F12 fire 112 to 123
  • [x] 9 fires 57
  • [x] , fires 188
  • [x] - fires 189
  • [x] . fires 190
  • [x] ... fires 192 (key described is the one left of 1, shitty github markdown, yo)
  • [x] [ fires 219
  • [x] \ fires 220
  • [x] ] fires 221
  • [x] ' fires 222

The current way of translating keys between ranges isn't failsafe. Currently these keycodes cannot be fixed:

  • [ ] ; fires 186, position is array index 58
  • [ ] = fires 187, position is array index 60
  • [ ] / fires 191, position is array index 46

The reason why this currently cannot be fixed is that the code in the UIInterface assumes that keycodes that are lower than 127 are always a 1:1 mapping; which isn't the case for these three keys.

Actually these three keys are the only cases where this doesn't apply, as the rest of the keyboard (speaking of 105/106 keys) works perfectly, including all special keys except Fn on laptops, but that's okay.

I guess in order to complete this, I need to talk with @paraboul on how to solve this properly. Either use the complete matrix in every case (so add all keycodes below 127 in it, too); or make some if/else comparisons inside UIInterface regarding SDL special characters, because the translation bitshift is wrong in above three cases - so they need to be done before the matrix lookup.

cookiengineer avatar Jan 30 '18 07:01 cookiengineer