Files
riverguile/src/call-idle-handler.c
bluepython508 a5e4b682fe Nix support
src/call-idle-handler.c change due to build failures because of -wall -werror
2025-03-18 10:03:47 +00:00

37 lines
970 B
C

#include <libguile.h>
#include "seat.h"
#include "call-idle-handler.h"
static void *call_idle_handler_inner (void *data)
{
struct Call_idle_handler_parameters *params =
(struct Call_idle_handler_parameters *)data;
SCM event = { 0 };
switch (params->event)
{
case IDLE: event = scm_from_utf8_symbol("idle"); break;
case RESUME: event = scm_from_utf8_symbol("resume"); break;
}
return scm_call_1(params->idle->handler, event);
}
void *call_idle_handler (void *data)
{
/* Continuation barrier causes stack unwind on exceptions (i.e. errors
* in the user defined idle handler) to stop here. Otherwise the entire
* stack created by scm_with_guile() would be unwound. This makes
* responding to exceptions nicer.
*/
SCM call_result = scm_c_with_continuation_barrier(
call_idle_handler_inner, data
);
if ( call_result == NULL )
return (void *)"ERROR: An exception occured while calling the idle handler.\n";
return NULL;
}