German keyboard vs. BasiliskII for Windows 30-09-2019

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

User avatar
adespoton
Forum All-Star
Posts: 4274
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by adespoton »

Is there any difference when testing in full-screen vs windowed mode? I know that Windows changes how it captures keyboard modifiers based on display mode.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7831
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by Ronald P. Regensburg »

So, trying to change the mapping does not work. Then best leave the lines in my latest keycodes file as they are. The Windows key correctly activates the Mac Option key, but I understand that pressing that key does also does unwanted things in Windows that interfere with what it should do in BasiliskII.

Have you tried if the key-combos are also highjacked by Windows when BasiliskII is running full-screen? I suppose that BasiliskII can also run full screen in Windows like it can on other hosts.

Edit: I see that adespoton also asked that question.
Last edited by Ronald P. Regensburg on Wed Feb 19, 2020 5:09 pm, edited 1 time in total.
Reason:  
maf
Inquisitive Elf
Posts: 36
Joined: Sat Aug 30, 2014 1:56 pm

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by maf »

Switching to full-screen works, but does not change the way keys are handled. (As a side note: I have a two monitor setup, BasiliskII uses one of them in full-screen mode. Parts of it look like I should be wearing old red-green pseudo 3D glasses. I guess the proportions don't match.)

Is there a SDL2 test program for Windows that will simply tell me the scancode whenever I press a key?

Please note: I made an error in my earlier post. Pressing the (right) Alt Gr key will highlight both control (not shift!) keys plus both Alt keys. I fixed the mistake.
maf
Inquisitive Elf
Posts: 36
Joined: Sat Aug 30, 2014 1:56 pm

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by maf »

I just found this when browsing through what I assume to be the source used to build BasiliskII 30-09-2019: Feature request: For SDL2, in keycode mode, allow remapping of modifier keys. Wouldn't that explain why all attempts to remap Alt Gr failed?
User avatar
Ronald P. Regensburg
Expert User
Posts: 7831
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by Ronald P. Regensburg »

Could well be. I understand that the possibility for remapping the modifier keys is merged very recently (10 days) to kanjitalk755 master. Now someone needs to build a new Windows version from the current source. Who? The previous build was done by emendelson.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7831
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by Ronald P. Regensburg »

emendelson kindly made for us a new BasiliskII build for Windows form the current source:
https://emaculation.com/basilisk/Basili ... 2-2020.zip

My latest version of the keycodes file is now also here:
https://emaculation.com/basilisk/Basili ... ycodes.zip
maf
Inquisitive Elf
Posts: 36
Joined: Sat Aug 30, 2014 1:56 pm

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by maf »

Thanks, emendelson.

Unfortunately, the new binary gives the same results as the older one with the redefined keycode

Code: Select all

230	55	# Command (<- Windows Alt Right, Alt Gr)
Pressing Alt Gr highlights both Ctrl and both Alt keys in the MacOS key application, the labels of the number keys don't change when Alt Gr is pressed, and Alt Gr + 5 produces no character.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7831
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by Ronald P. Regensburg »

maf wrote:

Code: Select all

230	55	# Command (<- Windows Alt Right, Alt Gr)
This is the original line, not a changed one. Pressing the Alt Right key should result in highlighting both Command keys in the Keys application, just like pressing the Alt Left key.

Do you now have more than one line starting with 230? That would explain highlighting of four keys instead of two.

And are you sure the Alt keys (= Option keys) are highlighted? The order of the keys on a Mac, and thus in the Keys application, are:
Control - Option (Alt) - Command (Apple) - Space - Command (Apple) - Option (Alt) - Control

I will study the sdl2 scancodes again this weekend.
maf
Inquisitive Elf
Posts: 36
Joined: Sat Aug 30, 2014 1:56 pm

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by maf »

Oh, stupid me! Good thing you spotted that!

Actually, there are two sources of confusion you pointed out: A wrong entry in keycodes file and a difference in keyboard layout and thus key names.

With

Code: Select all

#230	55	# Command (<- Windows Alt Right, Alt Gr)
230	58	# Option (<- Windows Alt Right, Alt Gr)
pressing the Alt Gr key will highlight both Ctrl keys and both Alt keys in the keys application. But those are the names on my Windows keyboard, which from left to right has this bottom row: Ctrl, Windows, Alt, Space, Alt Gr, Windows, Menu, Ctrl. The keys application only shows seven keys in the bottom row.

Now, with the above entry in the keycodes file, pressing Alt Gr, pressing and releasing Ctrl, and pressing 5 will actually render a [. And the label of the 5 key turns to [ once I release the Ctrl key. So I'm almost there.

My guess is that something in the source makes the Alt Gr (Alt Right) key always emit the Ctrl key code in addition to its own code. I will try to look at the source, but may be someone more familiar with it can help out.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7831
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by Ronald P. Regensburg »

maf wrote:But those are the names on my Windows keyboard, which from left to right has this bottom row: Ctrl, Windows, Alt, Space, Alt Gr, Windows, Menu, Ctrl. The keys application only shows seven keys in the bottom row..
When discussing these issues, please try to use the correct names for the Windows keys and the Mac keys, which are different.

On your Windows keyboard:
Control - Windows - Alt - Space - Alt - Windows - Menu - Control
(Alt Right is also called Alt Gr key and on your German keyboard Control is named Strg.)

On a Mac keyboard (and in the Keys application):
Control - Option - Command - Space - Command - Option - Control
(The option key is also called Alt key and the Command key used to be called Apple key.)

The different positions of the Alt keys on a Windows keyboard and on a Mac keyboard are indeed confusing. Best avoid the name "Alt" when describing Mac keys.

Later I will post different keycodes files to try.
Last edited by Ronald P. Regensburg on Fri Feb 21, 2020 10:55 am, edited 4 times in total.
Reason:  
User avatar
Ronald P. Regensburg
Expert User
Posts: 7831
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by Ronald P. Regensburg »

It is difficult to test things I can not see myself. To prevent confusion on my side, do not edit the keycodes files. We will start from the beginning.

Start with this keycodes file. It has the regular SDL2 to Mac mappings: https://ronaldpr.home.xs4all.nl/keycode ... ycodes.zip

I will upload other files depending on your findings.

Check everything in your Tastatur application in BasiliskII. What works there, will work in other applications.

1. Shift and Control
I understand that Shift and Control keys, both left and right, all show in Tastatur as expected and that the Shift keys works as expected. (Control does not do much). Is that correct? Then we will concentrate on the option and command keys.

2. Command (Alt Left)
I understand that your left Alt shows in Tastatur as the Command key as it should. Correct?
(There should be a few subtle changes on the keyboard, mainly related to 'dead' keys, but they are of little practical meaning.)

Can you use command key commands? For instance, with Tastatur in front pressing Command-W should close the Tastatur window.

3. Command (Alt Right / Alt Gr)
With this keycodes file, this key should work in BasiliskII as the one on the left. Does it do that? If not, what is different?

4. Option (Windows key left and right)
I understand that this key is the most problematic one.
Does pressing the key show correctly as the option key in Tastatur application? And do characters on the keys change as expected?

You mentioned that pressing number keys with the Window key starts Windows programs. Does this only happen with the number keys? Can you type the special characters with other keys? for instance ™ when pressing option-e, or © when pressing option-g, or œ when pressing option-ö?
maf
Inquisitive Elf
Posts: 36
Joined: Sat Aug 30, 2014 1:56 pm

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by maf »

Ronald P. Regensburg wrote:It is difficult to test things I can not see myself. To prevent confusion on my side, do not edit the keycodes files. We will start from the beginning.

Start with this keycodes file. It has the regular SDL2 to Mac mappings: https://ronaldpr.home.xs4all.nl/keycode ... ycodes.zip

I will upload other files depending on your findings.

Check everything in your Tastatur application in BasiliskII. What works there, will work in other applications.
Ok, thanks. I'm using BasiliskII 19-02-2020 as provided by emendelson and your new keycodes file. I will use "Windows Logo" for the Windows key to differentiate it from the operating system.
Ronald P. Regensburg wrote:1. Shift and Control
I understand that Shift and Control keys, both left and right, all show in Tastatur as expected and that the Shift keys works as expected. (Control does not do much). Is that correct? Then we will concentrate on the option and command keys.
Correct. Pressing any of those modifiers highlights both left and right keys in the Tastatur app. Shift and Control in combination with another key produce the characters indicated by the Tastatur app.
Ronald P. Regensburg wrote:2. Command (Alt Left)
I understand that your left Alt shows in Tastatur as the Command key as it should. Correct?
(There should be a few subtle changes on the keyboard, mainly related to 'dead' keys, but they are of little practical meaning.)

Can you use command key commands? For instance, with Tastatur in front pressing Command-W should close the Tastatur window.
Correct. Pressing Left Alt highlights both Alt keys in the Tastatur app. The Left Alt keys works as Command modifier, e.g. for Command-W.
Ronald P. Regensburg wrote:3. Command (Alt Right / Alt Gr)
With this keycodes file, this key should work in BasiliskII as the one on the left. Does it do that? If not, what is different?
Pressing Alt Right highlights both Alt keys and both Control keys in the Tastatur app (.i.e. a total of four keys). The labels of the other keys change as when pressing a Control key, but pressing Alt Gr plus another key (e.g. W) does not produce a character nor does it execute a command. So Alt Gr does not functions as a Command modifier key.
Ronald P. Regensburg wrote:4. Option (Windows key left and right)
I understand that this key is the most problematic one.
Does pressing the key show correctly as the option key in Tastatur application? And do characters on the keys change as expected?
Pressing any of the Windows Logo keys highlights both Options keys in the Tastatur app and changes almost all other key labels. Releasing the Windows Logo key opens the Windows start menu. Pressing a Windows Logo key plus any other key executes a operation defined by Windows (see list below). The only undefined key combination I have found so far is Windows Logo + Esc, which actually produces the (circle with arrow to upper left) character shown in the Tastatur app.
Ronald P. Regensburg wrote:You mentioned that pressing number keys with the Window key starts Windows programs. Does this only happen with the number keys? Can you type the special characters with other keys? for instance ™ when pressing option-e, or © when pressing option-g, or œ when pressing option-ö?
It seems that most Windows Logo key combination are handled by Windows itself, e.g. Windows Logo + E opens a File Explorer. There is a Microsoft page listing key combinations, with a (long) section "Windows logo key keyboard shortcuts".
User avatar
Ronald P. Regensburg
Expert User
Posts: 7831
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by Ronald P. Regensburg »

maf wrote:Pressing Left Alt highlights both Alt keys in the Tastatur app. The Left Alt keys works as Command modifier, e.g. for Command-W.
I understand that pressing the Left Alt key highlights the Command keys in the Tastatur app and that it works as expected. (Note that on a Mac keyboard the name "Alt" is used for the Option key, the key between the Control and Command.)
Pressing Alt Right highlights both Alt keys and both Control keys in the Tastatur app (.i.e. a total of four keys).
The combo Command-Control is not functional in Mac OS, so we cannot use Alt Right here.
Releasing the Windows Logo key opens the Windows start menu. Pressing a Windows Logo key plus any other key executes a operation defined by Windows (see list below).
So, the Windows Logo key cannot be used, unless all Windows keyboard shortcuts would be disabled.

I made a new keycodes file that contains three alternatives for activating the Mac Option key.

1. The left Control key
I do not expect this to work, but we should try it anyway.

2. The Menu key

3. The key between the left Shift key and the Y key
You may or may not have that key on your Windows keyboard. It is only available on ISO keyboards.

https://ronaldpr.home.xs4all.nl/keycode ... codes4.zip

Note: Edited link.
Last edited by Ronald P. Regensburg on Fri Feb 28, 2020 11:04 am, edited 3 times in total.
Reason:  
maf
Inquisitive Elf
Posts: 36
Joined: Sat Aug 30, 2014 1:56 pm

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by maf »

Ronald P. Regensburg wrote:I understand that pressing the Left Alt key highlights the Command keys in the Tastatur app and that it works as expected. (Note that on a Mac keyboard the name "Alt" is used for the Option key, the key between the Control and Command.)
True, I'm using the labels on the keys of my keyboard.
Ronald P. Regensburg wrote:
Pressing Alt Right highlights both Alt keys and both Control keys in the Tastatur app (.i.e. a total of four keys).
The combo Command-Control is not functional in Mac OS, so we cannot use Alt Right here.
With your new keycodes files, this changed. Now pressing Alt Right highlights both Alt keys and both Windows Logo keys. Pressing any of the two Windows Logo keys now only highlights those two.
Ronald P. Regensburg wrote:
Releasing the Windows Logo key opens the Windows start menu. Pressing a Windows Logo key plus any other key executes a operation defined by Windows (see list below).
So, the Windows Logo key cannot be used, unless all Windows keyboard shortcuts would be disabled.
I still have hope :???: May be I can find some explanation for the sometimes surprising handling of modifier keys in the source code. At the moment I'm stuck, though, because BasiliskII causes SIGSEGV when run in gdb.
Ronald P. Regensburg wrote:I made a new keycodes file that contains three alternatives for activating the Mac Option key.

1. The left Control key
I do not expect this to work, but we should try it anyway.
This works! Pressing the left Control key highlights both Windows Logo keys (i.e. Mac Option keys). Pressing Left Ctrl + <other key> produces the character shown by the Tastatur app. This includes Shift + Left Ctrl + <other key> combinations
Ronald P. Regensburg wrote:2. The Menu key
This works as well! Same behavior as Left Ctrl.
Ronald P. Regensburg wrote:3. The key between the left Shift key and the Y key
You may or may not have that key on your Windows keyboard. It is only available on ISO keyboards.
My keyboard does not have that key.

Great results! Thanks for your help!
User avatar
Ronald P. Regensburg
Expert User
Posts: 7831
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by Ronald P. Regensburg »

maf wrote:True, I'm using the labels on the keys of my keyboard.
Which confuses me. But never mind.
With your new keycodes files, this changed. Now pressing Alt Right highlights both Alt keys and both Windows Logo keys. Pressing any of the two Windows Logo keys now only highlights those two.
Still makes the Windows Logo keys and the Alt Right key useless in BasiliskII (and probably SheepShaver).
May be I can find some explanation for the sometimes surprising handling of modifier keys in the source code. At the moment I'm stuck, though, because BasiliskII causes SIGSEGV when run in gdb.
My guess is that the problem is not in the BasiliskII source, but is caused by the way Windows uses these keys regardless which application is running in front. Not something that can be solved in BasiliskII.
Ronald P. Regensburg wrote:I made a new keycodes file that contains three alternatives for activating the Mac Option key.

1. The left Control key
I do not expect this to work, but we should try it anyway.
This works! Pressing the left Control key highlights both Windows Logo keys (i.e. Mac Option keys). Pressing Left Ctrl + <other key> produces the character shown by the Tastatur app. This includes Shift + Left Ctrl + <other key> combinations
Great! That is all that is needed to be able to type all available characters. The right Control key remains available for Mac OS 8.0 and later, where Control-click activates the contextual menu.
2. The Menu key
This works as well! Same behavior as Left Ctrl.
Fine. we can leave it in. But as far as I am aware, not all Windows keyboards have this key.
3. The key between the left Shift key and the Y key
You may or may not have that key on your Windows keyboard. It is only available on ISO keyboards.
My keyboard does not have that key.
As the other two work, I will again remove this one because it will prevent typing the characters that are used there on ISO keyboards.

You can use this keycodes file for now. So far, identical keycodes files were used for both BasiliskII and SheepShaver on all three host systems (macOS, Windows, Linux). I will need to test what this one does on new builds for macOS. I will have very little time next two weeks, but I will come back to this later.

Edit: I am tired and talking nonsense. Identical files, yes. But not identical mappings. Of course I can easily split "sdl cocoa" mappings and "sdl windows" mappings in the keycodes file.
Last edited by Ronald P. Regensburg on Fri Feb 28, 2020 10:46 pm, edited 1 time in total.
Reason:  
maf
Inquisitive Elf
Posts: 36
Joined: Sat Aug 30, 2014 1:56 pm

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by maf »

Your new keycodes defines identical mappings for Alt Left and Alt Right:

Code: Select all

226	55	# Alt Left (--> Command)
44	49	# Space
230	55	# Alt Right (--> Command)
In the Tastatur app, pressing Alt Left will highlight both Alt keys. But pressing Alt Right will highlight both Alt keys plus both Windows Logo (Mac Option) keys. Can you explain, why that happens?

Could there be some interdependencies between mappings? If I remember correctly, these virtual double presses changed with different versions of the keycodes file.

I was surprised to find that with the change

Code: Select all

#230	55	# Alt Right (--> Command)
230	58	# Alt Right (--> Option)
pressing Alt Right now only highlights the Windows Logo (Mac Option) key and functions as the option key!

With this last change, I was able to define an AutoHotkey file that translates special key combinations on my keyboard to their MacOS counterparts:

Code: Select all

#IfWinActive, Basilisk

; {
<^>!7::
Send, {AppsKey down}8{AppsKey up}
Return

; [
<^>!8::
Send, {AppsKey down}5{AppsKey up}
Return

; ]
<^>!9::
Send, {AppsKey down}6{AppsKey up}
Return

; }
<^>!0::
Send, {AppsKey down}9{AppsKey up}
Return

; \
<^>!ß::
Send, {AppsKey down}{Shift down}7{Shift up}{AppsKey up}
Return

; @
<^>!q::
Send, {AppsKey down}{Shift down}1{Shift up}{AppsKey up}
Return

; ~
<^>!+::
Send, {AppsKey down}{Shift down}8{Shift up}{AppsKey up}
Return

; |
<^>!<::
Send, {AppsKey down}7{AppsKey up}
Return

; µ
<^>!m::
Send, {AppsKey down}m{AppsKey up}
Return
E.g., I can now press AltGr + 7 to type { and AltGr + Q to type @.

Edit: Added translations for \ and µ
Last edited by maf on Sun Mar 01, 2020 4:14 pm, edited 3 times in total.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7831
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by Ronald P. Regensburg »

maf wrote:Your new keycodes defines identical mappings for Alt Left and Alt Right:

Code: Select all

226	55	# Alt Left (--> Command)
44	49	# Space
230	55	# Alt Right (--> Command)
In the Tastatur app, pressing Alt Left will highlight both Alt keys. But pressing Alt Right will highlight both Alt keys plus both Windows Logo (Mac Option) keys. Can you explain, why that happens?
I have no explanation. In Windows the Alt Left and Alt Right keys are different, so I suppose it is something with the Alt Right key in Windows.
I was surprised to find that with the change

Code: Select all

#230	55	# Alt Right (--> Command)
230	58	# Alt Right (--> Option)
pressing Alt Right now only highlights the Windows Logo (Mac Option) key and functions as the option key!
Surprising that the translation Alt Right to Option works while the translation Alt Right to Command does not work as one would expect.
With this last change, I was able to define an AutoHotkey file that translates special key combinations on my keyboard to their MacOS counterparts:

[...]

E.g., I can now press AltGr + 7 to type { and AltGr + Q to type @.
I am not sure, but I suppose this makes it possible to use some of your familiar Windows key combos for special characters inside BasiliskII. Wouldn't it be a lot of work to do that for all (100+) special characters? A mixture of Windows and Mac key combos does not seem a good idea. Generally, I think one should best use Mac key combos in a Mac emulator.
maf
Inquisitive Elf
Posts: 36
Joined: Sat Aug 30, 2014 1:56 pm

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by maf »

maf wrote:I am not sure, but I suppose this makes it possible to use some of your familiar Windows key combos for special characters inside BasiliskII. Wouldn't it be a lot of work to do that for all (100+) special characters? A mixture of Windows and Mac key combos does not seem a good idea. Generally, I think one should best use Mac key combos in a Mac emulator.
I haven't used a Macintosh keyboard for a long time and I have a pretty bad memory. So I wouldn't know where to find special MacOS characters on my keyboard...

The translations I defined with AutoHotkey provide all the characters visible on my (propably fairly regular) QWERTZ keyboard but not available before. (Actually, except for the EURO sign, which does not seem to be included in my old fonts.) All other, regular characters are in the same place on my keyboard and in the Tastatur app already. I can now use the same key and key combinations in standard windows applications and in BasiliskII.

Note: I found one more translation (µ) and added to my script above.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7831
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by Ronald P. Regensburg »

Well, I suppose it is a solution if you can live with a limited character set. And, of course, your script will only work for German keyboards, while the keycodes file will work for all keyboard layouts.

I thought, for the sake of symmetry, we could try to make both Alt keys work as Option key and make one of the Control keys work as Command key. Then Option-Shift would be available on both sides and your AutoHotkey script can be used. The Control key gets a function in Mac OS 8.0 and later in combination with a mouse click. As most people will use the mouse with their right hand, maybe then best make the right Control key the Command key and keep the left Control key as Control key. What do you think?
maf
Inquisitive Elf
Posts: 36
Joined: Sat Aug 30, 2014 1:56 pm

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by maf »

The reason I redefined the mapping of Alt Right in your keycodes files was that I couldn't get the AutoHotkey script to work when both Alt and Win keys were pressed by AltGr as happens with this mapping:
230 55 # Alt Right (--> Command)
My redefinition of AltGr (Alt Right) was ment to avoid that virtual quadruple key press. But I have now found a way to make my translations work with your mapping: I have to first send up-events for both Windows logos keys. The remainder of the definition can stay the same, e.g.

Code: Select all

; {
<^>!7::
Send, {LWin up}{RWin up}{AppsKey down}8{AppsKey up}
Return
Note: This works with the above mapping.

Over the years, I got very used to using the left Alt key as the Mac Command key. I wouldn't want to change that. And it corresponds with the Macintosh keyboard layout. So I like the (left) Alt key as Command key replacement. Then, both Control keys can be used as Control keys. The Windows logo keys seem useless (unless there is an AutoHotkey trick yet to be discovered.) And for me, the Menu key is a great replacement for the Option key, because it allows me to type all the special characters I can see in the Tastatur app. But the special characters I need in everyday life are provided by the AutoHotkey host keys for the AltGr key combinations that correspond with the labels on my keyboard.

So I'm suggesting the following mappings

Code: Select all

224	54	# Ctrl Left
227	58	# Logo Left (--> Option)
226	55	# Alt Left (--> Command)
44	49	# Space
230	55	# Alt Right (--> Command)
231	58	# Logo Right (--> Option)
101	58	# International (Windows Menu)
228	54	# Ctrl Right
With those mappings, pressing AltGr changes back to highlighting the four Ctrl plus Alt keys. (So the mapping of scan code 244 influences the mapping of scan code 230. It seems to set the "additional" key if 230 is mapped to 55. I'm still guessing that something in the source causes this coupling.) That requires a change in the AutoHotkey script, beause now the Control keys have to be lifted first, e.g.:

Code: Select all

; {
<^>!7::
Send, {LCtrl up}{RCtrl up}{AppsKey down}8{AppsKey up}
Return
P.S.: I added a definition für \ to my earlier AutoHotkey script
User avatar
Ronald P. Regensburg
Expert User
Posts: 7831
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by Ronald P. Regensburg »

maf wrote:Over the years, I got very used to using the left Alt key as the Mac Command key. I wouldn't want to change that. And it corresponds with the Macintosh keyboard layout. So I like the (left) Alt key as Command key replacement. Then, both Control keys can be used as Control keys.
Then which key did you use for the Option key?
And for me, the Menu key is a great replacement for the Option key, because it allows me to type all the special characters I can see in the Tastatur app.
This works fine for you. But it can not be used for a general keycodes file for distribution. As far as I am aware, the Menu key is not available on all Windows keyboards.
(So the mapping of scan code 244 influences the mapping of scan code 230. It seems to set the "additional" key if 230 is mapped to 55. I'm still guessing that something in the source causes this coupling.)
It could also be a bug in SDL2. These scancodes are specific for SDL2 and are different from previous SDL scancodes.
maf
Inquisitive Elf
Posts: 36
Joined: Sat Aug 30, 2014 1:56 pm

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by maf »

Ronald P. Regensburg wrote:Then which key did you use for the Option key?
I use my virtual Mac very sparingly. I got along without one :smile:
Ronald P. Regensburg wrote:This works fine for you. But it can not be used for a general keycodes file for distribution. As far as I am aware, the Menu key is not available on all Windows keyboards.
That's true. Even though I found a solution that fits my needs, I'll happily test other keycode files if you like. Or: From what I have seen, AutoHotkey can handle scancodes as well. May be it would be possible to define language-independent translations, e.g. to make AltGr act like a true Option key on a Macintosh keyboard.
Ronald P. Regensburg wrote:It could also be a bug in SDL2. These scancodes are specific for SDL2 and are different from previous SDL scancodes.
True as well. Should I eventually manage to discover how to use gdb with BasiliskII...
User avatar
Ronald P. Regensburg
Expert User
Posts: 7831
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by Ronald P. Regensburg »

To be able to use the modifier keys, the most important combinations must be accessible with one hand. That is at least Option-Shift in older Mac OS versions and in later versions also Command-Shift. Also, best have much used commands (like Cmd-Q, Cmd-W, Cmd-S, Cmd-X, Cmd-C, Cmd-V) accessible with one hand.

(Eventually all thinkable combinations of Command with one or two other modifier keys were used, but these are for actions that can also be accessed through the application menus in the menu bar. Only in Mac OS 8 and 9 the Control key was used to produce some rare special characters.)
May be it would be possible to define language-independent translations, e.g. to make AltGr act like a true Option key on a Macintosh keyboard.
You mentioned earlier that this could be done in the keycodes file.

So, with the experiences so far, it could be like this. It could be used with or without an AutoHotkey script.

Shift Left --> Shift
Control Left --> Control
Logo Left (useless)
Alt Left --> Command
Space --> Space
Alt Right --> Option
Logo Right (useless)
Menu --> Option
Control Right --> Control
Shift Right --> Shift
Last edited by Ronald P. Regensburg on Mon Mar 02, 2020 12:38 pm, edited 1 time in total.
Reason:  
maf
Inquisitive Elf
Posts: 36
Joined: Sat Aug 30, 2014 1:56 pm

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by maf »

maf wrote:Shift Left --> Shift
Control Left --> Control
Logo Left (useless)
Alt Left --> Command
Space --> Space
Alt Right --> Option
Logo Right (useless)
Menu --> Option
Control Right --> Control
Shift Right --> Shift
Yes, that would be good. But I'm not sure we have found a way to achieve that with keycodes, yet.

As far as I remember, AltGr always shows up as a combination of its own mapping plus the mapping of Ctrl Left in the Tastatur. E.g., if Ctrl Left is mapped to Control and AltGr to Option, then pressing AltGr highlights four keys (both Controls and Options). I can catch that with AutoHotkey ({LCtrl up}{RCtrl up}), but AltGr does not work as a straight replacement for Option because the Control key changes some of the special keys. E.g. 5 and 6 do not switch to [ and ] anymore. Other keys are still ok, e.g. 8 and 9 still switch to { and }. Only if Ctrl Left and AltGr are both mapped to Option, AltGr works as a clean Option key.
Ronald P. Regensburg wrote:You mentioned earlier that this could be done in the keycodes file.
I think I meant with the help of AutoHotkey
User avatar
Ronald P. Regensburg
Expert User
Posts: 7831
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: German keyboard vs. BasiliskII for Windows 30-09-2019

Post by Ronald P. Regensburg »

maf wrote:
Ronald P. Regensburg wrote:You mentioned earlier that this could be done in the keycodes file.
I think I meant with the help of AutoHotkey
I was referring to this:
maf wrote:I was surprised to find that with the change

Code: Select all

#230	55	# Alt Right (--> Command)
230	58	# Alt Right (--> Option)
pressing Alt Right now only highlights the Windows Logo (Mac Option) key and functions as the option key!
Was that only with Control Left mapped to Option?
Last edited by Ronald P. Regensburg on Mon Mar 02, 2020 8:23 pm, edited 1 time in total.
Reason:  
Post Reply