summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Guyomarc'h <jean.guyomarch@openwide.fr>2015-10-08 11:58:46 +0200
committerChris Michael <cp.michael@samsung.com>2015-12-03 12:07:20 -0500
commit4623d57762094011c5155cbea9512ae6a2db8852 (patch)
treec2a95a013f4fd25e669091066ab4f33cba923994
parent116a0abf9326b274671d233be6626a5d63e153ab (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.am3
-rw-r--r--src/lib/ecore_cocoa/Ecore_Cocoa.h4
-rw-r--r--src/lib/ecore_cocoa/ecore_cocoa_private.h2
-rw-r--r--src/lib/ecore_cocoa/ecore_cocoa_window.m47
-rw-r--r--src/lib/ecore_evas/ecore_evas.c9
-rw-r--r--src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c3
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
7installed_ecorecocoamainheadersdir = $(includedir)/ecore-cocoa-@VMAJ@ 7installed_ecorecocoamainheadersdir = $(includedir)/ecore-cocoa-@VMAJ@
8dist_installed_ecorecocoamainheaders_DATA = \ 8dist_installed_ecorecocoamainheaders_DATA = \
9lib/ecore_cocoa/Ecore_Cocoa.h \ 9lib/ecore_cocoa/Ecore_Cocoa.h \
10lib/ecore_cocoa/Ecore_Cocoa_Cursor.h 10lib/ecore_cocoa/Ecore_Cocoa_Cursor.h \
11lib/ecore_cocoa/Ecore_Cocoa_Keys.h
11 12
12lib_ecore_cocoa_libecore_cocoa_la_SOURCES = \ 13lib_ecore_cocoa_libecore_cocoa_la_SOURCES = \
13lib/ecore_cocoa/ecore_cocoa.m \ 14lib/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);
285EAPI void ecore_cocoa_window_cursor_set(Ecore_Cocoa_Window *win, Ecore_Cocoa_Cursor c); 285EAPI void ecore_cocoa_window_cursor_set(Ecore_Cocoa_Window *win, Ecore_Cocoa_Cursor c);
286EAPI void ecore_cocoa_window_cursor_show(Ecore_Cocoa_Window *win, Eina_Bool show); 286EAPI void ecore_cocoa_window_cursor_show(Ecore_Cocoa_Window *win, Eina_Bool show);
287 287
288
289EAPI void ecore_cocoa_window_cursor_set(Ecore_Cocoa_Window *win, Ecore_Cocoa_Cursor c);
290EAPI void ecore_cocoa_window_cursor_show(Ecore_Cocoa_Window *win, Eina_Bool show);
291
288#ifdef __cplusplus 292#ifdef __cplusplus
289} 293}
290#endif 294#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);
67 67
68Eina_Bool _ecore_cocoa_feed_events(void *anEvent); 68Eina_Bool _ecore_cocoa_feed_events(void *anEvent);
69 69
70
71
72#endif 70#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)
578 return EINA_TRUE; 578 return EINA_TRUE;
579} 579}
580 580
581EAPI void
582ecore_cocoa_window_cursor_set(Ecore_Cocoa_Window *win,
583 Ecore_Cocoa_Cursor c)
584{
585 EINA_SAFETY_ON_NULL_RETURN(win);
586 EINA_SAFETY_ON_FALSE_RETURN((c >= 0) && (c <= __ECORE_COCOA_CURSOR_LAST));
587
588 NSCursor *cursor = _cursors[c];
589
590 DBG("Setting cursor %i (%s)", c, [[cursor description] UTF8String]);
591 [cursor set];
592}
593
594EAPI void
595ecore_cocoa_window_cursor_show(Ecore_Cocoa_Window *win,
596 Eina_Bool show)
597{
598 EINA_SAFETY_ON_NULL_RETURN(win);
599
600 if (show) [NSCursor unhide];
601 else [NSCursor hide];
602}
603
604Eina_Bool
605_ecore_cocoa_window_init(void)
606{
607 _cursors[ECORE_COCOA_CURSOR_ARROW] = [NSCursor arrowCursor];
608 _cursors[ECORE_COCOA_CURSOR_CONTEXTUAL_MENU] = [NSCursor contextualMenuCursor];
609 _cursors[ECORE_COCOA_CURSOR_CLOSED_HAND] = [NSCursor closedHandCursor];
610 _cursors[ECORE_COCOA_CURSOR_CROSSHAIR] = [NSCursor crosshairCursor];
611 _cursors[ECORE_COCOA_CURSOR_DISAPPEARING_ITEM] = [NSCursor disappearingItemCursor];
612 _cursors[ECORE_COCOA_CURSOR_DRAG_COPY] = [NSCursor dragCopyCursor];
613 _cursors[ECORE_COCOA_CURSOR_DRAG_LINK] = [NSCursor dragLinkCursor];
614 _cursors[ECORE_COCOA_CURSOR_IBEAM] = [NSCursor IBeamCursor];
615 _cursors[ECORE_COCOA_CURSOR_OPEN_HAND] = [NSCursor openHandCursor];
616 _cursors[ECORE_COCOA_CURSOR_OPERATION_NOT_ALLOWED] = [NSCursor operationNotAllowedCursor];
617 _cursors[ECORE_COCOA_CURSOR_POINTING_HAND] = [NSCursor pointingHandCursor];
618 _cursors[ECORE_COCOA_CURSOR_RESIZE_DOWN] = [NSCursor resizeDownCursor];
619 _cursors[ECORE_COCOA_CURSOR_RESIZE_LEFT] = [NSCursor resizeLeftCursor];
620 _cursors[ECORE_COCOA_CURSOR_RESIZE_LEFT_RIGHT] = [NSCursor resizeLeftRightCursor];
621 _cursors[ECORE_COCOA_CURSOR_RESIZE_RIGHT] = [NSCursor resizeRightCursor];
622 _cursors[ECORE_COCOA_CURSOR_RESIZE_UP] = [NSCursor resizeUpCursor];
623 _cursors[ECORE_COCOA_CURSOR_RESIZE_UP_DOWN] = [NSCursor resizeUpDownCursor];
624 _cursors[ECORE_COCOA_CURSOR_IBEAM_VERTICAL] = [NSCursor IBeamCursorForVerticalLayout];
625
626 return EINA_TRUE;
627}
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)
4003 return iface->window_get2(ee); 4003 return iface->window_get2(ee);
4004} 4004}
4005 4005
4006EAPI Ecore_Cocoa_Window *
4007ecore_evas_cocoa_window_get(const Ecore_Evas *ee)
4008{
4009 Ecore_Evas_Interface_Cocoa *iface;
4010 iface = (Ecore_Evas_Interface_Cocoa *)_ecore_evas_interface_get(ee, "opengl_cocoa");
4011 EINA_SAFETY_ON_NULL_RETURN_VAL(iface, NULL);
4012 return iface->window_get(ee);
4013}
4014
4006EAPI Ecore_Evas * 4015EAPI Ecore_Evas *
4007ecore_evas_drm_new(const char *disp_name, unsigned int parent, 4016ecore_evas_drm_new(const char *disp_name, unsigned int parent,
4008 int x, int y, int w, int h) 4017 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];
37static const char *_iface_name = "opengl_cocoa"; 37static const char *_iface_name = "opengl_cocoa";
38static const int _iface_version = 1; 38static const int _iface_version = 1;
39 39
40static const char *_iface_name = "opengl_cocoa";
41static const int _iface_version = 1;
42
40static int 43static int
41_render_updates_process(Ecore_Evas *ee, Eina_List *updates) 44_render_updates_process(Ecore_Evas *ee, Eina_List *updates)
42{ 45{