Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent confirmation keys #1400

Closed
Narre opened this issue May 16, 2020 · 11 comments
Closed

Inconsistent confirmation keys #1400

Narre opened this issue May 16, 2020 · 11 comments

Comments

@Narre
Copy link
Contributor

Narre commented May 16, 2020

SuperTux 0.6.2
Ubuntu 20.04

To confirm a selection (whether it's a menu item or a level in a worldmap), the player has to press either Enter, Space, Ctrl(or Alt, or whatever ACTION is bound to), or use the mouse (where applicable). However, this is very inconsistent. For example, in the main menu, any of the options can be used, when selecting a level in a worldmap, Enter doesn't work, in certain menus in the editor, Space doesn't work, in the 'Do you want to save' menu, both Enter and Space don't work, etc.
I've also noticed that 'P' can no longer be used instead of Escape (for Pause / skip dying animation). That can get really annoying - I still keep pressing P even though it hasn't worked for a while.

I'm not sure if this was changed intentionally or not, but at least the inconsistencies should be sorted out. Maybe 'Confirm' and 'Pause' could even be settable in Options. Or at the very least, all the keys that can be used as 'Confirm' somewhere should be able to be used as 'Confirm' anywhere.

@szborows
Copy link
Contributor

I started to look at this. I'm not familiar with the code, so it's gonna take some time. After some debugging I found out that on my machine following default mappings from KeyboardConfig are erased and only the second mapping survives (and it works!).

@Narre if you have keyboard with a keypad can you please confirm that keypad Enter works for you in worldmap and level intro?

  m_keymap[SDLK_RETURN]   = Control::MENU_SELECT;
  m_keymap[SDLK_KP_ENTER] = Control::MENU_SELECT;

It looks that when Worldmap/Level intro processes the keys (through KeyboardManager I guess), following line fails to find an entry in the std::map.

auto key_mapping = m_keyboard_config.m_keymap.find(event.keysym.sym);

Then it goes to

  else if (key_mapping == m_keyboard_config.m_keymap.end())
  {
    // default action: update controls
    //log_debug << "Key " << event.key.SDL_Keycode.sym << " is unbound" << std::endl;
  }

And is effectively ignored.

@szborows
Copy link
Contributor

I also looked to the config file and noticed that I have this weird KP_RETURN entry. Removing it also solves the problem. I wonder from where it came. I've neither modified config file nor keyboard settings in the game, ever.

      (map
        (key 1073741912)
        (control "menu-select")
      )

But I remember that I switched keyboard some time ago to one with keypad. Maybe it stopped to work back then.

@Narre
Copy link
Contributor Author

Narre commented May 22, 2020

@szborows I can confirm. Keypad Enter works fine (I honestly haven't even thought of trying that before).

@szborows
Copy link
Contributor

Ok, I think I know reproduction steps (below). Interestingly, once you cause this issue to happen it will remain.

  1. Unplug keyboard with keypad (I have laptop, so it's not big deal)
  2. Remove config (in my case: rm ~/.local/share/supertux2/config)
  3. Run supertux. Everything works as expected. Default config file is generated.
  4. Quit
  5. Plug in the keyboard
  6. Run supertux again. Now enter key ain't working.
  7. Quit and unplug the keyboard.
  8. Run supertux again. Even if the keyboard is unplugged, the laptop's keyboard Enter doesn't work. Config file is simply broken.

I know my posts are a little bit "spamish", but I have limited time so I just want to report my findings in case I stop working on this. I'll try to dive deeper soon, though.

@Narre
Copy link
Contributor Author

Narre commented May 22, 2020

I tried it. You don't need to plug/unplug anything, just turn on/off NumLock and the outcome is the same! I just thought this was changed in SuperTux code, it never occurred to me it was broken THIS MUCH!

@Narre
Copy link
Contributor Author

Narre commented May 22, 2020

BTW I've got a laptop with a keypad.

@szborows
Copy link
Contributor

Good catch!
I remember it was working in previous versions. Can you confirm too? If so I'll git bisect it to find a commit that introduced this bug.

@Narre
Copy link
Contributor Author

Narre commented May 22, 2020

I only started having this problem somewhere between 0.5.1 and 0.6.0, it worked fine before that.

@szborows
Copy link
Contributor

The culrit is f0209f6, between v0.6.0-rc1 and v0.6.1.

#1070

@szborows
Copy link
Contributor

Possibly related issue: #1282

@szborows
Copy link
Contributor

szborows commented May 22, 2020

@HybridDog @christ2go @tobbi FYI (sorry for spam)
edit: @Rusty-Box

szborows added a commit to szborows/supertux that referenced this issue May 22, 2020
szborows added a commit to szborows/supertux that referenced this issue May 23, 2020
szborows added a commit to szborows/supertux that referenced this issue May 23, 2020
@tobbi tobbi closed this as completed in f1438e4 Jun 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants