Keycodes file for Windows with latest code?

About SheepShaver, a PPC Mac emulator for Windows, MacOS X, and Linux that can run System 7.5.3 to MacOS 9.0.4.

Moderators: Cat_7, Ronald P. Regensburg, ClockWise

ebann
Tinkerer
Posts: 42
Joined: Tue Jan 19, 2021 10:26 pm

Re: Keycodes file for Windows with latest code?

Post by ebann »

Ronald P. Regensburg wrote: Sun Jun 20, 2021 11:43 am No, the Mac keycode for Option is 58 and the Mac keycode for Command is 55. Maybe you mixed up the names for the Mac modifier keys?
The diagram below shows the Mac keyboard followed by my Chromebook key assignment (as shown by Key Caps) followed by the keycode used in the BasiliskII_keycodes file.

Code: Select all

 Macintosh: Control | Option | Command | Space bar | Command | Option | Control
Chromebook: LCTRL   |   x    | LALT    |     x     | RALT    | RCTRL  |   x
   Keycode: 54      |   x    |    x    |     x     | 58      | 55     |   x
Note that the OPTION keys are not available on a Chromebook due to its lacking the WINDOWS symbols (L and R), so I mapped COMMAND and OPTION to the keys RALT and RCTRL.

I hope this shed some light in fine-tuning Basilisk's SDL2 keybindings.
Apparently your Left Alt key cannot be used because it is intercepted by the host.
You are correct. I "disabled" this keycode but it seems that it is still assigned the COMMAND keycode "naturally". Linux intercepts this key for the i3 windows manager but for non-i3 keybindings it works as COMMAND. For example, LALT+Q quits the current Mac OS application.
Extensive documentation about SD2 scancodes and differences between ISO and ANSI keyboards and different language layouts can be found here: https://www.libsdl.org/tmp/SDL/include/SDL_scancode.h
No mention of ABNT2 keyboards, but it seems similar to ISO keyboards as it has the "Non-US Backslash" key in the lower left corner.
Note that for the FORWARD_SLASH, QUESTION_MARK, and DEGREE symbols, I mapped it to the CONTROL modifier plus letters Q, W, and E respectively as those keys were unused. Inside Basilisk I would access them with CONTROL but in Linux I would access them with the standard ALT_GR key.
ebann
Tinkerer
Posts: 42
Joined: Tue Jan 19, 2021 10:26 pm

Re: Keycodes file for Windows with latest code?

Post by ebann »

Ronald P. Regensburg wrote: Sun Jun 20, 2021 12:24 pm And here about Portuguese and Brazilian ABNT/ABNT2 keyboards: https://en.wikipedia.org/wiki/Portugues ... ard_layout
Your Chromebook keyboard differs in that it is missing the Logo keys on a regular ABNT/ABNT2 keyboard.
Yes, the Chromebook is ABNT2 minus the WINDOWS keys. You can easily tell it's an ABNT2 layout when you see the FORWARD_SLASH and QUESTION_MARK assigned to the Q and W keys.

Is there anything else I can do to test and improve SDL2 keycode mapping?
User avatar
Ronald P. Regensburg
Expert User
Posts: 6858
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Keycodes file for Windows with latest code?

Post by Ronald P. Regensburg »

About Option versus Command:
Your assumption cannot be correct. You can check this in Key Caps:

With the key with keycode 58 pressed, you should get many more alternative characters you can type. Then that is the Option key
With the key with keycode 55 pressed, the letter keys should not change. Then that is the Command key

If the key with keycode 55 gives the alternative characters, something weird is going on in BasiliskII.

Edit: In the kanjitalk755 fork commit history I see a commit from 7 February 2021: "fixed swapping opt and cmd key if keycode file is used". It could be that this "fix" causes the swap you experience between keycodes 55 and 58. It does not happen in the macOS build I use. I will ask kanjitalk755 about it.
ebann
Tinkerer
Posts: 42
Joined: Tue Jan 19, 2021 10:26 pm

Re: Keycodes file for Windows with latest code?

Post by ebann »

Ronald P. Regensburg wrote: Mon Jun 21, 2021 8:01 am Edit: In the kanjitalk755 fork commit history I see a commit from 7 February 2021: "fixed swapping opt and cmd key if keycode file is used". It could be that this "fix" causes the swap you experience between keycodes 55 and 58. It does not happen in the macOS build I use. I will ask kanjitalk755 about it.
Image

Image

Image
User avatar
Ronald P. Regensburg
Expert User
Posts: 6858
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Keycodes file for Windows with latest code?

Post by Ronald P. Regensburg »

Yes, and not as it should be. If it is indeed caused by the "fix" in BasiliskII, you now had to use a fix in the keycodes file to fix the fix. Not good. I will contact kanjitalk755 about this.

In the meantime it works for you like this.
User avatar
Ronald P. Regensburg
Expert User
Posts: 6858
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Keycodes file for Windows with latest code?

Post by Ronald P. Regensburg »

Two questions:

1. Which OS, which Linux distro, runs on your Chromebook?

2. For compiling your BasiliskII, did you use source from kanjitalk755 from before or after 7 February 2021?
ebann
Tinkerer
Posts: 42
Joined: Tue Jan 19, 2021 10:26 pm

Re: Keycodes file for Windows with latest code?

Post by ebann »

