devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=4623d57762094011c5155cbea9512ae6a2db8852

commit 4623d57762094011c5155cbea9512ae6a2db8852
Author: Jean Guyomarc'h <jean.guyoma...@openwide.fr>
Date:   Thu Oct 8 11:58:46 2015 +0200

    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 <ced...@osg.samsung.com>
---
 src/Makefile_Ecore_Cocoa.am                        |  3 +-
 src/lib/ecore_cocoa/Ecore_Cocoa.h                  |  4 ++
 src/lib/ecore_cocoa/ecore_cocoa_private.h          |  2 -
 src/lib/ecore_cocoa/ecore_cocoa_window.m           | 47 ++++++++++++++++++++++
 src/lib/ecore_evas/ecore_evas.c                    |  9 +++++
 .../ecore_evas/engines/cocoa/ecore_evas_cocoa.c    |  3 ++
 6 files changed, 65 insertions(+), 3 deletions(-)

diff --git a/src/Makefile_Ecore_Cocoa.am b/src/Makefile_Ecore_Cocoa.am
index 66dc4f7..eaaad48 100644
--- a/src/Makefile_Ecore_Cocoa.am
+++ b/src/Makefile_Ecore_Cocoa.am
@@ -7,7 +7,8 @@ lib_LTLIBRARIES += lib/ecore_cocoa/libecore_cocoa.la
 installed_ecorecocoamainheadersdir = $(includedir)/ecore-cocoa-@VMAJ@
 dist_installed_ecorecocoamainheaders_DATA = \
 lib/ecore_cocoa/Ecore_Cocoa.h \
-lib/ecore_cocoa/Ecore_Cocoa_Cursor.h
+lib/ecore_cocoa/Ecore_Cocoa_Cursor.h \
+lib/ecore_cocoa/Ecore_Cocoa_Keys.h
 
 lib_ecore_cocoa_libecore_cocoa_la_SOURCES = \
 lib/ecore_cocoa/ecore_cocoa.m \
diff --git a/src/lib/ecore_cocoa/Ecore_Cocoa.h 
b/src/lib/ecore_cocoa/Ecore_Cocoa.h
index 2a20050..530f3a5 100644
--- a/src/lib/ecore_cocoa/Ecore_Cocoa.h
+++ b/src/lib/ecore_cocoa/Ecore_Cocoa.h
@@ -285,6 +285,10 @@ EAPI void ecore_cocoa_selection_clipboard_clear(void);
 EAPI void ecore_cocoa_window_cursor_set(Ecore_Cocoa_Window *win, 
Ecore_Cocoa_Cursor c);
 EAPI void ecore_cocoa_window_cursor_show(Ecore_Cocoa_Window *win, Eina_Bool 
show);
 
+
+EAPI void ecore_cocoa_window_cursor_set(Ecore_Cocoa_Window *win, 
Ecore_Cocoa_Cursor c);
+EAPI void ecore_cocoa_window_cursor_show(Ecore_Cocoa_Window *win, Eina_Bool 
show);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_private.h 
b/src/lib/ecore_cocoa/ecore_cocoa_private.h
index 535e08a..db00288 100644
--- a/src/lib/ecore_cocoa/ecore_cocoa_private.h
+++ b/src/lib/ecore_cocoa/ecore_cocoa_private.h
@@ -67,6 +67,4 @@ Eina_Bool _ecore_cocoa_window_init(void);
 
 Eina_Bool _ecore_cocoa_feed_events(void *anEvent);
 
-
-
 #endif
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_window.m 
b/src/lib/ecore_cocoa/ecore_cocoa_window.m
index 25a7c58..508eb8a 100644
--- a/src/lib/ecore_cocoa/ecore_cocoa_window.m
+++ b/src/lib/ecore_cocoa/ecore_cocoa_window.m
@@ -578,3 +578,50 @@ _ecore_cocoa_window_init(void)
    return EINA_TRUE;
 }
 
