lelegard / winkbdlayouts Goto Github PK
View Code? Open in Web Editor NEWWindows Keyboards Layouts (WKL)
License: BSD 2-Clause "Simplified" License
Windows Keyboards Layouts (WKL)
License: BSD 2-Clause "Simplified" License
Hi,
first of all, thank you for the documentation you wrote, it is really insightful!
I’m trying to create a driver for the ErgoL layout (ergol.org) which has a dead key on the O
key (qwerty location).
the code is here https://gist.github.com/Geobert/37b771d07ff0bbe8a30929ad373eb7da
line 245 and 246, I’m defining a dead key but when I press it, it trigger 2 char immediatly ("’
) acting like a ligature, but I don’t have ligatures defined.
What am I missing?
Explanation, why the keys @/# and </> are sometimes inverted on Mac.
There are exists at least two physical keyboard types, US style ANSI without extra key between left Shift and Z and ISO with such extra key.
Long time ago Apple assigned different scancodes to some keys for ANSI and ISO Apple Desktop Bus (ADB) keyboards, effectively moving key with ADB scancode 32 from the location below Esc on ANSI keyboards to the location near left Shift on ISO keyboards, and assigning new scancode 0A to the key below Esc on ISO keyboard. It was done in hardware, by physically rerouting wires, so for example symbol "~" was always assigned by US keyboard layout to scancode 32, and was located below Esc for ANSI and near the Shift for ISO ADB keyboards. Other languages assigned other symbols to the key with scancode 32, physical location of those symbols moved between ANSI and ISO ADB keyboards the same way.
For the backward compatibility purposes ADB scancodes are used even on modern versions of macOS, with PS/2, USB or Bluetooth keyboard drivers translating native scancodes to ADB scancodes very early. Behavior of "moving" key with ADB scancode 32 is emulated inside driver if macOS autodetects or if user specified that ISO style keyboard is in use.
Most of VM software were written by US programmers that are not aware about this "jumping" key 32, but Parallels Desktop developers were aware, and compensated "jumping" key 32 so that key under the Esc has stable IBM Set2 scancode inside VM no matter was it ANSI or ISO keyboard from macOS host point of view.
But Parallels Desktop developers attempted to create windows layouts that match macOS native keyboard layouts, and after providing stable IBM Set2 scancodes inside VM they were not able to emulate "jumping" behavior for "~" key inside VM, that was still occurs inside macOS host!
Therefore, having "alternative" keyboard layout with swapped keys with ADB scancodes 32 and 0F or equivalently IBM scancodes 29 and 56 is useful not only on VmWare, but even on Parallels Desktop, especially for situations when Windows keyboard layout created from European macOS keyboard layout is used on Mac with ANSI keyboard.
The last field of each entry in dead_keys is a mask of flags. The only defined flag is DKF_DEAD, unused in all standard keyboards, with unclear usage.
DKF_DEAD
flag is used for a dead key chaining. See http://archives.miloush.net/michkap/archive/2011/04/16/10154700.html and http://www.kbdedit.com/manual/dead_chained.html
SGCap: means that this key is affected by the Shift state and the CapsLock
state, but in different ways. This is described in two lines: the First
is marked SGCap in column 3 and indicates how the character values are
determined according to whether a Shift key is down or not. The Second
line is marked with -1 in column 1 (scancode) and indicates how character
values for the same key are determined according to the CapsLock state.
If SGCAPS affects this key and CapsLock is on: use the next entry
in the table, but not is Ctrl or Alt are down.
hello, guys.
Thanks a lot for this best tools pack. These programs helped me a lot to understand complex things (bitmask) for creating best layout ever ;) (Windows Driver Kit or this package). But this topic is vast and my knowledge is not deep yet...
So, I have a couple of questions.
Firstly, I created a layer with modificator 'Kana':
// in scancode replace RCTRL to KANA (VK_OEM_8)
// After fix a bitmask
static VK_TO_BIT vk_to_bits[] = {
{VK_SHIFT, KBDSHIFT},
{VK_CONTROL, KBDCTRL},
{VK_MENU, KBDALT},
{VK_OEM_8, KBDKANA},
{0, 0}
};
static MODIFIERS char_modifiers = {
.pVkToBit = vk_to_bits,
.wMaxModBits = 8,
.ModNumber = {
0, // 000 = <none>
1, // 001 = Shift
// disable another modification
SHFT_INVALID, // 010 = Control
SHFT_INVALID, // 011 = Shift Control
SHFT_INVALID, // 100 = Alt
SHFT_INVALID, // 101 = Shift Alt
SHFT_INVALID, // 110 = Control Alt (AltGr)
SHFT_INVALID, // 111 = Shift Control Alt (Shift AltGr)
2, // this is my best modificator for new layer.
}
};
// and add new layer
static VK_TO_WCHARS3 vk_to_wchar3[] = {
// Base Shift Kana
// ---- ----- ------
....
{'A', CAPLOK, {L'a', L'A', L'0'}},
{'D', CAPLOK, {L'd', L'D', L'2'}},
{'F', CAPLOK, {L'f', L'F', L'3'}},
{'J', CAPLOK, {L'j', L'J', L'('}},
{'K', CAPLOK, {L'k', L'K', L')'}},
{'M', CAPLOK, {L'm', L'M', L'['}},
{'S', CAPLOK, {L's', L'S', L'1'}},
{VK_OEM_COMMA, 0x00, {L',', L'<', L']'}},
....
{0, 0, 0, 0, 0}
};
All works fine, but... what to do with hotkeys that require characters through a modifier?
I want use hotkey, for example, "ctrl+1", need press kana+ctrl+S in this case, and nothing happend. Why?
The second question follows from the first, for correct work hotkeys this record is not valid?
{'A', CAPLOK, {L'b', L'B', L'№'}},
Need change scancode on position 'A' to scancode 'b'?
If you have time to answer, I would be grateful.
P.S. Sorry for my terrible English.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.