ecore_cocoa: replace Ecore_Cocoa_Window_Id by Ecore_Cocoa_Object

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
Jean Guyomarc'h 2016-01-06 21:38:10 +01:00 committed by Cedric BAIL
parent 71199709db
commit 84bbe500c5
3 changed files with 18 additions and 24 deletions

View File

@ -54,12 +54,6 @@ typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window;
*/ */
typedef struct _Ecore_Cocoa_Screen Ecore_Cocoa_Screen; typedef struct _Ecore_Cocoa_Screen Ecore_Cocoa_Screen;
/**
* @typedef Ecore_Cocoa_Window_Id
* Opaque handler to reference the actual Cocoa window
*/
typedef void * Ecore_Cocoa_Window_Id;
/** /**
* @typedef Ecore_Cocoa_Object * @typedef Ecore_Cocoa_Object
* Opaque handler to refer to an objective-c object (aka id) * Opaque handler to refer to an objective-c object (aka id)
@ -91,13 +85,13 @@ struct _Ecore_Cocoa_Event_Video_Resize
{ {
int w; /**< Current width of the window */ int w; /**< Current width of the window */
int h; /**< Current height of the window */ int h; /**< Current height of the window */
Ecore_Cocoa_Window_Id wid; /**< Handler of the Cocoa window */ Ecore_Cocoa_Object *cocoa_window; /**< Handler of the Cocoa window */
}; };
typedef struct _Ecore_Cocoa_Event_Window Ecore_Cocoa_Event_Window; typedef struct _Ecore_Cocoa_Event_Window Ecore_Cocoa_Event_Window;
struct _Ecore_Cocoa_Event_Window struct _Ecore_Cocoa_Event_Window
{ {
Ecore_Cocoa_Window_Id wid; Ecore_Cocoa_Object *cocoa_window;
}; };
/** /**
@ -262,7 +256,7 @@ EAPI void ecore_cocoa_window_view_set(Ecore_Cocoa_Window *window,
EAPI int ecore_cocoa_titlebar_height_get(void); EAPI int ecore_cocoa_titlebar_height_get(void);
EAPI Ecore_Cocoa_Window_Id ecore_cocoa_window_get_window_id(const Ecore_Cocoa_Window *window); EAPI Ecore_Cocoa_Object *ecore_cocoa_window_get(const Ecore_Cocoa_Window *window);
EAPI Eina_Bool ecore_cocoa_selection_clipboard_set(const void *data, int size, Ecore_Cocoa_Cnp_Type type); EAPI Eina_Bool ecore_cocoa_selection_clipboard_set(const void *data, int size, Ecore_Cocoa_Cnp_Type type);

View File

@ -64,7 +64,7 @@ static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST];
CRI("Failed to allocate Ecore_Cocoa_Event_Window"); CRI("Failed to allocate Ecore_Cocoa_Event_Window");
return; return;
} }
event->wid = [notification object]; event->cocoa_window = [notification object];
ecore_event_add(ECORE_COCOA_EVENT_WINDOW_DESTROY, event, NULL, NULL); ecore_event_add(ECORE_COCOA_EVENT_WINDOW_DESTROY, event, NULL, NULL);
} }
@ -82,7 +82,7 @@ static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST];
event->w = size.width; event->w = size.width;
event->h = size.height - event->h = size.height -
(([self isFullScreen] == YES) ? 0 : ecore_cocoa_titlebar_height_get()); (([self isFullScreen] == YES) ? 0 : ecore_cocoa_titlebar_height_get());
event->wid = [notif object]; event->cocoa_window = [notif object];
ecore_event_add(ECORE_COCOA_EVENT_RESIZE, event, NULL, NULL); ecore_event_add(ECORE_COCOA_EVENT_RESIZE, event, NULL, NULL);
/* /*
@ -107,7 +107,7 @@ static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST];
CRI("Failed to allocate Ecore_Cocoa_Event_Window"); CRI("Failed to allocate Ecore_Cocoa_Event_Window");
return; return;
} }
e->wid = [notification object]; e->cocoa_window = [notification object];
ecore_event_add(ECORE_COCOA_EVENT_GOT_FOCUS, e, NULL, NULL); ecore_event_add(ECORE_COCOA_EVENT_GOT_FOCUS, e, NULL, NULL);
} }
@ -131,7 +131,7 @@ static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST];
CRI("Failed to allocate Ecore_Cocoa_Event_Window"); CRI("Failed to allocate Ecore_Cocoa_Event_Window");
return; return;
} }
e->wid = [notification object]; e->cocoa_window = [notification object];
ecore_event_add(ECORE_COCOA_EVENT_LOST_FOCUS, e, NULL, NULL); ecore_event_add(ECORE_COCOA_EVENT_LOST_FOCUS, e, NULL, NULL);
} }
@ -588,8 +588,8 @@ ecore_cocoa_window_view_set(Ecore_Cocoa_Window *window,
[area release]; [area release];
} }
EAPI Ecore_Cocoa_Window_Id EAPI Ecore_Cocoa_Object *
ecore_cocoa_window_get_window_id(const Ecore_Cocoa_Window *window) ecore_cocoa_window_get(const Ecore_Cocoa_Window *window)
{ {
EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
return window->window; return window->window;

View File

@ -162,7 +162,7 @@ _ecore_evas_cocoa_render(Ecore_Evas *ee)
static Ecore_Evas * static Ecore_Evas *
_ecore_evas_cocoa_match(Ecore_Cocoa_Window_Id wid) _ecore_evas_cocoa_match(Ecore_Cocoa_Object *cocoa_win)
{ {
Eina_List *it; Eina_List *it;
Ecore_Evas *ee; Ecore_Evas *ee;
@ -170,7 +170,7 @@ _ecore_evas_cocoa_match(Ecore_Cocoa_Window_Id wid)
DBG(""); DBG("");
EINA_LIST_FOREACH(ecore_evases, it, ee) EINA_LIST_FOREACH(ecore_evases, it, ee)
{ {
if (ecore_cocoa_window_get_window_id((Ecore_Cocoa_Window *)ee->prop.window) == wid) if (ecore_cocoa_window_get((Ecore_Cocoa_Window *)ee->prop.window) == cocoa_win)
return ee; return ee;
} }
return NULL; return NULL;
@ -183,7 +183,7 @@ _ecore_evas_cocoa_event_got_focus(void *data EINA_UNUSED, int type EINA_UNUSED,
Ecore_Cocoa_Event_Window *e = event; Ecore_Cocoa_Event_Window *e = event;
Ecore_Evas *ee; Ecore_Evas *ee;
ee = _ecore_evas_cocoa_match(e->wid); ee = _ecore_evas_cocoa_match(e->cocoa_window);
if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
ee->prop.focused = EINA_TRUE; ee->prop.focused = EINA_TRUE;
@ -199,7 +199,7 @@ _ecore_evas_cocoa_event_lost_focus(void *data EINA_UNUSED, int type EINA_UNUSED,
Ecore_Cocoa_Event_Window *e = event; Ecore_Cocoa_Event_Window *e = event;
Ecore_Evas *ee; Ecore_Evas *ee;
ee = _ecore_evas_cocoa_match(e->wid); ee = _ecore_evas_cocoa_match(e->cocoa_window);
if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
evas_focus_out(ee->evas); evas_focus_out(ee->evas);
@ -241,10 +241,10 @@ _ecore_evas_cocoa_event_video_resize(void *data EINA_UNUSED, int type EINA_UNUSE
DBG(""); DBG("");
ee = _ecore_evas_cocoa_match(e->wid); ee = _ecore_evas_cocoa_match(e->cocoa_window);
if (EINA_UNLIKELY(!ee)) if (EINA_UNLIKELY(!ee))
{ {
ERR("Unregistered Ecore_Evas for window Id %p", e->wid); ERR("Unregistered Ecore_Evas for Cocoa window %p", e->cocoa_window);
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
} }
@ -262,13 +262,13 @@ _ecore_evas_cocoa_event_window_destroy(void *data EINA_UNUSED, int type EINA_UNU
DBG(""); DBG("");
if (!e->wid) if (!e->cocoa_window)
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
ee = _ecore_evas_cocoa_match(e->wid); ee = _ecore_evas_cocoa_match(e->cocoa_window);
if (!ee) if (!ee)
{ {
ERR("Unregistered Ecore_Evas for window Id %p", e->wid); ERR("Unregistered Ecore_Evas for Cocoa window %p", e->cocoa_window);
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
} }