Author Topic: Broken keyboard handling  (Read 26244 times)

Stof

  • Posts: 1343
  • Turrets: +1/-1
Broken keyboard handling
« on: June 09, 2006, 08:53:24 pm »
This is the feedback forum isn't it ? Well then, the keyboard doesn't work correctly when using a french layout on Linux :) This isn't new since I have yet to see a commercial game or ex-commercial game with non broken non-us keyboard support. Some knows what should be done to fix that ? I'm ready to tackle the problem if needed.
urphy's rules of combat
8 ) Teamwork is essential; it gives the enemy someone else to shoot at.
18 ) Make it too tough for the enemy to get in and you can't get out.

Lava Croft

  • Guest
Broken keyboard handling
« Reply #1 on: June 09, 2006, 11:48:56 pm »
Get a proper keyboard~  :roll:

Stof

  • Posts: 1343
  • Turrets: +1/-1
Broken keyboard handling
« Reply #2 on: June 09, 2006, 11:51:54 pm »
At least I avoided the "Get a proper OS" joke. Seriously, it's annoying having to switch to a qwerty layout each time I want to play. Most often, I forget to do that and I have to quit the game to change it because console cannot be opened at that point, and if I can't open the console, I cannot Alt+Tab out of the game.
urphy's rules of combat
8 ) Teamwork is essential; it gives the enemy someone else to shoot at.
18 ) Make it too tough for the enemy to get in and you can't get out.

SLAVE|Mietz

  • Posts: 672
  • Turrets: +2/-0
    • http://blasted.tremulous.info
Broken keyboard handling
« Reply #3 on: June 09, 2006, 11:58:38 pm »
Quote from: "Stof"
At least I avoided the "Get a proper OS" joke. Seriously, it's annoying having to switch to a qwerty layout each time I want to play. Most often, I forget to do that and I have to quit the game to change it because console cannot be opened at that point, and if I can't open the console, I cannot Alt+Tab out of the game.


Seriously, i dont understand your problem.
maybe explain it a bit, why wouldn't you open the console? do french keyboards have no "~"?

Neo

  • Posts: 760
  • Turrets: +2/-0
Broken keyboard handling
« Reply #4 on: June 10, 2006, 12:04:19 am »
Granted it wouldn't be easy, but you could just rebind the keys to fit an Azerty keyboard.

Stof

  • Posts: 1343
  • Turrets: +1/-1
Broken keyboard handling
« Reply #5 on: June 10, 2006, 12:12:17 am »
Quote from: "Neo"
Granted it wouldn't be easy, but you could just rebind the keys to fit an Azerty keyboard.

Some keys cannot be used when in french layout. The key used typicaly for the console doesn't work anymore, quite a few of the number keys ( not the numpad ) cannot be used either etc ...
urphy's rules of combat
8 ) Teamwork is essential; it gives the enemy someone else to shoot at.
18 ) Make it too tough for the enemy to get in and you can't get out.

Catalyc

  • Posts: 214
  • Turrets: +2/-0
Broken keyboard handling
« Reply #6 on: June 10, 2006, 12:15:37 am »
You can always bind the console to something else. Look this line up in the autogen.cfg:

Code: [Select]
bind ` "toggleconsole"

and change ` for whatever suits you.

On another note, you can probably Alt+Enter and switch to windowed mode, you'll have to reload the map though.
ttp://tremmapping.pbwiki.com/

Stof

  • Posts: 1343
  • Turrets: +1/-1
Broken keyboard handling
« Reply #7 on: June 10, 2006, 12:21:17 am »
Quote from: "Catalyc"
You can always bind the console to something else. Look this line up in the autogen.cfg:

Code: [Select]
bind ` "toggleconsole"

and change ` for whatever suits you.

Probably but I would still like the other keys to work.
Quote from: "Catalyc"

On another note, you can probably Alt+Enter and switch to windowed mode, you'll have to reload the map though.

I'll have you know that I can perfectly ALT+ENTER and switch between fullscreen and windowed mode without reloading the level at all. And also, since I use the same resolution ingame and outgame, the switch is instant :D

Unfortunately, when I do that, I just get a window which covers the whole screen and that I cannot leave at all. The game doesn't unlock the mouse and ALT+TAB until I open the console.

As a matter of fact, looking at the source code, I found a horible hack : if there's a SDL KEYDOWN event with a display char of '~', then it is translated as a the ~ key itself. It means that when I use "Right Alt ( Alt Gr ) + 3" I get the console to open and close :) Fortunately for me, that's two key's I have no reason to use yet but I wouldn't like the console to open at the worse possible time else ;)
urphy's rules of combat
8 ) Teamwork is essential; it gives the enemy someone else to shoot at.
18 ) Make it too tough for the enemy to get in and you can't get out.

tjw

  • Posts: 210
  • Turrets: +10/-0
Broken keyboard handling
« Reply #8 on: June 10, 2006, 12:26:18 am »
http://www.lokigames.com/support/quake3/faq3-installation.php3

xmodmap -e "keycode 49 = asciitilde"

might work for you.

For a real fix to ioquake3, perhaps unix/sdl_glimp.c needs a similar type of extended ascii mapping that win32/win_wndproc.c has.

Stof

  • Posts: 1343
  • Turrets: +1/-1
Broken keyboard handling
« Reply #9 on: June 10, 2006, 12:37:12 am »
Not sure about that. It looks like win_wndproc uses a scancode -> key convertion table which is something flawed to begin with because that table depends on the keyboard layout.

I'll have to test the windows version but looking at the code, I'm sure that pressing the A key on the keyboard config screen will display the Q key instead. Still, it might be possible to do it that way. It'll be far from perfect though.

As a matter of fact, the best thing to do would probably be to use SDL for all key handling on all platforms. At least there will be only one code path and there won't be a need for some "os dependend keyboard routine keycode" -> "game engine keycodes" convertion function.
urphy's rules of combat
8 ) Teamwork is essential; it gives the enemy someone else to shoot at.
18 ) Make it too tough for the enemy to get in and you can't get out.

Stof

  • Posts: 1343
  • Turrets: +1/-1
Broken keyboard handling
« Reply #10 on: June 10, 2006, 01:04:56 am »
Ok, problem is rather "simple" in the end. Looking at unix/sdl_gimpl.c line 180, we have the convertion table. What it says is that :
- if the symbol pressed is a printable ASCII char, then it is passed as it is. So far, so good
- else, if the sym matches a big switch case, we convert to the internal ioquake keycode.
- else, the key is ignored

and after that, a second test is made :
- if the key symbol is a pure ASCII value, then we pass it to the input buffer

First part is used to handle ingame keys like forward, fire etc ... and second part is used to handle console commands, text input fields etc ...

The problem is that french keyboards ( and many othe keyboards ) have some keys which produce a symbol which isn't ASCII but is still considered printable ( although not for quake ). And there's little chance to get them working like that. It'll require quite some change in the internals of the keyboard handling.
urphy's rules of combat
8 ) Teamwork is essential; it gives the enemy someone else to shoot at.
18 ) Make it too tough for the enemy to get in and you can't get out.

PierreF

  • Posts: 11
  • Turrets: +0/-0
Broken keyboard handling
« Reply #11 on: September 11, 2006, 11:53:31 am »
I've done a quick and durty patch to allow french keyboard to work well with the key ² (which is ~ on qwerty keyboard).

It's work for opening and closing console
Code: [Select]

--- tremulous-1.1.0-src/src/unix/sdl_glimp.c    2006-03-04 00:59:01.000000000 +0100
+++ tremulous-1.1.0-src.my/src/unix/sdl_glimp.c 2006-09-10 13:06:51.000000000 +0200
@@ -250,6 +250,9 @@
   case SDLK_KP_MINUS: *key = K_KP_MINUS; break;
   case SDLK_KP_DIVIDE: *key = K_KP_SLASH; break;

+  // pierref, console for french keyboard
+  case SDLK_WORLD_18: *key = '~'; break;
+
   default: break;
   }

rasz_pl

  • Guest
Broken keyboard handling
« Reply #12 on: September 11, 2006, 02:10:13 pm »
oh cmon, just
setxkbmap blabla
trem
setxkbmap blabla_back

Stof

  • Posts: 1343
  • Turrets: +1/-1
Broken keyboard handling
« Reply #13 on: September 11, 2006, 02:18:28 pm »
Quote from: "rasz_pl"
oh cmon, just
setxkbmap blabla
trem
setxkbmap blabla_back

:roll: :evil: :x
urphy's rules of combat
8 ) Teamwork is essential; it gives the enemy someone else to shoot at.
18 ) Make it too tough for the enemy to get in and you can't get out.

PierreF

  • Posts: 11
  • Turrets: +0/-0
Broken keyboard handling
« Reply #14 on: September 11, 2006, 07:33:29 pm »
Also buy qwerty keyboard !

It FAR easier for me to use a azerty keyboard, it's the layout I use all the time, I don't understand why I should change my layout only for a game, moreover when a simple patch solve the problem

Stof

  • Posts: 1343
  • Turrets: +1/-1
Broken keyboard handling
« Reply #15 on: September 11, 2006, 07:45:54 pm »
What I don't like about your patch which is a hack ( but to counter another hack ;) ) is that it might break other layouts.
urphy's rules of combat
8 ) Teamwork is essential; it gives the enemy someone else to shoot at.
18 ) Make it too tough for the enemy to get in and you can't get out.

Taiyo.uk

  • Posts: 2309
  • Turrets: +222/-191
    • Haos Redro
Broken keyboard handling
« Reply #16 on: September 12, 2006, 02:45:03 am »
Quote from: "rasz_pl"
oh cmon, just
setxkbmap blabla
trem
setxkbmap blabla_back


or just put this in your .bashrc:
Code: [Select]
alias trem="setxkbmap blabla; tremulous; setxkbmap blabla_back"
Then you can completely forget that it's a really lousy kludge :wink:

