Skip to content

Commit

Permalink
Fix #25682: Ignore "shift" when the hotkey is ":"
Browse files Browse the repository at this point in the history
This adds a second part, during the hotkey creation from an event,
to the hack around colons. It also ensures that the right field is
compared when checking for existing matching hotkeys for keyboard-based
hotkeys.
  • Loading branch information
aginor committed Apr 29, 2017
1 parent 9edf49e commit 73faf49
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/hotkey/hotkey_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,11 @@ hotkey_ptr create_hotkey(const std::string &id, const SDL_Event &event)
case SDL_TEXTINPUT: {
hotkey_keyboard_ptr keyboard(new hotkey_keyboard());
base = std::dynamic_pointer_cast<hotkey_base>(keyboard);
keyboard->set_text(std::string(event.text.text));
std::string text = std::string(event.text.text);
keyboard->set_text(text);
if (text == ":") {
mods = mods & ~KMOD_SHIFT;
}
}
break;
case SDL_MOUSEBUTTONDOWN:
Expand All @@ -179,7 +183,7 @@ hotkey_ptr create_hotkey(const std::string &id, const SDL_Event &event)
break;
}

base->set_mods(sdl_get_mods());
base->set_mods(mods);
base->set_command(id);
base->unset_default();

Expand Down Expand Up @@ -345,7 +349,7 @@ bool hotkey_keyboard::bindings_equal_helper(hotkey_ptr other) const
return false;
}

return keycode_ == other_k->keycode_;
return text_ == other_k->text_;
}

void del_hotkey(hotkey_ptr item)
Expand Down

0 comments on commit 73faf49

Please sign in to comment.