emacs-devel
[Top][All Lists]
Advanced

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

Re: Enhancement for Emacs on Mac OSX


From: Piet van Oostrum
Subject: Re: Enhancement for Emacs on Mac OSX
Date: 06 Feb 2004 00:48:11 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Here are the diffs:

Index: src/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/src/ChangeLog,v
retrieving revision 1.3519
diff -u -r1.3519 ChangeLog
--- src/ChangeLog       5 Feb 2004 13:01:13 -0000       1.3519
+++ src/ChangeLog       5 Feb 2004 23:38:07 -0000
@@ -1,3 +1,11 @@
+2004-02-06  Piet van Oostrum  <address@hidden>
+
+       * macterm.c (mac-emulate-three-button-mouse,
+                 Vmac_emulate_three_button_mouse,
+                 mac_event_to_emacs_modifiers, mac_get_mouse_btn):
+                         Emulate three button mouse with Alt (Option) and
+                                 Cmd (Meta) keys.
+
 2004-02-05  Jan Djärv  <address@hidden>
 
        * xterm.h: Add declaration of free_frame_menubar.

Index: src/macterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/macterm.c,v
retrieving revision 1.57
diff -u -r1.57 macterm.c
--- src/macterm.c       27 Jan 2004 07:32:41 -0000      1.57
+++ src/macterm.c       5 Feb 2004 23:34:38 -0000
@@ -6473,6 +6473,12 @@
 /* If Non-nil, the Mac "Control" key is passed on to the Mac Toolbox
    for processing before Emacs sees it.  */
 Lisp_Object Vmac_pass_control_to_system;
+
+/* Emulation of three button mouse:
+   if = 0, no emulation,
+   if > 0, Option-mouse is mouse-2 and Command-mouse is mouse-3
+   if < 0, Option-mouse is mouse-3 and Command-mouse is mouse-2.  */
+Lisp_Object Vmac_emulate_three_button_mouse;
 #endif
 
 /* convert input from Mac keyboard (assumed to be in Mac Roman coding)
@@ -6542,6 +6548,19 @@
   UInt32 mods = 0;
   GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, NULL,
                    sizeof (UInt32), NULL, &mods);
+  /* If emulating three button mouse and mouse up or down
+     then remove the alt and meta modifiers */
+  if (Vmac_emulate_three_button_mouse && 
+      GetEventClass (eventRef) == kEventClassMouse)
+    { 
+      UInt32 kind = GetEventKind (eventRef);
+      if (kind == kEventMouseDown || kind == kEventMouseUp)
+       {
+         if (!(mods & macAltKey))
+           mods &= ~macMetaKey;
+         mods &= ~macAltKey;
+       }
+    }
   return mac_to_emacs_modifiers (mods);
 }
 
@@ -6551,11 +6570,20 @@
 mac_get_mouse_btn (EventRef ref)
 {
   EventMouseButton result = kEventMouseButtonPrimary;
+  UInt32 mods = 0;
   GetEventParameter (ref, kEventParamMouseButton, typeMouseButton, NULL,
                    sizeof (EventMouseButton), NULL, &result);
   switch (result)
     {
     case kEventMouseButtonPrimary:
+      if (Vmac_emulate_three_button_mouse == 0)
+       return 0;
+      GetEventParameter (ref, kEventParamKeyModifiers, typeUInt32, NULL,
+                        sizeof (UInt32), NULL, &mods);
+      if (mods & macAltKey)
+       return Vmac_emulate_three_button_mouse > 0 ? 1 : 2;
+      if (mods & macMetaKey)
+       return Vmac_emulate_three_button_mouse > 0 ? 2 : 1;
       return 0;
     case kEventMouseButtonSecondary:
       return NILP (Vmac_wheel_button_is_mouse_2) ? 1 : 2;
@@ -8695,6 +8723,17 @@
    doc: /* If non-nil, the Mac \"Control\" key is passed on to the Mac
 Toolbox for processing before Emacs sees it.  */);
   Vmac_pass_control_to_system = Qt;
+
+  DEFVAR_INT ("mac-emulate-three-button-mouse", 
&Vmac_emulate_three_button_mouse,
+   doc: /* Emulation of three button mouse:
+   if = 0, no emulation;
+   if > 0, Alt-mouse is mouse-2 and Meta-mouse is mouse-3;
+   if < 0, Alt-mouse is mouse-3 and Meta-mouse is mouse-2.
+   When both Alt and Meta are pressed, Alt determines the button and
+   Meta is added as modifier.
+   Which key is Alt and which is Meta, is determined by
+   mac-reverse-ctrl-meta and mac-command-key-is-meta.*/);
+  Vmac_emulate_three_button_mouse = 0;
 #endif
 
   DEFVAR_INT ("mac-keyboard-text-encoding", &mac_keyboard_text_encoding,

-- 
Piet van Oostrum <address@hidden>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: address@hidden




reply via email to

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