Enlightenment CVS committal Author : sebastid Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: Makefile.am e_actions.c e_bindings.c e_includes.h e_int_menus.c e_pointer.c e_pointer.h Log Message: pointer stack work. =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/Makefile.am,v retrieving revision 1.51 retrieving revision 1.52 diff -u -3 -r1.51 -r1.52 --- Makefile.am 6 Oct 2005 18:49:53 -0000 1.51 +++ Makefile.am 9 Oct 2005 18:02:17 -0000 1.52 @@ -80,7 +80,8 @@ e_theme_about.h \ e_apps_cache.h \ e_entry.h \ -e_scrollbar.h +e_scrollbar.h \ +e_fileman.h enlightenment_src = \ e_user.c \ @@ -143,6 +144,7 @@ e_apps_cache.c \ e_entry.c \ e_scrollbar.c \ +e_fileman.c \ $(ENLIGHTENMENTHEADERS) enlightenment_SOURCES = \ =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_actions.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -3 -r1.38 -r1.39 --- e_actions.c 9 Oct 2005 08:54:24 -0000 1.38 +++ e_actions.c 9 Oct 2005 18:02:17 -0000 1.39 @@ -1213,27 +1213,38 @@ ecore_main_loop_quit(); } -ACT_FN_GO(pointer) +ACT_FN_GO(pointer_push) { - /* TODO: Check for valid pointer types? */ E_Manager *man = NULL; - if (!obj) obj = E_OBJECT(e_manager_current_get()); if (!obj) return; if (obj->type == E_BORDER_TYPE) { E_Border *bd; bd = (E_Border *)obj; if (bd->zone) - obj = bd->zone->container->manager; + man = bd->zone->container->manager; } - if (obj->type != E_MANAGER_TYPE) + if (!man) man = e_manager_current_get(); + if (!man) return; + e_pointer_type_push(man->pointer, obj, params); +} + +ACT_FN_GO(pointer_pop) +{ + E_Manager *man = NULL; + + if (!obj) return; + if (obj->type == E_BORDER_TYPE) { - obj = E_OBJECT(e_manager_current_get()); - if (!obj) return; + E_Border *bd; + bd = (E_Border *)obj; + if (bd->zone) + man = (E_Manager *)bd->zone->container->manager; } - man = (E_Manager *)obj; - e_pointer_type_set(man->pointer, params); + if (!man) man = e_manager_current_get(); + if (!man) return; + e_pointer_type_pop(man->pointer, obj, params); } /* local subsystem globals */ @@ -1326,7 +1337,8 @@ ACT_GO(restart); ACT_GO(exit); - ACT_GO(pointer); + ACT_GO(pointer_push); + ACT_GO(pointer_pop); return 1; } =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_bindings.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -3 -r1.21 -r1.22 --- e_bindings.c 9 Oct 2005 08:54:24 -0000 1.21 +++ e_bindings.c 9 Oct 2005 18:02:17 -0000 1.22 @@ -62,9 +62,9 @@ } e_bindings_signal_add(E_BINDING_CONTEXT_BORDER, "mouse,in", "resize_br", - E_BINDING_MODIFIER_NONE, 1, "pointer", "resize_br"); + E_BINDING_MODIFIER_NONE, 1, "pointer_push", "resize_br"); e_bindings_signal_add(E_BINDING_CONTEXT_BORDER, "mouse,out", "resize_br", - E_BINDING_MODIFIER_NONE, 1, "pointer", "default"); + E_BINDING_MODIFIER_NONE, 1, "pointer_pop", "resize_br"); return 1; } =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_includes.h,v retrieving revision 1.36 retrieving revision 1.37 diff -u -3 -r1.36 -r1.37 --- e_includes.h 4 Oct 2005 12:05:21 -0000 1.36 +++ e_includes.h 9 Oct 2005 18:02:17 -0000 1.37 @@ -62,3 +62,4 @@ #include "e_theme_about.h" #include "e_apps_cache.h" #include "e_scrollbar.h" +#include "e_fileman.h" =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_int_menus.c,v retrieving revision 1.100 retrieving revision 1.101 diff -u -3 -r1.100 -r1.101 --- e_int_menus.c 28 Sep 2005 17:36:35 -0000 1.100 +++ e_int_menus.c 9 Oct 2005 18:02:17 -0000 1.101 @@ -32,6 +32,7 @@ static void _e_int_menus_apps_del_hook (void *obj); static void _e_int_menus_apps_free_hook (void *obj); static void _e_int_menus_apps_run (void *data, E_Menu *m, E_Menu_Item *mi); +static void _e_int_menus_main_fm (void *data, E_Menu *m, E_Menu_Item *mi); static void _e_int_menus_config_pre_cb (void *data, E_Menu *m); static void _e_int_menus_config_free_hook (void *obj); static void _e_int_menus_config_item_cb (void *data, E_Menu *m, E_Menu_Item *mi); @@ -143,6 +144,11 @@ e_menu_item_callback_set(mi, _e_int_menus_main_run, NULL); } + mi = e_menu_item_new(m); + e_menu_item_label_set(mi, _("File Manager")); + e_util_menu_item_edje_icon_set(mi, "enlightenment/fileman"); + e_menu_item_callback_set(mi, _e_int_menus_main_fm, NULL); + subm = e_int_menus_config_new(); dat->config = subm; mi = e_menu_item_new(m); @@ -378,6 +384,15 @@ } static void +_e_int_menus_main_fm(void *data, E_Menu *m, E_Menu_Item *mi) +{ + E_Fileman_Canvas *canvas; + + canvas = e_fileman_new(m->zone->container); + e_fileman_show(canvas); +} + +static void _e_int_menus_main_restart(void *data, E_Menu *m, E_Menu_Item *mi) { E_Action *a; =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_pointer.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- e_pointer.c 9 Oct 2005 08:54:24 -0000 1.13 +++ e_pointer.c 9 Oct 2005 18:02:17 -0000 1.14 @@ -6,12 +6,23 @@ /* * TODO * - Make fallback user controlable. + * - Define the allowed signals? */ +typedef struct _E_Pointer_Stack E_Pointer_Stack; + +struct _E_Pointer_Stack +{ + void *obj; + char *type; + unsigned char e_cursor : 1; +}; + 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); +static int _e_pointer_type_set(E_Pointer *p); /* externally accessible functions */ E_Pointer * @@ -31,14 +42,6 @@ p = E_OBJECT_ALLOC(E_Pointer, E_POINTER_TYPE, _e_pointer_free); if (!p) return NULL; p->e_cursor = 1; - - p->type = strdup("default"); - if (!p->type) - { - e_object_del(E_OBJECT(p)); - return NULL; - } - p->win = win; p->w = e_config->cursor_size; @@ -85,44 +88,6 @@ return NULL; } p->pointer_object = o; - if (ecore_x_cursor_color_supported_get()) - { - if (!e_theme_edje_object_set(o, - "base/theme/pointer", - "pointer/enlightenment/default/color")) - { - /* fallback on x cursor */ - p->e_cursor = 0; - free(p->type); - p->type = strdup(""); - free(p->evas); - p->evas = NULL; - free(p->pixels); - p->evas = NULL; - e_pointer_type_set(p, "default"); - return p; - } - p->color = 1; - } - else - { - if (!e_theme_edje_object_set(o, - "base/theme/pointer", - "pointer/enlightenment/default/mono")) - { - /* fallback on x cursor */ - p->e_cursor = 0; - free(p->type); - p->type = strdup(""); - free(p->evas); - p->evas = NULL; - free(p->pixels); - p->evas = NULL; - e_pointer_type_set(p, "default"); - return p; - } - p->color = 0; - } /* Create the hotspot object */ o = evas_object_rectangle_add(p->evas); @@ -135,13 +100,24 @@ evas_object_event_callback_add(o, EVAS_CALLBACK_MOVE, _e_pointer_cb_move, p); - edje_object_part_swallow(p->pointer_object, "hotspot", o); + + /* Init the cursor object */ + if (ecore_x_cursor_color_supported_get()) + { + p->color = 1; + } + else + { + p->color = 0; + } /* init edje */ 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_pointer_type_push(p, p, "default"); + _e_pointers = evas_list_append(_e_pointers, p); } else @@ -149,18 +125,9 @@ p = E_OBJECT_ALLOC(E_Pointer, E_POINTER_TYPE, _e_pointer_free); if (!p) return NULL; p->e_cursor = 0; - - p->type = strdup("default"); - if (!p->type) - { - e_object_del(E_OBJECT(p)); - return NULL; - } - p->win = win; - ecore_x_window_cursor_set(win, - ecore_x_cursor_shape_get(ECORE_X_CURSOR_LEFT_PTR)); + e_pointer_type_push(p, p, "default"); _e_pointers = evas_list_append(_e_pointers, p); } @@ -200,103 +167,89 @@ } void -e_pointer_type_set(E_Pointer *p, const char *type) +e_pointer_type_push(E_Pointer *p, void *obj, const char *type) { - if (!strcmp(p->type, type)) return; + E_Pointer_Stack *stack; - if (p->e_cursor) - { - Evas_Object *o; - char cursor[1024]; + if (p->type) free(p->type); + p->type = strdup(type); + p->obj = obj; - o = p->pointer_object; - if (p->color) - { - snprintf(cursor, sizeof(cursor), "pointer/enlightenment/%s/color", type); - if (!e_theme_edje_object_set(o, - "base/theme/pointer", - cursor)) - { - /* fallback on x cursor */ - p->e_cursor = 0; - e_pointer_type_set(p, type); - return; - } - } - else + if (!_e_pointer_type_set(p)) + { + p->e_cursor = !p->e_cursor; + if (!_e_pointer_type_set(p)) { - snprintf(cursor, sizeof(cursor), "pointer/enlightenment/%s/mono", type); - if (!e_theme_edje_object_set(o, - "base/theme/pointer", - cursor)) - { - /* fallback on x cursor */ - p->e_cursor = 0; - e_pointer_type_set(p, type); - return; - } + printf("BUG: Can't set cursor!\n"); + return; } - edje_object_part_swallow(p->pointer_object, "hotspot", p->hot_object); - p->hot.update = 1; } - else + + stack = E_NEW(E_Pointer_Stack, 1); + if (stack) { - if (!strcmp(type, "move")) - { - ecore_x_window_cursor_set(p->win, - ecore_x_cursor_shape_get(ECORE_X_CURSOR_FLEUR)); - } - else if (!strcmp(type, "resize_tl")) - { - ecore_x_window_cursor_set(p->win, - ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_LEFT_CORNER)); - } - else if (!strcmp(type, "resize_t")) - { - ecore_x_window_cursor_set(p->win, - ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_SIDE)); - } - else if (!strcmp(type, "resize_tr")) - { - ecore_x_window_cursor_set(p->win, - ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_RIGHT_CORNER)); - } - else if (!strcmp(type, "resize_r")) - { - ecore_x_window_cursor_set(p->win, - ecore_x_cursor_shape_get(ECORE_X_CURSOR_RIGHT_SIDE)); - } - else if (!strcmp(type, "resize_br")) - { - ecore_x_window_cursor_set(p->win, - ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_RIGHT_CORNER)); - } - else if (!strcmp(type, "resize_b")) - { - ecore_x_window_cursor_set(p->win, - ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_SIDE)); - } - else if (!strcmp(type, "resize_bl")) - { - ecore_x_window_cursor_set(p->win, - ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_LEFT_CORNER)); - } - else if (!strcmp(type, "resize_l")) + stack->obj = p->obj; + stack->type = strdup(p->type); + stack->e_cursor = p->e_cursor; + p->stack = evas_list_prepend(p->stack, stack); + } + + /* try the default cursor next time */ + p->e_cursor = e_config->use_e_cursor; +} + +void +e_pointer_type_pop(E_Pointer *p, void *obj, const char *type) +{ + Evas_List *l; + E_Pointer_Stack *stack; + + for (l = p->stack; l;) + { + Evas_List *l2; + + stack = l->data; + l2 = l; + l = l->next; + + if ((stack->obj == obj) && + ((!type) || (!strcmp(stack->type, type)))) { - ecore_x_window_cursor_set(p->win, - ecore_x_cursor_shape_get(ECORE_X_CURSOR_LEFT_SIDE)); + p->stack = evas_list_remove_list(p->stack, l2); } - else + } + + if (!p->stack) + { + printf("BUG: No pointer on the stack!\n"); + return; + } + + stack = p->stack->data; + if ((stack->obj == p->obj) && + (!strcmp(stack->type, p->type))) + { + /* We already use the top pointer */ + return; + } + + if (p->type) free(p->type); + p->type = strdup(stack->type); + p->obj = stack->obj; + + p->e_cursor = stack->e_cursor; + if (!_e_pointer_type_set(p)) + { + p->e_cursor = !p->e_cursor; + if (!_e_pointer_type_set(p)) { - ecore_x_window_cursor_set(p->win, - ecore_x_cursor_shape_get(ECORE_X_CURSOR_LEFT_PTR)); + printf("BUG: Can't set cursor!\n"); + return; } } + /* try the default cursor next time */ p->e_cursor = e_config->use_e_cursor; - - if (p->type) free(p->type); - p->type = strdup(type); } void @@ -357,10 +310,127 @@ while (p->stack) { - free(p->stack->data); + E_Pointer_Stack *stack; + + stack = p->stack->data; + free(stack->type); + free(stack); + p->stack = evas_list_remove_list(p->stack, p->stack); } if (p->type) free(p->type); free(p); } + +static int +_e_pointer_type_set(E_Pointer *p) +{ + if (p->e_cursor) + { + Evas_Object *o; + char cursor[1024]; + + o = p->pointer_object; + if (p->color) + { + snprintf(cursor, sizeof(cursor), "pointer/enlightenment/%s/color", p->type); + if (!e_theme_edje_object_set(o, + "base/theme/pointer", + cursor)) + { + return 0; + } + } + else + { + snprintf(cursor, sizeof(cursor), "pointer/enlightenment/%s/mono", p->type); + if (!e_theme_edje_object_set(o, + "base/theme/pointer", + cursor)) + { + return 0; + } + } + edje_object_part_swallow(p->pointer_object, "hotspot", p->hot_object); + p->hot.update = 1; + } + else + { + Ecore_X_Cursor cursor; + if (!strcmp(p->type, "move")) + { + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_FLEUR); + if (!cursor) printf("X Cursor for %s is missing\n", p->type); + ecore_x_window_cursor_set(p->win, cursor); + } + else if (!strcmp(p->type, "resize")) + { + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_SIZING); + if (!cursor) printf("X Cursor for %s is missing\n", p->type); + ecore_x_window_cursor_set(p->win, cursor); + } + else if (!strcmp(p->type, "resize_tl")) + { + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_LEFT_CORNER); + if (!cursor) printf("X Cursor for %s is missing\n", p->type); + ecore_x_window_cursor_set(p->win, cursor); + } + else if (!strcmp(p->type, "resize_t")) + { + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_SIDE); + if (!cursor) printf("X Cursor for %s is missing\n", p->type); + ecore_x_window_cursor_set(p->win, cursor); + } + else if (!strcmp(p->type, "resize_tr")) + { + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_RIGHT_CORNER); + if (!cursor) printf("X Cursor for %s is missing\n", p->type); + ecore_x_window_cursor_set(p->win, cursor); + } + else if (!strcmp(p->type, "resize_r")) + { + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_RIGHT_SIDE); + if (!cursor) printf("X Cursor for %s is missing\n", p->type); + ecore_x_window_cursor_set(p->win, cursor); + } + else if (!strcmp(p->type, "resize_br")) + { + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_RIGHT_CORNER); + if (!cursor) printf("X Cursor for %s is missing\n", p->type); + ecore_x_window_cursor_set(p->win, cursor); + } + else if (!strcmp(p->type, "resize_b")) + { + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_SIDE); + if (!cursor) printf("X Cursor for %s is missing\n", p->type); + ecore_x_window_cursor_set(p->win, cursor); + } + else if (!strcmp(p->type, "resize_bl")) + { + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_LEFT_CORNER); + if (!cursor) printf("X Cursor for %s is missing\n", p->type); + ecore_x_window_cursor_set(p->win, cursor); + } + else if (!strcmp(p->type, "resize_l")) + { + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_LEFT_SIDE); + if (!cursor) printf("X Cursor for %s is missing\n", p->type); + ecore_x_window_cursor_set(p->win, cursor); + } + else if (!strcmp(p->type, "default")) + { + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_LEFT_PTR); + if (!cursor) printf("X Cursor for %s is missing\n", p->type); + ecore_x_window_cursor_set(p->win, cursor); + } + else + { + printf("Unknown pointer p->type: %s\n", p->type); + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_LEFT_PTR); + if (!cursor) printf("X Cursor for default is missing\n"); + ecore_x_window_cursor_set(p->win, cursor); + } + } + return 1; +} =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_pointer.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- e_pointer.h 9 Oct 2005 08:54:24 -0000 1.11 +++ e_pointer.h 9 Oct 2005 18:02:17 -0000 1.12 @@ -26,6 +26,7 @@ int w, h; char *type; + void *obj; Evas_List *stack; struct { @@ -35,7 +36,8 @@ }; EAPI E_Pointer *e_pointer_window_new(Ecore_X_Window win); -EAPI void e_pointer_type_set(E_Pointer *p, const char *type); +EAPI void e_pointer_type_push(E_Pointer *p, void *obj, const char *type); +EAPI void e_pointer_type_pop(E_Pointer *p, void *obj, const char *type); EAPI void e_pointers_size_set(int size); EAPI void e_pointer_idler_before(void); ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs