Commit 004a9572 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

always return a non-NULL string (return "<invalid event id>" as fallback).

2004-06-16  Michael Natterer  <mitch@gimp.org>

	* libgimpwidgets/gimpcontroller.c (gimp_controller_get_event_name)
	(gimp_controller_get_event_blurb): always return a non-NULL
	string (return "<invalid event id>" as fallback).

	* modules/controller_linux_input.c: reenabled button event
	dispatching.

	* app/widgets/gimpcontrollerinfo.c: fixed debugging output.
parent a1d67f0e
2004-06-16 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimpcontroller.c (gimp_controller_get_event_name)
(gimp_controller_get_event_blurb): always return a non-NULL
string (return "<invalid event id>" as fallback).
* modules/controller_linux_input.c: reenabled button event
dispatching.
* app/widgets/gimpcontrollerinfo.c: fixed debugging output.
2004-06-16 Simon Budig <simon@gimp.org>
* modules/controller_linux_input.c: break out of the
......
......@@ -427,9 +427,9 @@ gimp_controller_info_event (GimpController *controller,
controller, event, action_name, &retval);
if (retval)
g_print (" action was found\n\n");
g_print (" action was found\n\n");
else
g_print (" action NOT found\n\n");
g_print (" action NOT found\n\n");
return retval;
}
......
......@@ -221,26 +221,36 @@ const gchar *
gimp_controller_get_event_name (GimpController *controller,
gint event_id)
{
const gchar *name = NULL;
g_return_val_if_fail (GIMP_IS_CONTROLLER (controller), NULL);
if (GIMP_CONTROLLER_GET_CLASS (controller)->get_event_name)
return GIMP_CONTROLLER_GET_CLASS (controller)->get_event_name (controller,
name = GIMP_CONTROLLER_GET_CLASS (controller)->get_event_name (controller,
event_id);
return NULL;
if (! name)
name = "<invalid event id>";
return name;
}
const gchar *
gimp_controller_get_event_blurb (GimpController *controller,
gint event_id)
{
const gchar *blurb = NULL;
g_return_val_if_fail (GIMP_IS_CONTROLLER (controller), NULL);
if (GIMP_CONTROLLER_GET_CLASS (controller)->get_event_blurb)
return GIMP_CONTROLLER_GET_CLASS (controller)->get_event_blurb (controller,
event_id);
blurb = GIMP_CONTROLLER_GET_CLASS (controller)->get_event_blurb (controller,
event_id);
if (! blurb)
blurb = "<invalid event id>";
return NULL;
return blurb;
}
void
......
......@@ -394,11 +394,16 @@ linux_input_read_event (GIOChannel *io,
for (i = 0; i < G_N_ELEMENTS (key_events); i++)
if (ev.code == key_events[i].code)
{
GimpController *controller = GIMP_CONTROLLER (data);
GimpControllerEvent cevent;
cevent.any.type = GIMP_CONTROLLER_EVENT_TRIGGER;
cevent.any.source = GIMP_CONTROLLER (data);
cevent.any.event_id = i;
gimp_controller_event (controller, &cevent);
break;
}
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment