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>
* app/widgets/gimpcontrollers.c: better debugging output.

View File

@ -17,7 +17,7 @@
(controller "ControllerLinuxInput"
(options
(name "USB Device")
(name "ShuttlePRO")
(device "/dev/input/event2"))
(mapping 0 "tools-rect-select")
(mapping 1 "tools-ellipse-select")
@ -26,5 +26,7 @@
(mapping 4 "tools-pencil")
(mapping 5 "tools-paintbrush")
(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

@ -129,9 +129,8 @@ static const LinuxInputEvent input_events[] =
{ 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_REL, REL_WHEEL, N_("Wheel Turn Left") },
{ EV_REL, REL_WHEEL, N_("Wheel Turn Right") },
};
static GType controller_type = 0;
@ -337,8 +336,24 @@ linux_input_read_event (GIOChannel *io,
cevent.any.source = controller;
cevent.any.event_id = i;
/* 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;
}
}