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

Default behavior of "Ctrl + Up/Down" is not being prevented #6

Open
deltaidea opened this issue Apr 14, 2023 · 1 comment
Open

Default behavior of "Ctrl + Up/Down" is not being prevented #6

deltaidea opened this issue Apr 14, 2023 · 1 comment

Comments

@deltaidea
Copy link

deltaidea commented Apr 14, 2023

Hi! Thanks for making this utility!

I ran into the following issue.

Expectations

You should see either key code 17 (ControlLeft) or 91 (OSLeft) shown on the page when you return to the left desktop. Notably, you will not see key code 39 (ArrowRight) because Windows does not let the keyboard event pass to applications if it triggers a Windows hotkey.

I expect pressing Ctrl + Win + Down to have the same outcome. In other words, I expect the last key that I press in the combo to not result in a "key down" for other apps. I am not sure if the "key up" event should be propagated though - I didn't test this - but it should mirror the default behavior exactly, including if I release the keys in a different order compared to how I pressed them down.

Actual behavior

When you return to the left desktop, you will see key code 40 (ArrowDown), which means the browser has received all three key presses. In other words, any active application will act as if I pressed Ctrl+Down (if it doesn't check Win). This causes unwanted side-effects for me.

Environment

Other notes

It looks like you're currently passively checking if the relevant keys are pressed:

var ctrlState = GetAsyncKeyState(17);
var winState = GetAsyncKeyState(91);
var upArrowState = GetAsyncKeyState(38);
var downArrowState = GetAsyncKeyState(40);
var altKeyState = GetAsyncKeyState(18);

I'm not sure if it's possible to prevent other apps from getting key events with this approach. We might have to use WndProc or maybe call some sort of low-level Windows DLL.

Thanks again! 💚

@NNois
Copy link

NNois commented Jul 24, 2023

Well, using up down is not correct it remove a useful windows feature I agree why not sticking with the default keys (left right) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants