Skip to content

Commit

Permalink
Merge pull request #562 from Wedge009/bug_24186_fix_(1.12)
Browse files Browse the repository at this point in the history
Revert all recent improvements to SDL1.2 hot-key handling (1.12)
  • Loading branch information
CelticMinstrel committed Apr 10, 2016
2 parents f3410c9 + 2f8a066 commit 705a9cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 4 additions & 0 deletions changelog
Expand Up @@ -3,6 +3,10 @@ Version 1.12.5+dev:
* Updated translations: Galician, Italian, RACV, Russian, Slovak, Swedish
* User interface:
* GUI1 comboboxes now use the thinner menu frame style.
* Miscellaneous and bug fixes:
* Revert all updates to hot-key handling which broke letter-based short-cuts
on non-US keyboard layouts, where characters are in different key
locations (bug #24186).

Version 1.12.5:
* Campaigns:
Expand Down
9 changes: 2 additions & 7 deletions src/hotkey/hotkey_item.cpp
Expand Up @@ -98,9 +98,7 @@ hotkey::hotkey_item& get_hotkey(int character, int keycode,
bool found = false;

for (itor = hotkeys_.begin(); itor != hotkeys_.end(); ++itor) {
// If character is a letter, make sure it can match its key code. Otherwise combinations like Ctrl+Return/Enter can be mistaken for Ctrl+j or Ctrl+m (CR and LF respectively).
// Character may not match key code in case of punctuation, eg key code for semi-colon is different from key code for colon yet on US keyboards they are represented by the same key.
if (itor->get_character() != -1 && (isalpha(character) && keycode != -1 ? tolower(character) == keycode : true)) {
if (itor->get_character() != -1) {
if (character == itor->get_character()) {
if (ctrl == itor->get_ctrl()
&& cmd == itor->get_cmd()
Expand Down Expand Up @@ -532,10 +530,7 @@ void hotkey_item::set_key(int character, int keycode,
character -= 32; }

// We handle simple cases by character, others by the actual key.
// @ and ` are exceptions related to the space character. Without these, combinations involving Ctrl or Ctrl+Shift often resolve the character value to null (or @ and `).
// If character is read as a letter, only treat it as a letter if its key code matches that character. This covers cases such as Ctrl+Return/Enter, which would otherwise be mis-read as Ctrl+j or Ctrl+m (CR and LF respectively).
if (character != '@' && character != '`' &&
( (isalpha(character) && tolower(character) == keycode) || (!isalpha(character) && isprint(character) && !isspace(character)) )) {
if (isprint(character) && !isspace(character)) {
character_ = character;
ctrl_ = ctrl;
cmd_ = cmd;
Expand Down

0 comments on commit 705a9cc

Please sign in to comment.