SFML community forums

Help => Window => Topic started by: suppiml on February 25, 2015, 12:57:35 pm

Title: Why does my german umlaut key patch not work anymore?
Post by: suppiml on February 25, 2015, 12:57:35 pm
I'm a freetime programmer and during my term breaks i'm working on a midi sequencer for which i need to use the german umlaut keys. For this reason during the last term break i patched sfml to allow the use of my german umlaut keys (i don't care about portability, i just need my software for myself). To achive this in the first step i extended the enumerator Keyboard::Key in ~/src/SFML-2.1/include/SFML/Window/Keyboard.hpp to
        Uuml,         ///< The Ue Key
        Ouml,         ///< The Oe Key
        Auml,         ///< The Ae Key

        KeyCount      ///< Keep last -- the total number of keyboard keys

Then, in the second step i had to extend the switch-case thing in the InputImpl::isKeyPressed(Keyboard::Key key), which is located at ~/src/SFML-2.1/src/SFML/Window/Linux/InputImpl.cpp. I just added the cases
        case Keyboard::Uuml:       keysym = XK_udiaeresis;   break;
        case Keyboard::Ouml:       keysym = XK_odiaeresis;   break;
        case Keyboard::Auml:       keysym = XK_adiaeresis;   break;

(BTW: The names of the X11Keysyms are defined at /usr/include/X11/keysymdef.h and can be checked with xev).
Eventually, after doing a make install in my sfml directory i could use the german umlaut keys in my own program in the same way than the other keys, eg
  if ( sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Uuml)) std::cout << "uuml pressed\n";

Everything worked as expected and now, after not programming for a semester, i wanted to continue my work. But the patch does not work anymore! (sf::Keyboard::isKeyPressed(sf::Keyboard::Key::Uuml)) always evaluates to false! I did everything again (uninstalling sfml, downloading vanilla sfml, patching and installing it), but nothing helps. Now I'm confused and begging for help.

I guess this happened due to some os-update (i use debian wheezy), but i have no alternative idea how to patch my sfml installation. I have no debian sfml package installed, i built it from source. The X11Keysyms for the umlauts are still there and still have the same name (as can be seen in /usr/include/X11/keysymdef.h and in xev output).

Anybody with an idea what I could try to get my umlaut keys to work again?

Or do you have other hacks/ideas/workarounds to cope with the missing support for german umlaut keys in sfml?

My System is a debian wheezy amd64 with sfml 2.1 build from source.

/Edit: a possible workaround could be executing "setxkbmap us" on command line ;-)
Title: Re: Why does my german umlaut key patch not work anymore?
Post by: Laurent on March 01, 2015, 02:19:14 pm
You can put a std::cout statement to print the value of the pressed key in InputImpl.cpp, and then look for that value in keysymdef.h.