forked from enlightenment/enlightenment
some ipc is in to handle key and mouse bindings. right now you can just list
them (so now you know what the defaults are!) :) need to add add/del handling on both the e and e_remote sides. SVN revision: 14578
This commit is contained in:
parent
476c8f543a
commit
efa853f59e
|
@ -15,6 +15,8 @@ ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_font_available_list_enc);
|
||||||
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_font_fallback_list_enc);
|
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_font_fallback_list_enc);
|
||||||
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_font_default_list_enc);
|
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_font_default_list_enc);
|
||||||
ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_font_default_enc);
|
ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_font_default_enc);
|
||||||
|
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_mouse_binding_enc);
|
||||||
|
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_key_binding_enc);
|
||||||
|
|
||||||
/* local subsystem globals */
|
/* local subsystem globals */
|
||||||
static Ecore_Ipc_Server *_e_ipc_server = NULL;
|
static Ecore_Ipc_Server *_e_ipc_server = NULL;
|
||||||
|
@ -447,6 +449,54 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case E_IPC_OP_BINDING_MOUSE_LIST:
|
||||||
|
{
|
||||||
|
Evas_List *bindings;
|
||||||
|
int bytes;
|
||||||
|
char *data;
|
||||||
|
|
||||||
|
bindings = e_config->mouse_bindings;
|
||||||
|
data = _e_ipc_mouse_binding_enc(bindings, &bytes);
|
||||||
|
ecore_ipc_client_send(e->client,
|
||||||
|
E_IPC_DOMAIN_REPLY,
|
||||||
|
E_IPC_OP_BINDING_MOUSE_LIST_REPLY,
|
||||||
|
0/*ref*/, 0/*ref_to*/, 0/*response*/,
|
||||||
|
data, bytes);
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case E_IPC_OP_BINDING_MOUSE_ADD:
|
||||||
|
{
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case E_IPC_OP_BINDING_MOUSE_DEL:
|
||||||
|
{
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case E_IPC_OP_BINDING_KEY_LIST:
|
||||||
|
{
|
||||||
|
Evas_List *bindings;
|
||||||
|
int bytes;
|
||||||
|
char *data;
|
||||||
|
|
||||||
|
bindings = e_config->key_bindings;
|
||||||
|
data = _e_ipc_key_binding_enc(bindings, &bytes);
|
||||||
|
ecore_ipc_client_send(e->client,
|
||||||
|
E_IPC_DOMAIN_REPLY,
|
||||||
|
E_IPC_OP_BINDING_KEY_LIST_REPLY,
|
||||||
|
0/*ref*/, 0/*ref_to*/, 0/*response*/,
|
||||||
|
data, bytes);
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case E_IPC_OP_BINDING_KEY_ADD:
|
||||||
|
{
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case E_IPC_OP_BINDING_KEY_DEL:
|
||||||
|
{
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -625,9 +675,54 @@ ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_font_default_enc)
|
||||||
ECORE_IPC_ENC_STRUCT_HEAD(E_Font_Default,
|
ECORE_IPC_ENC_STRUCT_HEAD(E_Font_Default,
|
||||||
ECORE_IPC_SLEN(l1, text_class) +
|
ECORE_IPC_SLEN(l1, text_class) +
|
||||||
ECORE_IPC_SLEN(l2, font) +
|
ECORE_IPC_SLEN(l2, font) +
|
||||||
4);
|
4);
|
||||||
ECORE_IPC_PUTS(text_class, l1);
|
ECORE_IPC_PUTS(text_class, l1);
|
||||||
ECORE_IPC_PUTS(font, l2);
|
ECORE_IPC_PUTS(font, l2);
|
||||||
ECORE_IPC_PUT32(size);
|
ECORE_IPC_PUT32(size);
|
||||||
ECORE_IPC_ENC_STRUCT_FOOT();
|
ECORE_IPC_ENC_STRUCT_FOOT();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_mouse_binding_enc)
|
||||||
|
{
|
||||||
|
ECORE_IPC_ENC_EVAS_LIST_HEAD_START(E_Config_Binding_Mouse);
|
||||||
|
ECORE_IPC_CNT32();
|
||||||
|
ECORE_IPC_CNT32();
|
||||||
|
ECORE_IPC_CNTS(action);
|
||||||
|
ECORE_IPC_CNTS(params);
|
||||||
|
ECORE_IPC_CNT8();
|
||||||
|
ECORE_IPC_CNT8();
|
||||||
|
ECORE_IPC_ENC_EVAS_LIST_HEAD_FINISH();
|
||||||
|
int l1, l2;
|
||||||
|
ECORE_IPC_PUT32(context);
|
||||||
|
ECORE_IPC_PUT32(modifiers);
|
||||||
|
ECORE_IPC_SLEN(l1, action);
|
||||||
|
ECORE_IPC_SLEN(l2, params);
|
||||||
|
ECORE_IPC_PUTS(action, l1);
|
||||||
|
ECORE_IPC_PUTS(params, l2);
|
||||||
|
ECORE_IPC_PUT8(button);
|
||||||
|
ECORE_IPC_PUT8(any_mod);
|
||||||
|
ECORE_IPC_ENC_EVAS_LIST_FOOT();
|
||||||
|
}
|
||||||
|
|
||||||
|
ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_key_binding_enc)
|
||||||
|
{
|
||||||
|
ECORE_IPC_ENC_EVAS_LIST_HEAD_START(E_Config_Binding_Key);
|
||||||
|
ECORE_IPC_CNT32();
|
||||||
|
ECORE_IPC_CNT32();
|
||||||
|
ECORE_IPC_CNTS(key);
|
||||||
|
ECORE_IPC_CNTS(action);
|
||||||
|
ECORE_IPC_CNTS(params);
|
||||||
|
ECORE_IPC_CNT8();
|
||||||
|
ECORE_IPC_ENC_EVAS_LIST_HEAD_FINISH();
|
||||||
|
int l1, l2, l3;
|
||||||
|
ECORE_IPC_PUT32(context);
|
||||||
|
ECORE_IPC_PUT32(modifiers);
|
||||||
|
ECORE_IPC_SLEN(l1, key);
|
||||||
|
ECORE_IPC_SLEN(l2, action);
|
||||||
|
ECORE_IPC_SLEN(l3, params);
|
||||||
|
ECORE_IPC_PUTS(key, l1);
|
||||||
|
ECORE_IPC_PUTS(action, l2);
|
||||||
|
ECORE_IPC_PUTS(params, l3);
|
||||||
|
ECORE_IPC_PUT8(any_mod);
|
||||||
|
ECORE_IPC_ENC_EVAS_LIST_FOOT();
|
||||||
|
}
|
||||||
|
|
|
@ -51,6 +51,14 @@ typedef enum _E_Ipc_Op
|
||||||
E_IPC_OP_LANG_SET,
|
E_IPC_OP_LANG_SET,
|
||||||
E_IPC_OP_LANG_GET,
|
E_IPC_OP_LANG_GET,
|
||||||
E_IPC_OP_LANG_GET_REPLY,
|
E_IPC_OP_LANG_GET_REPLY,
|
||||||
|
E_IPC_OP_BINDING_MOUSE_LIST,
|
||||||
|
E_IPC_OP_BINDING_MOUSE_LIST_REPLY,
|
||||||
|
E_IPC_OP_BINDING_MOUSE_ADD,
|
||||||
|
E_IPC_OP_BINDING_MOUSE_DEL,
|
||||||
|
E_IPC_OP_BINDING_KEY_LIST,
|
||||||
|
E_IPC_OP_BINDING_KEY_LIST_REPLY,
|
||||||
|
E_IPC_OP_BINDING_KEY_ADD,
|
||||||
|
E_IPC_OP_BINDING_KEY_DEL,
|
||||||
E_IPC_OP_LAST
|
E_IPC_OP_LAST
|
||||||
} E_Ipc_Op;
|
} E_Ipc_Op;
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@ static int _e_ipc_cb_server_data(void *data, int type, void *event);
|
||||||
|
|
||||||
static void _e_help(void);
|
static void _e_help(void);
|
||||||
|
|
||||||
|
static const char *_e_ipc_context_str(int context);
|
||||||
|
static const char *_e_ipc_modifier_str(int mod);
|
||||||
static Evas_List *_e_ipc_str_list_dec(char *data, int bytes);
|
static Evas_List *_e_ipc_str_list_dec(char *data, int bytes);
|
||||||
|
|
||||||
ECORE_IPC_DEC_EVAS_LIST_PROTO(_e_ipc_module_list_dec);
|
ECORE_IPC_DEC_EVAS_LIST_PROTO(_e_ipc_module_list_dec);
|
||||||
|
@ -34,6 +36,8 @@ ECORE_IPC_DEC_EVAS_LIST_PROTO(_e_ipc_font_available_list_dec);
|
||||||
ECORE_IPC_DEC_EVAS_LIST_PROTO(_e_ipc_font_fallback_list_dec);
|
ECORE_IPC_DEC_EVAS_LIST_PROTO(_e_ipc_font_fallback_list_dec);
|
||||||
ECORE_IPC_DEC_EVAS_LIST_PROTO(_e_ipc_font_default_list_dec);
|
ECORE_IPC_DEC_EVAS_LIST_PROTO(_e_ipc_font_default_list_dec);
|
||||||
ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_font_default_dec);
|
ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_font_default_dec);
|
||||||
|
ECORE_IPC_DEC_EVAS_LIST_PROTO(_e_ipc_mouse_binding_dec);
|
||||||
|
ECORE_IPC_DEC_EVAS_LIST_PROTO(_e_ipc_key_binding_dec);
|
||||||
|
|
||||||
/* local subsystem globals */
|
/* local subsystem globals */
|
||||||
static Ecore_Ipc_Server *_e_ipc_server = NULL;
|
static Ecore_Ipc_Server *_e_ipc_server = NULL;
|
||||||
|
@ -77,7 +81,9 @@ E_IPC_Opt_Handler handlers[] =
|
||||||
OREQ("-shutdown", "Shutdown E17", E_IPC_OP_SHUTDOWN, 0),
|
OREQ("-shutdown", "Shutdown E17", E_IPC_OP_SHUTDOWN, 0),
|
||||||
OREQ("-lang-get", "Get the current language", E_IPC_OP_LANG_GET, 1),
|
OREQ("-lang-get", "Get the current language", E_IPC_OP_LANG_GET, 1),
|
||||||
OREQ("-lang-list", "List all available languages", E_IPC_OP_LANG_LIST, 1),
|
OREQ("-lang-list", "List all available languages", E_IPC_OP_LANG_LIST, 1),
|
||||||
OSTR("-lang-set", "Set the current language", E_IPC_OP_LANG_SET, 0)
|
OSTR("-lang-set", "Set the current language", E_IPC_OP_LANG_SET, 0),
|
||||||
|
OREQ("-binding-mouse-list", "List all mouse bindings", E_IPC_OP_BINDING_MOUSE_LIST, 1),
|
||||||
|
OREQ("-binding-key-list", "List all key bindings", E_IPC_OP_BINDING_KEY_LIST, 1)
|
||||||
};
|
};
|
||||||
|
|
||||||
/* externally accessible functions */
|
/* externally accessible functions */
|
||||||
|
@ -471,6 +477,56 @@ _e_ipc_cb_server_data(void *data, int type, void *event)
|
||||||
printf("REPLY: %s\n", e->data);
|
printf("REPLY: %s\n", e->data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case E_IPC_OP_BINDING_MOUSE_LIST_REPLY:
|
||||||
|
if (e->data)
|
||||||
|
{
|
||||||
|
Evas_List *bindings;
|
||||||
|
E_Config_Binding_Mouse *eb;
|
||||||
|
|
||||||
|
bindings = _e_ipc_mouse_binding_dec(e->data, e->size);
|
||||||
|
while (bindings)
|
||||||
|
{
|
||||||
|
eb = bindings->data;
|
||||||
|
printf("REPLY: BINDING CONTEXT=%s MODIFIERS=%s BUTTON=%i ANY_MOD=%i ACTION=\"%s\" PARAMS=\"%s\"\n",
|
||||||
|
_e_ipc_context_str(eb->context),
|
||||||
|
_e_ipc_modifier_str(eb->modifiers),
|
||||||
|
eb->button,
|
||||||
|
eb->any_mod,
|
||||||
|
eb->action,
|
||||||
|
eb->params
|
||||||
|
);
|
||||||
|
bindings = evas_list_remove_list(bindings, bindings);
|
||||||
|
E_FREE(eb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf("REPLY: AVAILABLE NONE\n");
|
||||||
|
break;
|
||||||
|
case E_IPC_OP_BINDING_KEY_LIST_REPLY:
|
||||||
|
if (e->data)
|
||||||
|
{
|
||||||
|
Evas_List *bindings;
|
||||||
|
E_Config_Binding_Key *eb;
|
||||||
|
|
||||||
|
bindings = _e_ipc_key_binding_dec(e->data, e->size);
|
||||||
|
while (bindings)
|
||||||
|
{
|
||||||
|
eb = bindings->data;
|
||||||
|
printf("REPLY: BINDING CONTEXT=%s MODIFIERS=%s KEY=\"%s\" ANY_MOD=%i ACTION=\"%s\" PARAMS=\"%s\"\n",
|
||||||
|
_e_ipc_context_str(eb->context),
|
||||||
|
_e_ipc_modifier_str(eb->modifiers),
|
||||||
|
eb->key,
|
||||||
|
eb->any_mod,
|
||||||
|
eb->action,
|
||||||
|
eb->params
|
||||||
|
);
|
||||||
|
bindings = evas_list_remove_list(bindings, bindings);
|
||||||
|
E_FREE(eb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf("REPLY: AVAILABLE NONE\n");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -524,6 +580,46 @@ _e_help(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* generic encoding functions */
|
/* generic encoding functions */
|
||||||
|
static const char *
|
||||||
|
_e_ipc_context_str(int context)
|
||||||
|
{
|
||||||
|
if (context == E_BINDING_CONTEXT_NONE) return "NONE";
|
||||||
|
if (context == E_BINDING_CONTEXT_UNKNOWN) return "UNKNOWN";
|
||||||
|
if (context == E_BINDING_CONTEXT_BORDER) return "BORDER";
|
||||||
|
if (context == E_BINDING_CONTEXT_ZONE) return "ZONE";
|
||||||
|
if (context == E_BINDING_CONTEXT_MANAGER) return "MANAGER";
|
||||||
|
if (context == E_BINDING_CONTEXT_ANY) return "ANY";
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
static char _mod_buf[256];
|
||||||
|
static const char *
|
||||||
|
_e_ipc_modifier_str(int mod)
|
||||||
|
{
|
||||||
|
_mod_buf[0] = 0;
|
||||||
|
if (mod & E_BINDING_MODIFIER_SHIFT)
|
||||||
|
{
|
||||||
|
if (_mod_buf[0] != 0) strcat(_mod_buf, "|");
|
||||||
|
strcat(_mod_buf, "SHIFT");
|
||||||
|
}
|
||||||
|
if (mod & E_BINDING_MODIFIER_CTRL)
|
||||||
|
{
|
||||||
|
if (_mod_buf[0] != 0) strcat(_mod_buf, "|");
|
||||||
|
strcat(_mod_buf, "CTRL");
|
||||||
|
}
|
||||||
|
if (mod & E_BINDING_MODIFIER_ALT)
|
||||||
|
{
|
||||||
|
if (_mod_buf[0] != 0) strcat(_mod_buf, "|");
|
||||||
|
strcat(_mod_buf, "ALT");
|
||||||
|
}
|
||||||
|
if (mod & E_BINDING_MODIFIER_WIN)
|
||||||
|
{
|
||||||
|
if (_mod_buf[0] != 0) strcat(_mod_buf, "|");
|
||||||
|
strcat(_mod_buf, "WIN");
|
||||||
|
}
|
||||||
|
return _mod_buf;
|
||||||
|
}
|
||||||
|
|
||||||
static Evas_List *
|
static Evas_List *
|
||||||
_e_ipc_str_list_dec(char *data, int bytes)
|
_e_ipc_str_list_dec(char *data, int bytes)
|
||||||
{
|
{
|
||||||
|
@ -585,3 +681,27 @@ ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_font_default_dec)
|
||||||
ECORE_IPC_GET32(size);
|
ECORE_IPC_GET32(size);
|
||||||
ECORE_IPC_DEC_STRUCT_FOOT();
|
ECORE_IPC_DEC_STRUCT_FOOT();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ECORE_IPC_DEC_EVAS_LIST_PROTO(_e_ipc_mouse_binding_dec)
|
||||||
|
{
|
||||||
|
ECORE_IPC_DEC_EVAS_LIST_HEAD(E_Config_Binding_Mouse);
|
||||||
|
ECORE_IPC_GET32(context);
|
||||||
|
ECORE_IPC_GET32(modifiers);
|
||||||
|
ECORE_IPC_GETS(action);
|
||||||
|
ECORE_IPC_GETS(params);
|
||||||
|
ECORE_IPC_GET8(button);
|
||||||
|
ECORE_IPC_GET8(any_mod);
|
||||||
|
ECORE_IPC_DEC_EVAS_LIST_FOOT();
|
||||||
|
}
|
||||||
|
|
||||||
|
ECORE_IPC_DEC_EVAS_LIST_PROTO(_e_ipc_key_binding_dec)
|
||||||
|
{
|
||||||
|
ECORE_IPC_DEC_EVAS_LIST_HEAD(E_Config_Binding_Key);
|
||||||
|
ECORE_IPC_GET32(context);
|
||||||
|
ECORE_IPC_GET32(modifiers);
|
||||||
|
ECORE_IPC_GETS(key);
|
||||||
|
ECORE_IPC_GETS(action);
|
||||||
|
ECORE_IPC_GETS(params);
|
||||||
|
ECORE_IPC_GET8(any_mod);
|
||||||
|
ECORE_IPC_DEC_EVAS_LIST_FOOT();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue