Enlightenment CVS committal Author : dj2 Project : e17 Module : apps/e
Dir : e17/apps/e/src/lib Modified Files: E_Lib.h e_main.c Log Message: - the RESPONSE macro dosen't use HDL, so remove it - remove reply_count from the macros as this is an e_remote thing and isn't used by the other types. e_remote seems to still be working, but some may want to check that - add E_Lib code in for key/mouse bindings. I've tested the list calls, add/del are untested at the moment. =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/lib/E_Lib.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- E_Lib.h 1 Aug 2005 07:34:51 -0000 1.6 +++ E_Lib.h 10 Aug 2005 04:52:07 -0000 1.7 @@ -1,3 +1,6 @@ +/* + * vim:ts=8:sw=3:sts=3:noexpandtab:cino=>5n-3f0^-2{2 + */ #ifndef _E_H #define _E_H @@ -18,14 +21,40 @@ # endif #endif - -typedef struct _E_Response_Module_List E_Response_Module_List; -typedef struct _E_Response_Module_Data E_Response_Module_Data; -typedef struct _E_Response_Dirs_List E_Response_Dirs_List; +typedef enum E_Lib_Binding_Context +{ + E_LIB_BINDING_CONTEXT_NONE, + E_LIB_BINDING_CONTEXT_UNKNOWN, + E_LIB_BINDING_CONTEXT_BORDER, + E_LIB_BINDING_CONTEXT_ZONE, + E_LIB_BINDING_CONTEXT_CONTAINER, + E_LIB_BINDING_CONTEXT_MANAGER, + E_LIB_BINDING_CONTEXT_MENU, + E_LIB_BINDING_CONTEXT_WINLIST, + E_LIB_BINDING_CONTEXT_ANY +} E_Lib_Binding_Context; + +typedef enum E_Lib_Binding_Modifier +{ + E_LIB_BINDING_MODIFIER_NONE = 0, + E_LIB_BINDING_MODIFIER_SHIFT = (1 << 0), + E_LIB_BINDING_MODIFIER_CTRL = (1 << 1), + E_LIB_BINDING_MODIFIER_ALT = (1 << 2), + E_LIB_BINDING_MODIFIER_WIN = (1 << 3) +} E_Lib_Binding_Modifier; + +typedef struct _E_Response_Module_List E_Response_Module_List; +typedef struct _E_Response_Module_Data E_Response_Module_Data; +typedef struct _E_Response_Dirs_List E_Response_Dirs_List; typedef struct _E_Response_Background_Get E_Response_Background_Get; typedef struct _E_Response_Language_Get E_Response_Language_Get; typedef struct _E_Response_Theme_Get E_Response_Theme_Get; +typedef struct _E_Response_Binding_Mouse_List E_Response_Binding_Mouse_List; +typedef struct _E_Response_Binding_Mouse_Data E_Response_Binding_Mouse_Data; +typedef struct _E_Response_Binding_Key_List E_Response_Binding_Key_List; +typedef struct _E_Response_Binding_Key_Data E_Response_Binding_Key_Data; + struct _E_Response_Module_List { E_Response_Module_Data **modules; @@ -60,6 +89,38 @@ char *lang; }; +struct _E_Response_Binding_Key_List +{ + E_Response_Binding_Key_Data **bindings; + int count; +}; + +struct _E_Response_Binding_Key_Data +{ + E_Lib_Binding_Context ctx; + char *key; + E_Lib_Binding_Modifier mod; + unsigned char any_mod : 1; + char *action; + char *params; +}; + +struct _E_Response_Binding_Mouse_List +{ + E_Response_Binding_Mouse_Data **bindings; + int count; +}; + +struct _E_Response_Binding_Mouse_Data +{ + E_Lib_Binding_Context ctx; + int button; + E_Lib_Binding_Modifier mod; + unsigned char any_mod : 1; + char *action; + char *params; +}; + extern EAPI int E_RESPONSE_MODULE_LIST; extern EAPI int E_RESPONSE_BACKGROUND_GET; extern EAPI int E_RESPONSE_LANGUAGE_GET; @@ -74,6 +135,9 @@ extern EAPI int E_RESPONSE_MODULE_DIRS_LIST; extern EAPI int E_RESPONSE_BACKGROUND_DIRS_LIST; +extern EAPI int E_RESPONSE_BINDING_KEY_LIST; +extern EAPI int E_RESPONSE_BINDING_MOUSE_LIST; + #ifdef __cplusplus extern "C" { #endif @@ -97,6 +161,19 @@ EAPI void e_lib_desktop_background_add (const int con, const int zone, const int desk_x, const int desk_y, const char *bgfile); EAPI void e_lib_desktop_background_del (const int con, const int zone, const int desk_x, const int desk_y); + /* key/mouse bindings */ + EAPI void e_lib_bindings_key_list (void); + EAPI void e_lib_binding_key_del (unsigned int *context, unsigned int modifiers, const char *key, + unsigned int any_mod, const char *action, const char *params); + EAPI void e_lib_binding_key_add (unsigned int *context, unsigned int modifiers, const char *key, + unsigned int any_mod, const char *action, const char *params); + + EAPI void e_lib_bindings_mouse_list (void); + EAPI void e_lib_binding_mouse_del (unsigned int *context, unsigned int modifiers, unsigned int button, + unsigned int any_mod, const char *action, const char *params); + EAPI void e_lib_binding_mouse_add (unsigned int *context, unsigned int modifiers, unsigned int button, + unsigned int any_mod, const char *action, const char *params); + /* E current theme manipulation */ EAPI void e_lib_theme_set (const char *category, const char *file); EAPI void e_lib_theme_get (const char *category); =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/lib/e_main.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -3 -r1.30 -r1.31 --- e_main.c 1 Aug 2005 07:34:51 -0000 1.30 +++ e_main.c 10 Aug 2005 04:52:07 -0000 1.31 @@ -51,6 +51,11 @@ static void _e_cb_module_list_free(void *data, void *ev); static void _e_cb_dir_list_free(void *data __UNUSED__, void *ev); +static void e_lib_binding_key_handle(int hdl, unsigned int *context, unsigned int modifiers, const char *key, + unsigned int any_mod, const char *action, const char *params); +static void e_lib_binding_mouse_handle(int hdl, unsigned int *context, unsigned int modifiers, unsigned int button, + unsigned int any_mod, const char *action, const char *params); + static Ecore_Ipc_Server *_e_ipc_server = NULL; int E_RESPONSE_MODULE_LIST = 0; @@ -67,6 +72,8 @@ int E_RESPONSE_MODULE_DIRS_LIST = 0; int E_RESPONSE_BACKGROUND_DIRS_LIST = 0; +int E_RESPONSE_BINDING_KEY_LIST = 0; +int E_RESPONSE_BINDING_MOUSE_LIST = 0; /* * initialise connection to the current E running on "display". @@ -153,6 +160,8 @@ E_RESPONSE_MODULE_DIRS_LIST = ecore_event_type_new(); E_RESPONSE_BACKGROUND_DIRS_LIST = ecore_event_type_new(); + E_RESPONSE_BINDING_KEY_LIST = ecore_event_type_new(); + E_RESPONSE_BINDING_MOUSE_LIST = ecore_event_type_new(); } if (free_disp) @@ -390,6 +399,125 @@ _e_ipc_call(E_IPC_OP_DIRS_LIST, &type); } +void +e_lib_bindings_key_list(void) +{ + _e_ipc_call(E_IPC_OP_BINDING_KEY_LIST, NULL); +} + +static void +e_lib_binding_key_handle(int hdl, unsigned int *context, unsigned int modifiers, const char *key, + unsigned int any_mod, const char *action, const char *key_params) +{ + char buf[256]; + char *params[6]; + int i; + + for (i = 0; i < 5; i++) + params[i] = calloc(5, sizeof(char)); + + snprintf(buf, 256, "%d", context); + params[0] = strdup(buf); + + snprintf(buf, 256, "%d", modifiers); + params[1] = strdup(buf); + + params[2] = strdup(key); + + snprintf(buf, 256, "%d", any_mod); + params[3] = strdup(buf); + + params[4] = strdup(action); + params[5] = strdup(key_params); + + if ((!params[0]) || (!params[1]) || (!params[2]) + || (!params[3]) || (!params[4]) || (!params[5])) + return; + + _e_ipc_call(hdl, params); + + free(params[0]); + free(params[1]); + free(params[2]); + free(params[3]); + free(params[4]); + free(params[5]); +} + +void +e_lib_binding_key_del(unsigned int *context, unsigned int modifiers, const char *key, + unsigned int any_mod, const char *action, const char *params) +{ + e_lib_binding_key_handle(E_IPC_OP_BINDING_KEY_DEL, context, modifiers, key, any_mod, action, params); +} + +void +e_lib_binding_key_add(unsigned int *context, unsigned int modifiers, const char *key, + unsigned int any_mod, const char *action, const char *params) +{ + e_lib_binding_key_handle(E_IPC_OP_BINDING_KEY_ADD, context, modifiers, key, any_mod, action, params); +} + +void +e_lib_bindings_mouse_list(void) +{ + _e_ipc_call(E_IPC_OP_BINDING_MOUSE_LIST, NULL); +} + +static void +e_lib_binding_mouse_handle(int hdl, unsigned int *context, unsigned int modifiers, unsigned int button, + unsigned int any_mod, const char *action, const char *mouse_params) +{ + char buf[256]; + char *params[6]; + int i; + + for (i = 0; i < 5; i++) + params[i] = calloc(5, sizeof(char)); + + snprintf(buf, 256, "%d", context); + params[0] = strdup(buf); + + snprintf(buf, 256, "%d", modifiers); + params[1] = strdup(buf); + + snprintf(buf, 256, "%d", button); + params[2] = strdup(buf); + + snprintf(buf, 256, "%d", any_mod); + params[3] = strdup(buf); + + params[4] = strdup(action); + params[5] = strdup(mouse_params); + + if ((!params[0]) || (!params[1]) || (!params[2]) + || (!params[3]) || (!params[4]) || (!params[5])) + return; + + _e_ipc_call(hdl, params); + + free(params[0]); + free(params[1]); + free(params[2]); + free(params[3]); + free(params[4]); + free(params[5]); +} + +void +e_lib_binding_mouse_del(unsigned int *context, unsigned int modifiers, unsigned int button, + unsigned int any_mod, const char *action, const char *params) +{ + e_lib_binding_mouse_handle(E_IPC_OP_BINDING_MOUSE_DEL, context, modifiers, button, any_mod, action, params); +} + +void +e_lib_binding_mouse_add(unsigned int *context, unsigned int modifiers, unsigned int button, + unsigned int any_mod, const char *action, const char *params) +{ + e_lib_binding_mouse_handle(E_IPC_OP_BINDING_MOUSE_ADD, context, modifiers, button, any_mod, action, params); +} + static int _e_ipc_init(const char *display) { ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs