summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrii Kroitor <an.kroitor@samsung.com>2016-08-23 16:57:06 +0300
committerAndrii Kroitor <an.kroitor@samsung.com>2016-08-31 19:38:25 +0300
commit99a24fbebc7eb55edee0b6c02f1ff4015868a0d0 (patch)
treebe41f8a6d4dcc8978064bdeabac1f61a2a8e9c56
parentcecccd2b8311508fb60ae01862c22a5f40667e1d (diff)
stop recording on preload disconnect
-rw-r--r--src/descriptor.c22
-rw-r--r--src/descriptor.h7
-rw-r--r--src/recorder.c7
-rw-r--r--src/server.c16
4 files changed, 49 insertions, 3 deletions
diff --git a/src/descriptor.c b/src/descriptor.c
index 7848a7a..ef5620e 100644
--- a/src/descriptor.c
+++ b/src/descriptor.c
@@ -19,6 +19,25 @@ eauto_handshake_descriptor_init()
19#undef EAUTO_HANDSHAKE_ADD_BASIC 19#undef EAUTO_HANDSHAKE_ADD_BASIC
20} 20}
21 21
22static Eet_Data_Descriptor *_eauto_close_descriptor;
23static void
24eauto_close_descriptor_init()
25{
26 Eet_Data_Descriptor_Class eddc;
27
28 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, EAuto_Close);
29 _eauto_close_descriptor = eet_data_descriptor_stream_new(&eddc);
30
31#define EAUTO_CLOSE_ADD_BASIC(member, eet_type) \
32 EET_DATA_DESCRIPTOR_ADD_BASIC \
33 (_eauto_close_descriptor, EAuto_Close, # member, member, eet_type)
34
35 EAUTO_CLOSE_ADD_BASIC(type, EET_T_SHORT);
36 EAUTO_CLOSE_ADD_BASIC(exitcode, EET_T_INT);
37
38#undef EAUTO_CLOSE_ADD_BASIC
39}
40
22static Eet_Data_Descriptor *_eauto_mouse_move_descriptor; 41static Eet_Data_Descriptor *_eauto_mouse_move_descriptor;
23static void 42static void
24eauto_mouse_move_descriptor_init() 43eauto_mouse_move_descriptor_init()
@@ -119,6 +138,7 @@ void
119eauto_descriptors_init(void) 138eauto_descriptors_init(void)
120{ 139{
121 eauto_handshake_descriptor_init(); 140 eauto_handshake_descriptor_init();
141 eauto_close_descriptor_init();
122 eauto_mouse_move_descriptor_init(); 142 eauto_mouse_move_descriptor_init();
123 eauto_mouse_button_descriptor_init(); 143 eauto_mouse_button_descriptor_init();
124 eauto_mouse_wheel_descriptor_init(); 144 eauto_mouse_wheel_descriptor_init();
@@ -129,6 +149,7 @@ void
129eauto_descriptors_shutdown(void) 149eauto_descriptors_shutdown(void)
130{ 150{
131 eet_data_descriptor_free(_eauto_handshake_descriptor); 151 eet_data_descriptor_free(_eauto_handshake_descriptor);
152 eet_data_descriptor_free(_eauto_close_descriptor);
132 eet_data_descriptor_free(_eauto_mouse_move_descriptor); 153 eet_data_descriptor_free(_eauto_mouse_move_descriptor);
133 eet_data_descriptor_free(_eauto_mouse_button_descriptor); 154 eet_data_descriptor_free(_eauto_mouse_button_descriptor);
134 eet_data_descriptor_free(_eauto_mouse_wheel_descriptor); 155 eet_data_descriptor_free(_eauto_mouse_wheel_descriptor);
@@ -139,6 +160,7 @@ void
139eauto_descriptors_register_descs(Ecore_Con_Eet *eet_svr) 160eauto_descriptors_register_descs(Ecore_Con_Eet *eet_svr)
140{ 161{
141 ecore_con_eet_register(eet_svr, EAUTO_HANDSHAKE_STREAM, _eauto_handshake_descriptor); 162 ecore_con_eet_register(eet_svr, EAUTO_HANDSHAKE_STREAM, _eauto_handshake_descriptor);
163 ecore_con_eet_register(eet_svr, EAUTO_CLOSE_STREAM, _eauto_close_descriptor);
142 164
143 ecore_con_eet_register(eet_svr, EAUTO_MOUSE_MOVE_STREAM, _eauto_mouse_move_descriptor); 165 ecore_con_eet_register(eet_svr, EAUTO_MOUSE_MOVE_STREAM, _eauto_mouse_move_descriptor);
144 ecore_con_eet_register(eet_svr, EAUTO_MOUSE_DOWN_STREAM, _eauto_mouse_button_descriptor); 166 ecore_con_eet_register(eet_svr, EAUTO_MOUSE_DOWN_STREAM, _eauto_mouse_button_descriptor);
diff --git a/src/descriptor.h b/src/descriptor.h
index 75cd01e..970771c 100644
--- a/src/descriptor.h
+++ b/src/descriptor.h
@@ -30,6 +30,13 @@ typedef struct
30 char *message; 30 char *message;
31} EAuto_Handshake; 31} EAuto_Handshake;
32 32
33#define EAUTO_CLOSE_STREAM "EAUTO_CLOSE_STREAM"
34typedef struct
35{
36 EAuto_Client type;
37 int exitcode;
38} EAuto_Close;
39
33void eauto_descriptors_init(void); 40void eauto_descriptors_init(void);
34void eauto_descriptors_shutdown(void); 41void eauto_descriptors_shutdown(void);
35void eauto_descriptors_register_descs(Ecore_Con_Eet *eet_svr); 42void eauto_descriptors_register_descs(Ecore_Con_Eet *eet_svr);
diff --git a/src/recorder.c b/src/recorder.c
index b7f7cba..996a095 100644
--- a/src/recorder.c
+++ b/src/recorder.c
@@ -46,6 +46,12 @@ _disconnect_timer(void *data EINA_UNUSED)
46} 46}
47 47
48static double last_time = 0; 48static double last_time = 0;
49
50static void
51_client_close_cb(void *data EINA_UNUSED, Ecore_Con_Reply *reply EINA_UNUSED, const char *protocol_name EINA_UNUSED, void *value EINA_UNUSED)
52{
53 ecore_main_loop_quit();
54}
49static void 55static void
50_event_mouse_button_cb(void *data, Ecore_Con_Reply *reply EINA_UNUSED, const char *protocol_name EINA_UNUSED, void *value) 56_event_mouse_button_cb(void *data, Ecore_Con_Reply *reply EINA_UNUSED, const char *protocol_name EINA_UNUSED, void *value)
51{ 57{
@@ -172,6 +178,7 @@ main()
172 178
173 ecore_con_eet_server_connect_callback_add(ec_eet, _eet_svr_cnct_cb, NULL); 179 ecore_con_eet_server_connect_callback_add(ec_eet, _eet_svr_cnct_cb, NULL);
174 ecore_con_eet_server_disconnect_callback_add(ec_eet, _eet_svr_discnct_cb, NULL); 180 ecore_con_eet_server_disconnect_callback_add(ec_eet, _eet_svr_discnct_cb, NULL);
181 ecore_con_eet_data_callback_add(ec_eet, EAUTO_CLOSE_STREAM, _client_close_cb, NULL);
175 ecore_con_eet_data_callback_add(ec_eet, EAUTO_EVENT_MOUSE_DOWN_STREAM, _event_mouse_button_cb, "raw_mouse_down_event"); 182 ecore_con_eet_data_callback_add(ec_eet, EAUTO_EVENT_MOUSE_DOWN_STREAM, _event_mouse_button_cb, "raw_mouse_down_event");
176 ecore_con_eet_data_callback_add(ec_eet, EAUTO_EVENT_MOUSE_UP_STREAM, _event_mouse_button_cb, "raw_mouse_up_event"); 183 ecore_con_eet_data_callback_add(ec_eet, EAUTO_EVENT_MOUSE_UP_STREAM, _event_mouse_button_cb, "raw_mouse_up_event");
177 ecore_con_eet_data_callback_add(ec_eet, EAUTO_EVENT_MOUSE_MOVE_STREAM, _event_mouse_move_cb, "raw_mouse_move_event"); 184 ecore_con_eet_data_callback_add(ec_eet, EAUTO_EVENT_MOUSE_MOVE_STREAM, _event_mouse_move_cb, "raw_mouse_move_event");
diff --git a/src/server.c b/src/server.c
index ba56441..12258cc 100644
--- a/src/server.c
+++ b/src/server.c
@@ -10,9 +10,19 @@ static Ecore_Con_Reply *reply_to_lib, *reply_to_preload, *reply_to_rec;
10static Eina_Bool 10static Eina_Bool
11_eet_client_discnct_cb(void *data EINA_UNUSED, Ecore_Con_Reply *reply EINA_UNUSED, Ecore_Con_Client *conn EINA_UNUSED) 11_eet_client_discnct_cb(void *data EINA_UNUSED, Ecore_Con_Reply *reply EINA_UNUSED, Ecore_Con_Client *conn EINA_UNUSED)
12{ 12{
13 _client_count--; 13 EAuto_Close ev;
14 // if (!_client_count) 14 if (reply == reply_to_preload)
15 // ecore_main_loop_quit(); 15 {
16 reply_to_preload = NULL;
17 ev.type = EAUTO_CLIENT_PRELOAD;
18
19 if (reply_to_rec)
20 ecore_con_eet_send(reply_to_rec, EAUTO_CLOSE_STREAM, &ev);
21 }
22 else if (reply == reply_to_rec)
23 reply_to_rec = NULL;
24 else if (reply == reply_to_lib)
25 reply_to_lib = NULL;
16 26
17 return EINA_FALSE; 27 return EINA_FALSE;
18} 28}