summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Guyomarc'h <jean.guyomarch@openwide.fr>2015-10-08 12:01:38 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-12-03 11:04:28 -0800
commite1c29985c4256cd77aee95fa6a0fa56e9ce0e78a (patch)
tree2a2e1a56d784bfc54f6330e8bf898292f73cf580
parentd8ed87b921b8bb583fb2ad5c4f64aee67dfbb21f (diff)
cursor: add support for Cocoa system cursors.
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/lib/elm_win.c51
-rw-r--r--src/lib/elm_win.eo6
-rw-r--r--src/lib/els_cursor.c227
3 files changed, 199 insertions, 85 deletions
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index 6de610ca9..0b3b09ba5 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -118,6 +118,11 @@ struct _Elm_Win_Data
118 Eina_Bool opaque_dirty : 1; 118 Eina_Bool opaque_dirty : 1;
119 } wl; 119 } wl;
120#endif 120#endif
121#ifdef HAVE_ELEMENTARY_COCOA
122 struct {
123 Ecore_Cocoa_Window *win;
124 } cocoa;
125#endif
121 126
122 Ecore_Job *deferred_resize_job; 127 Ecore_Job *deferred_resize_job;
123 Ecore_Job *deferred_child_eval_job; 128 Ecore_Job *deferred_child_eval_job;
@@ -2178,6 +2183,34 @@ _elm_win_wlwindow_get(Elm_Win_Data *sd)
2178} 2183}
2179#endif 2184#endif
2180 2185
2186Ecore_Cocoa_Window *
2187_elm_ee_cocoa_win_get(const Ecore_Evas *ee)
2188{
2189#ifdef HAVE_ELEMENTARY_COCOA
2190 const char *engine_name;
2191
2192 if (!ee) return NULL;
2193
2194 engine_name = ecore_evas_engine_name_get(ee);
2195 if (EINA_UNLIKELY(!engine_name)) return NULL;
2196
2197 if (!strcmp(engine_name, "opengl_cocoa") ||
2198 !strcmp(engine_name, "gl_cocoa"))
2199 return ecore_evas_cocoa_window_get(ee);
2200#else
2201 (void)ee;
2202#endif
2203 return NULL;
2204}
2205
2206#ifdef HAVE_ELEMENTARY_COCOA
2207static void
2208_elm_win_cocoawindow_get(Elm_Win_Data *sd)
2209{
2210 sd->cocoa.win = _elm_ee_cocoa_win_get(sd->ee);
2211}
2212#endif
2213
2181#ifdef HAVE_ELEMENTARY_X 2214#ifdef HAVE_ELEMENTARY_X
2182static void 2215static void
2183_elm_win_xwin_update(Elm_Win_Data *sd) 2216_elm_win_xwin_update(Elm_Win_Data *sd)
@@ -3721,6 +3754,10 @@ _elm_win_finalize_internal(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_
3721 _elm_win_wlwindow_get(sd); 3754 _elm_win_wlwindow_get(sd);
3722#endif 3755#endif
3723 3756
3757#ifdef HAVE_ELEMENTARY_COCOA
3758 _elm_win_cocoawindow_get(sd);
3759#endif
3760
3724 if ((_elm_config->bgpixmap) 3761 if ((_elm_config->bgpixmap)
3725#ifdef HAVE_ELEMENTARY_X 3762#ifdef HAVE_ELEMENTARY_X
3726 && 3763 &&
@@ -5410,6 +5447,20 @@ elm_win_wl_window_get(const Evas_Object *obj)
5410 return ret; 5447 return ret;
5411} 5448}
5412 5449
5450EOLIAN static Ecore_Cocoa_Window *
5451_elm_win_cocoa_window_get(Eo *obj,
5452 Elm_Win_Data *sd)
5453{
5454 const char *engine_name = ecore_evas_engine_name_get(sd->ee);
5455 if (!engine_name) return NULL;
5456 if (strcmp(engine_name, "gl_cocoa") != 0 &&
5457 strcmp(engine_name, "opengl_cocoa") != 0)
5458 return NULL;
5459
5460 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
5461 return _elm_ee_cocoa_win_get(ee);
5462}
5463
5413EOLIAN static Ecore_Wl2_Window* 5464EOLIAN static Ecore_Wl2_Window*
5414_elm_win_wl_window_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd) 5465_elm_win_wl_window_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd)
5415{ 5466{
diff --git a/src/lib/elm_win.eo b/src/lib/elm_win.eo
index c48ff3822..f641c7615 100644
--- a/src/lib/elm_win.eo
+++ b/src/lib/elm_win.eo
@@ -961,6 +961,12 @@ class Elm.Win (Elm.Widget, Elm_Interface_Atspi_Window,
961 legacy: null; 961 legacy: null;
962 } 962 }
963 } 963 }
964 @property cocoa_window {
965 get {
966 [[Get the Ecore_Cocoa_Window of an Evas.Object.]]
967 return: Ecore_Cocoa_Window *; [[The Ecore_Cocoa_Window of $obj.]]
968 }
969 }
964 @property window_id { 970 @property window_id {
965 get { 971 get {
966 [[Get the Ecore_Window of an Evas_Object 972 [[Get the Ecore_Window of an Evas_Object
diff --git a/src/lib/els_cursor.c b/src/lib/els_cursor.c
index ac6ede256..eaed2de0f 100644
--- a/src/lib/els_cursor.c
+++ b/src/lib/els_cursor.c
@@ -12,104 +12,117 @@
12#include <Ecore_X_Cursor.h> 12#include <Ecore_X_Cursor.h>
13#endif 13#endif
14 14
15#ifdef HAVE_ELEMENTARY_COCOA
16#include <Ecore_Cocoa.h>
17#include <Ecore_Cocoa_Cursor.h>
18#endif
19
15#define _cursor_key "_elm_cursor" 20#define _cursor_key "_elm_cursor"
16 21
17struct _Cursor_Id 22struct _Cursor_Id
18{ 23{
19 const char *name; 24 const char *name;
20#ifdef HAVE_ELEMENTARY_X 25
21 int id; 26#if defined(HAVE_ELEMENTARY_X) || defined(HAVE_ELEMENTARY_COCOA)
27 int id; /* For X */
28 int cid; /* For Cocoa */
22#endif 29#endif
23}; 30};
24 31
25#ifdef HAVE_ELEMENTARY_X 32#if defined(HAVE_ELEMENTARY_X)
26#define CURSOR(_name, _xid) \ 33# if defined(HAVE_ELEMENTARY_COCOA)
27 {_name , _xid} 34# define CURSOR(_name, _id, _cid) {_name, _id, _cid}
35# else
36# define CURSOR(_name, _id, _cid) { _name, _id, -1 }
37# endif
38#else
39# if defined(HAVE_ELEMENTARY_COCOA)
40# define CURSOR(_name, _id, _cid) {_name, -1, _cid}
28# else 41# else
29#define CURSOR(_name, _xid) \ 42# define CURSOR(_name, _id, _cid) { _name }
30 {_name} 43# endif
31#endif 44#endif
32 45
33/* Please keep order in sync with Ecore_X_Cursor.h values! */ 46/* Please keep order in sync with Ecore_X_Cursor.h values! */
34struct _Cursor_Id _cursors[] = 47struct _Cursor_Id _cursors[] =
35{ 48{
36 CURSOR(ELM_CURSOR_X , ECORE_X_CURSOR_X ), 49 CURSOR(ELM_CURSOR_X , ECORE_X_CURSOR_X , ECORE_COCOA_CURSOR_CROSSHAIR),
37 CURSOR(ELM_CURSOR_ARROW , ECORE_X_CURSOR_ARROW ), 50 CURSOR(ELM_CURSOR_ARROW , ECORE_X_CURSOR_ARROW , ECORE_COCOA_CURSOR_ARROW),
38 CURSOR(ELM_CURSOR_BASED_ARROW_DOWN , ECORE_X_CURSOR_BASED_ARROW_DOWN ), 51 CURSOR(ELM_CURSOR_BASED_ARROW_DOWN , ECORE_X_CURSOR_BASED_ARROW_DOWN , ECORE_COCOA_CURSOR_DEFAULT),
39 CURSOR(ELM_CURSOR_BASED_ARROW_UP , ECORE_X_CURSOR_UP ), 52 CURSOR(ELM_CURSOR_BASED_ARROW_UP , ECORE_X_CURSOR_UP , ECORE_COCOA_CURSOR_DEFAULT),
40 CURSOR(ELM_CURSOR_BOAT , ECORE_X_CURSOR_BOAT ), 53 CURSOR(ELM_CURSOR_BOAT , ECORE_X_CURSOR_BOAT , ECORE_COCOA_CURSOR_DEFAULT),
41 CURSOR(ELM_CURSOR_BOGOSITY , ECORE_X_CURSOR_BOGOSITY ), 54 CURSOR(ELM_CURSOR_BOGOSITY , ECORE_X_CURSOR_BOGOSITY , ECORE_COCOA_CURSOR_DEFAULT),
42 CURSOR(ELM_CURSOR_BOTTOM_LEFT_CORNER , ECORE_X_CURSOR_BOTTOM_LEFT_CORNER ), 55 CURSOR(ELM_CURSOR_BOTTOM_LEFT_CORNER , ECORE_X_CURSOR_BOTTOM_LEFT_CORNER , ECORE_COCOA_CURSOR_DEFAULT),
43 CURSOR(ELM_CURSOR_BOTTOM_RIGHT_CORNER, ECORE_X_CURSOR_BOTTOM_RIGHT_CORNER), 56 CURSOR(ELM_CURSOR_BOTTOM_RIGHT_CORNER, ECORE_X_CURSOR_BOTTOM_RIGHT_CORNER, ECORE_COCOA_CURSOR_DEFAULT),
44 CURSOR(ELM_CURSOR_BOTTOM_SIDE , ECORE_X_CURSOR_BOTTOM_SIDE ), 57 CURSOR(ELM_CURSOR_BOTTOM_SIDE , ECORE_X_CURSOR_BOTTOM_SIDE , ECORE_COCOA_CURSOR_RESIZE_DOWN),
45 CURSOR(ELM_CURSOR_BOTTOM_TEE , ECORE_X_CURSOR_BOTTOM_TEE ), 58 CURSOR(ELM_CURSOR_BOTTOM_TEE , ECORE_X_CURSOR_BOTTOM_TEE , ECORE_COCOA_CURSOR_RESIZE_DOWN),
46 CURSOR(ELM_CURSOR_BOX_SPIRAL , ECORE_X_CURSOR_BOX_SPIRAL ), 59 CURSOR(ELM_CURSOR_BOX_SPIRAL , ECORE_X_CURSOR_BOX_SPIRAL , ECORE_COCOA_CURSOR_DEFAULT),
47 CURSOR(ELM_CURSOR_CENTER_PTR , ECORE_X_CURSOR_CENTER_PTR ), 60 CURSOR(ELM_CURSOR_CENTER_PTR , ECORE_X_CURSOR_CENTER_PTR , ECORE_COCOA_CURSOR_DEFAULT),
48 CURSOR(ELM_CURSOR_CIRCLE , ECORE_X_CURSOR_CIRCLE ), 61 CURSOR(ELM_CURSOR_CIRCLE , ECORE_X_CURSOR_CIRCLE , ECORE_COCOA_CURSOR_DEFAULT),
49 CURSOR(ELM_CURSOR_CLOCK , ECORE_X_CURSOR_CLOCK ), 62 CURSOR(ELM_CURSOR_CLOCK , ECORE_X_CURSOR_CLOCK , ECORE_COCOA_CURSOR_DEFAULT),
50 CURSOR(ELM_CURSOR_COFFEE_MUG , ECORE_X_CURSOR_COFFEE_MUG ), 63 CURSOR(ELM_CURSOR_COFFEE_MUG , ECORE_X_CURSOR_COFFEE_MUG , ECORE_COCOA_CURSOR_DEFAULT),
51 CURSOR(ELM_CURSOR_CROSS , ECORE_X_CURSOR_CROSS ), 64 CURSOR(ELM_CURSOR_CROSS , ECORE_X_CURSOR_CROSS , ECORE_COCOA_CURSOR_CROSSHAIR),
52 CURSOR(ELM_CURSOR_CROSS_REVERSE , ECORE_X_CURSOR_CROSS_REVERSE ), 65 CURSOR(ELM_CURSOR_CROSS_REVERSE , ECORE_X_CURSOR_CROSS_REVERSE , ECORE_COCOA_CURSOR_CROSSHAIR),
53 CURSOR(ELM_CURSOR_CROSSHAIR , ECORE_X_CURSOR_CROSSHAIR ), 66 CURSOR(ELM_CURSOR_CROSSHAIR , ECORE_X_CURSOR_CROSSHAIR , ECORE_COCOA_CURSOR_CROSSHAIR),
54 CURSOR(ELM_CURSOR_DIAMOND_CROSS , ECORE_X_CURSOR_DIAMOND_CROSS ), 67 CURSOR(ELM_CURSOR_DIAMOND_CROSS , ECORE_X_CURSOR_DIAMOND_CROSS , ECORE_COCOA_CURSOR_DEFAULT),
55 CURSOR(ELM_CURSOR_DOT , ECORE_X_CURSOR_DOT ), 68 CURSOR(ELM_CURSOR_DOT , ECORE_X_CURSOR_DOT , ECORE_COCOA_CURSOR_DEFAULT),
56 CURSOR(ELM_CURSOR_DOT_BOX_MASK , ECORE_X_CURSOR_DOT_BOX_MASK ), 69 CURSOR(ELM_CURSOR_DOT_BOX_MASK , ECORE_X_CURSOR_DOT_BOX_MASK , ECORE_COCOA_CURSOR_DEFAULT),
57 CURSOR(ELM_CURSOR_DOUBLE_ARROW , ECORE_X_CURSOR_DOUBLE_ARROW ), 70 CURSOR(ELM_CURSOR_DOUBLE_ARROW , ECORE_X_CURSOR_DOUBLE_ARROW , ECORE_COCOA_CURSOR_RESIZE_UP_DOWN),
58 CURSOR(ELM_CURSOR_DRAFT_LARGE , ECORE_X_CURSOR_DRAFT_LARGE ), 71 CURSOR(ELM_CURSOR_DRAFT_LARGE , ECORE_X_CURSOR_DRAFT_LARGE , ECORE_COCOA_CURSOR_DEFAULT),
59 CURSOR(ELM_CURSOR_DRAFT_SMALL , ECORE_X_CURSOR_DRAFT_SMALL ), 72 CURSOR(ELM_CURSOR_DRAFT_SMALL , ECORE_X_CURSOR_DRAFT_SMALL , ECORE_COCOA_CURSOR_DEFAULT),
60 CURSOR(ELM_CURSOR_DRAPED_BOX , ECORE_X_CURSOR_DRAPED_BOX ), 73 CURSOR(ELM_CURSOR_DRAPED_BOX , ECORE_X_CURSOR_DRAPED_BOX , ECORE_COCOA_CURSOR_DEFAULT),
61 CURSOR(ELM_CURSOR_EXCHANGE , ECORE_X_CURSOR_EXCHANGE ), 74 CURSOR(ELM_CURSOR_EXCHANGE , ECORE_X_CURSOR_EXCHANGE , ECORE_COCOA_CURSOR_DEFAULT),
62 CURSOR(ELM_CURSOR_FLEUR , ECORE_X_CURSOR_FLEUR ), 75 CURSOR(ELM_CURSOR_FLEUR , ECORE_X_CURSOR_FLEUR , ECORE_COCOA_CURSOR_DEFAULT),
63 CURSOR(ELM_CURSOR_GOBBLER , ECORE_X_CURSOR_GOBBLER ), 76 CURSOR(ELM_CURSOR_GOBBLER , ECORE_X_CURSOR_GOBBLER , ECORE_COCOA_CURSOR_DEFAULT),
64 CURSOR(ELM_CURSOR_GUMBY , ECORE_X_CURSOR_GUMBY ), 77 CURSOR(ELM_CURSOR_GUMBY , ECORE_X_CURSOR_GUMBY , ECORE_COCOA_CURSOR_DEFAULT),
65 CURSOR(ELM_CURSOR_HAND1 , ECORE_X_CURSOR_HAND1 ), 78 CURSOR(ELM_CURSOR_HAND1 , ECORE_X_CURSOR_HAND1 , ECORE_COCOA_CURSOR_POINTING_HAND),
66 CURSOR(ELM_CURSOR_HAND2 , ECORE_X_CURSOR_HAND2 ), 79 CURSOR(ELM_CURSOR_HAND2 , ECORE_X_CURSOR_HAND2 , ECORE_COCOA_CURSOR_POINTING_HAND),
67 CURSOR(ELM_CURSOR_HEART , ECORE_X_CURSOR_HEART ), 80 CURSOR(ELM_CURSOR_HEART , ECORE_X_CURSOR_HEART , ECORE_COCOA_CURSOR_DEFAULT),
68 CURSOR(ELM_CURSOR_ICON , ECORE_X_CURSOR_ICON ), 81 CURSOR(ELM_CURSOR_ICON , ECORE_X_CURSOR_ICON , ECORE_COCOA_CURSOR_DEFAULT),
69 CURSOR(ELM_CURSOR_IRON_CROSS , ECORE_X_CURSOR_IRON_CROSS ), 82 CURSOR(ELM_CURSOR_IRON_CROSS , ECORE_X_CURSOR_IRON_CROSS , ECORE_COCOA_CURSOR_DEFAULT),
70 CURSOR(ELM_CURSOR_LEFT_PTR , ECORE_X_CURSOR_LEFT_PTR ), 83 CURSOR(ELM_CURSOR_LEFT_PTR , ECORE_X_CURSOR_LEFT_PTR , ECORE_COCOA_CURSOR_ARROW),
71 CURSOR(ELM_CURSOR_LEFT_SIDE , ECORE_X_CURSOR_LEFT_SIDE ), 84 CURSOR(ELM_CURSOR_LEFT_SIDE , ECORE_X_CURSOR_LEFT_SIDE , ECORE_COCOA_CURSOR_RESIZE_LEFT),
72 CURSOR(ELM_CURSOR_LEFT_TEE , ECORE_X_CURSOR_LEFT_TEE ), 85 CURSOR(ELM_CURSOR_LEFT_TEE , ECORE_X_CURSOR_LEFT_TEE , ECORE_COCOA_CURSOR_RESIZE_LEFT),
73 CURSOR(ELM_CURSOR_LEFTBUTTON , ECORE_X_CURSOR_LEFTBUTTON ), 86 CURSOR(ELM_CURSOR_LEFTBUTTON , ECORE_X_CURSOR_LEFTBUTTON , ECORE_COCOA_CURSOR_DEFAULT),
74 CURSOR(ELM_CURSOR_LL_ANGLE , ECORE_X_CURSOR_LL_ANGLE ), 87 CURSOR(ELM_CURSOR_LL_ANGLE , ECORE_X_CURSOR_LL_ANGLE , ECORE_COCOA_CURSOR_DEFAULT),
75 CURSOR(ELM_CURSOR_LR_ANGLE , ECORE_X_CURSOR_LR_ANGLE ), 88 CURSOR(ELM_CURSOR_LR_ANGLE , ECORE_X_CURSOR_LR_ANGLE , ECORE_COCOA_CURSOR_DEFAULT),
76 CURSOR(ELM_CURSOR_MAN , ECORE_X_CURSOR_MAN ), 89 CURSOR(ELM_CURSOR_MAN , ECORE_X_CURSOR_MAN , ECORE_COCOA_CURSOR_DEFAULT),
77 CURSOR(ELM_CURSOR_MIDDLEBUTTON , ECORE_X_CURSOR_MIDDLEBUTTON ), 90 CURSOR(ELM_CURSOR_MIDDLEBUTTON , ECORE_X_CURSOR_MIDDLEBUTTON , ECORE_COCOA_CURSOR_DEFAULT),
78 CURSOR(ELM_CURSOR_MOUSE , ECORE_X_CURSOR_MOUSE ), 91 CURSOR(ELM_CURSOR_MOUSE , ECORE_X_CURSOR_MOUSE , ECORE_COCOA_CURSOR_DEFAULT),
79 CURSOR(ELM_CURSOR_PENCIL , ECORE_X_CURSOR_PENCIL ), 92 CURSOR(ELM_CURSOR_PENCIL , ECORE_X_CURSOR_PENCIL , ECORE_COCOA_CURSOR_DEFAULT),
80 CURSOR(ELM_CURSOR_PIRATE , ECORE_X_CURSOR_PIRATE ), 93 CURSOR(ELM_CURSOR_PIRATE , ECORE_X_CURSOR_PIRATE , ECORE_COCOA_CURSOR_DEFAULT),
81 CURSOR(ELM_CURSOR_PLUS , ECORE_X_CURSOR_PLUS ), 94 CURSOR(ELM_CURSOR_PLUS , ECORE_X_CURSOR_PLUS , ECORE_COCOA_CURSOR_CROSSHAIR),
82 CURSOR(ELM_CURSOR_QUESTION_ARROW , ECORE_X_CURSOR_QUESTION_ARROW ), 95 CURSOR(ELM_CURSOR_QUESTION_ARROW , ECORE_X_CURSOR_QUESTION_ARROW , ECORE_COCOA_CURSOR_DEFAULT),
83 CURSOR(ELM_CURSOR_RIGHT_PTR , ECORE_X_CURSOR_RIGHT_PTR ), 96 CURSOR(ELM_CURSOR_RIGHT_PTR , ECORE_X_CURSOR_RIGHT_PTR , ECORE_COCOA_CURSOR_DEFAULT),
84 CURSOR(ELM_CURSOR_RIGHT_SIDE , ECORE_X_CURSOR_RIGHT_SIDE ), 97 CURSOR(ELM_CURSOR_RIGHT_SIDE , ECORE_X_CURSOR_RIGHT_SIDE , ECORE_COCOA_CURSOR_RESIZE_RIGHT),
85 CURSOR(ELM_CURSOR_RIGHT_TEE , ECORE_X_CURSOR_RIGHT_TEE ), 98 CURSOR(ELM_CURSOR_RIGHT_TEE , ECORE_X_CURSOR_RIGHT_TEE , ECORE_COCOA_CURSOR_RESIZE_RIGHT),
86 CURSOR(ELM_CURSOR_RIGHTBUTTON , ECORE_X_CURSOR_RIGHTBUTTON ), 99 CURSOR(ELM_CURSOR_RIGHTBUTTON , ECORE_X_CURSOR_RIGHTBUTTON , ECORE_COCOA_CURSOR_DEFAULT),
87 CURSOR(ELM_CURSOR_RTL_LOGO , ECORE_X_CURSOR_RTL_LOGO ), 100 CURSOR(ELM_CURSOR_RTL_LOGO , ECORE_X_CURSOR_RTL_LOGO , ECORE_COCOA_CURSOR_DEFAULT),
88 CURSOR(ELM_CURSOR_SAILBOAT , ECORE_X_CURSOR_SAILBOAT ), 101 CURSOR(ELM_CURSOR_SAILBOAT , ECORE_X_CURSOR_SAILBOAT , ECORE_COCOA_CURSOR_DEFAULT),
89 CURSOR(ELM_CURSOR_SB_DOWN_ARROW , ECORE_X_CURSOR_SB_DOWN_ARROW ), 102 CURSOR(ELM_CURSOR_SB_DOWN_ARROW , ECORE_X_CURSOR_SB_DOWN_ARROW , ECORE_COCOA_CURSOR_RESIZE_DOWN),
90 CURSOR(ELM_CURSOR_SB_H_DOUBLE_ARROW , ECORE_X_CURSOR_SB_H_DOUBLE_ARROW ), 103 CURSOR(ELM_CURSOR_SB_H_DOUBLE_ARROW , ECORE_X_CURSOR_SB_H_DOUBLE_ARROW , ECORE_COCOA_CURSOR_RESIZE_LEFT_RIGHT),
91 CURSOR(ELM_CURSOR_SB_LEFT_ARROW , ECORE_X_CURSOR_SB_LEFT_ARROW ), 104 CURSOR(ELM_CURSOR_SB_LEFT_ARROW , ECORE_X_CURSOR_SB_LEFT_ARROW , ECORE_COCOA_CURSOR_RESIZE_LEFT),
92 CURSOR(ELM_CURSOR_SB_RIGHT_ARROW , ECORE_X_CURSOR_SB_RIGHT_ARROW ), 105 CURSOR(ELM_CURSOR_SB_RIGHT_ARROW , ECORE_X_CURSOR_SB_RIGHT_ARROW , ECORE_COCOA_CURSOR_RESIZE_RIGHT),
93 CURSOR(ELM_CURSOR_SB_UP_ARROW , ECORE_X_CURSOR_SB_UP_ARROW ), 106 CURSOR(ELM_CURSOR_SB_UP_ARROW , ECORE_X_CURSOR_SB_UP_ARROW , ECORE_COCOA_CURSOR_RESIZE_UP),
94 CURSOR(ELM_CURSOR_SB_V_DOUBLE_ARROW , ECORE_X_CURSOR_SB_V_DOUBLE_ARROW ), 107 CURSOR(ELM_CURSOR_SB_V_DOUBLE_ARROW , ECORE_X_CURSOR_SB_V_DOUBLE_ARROW , ECORE_COCOA_CURSOR_RESIZE_UP_DOWN),
95 CURSOR(ELM_CURSOR_SHUTTLE , ECORE_X_CURSOR_SHUTTLE ), 108 CURSOR(ELM_CURSOR_SHUTTLE , ECORE_X_CURSOR_SHUTTLE , ECORE_COCOA_CURSOR_DEFAULT),
96 CURSOR(ELM_CURSOR_SIZING , ECORE_X_CURSOR_SIZING ), 109 CURSOR(ELM_CURSOR_SIZING , ECORE_X_CURSOR_SIZING , ECORE_COCOA_CURSOR_DEFAULT),
97 CURSOR(ELM_CURSOR_SPIDER , ECORE_X_CURSOR_SPIDER ), 110 CURSOR(ELM_CURSOR_SPIDER , ECORE_X_CURSOR_SPIDER , ECORE_COCOA_CURSOR_DEFAULT),
98 CURSOR(ELM_CURSOR_SPRAYCAN , ECORE_X_CURSOR_SPRAYCAN ), 111 CURSOR(ELM_CURSOR_SPRAYCAN , ECORE_X_CURSOR_SPRAYCAN , ECORE_COCOA_CURSOR_DEFAULT),
99 CURSOR(ELM_CURSOR_STAR , ECORE_X_CURSOR_STAR ), 112 CURSOR(ELM_CURSOR_STAR , ECORE_X_CURSOR_STAR , ECORE_COCOA_CURSOR_DEFAULT),
100 CURSOR(ELM_CURSOR_TARGET , ECORE_X_CURSOR_TARGET ), 113 CURSOR(ELM_CURSOR_TARGET , ECORE_X_CURSOR_TARGET , ECORE_COCOA_CURSOR_DEFAULT),
101 CURSOR(ELM_CURSOR_TCROSS , ECORE_X_CURSOR_TCROSS ), 114 CURSOR(ELM_CURSOR_TCROSS , ECORE_X_CURSOR_TCROSS , ECORE_COCOA_CURSOR_CROSSHAIR),
102 CURSOR(ELM_CURSOR_TOP_LEFT_ARROW , ECORE_X_CURSOR_TOP_LEFT_ARROW ), 115 CURSOR(ELM_CURSOR_TOP_LEFT_ARROW , ECORE_X_CURSOR_TOP_LEFT_ARROW , ECORE_COCOA_CURSOR_DEFAULT),
103 CURSOR(ELM_CURSOR_TOP_LEFT_CORNER , ECORE_X_CURSOR_TOP_LEFT_CORNER ), 116 CURSOR(ELM_CURSOR_TOP_LEFT_CORNER , ECORE_X_CURSOR_TOP_LEFT_CORNER , ECORE_COCOA_CURSOR_DEFAULT),
104 CURSOR(ELM_CURSOR_TOP_RIGHT_CORNER , ECORE_X_CURSOR_TOP_RIGHT_CORNER ), 117 CURSOR(ELM_CURSOR_TOP_RIGHT_CORNER , ECORE_X_CURSOR_TOP_RIGHT_CORNER , ECORE_COCOA_CURSOR_DEFAULT),
105 CURSOR(ELM_CURSOR_TOP_SIDE , ECORE_X_CURSOR_TOP_SIDE ), 118 CURSOR(ELM_CURSOR_TOP_SIDE , ECORE_X_CURSOR_TOP_SIDE , ECORE_COCOA_CURSOR_DEFAULT),
106 CURSOR(ELM_CURSOR_TOP_TEE , ECORE_X_CURSOR_TOP_TEE ), 119 CURSOR(ELM_CURSOR_TOP_TEE , ECORE_X_CURSOR_TOP_TEE , ECORE_COCOA_CURSOR_DEFAULT),
107 CURSOR(ELM_CURSOR_TREK , ECORE_X_CURSOR_TREK ), 120 CURSOR(ELM_CURSOR_TREK , ECORE_X_CURSOR_TREK , ECORE_COCOA_CURSOR_DEFAULT),
108 CURSOR(ELM_CURSOR_UL_ANGLE , ECORE_X_CURSOR_UL_ANGLE ), 121 CURSOR(ELM_CURSOR_UL_ANGLE , ECORE_X_CURSOR_UL_ANGLE , ECORE_COCOA_CURSOR_DEFAULT),
109 CURSOR(ELM_CURSOR_UMBRELLA , ECORE_X_CURSOR_UMBRELLA ), 122 CURSOR(ELM_CURSOR_UMBRELLA , ECORE_X_CURSOR_UMBRELLA , ECORE_COCOA_CURSOR_DEFAULT),
110 CURSOR(ELM_CURSOR_UR_ANGLE , ECORE_X_CURSOR_UR_ANGLE ), 123 CURSOR(ELM_CURSOR_UR_ANGLE , ECORE_X_CURSOR_UR_ANGLE , ECORE_COCOA_CURSOR_DEFAULT),
111 CURSOR(ELM_CURSOR_WATCH , ECORE_X_CURSOR_WATCH ), 124 CURSOR(ELM_CURSOR_WATCH , ECORE_X_CURSOR_WATCH , ECORE_COCOA_CURSOR_DEFAULT),
112 CURSOR(ELM_CURSOR_XTERM , ECORE_X_CURSOR_XTERM ) 125 CURSOR(ELM_CURSOR_XTERM , ECORE_X_CURSOR_XTERM , ECORE_COCOA_CURSOR_IBEAM)
113}; 126};
114static const int _cursors_count = sizeof(_cursors)/sizeof(struct _Cursor_Id); 127static const int _cursors_count = sizeof(_cursors)/sizeof(struct _Cursor_Id);
115 128
@@ -152,6 +165,13 @@ struct _Elm_Cursor
152 } wl; 165 } wl;
153#endif 166#endif
154 167
168#ifdef HAVE_ELEMENTARY_COCOA
169 struct {
170 Ecore_Cocoa_Cursor cursor;
171 Ecore_Cocoa_Window *win;
172 } cocoa;
173#endif
174
155 Eina_Bool visible:1; 175 Eina_Bool visible:1;
156 Eina_Bool use_engine:1; 176 Eina_Bool use_engine:1;
157 Eina_Bool theme_search:1; 177 Eina_Bool theme_search:1;
@@ -286,6 +306,12 @@ _elm_cursor_set(Elm_Cursor *cur)
286 if (cur->wl.win) 306 if (cur->wl.win)
287 ecore_wl2_window_cursor_from_name_set(cur->wl.win, cur->cursor_name); 307 ecore_wl2_window_cursor_from_name_set(cur->wl.win, cur->cursor_name);
288#endif 308#endif
309
310#ifdef HAVE_ELEMENTARY_COCOA
311 if (cur->cocoa.win)
312 ecore_cocoa_window_cursor_set(cur->cocoa.win, cur->cocoa.cursor);
313#endif
314
289 } 315 }
290 evas_event_thaw(cur->evas); 316 evas_event_thaw(cur->evas);
291} 317}
@@ -344,6 +370,12 @@ _elm_cursor_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_
344 if (cur->wl.win) 370 if (cur->wl.win)
345 ecore_wl2_window_cursor_from_name_set(cur->wl.win, NULL); 371 ecore_wl2_window_cursor_from_name_set(cur->wl.win, NULL);
346#endif 372#endif
373
374#ifdef HAVE_ELEMENTARY_COCOA
375 if (cur->cocoa.win)
376 ecore_cocoa_window_cursor_set(cur->cocoa.win, ECORE_COCOA_CURSOR_DEFAULT);
377#endif
378
347 } 379 }
348 evas_event_thaw(cur->evas); 380 evas_event_thaw(cur->evas);
349} 381}
@@ -354,7 +386,7 @@ _elm_cursor_del(void *data EINA_UNUSED, Evas *evas EINA_UNUSED, Evas_Object *obj
354 elm_object_cursor_unset(obj); 386 elm_object_cursor_unset(obj);
355} 387}
356 388
357#ifdef HAVE_ELEMENTARY_X 389#if defined(HAVE_ELEMENTARY_X) || defined(HAVE_ELEMENTARY_COCOA)
358static int 390static int
359_elm_cursor_strcmp(const void *data1, const void *data2) 391_elm_cursor_strcmp(const void *data1, const void *data2)
360{ 392{
@@ -418,6 +450,26 @@ _elm_cursor_cur_set(Elm_Cursor *cur)
418 cur->x.cursor = ecore_x_cursor_shape_get(cur_id->id); 450 cur->x.cursor = ecore_x_cursor_shape_get(cur_id->id);
419 } 451 }
420#endif 452#endif
453
454#ifdef HAVE_ELEMENTARY_COCOA
455 cur->cocoa.win = elm_win_cocoa_window_get(top);
456 if (cur->cocoa.win)
457 {
458 struct _Cursor_Id *cur_id;
459
460 cur_id = bsearch(&(cur->cursor_name), _cursors, _cursors_count,
461 sizeof(struct _Cursor_Id), _elm_cursor_strcmp);
462 if (!cur_id)
463 {
464 INF("Cocoa Cursor couldn't be found: %s. Using default...",
465 cur->cursor_name);
466 cur->cocoa.cursor = ECORE_COCOA_CURSOR_DEFAULT;
467 }
468 else
469 cur->cocoa.cursor = cur_id->cid;
470 }
471#endif
472
421#ifdef HAVE_ELEMENTARY_WL2 473#ifdef HAVE_ELEMENTARY_WL2
422 cur->wl.win = elm_win_wl_window_get(top); 474 cur->wl.win = elm_win_wl_window_get(top);
423#endif 475#endif
@@ -541,6 +593,10 @@ elm_object_cursor_unset(Evas_Object *obj)
541 else if (cur->x.win) 593 else if (cur->x.win)
542 ecore_x_window_cursor_set(cur->x.win, ECORE_X_CURSOR_X); 594 ecore_x_window_cursor_set(cur->x.win, ECORE_X_CURSOR_X);
543#endif 595#endif
596#ifdef HAVE_ELEMENTARY_COCOA
597 else if (cur->cocoa.win)
598 ecore_cocoa_window_cursor_set(cur->cocoa.win, ECORE_COCOA_CURSOR_DEFAULT);
599#endif
544#ifdef HAVE_ELEMENTARY_WL2 600#ifdef HAVE_ELEMENTARY_WL2
545 else if (cur->wl.win) 601 else if (cur->wl.win)
546 ecore_wl2_window_cursor_from_name_set(cur->wl.win, NULL); 602 ecore_wl2_window_cursor_from_name_set(cur->wl.win, NULL);
@@ -621,3 +677,4 @@ elm_object_cursor_theme_search_enabled_get(const Evas_Object *obj)
621 ELM_CURSOR_GET_OR_RETURN(cur, obj, EINA_FALSE); 677 ELM_CURSOR_GET_OR_RETURN(cur, obj, EINA_FALSE);
622 return cur->theme_search; 678 return cur->theme_search;
623} 679}
680