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

Cannot switch keyboard layout with Ctrl-Shift-Number #663

Closed
max630 opened this issue May 29, 2017 · 13 comments

Comments

Projects
None yet
2 participants
@max630
Copy link

commented May 29, 2017

windows 10
mintty 2.7.3 (x86_64-pc-msys), installed with git for windows 2.13.0.windows.1

I have to use more that 2 layouts, so I use non-circular shortcuts Ctrl-Shift-1, Ctrl-Shift-2, Ctrl-Shift-3. When I press them having the mintty focused, the keyboard switching does not happen.

@mintty

This comment has been minimized.

Copy link
Owner

commented May 29, 2017

These are apparently keyboard shortcuts that you defined yourself at Windows level, not standard shortcuts.
Ctrl+Shift+ has a specific meaning in mintty. Not a very typical one, admittedly, sending proprietary escape sequences. In general, a terminal is expected to interpret the keyboard on behalf of its client application, and provide as much information to it as possible or suitable, with the exception of a set of global shortcuts. However, like for some other combinations, we can discuss an option to disable native handling of these keys. It would be useful, though, to find a more generic criteria for which keys to disable.

@max630

This comment has been minimized.

Copy link
Author

commented May 29, 2017

These are apparently keyboard shortcuts that you defined yourself at Windows level, not standard shortcuts
we can discuss an option to disable native handling of these keys. It would be useful, though, to find a more generic criteria for which keys to disable

To switch to a specific layout, there are sort of standard shortcuts which can be set up (that is, you can click to them from Control Panel, no fancy tweaking). It is possible to assign "Ctrl", or "Ctrl+Shift", or "Left Alt +Shoft" modifier + something from the number row to a specific keyboard layout.

Their change are somehow reflected in registry paths HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys\*, specifically for example:

HKEY_CURRENT_USER\Control Panel\Input Method\Hot Keys\00000100:
Key Modifiers = 06 c0 00 00
Target IME = something
Virtual Key = 31 00 00 00
Means "Ctrl-Shift + 1"

Key Modifier = "02 c0 00" corresponds to "Ctrl" modifier, "05 c0 00 00" to "Left Alt + Shift" modifier. The "Virtual Key" looks like the ascii code of the key. They are in the registry keys "00000100", "00000101" etc., though probably others also have some use.

Those keys could be inspected to find out if they need to be disabled

@mintty

This comment has been minimized.

Copy link
Owner

commented May 29, 2017

sort of standard shortcuts

No, they can be set up but they aren't by default.

Thanks for the registry info, but mintty is by default supposed to handle these modified keys, regardless of external shortcuts, so disabling mintty to capture them needs to be a mintty option.

@max630

This comment has been minimized.

Copy link
Author

commented Jun 9, 2017

Actually, Settings already has checkbox "Ctrl+Shift+letter shortcuts". If I understand your comment correctly, when disabled it lets the system handle those keypresses. Could it be extended to the digital row as well?

@mintty

This comment has been minimized.

Copy link
Owner

commented Jun 14, 2017

The Ctrl+Shift+letter shortcuts invoke window functions while Ctrl+Shift+digit (and some others) which you want disabled generate certain escape sequences. These are quite different things and I shouldn't fold them together.
I'm thinking about an option CtrlShiftControls to disable those mintty-specific sequences. It's a little bit fiddly to implement.

@mintty

This comment has been minimized.

Copy link
Owner

commented Jun 15, 2017

I've tried a modification that detects this case, ignores it and reports back the keyboard event still has to be handled. But is does not work. Somebody will have to find out how to prevent such events from being captured by the application.

@max630

This comment has been minimized.

Copy link
Author

commented Jun 16, 2017

I have found this place:

when WM_INPUTLANGCHANGEREQUEST: // catch Shift-Control-0

    when WM_INPUTLANGCHANGEREQUEST:  // catch Shift-Control-0
      if ((GetKeyState(VK_SHIFT) & 0x80) && (GetKeyState(VK_CONTROL) & 0x80))
        if (win_key_down('0', 0x000B0001))
             return 0;

if I remove this case the buttons seems to works (I did not test it for long though).

Could you say a bit more about which applications do it and how big impact would it be if they do not receive the input? Maybe it could be a user preference to handle language change rather than send the input to application.

Or, maybe it could perform the custom action and pass the event to DefWindowProcW()? I have not tried this but probably it could work as well.

@mintty

This comment has been minimized.

Copy link
Owner

commented Jun 16, 2017

Thanks for the hint; I overlooked that case.
Need to make sure that a tweak does not spoil #472 or #233.

@mintty

This comment has been minimized.

Copy link
Owner

commented Jun 19, 2017

Please recheck.

@max630

This comment has been minimized.

Copy link
Author

commented Jun 20, 2017

Looks working. Thanks

@mintty

This comment has been minimized.

Copy link
Owner

commented Jun 23, 2017

Released 2.7.8.

@mintty

This comment has been minimized.

Copy link
Owner

commented Mar 28, 2018

@max630, please recheck current repository version after fixing a regression (#743).

@max630

This comment has been minimized.

Copy link
Author

commented Mar 29, 2018

Seems working. commit 1da8d85, used windows7 32bit + gitsdk-1.0.6 + gcc-6.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.