Stof

  • Posts: 1343
  • Turrets: +1/-1
Broken keyboard handling
« Reply #17 on: September 12, 2006, 09:11:42 am »
Quote from: "Taiyo.uk"
Quote from: "rasz_pl"
oh cmon, just
setxkbmap blabla
trem
setxkbmap blabla_back


or just put this in your .bashrc:
Code: [Select]
alias trem="setxkbmap blabla; tremulous; setxkbmap blabla_back"
Then you can completely forget that it's a really lousy kludge :wink:

Goodness! Maybe you don't know it but doing a setxkbmap will change the keyboard map! It means you'll be having a english keyboard map on an nonengligh keyboard :x

Unacceptable.
urphy's rules of combat
8 ) Teamwork is essential; it gives the enemy someone else to shoot at.
18 ) Make it too tough for the enemy to get in and you can't get out.


Taiyo.uk

  • Posts: 2309
  • Turrets: +222/-191
    • Haos Redro
Broken keyboard handling
« Reply #19 on: September 12, 2006, 03:24:34 pm »
Quote from: "Stof"

Goodness! Maybe you don't know it but doing a setxkbmap will change the keyboard map! It means you'll be having a english keyboard map on an nonengligh keyboard :x

Unacceptable.


Yeah, pretty wicked, huh? It's like das keyboard but more confusing  :wink:

In fact get youself one of those, then what keymap you set is completely irrelevant. Kludgetastic!

kevlarman

  • Posts: 2737
  • Turrets: +291/-295
Broken keyboard handling
« Reply #20 on: September 13, 2006, 05:22:31 am »
this is still a hack, but at least it doesn't screw up your entire keyboard (or depend on a specific layout): you can wrap trem in a script that uses xmodmap to remap a few keys, and then unremaps them when trem exits, but you'll have a messed up keyboard when you alt-tab out of trem.
Quote from: Asvarox link=topic=8622.msg169333#msg169333
Ok let's plan it out. Asva, you are nub, go sit on rets, I will build, you two go feed like hell, you go pwn their asses, and everyone else camp in the hallway, roger?
the dretch bites.
-----
|..d| #
|.@.-##
-----

Karmon

  • Posts: 7
  • Turrets: +0/-0
Broken keyboard handling
« Reply #21 on: May 30, 2007, 12:09:16 am »
I have the same problem as Stof but with a german keyboard.

BUT...only when playing Trem under Linux.
That's the weird thing about it because it works ok under Win98.

For example, the "ü" and "ö"-keys which are to the right of the "P" and "L"-keys, respectively, can be set under the Win-version of Trem, but under Linux they don't even respond.

Another annoyance:
If I use a certain key, for opening the console under Linux, it will open it but when pressing this specific key again it will print that key within the console instead of closing the console again.

Please don't tell me that playing Trem under Linux is behind playing it under Win.

Hopefully these problems can be fixed easily in the next version.
Or are there some simple workarounds ?


Karmon
oses are red,
violets are blue,
some poems rhyme,
and some don't...

PFB

  • Guest
Broken keyboard handling
« Reply #22 on: May 30, 2007, 12:18:07 am »
well keyboards are cheap
get a qwerty us keyboard

Stof

  • Posts: 1343
  • Turrets: +1/-1
Broken keyboard handling
« Reply #23 on: May 30, 2007, 10:26:58 am »
Quote from: "Karmon"
I have the same problem as Stof but with a german keyboard.

BUT...only when playing Trem under Linux.
That's the weird thing about it because it works ok under Win98.

For example, the "ü" and "ö"-keys which are to the right of the "P" and "L"-keys, respectively, can be set under the Win-version of Trem, but under Linux they don't even respond.

Another annoyance:
If I use a certain key, for opening the console under Linux, it will open it but when pressing this specific key again it will print that key within the console instead of closing the console again.

Please don't tell me that playing Trem under Linux is behind playing it under Win.

Hopefully these problems can be fixed easily in the next version.
Or are there some simple workarounds ?


Karmon

Are you using the latest tjw client backport? IIRC, some of us submitted a few patches for that and it should work much better now, provided they got integrated in that client :) Next version should work much better for that, even the console key I hope.

Of course, there's always the problem that maybe nobody tested with your specific keyboard some there might still be some specific problems.
urphy's rules of combat
8 ) Teamwork is essential; it gives the enemy someone else to shoot at.
18 ) Make it too tough for the enemy to get in and you can't get out.

Karmon

  • Posts: 7
  • Turrets: +0/-0
Broken keyboard handling
« Reply #24 on: May 30, 2007, 11:02:18 pm »
@ PFB
Unqualified and useless comment...  --> /dev/null

@ stof
No, I haven't tried that so far. I just installed Trem with aptitude from the Debian stable repository.
I just find it strange that Trem doesn't stick to the OS's settings as it does under Windows.
oses are red,
violets are blue,
some poems rhyme,
and some don't...