summaryrefslogtreecommitdiff
path: root/src/bin/e_ipc.c
diff options
context:
space:
mode:
authorChristopher Michael <cpmichael1@comcast.net>2011-07-25 09:40:18 +0000
committerChristopher Michael <cpmichael1@comcast.net>2011-07-25 09:40:18 +0000
commit1a13f8c26f67c2a13c1dffdb60b4577a5e3e704d (patch)
treed040dc396d43194a63647c69e7cdb25d15cc212c /src/bin/e_ipc.c
parentbc5f550546f5e2994d6fb95feb8651a82240d8e5 (diff)
E: Make E work with the new XCB stuffs. This breaks out e_alert into
it's own utility (as per raster's request/idea). Remove explicit x_clags in Makefile.am(s) as they are no longer needed. NB: I added some additional libs to the precache stuffs (even tho it's not used right now). Also a newer e_main (more optimized). NB: IF you are brave and want to test this, build evas w/ xcb, build ecore w/ xcb, then rebuild E. Also, disable building opengl in both evas & ecore (it's not ready for public consumption when paired w/ xcb). SVN revision: 61680
Diffstat (limited to 'src/bin/e_ipc.c')
-rw-r--r--src/bin/e_ipc.c153
1 files changed, 82 insertions, 71 deletions
diff --git a/src/bin/e_ipc.c b/src/bin/e_ipc.c
index 4f6f4d8..de44329 100644
--- a/src/bin/e_ipc.c
+++ b/src/bin/e_ipc.c
@@ -2,15 +2,9 @@
2 2
3#ifdef USE_IPC 3#ifdef USE_IPC
4/* local subsystem functions */ 4/* local subsystem functions */
5static Eina_Bool _e_ipc_cb_client_add(void *data __UNUSED__, 5static Eina_Bool _e_ipc_cb_client_add(void *data __UNUSED__, int type __UNUSED__, void *event);
6 int type __UNUSED__, 6static Eina_Bool _e_ipc_cb_client_del(void *data __UNUSED__, int type __UNUSED__, void *event);
7 void *event); 7static Eina_Bool _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event);
8static Eina_Bool _e_ipc_cb_client_del(void *data __UNUSED__,
9 int type __UNUSED__,
10 void *event);
11static Eina_Bool _e_ipc_cb_client_data(void *data __UNUSED__,
12 int type __UNUSED__,
13 void *event);
14 8
15/* local subsystem globals */ 9/* local subsystem globals */
16static Ecore_Ipc_Server *_e_ipc_server = NULL; 10static Ecore_Ipc_Server *_e_ipc_server = NULL;
@@ -42,8 +36,7 @@ e_ipc_init(void)
42 36
43 if (stat(buf, &st) == 0) 37 if (stat(buf, &st) == 0)
44 { 38 {
45 if ((st.st_uid == 39 if ((st.st_uid == getuid()) &&
46 getuid()) &&
47 ((st.st_mode & (S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO)) == 40 ((st.st_mode & (S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO)) ==
48 (S_IRWXU | S_IFDIR))) 41 (S_IRWXU | S_IFDIR)))
49 { 42 {
@@ -68,15 +61,19 @@ e_ipc_init(void)
68 return 0; 61 return 0;
69 } 62 }
70 } 63 }
71 snprintf(buf, sizeof(buf), "%s/enlightenment-%s/disp-%s-%i", tmp, user, disp, pid); 64 snprintf(buf, sizeof(buf), "%s/enlightenment-%s/disp-%s-%i",
65 tmp, user, disp, pid);
72 _e_ipc_server = ecore_ipc_server_add(ECORE_IPC_LOCAL_SYSTEM, buf, 0, NULL); 66 _e_ipc_server = ecore_ipc_server_add(ECORE_IPC_LOCAL_SYSTEM, buf, 0, NULL);
73 e_util_env_set("E_IPC_SOCKET", ""); 67 e_util_env_set("E_IPC_SOCKET", "");
74 if (!_e_ipc_server) return 0; 68 if (!_e_ipc_server) return 0;
75 e_util_env_set("E_IPC_SOCKET", buf); 69 e_util_env_set("E_IPC_SOCKET", buf);
76 printf("INFO: E_IPC_SOCKET=%s\n", buf); 70 printf("INFO: E_IPC_SOCKET=%s\n", buf);
77 ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD, _e_ipc_cb_client_add, NULL); 71 ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD,
78 ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, _e_ipc_cb_client_del, NULL); 72 _e_ipc_cb_client_add, NULL);
79 ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA, _e_ipc_cb_client_data, NULL); 73 ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL,
74 _e_ipc_cb_client_del, NULL);
75 ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA,
76 _e_ipc_cb_client_data, NULL);
80 77
81 e_ipc_codec_init(); 78 e_ipc_codec_init();
82#endif 79#endif
@@ -100,26 +97,24 @@ e_ipc_shutdown(void)
100#ifdef USE_IPC 97#ifdef USE_IPC
101/* local subsystem globals */ 98/* local subsystem globals */
102static Eina_Bool 99static Eina_Bool
103_e_ipc_cb_client_add(void *data __UNUSED__, 100_e_ipc_cb_client_add(void *data __UNUSED__, int type __UNUSED__, void *event)
104 int type __UNUSED__,
105 void *event)
106{ 101{
107 Ecore_Ipc_Event_Client_Add *e; 102 Ecore_Ipc_Event_Client_Add *e;
108 103
109 e = event; 104 e = event;
110 if (ecore_ipc_client_server_get(e->client) != _e_ipc_server) return ECORE_CALLBACK_PASS_ON; 105 if (ecore_ipc_client_server_get(e->client) != _e_ipc_server)
106 return ECORE_CALLBACK_PASS_ON;
111 return ECORE_CALLBACK_PASS_ON; 107 return ECORE_CALLBACK_PASS_ON;
112} 108}
113 109
114static Eina_Bool 110static Eina_Bool
115_e_ipc_cb_client_del(void *data __UNUSED__, 111_e_ipc_cb_client_del(void *data __UNUSED__, int type __UNUSED__, void *event)
116 int type __UNUSED__,
117 void *event)
118{ 112{
119 Ecore_Ipc_Event_Client_Del *e; 113 Ecore_Ipc_Event_Client_Del *e;
120 114
121 e = event; 115 e = event;
122 if (ecore_ipc_client_server_get(e->client) != _e_ipc_server) return ECORE_CALLBACK_PASS_ON; 116 if (ecore_ipc_client_server_get(e->client) != _e_ipc_server)
117 return ECORE_CALLBACK_PASS_ON;
123 /* delete client sruct */ 118 /* delete client sruct */
124 e_thumb_client_del(e); 119 e_thumb_client_del(e);
125 e_fm2_client_del(e); 120 e_fm2_client_del(e);
@@ -129,14 +124,13 @@ _e_ipc_cb_client_del(void *data __UNUSED__,
129} 124}
130 125
131static Eina_Bool 126static Eina_Bool
132_e_ipc_cb_client_data(void *data __UNUSED__, 127_e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
133 int type __UNUSED__,
134 void *event)
135{ 128{
136 Ecore_Ipc_Event_Client_Data *e; 129 Ecore_Ipc_Event_Client_Data *e;
137 130
138 e = event; 131 e = event;
139 if (ecore_ipc_client_server_get(e->client) != _e_ipc_server) return ECORE_CALLBACK_PASS_ON; 132 if (ecore_ipc_client_server_get(e->client) != _e_ipc_server)
133 return ECORE_CALLBACK_PASS_ON;
140 switch (e->major) 134 switch (e->major)
141 { 135 {
142 case E_IPC_DOMAIN_SETUP: 136 case E_IPC_DOMAIN_SETUP:
@@ -146,50 +140,50 @@ _e_ipc_cb_client_data(void *data __UNUSED__,
146 switch (e->minor) 140 switch (e->minor)
147 { 141 {
148 case E_IPC_OP_EXEC_ACTION: 142 case E_IPC_OP_EXEC_ACTION:
149 { 143 {
150 E_Ipc_2Str *req = NULL; 144 E_Ipc_2Str *req = NULL;
151 145
152 if (e_ipc_codec_2str_dec(e->data, e->size, &req)) 146 if (e_ipc_codec_2str_dec(e->data, e->size, &req))
153 { 147 {
154 Eina_List *m = e_manager_list(); 148 Eina_List *m = e_manager_list();
155 int len, ok = 0; 149 int len, ok = 0;
156 void *d; 150 void *d;
157 151
158 if (m) 152 if (m)
159 { 153 {
160 E_Manager *man = eina_list_data_get(m); 154 E_Manager *man = eina_list_data_get(m);
161 155
162 if (man) 156 if (man)
163 { 157 {
164 E_Action *act = e_action_find(req->str1); 158 E_Action *act = e_action_find(req->str1);
165 159
166 if (act && act->func.go) 160 if ((act) && (act->func.go))
167 { 161 {
168 act->func.go(E_OBJECT(man), req->str2); 162 act->func.go(E_OBJECT(man), req->str2);
169 ok = 1; 163 ok = 1;
170 } 164 }
171 } 165 }
172 } 166 }
173 167
174 d = e_ipc_codec_int_enc(ok, &len); 168 d = e_ipc_codec_int_enc(ok, &len);
175 if (d) 169 if (d)
176 { 170 {
177 ecore_ipc_client_send(e->client, 171 ecore_ipc_client_send(e->client,
178 E_IPC_DOMAIN_REPLY, 172 E_IPC_DOMAIN_REPLY,
179 E_IPC_OP_EXEC_ACTION_REPLY, 173 E_IPC_OP_EXEC_ACTION_REPLY,
180 0, 0, 0, d, len); 174 0, 0, 0, d, len);
181 free(d); 175 free(d);
182 } 176 }
183 177
184 if (req) 178 if (req)
185 { 179 {
186 E_FREE(req->str1); 180 E_FREE(req->str1);
187 E_FREE(req->str2); 181 E_FREE(req->str2);
188 E_FREE(req); 182 E_FREE(req);
189 } 183 }
190 } 184 }
191 } 185 }
192 break; 186 break;
193 187
194 default: 188 default:
195 break; 189 break;
@@ -208,6 +202,23 @@ _e_ipc_cb_client_data(void *data __UNUSED__,
208 e_init_client_data(e); 202 e_init_client_data(e);
209 break; 203 break;
210 204
205 case E_IPC_DOMAIN_ALERT:
206 {
207 E_Action *a = NULL;
208
209 switch (e->minor)
210 {
211 case E_ALERT_OP_RESTART:
212 a = e_action_find("restart");
213 break;
214 case E_ALERT_OP_EXIT:
215 a = e_action_find("exit");
216 break;
217 }
218 if ((a) && (a->func.go)) a->func.go(NULL, NULL);
219 break;
220 }
221
211 default: 222 default:
212 break; 223 break;
213 } 224 }