* Enhancement for Emacs on Mac OSX @ 2004-02-05 12:49 Piet van Oostrum 2004-02-05 15:14 ` Kim F. Storm 2004-02-13 4:29 ` Three-button mouse emulation on OSX (was Re: Enhancement for Emacs on Mac OSX) Steven Tamm 0 siblings, 2 replies; 5+ messages in thread From: Piet van Oostrum @ 2004-02-05 12:49 UTC (permalink / raw) I have some code in my private emacs copy for emulation a three-button mouse on a Mac with a one-button mouse. Basically the same as it is done in X11: Alt-mouse for the middle button and Command-mouse for the right button, or the other way around, depending on a variable. I would like to ask to include this code in CVS. I have no CVS access, but I signed copyright papers (how do you call them) centuries ago (Well, the last century). Can I post this code here, or gain CVS access? As I am using this emacs all day, I can also do some debugging. Regards, -- Piet van Oostrum <piet@cs.uu.nl> URL: http://www.cs.uu.nl/~piet [PGP] Private email: P.van.Oostrum@hccnet.nl ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Enhancement for Emacs on Mac OSX 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 2004-02-13 4:29 ` Three-button mouse emulation on OSX (was Re: Enhancement for Emacs on Mac OSX) Steven Tamm 1 sibling, 1 reply; 5+ messages in thread From: Kim F. Storm @ 2004-02-05 15:14 UTC (permalink / raw) Cc: emacs-devel Piet van Oostrum <piet@cs.uu.nl> writes: > I have no CVS access, but I signed > copyright papers (how do you call them) centuries ago You have signed a disclaimer for changes for emacs on HP-UX back in 1990. I don't see a general assignment for emacs, so you might have to sign new papers. RMS will tell you. > (Well, the last > century). Can I post this code here, or gain CVS access? I suggest you post your patches here. Then we also get a chance to look at them before they are committed. Remember to include a ChangeLog entry for your changes. -- Kim F. Storm <storm@cua.dk> http://www.cua.dk ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Enhancement for Emacs on Mac OSX 2004-02-05 15:14 ` Kim F. Storm @ 2004-02-05 23:48 ` Piet van Oostrum 2004-02-07 9:01 ` Richard Stallman 0 siblings, 1 reply; 5+ messages in thread From: Piet van Oostrum @ 2004-02-05 23:48 UTC (permalink / raw) 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Enhancement for Emacs on Mac OSX 2004-02-05 23:48 ` Piet van Oostrum @ 2004-02-07 9:01 ` Richard Stallman 0 siblings, 0 replies; 5+ messages in thread From: Richard Stallman @ 2004-02-07 9:01 UTC (permalink / raw) Cc: emacs-devel This is large enough that we need some sort of legal papers for it. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Three-button mouse emulation on OSX (was Re: Enhancement for Emacs on Mac OSX) 2004-02-05 12:49 Enhancement for Emacs on Mac OSX Piet van Oostrum 2004-02-05 15:14 ` Kim F. Storm @ 2004-02-13 4:29 ` Steven Tamm 1 sibling, 0 replies; 5+ messages in thread From: Steven Tamm @ 2004-02-13 4:29 UTC (permalink / raw) Cc: emacs-devel So I'm getting around to look at this and I have a couple suggestions: - I don't like the use of positive and negative numbers to represent the variable. I'd much rather have symbols like nil, t, and "reverse" (or something like that). "t" would correspond to the Apple X11 implementation where option is the middle button and command is the right button (what was positive in your implementation). "reverse" is self-explanatory. - What should happen if both option and command is clicked? With X11, the mouse-3 wins, that should probably be the behavior (in the patch, option wins). - Right now the patch here would require carbon events (i.e. it wouldn't work on OS9). Is anyone out there using OS9 that would like 3-button emulation? Is anyone using emacs with OS9? The change would be fairly trivial, but I'd like some testing since I don't even have classic installed. All opinions welcome, -Steven On Feb 5, 2004, at 4:49 AM, Piet van Oostrum wrote: > I have some code in my private emacs copy for emulation a three-button > mouse on a Mac with a one-button mouse. Basically the same as it is > done > in X11: Alt-mouse for the middle button and Command-mouse for the right > button, or the other way around, depending on a variable. I would like > to > ask to include this code in CVS. I have no CVS access, but I signed > copyright papers (how do you call them) centuries ago (Well, the last > century). Can I post this code here, or gain CVS access? > > As I am using this emacs all day, I can also do some debugging. > > Regards, > -- > Piet van Oostrum <piet@cs.uu.nl> > URL: http://www.cs.uu.nl/~piet [PGP] > Private email: P.van.Oostrum@hccnet.nl ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-02-13 4:29 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 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
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).