Enlightenment CVS committal Author : sebastid Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_config.c e_config.h e_ipc_handlers.h e_ipc_handlers_list.h e_pointer.c e_pointer.h Log Message: More work on themeable cursor. =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_config.c,v retrieving revision 1.89 retrieving revision 1.90 diff -u -3 -r1.89 -r1.90 --- e_config.c 6 Aug 2005 04:12:17 -0000 1.89 +++ e_config.c 21 Aug 2005 23:37:28 -0000 1.90 @@ -298,6 +298,7 @@ E_CONFIG_VAL(D, T, resize_info_follows, INT); /**/ E_CONFIG_VAL(D, T, focus_last_focused_per_desktop, INT); /**/ E_CONFIG_VAL(D, T, focus_revert_on_hide_or_close, INT); /**/ + E_CONFIG_VAL(D, T, cursor_size, INT); /**/ e_config = e_config_domain_load("e", _e_config_edd); if (e_config) @@ -403,6 +404,7 @@ e_config->resize_info_follows = 1; e_config->focus_last_focused_per_desktop = 1; e_config->focus_revert_on_hide_or_close = 1; + e_config->cursor_size = 32; { E_Config_Module *em; @@ -959,6 +961,7 @@ E_CONFIG_LIMIT(e_config->resize_info_follows, 0, 1); E_CONFIG_LIMIT(e_config->focus_last_focused_per_desktop, 0, 1); E_CONFIG_LIMIT(e_config->focus_revert_on_hide_or_close, 0, 1); + E_CONFIG_LIMIT(e_config->cursor_size, 0, 1024); /* apply lang config - exception because config is loaded after intl setup */ =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_config.h,v retrieving revision 1.46 retrieving revision 1.47 diff -u -3 -r1.46 -r1.47 --- e_config.h 6 Aug 2005 04:12:18 -0000 1.46 +++ e_config.h 21 Aug 2005 23:37:28 -0000 1.47 @@ -48,7 +48,7 @@ * defaults for e to work - started at 100 when we introduced this config * versioning feature */ -#define E_CONFIG_FILE_VERSION 121 +#define E_CONFIG_FILE_VERSION 122 #define E_EVAS_ENGINE_DEFAULT 0 #define E_EVAS_ENGINE_SOFTWARE_X11 1 @@ -142,6 +142,7 @@ int resize_info_follows; int focus_last_focused_per_desktop; int focus_revert_on_hide_or_close; + int cursor_size; }; struct _E_Config_Module =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_ipc_handlers.h,v retrieving revision 1.63 retrieving revision 1.64 diff -u -3 -r1.63 -r1.64 --- e_ipc_handlers.h 10 Aug 2005 04:52:07 -0000 1.63 +++ e_ipc_handlers.h 21 Aug 2005 23:37:28 -0000 1.64 @@ -4589,6 +4589,51 @@ #endif #undef HDL +/****************************************************************************/ + +#define HDL E_IPC_OP_CURSOR_SIZE_SET +#if (TYPE == E_REMOTE_OPTIONS) + OP("-cursor-size-set", 1, "Set the E cursor size", 0, HDL) +#elif (TYPE == E_REMOTE_OUT) + REQ_INT(atoi(params[0]), HDL); +#elif (TYPE == E_WM_IN) + START_INT(val, HDL); + e_config->cursor_size = val; + /* TODO: Update cursor size on screen! */ + E_CONFIG_LIMIT(e_config->cursor_size, 0, 1024); + SAVE; + END_INT; +#elif (TYPE == E_REMOTE_IN) +#endif +#undef HDL + +/****************************************************************************/ +#define HDL E_IPC_OP_CURSOR_SIZE_GET +#if (TYPE == E_REMOTE_OPTIONS) + OP("-cursor-size-get", 0, "Get the E cursor size", 1, HDL) +#elif (TYPE == E_REMOTE_OUT) + REQ_NULL(HDL); +#elif (TYPE == E_WM_IN) + SEND_INT(e_config->cursor_size, E_IPC_OP_CURSOR_SIZE_GET_REPLY, HDL); +#elif (TYPE == E_REMOTE_IN) +#endif +#undef HDL + +/****************************************************************************/ +#define HDL E_IPC_OP_CURSOR_SIZE_GET_REPLY +#if (TYPE == E_REMOTE_OPTIONS) +#elif (TYPE == E_REMOTE_OUT) +#elif (TYPE == E_WM_IN) +#elif (TYPE == E_REMOTE_IN) + START_INT(val, HDL); + printf("REPLY: %d\n", val); + END_INT; +#endif +#undef HDL + +/****************************************************************************/ + + #if 0 } #endif =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_ipc_handlers_list.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -3 -r1.15 -r1.16 --- e_ipc_handlers_list.h 6 Aug 2005 04:00:03 -0000 1.15 +++ e_ipc_handlers_list.h 21 Aug 2005 23:37:28 -0000 1.16 @@ -222,3 +222,6 @@ #define E_IPC_OP_DESKTOP_NAME_DEL 222 #define E_IPC_OP_DESKTOP_NAME_LIST 223 #define E_IPC_OP_DESKTOP_NAME_LIST_REPLY 224 +#define E_IPC_OP_CURSOR_SIZE_SET 225 +#define E_IPC_OP_CURSOR_SIZE_GET 226 +#define E_IPC_OP_CURSOR_SIZE_GET_REPLY 227 =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_pointer.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- e_pointer.c 17 Aug 2005 01:35:48 -0000 1.6 +++ e_pointer.c 21 Aug 2005 23:37:28 -0000 1.7 @@ -5,6 +5,7 @@ static Evas_List *_e_pointers = NULL; +static void _e_pointer_cb_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); static void _e_pointer_free(E_Pointer *p); /* externally accessible functions */ @@ -13,8 +14,8 @@ { Evas_Engine_Info_Buffer *einfo; E_Pointer *p; + Evas_Object *o; int rmethod; - Evas_Coord w, h; rmethod = evas_render_method_lookup("buffer"); if (!rmethod) return NULL; @@ -24,8 +25,8 @@ p->win = win; - p->w = 10; - p->h = 10; + p->w = e_config->cursor_size; + p->h = e_config->cursor_size; /* create evas */ p->evas = evas_new(); @@ -49,16 +50,17 @@ } /* set the pointer edje */ - p->evas_object = edje_object_add(p->evas); + o = edje_object_add(p->evas); + p->pointer_object = o; if (ecore_x_cursor_color_supported_get()) { - if (!e_theme_edje_object_set(p->evas_object, + if (!e_theme_edje_object_set(o, "base/theme/pointer", "pointer/enlightenment/default")) { /* error */ printf("ERROR: No default theme for pointer!\n"); - if (!e_theme_edje_object_set(p->evas_object, + if (!e_theme_edje_object_set(o, "base/theme/pointer", "pointer/enlightenment/mono")) { @@ -69,7 +71,7 @@ } else { - if (!e_theme_edje_object_set(p->evas_object, + if (!e_theme_edje_object_set(o, "base/theme/pointer", "pointer/enlightenment/mono")) { @@ -77,42 +79,19 @@ printf("ERROR: No mono theme for pointer!\n"); } } - edje_object_calc_force(p->evas_object); - edje_object_size_min_calc(p->evas_object, &w, &h); - if ((w == 0) || (h == 0)) - { - /* error */ - printf("The size of the pointer is 0!\n"); - w = h = 10; - } - p->w = w; - p->h = h; - /* resize evas */ - evas_output_size_set(p->evas, p->w, p->h); - evas_output_viewport_set(p->evas, 0, 0, p->w, p->h); - evas_damage_rectangle_add(p->evas, 0, 0, p->w, p->h); - - free(p->pixels); - p->pixels = calloc(p->w * p->h, sizeof(int)); - - einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(p->evas); - if (einfo) - { - einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; - einfo->info.dest_buffer = p->pixels; - einfo->info.dest_buffer_row_bytes = p->w * sizeof(int); - einfo->info.use_color_key = 0; - einfo->info.alpha_threshold = 0; - einfo->info.func.new_update_region = NULL; - einfo->info.func.free_update_region = NULL; - evas_engine_info_set(p->evas, (Evas_Engine_Info *)einfo); - } + /* Create the hotspot object */ + o = evas_object_rectangle_add(p->evas); + p->hot_object = o; + evas_object_event_callback_add(o, + EVAS_CALLBACK_MOVE, + _e_pointer_cb_move, p); + edje_object_part_swallow(p->pointer_object, "hotspot", o); /* init edje */ - evas_object_move(p->evas_object, 0, 0); - evas_object_resize(p->evas_object, p->w, p->h); - evas_object_show(p->evas_object); + evas_object_move(p->pointer_object, 0, 0); + evas_object_resize(p->pointer_object, p->w, p->h); + evas_object_show(p->pointer_object); _e_pointers = evas_list_append(_e_pointers, p); return p; @@ -133,28 +112,38 @@ if (updates) { Ecore_X_Cursor cur; - Evas_Coord w, h; - - evas_render_updates_free(updates); - /* TODO: Resize evas if pointer changes */ - evas_object_geometry_get(p->evas_object, NULL, NULL, &w, &h); - cur = ecore_x_cursor_new(p->win, p->pixels, p->w, p->h, 0, 0); + cur = ecore_x_cursor_new(p->win, p->pixels, p->w, p->h, p->hot.x, p->hot.y); ecore_x_window_cursor_set(p->win, cur); ecore_x_cursor_free(cur); + + evas_render_updates_free(updates); } } } /* local subsystem functions */ static void +_e_pointer_cb_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info) +{ + E_Pointer *p; + Evas_Coord x, y; + + p = data; + evas_object_geometry_get(p->hot_object, &x, &y, NULL, NULL); + p->hot.x = x; + p->hot.y = y; +} + +static void _e_pointer_free(E_Pointer *p) { _e_pointers = evas_list_remove(_e_pointers, p); /* create evas */ - if (p->evas_object) evas_object_del(p->evas_object); + if (p->pointer_object) evas_object_del(p->pointer_object); + if (p->hot_object) evas_object_del(p->hot_object); if (p->evas) evas_free(p->evas); free(p->pixels); =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_pointer.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- e_pointer.h 17 Aug 2005 01:35:48 -0000 1.5 +++ e_pointer.h 21 Aug 2005 23:37:28 -0000 1.6 @@ -16,12 +16,17 @@ E_Object e_obj_inherit; Evas *evas; - Evas_Object *evas_object; + Evas_Object *pointer_object; + Evas_Object *hot_object; int *pixels; Ecore_X_Window win; int w, h; + + struct { + int x, y; + } hot; }; EAPI E_Pointer *e_pointer_window_set(Ecore_X_Window win); ------------------------------------------------------- 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 [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs