Skip to content

Commit e0fddc9

Browse files
committed
Improve AltGr modifier triggering detection
A press/release of AltGr is translated by the system into the press/release of two keys - LCtrl and RAlt. In Far, for modifiers, activation is registered upon release, and the problem with AltGr is that, being a combined event, it triggered upon the release of the very first key in the combination - LCtrl, thereby producing "CtrlRAlt" instead of the expected "RAlt" (similarly for compound combinations). This patch prevents premature reaction to the LCtrl release event.
1 parent d69bfd5 commit e0fddc9

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

far/keyboard.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ enum MODIF_PRESSED_LAST
101101
MODIF_CTRL = 3_bit,
102102
MODIF_RCTRL = 4_bit,
103103
};
104-
static bool LastWasDown;
104+
static bool LastWasDown, LastWasAltGr;
105105

106106
static std::chrono::steady_clock::time_point KeyPressedLastTime;
107107

@@ -1132,6 +1132,10 @@ static DWORD GetInputRecordImpl(INPUT_RECORD *rec,bool ExcludeMacro,bool Process
11321132
CalcKey = KEY_NONE;
11331133
LastWasDown = CalcKey == KEY_NONE && KeyDown;
11341134

1135+
if (LastWasAltGr && !KeyDown && KeyCode == VK_CONTROL && !(CtrlState & ENHANCED_KEY))
1136+
CalcKey = KEY_NONE;
1137+
LastWasAltGr = KeyCode==VK_MENU && ENHANCED_KEY == (CtrlState & (ENHANCED_KEY | LEFT_CTRL_PRESSED));
1138+
11351139
Panel::EndDrag();
11361140
}
11371141

0 commit comments

Comments
 (0)