From: ehofman Date: Sat, 27 Sep 2003 09:44:41 +0000 (+0000) Subject: First, MSVC 7 bombs when a value greater than 255 is passed to X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4779557037c91dd33e46701db55539c31ba0721d;p=flightgear.git First, MSVC 7 bombs when a value greater than 255 is passed to Frederic Bouvier: First, MSVC 7 bombs when a value greater than 255 is passed to issomething(), so I copy k to a char (unsigned ) kc before calling them. Second, with my french keyboard, and I thing this is the same for a great number of countries, some characters from the regular ASCII set can only be get with ALt Gr that appears to be CTRL+ALT. Especially, I can't select the second engine because '@' is AltGr+'à' nor all because '~' is AltGr+'é' (and I have to hit space after otherwise I can get õ or ã that are not used in french) and FG try to cope with the modifiers. So, currently, we have to mask out CTRL and ALT modifiers when they are together. The current bingings don't allow 2 simultaneous to be declared so it shouldn't break anything. --- diff --git a/src/Input/input.cxx b/src/Input/input.cxx index 4a099e4f8..887d18d49 100644 --- a/src/Input/input.cxx +++ b/src/Input/input.cxx @@ -847,22 +847,27 @@ FGInput::_read_bindings (const SGPropertyNode * node, const vector & FGInput::_find_key_bindings (unsigned int k, int modifiers) { + unsigned char kc = (unsigned char)k; button &b = _key_bindings[k]; // Try it straight, first. if (b.bindings[modifiers].size() > 0) return b.bindings[modifiers]; + // Alt-Gr is CTRL+ALT + else if (modifiers&(FG_MOD_CTRL|FG_MOD_ALT)) + return _find_key_bindings(k, modifiers&~(FG_MOD_CTRL|FG_MOD_ALT)); + // Try removing the control modifier // for control keys. - else if ((modifiers&FG_MOD_CTRL) && iscntrl(k)) + else if ((modifiers&FG_MOD_CTRL) && iscntrl(kc)) return _find_key_bindings(k, modifiers&~FG_MOD_CTRL); // Try removing shift modifier // for upper case or any punctuation // (since different keyboards will // shift different punctuation types) - else if ((modifiers&FG_MOD_SHIFT) && (isupper(k) || ispunct(k))) + else if ((modifiers&FG_MOD_SHIFT) && (isupper(kc) || ispunct(kc))) return _find_key_bindings(k, modifiers&~FG_MOD_SHIFT); // Try removing alt modifier for