Hi.
Motivated by a post I read once about a braille display with a scroll wheel
I just hacked up mouse wheel support for BRLTTY key tables. This isn't exactly
ment to be integrated as is into the repository but rather as a way
to play with the idea in general, to see if it ergonomically makes sense,
or if it is a creeping featurism.
With the attached patch, you can bind mouse wheel action in your ktb file like
this:
bind MOUSE_WheelUp LNUP
bind MOUSE_WheelDown LNDN
If you are interested to try this, apply the attached patch to the svn
repository and recompile. Please let me know about your experiences
from an ergonomical standpoint.
diff --git a/Programs/config.c b/Programs/config.c
index 18eb447..f35f6ff 100644
--- a/Programs/config.c
+++ b/Programs/config.c
@@ -684,6 +684,12 @@ handleKeyEvent (const KeyCodeSet *modifiers, KeyCode code, int press) {
int command = getKeyCommand(keyTable, modifiers, code);
int bound = command != EOF;
+ if (bound && (code == KEY_MOUSE_WheelUp) || (code == KEY_MOUSE_WheelDown)) {
+ while (press--) {
+ enqueueCommand(command);
+ }
+ return PKS_NO;
+ }
if (!press || !bound) {
if (lastCommand != EOF) {
lastCommand = EOF;
diff --git a/Programs/keycodes.h b/Programs/keycodes.h
index 4fb2e93..88c76ed 100644
--- a/Programs/keycodes.h
+++ b/Programs/keycodes.h
@@ -248,6 +248,9 @@ typedef enum {
KEY_FUNCTION_CrSel_Props,
KEY_FUNCTION_ExSel,
+ KEY_MOUSE_WheelUp,
+ KEY_MOUSE_WheelDown,
+
KeyCodeCount
} KeyCode;
diff --git a/Programs/ktb_compile.c b/Programs/ktb_compile.c
index c7e8f84..10e9cb4 100644
--- a/Programs/ktb_compile.c
+++ b/Programs/ktb_compile.c
@@ -293,6 +293,9 @@ static const KeyNameEntry keyNameTable[] = {
{"FUNCTION_CrSel_Props", KEY_FUNCTION_CrSel_Props},
{"FUNCTION_ExSel", KEY_FUNCTION_ExSel},
+ {"MOUSE_WheelUp", KEY_MOUSE_WheelUp},
+ {"MOUSE_WheelDown", KEY_MOUSE_WheelDown},
+
{NULL, KEY_SPECIAL_None}
};
diff --git a/Programs/sys_kbd_linux.h b/Programs/sys_kbd_linux.h
index 74df634..9aacab7 100644
--- a/Programs/sys_kbd_linux.h
+++ b/Programs/sys_kbd_linux.h
@@ -592,6 +592,19 @@ handleKeyboardEvent (const AsyncInputResult *result) {
break;
}
}
+ } else if (event->type == EV_REL) {
+ int value = event->value;
+ int direction = event->value > 0;
+ static const KeyCode map[REL_MAX][2] = {
+ [REL_WHEEL] = {KEY_MOUSE_WheelDown, KEY_MOUSE_WheelUp},
+ };
+ KeyCode code = map[event->code][direction];
+
+ if (code) {
+ PressedKeysState state;
+
+ state = kpd->kcd->handleKeyEvent(&kpd->pressedKeys, code, direction? value: -value);
+ }
} else {
writeInputEvent(event);
}
@@ -654,7 +667,8 @@ monitorKeyboard (int device, KeyboardCommonData *kcd) {
}
if (checkKeyboardProperties(&kpd->actualProperties, &kcd->requiredProperties)) {
- if (hasInputEvent(device, EV_KEY, KEY_ENTER, KEY_MAX)) {
+ if (hasInputEvent(device, EV_KEY, KEY_ENTER, KEY_MAX) ||
+ hasInputEvent(device, EV_REL, REL_WHEEL, REL_MAX)) {
if (asyncRead(device, sizeof(struct input_event), handleKeyboardEvent, kpd)) {
#ifdef EVIOCGRAB
ioctl(device, EVIOCGRAB, 1);
--
CYa,
⡍⠁⠗⠊⠕ | Debian Developer <URL:http://debian.org/>
.''`. | Get my public key via finger mlang/[email protected]
: :' : | 1024D/7FC1A0854909BCCDBE6C102DDFFC022A6B113E44
`. `'
`- <URL:http://delysid.org/> <URL:http://www.staff.tugraz.at/mlang/>
_______________________________________________
This message was sent via the BRLTTY mailing list.
To post a message, send an e-mail to: [email protected]
For general information, go to: http://mielke.cc/mailman/listinfo/brltty