forked from enlightenment/efl
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>
This commit is contained in:
parent
116a0abf93
commit
4623d57762
|
@ -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 \
|
||||
|
|
|
@ -282,6 +282,10 @@ EAPI void *ecore_cocoa_selection_clipboard_get(int *size, Ecore_Cocoa_Cnp_Type t
|
|||
|
||||
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);
|
||||
|
||||
|
|
|
@ -67,6 +67,4 @@ Eina_Bool _ecore_cocoa_window_init(void);
|
|||
|
||||
Eina_Bool _ecore_cocoa_feed_events(void *anEvent);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue