summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-01-06 18:49:07 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-01-06 18:49:07 +0900
commitf62e0513435de1115e454fa4e8ad61c906b2c5e5 (patch)
treef325bc2ed5093fb6688343cba58b85150952eac1
parentba16dee6b3d5f84e0184c86b64d5fe54e32b4966 (diff)
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.
-rw-r--r--src/lib/ecore/ecore_signal.c15
-rw-r--r--src/lib/ecore/efl_loop.eo3
2 files changed, 16 insertions, 2 deletions
diff --git a/src/lib/ecore/ecore_signal.c b/src/lib/ecore/ecore_signal.c
index e4f33de815..1d9872a459 100644
--- a/src/lib/ecore/ecore_signal.c
+++ b/src/lib/ecore/ecore_signal.c
@@ -41,7 +41,7 @@ typedef struct _Signal_Data
41} Signal_Data; 41} Signal_Data;
42 42
43static Eina_Bool 43static Eina_Bool
44_ecore_signal_pipe_read(void) 44_ecore_signal_pipe_read(Eo *obj)
45{ 45{
46 Signal_Data sdata; 46 Signal_Data sdata;
47 int ret; 47 int ret;
@@ -69,6 +69,14 @@ _ecore_signal_pipe_read(void)
69 ecore_event_add(ECORE_EVENT_SIGNAL_USER, e, 69 ecore_event_add(ECORE_EVENT_SIGNAL_USER, e,
70 _ecore_signal_generic_free, NULL); 70 _ecore_signal_generic_free, NULL);
71 } 71 }
72 Eo *loop = efl_provider_find(obj, EFL_LOOP_CLASS);
73 if (loop)
74 {
75 if (sdata.sig == SIGUSR1)
76 efl_event_callback_call(loop, EFL_LOOP_EVENT_SIGNAL_USR1, NULL);
77 else
78 efl_event_callback_call(loop, EFL_LOOP_EVENT_SIGNAL_USR2, NULL);
79 }
72 } 80 }
73 break; 81 break;
74 case SIGHUP: 82 case SIGHUP:
@@ -80,6 +88,9 @@ _ecore_signal_pipe_read(void)
80 ecore_event_add(ECORE_EVENT_SIGNAL_HUP, e, 88 ecore_event_add(ECORE_EVENT_SIGNAL_HUP, e,
81 _ecore_signal_generic_free, NULL); 89 _ecore_signal_generic_free, NULL);
82 } 90 }
91 Eo *loop = efl_provider_find(obj, EFL_LOOP_CLASS);
92 if (loop)
93 efl_event_callback_call(loop, EFL_LOOP_EVENT_SIGNAL_HUP, NULL);
83 } 94 }
84 break; 95 break;
85 case SIGQUIT: 96 case SIGQUIT:
@@ -120,7 +131,7 @@ _ecore_signal_pipe_read(void)
120static void 131static void
121_ecore_signal_cb_read(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) 132_ecore_signal_cb_read(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
122{ 133{
123 while (_ecore_signal_pipe_read()); 134 while (_ecore_signal_pipe_read(event->object));
124} 135}
125 136
126static void 137static void
diff --git a/src/lib/ecore/efl_loop.eo b/src/lib/ecore/efl_loop.eo
index c91709509a..66ff276f0e 100644
--- a/src/lib/ecore/efl_loop.eo
+++ b/src/lib/ecore/efl_loop.eo
@@ -151,6 +151,9 @@ class Efl.Loop (Efl.Object)
151 pause; [[Called when the window is not going be displayed for some time]] 151 pause; [[Called when the window is not going be displayed for some time]]
152 resume; [[Called before a window is rendered after a pause event]] 152 resume; [[Called before a window is rendered after a pause event]]
153 terminate; [[Called before starting the shutdown of Elementary]] 153 terminate; [[Called before starting the shutdown of Elementary]]
154 signal,usr1; [[System specific, but on unix maps to SIGUSR1 signal to the process - only called on main loop object]]
155 signal,usr2; [[System specific, but on unix maps to SIGUSR2 signal to the process - only called on main loop object]]
156 signal,hup; [[System specific, but on unix maps to SIGHUP signal to the process - only called on main loop object]]
154 } 157 }
155 implements { 158 implements {
156 Efl.Object.constructor; 159 Efl.Object.constructor;