From c0096e11c0a18716a3562b4105968702255d30b5 Mon Sep 17 00:00:00 2001 From: sebastid Date: Sun, 9 Oct 2005 18:11:10 +0000 Subject: [PATCH] Don't change pointer if it is equal. SVN revision: 17354 --- src/bin/e_pointer.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/bin/e_pointer.c b/src/bin/e_pointer.c index 84c6c8c59..1cca73129 100644 --- a/src/bin/e_pointer.c +++ b/src/bin/e_pointer.c @@ -22,7 +22,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); -static int _e_pointer_type_set(E_Pointer *p); +static int _e_pointer_type_set(E_Pointer *p, const char *type); /* externally accessible functions */ E_Pointer * @@ -171,20 +171,20 @@ e_pointer_type_push(E_Pointer *p, void *obj, const char *type) { E_Pointer_Stack *stack; - if (p->type) free(p->type); - p->type = strdup(type); - p->obj = obj; - - if (!_e_pointer_type_set(p)) + if (!_e_pointer_type_set(p, type)) { p->e_cursor = !p->e_cursor; - if (!_e_pointer_type_set(p)) + if (!_e_pointer_type_set(p, type)) { printf("BUG: Can't set cursor!\n"); return; } } + if (p->type) free(p->type); + p->type = strdup(type); + p->obj = obj; + stack = E_NEW(E_Pointer_Stack, 1); if (stack) { @@ -233,21 +233,21 @@ e_pointer_type_pop(E_Pointer *p, void *obj, const char *type) 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)) + if (!_e_pointer_type_set(p, stack->type)) { p->e_cursor = !p->e_cursor; - if (!_e_pointer_type_set(p)) + if (!_e_pointer_type_set(p, stack->type)) { printf("BUG: Can't set cursor!\n"); return; } } + if (p->type) free(p->type); + p->type = strdup(stack->type); + p->obj = stack->obj; + /* try the default cursor next time */ p->e_cursor = e_config->use_e_cursor; } @@ -324,8 +324,11 @@ _e_pointer_free(E_Pointer *p) } static int -_e_pointer_type_set(E_Pointer *p) +_e_pointer_type_set(E_Pointer *p, const char *type) { + /* Check if this pointer is already set */ + if ((p->type) && (!strcmp(p->type, type))) return 1; + if (p->e_cursor) { Evas_Object *o;