X11_KeyToUnicode.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # HG changeset patch
  2. # User Sam Lantinga <slouken@libsdl.org>
  3. # Date 1327258041 18000
  4. # Node ID 900a0fae90ca65cff55a70a17b9ec39d2ddccbcf
  5. # Parent 5273dfd19a5e8c5736a0d417bd441f704c5355f8
  6. Fixed bug 1390 - X11_KeyToUnicode
  7. manuel.montezelo 2012-01-22 08:56:18 PST
  8. We had the following bug report at Debian:
  9. http://bugs.debian.org/376560
  10. Same one in Ubuntu:
  11. https://bugs.launchpad.net/ubuntu/+source/libsdl1.2/+bug/66217
  12. We've been including a patch since then (attached) to actually export the
  13. symbol, since 2006. In the last release the function seems to be there, alive
  14. and kicking.
  15. It's affecting other people too:
  16. http://www.garagegames.com/community/forums/viewthread/52287
  17. diff -r 5273dfd19a5e -r 900a0fae90ca src/video/x11/SDL_x11events.c
  18. --- a/src/video/x11/SDL_x11events.c Sat Jan 21 12:06:51 2012 -0500
  19. +++ b/src/video/x11/SDL_x11events.c Sun Jan 22 13:47:21 2012 -0500
  20. @@ -1246,8 +1246,11 @@
  21. * sequences (dead accents, compose key sequences) will not work since the
  22. * state has been irrevocably lost.
  23. */
  24. +extern DECLSPEC Uint16 SDLCALL X11_KeyToUnicode(SDLKey, SDLMod);
  25. +
  26. Uint16 X11_KeyToUnicode(SDLKey keysym, SDLMod modifiers)
  27. {
  28. + static int warning = 0;
  29. struct SDL_VideoDevice *this = current_video;
  30. char keybuf[32];
  31. int i;
  32. @@ -1255,6 +1258,12 @@
  33. XKeyEvent xkey;
  34. Uint16 unicode;
  35. + if ( warning ) {
  36. + warning = 0;
  37. + fprintf(stderr, "WARNING: Application is using X11_KeyToUnicode().\n");
  38. + fprintf(stderr, "This is not an official SDL function, please report this as a bug.\n");
  39. + }
  40. +
  41. if ( !this || !SDL_Display ) {
  42. return 0;
  43. }