diff options
author | Jean Guyomarc'h <jean.guyomarch@openwide.fr> | 2015-10-08 11:58:46 +0200 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2015-12-01 12:15:31 -0800 |
commit | 2c93c73cbd1966e8cead7e7856044a2eb12138d7 (patch) | |
tree | 51897e9c1001d71e92f3ad3bdf086e114be1038f | |
parent | ba4fbb99bc99734b81925793f47cc2601be5bd5b (diff) |
ecore_cocoa: add support for system cursors
- Ecore_Cocoa_Cursor enum which references system cursors;
- API to show/hide cursor: ecore_cocoa_window_cursor_show();
- API to set system cursor: ecore_cocoa_window_cursor_set();
- Ecore_Evas interface to get Ecore_Cocoa_Window from Ecore_Evas.
@feature
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r-- | src/Makefile_Ecore_Cocoa.am | 1 | ||||
-rw-r--r-- | src/Makefile_Ecore_Evas.am | 1 | ||||
-rw-r--r-- | src/lib/ecore_cocoa/Ecore_Cocoa.h | 5 | ||||
-rw-r--r-- | src/lib/ecore_cocoa/Ecore_Cocoa_Cursor.h | 32 | ||||
-rw-r--r-- | src/lib/ecore_cocoa/ecore_cocoa.m | 3 | ||||
-rw-r--r-- | src/lib/ecore_cocoa/ecore_cocoa_private.h | 4 | ||||
-rw-r--r-- | src/lib/ecore_cocoa/ecore_cocoa_window.m | 53 | ||||
-rw-r--r-- | src/lib/ecore_evas/Ecore_Evas.h | 2 | ||||
-rw-r--r-- | src/lib/ecore_evas/ecore_evas.c | 10 | ||||
-rw-r--r-- | src/lib/ecore_evas/ecore_evas_cocoa.h | 14 | ||||
-rw-r--r-- | src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c | 56 |
11 files changed, 172 insertions, 9 deletions
diff --git a/src/Makefile_Ecore_Cocoa.am b/src/Makefile_Ecore_Cocoa.am index 3321b258fb..a158767380 100644 --- a/src/Makefile_Ecore_Cocoa.am +++ b/src/Makefile_Ecore_Cocoa.am | |||
@@ -7,6 +7,7 @@ lib_LTLIBRARIES += lib/ecore_cocoa/libecore_cocoa.la | |||
7 | installed_ecorecocoamainheadersdir = $(includedir)/ecore-cocoa-@VMAJ@ | 7 | installed_ecorecocoamainheadersdir = $(includedir)/ecore-cocoa-@VMAJ@ |
8 | dist_installed_ecorecocoamainheaders_DATA = \ | 8 | dist_installed_ecorecocoamainheaders_DATA = \ |
9 | lib/ecore_cocoa/Ecore_Cocoa.h \ | 9 | lib/ecore_cocoa/Ecore_Cocoa.h \ |
10 | lib/ecore_cocoa/Ecore_Cocoa_Cursor.h \ | ||
10 | lib/ecore_cocoa/Ecore_Cocoa_Keys.h | 11 | lib/ecore_cocoa/Ecore_Cocoa_Keys.h |
11 | 12 | ||
12 | lib_ecore_cocoa_libecore_cocoa_la_SOURCES = \ | 13 | lib_ecore_cocoa_libecore_cocoa_la_SOURCES = \ |
diff --git a/src/Makefile_Ecore_Evas.am b/src/Makefile_Ecore_Evas.am index f8da5e18fa..ed497a6645 100644 --- a/src/Makefile_Ecore_Evas.am +++ b/src/Makefile_Ecore_Evas.am | |||
@@ -20,6 +20,7 @@ lib/ecore_evas/ecore_evas_private.h \ | |||
20 | lib/ecore_evas/ecore_evas_extn.h \ | 20 | lib/ecore_evas/ecore_evas_extn.h \ |
21 | lib/ecore_evas/ecore_evas_extn.c \ | 21 | lib/ecore_evas/ecore_evas_extn.c \ |
22 | lib/ecore_evas/ecore_evas_wayland.h \ | 22 | lib/ecore_evas/ecore_evas_wayland.h \ |
23 | lib/ecore_evas/ecore_evas_cocoa.h \ | ||
23 | lib/ecore_evas/ecore_evas_win32.h \ | 24 | lib/ecore_evas/ecore_evas_win32.h \ |
24 | lib/ecore_evas/ecore_evas_x11.h \ | 25 | lib/ecore_evas/ecore_evas_x11.h \ |
25 | lib/ecore_evas/ecore_evas_util.c | 26 | lib/ecore_evas/ecore_evas_util.c |
diff --git a/src/lib/ecore_cocoa/Ecore_Cocoa.h b/src/lib/ecore_cocoa/Ecore_Cocoa.h index 78d15ced48..4341389ce2 100644 --- a/src/lib/ecore_cocoa/Ecore_Cocoa.h +++ b/src/lib/ecore_cocoa/Ecore_Cocoa.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #include <Eina.h> | 28 | #include <Eina.h> |
29 | #include "Ecore_Cocoa_Cursor.h" | ||
29 | 30 | ||
30 | #ifdef __cplusplus | 31 | #ifdef __cplusplus |
31 | extern "C" { | 32 | extern "C" { |
@@ -165,6 +166,10 @@ EAPI int ecore_cocoa_titlebar_height_get(void); | |||
165 | 166 | ||
166 | EAPI Ecore_Cocoa_Window_Id ecore_cocoa_window_get_window_id(Ecore_Cocoa_Window *window); | 167 | EAPI Ecore_Cocoa_Window_Id ecore_cocoa_window_get_window_id(Ecore_Cocoa_Window *window); |
167 | 168 | ||
169 | |||
170 | EAPI void ecore_cocoa_window_cursor_set(Ecore_Cocoa_Window *win, Ecore_Cocoa_Cursor c); | ||
171 | EAPI void ecore_cocoa_window_cursor_show(Ecore_Cocoa_Window *win, Eina_Bool show); | ||
172 | |||
168 | #ifdef __cplusplus | 173 | #ifdef __cplusplus |
169 | } | 174 | } |
170 | #endif | 175 | #endif |
diff --git a/src/lib/ecore_cocoa/Ecore_Cocoa_Cursor.h b/src/lib/ecore_cocoa/Ecore_Cocoa_Cursor.h new file mode 100644 index 0000000000..6bca47f6aa --- /dev/null +++ b/src/lib/ecore_cocoa/Ecore_Cocoa_Cursor.h | |||
@@ -0,0 +1,32 @@ | |||
1 | #ifndef __ECORE_COCOA_CURSOR_H__ | ||
2 | #define __ECORE_COCOA_CURSOR_H__ | ||
3 | |||
4 | typedef enum | ||
5 | { | ||
6 | ECORE_COCOA_CURSOR_ARROW = 0, | ||
7 | ECORE_COCOA_CURSOR_CONTEXTUAL_MENU, | ||
8 | ECORE_COCOA_CURSOR_CLOSED_HAND, | ||
9 | ECORE_COCOA_CURSOR_CROSSHAIR, | ||
10 | ECORE_COCOA_CURSOR_DISAPPEARING_ITEM, | ||
11 | ECORE_COCOA_CURSOR_DRAG_COPY, | ||
12 | ECORE_COCOA_CURSOR_DRAG_LINK, | ||
13 | ECORE_COCOA_CURSOR_IBEAM, | ||
14 | ECORE_COCOA_CURSOR_OPEN_HAND, | ||
15 | ECORE_COCOA_CURSOR_OPERATION_NOT_ALLOWED, | ||
16 | ECORE_COCOA_CURSOR_POINTING_HAND, | ||
17 | ECORE_COCOA_CURSOR_RESIZE_DOWN, | ||
18 | ECORE_COCOA_CURSOR_RESIZE_LEFT, | ||
19 | ECORE_COCOA_CURSOR_RESIZE_LEFT_RIGHT, | ||
20 | ECORE_COCOA_CURSOR_RESIZE_RIGHT, | ||
21 | ECORE_COCOA_CURSOR_RESIZE_UP, | ||
22 | ECORE_COCOA_CURSOR_RESIZE_UP_DOWN, | ||
23 | ECORE_COCOA_CURSOR_IBEAM_VERTICAL, | ||
24 | |||
25 | __ECORE_COCOA_CURSOR_LAST, /* Sentinel */ | ||
26 | |||
27 | ECORE_COCOA_CURSOR_DEFAULT = ECORE_COCOA_CURSOR_ARROW | ||
28 | |||
29 | } Ecore_Cocoa_Cursor; | ||
30 | |||
31 | #endif /* ! __ECORE_COCOA_CURSOR_H__ */ | ||
32 | |||
diff --git a/src/lib/ecore_cocoa/ecore_cocoa.m b/src/lib/ecore_cocoa/ecore_cocoa.m index d4e85804b2..1227f2a2a9 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa.m +++ b/src/lib/ecore_cocoa/ecore_cocoa.m | |||
@@ -61,6 +61,9 @@ ecore_cocoa_init(void) | |||
61 | /* Start events monitoring */ | 61 | /* Start events monitoring */ |
62 | [NSApp run]; | 62 | [NSApp run]; |
63 | 63 | ||
64 | if (!_ecore_cocoa_window_init()) | ||
65 | return --_ecore_cocoa_init_count; | ||
66 | |||
64 | return _ecore_cocoa_init_count; | 67 | return _ecore_cocoa_init_count; |
65 | } | 68 | } |
66 | 69 | ||
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_private.h b/src/lib/ecore_cocoa/ecore_cocoa_private.h index ffe48ab074..9952278cea 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa_private.h +++ b/src/lib/ecore_cocoa/ecore_cocoa_private.h | |||
@@ -62,4 +62,8 @@ struct _Ecore_Cocoa_Window | |||
62 | }; | 62 | }; |
63 | 63 | ||
64 | 64 | ||
65 | /* Internal init */ | ||
66 | Eina_Bool _ecore_cocoa_window_init(void); | ||
67 | |||
68 | |||
65 | #endif | 69 | #endif |
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_window.m b/src/lib/ecore_cocoa/ecore_cocoa_window.m index 53137a0a84..de905c53ee 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa_window.m +++ b/src/lib/ecore_cocoa/ecore_cocoa_window.m | |||
@@ -6,9 +6,13 @@ | |||
6 | 6 | ||
7 | #include <Ecore.h> | 7 | #include <Ecore.h> |
8 | #include <Ecore_Cocoa.h> | 8 | #include <Ecore_Cocoa.h> |
9 | #include <Ecore_Cocoa_Cursor.h> | ||
9 | #import "ecore_cocoa_window.h" | 10 | #import "ecore_cocoa_window.h" |
10 | #include "ecore_cocoa_private.h" | 11 | #include "ecore_cocoa_private.h" |
11 | 12 | ||
13 | static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST]; | ||
14 | |||
15 | |||
12 | @implementation EcoreCocoaWindow | 16 | @implementation EcoreCocoaWindow |
13 | 17 | ||
14 | @synthesize ecore_window_data; | 18 | @synthesize ecore_window_data; |
@@ -501,3 +505,52 @@ Ecore_Cocoa_Window_Id ecore_cocoa_window_get_window_id(Ecore_Cocoa_Window *windo | |||
501 | 505 | ||
502 | return window->window; | 506 | return window->window; |
503 | } | 507 | } |
508 | |||
509 | EAPI void | ||
510 | ecore_cocoa_window_cursor_set(Ecore_Cocoa_Window *win, | ||
511 | Ecore_Cocoa_Cursor c) | ||
512 | { | ||
513 | EINA_SAFETY_ON_NULL_RETURN(win); | ||
514 | EINA_SAFETY_ON_FALSE_RETURN((c >= 0) && (c <= __ECORE_COCOA_CURSOR_LAST)); | ||
515 | |||
516 | NSCursor *cursor = _cursors[c]; | ||
517 | |||
518 | DBG("Setting cursor %i (%s)", c, [[cursor description] UTF8String]); | ||
519 | [cursor set]; | ||
520 | } | ||
521 | |||
522 | EAPI void | ||
523 | ecore_cocoa_window_cursor_show(Ecore_Cocoa_Window *win, | ||
524 | Eina_Bool show) | ||
525 | { | ||
526 | EINA_SAFETY_ON_NULL_RETURN(win); | ||
527 | |||
528 | if (show) [NSCursor unhide]; | ||
529 | else [NSCursor hide]; | ||
530 | } | ||
531 | |||
532 | Eina_Bool | ||
533 | _ecore_cocoa_window_init(void) | ||
534 | { | ||
535 | _cursors[ECORE_COCOA_CURSOR_ARROW] = [NSCursor arrowCursor]; | ||
536 | _cursors[ECORE_COCOA_CURSOR_CONTEXTUAL_MENU] = [NSCursor contextualMenuCursor]; | ||
537 | _cursors[ECORE_COCOA_CURSOR_CLOSED_HAND] = [NSCursor closedHandCursor]; | ||
538 | _cursors[ECORE_COCOA_CURSOR_CROSSHAIR] = [NSCursor crosshairCursor]; | ||
539 | _cursors[ECORE_COCOA_CURSOR_DISAPPEARING_ITEM] = [NSCursor disappearingItemCursor]; | ||
540 | _cursors[ECORE_COCOA_CURSOR_DRAG_COPY] = [NSCursor dragCopyCursor]; | ||
541 | _cursors[ECORE_COCOA_CURSOR_DRAG_LINK] = [NSCursor dragLinkCursor]; | ||
542 | _cursors[ECORE_COCOA_CURSOR_IBEAM] = [NSCursor IBeamCursor]; | ||
543 | _cursors[ECORE_COCOA_CURSOR_OPEN_HAND] = [NSCursor openHandCursor]; | ||
544 | _cursors[ECORE_COCOA_CURSOR_OPERATION_NOT_ALLOWED] = [NSCursor operationNotAllowedCursor]; | ||
545 | _cursors[ECORE_COCOA_CURSOR_POINTING_HAND] = [NSCursor pointingHandCursor]; | ||
546 | _cursors[ECORE_COCOA_CURSOR_RESIZE_DOWN] = [NSCursor resizeDownCursor]; | ||
547 | _cursors[ECORE_COCOA_CURSOR_RESIZE_LEFT] = [NSCursor resizeLeftCursor]; | ||
548 | _cursors[ECORE_COCOA_CURSOR_RESIZE_LEFT_RIGHT] = [NSCursor resizeLeftRightCursor]; | ||
549 | _cursors[ECORE_COCOA_CURSOR_RESIZE_RIGHT] = [NSCursor resizeRightCursor]; | ||
550 | _cursors[ECORE_COCOA_CURSOR_RESIZE_UP] = [NSCursor resizeUpCursor]; | ||
551 | _cursors[ECORE_COCOA_CURSOR_RESIZE_UP_DOWN] = [NSCursor resizeUpDownCursor]; | ||
552 | _cursors[ECORE_COCOA_CURSOR_IBEAM_VERTICAL] = [NSCursor IBeamCursorForVerticalLayout]; | ||
553 | |||
554 | return EINA_TRUE; | ||
555 | } | ||
556 | |||
diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h index 1a035ab1fa..1aef27be7d 100644 --- a/src/lib/ecore_evas/Ecore_Evas.h +++ b/src/lib/ecore_evas/Ecore_Evas.h | |||
@@ -1317,6 +1317,8 @@ EAPI void ecore_evas_wayland_pointer_set(Ecore_Evas *ee, int hot_x, i | |||
1317 | EAPI void ecore_evas_wayland_type_set(Ecore_Evas *ee, int type); | 1317 | EAPI void ecore_evas_wayland_type_set(Ecore_Evas *ee, int type); |
1318 | EAPI Ecore_Wl_Window *ecore_evas_wayland_window_get(const Ecore_Evas *ee); | 1318 | EAPI Ecore_Wl_Window *ecore_evas_wayland_window_get(const Ecore_Evas *ee); |
1319 | 1319 | ||
1320 | EAPI Ecore_Cocoa_Window *ecore_evas_cocoa_window_get(const Ecore_Evas *ee); | ||
1321 | |||
1320 | EAPI Ecore_Evas *ecore_evas_drm_new(const char *device, unsigned int parent, int x, int y, int w, int h); | 1322 | EAPI Ecore_Evas *ecore_evas_drm_new(const char *device, unsigned int parent, int x, int y, int w, int h); |
1321 | EAPI Ecore_Evas *ecore_evas_gl_drm_new(const char *device, unsigned int parent, int x, int y, int w, int h); /** @since 1.12 */ | 1323 | EAPI Ecore_Evas *ecore_evas_gl_drm_new(const char *device, unsigned int parent, int x, int y, int w, int h); /** @since 1.12 */ |
1322 | 1324 | ||
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index d702cccbad..f0a784ac7b 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include "ecore_evas_private.h" | 30 | #include "ecore_evas_private.h" |
31 | #include "ecore_evas_x11.h" | 31 | #include "ecore_evas_x11.h" |
32 | #include "ecore_evas_wayland.h" | 32 | #include "ecore_evas_wayland.h" |
33 | #include "ecore_evas_cocoa.h" | ||
33 | #include "ecore_evas_extn.h" | 34 | #include "ecore_evas_extn.h" |
34 | #include "ecore_evas_win32.h" | 35 | #include "ecore_evas_win32.h" |
35 | 36 | ||
@@ -3983,6 +3984,15 @@ ecore_evas_wayland_window_get(const Ecore_Evas *ee) | |||
3983 | return iface->window_get(ee); | 3984 | return iface->window_get(ee); |
3984 | } | 3985 | } |
3985 | 3986 | ||
3987 | EAPI Ecore_Cocoa_Window * | ||
3988 | ecore_evas_cocoa_window_get(const Ecore_Evas *ee) | ||
3989 | { | ||
3990 | Ecore_Evas_Interface_Cocoa *iface; | ||
3991 | iface = (Ecore_Evas_Interface_Cocoa *)_ecore_evas_interface_get(ee, "opengl_cocoa"); | ||
3992 | EINA_SAFETY_ON_NULL_RETURN_VAL(iface, NULL); | ||
3993 | return iface->window_get(ee); | ||
3994 | } | ||
3995 | |||
3986 | EAPI Ecore_Evas * | 3996 | EAPI Ecore_Evas * |
3987 | ecore_evas_drm_new(const char *disp_name, unsigned int parent, | 3997 | ecore_evas_drm_new(const char *disp_name, unsigned int parent, |
3988 | int x, int y, int w, int h) | 3998 | int x, int y, int w, int h) |
diff --git a/src/lib/ecore_evas/ecore_evas_cocoa.h b/src/lib/ecore_evas/ecore_evas_cocoa.h new file mode 100644 index 0000000000..edc8e051f3 --- /dev/null +++ b/src/lib/ecore_evas/ecore_evas_cocoa.h | |||
@@ -0,0 +1,14 @@ | |||
1 | #ifndef __ECORE_EVAS_COCOA_H__ | ||
2 | #define __ECORE_EVAS_COCOA_H__ | ||
3 | |||
4 | typedef struct _Ecore_Evas_Interface_Cocoa Ecore_Evas_Interface_Cocoa; | ||
5 | |||
6 | struct _Ecore_Evas_Interface_Cocoa | ||
7 | { | ||
8 | Ecore_Evas_Interface base; | ||
9 | |||
10 | Ecore_Cocoa_Window *(*window_get)(const Ecore_Evas *ee); | ||
11 | }; | ||
12 | |||
13 | #endif /* ! __ECORE_EVAS_COCOA_H__ */ | ||
14 | |||
diff --git a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c index fc0241f6f2..574604a8ae 100644 --- a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c +++ b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | #include "Ecore_Evas.h" | 13 | #include "Ecore_Evas.h" |
14 | #include "ecore_evas_private.h" | 14 | #include "ecore_evas_private.h" |
15 | #include "ecore_evas_cocoa.h" | ||
15 | 16 | ||
16 | #ifdef EAPI | 17 | #ifdef EAPI |
17 | # undef EAPI | 18 | # undef EAPI |
@@ -44,6 +45,9 @@ static Eina_List *ecore_evases = NULL; | |||
44 | static Ecore_Event_Handler *ecore_evas_event_handlers[5] = { 0 }; | 45 | static Ecore_Event_Handler *ecore_evas_event_handlers[5] = { 0 }; |
45 | static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL; | 46 | static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL; |
46 | 47 | ||
48 | static const char *_iface_name = "opengl_cocoa"; | ||
49 | static const int _iface_version = 1; | ||
50 | |||
47 | static int | 51 | static int |
48 | _render_updates_process(Ecore_Evas *ee, Eina_List *updates) | 52 | _render_updates_process(Ecore_Evas *ee, Eina_List *updates) |
49 | { | 53 | { |
@@ -528,16 +532,19 @@ static void | |||
528 | _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | 532 | _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) |
529 | { | 533 | { |
530 | int x, y; | 534 | int x, y; |
535 | Evas_Object *old; | ||
536 | Ecore_Cocoa_Window *win = (Ecore_Cocoa_Window *)(ee->prop.window); | ||
531 | DBG(""); | 537 | DBG(""); |
532 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
533 | 538 | ||
539 | old = ee->prop.cursor.object; | ||
534 | if (obj == NULL) | 540 | if (obj == NULL) |
535 | { | 541 | { |
536 | ee->prop.cursor.object = NULL; | 542 | ee->prop.cursor.object = NULL; |
537 | ee->prop.cursor.layer = 0; | 543 | ee->prop.cursor.layer = 0; |
538 | ee->prop.cursor.hot.x = 0; | 544 | ee->prop.cursor.hot.x = 0; |
539 | ee->prop.cursor.hot.y = 0; | 545 | ee->prop.cursor.hot.y = 0; |
540 | return; | 546 | ecore_cocoa_window_cursor_show(win, EINA_TRUE); |
547 | goto end; | ||
541 | } | 548 | } |
542 | 549 | ||
543 | ee->prop.cursor.object = obj; | 550 | ee->prop.cursor.object = obj; |
@@ -546,17 +553,27 @@ _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int h | |||
546 | ee->prop.cursor.hot.y = hot_y; | 553 | ee->prop.cursor.hot.y = hot_y; |
547 | 554 | ||
548 | evas_pointer_output_xy_get(ee->evas, &x, &y); | 555 | evas_pointer_output_xy_get(ee->evas, &x, &y); |
549 | evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); | 556 | if (obj != old) |
557 | { | ||
558 | ecore_cocoa_window_cursor_show(win, EINA_FALSE); | ||
559 | evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); | ||
560 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | ||
561 | if (evas_pointer_inside_get(ee->evas)) | ||
562 | evas_object_show(ee->prop.cursor.object); | ||
563 | evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, | ||
564 | _ecore_evas_object_cursor_del, ee); | ||
565 | } | ||
550 | evas_object_move(ee->prop.cursor.object, | 566 | evas_object_move(ee->prop.cursor.object, |
551 | x - ee->prop.cursor.hot.x, | 567 | x - ee->prop.cursor.hot.x, |
552 | y - ee->prop.cursor.hot.y); | 568 | y - ee->prop.cursor.hot.y); |
553 | 569 | ||
554 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | 570 | end: |
555 | 571 | if ((old) && (obj != old)) | |
556 | if (evas_pointer_inside_get(ee->evas)) | 572 | { |
557 | evas_object_show(ee->prop.cursor.object); | 573 | evas_object_event_callback_del_full(old, EVAS_CALLBACK_DEL, |
558 | 574 | _ecore_evas_object_cursor_del, ee); | |
559 | evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); | 575 | evas_object_del(old); |
576 | } | ||
560 | } | 577 | } |
561 | 578 | ||
562 | static void | 579 | static void |
@@ -688,10 +705,19 @@ static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func = | |||
688 | NULL // msg_send | 705 | NULL // msg_send |
689 | }; | 706 | }; |
690 | 707 | ||
708 | static Ecore_Cocoa_Window * | ||
709 | _ecore_evas_cocoa_window_get(const Ecore_Evas *ee) | ||
710 | { | ||
711 | /* See affectation of ee->prop.window in ecore_evas_cocoa_new_internal */ | ||
712 | return (Ecore_Cocoa_Window *)(ee->prop.window); | ||
713 | } | ||
714 | |||
715 | |||
691 | EAPI Ecore_Evas * | 716 | EAPI Ecore_Evas * |
692 | ecore_evas_cocoa_new_internal(Ecore_Cocoa_Window *parent EINA_UNUSED, int x, int y, int w, int h) | 717 | ecore_evas_cocoa_new_internal(Ecore_Cocoa_Window *parent EINA_UNUSED, int x, int y, int w, int h) |
693 | { | 718 | { |
694 | Ecore_Evas *ee; | 719 | Ecore_Evas *ee; |
720 | Ecore_Evas_Interface_Cocoa *iface; | ||
695 | 721 | ||
696 | if (!ecore_cocoa_init()) | 722 | if (!ecore_cocoa_init()) |
697 | return NULL; | 723 | return NULL; |
@@ -755,6 +781,18 @@ ecore_evas_cocoa_new_internal(Ecore_Cocoa_Window *parent EINA_UNUSED, int x, int | |||
755 | return NULL; | 781 | return NULL; |
756 | } | 782 | } |
757 | 783 | ||
784 | /* Interface setup */ | ||
785 | iface = calloc(1, sizeof(*iface)); | ||
786 | if (EINA_UNLIKELY(!iface)) | ||
787 | { | ||
788 | _ecore_evas_cocoa_shutdown(); | ||
789 | free(ee); | ||
790 | return NULL; | ||
791 | } | ||
792 | iface->base.name = _iface_name; | ||
793 | iface->base.version = _iface_version; | ||
794 | iface->window_get = _ecore_evas_cocoa_window_get; | ||
795 | ee->engine.ifaces = eina_list_append(ee->engine.ifaces, iface); | ||
758 | 796 | ||
759 | ee->engine.func->fn_render = _ecore_evas_cocoa_render; | 797 | ee->engine.func->fn_render = _ecore_evas_cocoa_render; |
760 | _ecore_evas_register(ee); | 798 | _ecore_evas_register(ee); |