Re: One-Button iMac mouse
* Fri 21 Apr (01:34), Magnus Rosenbaum scrive:
> Jon Linnell wrote:
> > I want to know if there's some way of changing the controls so that
> > when you have a button down (CTRL, ALT etc.) and click the mouse you
> > get the contextual menu up.
>
> There is a patch:
> http://geekounet.org/patches/#linux-2.4.19-ctrl_click.patch
I've rewritten this patch for 2.6!
>
> Yes, it is as bit old... would be nice, if it would be integrated in mouseemu.
>
I attach it.
> cu, Magnum
>
Ciao
Bigo!
--
E' piu' facile modificare le specifiche per adeguarle al software piuttosto che viceversa. [Anonimo]
------------------------------------------------------
Registered Linux User # 365044
http://dust.homelinux.org/~bigo/index.html
Please don't send me any Micro$oft attachments!
------------------------------------------------------
--- linux-2.6.15.4.ORIG/drivers/input/input.c 2006-02-10 08:22:48.000000000 +0100
+++ linux-2.6.15.4/drivers/input/input.c 2006-03-11 15:03:14.000000000 +0100
@@ -48,6 +48,10 @@ static LIST_HEAD(input_handler_list);
static struct input_handler *input_table[8];
+#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;
@@ -73,6 +77,12 @@ void input_event(struct input_dev *dev,
break;
case EV_KEY:
+#ifdef CONFIG_MAC_EMUMOUSEBTN
+ if (mac_hid_mouse_emulate_buttons(2, code, value))
+ code = BTN_RIGHT;
+ if (mac_hid_mouse_emulate_buttons(3, code, value))
+ code = BTN_MIDDLE;
+#endif
if (code > KEY_MAX || !test_bit(code, dev->keybit) || !!test_bit(code, dev->key) == value)
return;
--- linux-2.6.15.4.ORIG/drivers/macintosh/mac_hid.c 2006-02-10 08:22:48.000000000 +0100
+++ linux-2.6.15.4/drivers/macintosh/mac_hid.c 2006-03-11 15:05:44.000000000 +0100
@@ -21,7 +21,11 @@ static int emumousebtn_input_register(vo
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 cclick_key_modifier = 0; /* disabled */
static int mouse_last_keycode = 0;
+static int rclick_key_modifier_down = 0;
+static int cclick_key_modifier_down = 0;
#if defined(CONFIG_SYSCTL)
/* file(s) in /proc/sys/dev/mac_hid */
@@ -50,6 +54,22 @@ ctl_table mac_hid_files[] = {
.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 = DEV_MAC_HID_CCLICK_KEY_MODIFIER,
+ .procname = "cclick_key_modifier",
+ .data = &cclick_key_modifier,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = &proc_dointvec,
+ },
{ .ctl_name = 0 }
};
@@ -98,6 +118,26 @@ int mac_hid_mouse_emulate_buttons(int ca
}
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;
+
+ if (cclick_key_modifier
+ && keycode == cclick_key_modifier)
+ cclick_key_modifier_down = down;
+
+ break;
+ case 3:
+ /* Called from input.c */
+ if (keycode == BTN_LEFT && cclick_key_modifier && cclick_key_modifier_down)
+ return 1;
+
break;
}
return 0;
--- linux-2.6.15.4.ORIG/include/linux/sysctl.h 2006-02-10 08:22:48.000000000 +0100
+++ linux-2.6.15.4/include/linux/sysctl.h 2006-03-11 14:58:02.000000000 +0100
@@ -836,7 +836,11 @@ enum {
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,
+ DEV_MAC_HID_CCLICK_KEY_MODIFIER=8
+
+
};
/* /proc/sys/dev/scsi */
--- linux-2.6.15.4.ORIG/drivers/macintosh/Kconfig 2006-02-10 08:22:48.000000000 +0100
+++ linux-2.6.15.4/drivers/macintosh/Kconfig 2006-03-11 15:20:27.000000000 +0100
@@ -133,6 +133,13 @@ config INPUT_ADBHID
If unsure, say Y.
+config ADB_TRACKPAD_ABSOLUTE
+ bool "Enable absolute mode for adb trackpads"
+ depends on INPUT_ADBHID
+ help
+ Enable absolute mode in adb-base trackpads. This feature adds
+ compatibility with synaptics Xorg / Xfree drivers.
+
config MAC_EMUMOUSEBTN
bool "Support for mouse button 2+3 emulation"
depends on INPUT_ADBHID
@@ -144,7 +151,17 @@ config MAC_EMUMOUSEBTN
/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
+ /proc/sys/dev/mac_hid/cclick_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.
+
+ cclick_key_modifier allows the kernel to handle "Key+LClick" as a
+ middle-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.
config THERM_WINDTUNNEL
Reply to: