summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2020-02-09 23:10:39 +0100
committerBoris Faure <billiob@gmail.com>2020-02-09 23:10:39 +0100
commit91e6ae31fceaaf4424f811276a8bff577c0f89a6 (patch)
treebbe336b4d6a21c73a534b927e4e9446b83f525f2
parent0eb8948d676bcef01aeb17081b9c11c95f912a8f (diff)
ipc/main: restore ability to set multiple commands at startup.
Closes T8563
-rw-r--r--src/bin/ipc.c15
-rw-r--r--src/bin/ipc.h1
-rw-r--r--src/bin/main.c16
3 files changed, 20 insertions, 12 deletions
diff --git a/src/bin/ipc.c b/src/bin/ipc.c
index c848e4f..0b9bcdd 100644
--- a/src/bin/ipc.c
+++ b/src/bin/ipc.c
@@ -6,6 +6,9 @@
6#include <Eet.h> 6#include <Eet.h>
7#include "ipc.h" 7#include "ipc.h"
8 8
9#define TY_IPC_MAJOR 3
10#define TY_IPC_MINOR 8
11
9static Ecore_Ipc_Server *ipc = NULL; 12static Ecore_Ipc_Server *ipc = NULL;
10static Ecore_Event_Handler *hnd_data = NULL; 13static Ecore_Event_Handler *hnd_data = NULL;
11static void (*func_new_inst) (Ipc_Instance *inst) = NULL; 14static void (*func_new_inst) (Ipc_Instance *inst) = NULL;
@@ -20,7 +23,9 @@ _ipc_cb_client_data(void *_data EINA_UNUSED,
20 23
21 if (ecore_ipc_client_server_get(e->client) != ipc) 24 if (ecore_ipc_client_server_get(e->client) != ipc)
22 return ECORE_CALLBACK_PASS_ON; 25 return ECORE_CALLBACK_PASS_ON;
23 if ((e->major == 3) && (e->minor == 7) && (e->data) && (e->size > 0)) 26 if ((e->major == TY_IPC_MAJOR) &&
27 (e->minor == TY_IPC_MINOR) &&
28 (e->data) && (e->size > 0))
24 { 29 {
25 Ipc_Instance *inst; 30 Ipc_Instance *inst;
26 31
@@ -79,16 +84,19 @@ void
79ipc_init(void) 84ipc_init(void)
80{ 85{
81 Eet_Data_Descriptor_Class eddc; 86 Eet_Data_Descriptor_Class eddc;
82 87
83 ecore_ipc_init(); 88 ecore_ipc_init();
84 eet_init(); 89 eet_init();
85 eet_eina_stream_data_descriptor_class_set(&eddc, sizeof(eddc), 90 eet_eina_stream_data_descriptor_class_set(&eddc, sizeof(eddc),
86 "inst", sizeof(Ipc_Instance)); 91 "inst", sizeof(Ipc_Instance));
87 new_inst_edd = eet_data_descriptor_stream_new(&eddc); 92 new_inst_edd = eet_data_descriptor_stream_new(&eddc);
93
88 EET_DATA_DESCRIPTOR_ADD_BASIC(new_inst_edd, Ipc_Instance, 94 EET_DATA_DESCRIPTOR_ADD_BASIC(new_inst_edd, Ipc_Instance,
89 "cmd", cmd, EET_T_STRING); 95 "cmd", cmd, EET_T_STRING);
90 EET_DATA_DESCRIPTOR_ADD_BASIC(new_inst_edd, Ipc_Instance, 96 EET_DATA_DESCRIPTOR_ADD_BASIC(new_inst_edd, Ipc_Instance,
91 "cd", cd, EET_T_STRING); 97 "cd", cd, EET_T_STRING);
98 EET_DATA_DESCRIPTOR_ADD_LIST_STRING(new_inst_edd, Ipc_Instance,
99 "cmds", cmds);
92 EET_DATA_DESCRIPTOR_ADD_BASIC(new_inst_edd, Ipc_Instance, 100 EET_DATA_DESCRIPTOR_ADD_BASIC(new_inst_edd, Ipc_Instance,
93 "background", background, EET_T_STRING); 101 "background", background, EET_T_STRING);
94 EET_DATA_DESCRIPTOR_ADD_BASIC(new_inst_edd, Ipc_Instance, 102 EET_DATA_DESCRIPTOR_ADD_BASIC(new_inst_edd, Ipc_Instance,
@@ -216,7 +224,8 @@ ipc_instance_add(Ipc_Instance *inst)
216 ipcsrv = ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, hash, 0, NULL); 224 ipcsrv = ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, hash, 0, NULL);
217 if (ipcsrv) 225 if (ipcsrv)
218 { 226 {
219 ecore_ipc_server_send(ipcsrv, 3, 7, 0, 0, 0, data, size); 227 ecore_ipc_server_send(ipcsrv, TY_IPC_MAJOR, TY_IPC_MINOR,
228 0, 0, 0, data, size);
220 ecore_ipc_server_flush(ipcsrv); 229 ecore_ipc_server_flush(ipcsrv);
221 free(data); 230 free(data);
222 free(hash); 231 free(hash);
diff --git a/src/bin/ipc.h b/src/bin/ipc.h
index 0aa4775..26349b9 100644
--- a/src/bin/ipc.h
+++ b/src/bin/ipc.h
@@ -33,6 +33,7 @@ struct _Ipc_Instance
33 Eina_Bool active_links; 33 Eina_Bool active_links;
34 Eina_Bool cursor_blink; 34 Eina_Bool cursor_blink;
35 Eina_Bool visual_bell; 35 Eina_Bool visual_bell;
36 Eina_List *cmds;
36 Config *config; 37 Config *config;
37}; 38};
38 39
diff --git a/src/bin/main.c b/src/bin/main.c
index 9bcd88b..6cb1137 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -611,7 +611,6 @@ _start(Ipc_Instance *instance)
611 if (instance->startup_split) 611 if (instance->startup_split)
612 { 612 {
613 unsigned int i = 0; 613 unsigned int i = 0;
614 Eina_List *cmds_list = NULL;
615 Term *next = term; 614 Term *next = term;
616 615
617 for (i = 0; i < strlen(instance->startup_split); i++) 616 for (i = 0; i < strlen(instance->startup_split); i++)
@@ -620,17 +619,19 @@ _start(Ipc_Instance *instance)
620 619
621 if (instance->startup_split[i] == 'v') 620 if (instance->startup_split[i] == 'v')
622 { 621 {
623 cmd = cmds_list ? cmds_list->data : NULL; 622 cmd = eina_list_data_get(instance->cmds);
624 split_vertically(win_evas_object_get(term_win_get(next)), 623 split_vertically(win_evas_object_get(term_win_get(next)),
625 term_termio_get(next), cmd); 624 term_termio_get(next), cmd);
626 cmds_list = eina_list_remove_list(cmds_list, cmds_list); 625 instance->cmds = eina_list_remove_list(instance->cmds,
626 instance->cmds);
627 } 627 }
628 else if (instance->startup_split[i] == 'h') 628 else if (instance->startup_split[i] == 'h')
629 { 629 {
630 cmd = cmds_list ? cmds_list->data : NULL; 630 cmd = eina_list_data_get(instance->cmds);
631 split_horizontally(win_evas_object_get(term_win_get(next)), 631 split_horizontally(win_evas_object_get(term_win_get(next)),
632 term_termio_get(next), cmd); 632 term_termio_get(next), cmd);
633 cmds_list = eina_list_remove_list(cmds_list, cmds_list); 633 instance->cmds = eina_list_remove_list(instance->cmds,
634 instance->cmds);
634 } 635 }
635 else if (instance->startup_split[i] == '-') 636 else if (instance->startup_split[i] == '-')
636 next = term_next_get(next); 637 next = term_next_get(next);
@@ -641,8 +642,6 @@ _start(Ipc_Instance *instance)
641 goto end; 642 goto end;
642 } 643 }
643 } 644 }
644 if (cmds_list)
645 eina_list_free(cmds_list);
646 } 645 }
647 if (instance->pos) 646 if (instance->pos)
648 { 647 {
@@ -909,7 +908,6 @@ elm_main(int argc, char **argv)
909 908
910 if (cmd_options) 909 if (cmd_options)
911 { 910 {
912 Eina_List *cmds_list = NULL;
913 int i; 911 int i;
914 912
915 if (args == argc) 913 if (args == argc)
@@ -922,7 +920,7 @@ elm_main(int argc, char **argv)
922 if (instance.startup_split) 920 if (instance.startup_split)
923 { 921 {
924 for(i = args+1; i < argc; i++) 922 for(i = args+1; i < argc; i++)
925 cmds_list = eina_list_append(cmds_list, argv[i]); 923 instance.cmds = eina_list_append(instance.cmds, argv[i]);
926 instance.cmd = argv[args]; 924 instance.cmd = argv[args];
927 } 925 }
928 else 926 else