unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Swapping mouse buttons under X11
@ 2006-09-04 20:37 Christopher J. Madsen
  2006-09-10 13:47 ` Reiner Steib
  0 siblings, 1 reply; 2+ messages in thread
From: Christopher J. Madsen @ 2006-09-04 20:37 UTC (permalink / raw)


[-- Attachment #1: message body and .signature --]
[-- Type: text/plain, Size: 1083 bytes --]

I got used to using Emacs on Microsoft Windows with w32-swap-mouse-buttons
set to 't (which swaps mouse buttons 2 & 3).  I want to be able to get the
same behavior on GNU/Linux & X11.

I have attached a patch to illustrate what I'm trying to do.  The patch
works great (I've been using it on my system for years), but the problem
is that it has no UI.  It always swaps buttons 2 & 3.  Obviously, it needs
a UI before it can be merged.

The question is what kind of UI it should have.  I'm aware of two
variables that have similar behavior: mac-wheel-button-is-mouse-2 and
w32-swap-mouse-buttons.  They do the same thing, except the sense is
reversed.

I see several possibilities:

1. Add x-swap-mouse-buttons (acts like w32-swap-mouse-buttons).

2. Add x-mouse-button-array (lets you remap buttons in any way you choose).

3. Replace existing vars with swap-mouse-buttons.

4. Replace existing vars with mouse-button-array.

Any comments?

-- 
Chris Madsen                                            cjm@pobox.com
  ------------------  http://www.pobox.com/~cjm  ------------------

[-- Attachment #2: Patch to xterm.c --]
[-- Type: text/plain, Size: 1888 bytes --]

*** xterm.c	Sat Jan  3 11:51:04 2004
--- xterm.c	Sat Jan  3 11:57:41 2004
***************
*** 371,376 ****
--- 371,391 ----
                                    int *));
  
  
+ /* CJM added x_get_button_num 9/18/02 */
+ static int x_button_numbers[] = { 0, 2, 1 };
+ 
+ static int
+ x_get_button_num (button)
+   int button;
+ {
+   button -= Button1;
+   if ((button >= 0) && (button < sizeof(x_button_numbers)/sizeof(x_button_numbers[0])))
+     return x_button_numbers[button];
+   else
+     return button;
+ }
+ 
+ 
  /* Flush display of frame F, or of all frames if F is null.  */
  
  static void
***************
*** 3498,3504 ****
    /* Make the event type NO_EVENT; we'll change that when we decide
       otherwise.  */
    result->kind = MOUSE_CLICK_EVENT;
!   result->code = event->button - Button1;
    result->timestamp = event->time;
    result->modifiers = (x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f),
  					       event->state)
--- 3513,3519 ----
    /* Make the event type NO_EVENT; we'll change that when we decide
       otherwise.  */
    result->kind = MOUSE_CLICK_EVENT;
!   result->code = x_get_button_num(event->button);
    result->timestamp = event->time;
    result->modifiers = (x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO (f),
  					       event->state)
***************
*** 5301,5307 ****
      abort ();
  
    emacs_event->kind = SCROLL_BAR_CLICK_EVENT;
!   emacs_event->code = event->xbutton.button - Button1;
    emacs_event->modifiers
      = (x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO
  			       (XFRAME (WINDOW_FRAME (XWINDOW (bar->window)))),
--- 5316,5322 ----
      abort ();
  
    emacs_event->kind = SCROLL_BAR_CLICK_EVENT;
!   emacs_event->code = x_get_button_num(event->xbutton.button);
    emacs_event->modifiers
      = (x_x_to_emacs_modifiers (FRAME_X_DISPLAY_INFO
  			       (XFRAME (WINDOW_FRAME (XWINDOW (bar->window)))),

[-- Attachment #3: Type: text/plain, Size: 149 bytes --]

_______________________________________________
bug-gnu-emacs mailing list
bug-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-10 13:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-04 20:37 Swapping mouse buttons under X11 Christopher J. Madsen
2006-09-10 13:47 ` Reiner Steib

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).