From: Sam Hocevar <sam+deb@zoy.org>
Date: Sun, 10 Jul 2022 11:19:25 +0100
Subject: Export X11_KeyToUnicode() to legacy applications,
 but warn about such usage to stderr

Introduced in 1.2.11-3 (Sun, 13 Aug 2006 19:03:51 +0200).

Last-Update: 2012-01-22
Bug-Debian: http://bugs.debian.org/376560
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libsdl1.2/+bug/66217
Forwarded: http://bugzilla.libsdl.org/show_bug.cgi?id=1390
Forwarded: https://github.com/libsdl-org/SDL-1.2/issues/659
Applied-Upstream: commit:http://hg.libsdl.org/SDL/rev/900a0fae90ca
Applied-Upstream: commit:https://github.com/libsdl-org/SDL-1.2/commit/a788ac9ea6f8e0ec9e7bc84c3ccd5cd830ab7612
---
 src/video/x11/SDL_x11events.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c
index 559a001..607cc07 100644
--- a/src/video/x11/SDL_x11events.c
+++ b/src/video/x11/SDL_x11events.c
@@ -1246,8 +1246,11 @@ static void get_modifier_masks(Display *display)
  * sequences (dead accents, compose key sequences) will not work since the
  * state has been irrevocably lost.
  */
+extern DECLSPEC Uint16 SDLCALL X11_KeyToUnicode(SDLKey, SDLMod);
+
 Uint16 X11_KeyToUnicode(SDLKey keysym, SDLMod modifiers)
 {
+	static int warning = 1;
 	struct SDL_VideoDevice *this = current_video;
 	char keybuf[32];
 	int i;
@@ -1255,6 +1258,12 @@ Uint16 X11_KeyToUnicode(SDLKey keysym, SDLMod modifiers)
 	XKeyEvent xkey;
 	Uint16 unicode;
 
+	if ( warning ) {
+		warning = 0;
+		fprintf(stderr, "WARNING: Application is using X11_KeyToUnicode().\n");
+		fprintf(stderr, "This is not an official SDL function, please report this as a bug.\n");
+	}
+
 	if ( !this || !SDL_Display ) {
 		return 0;
 	}
