From: Piet van Oostrum <piet@cs.uu.nl>
Subject: Re: Enhancement for Emacs on Mac OSX
Date: 06 Feb 2004 00:48:11 +0100 [thread overview]
Message-ID: <wzptct6qbo.fsf@cs.uu.nl> (raw)
In-Reply-To: <m3vfmld0df.fsf@kfs-l.imdomain.dk>
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 <piet@cs.uu.nl>
+
+ * 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 <jan.h.d@swipnet.se>
* 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 <piet@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum@hccnet.nl
next prev parent reply other threads:[~2004-02-05 23:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-05 12:49 Enhancement for Emacs on Mac OSX Piet van Oostrum
2004-02-05 15:14 ` Kim F. Storm
2004-02-05 23:48 ` Piet van Oostrum [this message]
2004-02-07 9:01 ` Richard Stallman
2004-02-13 4:29 ` Three-button mouse emulation on OSX (was Re: Enhancement for Emacs on Mac OSX) Steven Tamm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=wzptct6qbo.fsf@cs.uu.nl \
--to=piet@cs.uu.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).