emacs-devel
[Top][All Lists]
Advanced

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

Re: AltGr finger twisters documented?


From: YAMAMOTO Mitsuharu
Subject: Re: AltGr finger twisters documented?
Date: Wed, 06 Jul 2005 09:23:15 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/22.0.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Tue, 5 Jul 2005 16:00:05 +0200, "Jan D." <address@hidden> said:

> Well, GNU/Linux in many flavors, FreeBSD, Solaris, MacOSX (but there
> I have no idea how to get C-\).

As for Mac OS X/Carbon, could you test if you can type C-\ with "Ctrl
+ [the key combination for '\']" with the following patch?

                                     YAMAMOTO Mitsuharu
                                address@hidden


Index: src/macterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/macterm.c,v
retrieving revision 1.120
diff -c -r1.120 macterm.c
*** src/macterm.c       4 Jul 2005 16:06:33 -0000       1.120
--- src/macterm.c       6 Jul 2005 00:13:57 -0000
***************
*** 93,99 ****
  #define macMetaKey     (NILP (Vmac_reverse_ctrl_meta) ?                       
\
                        (NILP (Vmac_command_key_is_meta) ? optionKey : cmdKey) \
                        : controlKey)
! #define macAltKey      (NILP (Vmac_command_key_is_meta) ? cmdKey : optionKey)
  
  #define mac_window_to_frame(wp) (((mac_output *) GetWRefCon (wp))->mFP)
  
--- 93,101 ----
  #define macMetaKey     (NILP (Vmac_reverse_ctrl_meta) ?                       
\
                        (NILP (Vmac_command_key_is_meta) ? optionKey : cmdKey) \
                        : controlKey)
! #define macAltKey      (NILP (Vmac_command_key_is_meta) ? \
!                       (NILP (Vmac_command_key_is_meta) ? cmdKey : optionKey) \
!                       : 0)
  
  #define mac_window_to_frame(wp) (((mac_output *) GetWRefCon (wp))->mFP)
  
***************
*** 7537,7543 ****
      result |= ctrl_modifier;
    if (mods & macMetaKey)
      result |= meta_modifier;
!   if (NILP (Vmac_command_key_is_meta) && (mods & macAltKey))
      result |= alt_modifier;
    if (!NILP (Vmac_option_modifier) && (mods & optionKey)) {
        Lisp_Object val = Fget(Vmac_option_modifier, Qmodifier_value);
--- 7539,7545 ----
      result |= ctrl_modifier;
    if (mods & macMetaKey)
      result |= meta_modifier;
!   if (mods & macAltKey)
      result |= alt_modifier;
    if (!NILP (Vmac_option_modifier) && (mods & optionKey)) {
        Lisp_Object val = Fget(Vmac_option_modifier, Qmodifier_value);
***************
*** 9479,9487 ****
              }
            else
              {
!               if (er.modifiers & (controlKey |
!                                   (NILP (Vmac_command_key_is_meta) ? optionKey
!                                    : cmdKey)))
                  {
                    /* This code comes from Keyboard Resource,
                       Appendix C of IM - Text.  This is necessary
--- 9481,9492 ----
              }
            else
              {
!               EventModifiers mask = macCtrlKey | macMetaKey | macAltKey;
! 
!               if (!NILP (Vmac_option_modifier))
!                 mask |= optionKey;
! 
!               if (er.modifiers & mask)
                  {
                    /* This code comes from Keyboard Resource,
                       Appendix C of IM - Text.  This is necessary
***************
*** 9490,9513 ****
                       It also does not translate correctly
                       control-shift chars like C-% so mask off shift
                       here also */
!                   int new_modifiers = er.modifiers & 0xe600;
!                   /* mask off option and command */
!                   int new_keycode = keycode | new_modifiers;
!                   Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache);
!                   unsigned long some_state = 0;
!                   inev.code = KeyTranslate (kchr_ptr, new_keycode,
!                                             &some_state) & 0xff;
!                 }
!               else if (!NILP (Vmac_option_modifier)
!                        && (er.modifiers & optionKey))
!                 {
!                   /* When using the option key as an emacs modifier,
!                      convert the pressed key code back to one
!                      without the Mac option modifier applied. */
!                   int new_modifiers = er.modifiers & ~optionKey;
!                   int new_keycode = keycode | new_modifiers;
                    Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache);
!                   unsigned long some_state = 0;
                    inev.code = KeyTranslate (kchr_ptr, new_keycode,
                                              &some_state) & 0xff;
                  }
--- 9495,9506 ----
                       It also does not translate correctly
                       control-shift chars like C-% so mask off shift
                       here also */
!                   EventModifiers new_modifiers = er.modifiers & ~mask;
!                   /* mask off modifiers */
!                   UInt16 new_keycode = keycode | new_modifiers & 0xff00;
                    Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache);
!                   UInt32 some_state = 0;
! 
                    inev.code = KeyTranslate (kchr_ptr, new_keycode,
                                              &some_state) & 0xff;
                  }




reply via email to

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