International keyboard layouts on Linux/SDL/Xwayland [solved]

About BasiliskII, a 68k Mac emulator for Windows, MacOSX, and Linux that can run System 7.x through MacOS 8.1.

Moderators: Cat_7, Ronald P. Regensburg

Post Reply
User avatar
scops
Tinkerer
Posts: 48
Joined: Thu Jan 23, 2003 2:35 pm

International keyboard layouts on Linux/SDL/Xwayland [solved]

Post by scops »

Hello,

is there a keycodes file to use international keyboards (with german umlauts for example) on Linux/SDL/Xwayland?

If i activate the bundled sdl keycodes file bundled with the sources (https://github.com/kanjitalk755/macemu) the whole keyboard is messed up. if i dont activate the keycodes file i don't have the chance to use (in my case) german umlauts on my system :(
Last edited by scops on Sat Sep 04, 2021 2:04 pm, edited 1 time in total.
no RISC no FUN ;)
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: International keyboard layouts on Linux/SDL/Xwayland

Post by Ronald P. Regensburg »

I do not know which keycodes file is bundled with the source on kanjitalk755 (I cannot find it) but it is probably an old one that only works with SDL1 builds.

Also, the keycodes files distributed on this site do not yet work with SDL2 Linux builds.

Assuming that you use an ISO keyboard (with Return key shaped as a "L" upside-down), that your BasiliskII is built with SDL2, and that you chose the German layout in Keyboard control panel in MacOS in BasiliskII, this test keycodes file should work: https://ronaldpr.home.xs4all.nl/keycode ... s_test.zip
User avatar
scops
Tinkerer
Posts: 48
Joined: Thu Jan 23, 2003 2:35 pm

Re: International keyboard layouts on Linux/SDL/Xwayland

Post by scops »

This file seems to be corrupt;

Code: Select all

#
# cocoa (SDL2)
# sdl x11
#
sdl cocoa
53	10	# `
nothing more in this.

in general i tryed all keycodes i found here ;) the german macOS version works nicely on macos but the keycodes doesn't match for Linux/SDL.
Maybe i can create a own keycodes file... have you some hints how to check which codes of sdl2 stands for which key and how i can see which code generates a keypress?
no RISC no FUN ;)
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: International keyboard layouts on Linux/SDL/Xwayland

Post by Ronald P. Regensburg »

No, It is exactly only this.

Do you use a German ISO keyboard? And did you choose the German keyboard layout in Keyboard control panel in MacOS in BasiliskII?
In fact, with a SDL2 build you will need to correct in keycodes only one key for an ISO keyboard, the top-left key next to the number "1" key. Even without a keycodes file, all other keys should be there as expected. With the German keyboard layout selected, you can use a QWERTZ keyboard with, for instance, next to the "L" the ö ä and #.
User avatar
scops
Tinkerer
Posts: 48
Joined: Thu Jan 23, 2003 2:35 pm

Re: International keyboard layouts on Linux/SDL/Xwayland

Post by scops »

Yes, i use a small german iso keyboard; keyboardtype 3 matches best. In (german) Mac OS 8 it is also selected.
y/z are still transposed and äöü can't be typed. if i type "-" (on the bottom right next to shift on my keyboard) "ß" apears on the screen..

edit:
i added "sdl x11" to the keycodes file so that Basilisk II can use it.
no RISC no FUN ;)
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: International keyboard layouts on Linux/SDL/Xwayland

Post by Ronald P. Regensburg »

When you install an English MacOS, the keyboard defaults to an English keyboard. But the Keyboard control panel in MacOS should give a choice of different language keyboards. Isn’t the German keyboard among the choices?
User avatar
scops
Tinkerer
Posts: 48
Joined: Thu Jan 23, 2003 2:35 pm

Re: International keyboard layouts on Linux/SDL/Xwayland

Post by scops »

Yes, and is selected (as only active keyboard) on Mac OS 8 ;)

edit:
here is a shot of my little setup. i just typed on the keyboard:

"qwertzuiopü+asdfghjklöä#<yxcvbnm,."

Image
no RISC no FUN ;)
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: International keyboard layouts on Linux/SDL/Xwayland

Post by Ronald P. Regensburg »

So what exactly is the problem? Keys appear correct in the Key Caps (Tastatur) application, but typing on the physical keyboard does not produce the correct characters?

Is your BasiliskII built with SDL2? If so, it should work correctly even without keycodes file, except for one key.

You could try this full keycodes file, but it should not be needed: https://ronaldpr.home.xs4all.nl/keycode ... ycodes.zip

(Option and Command keys may appear reversed in this file, depending on your "swap_opt_cmd" setting.)

(Yes, I did not correctly add "sdl x11" to the smaller file, I was in a hurry.)
User avatar
scops
Tinkerer
Posts: 48
Joined: Thu Jan 23, 2003 2:35 pm

Re: International keyboard layouts on Linux/SDL/Xwayland

Post by scops »

Yes, the inputs where interpreted as if i had a english keyboard and not a german with the small keyfile
The complete file works! - i just copy/pasted the sdl x11 stuff.
no RISC no FUN ;)
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: International keyboard layouts on Linux/SDL/Xwayland

Post by Ronald P. Regensburg »

Now I am left wondering why the smaller file did not work. Unlike pre-SDL2 builds, BasiliskII (and SheepShaver) built with SDL2 should do most scancode to keycode translations by itself. That was made possible because with SDL2 the scancodes are identical on all platforms. It works like that in macOS and Windows builds. Only the one key that behaves differently on ISO vs ANSI keyboards should need translation in the keycodes file.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: International keyboard layouts on Linux/SDL/Xwayland [solved]

Post by Ronald P. Regensburg »

Maybe you can help me to understand how this works in your BasiliskII build.

Your BasiliskII was built from recent kanjitalk755 source with SDL2 2.0.14 or later?

If you do not use a keycodes file, that is if in the prefs file is set

Code: Select all

keycodes false
does not typing work as expected with the exception of the key left to the "1" key?

Note that if keycodes is set to true while no keycodes file is selected, BasiliskII will look for an available keycodes file and use that one.
User avatar
scops
Tinkerer
Posts: 48
Joined: Thu Jan 23, 2003 2:35 pm

Re: International keyboard layouts on Linux/SDL/Xwayland [solved]

Post by scops »

Ronald P. Regensburg wrote: Sat Sep 04, 2021 3:40 pm Maybe you can help me to understand how this works in your BasiliskII build.

Your BasiliskII was built from recent kanjitalk755 source with SDL2 2.0.14 or later?
yes, i compiled with the how to found on the wiki with the SDL2 2.0.14 package on debian bullseye.
Ronald P. Regensburg wrote: Sat Sep 04, 2021 3:40 pm If you do not use a keycodes file, that is if in the prefs file is set

Code: Select all

keycodes false
does not typing work as expected with the exception of the key left to the "1" key?
if i turn off the keycodes completly the key left to "1" does just nothing.
Ronald P. Regensburg wrote: Sat Sep 04, 2021 3:40 pm Note that if keycodes is set to true while no keycodes file is selected, BasiliskII will look for an available keycodes file and use that one.
i set it manually with keycodefile [filename]
no RISC no FUN ;)
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: International keyboard layouts on Linux/SDL/Xwayland [solved]

Post by Ronald P. Regensburg »

scops wrote: Sat Sep 04, 2021 9:19 pmif i turn off the keycodes completly the key left to "1" does just nothing.
But the question is: With keycodes turned off completely (keycodes false and BasiliskII stopped and started again) do the other keys work as expected?
User avatar
scops
Tinkerer
Posts: 48
Joined: Thu Jan 23, 2003 2:35 pm

Re: International keyboard layouts on Linux/SDL/Xwayland [solved]

Post by scops »

no; if i disable the keycodes follow errors/missmatches appear:
  • ^ does nothing
  • ß does nothing
  • ` (next to ß on my keyboard) does nothing
  • < shows up as "m" but makes a ","
  • - makes a "ß"
  • # "makes a "3"
  • äöü does nothing
no RISC no FUN ;)
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: International keyboard layouts on Linux/SDL/Xwayland [solved]

Post by Ronald P. Regensburg »

Well, this is not what I expected and not what happens in OSX/macOS versions and afaik in Windows versions. I will try to figure this out and maybe discuss it with kanjitalk755.

Thanks for the test.
User avatar
scops
Tinkerer
Posts: 48
Joined: Thu Jan 23, 2003 2:35 pm

Re: International keyboard layouts on Linux/SDL/Xwayland [solved]

Post by scops »

you are welcome :)
If you or kanjitalk755 have patches to test, feel free to contact me directly (github.com/codeandcreate).

maybe it has something todo with SDL on X on wayland? I haven't tried it on xorg directly - i use gnome 40 on wayland.
no RISC no FUN ;)
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: International keyboard layouts on Linux/SDL/Xwayland [solved]

Post by Ronald P. Regensburg »

Thanks, I will remember you for testing.

In SDL2 builds, unlike in pre-SDL2 builds, scancodes are identical on all three platforms and thus SDL2 scancode to Mac keycode translations are identical. Basically, the keycodes file can be the same for all platforms. This is also true for the Linux version, otherwise the keycodes file would not work correctly.

In SDL2 builds for OSX/macOS those translations are built-in in the application. With ANSI (and similar) keyboards no keycodes file is needed, regardless the language layout. Only for ISO and ABNT (Brazilian) keyboards a keycodes file is needed for the one key that behaves differently on those keyboards (the key left of the "1" key).

I thought it was the same in SDL2 builds for Windows (apart from an issue with the Windows logo key), I will need to check that.

Apparently it is not the same in Linux builds.
Post Reply