summaryrefslogtreecommitdiff
path: root/src/bin/e_ipc.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2005-05-02 10:16:31 +0000
committerCarsten Haitzler <raster@rasterman.com>2005-05-02 10:16:31 +0000
commitb1422de6363722512fbdb9a546989be17c17b6e7 (patch)
treedf2bc1b3b5b0213c4ae8a0a33a936d5e3403bcb2 /src/bin/e_ipc.c
parent2eaa1ce1c705a82dd7dc834ada8903b8788fa32c (diff)
fix focus loss on window unfocus so keybindings still work
some start on language set/get/list ipc SVN revision: 14548
Diffstat (limited to 'src/bin/e_ipc.c')
-rw-r--r--src/bin/e_ipc.c133
1 files changed, 105 insertions, 28 deletions
diff --git a/src/bin/e_ipc.c b/src/bin/e_ipc.c
index 0073aa8..bfdf3d8 100644
--- a/src/bin/e_ipc.c
+++ b/src/bin/e_ipc.c
@@ -5,6 +5,7 @@ static int _e_ipc_cb_client_add(void *data, int type, void *event);
5static int _e_ipc_cb_client_del(void *data, int type, void *event); 5static int _e_ipc_cb_client_del(void *data, int type, void *event);
6static int _e_ipc_cb_client_data(void *data, int type, void *event); 6static int _e_ipc_cb_client_data(void *data, int type, void *event);
7static char *_e_ipc_path_str_get(char **paths, int *bytes); 7static char *_e_ipc_path_str_get(char **paths, int *bytes);
8static char *_e_ipc_str_list_get(Evas_List *strs, int *bytes);
8static char *_e_ipc_simple_str_dec(char *data, int bytes); 9static char *_e_ipc_simple_str_dec(char *data, int bytes);
9static char **_e_ipc_multi_str_dec(char *data, int bytes, int str_count); 10static char **_e_ipc_multi_str_dec(char *data, int bytes, int str_count);
10 11
@@ -14,6 +15,7 @@ ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_font_available_list_enc);
14ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_font_fallback_list_enc); 15ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_font_fallback_list_enc);
15ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_font_default_list_enc); 16ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_font_default_list_enc);
16ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_font_default_enc); 17ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_font_default_enc);
18//ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_string_list_enc);
17 19
18/* local subsystem globals */ 20/* local subsystem globals */
19static Ecore_Ipc_Server *_e_ipc_server = NULL; 21static Ecore_Ipc_Server *_e_ipc_server = NULL;
@@ -213,9 +215,9 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
213 case E_IPC_OP_BG_GET: 215 case E_IPC_OP_BG_GET:
214 { 216 {
215 char *bg; 217 char *bg;
218
216 bg = e_config->desktop_default_background; 219 bg = e_config->desktop_default_background;
217 if (!bg) 220 if (!bg) bg = "";
218 bg = "";
219 ecore_ipc_client_send(e->client, 221 ecore_ipc_client_send(e->client,
220 E_IPC_DOMAIN_REPLY, 222 E_IPC_DOMAIN_REPLY,
221 E_IPC_OP_BG_GET_REPLY, 223 E_IPC_OP_BG_GET_REPLY,
@@ -328,7 +330,7 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
328 int bytes; 330 int bytes;
329 331
330 text_class = _e_ipc_simple_str_dec(e->data, e->size); 332 text_class = _e_ipc_simple_str_dec(e->data, e->size);
331 efd = e_font_default_get (text_class); 333 efd = e_font_default_get(text_class);
332 free(text_class); 334 free(text_class);
333 data = _e_ipc_font_default_enc(efd, &bytes); 335 data = _e_ipc_font_default_enc(efd, &bytes);
334 ecore_ipc_client_send(e->client, 336 ecore_ipc_client_send(e->client,
@@ -399,6 +401,45 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
399 ecore_main_loop_quit(); 401 ecore_main_loop_quit();
400 } 402 }
401 break; 403 break;
404 case E_IPC_OP_LANG_LIST:
405 {
406 Evas_List *langs;
407 int bytes;
408 char *data;
409
410 langs = (Evas_List *)e_intl_language_list();
411 data = _e_ipc_str_list_get(langs, &bytes);
412 ecore_ipc_client_send(e->client,
413 E_IPC_DOMAIN_REPLY,
414 E_IPC_OP_LANG_LIST_REPLY,
415 0/*ref*/, 0/*ref_to*/, 0/*response*/,
416 data, bytes);
417 free(data);
418 }
419 case E_IPC_OP_LANG_SET:
420 {
421 char *lang;
422
423 lang = _e_ipc_simple_str_dec(e->data, e->size);
424 IF_FREE(e_config->language);
425 e_config->language = lang;
426 e_intl_language_set(e_config->language);
427 e_config_save_queue();
428 }
429 case E_IPC_OP_LANG_GET:
430 {
431 char *lang;
432
433 lang = e_config->language;
434 if (!lang) lang = "";
435 ecore_ipc_client_send(e->client,
436 E_IPC_DOMAIN_REPLY,
437 E_IPC_OP_LANG_GET_REPLY,
438 0/*ref*/, 0/*ref_to*/, 0/*response*/,
439 lang, strlen(lang) + 1);
440 free(data);
441 }
442 break;
402 default: 443 default:
403 break; 444 break;
404 } 445 }
@@ -422,7 +463,7 @@ _e_ipc_path_str_get(char **paths, int *bytes)
422 char *data = NULL, **cur, *home; 463 char *data = NULL, **cur, *home;
423 int pos = 0; 464 int pos = 0;
424 char tmp[PATH_MAX]; 465 char tmp[PATH_MAX];
425 466
426 *bytes = 0; 467 *bytes = 0;
427 home = e_user_homedir_get(); 468 home = e_user_homedir_get();
428 for (cur = paths; *cur != NULL; cur++) 469 for (cur = paths; *cur != NULL; cur++)
@@ -444,6 +485,30 @@ _e_ipc_path_str_get(char **paths, int *bytes)
444 return data; 485 return data;
445} 486}
446 487
488static char *
489_e_ipc_str_list_get(Evas_List *strs, int *bytes)
490{
491 char *data = NULL, **cur;
492 int pos = 0;
493 Evas_List *l;
494
495 *bytes = 0;
496 for (l = strs; l; l = l->next)
497 {
498 char *p;
499
500 p = l->data;
501
502 *bytes += strlen(p) + 1;
503 data = realloc(data, *bytes);
504
505 memcpy(data + pos, p, strlen(p));
506 pos = *bytes;
507 data[pos - 1] = 0;
508 }
509 return data;
510}
511
447/** 512/**
448 * Decode a simple string that was passed by an IPC client 513 * Decode a simple string that was passed by an IPC client
449 * 514 *
@@ -452,13 +517,13 @@ _e_ipc_path_str_get(char **paths, int *bytes)
452static char * 517static char *
453_e_ipc_simple_str_dec(char *data, int bytes) 518_e_ipc_simple_str_dec(char *data, int bytes)
454{ 519{
455 char *str; 520 char *str;
456 521
457 str = malloc(bytes + 1); 522 str = malloc(bytes + 1);
458 str[bytes] = 0; 523 str[bytes] = 0;
459 memcpy(str, data, bytes); 524 memcpy(str, data, bytes);
460 525
461 return str; 526 return str;
462} 527}
463 528
464/** 529/**
@@ -472,26 +537,25 @@ _e_ipc_simple_str_dec(char *data, int bytes)
472static char ** 537static char **
473_e_ipc_multi_str_dec(char *data, int bytes, int str_count) 538_e_ipc_multi_str_dec(char *data, int bytes, int str_count)
474{ 539{
475 char ** str_array; 540 char **str_array;
476 int i; 541 int i;
477 542
478 /* Make sure our data is packed for us <str>0<str>0 */ 543 /* Make sure our data is packed for us <str>0<str>0 */
479 if( data[bytes - 1] != 0) { 544 if (data[bytes - 1] != 0)
480 return NULL; 545 return NULL;
481 } 546
482 547 str_array = malloc(sizeof(char *) * str_count);
483 str_array = malloc(sizeof(char *)*str_count); 548
484 549 for (i = 0; i < str_count; i++)
485 for(i = 0; i < str_count; i++) 550 {
486 {
487 str_array[i] = data; 551 str_array[i] = data;
488 data += strlen(str_array[i]) + 1; 552 data += strlen(str_array[i]) + 1;
489 } 553 }
490 554
491 return str_array; 555 return str_array;
492} 556}
493 557
494 558
495/* list/struct encoding functions */ 559/* list/struct encoding functions */
496ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_module_list_enc) 560ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_module_list_enc)
497{ 561{
@@ -556,3 +620,16 @@ ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_font_default_enc)
556 ECORE_IPC_PUT32(size); 620 ECORE_IPC_PUT32(size);
557 ECORE_IPC_ENC_STRUCT_FOOT(); 621 ECORE_IPC_ENC_STRUCT_FOOT();
558} 622}
623
624/*
625ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_string_list_enc)
626{
627 ECORE_IPC_ENC_EVAS_LIST_HEAD_START(E_String);
628 ECORE_IPC_CNTS(str);
629 ECORE_IPC_ENC_EVAS_LIST_HEAD_FINISH();
630 int l1;
631 ECORE_IPC_SLEN(l1, str);
632 ECORE_IPC_PUTS(str, l1);
633 ECORE_IPC_ENC_EVAS_LIST_FOOT();
634}
635*/