emit GIMP_CONTROLLER_EVENT_VALUE, not TRIGGER for movements on relative

2007-02-09  Michael Natterer  <mitch@gimp.org>

	* modules/controller_linux_input.c (linux_input_read_event): emit
	GIMP_CONTROLLER_EVENT_VALUE, not TRIGGER for movements on relative
	axes. Reduces the number of events significantly. Now we can start
	thinking what to do with them...


svn path=/trunk/; revision=21885
This commit is contained in:
Michael Natterer
2007-02-09 21:58:16 +00:00
committed by Michael Natterer
parent f5f93181da
commit 9efbdbe5fd
2 changed files with 24 additions and 14 deletions

View File

@ -1,3 +1,10 @@
2007-02-09 Michael Natterer <mitch@gimp.org>
* modules/controller_linux_input.c (linux_input_read_event): emit
GIMP_CONTROLLER_EVENT_VALUE, not TRIGGER for movements on relative
axes. Reduces the number of events significantly. Now we can start
thinking what to do with them...
2007-02-09 Michael Natterer <mitch@gimp.org> 2007-02-09 Michael Natterer <mitch@gimp.org>
* app/plug-in/gimpenvirontable.c: renamed newly added functions to * app/plug-in/gimpenvirontable.c: renamed newly added functions to

View File

@ -468,17 +468,17 @@ linux_input_read_event (GIOChannel *io,
if (n_bytes == sizeof (struct input_event)) if (n_bytes == sizeof (struct input_event))
{ {
GimpController *controller = GIMP_CONTROLLER (data);
GimpControllerEvent cevent;
switch (ev.type) switch (ev.type)
{ {
case EV_KEY: case EV_KEY:
for (i = 0; i < G_N_ELEMENTS (key_events); i++) for (i = 0; i < G_N_ELEMENTS (key_events); i++)
if (ev.code == key_events[i].code) if (ev.code == key_events[i].code)
{ {
GimpController *controller = GIMP_CONTROLLER (data);
GimpControllerEvent cevent;
cevent.any.type = GIMP_CONTROLLER_EVENT_TRIGGER; cevent.any.type = GIMP_CONTROLLER_EVENT_TRIGGER;
cevent.any.source = GIMP_CONTROLLER (data); cevent.any.source = controller;
cevent.any.event_id = i; cevent.any.event_id = i;
gimp_controller_event (controller, &cevent); gimp_controller_event (controller, &cevent);
@ -491,20 +491,23 @@ linux_input_read_event (GIOChannel *io,
for (i = 0; i < G_N_ELEMENTS (rel_events); i++) for (i = 0; i < G_N_ELEMENTS (rel_events); i++)
if (ev.code == rel_events[i].code) if (ev.code == rel_events[i].code)
{ {
GimpController *controller = GIMP_CONTROLLER (data); cevent.any.type = GIMP_CONTROLLER_EVENT_VALUE;
GimpControllerEvent cevent;
gint count;
cevent.any.type = GIMP_CONTROLLER_EVENT_TRIGGER;
cevent.any.source = controller; cevent.any.source = controller;
cevent.any.event_id = G_N_ELEMENTS (key_events) + i; cevent.any.event_id = G_N_ELEMENTS (key_events) + i;
for (count = ev.value; count < 0; count++) if (ev.value < 0)
gimp_controller_event (controller, &cevent); {
g_value_init (&cevent.value.value, G_TYPE_DOUBLE);
g_value_set_double (&cevent.value.value, -ev.value);
}
else
{
cevent.any.event_id++; cevent.any.event_id++;
for (count = ev.value; count > 0; count--) g_value_init (&cevent.value.value, G_TYPE_DOUBLE);
g_value_set_double (&cevent.value.value, ev.value);
}
gimp_controller_event (controller, &cevent); gimp_controller_event (controller, &cevent);
break; break;