[Commits] [wesnoth/wesnoth] 3d8c29: Fix a stray ; character appearing in the command c...

GitHub noreply at github.com
Thu Aug 11 19:18:53 UTC 2016


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 3d8c29bc299bacf58894638734a728e5550ee65b
      https://github.com/wesnoth/wesnoth/commit/3d8c29bc299bacf58894638734a728e5550ee65b
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2016-08-11 (Thu, 11 Aug 2016)

  Changed paths:
    M changelog
    M players_changelog
    M src/widgets/textbox.cpp
    M src/widgets/textbox.hpp

  Log Message:
  -----------
  Fix a stray ; character appearing in the command console

The GUI1 textbox widget had a mechanism to reject input until it has
received an SDL_KEYDOWN event, but it didn't do any good. I suspect this
regressed in commit 61ccf2fc, which changed the type of the event handler
container from std::vector to std::list. Apparently, starting from that
commit, an event (say, an SDL_KEYDOWN event) will also be delivered to
any event listeners which are registered by existing event handlers.

In other words:
1. the player presses ;
2. SDL generates an SDL_KEYDOWN event
3. a handler for that event creates the command console
4. the command console registers a handler for SDL events
5. the original keypress event is delivered to the command console
6. the console starts listening for input as a result of that event
7. SDL generates an SDL_TEXTINPUT event, still for the same keypress
8. the console inserts the ; character

I made the textbox loop through all the keys in construction, and store a
set of all pressed keys. The box will ignore all input until all the keys
which were down at the time it was created have been released. The fix
stops the stray ; character from appearing.





More information about the Commits mailing list