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

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

w32fns.c patches


From: Jonathan Epstein
Subject: w32fns.c patches
Date: Mon, 05 Nov 2001 08:34:39 -0500

Hi,

I have made some local changes to the Emacs 21-1 sources, and would like for 
them to be migrated into the Emacs 21 source baseline, and possible Emacs 20 as 
well.  The nature of the changes is to obey a legacy DOS mechanism for entering 
arbitrary characters using the Alt key and the numeric keyboard.  The rationale 
for needing this change is described at:
  
http://groups.google.com/groups?selm=Ug_D7.202%24f5.553248%40mencken.net.nih.gov&output=gplain

The changes which follow are based upon the posted Emacs 21-1 sources, which 
don't seem to be terribly similar to the CVS sources which I have seen.  
Fortunately, these changes are small and the particular pieces of code seems to 
be mostly untouched by others.

I would appreciate any input on how I get these into the source baseline(s) [is 
this the right venue?], and especially how they might be introduced into the 
forthcoming binaries of Emacs 21 for Windows.

By default the old behavior is retained, with a very modest performance 
overhead (one extra boolean comparison of a C integer in most cases).  The new 
behavior, which should be completely non-intrusive, is introduced by setting:
    (setq w32-alt-with-numerics-legacy t)

Context-sensitive diffs appear below.

TIA,

- Jonathan



*** c:/DOCUME~1/epsteinj/LOCALS~1/Temp/Copy of w32fns.c Fri Nov  2 16:25:30 2001
--- c:/DOCUME~1/epsteinj/LOCALS~1/Temp/w32fns.c Fri Nov  2 16:25:30 2001
***************
*** 89,94 ****
--- 89,99 ----
     to alt_modifier.  */
  Lisp_Object Vw32_alt_is_meta;

+ /* Non nil if alt key in combination with numbers on numeric keypad
+    is recognized in accordance with DOS legacy; e.g. 034 with the
+    Alt-key held down yields a double-quote mark (") */
+ Lisp_Object Vw32_alt_with_numerics_legacy;
+
  /* If non-zero, the windows virtual key code for an alternative quit key. */
  Lisp_Object Vw32_quit_key;

***************
*** 168,173 ****
--- 173,181 ----

  static int w32_in_use;

+ /* tallying for use with Vw32_alt_with_numerics_legacy */
+ static int accumulated_character = 0;
+
  /* Search path for bitmap files.  */

  Lisp_Object Vx_bitmap_file_path;
***************
*** 4171,4177 ****

      case WM_KEYUP:
      case WM_SYSKEYUP:
!       record_keyup (wParam, lParam);
        goto dflt;

      case WM_KEYDOWN:
--- 4179,4193 ----

      case WM_KEYUP:
      case WM_SYSKEYUP:
!
!       if (accumulated_character > 0 && wParam == VK_MENU &&
!         ! NILP(Vw32_alt_with_numerics_legacy)) {
!       /*transmit a character here*/
!       PostMessage (hwnd, WM_CHAR, accumulated_character , 0);
!       accumulated_character = 0;
!       }
!
!       record_keyup (wParam, lParam);
        goto dflt;

      case WM_KEYDOWN:
***************
*** 4305,4310 ****
--- 4321,4333 ----
            wParam = VK_NUMLOCK;
          break;
        default:
+
+         if ((wParam >= VK_NUMPAD0 && wParam <= VK_NUMPAD9) &&
+             (modifier_set(VK_LMENU) || modifier_set(VK_RMENU)) &&
+             ! NILP(Vw32_alt_with_numerics_legacy)) {
+           accumulated_character = accumulated_character * 10 + wParam - 
VK_NUMPAD0;
+         }
+
          /* If not defined as a function key, change it to a WM_CHAR message. 
*/
          if (lispy_function_keys[wParam] == 0)
            {
***************
*** 13573,13578 ****
--- 13596,13607 ----
               "Non-nil if the alt key is to be considered the same as the meta 
key.\n\
  When nil, Emacs will translate the alt key to the Alt modifier, and not 
Meta.");
    Vw32_alt_is_meta = Qt;
+
+   DEFVAR_LISP ("w32-alt-with-numerics-legacy", &Vw32_alt_with_numerics_legacy,
+              "Non nil if alt key in combination with numbers on numeric 
keypad\n\
+    is recognized in accordance with DOS legacy; e.g. 034 with the\n\
+    Alt-key held down yields a double-quote mark (\").");
+   Vw32_alt_with_numerics_legacy = Qnil;

    DEFVAR_INT ("w32-quit-key", &Vw32_quit_key,
               "If non-zero, the virtual key code for an alternative quit 
key.");





reply via email to

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