efl signals - add signal callbacks for minimal signal set on loops

this willonly apply to the main loop, but to be able to see these
signals as callbacks, we have to expose them. term/quit/int are
already handled internally where the loop will terminate (efl will
enforce this) AND ... there is a terminate event already on the loop
to deal with this cleanup. other signals really arent applicable IMHO
except usr1/2 and hup.
This commit is contained in:
Carsten Haitzler 2018-01-06 18:49:07 +09:00
parent ba16dee6b3
commit f62e051343
2 changed files with 16 additions and 2 deletions

View File

@ -41,7 +41,7 @@ typedef struct _Signal_Data
} Signal_Data;
static Eina_Bool
_ecore_signal_pipe_read(void)
_ecore_signal_pipe_read(Eo *obj)
{
Signal_Data sdata;
int ret;
@ -69,6 +69,14 @@ _ecore_signal_pipe_read(void)
ecore_event_add(ECORE_EVENT_SIGNAL_USER, e,
_ecore_signal_generic_free, NULL);
}
Eo *loop = efl_provider_find(obj, EFL_LOOP_CLASS);
if (loop)
{
if (sdata.sig == SIGUSR1)
efl_event_callback_call(loop, EFL_LOOP_EVENT_SIGNAL_USR1, NULL);
else
efl_event_callback_call(loop, EFL_LOOP_EVENT_SIGNAL_USR2, NULL);
}
}
break;
case SIGHUP:
@ -80,6 +88,9 @@ _ecore_signal_pipe_read(void)
ecore_event_add(ECORE_EVENT_SIGNAL_HUP, e,
_ecore_signal_generic_free, NULL);
}
Eo *loop = efl_provider_find(obj, EFL_LOOP_CLASS);
if (loop)
efl_event_callback_call(loop, EFL_LOOP_EVENT_SIGNAL_HUP, NULL);
}
break;
case SIGQUIT:
@ -120,7 +131,7 @@ _ecore_signal_pipe_read(void)
static void
_ecore_signal_cb_read(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
{
while (_ecore_signal_pipe_read());
while (_ecore_signal_pipe_read(event->object));
}
static void

View File

@ -151,6 +151,9 @@ class Efl.Loop (Efl.Object)
pause; [[Called when the window is not going be displayed for some time]]
resume; [[Called before a window is rendered after a pause event]]
terminate; [[Called before starting the shutdown of Elementary]]
signal,usr1; [[System specific, but on unix maps to SIGUSR1 signal to the process - only called on main loop object]]
signal,usr2; [[System specific, but on unix maps to SIGUSR2 signal to the process - only called on main loop object]]
signal,hup; [[System specific, but on unix maps to SIGHUP signal to the process - only called on main loop object]]
}
implements {
Efl.Object.constructor;