Page 1 of 1

Broken '\': how to solve that?

Posted: Sat Feb 14, 2009 2:15 pm
by Kaks
After reading this topic I vaguely remember the issue cropping up time and again in the forum (that's how I got the advanced compass to work on my pc many moons ago).

But it doesn't feel right to fiddle with the standard key settings in the land of Oolite's birth!
I've done some looking around in the code, and I can get that key to work:

The problem
On windows ( not on mac or linux, they're fine! ) the code has no way to tell which keyboard is being used, and assumes everybody is using a US keyboard, where the \ key is in the same place as # on a prop..british keyboard.

The solution
We could either agree with these guys, or add some support for the unlucky non-US windows users amongst us... I'm quite happy to go with the second option myself, but I've got no idea how good a job I need to do: would it be ok to just switch between UK/US keyboards or do we need more options than that?

If we need more options, I need information: how many of you windows people needed to change key_next_compass_mode
inside keyconfig.plist? Or change the standard key configuration because one or more keys were 'broken' on your PC? And what's your keyboard layout like?

Re: Broken '\': how to solve that?

Posted: Sat Feb 14, 2009 2:43 pm
by Gimi
Kaks wrote:
After reading this topic I vaguely remember the issue cropping up time and again in the forum (that's how I got the advanced compass to work on my pc many moons ago).

But it doesn't feel right to fiddle with the standard key settings in the land of Oolite's birth!
I've done some looking around in the code, and I can get that key to work:

The problem
On windows ( not on mac or linux, they're fine! ) the code has no way to tell which keyboard is being used, and assumes everybody is using a US keyboard, where the \ key is in the same place as # on a prop..british keyboard.

The solution
We could either agree with these guys, or add some support for the unlucky non-US windows users amongst us... I'm quite happy to go with the second option myself, but I've got no idea how good a job I need to do: would it be ok to just switch between UK/US keyboards or do we need more options than that?

If we need more options, I need information: how many of you windows people needed to change key_next_compass_mode
inside keyconfig.plist? Or change the standard key configuration because one or more keys were 'broken' on your PC? And what's your keyboard layout like?
I would really love a solution for this. I use a Norwegian keyboard, and although I have had no problems so far, as more keys are put to use, it is a good idea to make the game more future proof.

Posted: Sat Feb 14, 2009 8:23 pm
by JensAyton
There really should be a way to deal with key mappings in the game… but I’m reluctant to even try without first writing a better system to deal with UI in general. (I have it all mapped out in my head, but, well, feature list creep.)

Incidentally, I also consider this a prerequisite for reintroducing the JavaScript key callback mechanism from dajt’s original JS branch. Hard-coding key mappings in scripts is simply not acceptable.

Posted: Sat Feb 14, 2009 9:34 pm
by Kaks
I wasn't thinking as far ahead as that, more along the lines of a smaller "let's cope with m$" thing.

I've had a look around and found out that a stable version of SDL 1.3 ( a library used by Oolite I/O ) should just be round the corner, and it looks promising! It's got internationalisation support, so it can pick up both scancodes & keymapped characters.
What I was thinking of was to dynamically generate a scancode/character lookup table & then only deal with scancodes... Ok, this is getting technical...

The minimal change I've done so far limits itself to noticing if the scancode for the UK backslash is pressed and uses it as an extra backslash key. Safe enough to use since that key is not present on US keyboards, and a few other countries (Brazil & Belgium too) use it too.

I'll polish up my work-in-progress patch, and even if the new version of SDL isn't ready at the time, we could still have the right backslash key for Windows' UK keyboards for 1.73.
'Course, to do more than that now would be overkill... :)