ipc/main: restore ability to set multiple commands at startup.

Closes T8563
terminology-1.6
Boris Faure 3 years ago
parent 0eb8948d67
commit 91e6ae31fc
Signed by: borisfaure
GPG Key ID: 35C0410516166BE8
  1. 15
      src/bin/ipc.c
  2. 1
      src/bin/ipc.h
  3. 16
      src/bin/main.c

@ -6,6 +6,9 @@
#include <Eet.h>
#include "ipc.h"
#define TY_IPC_MAJOR 3
#define TY_IPC_MINOR 8
static Ecore_Ipc_Server *ipc = NULL;
static Ecore_Event_Handler *hnd_data = NULL;
static void (*func_new_inst) (Ipc_Instance *inst) = NULL;
@ -20,7 +23,9 @@ _ipc_cb_client_data(void *_data EINA_UNUSED,
if (ecore_ipc_client_server_get(e->client) != ipc)
return ECORE_CALLBACK_PASS_ON;
if ((e->major == 3) && (e->minor == 7) && (e->data) && (e->size > 0))
if ((e->major == TY_IPC_MAJOR) &&
(e->minor == TY_IPC_MINOR) &&
(e->data) && (e->size > 0))
{
Ipc_Instance *inst;
@ -79,16 +84,19 @@ void
ipc_init(void)
{
Eet_Data_Descriptor_Class eddc;
ecore_ipc_init();
eet_init();
eet_eina_stream_data_descriptor_class_set(&eddc, sizeof(eddc),
"inst", sizeof(Ipc_Instance));
new_inst_edd = eet_data_descriptor_stream_new(&eddc);
EET_DATA_DESCRIPTOR_ADD_BASIC(new_inst_edd, Ipc_Instance,
"cmd", cmd, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(new_inst_edd, Ipc_Instance,
"cd", cd, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_LIST_STRING(new_inst_edd, Ipc_Instance,
"cmds", cmds);
EET_DATA_DESCRIPTOR_ADD_BASIC(new_inst_edd, Ipc_Instance,
"background", background, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(new_inst_edd, Ipc_Instance,
@ -216,7 +224,8 @@ ipc_instance_add(Ipc_Instance *inst)
ipcsrv = ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, hash, 0, NULL);
if (ipcsrv)
{
ecore_ipc_server_send(ipcsrv, 3, 7, 0, 0, 0, data, size);
ecore_ipc_server_send(ipcsrv, TY_IPC_MAJOR, TY_IPC_MINOR,
0, 0, 0, data, size);
ecore_ipc_server_flush(ipcsrv);
free(data);
free(hash);

@ -33,6 +33,7 @@ struct _Ipc_Instance
Eina_Bool active_links;
Eina_Bool cursor_blink;
Eina_Bool visual_bell;
Eina_List *cmds;
Config *config;
};

@ -611,7 +611,6 @@ _start(Ipc_Instance *instance)
if (instance->startup_split)
{
unsigned int i = 0;
Eina_List *cmds_list = NULL;
Term *next = term;
for (i = 0; i < strlen(instance->startup_split); i++)
@ -620,17 +619,19 @@ _start(Ipc_Instance *instance)
if (instance->startup_split[i] == 'v')
{
cmd = cmds_list ? cmds_list->data : NULL;
cmd = eina_list_data_get(instance->cmds);
split_vertically(win_evas_object_get(term_win_get(next)),
term_termio_get(next), cmd);
cmds_list = eina_list_remove_list(cmds_list, cmds_list);
instance->cmds = eina_list_remove_list(instance->cmds,
instance->cmds);
}
else if (instance->startup_split[i] == 'h')
{
cmd = cmds_list ? cmds_list->data : NULL;
cmd = eina_list_data_get(instance->cmds);
split_horizontally(win_evas_object_get(term_win_get(next)),
term_termio_get(next), cmd);
cmds_list = eina_list_remove_list(cmds_list, cmds_list);
instance->cmds = eina_list_remove_list(instance->cmds,
instance->cmds);
}
else if (instance->startup_split[i] == '-')
next = term_next_get(next);
@ -641,8 +642,6 @@ _start(Ipc_Instance *instance)
goto end;
}
}
if (cmds_list)
eina_list_free(cmds_list);
}
if (instance->pos)
{
@ -909,7 +908,6 @@ elm_main(int argc, char **argv)
if (cmd_options)
{
Eina_List *cmds_list = NULL;
int i;
if (args == argc)
@ -922,7 +920,7 @@ elm_main(int argc, char **argv)
if (instance.startup_split)
{
for(i = args+1; i < argc; i++)
cmds_list = eina_list_append(cmds_list, argv[i]);
instance.cmds = eina_list_append(instance.cmds, argv[i]);
instance.cmd = argv[args];
}
else

Loading…
Cancel
Save