Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added keyUp events & CapsLock synchronization; refactored handling of events #24

Merged
merged 19 commits into from
Sep 15, 2020

Conversation

fw623
Copy link

@fw623 fw623 commented Sep 14, 2020

I had a go at fixing the things that didn't work properly and bothered me (and others, it seems) and actually managed to do so. These are the changes summarized:

  1. Added handling of keyUp events (and combined it with keyDown)
  2. Refactored handling of key events and updating of states by moving many things to their own functions
  3. Added scanCode to manually sent key events
  4. Improved (imo) formatting of log messages to this:
    key down      | sc:050 vk:0x4D flags:0x00 extra:0 (M)
     mapped       | sc:050 M->m [0x006D] (level 1)
    injected down | sc:050 vk:0x4D flags:0x10 extra:0 (M)
    key up        | sc:050 vk:0x4D flags:0x80 extra:0 (M)
     mapped       | sc:050 M->m [0x006D] (level 1)
    injected up   | sc:050 vk:0x4D flags:0x90 extra:0 (M)
    
  5. Added synchronization of ShiftLock and CapsLock with windows CapsLock state.
    • This is achieved by sending an actual CapsLock keypress when toggling ShiftLock or CapsLock
    • This is also done during bypassMode, so when bypassMode=true and CapsLock is pressed, it will also be enabled when switching back to bypassMode=false
    • This now also toggles the keyboard indicator correctly for me
  6. Moved initialization of layer 4 special cases to initLayout

I have been using this for 2 weeks now and haven't noticed any problems in daily use (though while gaming I always had it disabled because the modifier keys don't behave how they'd need to for those programs - for me at least).

Copy link
Owner

@MaxGyver83 MaxGyver83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested it without problems. The changes look very good to me. Thank you for your contribution!

@@ -2,8 +2,8 @@
# Layout: neo, adnw, adnwzjf, bone, koy, kou, vou, qwertz
layout=neo

# use quote/� as right level 3 modifier
# �-Taste als rechten Ebene3-Modifier verwenden
# use quote/ä as right level 3 modifier
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What have you changed here? I don't see any difference. Is it the file encoding?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

da war glaub echt was anders am file encoding. So wies jetzt ist, stimmt es glaub

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it showed for all the umlaute for me, so I just added the Umlaute again by keyboard (and something changed, I guess 🤷)

@@ -142,6 +148,45 @@ void mapLevels_2_5_6(TCHAR * mappingTableOutput, TCHAR * newChars)
}
}

void initLevel4SpecialCases() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initializing this makes sense definitely!

@@ -383,29 +467,28 @@ bool handleLayer3SpecialCases(KBDLLHOOKSTRUCT keyInfo)
return true;
case 20:
sendChar(L'^', keyInfo);
keybd_event(VK_SPACE, 0x39, 0, 0);
commitDeadKey(keyInfo);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a side note: I just noticed that I only get spaces instead of ^ in Neovim (same for backticks). But this also occurs with the official release. So not caused by your changes.

@MaxGyver83 MaxGyver83 merged commit 4b2331f into MaxGyver83:master Sep 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants