modules/controller_linux_input.c basic wheel event support.

2004-06-16  Sven Neumann  <sven@gimp.org>

	* modules/controller_linux_input.c
	* etc/controllerrc: basic wheel event support.
This commit is contained in:
Sven Neumann 2004-06-16 02:39:15 +00:00 committed by Sven Neumann
parent 3474308cfe
commit 152a05c51a
3 changed files with 48 additions and 26 deletions

View File

@ -1,3 +1,8 @@
2004-06-16 Sven Neumann <sven@gimp.org>
* modules/controller_linux_input.c
* etc/controllerrc: preliminary wheel event support.
2004-06-16 Michael Natterer <mitch@gimp.org> 2004-06-16 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcontrollers.c: better debugging output. * app/widgets/gimpcontrollers.c: better debugging output.

View File

@ -17,14 +17,16 @@
(controller "ControllerLinuxInput" (controller "ControllerLinuxInput"
(options (options
(name "USB Device") (name "ShuttlePRO")
(device "/dev/input/event2")) (device "/dev/input/event2"))
(mapping 0 "tools-rect-select") (mapping 0 "tools-rect-select")
(mapping 1 "tools-ellipse-select") (mapping 1 "tools-ellipse-select")
(mapping 2 "tools-bucket-fill") (mapping 2 "tools-bucket-fill")
(mapping 3 "tools-blend") (mapping 3 "tools-blend")
(mapping 4 "tools-pencil") (mapping 4 "tools-pencil")
(mapping 5 "tools-paintbrush") (mapping 5 "tools-paintbrush")
(mapping 6 "tools-eraser") (mapping 6 "tools-eraser")
(mapping 7 "tools-airbrush")) (mapping 7 "tools-airbrush")
(mapping 13 "context-brush-radius-decrease")
(mapping 14 "context-brush-radius-increase"))

View File

@ -116,22 +116,21 @@ static const GimpModuleInfo linux_input_info =
static const LinuxInputEvent input_events[] = static const LinuxInputEvent input_events[] =
{ {
{ EV_KEY, BTN_0, N_("Button 0") }, { EV_KEY, BTN_0, N_("Button 0") },
{ EV_KEY, BTN_1, N_("Button 1") }, { EV_KEY, BTN_1, N_("Button 1") },
{ EV_KEY, BTN_2, N_("Button 2") }, { EV_KEY, BTN_2, N_("Button 2") },
{ EV_KEY, BTN_3, N_("Button 3") }, { EV_KEY, BTN_3, N_("Button 3") },
{ EV_KEY, BTN_4, N_("Button 4") }, { EV_KEY, BTN_4, N_("Button 4") },
{ EV_KEY, BTN_5, N_("Button 5") }, { EV_KEY, BTN_5, N_("Button 5") },
{ EV_KEY, BTN_6, N_("Button 6") }, { EV_KEY, BTN_6, N_("Button 6") },
{ EV_KEY, BTN_7, N_("Button 7") }, { EV_KEY, BTN_7, N_("Button 7") },
{ EV_KEY, BTN_8, N_("Button 8") }, { EV_KEY, BTN_8, N_("Button 8") },
{ EV_KEY, BTN_9, N_("Button 9") }, { EV_KEY, BTN_9, N_("Button 9") },
{ EV_KEY, BTN_LEFT, N_("Button Left") }, { EV_KEY, BTN_LEFT, N_("Button Left") },
{ EV_KEY, BTN_RIGHT, N_("Button Right") }, { EV_KEY, BTN_RIGHT, N_("Button Right") },
{ EV_KEY, BTN_MIDDLE, N_("Button Middle") }, { EV_KEY, BTN_MIDDLE, N_("Button Middle") },
{ EV_REL, REL_DIAL, N_("Dial (rel.)") }, { EV_REL, REL_WHEEL, N_("Wheel Turn Left") },
{ EV_REL, REL_WHEEL, N_("Wheel (rel.)") }, { EV_REL, REL_WHEEL, N_("Wheel Turn Right") },
{ EV_ABS, ABS_WHEEL, N_("Wheel (abs.)") }
}; };
static GType controller_type = 0; static GType controller_type = 0;
@ -337,7 +336,23 @@ linux_input_read_event (GIOChannel *io,
cevent.any.source = controller; cevent.any.source = controller;
cevent.any.event_id = i; 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; break;
} }