+EAPI void
+ecore_cocoa_window_cursor_set(Ecore_Cocoa_Window *win,
+                              Ecore_Cocoa_Cursor  c)
+{
+   EINA_SAFETY_ON_NULL_RETURN(win);
+   EINA_SAFETY_ON_FALSE_RETURN((c >= 0) && (c <= __ECORE_COCOA_CURSOR_LAST));
+
+   NSCursor *cursor = _cursors[c];
+
+   DBG("Setting cursor %i (%s)", c, [[cursor description] UTF8String]);
+   [cursor set];
+}
+
+EAPI void
+ecore_cocoa_window_cursor_show(Ecore_Cocoa_Window *win,
+                               Eina_Bool           show)
+{
+   EINA_SAFETY_ON_NULL_RETURN(win);
+
+   if (show) [NSCursor unhide];
+   else [NSCursor hide];
+}
+
+Eina_Bool
+_ecore_cocoa_window_init(void)
+{
+   _cursors[ECORE_COCOA_CURSOR_ARROW]                 = [NSCursor arrowCursor];
+   _cursors[ECORE_COCOA_CURSOR_CONTEXTUAL_MENU]       = [NSCursor 
contextualMenuCursor];
+   _cursors[ECORE_COCOA_CURSOR_CLOSED_HAND]           = [NSCursor 
closedHandCursor];
+   _cursors[ECORE_COCOA_CURSOR_CROSSHAIR]             = [NSCursor 
crosshairCursor];
+   _cursors[ECORE_COCOA_CURSOR_DISAPPEARING_ITEM]     = [NSCursor 
disappearingItemCursor];
+   _cursors[ECORE_COCOA_CURSOR_DRAG_COPY]             = [NSCursor 
dragCopyCursor];
+   _cursors[ECORE_COCOA_CURSOR_DRAG_LINK]             = [NSCursor 
dragLinkCursor];
+   _cursors[ECORE_COCOA_CURSOR_IBEAM]                 = [NSCursor IBeamCursor];
+   _cursors[ECORE_COCOA_CURSOR_OPEN_HAND]             = [NSCursor 
openHandCursor];
+   _cursors[ECORE_COCOA_CURSOR_OPERATION_NOT_ALLOWED] = [NSCursor 
operationNotAllowedCursor];
+   _cursors[ECORE_COCOA_CURSOR_POINTING_HAND]         = [NSCursor 
pointingHandCursor];
+   _cursors[ECORE_COCOA_CURSOR_RESIZE_DOWN]           = [NSCursor 
resizeDownCursor];
+   _cursors[ECORE_COCOA_CURSOR_RESIZE_LEFT]           = [NSCursor 
resizeLeftCursor];
+   _cursors[ECORE_COCOA_CURSOR_RESIZE_LEFT_RIGHT]     = [NSCursor 
resizeLeftRightCursor];
+   _cursors[ECORE_COCOA_CURSOR_RESIZE_RIGHT]          = [NSCursor 
resizeRightCursor];
+   _cursors[ECORE_COCOA_CURSOR_RESIZE_UP]             = [NSCursor 
resizeUpCursor];
+   _cursors[ECORE_COCOA_CURSOR_RESIZE_UP_DOWN]        = [NSCursor 
resizeUpDownCursor];
+   _cursors[ECORE_COCOA_CURSOR_IBEAM_VERTICAL]        = [NSCursor 
IBeamCursorForVerticalLayout];
+
+   return EINA_TRUE;
+}
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index befa11b..66ffa0f 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -4003,6 +4003,15 @@ ecore_evas_wayland_window_get2(const Ecore_Evas *ee)
    return iface->window_get2(ee);
 }
 
+EAPI Ecore_Cocoa_Window *
+ecore_evas_cocoa_window_get(const Ecore_Evas *ee)
+{
+   Ecore_Evas_Interface_Cocoa *iface;
+   iface = (Ecore_Evas_Interface_Cocoa *)_ecore_evas_interface_get(ee, 
"opengl_cocoa");
+   EINA_SAFETY_ON_NULL_RETURN_VAL(iface, NULL);
+   return iface->window_get(ee);
+}
+
 EAPI Ecore_Evas *
 ecore_evas_drm_new(const char *disp_name, unsigned int parent,
                    int x, int y, int w, int h)
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 0f9c3b6..551f416 100644
--- a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
+++ b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
@@ -37,6 +37,9 @@ static Ecore_Event_Handler      *ecore_evas_event_handlers[4];
 static const char *_iface_name = "opengl_cocoa";
 static const int _iface_version = 1;
 
+static const char *_iface_name = "opengl_cocoa";
+static const int _iface_version = 1;
+
 static int
 _render_updates_process(Ecore_Evas *ee, Eina_List *updates)
 {

-- 


Reply via email to