* Fw: [PATCH] Right-click modifier
@ 2003-10-14 9:02 Colin Leroy
2003-10-14 9:36 ` Olaf Hering
0 siblings, 1 reply; 4+ messages in thread
From: Colin Leroy @ 2003-10-14 9:02 UTC (permalink / raw)
To: linuxppc-dev
[-- 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)"
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fw: [PATCH] Right-click modifier
2003-10-14 9:02 Fw: [PATCH] Right-click modifier Colin Leroy
@ 2003-10-14 9:36 ` Olaf Hering
2003-10-14 10:27 ` Colin Leroy
0 siblings, 1 reply; 4+ messages in thread
From: Olaf Hering @ 2003-10-14 9:36 UTC (permalink / raw)
To: Colin Leroy; +Cc: linuxppc-dev
On Tue, Oct 14, Colin Leroy wrote:
> [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.
Its certainly a nice thing, but all this mouse button emulation stuff
should be handled in userland. Its just the question how and where.
--
USB is for mice, FireWire is for men!
sUse lINUX ag, nÜRNBERG
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fw: [PATCH] Right-click modifier
2003-10-14 9:36 ` Olaf Hering
@ 2003-10-14 10:27 ` Colin Leroy
2003-10-14 11:34 ` Franz Sirl
0 siblings, 1 reply; 4+ messages in thread
From: Colin Leroy @ 2003-10-14 10:27 UTC (permalink / raw)
To: linuxppc-dev
On 14 Oct 2003 at 11h36, Olaf Hering wrote:
Hi,
> Its certainly a nice thing, but all this mouse button emulation stuff
> should be handled in userland. Its just the question how and where.
Any pointer about how it could be done?
--
Colin
http://ayttm.sf.net/
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fw: [PATCH] Right-click modifier
2003-10-14 10:27 ` Colin Leroy
@ 2003-10-14 11:34 ` Franz Sirl
0 siblings, 0 replies; 4+ messages in thread
From: Franz Sirl @ 2003-10-14 11:34 UTC (permalink / raw)
To: Colin Leroy; +Cc: linuxppc-dev
At 12:27 14.10.2003, Colin Leroy wrote:
>On 14 Oct 2003 at 11h36, Olaf Hering wrote:
>
>Hi,
>
> > Its certainly a nice thing, but all this mouse button emulation stuff
> > should be handled in userland. Its just the question how and where.
>
>Any pointer about how it could be done?
Well, all this button emulation stuff currently is a hack that should go
away, so Olaf is right here. Colin's patch itself is unacceptable to the
kernel people, so it would be a benh-tree only solution at best.
But since there is now the possibility to "grab" (input_grab_device()) away
input devices from the input handler chain, one could write a input device
kernel module that grabs keyboard and 1/2-button mice devices, massages the
events and gives them back to the input layer via input_event(). I guess
this is the only in-kernel solution acceptable to the kernel people.
Franz.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-10-14 11:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-14 9:02 Fw: [PATCH] Right-click modifier Colin Leroy
2003-10-14 9:36 ` Olaf Hering
2003-10-14 10:27 ` Colin Leroy
2003-10-14 11:34 ` Franz Sirl
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).