emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: Carbon: Unicode keyboard layouts does not work properly


From: YAMAMOTO Mitsuharu
Subject: Re: Carbon: Unicode keyboard layouts does not work properly
Date: Mon, 19 Feb 2007 10:24:39 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shij┼Ź) APEL/10.6 Emacs/22.0.93 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Sun, 18 Feb 2007 13:09:42 +0000, David Reitter <address@hidden> said:

> The symptom I am experiencing is that trying to invoke the emacs
> command of `insert-parentheses┬┤ I want to press Meta+Shift+8. When
> using the danish latin keyboard layout, I get what I want
> (ie. "M-(") but with a unicode keyboard layout, emacs claims I am
> pressing "M-*" as it would have been on an american keyboard.

Thanks for the report.  I could reproduce it.

Actually, I'm not sure why the current code does not work.  But the
Keyboard Layout Services API, which is available on Mac OS X 10.2 and
later, seems to solve the problem.  Could you try the following patch?

                                     YAMAMOTO Mitsuharu
                                address@hidden

Index: src/macterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/macterm.c,v
retrieving revision 1.204
diff -c -p -r1.204 macterm.c
*** src/macterm.c       13 Feb 2007 08:28:39 -0000      1.204
--- src/macterm.c       19 Feb 2007 01:06:40 -0000
*************** XTread_socket (sd, expected, hold_quit)
*** 11165,11170 ****
--- 11165,11180 ----
                /* translate the keycode back to determine the
                   original key */
  #ifdef MAC_OSX
+               UCKeyboardLayout *uchr_ptr = NULL;
+ #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
+               OSStatus err;
+               KeyboardLayoutRef layout;
+ 
+               err = KLGetCurrentKeyboardLayout (&layout);
+               if (err == noErr)
+                 KLGetKeyboardLayoutProperty (layout, kKLuchrData,
+                                              (const void **) &uchr_ptr);
+ #else
                static SInt16 last_key_layout_id = 0;
                static Handle uchr_handle = (Handle)-1;
                SInt16 current_key_layout_id =
*************** XTread_socket (sd, expected, hold_quit)
*** 11176,11183 ****
                    uchr_handle = GetResource ('uchr', current_key_layout_id);
                    last_key_layout_id = current_key_layout_id;
                  }
- 
                if (uchr_handle)
                  {
                    OSStatus status;
                    UInt16 key_action = er.what - keyDown;
--- 11186,11196 ----
                    uchr_handle = GetResource ('uchr', current_key_layout_id);
                    last_key_layout_id = current_key_layout_id;
                  }
                if (uchr_handle)
+                 uchr_ptr = (UCKeyboardLayout *)*uchr_handle;
+ #endif
+ 
+               if (uchr_ptr)
                  {
                    OSStatus status;
                    UInt16 key_action = er.what - keyDown;
*************** XTread_socket (sd, expected, hold_quit)
*** 11188,11194 ****
                    UniChar code;
                    UniCharCount actual_length;
  
!                   status = UCKeyTranslate ((UCKeyboardLayout *)*uchr_handle,
                                             keycode, key_action,
                                             modifier_key_state,
                                             keyboard_type,
--- 11201,11207 ----
                    UniChar code;
                    UniCharCount actual_length;
  
!                   status = UCKeyTranslate (uchr_ptr,
                                             keycode, key_action,
                                             modifier_key_state,
                                             keyboard_type,




reply via email to

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