DirectX keyboard problems with child windows - patch

Patch attached …

Sam Lantinga wrote:

Sam,

whatever you say - you are the man.

But the fact remains, that a child window of the SDL window does not
receive any WM_CHAR messages unless the TranslateMessage() is done where
I pointed out.

And adding the TranslateMessage() does not seem to do any harm as far as
I can tell. The default SDL message loop still receives the keysyms as
before (Unicode is turned off - ie. the default).

Ah, I see what’s happening.
The only drawback is the additional translation processing overhead.
Do you set the SDL window with SDL_WINDOWID? If so, I can special
case that to perform character translation … although I’m not sure
that’s the best way to handle it…

So I would add my vote for adding this as an optional compile time flag.

Okay, you want to submit a patch?

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment
-------------- next part --------------
diff -rbd -U 2 SDL-1.2-orig/src/video/windib/SDL_dibevents.c SDL-1.2-patched/src/video/windib/SDL_dibevents.c
— SDL-1.2-orig/src/video/windib/SDL_dibevents.c Thu Aug 9 08:21:32 2001
+++ SDL-1.2-patched/src/video/windib/SDL_dibevents.c Thu Nov 29 14:32:58 2001
@@ -175,4 +175,5 @@
while ( PeekMessage(&msg, NULL, 0, (WM_APP-1), PM_NOREMOVE) ) {
if ( GetMessage(&msg, NULL, 0, (WM_APP-1)) > 0 ) {

  •   	TranslateMessage(&msg);
      	DispatchMessage(&msg);
      }
    

diff -rbd -U 2 SDL-1.2-orig/src/video/windx5/SDL_dx5events.c SDL-1.2-patched/src/video/windx5/SDL_dx5events.c
— SDL-1.2-orig/src/video/windx5/SDL_dx5events.c Thu Aug 9 08:21:32 2001
+++ SDL-1.2-patched/src/video/windx5/SDL_dx5events.c Thu Nov 29 14:33:53 2001
@@ -482,5 +482,8 @@
case WM_SYSKEYDOWN:
case WM_KEYUP:

  •   case WM_KEYDOWN: {
    
  •   case WM_KEYDOWN: 
    
  •   case WM_CHAR:
    
  •   case WM_SYSCHAR:
    
  •   {
      	/* Ignore windows keyboard messages */;
      }
    

@@ -544,4 +547,5 @@
PeekMessage(&msg, NULL, 0, (WM_APP-1), PM_NOREMOVE) ) {
if ( GetMessage(&msg, NULL, 0, (WM_APP-1)) > 0 ) {

  •   	TranslateMessage(&msg);
      	DispatchMessage(&msg);
      } else {
    

@@ -602,4 +606,5 @@
if ( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) ) {
if ( GetMessage(&msg, NULL, 0, 0) > 0 ) {

  •   		TranslateMessage(&msg);
      		DispatchMessage(&msg);
      	} else {