From 152a05c51a6dec90ae1efe9b6bce0aaf01fb8232 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Wed, 16 Jun 2004 02:39:15 +0000 Subject: [PATCH] modules/controller_linux_input.c basic wheel event support. 2004-06-16 Sven Neumann * modules/controller_linux_input.c * etc/controllerrc: basic wheel event support. --- ChangeLog | 5 ++++ etc/controllerrc | 20 +++++++------ modules/controller_linux_input.c | 49 +++++++++++++++++++++----------- 3 files changed, 48 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2750cae393..6814fae695 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-06-16 Sven Neumann + + * modules/controller_linux_input.c + * etc/controllerrc: preliminary wheel event support. + 2004-06-16 Michael Natterer * app/widgets/gimpcontrollers.c: better debugging output. diff --git a/etc/controllerrc b/etc/controllerrc index 6193bb3642..1ba69be913 100644 --- a/etc/controllerrc +++ b/etc/controllerrc @@ -17,14 +17,16 @@ (controller "ControllerLinuxInput" (options - (name "USB Device") + (name "ShuttlePRO") (device "/dev/input/event2")) - (mapping 0 "tools-rect-select") - (mapping 1 "tools-ellipse-select") - (mapping 2 "tools-bucket-fill") - (mapping 3 "tools-blend") - (mapping 4 "tools-pencil") - (mapping 5 "tools-paintbrush") - (mapping 6 "tools-eraser") - (mapping 7 "tools-airbrush")) + (mapping 0 "tools-rect-select") + (mapping 1 "tools-ellipse-select") + (mapping 2 "tools-bucket-fill") + (mapping 3 "tools-blend") + (mapping 4 "tools-pencil") + (mapping 5 "tools-paintbrush") + (mapping 6 "tools-eraser") + (mapping 7 "tools-airbrush") + (mapping 13 "context-brush-radius-decrease") + (mapping 14 "context-brush-radius-increase")) diff --git a/modules/controller_linux_input.c b/modules/controller_linux_input.c index 2913381e08..c06806c166 100644 --- a/modules/controller_linux_input.c +++ b/modules/controller_linux_input.c @@ -116,22 +116,21 @@ static const GimpModuleInfo linux_input_info = static const LinuxInputEvent input_events[] = { - { EV_KEY, BTN_0, N_("Button 0") }, - { EV_KEY, BTN_1, N_("Button 1") }, - { EV_KEY, BTN_2, N_("Button 2") }, - { EV_KEY, BTN_3, N_("Button 3") }, - { EV_KEY, BTN_4, N_("Button 4") }, - { EV_KEY, BTN_5, N_("Button 5") }, - { EV_KEY, BTN_6, N_("Button 6") }, - { EV_KEY, BTN_7, N_("Button 7") }, - { EV_KEY, BTN_8, N_("Button 8") }, - { EV_KEY, BTN_9, N_("Button 9") }, - { EV_KEY, BTN_LEFT, N_("Button Left") }, - { EV_KEY, BTN_RIGHT, N_("Button Right") }, - { EV_KEY, BTN_MIDDLE, N_("Button Middle") }, - { EV_REL, REL_DIAL, N_("Dial (rel.)") }, - { EV_REL, REL_WHEEL, N_("Wheel (rel.)") }, - { EV_ABS, ABS_WHEEL, N_("Wheel (abs.)") } + { EV_KEY, BTN_0, N_("Button 0") }, + { EV_KEY, BTN_1, N_("Button 1") }, + { EV_KEY, BTN_2, N_("Button 2") }, + { EV_KEY, BTN_3, N_("Button 3") }, + { EV_KEY, BTN_4, N_("Button 4") }, + { EV_KEY, BTN_5, N_("Button 5") }, + { EV_KEY, BTN_6, N_("Button 6") }, + { EV_KEY, BTN_7, N_("Button 7") }, + { EV_KEY, BTN_8, N_("Button 8") }, + { EV_KEY, BTN_9, N_("Button 9") }, + { EV_KEY, BTN_LEFT, N_("Button Left") }, + { EV_KEY, BTN_RIGHT, N_("Button Right") }, + { EV_KEY, BTN_MIDDLE, N_("Button Middle") }, + { EV_REL, REL_WHEEL, N_("Wheel Turn Left") }, + { EV_REL, REL_WHEEL, N_("Wheel Turn Right") }, }; static GType controller_type = 0; @@ -337,7 +336,23 @@ linux_input_read_event (GIOChannel *io, cevent.any.source = controller; cevent.any.event_id = i; - gimp_controller_event (controller, &cevent); + /* EEEEEEK */ + if (ev.code == REL_WHEEL) + { + gint count; + + for (count = ev.value; count < 0; count++) + gimp_controller_event (controller, &cevent); + + cevent.any.event_id++; + + for (count = ev.value; count > 0; count--) + gimp_controller_event (controller, &cevent); + } + else + { + gimp_controller_event (controller, &cevent); + } break; }