From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Piet van Oostrum Newsgroups: gmane.emacs.devel Subject: Re: Enhancement for Emacs on Mac OSX Date: 06 Feb 2004 00:48:11 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1076025011 22579 80.91.224.253 (5 Feb 2004 23:50:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 5 Feb 2004 23:50:11 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Feb 06 00:50:00 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AotFw-0007Rc-00 for ; Fri, 06 Feb 2004 00:50:00 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AotFv-0006qS-00 for ; Fri, 06 Feb 2004 00:49:59 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AotFN-0005PW-8C for emacs-devel@quimby.gnus.org; Thu, 05 Feb 2004 18:49:25 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AotF1-0005Ho-Mx for emacs-devel@gnu.org; Thu, 05 Feb 2004 18:49:03 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AotED-0004Hn-HZ for emacs-devel@gnu.org; Thu, 05 Feb 2004 18:48:44 -0500 Original-Received: from [213.116.124.235] (helo=ordesa.cs.uu.nl) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AotEC-0004He-MJ for emacs-devel@gnu.org; Thu, 05 Feb 2004 18:48:12 -0500 Original-Received: from ordesa (localhost [127.0.0.1]) by ordesa.cs.uu.nl (Postfix) with ESMTP id C9E9BBDCEB for ; Fri, 6 Feb 2004 00:48:14 +0100 (CET) X-Mailer: emacs 21.3.50.1 (via feedmail 8 I) Original-To: emacs-devel@gnu.org In-Reply-To: Original-Lines: 106 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:19759 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:19759 Here are the diffs: Index: src/ChangeLog =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 + + * 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=E4rv =20 * xterm.h: Add declaration of free_frame_menubar. Index: src/macterm.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 =3D 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 =20 /* convert input from Mac keyboard (assumed to be in Mac Roman coding) @@ -6542,6 +6548,19 @@ UInt32 mods =3D 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 &&=20 + GetEventClass (eventRef) =3D=3D kEventClassMouse) + {=20 + UInt32 kind =3D GetEventKind (eventRef); + if (kind =3D=3D kEventMouseDown || kind =3D=3D kEventMouseUp) + { + if (!(mods & macAltKey)) + mods &=3D ~macMetaKey; + mods &=3D ~macAltKey; + } + } return mac_to_emacs_modifiers (mods); } =20 @@ -6551,11 +6570,20 @@ mac_get_mouse_btn (EventRef ref) { EventMouseButton result =3D kEventMouseButtonPrimary; + UInt32 mods =3D 0; GetEventParameter (ref, kEventParamMouseButton, typeMouseButton, NULL, sizeof (EventMouseButton), NULL, &result); switch (result) { case kEventMouseButtonPrimary: + if (Vmac_emulate_three_button_mouse =3D=3D 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 =3D Qt; + + DEFVAR_INT ("mac-emulate-three-button-mouse", &Vmac_emulate_three_button= _mouse, + doc: /* Emulation of three button mouse: + if =3D 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 =3D 0; #endif =20 DEFVAR_INT ("mac-keyboard-text-encoding", &mac_keyboard_text_encoding, --=20 Piet van Oostrum URL: http://www.cs.uu.nl/~piet [PGP] Private email: P.van.Oostrum@hccnet.nl