emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109542: Fix bug #10299 with Unicode


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109542: Fix bug #10299 with Unicode characters sent on MS-Windows by MSKLC.
Date: Fri, 10 Aug 2012 09:54:37 +0300
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109542
fixes bug: http://debbugs.gnu.org/10299
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Fri 2012-08-10 09:54:37 +0300
message:
  Fix bug #10299 with Unicode characters sent on MS-Windows by MSKLC.
  
   src/w32fns.c (INIT_WINDOW_CLASS): New macro.
   (w32_init_class): Use it to initialize the Emacs class with either
   ANSI or Unicode API calls.
   (w32_msg_pump): Call GetMessageW and DispatchMessageW on NT and
   later.
   (w32_wnd_proc): If the character code sent by WM_CHAR or
   WM_SYSCHAR is above 255, post a WM_UNICHAR message, not the
   original message.  Call DefWindowProcW on NT and later.
modified:
  src/ChangeLog
  src/w32fns.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-08-10 00:47:21 +0000
+++ b/src/ChangeLog     2012-08-10 06:54:37 +0000
@@ -1,3 +1,17 @@
+2012-08-10  Joakim HÃ¥rsman  <address@hidden>  (tiny patch)
+           Eli Zaretskii  <address@hidden>
+
+       Fix bug #10299 with Unicode characters sent by customized
+       keyboards created by MSKLC.
+       * w32fns.c (INIT_WINDOW_CLASS): New macro.
+       (w32_init_class): Use it to initialize the Emacs class with either
+       ANSI or Unicode API calls.
+       (w32_msg_pump): Call GetMessageW and DispatchMessageW on NT and
+       later.
+       (w32_wnd_proc): If the character code sent by WM_CHAR or
+       WM_SYSCHAR is above 255, post a WM_UNICHAR message, not the
+       original message.  Call DefWindowProcW on NT and later.
+
 2012-08-10  Glenn Morris  <address@hidden>
 
        * Makefile.in (config_h): Fix conf_post.h out-of-tree build location.

=== modified file 'src/w32fns.c'
--- a/src/w32fns.c      2012-08-07 07:33:18 +0000
+++ b/src/w32fns.c      2012-08-10 06:54:37 +0000
@@ -1780,23 +1780,37 @@
 
 static LRESULT CALLBACK w32_wnd_proc (HWND, UINT, WPARAM, LPARAM);
 
+#define INIT_WINDOW_CLASS(WC)                    \
+  (WC).style = CS_HREDRAW | CS_VREDRAW;                  \
+  (WC).lpfnWndProc = (WNDPROC) w32_wnd_proc;      \
+  (WC).cbClsExtra = 0;                            \
+  (WC).cbWndExtra = WND_EXTRA_BYTES;              \
+  (WC).hInstance = hinst;                         \
+  (WC).hIcon = LoadIcon (hinst, EMACS_CLASS);     \
+  (WC).hCursor = w32_load_cursor (IDC_ARROW);     \
+  (WC).hbrBackground = NULL;                      \
+  (WC).lpszMenuName = NULL;                       \
+
 static BOOL
 w32_init_class (HINSTANCE hinst)
 {
-  WNDCLASS wc;
-
-  wc.style = CS_HREDRAW | CS_VREDRAW;
-  wc.lpfnWndProc = (WNDPROC) w32_wnd_proc;
-  wc.cbClsExtra = 0;
-  wc.cbWndExtra = WND_EXTRA_BYTES;
-  wc.hInstance = hinst;
-  wc.hIcon = LoadIcon (hinst, EMACS_CLASS);
-  wc.hCursor = w32_load_cursor (IDC_ARROW);
-  wc.hbrBackground = NULL; /* GetStockObject (WHITE_BRUSH);  */
-  wc.lpszMenuName = NULL;
-  wc.lpszClassName = EMACS_CLASS;
-
-  return (RegisterClass (&wc));
+
+  if (os_subtype == OS_NT)
+    {
+      WNDCLASSW  uwc;
+      INIT_WINDOW_CLASS(uwc);
+      uwc.lpszClassName = L"Emacs";
+
+      return RegisterClassW (&uwc);
+    }
+  else
+    {
+      WNDCLASS  wc;
+      INIT_WINDOW_CLASS(wc);
+      wc.lpszClassName = EMACS_CLASS;
+
+      return RegisterClassA (&wc);
+    }
 }
 
 static HWND
@@ -2246,7 +2260,7 @@
 
   msh_mousewheel = RegisterWindowMessage (MSH_MOUSEWHEEL);
 
-  while (GetMessage (&msg, NULL, 0, 0))
+  while ((os_subtype == OS_NT ? GetMessageW : GetMessageA) (&msg, NULL, 0, 0))
     {
       if (msg.hwnd == NULL)
        {
@@ -2341,7 +2355,10 @@
        }
       else
        {
-         DispatchMessage (&msg);
+         if (os_subtype == OS_NT)
+           DispatchMessageW (&msg);
+         else
+           DispatchMessageA (&msg);
        }
 
       /* Exit nested loop when our deferred message has completed.  */
@@ -2918,8 +2935,18 @@
 
     case WM_SYSCHAR:
     case WM_CHAR:
-      post_character_message (hwnd, msg, wParam, lParam,
-                             w32_get_key_modifiers (wParam, lParam));
+      if (wParam > 255 )
+        {
+          W32Msg wmsg;
+
+          wmsg.dwModifiers = w32_get_key_modifiers (wParam, lParam);
+          signal_user_input ();
+          my_post_msg (&wmsg, hwnd, WM_UNICHAR, wParam, lParam);
+
+        }
+      else
+        post_character_message (hwnd, msg, wParam, lParam,
+                                w32_get_key_modifiers (wParam, lParam));
       break;
 
     case WM_UNICHAR:
@@ -3801,7 +3828,7 @@
        }
 
     dflt:
-      return DefWindowProc (hwnd, msg, wParam, lParam);
+      return (os_subtype == OS_NT ? DefWindowProcW :  DefWindowProcA) (hwnd, 
msg, wParam, lParam);
     }
 
   /* The most common default return code for handled messages is 0.  */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]