mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-140342 AltGr+г in ukrainian layout does not working
This commit is contained in:
+5
-1
@@ -35,7 +35,7 @@ import java.util.Locale;
|
||||
)
|
||||
public class KeyboardSettingsExternalizable implements PersistentStateComponent<KeyboardSettingsExternalizable.OptionSet> {
|
||||
|
||||
private static final String [] supportedNonEnglishLanguages = {"de", "fr", "it"};
|
||||
private static final String [] supportedNonEnglishLanguages = {"de", "fr", "it", "uk"};
|
||||
|
||||
public static boolean isSupportedKeyboardLayout(@NotNull Component component) {
|
||||
if (SystemInfo.isMac) return false;
|
||||
@@ -92,6 +92,10 @@ public class KeyboardSettingsExternalizable implements PersistentStateComponent<
|
||||
myOptions = state;
|
||||
}
|
||||
|
||||
public boolean isUkrainianKeyboard (Component c) {
|
||||
return c!=null && "uk".equals(c.getInputContext().getLocale().getLanguage());
|
||||
}
|
||||
|
||||
public boolean isNonEnglishKeyboardSupportEnabled () {
|
||||
return myOptions.USE_NON_ENGLISH_KEYBOARD;
|
||||
}
|
||||
|
||||
@@ -416,20 +416,8 @@ public class IdeEventQueue extends EventQueue {
|
||||
if (e instanceof KeyEvent) {
|
||||
KeyEvent ke = (KeyEvent)e;
|
||||
|
||||
// Alt,keyChar=Undefined keyChar,modifiers=Ctrl+Alt,extModifiers=Ctrl+Alt+Button5,keyLocation=KEY_LOCATION_RIGHT
|
||||
|
||||
//if (ke.getKeyCode() == KeyEvent.VK_ALT && ke.getID() == KeyEvent.KEY_PRESSED) {
|
||||
//
|
||||
// if (ke.getKeyLocation() == KeyEvent.KEY_LOCATION_RIGHT) {
|
||||
// if ((ke.getModifiersEx() & (InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK)) != (InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK))
|
||||
// {
|
||||
// altGrIsPressed = true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//} else {
|
||||
// altGrIsPressed = false;
|
||||
//}
|
||||
// Try to get it from editor
|
||||
Component sourceComponent = WindowManagerEx.getInstanceEx().getMostRecentFocusedWindow();
|
||||
|
||||
if (ke.getID() == KeyEvent.KEY_PRESSED) {
|
||||
switch (ke.getKeyCode()) {
|
||||
@@ -459,8 +447,15 @@ public class IdeEventQueue extends EventQueue {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!leftAltIsPressed && KeyboardSettingsExternalizable.getInstance().isUkrainianKeyboard(sourceComponent) ) {
|
||||
if ('ґ' == ke.getKeyChar() || ke.getKeyCode() == KeyEvent.VK_U) {
|
||||
ke = new KeyEvent(ke.getComponent(), ke.getID(), ke.getWhen(), 0,
|
||||
KeyEvent.VK_UNDEFINED, 'ґ', ke.getKeyLocation());
|
||||
ke.setKeyCode(KeyEvent.VK_U);
|
||||
ke.setKeyChar('ґ');
|
||||
return ke;
|
||||
}
|
||||
}
|
||||
|
||||
Integer keyCodeFromChar = CharToVKeyMap.get(ke.getKeyChar());
|
||||
if (keyCodeFromChar != null) {
|
||||
@@ -469,15 +464,12 @@ public class IdeEventQueue extends EventQueue {
|
||||
ke.setKeyCode(keyCodeFromChar);
|
||||
}
|
||||
|
||||
// Try to get it from editor
|
||||
Component sourceComponent = WindowManagerEx.getInstanceEx().getMostRecentFocusedWindow();
|
||||
|
||||
//for (int i = 0; sourceComponent == null && i < WindowManagerEx.getInstanceEx().getAllProjectFrames().length; i++) {
|
||||
// sourceComponent = WindowManagerEx.getInstanceEx().getAllProjectFrames()[i].getComponent();
|
||||
//}
|
||||
|
||||
if (sourceComponent != null) {
|
||||
if (sourceComponent.getInputContext().getLocale().getLanguage().equals("de")) {
|
||||
if (KeyboardSettingsExternalizable.isSupportedKeyboardLayout(sourceComponent)) {
|
||||
if ((ke.getModifiersEx() & (InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK)) != 0 /*&& ke.getKeyLocation() == KeyEvent.KEY_LOCATION_RIGHT*/) {
|
||||
// On German keyboard layout on Windows we are getting on key press
|
||||
// ctrl + alt instead of AltGr
|
||||
|
||||
Reference in New Issue
Block a user