forked from enlightenment/efl
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:
parent
ba16dee6b3
commit
f62e051343
|
@ -41,7 +41,7 @@ typedef struct _Signal_Data
|
||||||
} Signal_Data;
|
} Signal_Data;
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_ecore_signal_pipe_read(void)
|
_ecore_signal_pipe_read(Eo *obj)
|
||||||
{
|
{
|
||||||
Signal_Data sdata;
|
Signal_Data sdata;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -69,6 +69,14 @@ _ecore_signal_pipe_read(void)
|
||||||
ecore_event_add(ECORE_EVENT_SIGNAL_USER, e,
|
ecore_event_add(ECORE_EVENT_SIGNAL_USER, e,
|
||||||
_ecore_signal_generic_free, NULL);
|
_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;
|
break;
|
||||||
case SIGHUP:
|
case SIGHUP:
|
||||||
|
@ -80,6 +88,9 @@ _ecore_signal_pipe_read(void)
|
||||||
ecore_event_add(ECORE_EVENT_SIGNAL_HUP, e,
|
ecore_event_add(ECORE_EVENT_SIGNAL_HUP, e,
|
||||||
_ecore_signal_generic_free, NULL);
|
_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;
|
break;
|
||||||
case SIGQUIT:
|
case SIGQUIT:
|
||||||
|
@ -120,7 +131,7 @@ _ecore_signal_pipe_read(void)
|
||||||
static void
|
static void
|
||||||
_ecore_signal_cb_read(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
|
_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
|
static void
|
||||||
|
|
|
@ -151,6 +151,9 @@ class Efl.Loop (Efl.Object)
|
||||||
pause; [[Called when the window is not going be displayed for some time]]
|
pause; [[Called when the window is not going be displayed for some time]]
|
||||||
resume; [[Called before a window is rendered after a pause event]]
|
resume; [[Called before a window is rendered after a pause event]]
|
||||||
terminate; [[Called before starting the shutdown of Elementary]]
|
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 {
|
implements {
|
||||||
Efl.Object.constructor;
|
Efl.Object.constructor;
|
||||||
|
|
Loading…
Reference in New Issue