linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Colin Leroy" <colin@colino.net>
To: <linuxppc-dev@lists.linuxppc.org>
Subject: Fw: [PATCH] Right-click modifier
Date: Tue, 14 Oct 2003 11:02:15 +0200	[thread overview]
Message-ID: <02cc01c39231$dce0d200$3cc8a8c0@ANOSP> (raw)

[-- Attachment #1: Type: text/plain, Size: 501 bytes --]

[Forwarding, just in case.]

> Hi,
>
> this patch adds an entry in /proc,
> /proc/sys/dev/mac_hid/rclick_key_modifier.
>
> It lets the kernel report a right-click when KEY+Left click are pressed,
> where KEY is the KEY specified by echoing its code to the /proc entry.
>
> ie, "echo 29 > /proc/sys/dev/mac_hid/rclick_key_modifier" and you'll
have
> Ctrl-click = right click.
>
> It's a patch against linuxppc-2.5-benh tree rsync'ed tonight from
> source.mvista.com.
>
> hope it's useful,
> --
> Colin

[-- Attachment #2: rclick_key_modifier.patch --]
[-- Type: application/octet-stream, Size: 3641 bytes --]

--- linuxppc-2.5-benh/drivers/input/input.c.orig	Mon Oct 13 23:04:52 2003
+++ linuxppc-2.5-benh/drivers/input/input.c	Mon Oct 13 23:06:46 2003
@@ -63,6 +63,10 @@
 }
 
 
+#ifdef CONFIG_MAC_EMUMOUSEBTN
+extern int mac_hid_mouse_emulate_buttons(int,int,int);
+#endif
+
 void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
 {
 	struct input_handle *handle;
@@ -91,7 +95,10 @@
 			break;
 
 		case EV_KEY:
-
+#ifdef CONFIG_MAC_EMUMOUSEBTN
+			if (mac_hid_mouse_emulate_buttons(2, code, value))
+				code = BTN_RIGHT;
+#endif
 			if (code > KEY_MAX || !test_bit(code, dev->keybit) || !!test_bit(code, dev->key) == value)
 				return;
 
--- linuxppc-2.5-benh/drivers/macintosh/mac_hid.c.orig	Mon Oct 13 23:04:46 2003
+++ linuxppc-2.5-benh/drivers/macintosh/mac_hid.c	Mon Oct 13 23:05:40 2003
@@ -21,7 +21,9 @@
 static int mouse_emulate_buttons = 0;
 static int mouse_button2_keycode = KEY_RIGHTCTRL;	/* right control key */
 static int mouse_button3_keycode = KEY_RIGHTALT;	/* right option key */
+static int rclick_key_modifier   = 0;			/* disabled */
 static int mouse_last_keycode = 0;
+static int rclick_key_modifier_down = 0;
 
 #if defined(CONFIG_SYSCTL)
 /* file(s) in /proc/sys/dev/mac_hid */
@@ -50,6 +52,14 @@
 		.mode		= 0644,
 		.proc_handler	= &proc_dointvec,
 	},
+	{
+		.ctl_name       = DEV_MAC_HID_RCLICK_KEY_MODIFIER,
+		.procname       = "rclick_key_modifier",
+		.data           = &rclick_key_modifier,
+		.maxlen         = sizeof(int),
+                .mode           = 0644,
+		.proc_handler   = &proc_dointvec,
+	},
 	{ .ctl_name = 0 }
 };
 
@@ -98,6 +108,15 @@
 			}
 			mouse_last_keycode = down ? keycode : 0;
 		}
+		if (rclick_key_modifier 
+		    && keycode == rclick_key_modifier)
+			rclick_key_modifier_down = down;
+
+		break;
+	case 2:
+		/* Called from input.c */
+		if (keycode == BTN_LEFT && rclick_key_modifier && rclick_key_modifier_down)
+			return 1;
 		break;
 	}
 	return 0;
--- linuxppc-2.5-benh/include/linux/sysctl.h.orig	Mon Oct 13 23:05:33 2003
+++ linuxppc-2.5-benh/include/linux/sysctl.h	Mon Oct 13 23:05:40 2003
@@ -681,7 +681,8 @@
 	DEV_MAC_HID_MOUSE_BUTTON_EMULATION=3,
 	DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE=4,
 	DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE=5,
-	DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6
+	DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6,
+	DEV_MAC_HID_RCLICK_KEY_MODIFIER=7
 };
 
 /* /proc/sys/dev/scsi */
--- linuxppc-2.5-benh/arch/ppc/Kconfig.orig	Mon Oct 13 23:05:00 2003
+++ linuxppc-2.5-benh/arch/ppc/Kconfig	Mon Oct 13 23:05:40 2003
@@ -1243,6 +1243,11 @@
 	  /proc/sys/dev/mac_hid/mouse_button_emulation
 	  /proc/sys/dev/mac_hid/mouse_button2_keycode
 	  /proc/sys/dev/mac_hid/mouse_button3_keycode
+	  /proc/sys/dev/mac_hid/rclick_key_modifier
+
+	  rclick_key_modifier allows the kernel to handle "Key+LClick" as a 
+	  right-click. It's disabled by default. Echo a keycode to it to 
+	  enable it.
 
 	  If you have an Apple machine with a 1-button mouse, say Y here.
 
--- linuxppc-2.5-benh/arch/m68k/Kconfig.orig	Mon Oct 13 23:05:18 2003
+++ linuxppc-2.5-benh/arch/m68k/Kconfig	Mon Oct 13 23:05:40 2003
@@ -932,6 +932,11 @@
 	  /proc/sys/dev/mac_hid/mouse_button_emulation
 	  /proc/sys/dev/mac_hid/mouse_button2_keycode
 	  /proc/sys/dev/mac_hid/mouse_button3_keycode
+ 	  /proc/sys/dev/mac_hid/rclick_key_modifier
+ 
+	  rclick_key_modifier allows the kernel to handle "Key+LClick" as a 
+	  right-click. It's disabled by default. Echo a keycode to it to 
+	  enable it.
 
 config ADB_KEYBOARD
 	bool "Support for ADB keyboard (old driver)"

             reply	other threads:[~2003-10-14  9:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-14  9:02 Colin Leroy [this message]
2003-10-14  9:36 ` Fw: [PATCH] Right-click modifier Olaf Hering
2003-10-14 10:27   ` Colin Leroy
2003-10-14 11:34     ` Franz Sirl

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='02cc01c39231$dce0d200$3cc8a8c0@ANOSP' \
    --to=colin@colino.net \
    --cc=linuxppc-dev@lists.linuxppc.org \
    /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.
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 NNTP newsgroup(s).