Subject: Re: bug#10299: Emacs doesn't handle Unicode characters in keyboard layout on MS Windows

From: Stefan Monnier <[email-masked]>
Date: Mon, 23 Jan 2012 20:35:17 -0500

> I've amended the patch to take your comments into account.

Thank you.

> --- src/w32.h   2011-10-28 09:54:02 +0000
> +++ src/w32.h   2012-01-23 19:10:04 +0000
> @@ -159,5 +159,18 @@
>                                    const void* buf, size_t sz);
>  #endif /* HAVE_GNUTLS */

> +#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;                     \
> +
> +
> +
>  #endif /* EMACS_W32_H */

Please don't put this macro there: it's not something that's exported to
other files, so it is better to keep it close to where it's used.

> +/* Set text of w32 frame with handle HWND to TEXT.
> +
> +   We explicitly switch between the Unicode and ANSI version of
> +   SetWindowText because Emacs isn't compiled with UNICODE defined to
> +   retain compatibility with Windows 95. */
> +
> +void
> +w32_set_frame_text(HWND hwnd, LPCSTR text)

This should be `static', I think, and with a space before the open-paren.

> +      if (os_subtype == OS_NT)
> +        result = GetMessageW (&msg, NULL, 0, 0);
> +      else
> +        result = GetMessage (&msg, NULL, 0, 0);

I'd write it as follows:

  result = (os_subtype == OS_NT ? GetMessageW : GetMessage) (&msg, NULL, 0, 0);

other than that, the code looks fine for me (I'll let Windows users
assess whether it actually does what it's meant to do ;-),

        Stefan