From 470bf9d36feb409c821f9f89cfca3301c0f83ac8 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 13 Jun 2005 19:56:28 +0000 Subject: [PATCH] - add -desks-set/get back in SVN revision: 15313 --- src/bin/e_ipc.c | 41 ----------------- src/bin/e_ipc_handlers.h | 96 ++++++++++++++++++++++++++++++++++++++++ src/bin/e_remote_main.c | 12 ----- 3 files changed, 96 insertions(+), 53 deletions(-) diff --git a/src/bin/e_ipc.c b/src/bin/e_ipc.c index b9529b16a..a1772db6d 100644 --- a/src/bin/e_ipc.c +++ b/src/bin/e_ipc.c @@ -344,47 +344,6 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event) } } break; - case E_IPC_OP_DESKS_SET: - if (e_ipc_codec_2int_dec(e->data, e->size, - &(e_config->zone_desks_x_count), - &(e_config->zone_desks_y_count))) - { - Evas_List *l; - - E_CONFIG_LIMIT(e_config->zone_desks_x_count, 1, 64); - E_CONFIG_LIMIT(e_config->zone_desks_y_count, 1, 64); - for (l = e_manager_list(); l; l = l->next) - { - E_Manager *man; - Evas_List *l2; - - man = l->data; - for (l2 = man->containers; l2; l2 = l2->next) - { - E_Container *con; - Evas_List *l3; - - con = l2->data; - for (l3 = con->zones; l3; l3 = l3->next) - { - E_Zone *zone; - - zone = l3->data; - e_zone_desk_count_set(zone, - e_config->zone_desks_x_count, - e_config->zone_desks_y_count); - } - } - } - e_config_save_queue(); - } - break; - case E_IPC_OP_DESKS_GET: - _e_ipc_reply_2int_send(e->client, - e_config->zone_desks_x_count, - e_config->zone_desks_y_count, - E_IPC_OP_DESKS_GET_REPLY); - break; #endif default: break; diff --git a/src/bin/e_ipc_handlers.h b/src/bin/e_ipc_handlers.h index c892dc452..aa5f9175b 100644 --- a/src/bin/e_ipc_handlers.h +++ b/src/bin/e_ipc_handlers.h @@ -63,6 +63,17 @@ if (e->data) { \ } \ break; +# define START_2INT(__int1, __int2, HDL) \ +case HDL: \ +if (e->data) { \ + int __int1 = 0; \ + int __int2 = 0; \ + if (e_ipc_codec_2int_dec(e->data, e->size, &(__int1), &(__int2))) { +# define END_2INT \ + } \ +} \ +break; + # define RESPONSE(__res, __store, HDL) \ __store *__res = calloc(1, sizeof(__store)); \ if (e->data) { @@ -118,6 +129,16 @@ break; REQ_INT_START(HDL) \ REQ_INT_END(__int, HDL) +# define REQ_2INT(__int1, __int2, HDL) \ +case HDL: { void *data; int bytes; \ + data = e_ipc_codec_2int_enc(__int1, __int2, &bytes); \ + if (data) { \ + ecore_ipc_server_send(e->server, E_IPC_DOMAIN_REQUEST, HDL, 0, 0, 0, data, bytes); \ + free(data); \ + } \ +} \ +break; + # define REQ_NULL(HDL) \ case HDL: \ ecore_ipc_server_send(e->server, E_IPC_DOMAIN_REQUEST, HDL, 0, 0, 0, NULL, 0); \ @@ -198,6 +219,16 @@ case HDL: { void *data; int bytes; \ } \ break; +# define SEND_2INT(__int1, __int2,__op, HDL) \ +case HDL: { void *data; int bytes; \ + data = e_ipc_codec_2int_enc(__int1, __int2, &bytes); \ + if (data) { \ + ecore_ipc_client_send(e->client, E_IPC_DOMAIN_REPLY, __op, 0, 0, 0, data, bytes); \ + free(data); \ + } \ +} \ +break; + #define LIST_DATA() \ Evas_List *dat = NULL, *l; \ void *data; int bytes; @@ -1314,6 +1345,71 @@ break; #endif #undef HDL +/****************************************************************************/ +#define HDL E_IPC_OP_DESKS_SET +#if (TYPE == E_REMOTE_OPTIONS) + OP("-desks-set", 1, "Set the number of virtual desktops (X x Y. OPT1 = X, OPT2 = Y)", 0, HDL) +#elif (TYPE == E_REMOTE_OUT) + REQ_2INT(atoi(params[0]), atoi(params[1]), HDL); +#elif (TYPE == E_WM_IN) + START_2INT(val1, val2, HDL); + e_config->zone_desks_x_count = val1; + e_config->zone_desks_y_count = val2; + E_CONFIG_LIMIT(e_config->zone_desks_x_count, 1, 64) + E_CONFIG_LIMIT(e_config->zone_desks_y_count, 1, 64) + { + Evas_List *l; + for (l = e_manager_list(); l; l = l->next) + { + E_Manager *man; + Evas_List *l2; + man = l->data; + for (l2 = man->containers; l2; l2 = l2->next) + { + E_Container *con; + Evas_List *l3; + con = l2->data; + for (l3 = con->zones; l3; l3 = l3->next) + { + E_Zone *zone; + zone = l3->data; + e_zone_desk_count_set(zone, + e_config->zone_desks_x_count, + e_config->zone_desks_y_count); + } + } + } + } + SAVE; + END_2INT; +#elif (TYPE == E_REMOTE_IN) +#endif +#undef HDL + +/****************************************************************************/ +#define HDL E_IPC_OP_DESKS_GET +#if (TYPE == E_REMOTE_OPTIONS) + OP("-desks-get", 0, "Get the number of virtual desktops", 1, HDL) +#elif (TYPE == E_REMOTE_OUT) + REQ_NULL(HDL) +#elif (TYPE == E_WM_IN) + SEND_2INT(e_config->zone_desks_x_count, e_config->zone_desks_y_count, E_IPC_OP_DESKS_GET_REPLY, HDL); +#elif (TYPE == E_REMOTE_IN) +#endif +#undef HDL + +/****************************************************************************/ +#define HDL E_IPC_OP_DESKS_GET_REPLY +#if (TYPE == E_REMOTE_OPTIONS) +#elif (TYPE == E_REMOTE_OUT) +#elif (TYPE == E_WM_IN) +#elif (TYPE == E_REMOTE_IN) + START_2INT(val1, val2, HDL) + printf("REPLY: %i %i\n", val1, val2); + END_2INT; +#endif +#undef HDL + #if 0 } #endif diff --git a/src/bin/e_remote_main.c b/src/bin/e_remote_main.c index 1bd832c37..cd0c5f8c4 100644 --- a/src/bin/e_remote_main.c +++ b/src/bin/e_remote_main.c @@ -580,8 +580,6 @@ E_IPC_Opt_Handler handlers[] = OREQ("-binding-key-list", "List all key bindings", E_IPC_OP_BINDING_KEY_LIST, 1), OFNC("-binding-key-add", "Add an existing key binding. OPT1 = Context, OPT2 = key, OPT3 = modifiers, OPT4 = any modifier ok, OPT5 = action, OPT6 = action parameters", 6, _e_opt_binding_key_add, 0), OFNC("-binding-key-del", "Delete an existing key binding. OPT1 = Context, OPT2 = key, OPT3 = modifiers, OPT4 = any modifier ok, OPT5 = action, OPT6 = action parameters", 6, _e_opt_binding_key_del, 0), - O2INT("-desks-set", "Set the number of virtual desktops (X x Y. OPT1 = X, OPT2 = Y)", E_IPC_OP_DESKS_SET, 0), - OREQ("-desks-get", "Get the number of virtual desktops", E_IPC_OP_DESKS_GET, 1), }; /* externally accessible functions */ @@ -962,16 +960,6 @@ _e_ipc_cb_server_data(void *data, int type, void *event) else printf("REPLY: AVAILABLE NONE\n"); break; - case E_IPC_OP_DESKS_GET_REPLY: - if (e->data) - { - int val1; - int val2; - - if (e_ipc_codec_2int_dec(e->data, e->size, &val1, &val2)) - printf("REPLY: %i %i\n", val1, val2); - } - break; default: break; }