Ronald P. Regensburg wrote: Tue Jun 22, 2021 7:41 am Two questions:

1. Which OS, which Linux distro, runs on your Chromebook?

2. For compiling your BasiliskII, did you use source from kanjitalk755 from before or after 7 February 2021?
64-bit Debian 10.9 “Buster” netinst with non-free firmware.

After… kanjitalk755 git cloned on June 16.
User avatar
Ronald P. Regensburg
Expert User
Posts: 6858
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Keycodes file for Windows with latest code?

Post by Ronald P. Regensburg »

Another couple of questions:

1. Do you have in the prefs (configuration) file an entry swap_opt_cmd ?
(The prefs file will probably be named .basilisk_ii_prefs in your Home directory.)

2. If yes, is it set to true or false?

3. If no, can you add that line and see how BasiliskII behaves with either

Code: Select all

swap_opt_cmd false
or

Code: Select all

swap_opt_cmd true
ebann
Tinkerer
Posts: 42
Joined: Tue Jan 19, 2021 10:26 pm

Re: Keycodes file for Windows with latest code?

Post by ebann »

Ronald P. Regensburg wrote: Sat Jun 26, 2021 10:00 am Another couple of questions:

1. Do you have in the prefs (configuration) file an entry swap_opt_cmd ?
(The prefs file will probably be named .basilisk_ii_prefs in your Home directory.)

2. If yes, is it set to true or false?

3. If no, can you add that line and see how BasiliskII behaves with either

Code: Select all

swap_opt_cmd false
or

Code: Select all

swap_opt_cmd true
I did not have that option in my config file. Didn't even know it existed. As such, it defaulted to FALSE (“BasiliskII --help”). So I did the following:

1. Reverted back to the correct key codes, CMD=55 and OPT=58, in BasiliskII_keycodes.
2. Declared “swap_opt_cmd” as FALSE in “.basikisk_ii_prefs”
3. Needed to set LALT=55=CMD otherwise, if not set, it would default to OPT.

The result:

Code: Select all

 Macintosh: Control | Option | Command | Space bar | Command | Option | Control
Chromebook: LCTRL   |   x    | LALT    |     x     | RALT    | RCTRL  |   x
   Keycode: 54      |   x    |    55   |     x     | 55      | 58     |   x
And it works as I want BUT logic dictates that I would have needed to set “swap_opt_cmd” as TRUE in “.basikisk_ii_prefs”. After some experiment I found out that if I removed the “swap_opt_cmd” line from the config file, the CMD and OPT are swapped!

It seems that even if “BasiliskII --help” says that “swap_opt_cmd” defaults to FALSE if not defined, it actually sets to TRUE.

Does that make sense?
User avatar
Ronald P. Regensburg
Expert User
Posts: 6858
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Keycodes file for Windows with latest code?

Post by Ronald P. Regensburg »

ebann wrote: Tue Jun 29, 2021 6:47 pmDoes that make sense?
It does. I found that in recent Windows and Linux builds swap_opt_cmd defaults to true, thus interfering with using keycodes files. This was not so in older builds.

I hope to convince kanjitalk755 that this change should be reversed, at least when a keycodes file is used.

Thanks for testing.

Do you also have a BasiliskII or SheepShaver setup on Linux on a computer with full keyboard, not just the control and alt keys as on your Chromebook?

Or anyone else who is following this topic?
ebann
Tinkerer
Posts: 42
Joined: Tue Jan 19, 2021 10:26 pm

Re: Keycodes file for Windows with latest code?

Post by ebann »

Ronald P. Regensburg wrote: Tue Jun 29, 2021 8:42 pm
ebann wrote: Tue Jun 29, 2021 6:47 pmDoes that make sense?
It does. I found that in recent Windows and Linux builds swap_opt_cmd defaults to true, thus interfering with using keycodes files. This was not so in older builds.

I hope to convince kanjitalk755 that this change should be reversed, at least when a keycodes file is used.

Thanks for testing.

Do you also have a BasiliskII or SheepShaver setup on Linux on a computer with full keyboard, not just the control and alt keys as on your Chromebook?

Or anyone else who is following this topic?
I have a Raspberry Pi which runs a version of Debian Linux. I will test on that platform using a US keyboard

Image
User avatar
Ronald P. Regensburg
Expert User
Posts: 6858
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: Keycodes file for Windows with latest code?

Post by Ronald P. Regensburg »

Today kanjitalk755 changed the code such that swap_opt_cmd false is forced when a "valid" keycodes file is used. (Not sure yet what he means with "valid".)

So best use a freshly compiled build from his fork. Can be either BasiliskII or SheepShaver.

Use this test keycodes file: http://ronaldpr.home.xs4all.nl/emaculat ... s_test.zip

I am specifically interested in the keys at the bottom. (The Fn key is only for use with the F keys?)

Thanks in advance.

Edit: A keycodes file is "valid" when keycodes true is set in prefs and keycode file points to a file that can be read and that contains the expected driver string (sdl x11 for Linux).
User avatar
adespoton
Forum All-Star
Posts: 3428
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Keycodes file for Windows with latest code?

Post by adespoton »

Ronald P. Regensburg wrote: Wed Jun 30, 2021 7:39 am I am specifically interested in the keys at the bottom. (The Fn key is only for use with the F keys?)
The Fn key toggles the keycodes sent to the ones in red on the keyboard I believe.
Post Reply