summaryrefslogtreecommitdiff
path: root/src/bin/e_ipc.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2005-05-13 15:15:52 +0000
committerCarsten Haitzler <raster@rasterman.com>2005-05-13 15:15:52 +0000
commit3f92e26079e5dc9ca917da3b51eafba191ec205a (patch)
treec3c405ebf52ef2220c8f20c653d52b1342104d28 /src/bin/e_ipc.c
parent9036a4c57a8156944deeaf977e2e2bdd50851841 (diff)
breaking out some ipc action!
SVN revision: 14755
Diffstat (limited to 'src/bin/e_ipc.c')
-rw-r--r--src/bin/e_ipc.c203
1 files changed, 188 insertions, 15 deletions
diff --git a/src/bin/e_ipc.c b/src/bin/e_ipc.c
index dcc3a95..90697b9 100644
--- a/src/bin/e_ipc.c
+++ b/src/bin/e_ipc.c
@@ -4,6 +4,9 @@
4static int _e_ipc_cb_client_add(void *data, int type, void *event); 4static 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 void _e_ipc_reply_double_send(Ecore_Ipc_Client *client, double val, int opcode);
8static void _e_ipc_reply_int_send(Ecore_Ipc_Client *client, int val, int opcode);
9static void _e_ipc_reply_2int_send(Ecore_Ipc_Client *client, int val1, int val2, int opcode);
7static char *_e_ipc_path_str_get(char **paths, int *bytes); 10static char *_e_ipc_path_str_get(char **paths, int *bytes);
8static char *_e_ipc_str_list_get(Evas_List *strs, int *bytes); 11static char *_e_ipc_str_list_get(Evas_List *strs, int *bytes);
9static char *_e_ipc_simple_str_dec(char *data, int bytes); 12static char *_e_ipc_simple_str_dec(char *data, int bytes);
@@ -597,61 +600,180 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
597 } 600 }
598 break; 601 break;
599 case E_IPC_OP_MENUS_SCROLL_SPEED_GET: 602 case E_IPC_OP_MENUS_SCROLL_SPEED_GET:
600 { 603 _e_ipc_reply_double_send(e->client,
601 void *data; 604 e_config->menus_scroll_speed,
602 int bytes; 605 E_IPC_OP_MENUS_SCROLL_SPEED_GET_REPLY);
603
604 if ((data = e_ipc_codec_double_enc(e_config->menus_scroll_speed,
605 &bytes)))
606 {
607 ecore_ipc_client_send(e->client,
608 E_IPC_DOMAIN_REPLY,
609 E_IPC_OP_MENUS_SCROLL_SPEED_GET_REPLY,
610 0/*ref*/, 0/*ref_to*/, 0/*response*/,
611 data, bytes);
612 free(data);
613 }
614 }
615 break; 606 break;
616 case E_IPC_OP_MENUS_FAST_MOVE_THRESHHOLD_SET: 607 case E_IPC_OP_MENUS_FAST_MOVE_THRESHHOLD_SET:
608 if (e_ipc_codec_double_dec(e->data, e->size,
609 &(e_config->menus_fast_mouse_move_threshhold)))
610 {
611 E_CONFIG_LIMIT(e_config->menus_fast_mouse_move_threshhold, 1.0, 2000.0);
612 e_config_save_queue();
613 }
617 break; 614 break;
618 case E_IPC_OP_MENUS_FAST_MOVE_THRESHHOLD_GET: 615 case E_IPC_OP_MENUS_FAST_MOVE_THRESHHOLD_GET:
616 _e_ipc_reply_double_send(e->client,
617 e_config->menus_fast_mouse_move_threshhold,
618 E_IPC_OP_MENUS_FAST_MOVE_THRESHHOLD_GET_REPLY);
619 break; 619 break;
620 case E_IPC_OP_MENUS_CLICK_DRAG_TIMEOUT_SET: 620 case E_IPC_OP_MENUS_CLICK_DRAG_TIMEOUT_SET:
621 if (e_ipc_codec_double_dec(e->data, e->size,
622 &(e_config->menus_click_drag_timeout)))
623 {
624 E_CONFIG_LIMIT(e_config->menus_click_drag_timeout, 0.0, 10.0);
625 e_config_save_queue();
626 }
621 break; 627 break;
622 case E_IPC_OP_MENUS_CLICK_DRAG_TIMEOUT_GET: 628 case E_IPC_OP_MENUS_CLICK_DRAG_TIMEOUT_GET:
629 _e_ipc_reply_double_send(e->client,
630 e_config->menus_click_drag_timeout,
631 E_IPC_OP_MENUS_CLICK_DRAG_TIMEOUT_GET_REPLY);
623 break; 632 break;
624 case E_IPC_OP_BORDER_SHADE_ANIMATE_SET: 633 case E_IPC_OP_BORDER_SHADE_ANIMATE_SET:
634 if (e_ipc_codec_int_dec(e->data, e->size,
635 &(e_config->border_shade_animate)))
636 {
637 E_CONFIG_LIMIT(e_config->border_shade_animate, 0, 1);
638 e_config_save_queue();
639 }
625 break; 640 break;
626 case E_IPC_OP_BORDER_SHADE_ANIMATE_GET: 641 case E_IPC_OP_BORDER_SHADE_ANIMATE_GET:
642 _e_ipc_reply_int_send(e->client,
643 e_config->border_shade_animate,
644 E_IPC_OP_BORDER_SHADE_ANIMATE_GET_REPLY);
627 break; 645 break;
628 case E_IPC_OP_BORDER_SHADE_TRANSITION_SET: 646 case E_IPC_OP_BORDER_SHADE_TRANSITION_SET:
647 if (e_ipc_codec_int_dec(e->data, e->size,
648 &(e_config->border_shade_transition)))
649 {
650 E_CONFIG_LIMIT(e_config->border_shade_speed, 0, 3);
651 e_config_save_queue();
652 }
629 break; 653 break;
630 case E_IPC_OP_BORDER_SHADE_TRANSITION_GET: 654 case E_IPC_OP_BORDER_SHADE_TRANSITION_GET:
655 _e_ipc_reply_int_send(e->client,
656 e_config->border_shade_transition,
657 E_IPC_OP_BORDER_SHADE_TRANSITION_GET_REPLY);
631 break; 658 break;
632 case E_IPC_OP_BORDER_SHADE_SPEED_SET: 659 case E_IPC_OP_BORDER_SHADE_SPEED_SET:
660 if (e_ipc_codec_double_dec(e->data, e->size,
661 &(e_config->framerate)))
662 {
663 E_CONFIG_LIMIT(e_config->framerate, 1.0, 20000.0);
664 e_config_save_queue();
665 }
633 break; 666 break;
634 case E_IPC_OP_BORDER_SHADE_SPEED_GET: 667 case E_IPC_OP_BORDER_SHADE_SPEED_GET:
668 _e_ipc_reply_double_send(e->client,
669 e_config->border_shade_speed,
670 E_IPC_OP_BORDER_SHADE_SPEED_GET_REPLY);
635 break; 671 break;
636 case E_IPC_OP_FRAMERATE_SET: 672 case E_IPC_OP_FRAMERATE_SET:
673 if (e_ipc_codec_double_dec(e->data, e->size,
674 &(e_config->framerate)))
675 {
676 E_CONFIG_LIMIT(e_config->image_cache, 1.0, 200.0);
677 e_config_save_queue();
678 }
637 break; 679 break;
638 case E_IPC_OP_FRAMERATE_GET: 680 case E_IPC_OP_FRAMERATE_GET:
681 _e_ipc_reply_double_send(e->client,
682 e_config->framerate,
683 E_IPC_OP_FRAMERATE_GET_REPLY);
639 break; 684 break;
640 case E_IPC_OP_IMAGE_CACHE_SET: 685 case E_IPC_OP_IMAGE_CACHE_SET:
686 if (e_ipc_codec_int_dec(e->data, e->size,
687 &(e_config->image_cache)))
688 {
689 E_CONFIG_LIMIT(e_config->image_cache, 0, 256 * 1024);
690 e_config_save_queue();
691 }
641 break; 692 break;
642 case E_IPC_OP_IMAGE_CACHE_GET: 693 case E_IPC_OP_IMAGE_CACHE_GET:
694 _e_ipc_reply_int_send(e->client,
695 e_config->image_cache,
696 E_IPC_OP_IMAGE_CACHE_GET_REPLY);
643 break; 697 break;
644 case E_IPC_OP_FONT_CAHCE_SET: 698 case E_IPC_OP_FONT_CAHCE_SET:
699 if (e_ipc_codec_int_dec(e->data, e->size,
700 &(e_config->font_cache)))
701 {
702 E_CONFIG_LIMIT(e_config->font_cache, 0, 32 * 1024);
703 e_config_save_queue();
704 }
645 break; 705 break;
646 case E_IPC_OP_FONT_CACHE_GET: 706 case E_IPC_OP_FONT_CACHE_GET:
707 _e_ipc_reply_int_send(e->client,
708 e_config->font_cache,
709 E_IPC_OP_FONT_CACHE_GET_REPLY);
647 break; 710 break;
648 case E_IPC_OP_USE_EDGE_FLIP_SET: 711 case E_IPC_OP_USE_EDGE_FLIP_SET:
712 if (e_ipc_codec_int_dec(e->data, e->size,
713 &(e_config->use_edge_flip)))
714 {
715 E_CONFIG_LIMIT(e_config->use_edge_flip, 0, 1);
716 e_config_save_queue();
717 }
649 break; 718 break;
650 case E_IPC_OP_USE_EDGE_FLIP_GET: 719 case E_IPC_OP_USE_EDGE_FLIP_GET:
720 _e_ipc_reply_int_send(e->client,
721 e_config->use_edge_flip,
722 E_IPC_OP_USE_EDGE_FLIP_GET_REPLY);
651 break; 723 break;
652 case E_IPC_OP_EDGE_FLIP_TIMEOUT_SET: 724 case E_IPC_OP_EDGE_FLIP_TIMEOUT_SET:
725 if (e_ipc_codec_double_dec(e->data, e->size,
726 &(e_config->edge_flip_timeout)))
727 {
728 E_CONFIG_LIMIT(e_config->edge_flip_timeout, 0.0, 2.0);
729 e_config_save_queue();
730 }
653 break; 731 break;
654 case E_IPC_OP_EDGE_FLIP_TIMEOUT_GET: 732 case E_IPC_OP_EDGE_FLIP_TIMEOUT_GET:
733 _e_ipc_reply_double_send(e->client,
734 e_config->edge_flip_timeout,
735 E_IPC_OP_EDGE_FLIP_TIMEOUT_GET_REPLY);
736 break;
737 case E_IPC_OP_DESKS_SET:
738 if (e_ipc_codec_2int_dec(e->data, e->size,
739 &(e_config->zone_desks_x_count),
740 &(e_config->zone_desks_y_count)))
741 {
742 Evas_List *l;
743
744 E_CONFIG_LIMIT(e_config->zone_desks_x_count, 1, 64);
745 E_CONFIG_LIMIT(e_config->zone_desks_y_count, 1, 64);
746 for (l = e_manager_list(); l; l = l->next)
747 {
748 E_Manager *man;
749 Evas_List *l2;
750
751 man = l->data;
752 for (l2 = man->containers; l2; l2 = l2->next)
753 {
754 E_Container *con;
755 Evas_List *l3;
756
757 con = l2->data;
758 for (l3 = con->zones; l3; l3 = l3->next)
759 {
760 E_Zone *zone;
761
762 zone = l3->data;
763 e_zone_desk_count_set(zone,
764 e_config->zone_desks_x_count,
765 e_config->zone_desks_y_count);
766 }
767 }
768 }
769 e_config_save_queue();
770 }
771 break;
772 case E_IPC_OP_DESKS_GET:
773 _e_ipc_reply_2int_send(e->client,
774 e_config->zone_desks_x_count,
775 e_config->zone_desks_y_count,
776 E_IPC_OP_DESKS_GET_REPLY);
655 break; 777 break;
656 default: 778 default:
657 break; 779 break;
@@ -665,6 +787,57 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
665 return 1; 787 return 1;
666} 788}
667 789
790static void
791_e_ipc_reply_double_send(Ecore_Ipc_Client *client, double val, int opcode)
792{
793 void *data;
794 int bytes;
795
796 if ((data = e_ipc_codec_double_enc(val, &bytes)))
797 {
798 ecore_ipc_client_send(client,
799 E_IPC_DOMAIN_REPLY,
800 opcode,
801 0/*ref*/, 0/*ref_to*/, 0/*response*/,
802 data, bytes);
803 free(data);
804 }
805}
806
807static void
808_e_ipc_reply_int_send(Ecore_Ipc_Client *client, int val, int opcode)
809{
810 void *data;
811 int bytes;
812
813 if ((data = e_ipc_codec_int_enc(val, &bytes)))
814 {
815 ecore_ipc_client_send(client,
816 E_IPC_DOMAIN_REPLY,
817 opcode,
818 0/*ref*/, 0/*ref_to*/, 0/*response*/,
819 data, bytes);
820 free(data);
821 }
822}
823
824static void
825_e_ipc_reply_2int_send(Ecore_Ipc_Client *client, int val1, int val2, int opcode)
826{
827 void *data;
828 int bytes;
829
830 if ((data = e_ipc_codec_2int_enc(val1, val2, &bytes)))
831 {
832 ecore_ipc_client_send(client,
833 E_IPC_DOMAIN_REPLY,
834 opcode,
835 0/*ref*/, 0/*ref_to*/, 0/*response*/,
836 data, bytes);
837 free(data);
838 }
839}
840
668/* 841/*
669 * FIXME: This dosen't handle the case where one of the paths is of the 842 * FIXME: This dosen't handle the case where one of the paths is of the
670 * form: ~moo/bar/baz need to figure out the correct path to the 843 * form: ~moo/bar/baz need to figure out the correct path to the