From aab530e3473fa06ce035d2a30b200caa3b3c0ddc Mon Sep 17 00:00:00 2001 From: Nicolas Aguirre Date: Thu, 6 Aug 2015 19:06:34 +0200 Subject: [PATCH] ecore_cocoa/evas_gl_cocoa: fix indent, remove printf, and add DBG messages Signed-off-by: Cedric BAIL --- src/lib/ecore_cocoa/ecore_cocoa.m | 26 +- .../ecore_evas/engines/cocoa/ecore_evas_cocoa.c | 607 ++++++++++----------- src/modules/evas/engines/gl_cocoa/evas_engine.c | 314 +++++------ .../evas/engines/gl_cocoa/evas_gl_cocoa_main.m | 45 +- 4 files changed, 471 insertions(+), 521 deletions(-) diff --git a/src/lib/ecore_cocoa/ecore_cocoa.m b/src/lib/ecore_cocoa/ecore_cocoa.m index 568a828..d4e8580 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa.m +++ b/src/lib/ecore_cocoa/ecore_cocoa.m @@ -33,8 +33,6 @@ ecore_cocoa_init(void) if (++_ecore_cocoa_init_count != 1) return _ecore_cocoa_init_count; - DBG("Ecore Cocoa Init"); - if (!ecore_init()) return --_ecore_cocoa_init_count; @@ -48,6 +46,8 @@ ecore_cocoa_init(void) return 0; } + DBG(""); + ECORE_COCOA_EVENT_GOT_FOCUS = ecore_event_type_new(); ECORE_COCOA_EVENT_LOST_FOCUS = ecore_event_type_new(); ECORE_COCOA_EVENT_RESIZE = ecore_event_type_new(); @@ -163,20 +163,6 @@ _ecore_cocoa_event_key(NSEvent *event, int keyType) return ev; } -static inline Eina_Bool -_nsevent_window_is_type_of(NSEvent *event, Class class) -{ - /* An NSPeriodic event has no window (undefined behaviour) */ - if ([event type] == NSPeriodic) return EINA_FALSE; - return [[event window] isKindOfClass:class]; -} - -static inline Eina_Bool -_has_ecore_cocoa_window(NSEvent *event) -{ - return _nsevent_window_is_type_of(event, [EcoreCocoaWindow class]); -} - EAPI Eina_Bool ecore_cocoa_feed_events(void *anEvent) { @@ -186,7 +172,7 @@ ecore_cocoa_feed_events(void *anEvent) unsigned int time = (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff); Eina_Bool pass = EINA_FALSE; - DBG("Feed events, event type ; %d", [event type]); + DBG("Feed events, event type ; %lu", [event type]); switch ([event type]) { @@ -381,14 +367,14 @@ ecore_cocoa_feed_events(void *anEvent) } EAPI void -ecore_cocoa_screen_size_get(Ecore_Cocoa_Screen *screen, int *w, int *h) +ecore_cocoa_screen_size_get(Ecore_Cocoa_Screen *screen EINA_UNUSED, int *w, int *h) { NSSize pt = [[[NSScreen screens] objectAtIndex:0] frame].size; - DBG("Screen size get : %dx%d", w, h); - if (w) *w = (int)pt.width; if (h) *h = (int)pt.height; + + DBG("Screen size get : %dx%d", (int)pt.width, (int)pt.height); } EAPI int 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 5fe7a73..fc0241f 100644 --- a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c +++ b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c @@ -41,13 +41,9 @@ static int _ecore_evas_init_count = 0; // FIXME: In case we have a lot of windows per app, we should probably use another container // like a rbtree or a dictionnary-based container static Eina_List *ecore_evases = NULL; -static Ecore_Event_Handler *ecore_evas_event_handlers[5] = { - 0 -}; +static Ecore_Event_Handler *ecore_evas_event_handlers[5] = { 0 }; static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL; -//static const char *ecore_evas_cocoa_default = "EFL Cocoa"; - static int _render_updates_process(Ecore_Evas *ee, Eina_List *updates) { @@ -55,11 +51,11 @@ _render_updates_process(Ecore_Evas *ee, Eina_List *updates) if (ee->prop.avoid_damage) { - if (updates) - { - _ecore_evas_idle_timeout_update(ee); - rend = 1; - } + if (updates) + { + _ecore_evas_idle_timeout_update(ee); + rend = 1; + } } else if (((ee->visible) && (ee->draw_ok)) || @@ -70,11 +66,11 @@ _render_updates_process(Ecore_Evas *ee, Eina_List *updates) { if (ee->shaped) { - //TODO + //TODO } if (ee->alpha) { - //TODO + //TODO } _ecore_evas_idle_timeout_update(ee); rend = 1; @@ -97,7 +93,7 @@ _render_updates_process(Ecore_Evas *ee, Eina_List *updates) if ((t - t0) > 1.0) { td = t - t0; - printf("FPS: %3.3f\n", (double)frames / td); + DBG("FPS: %3.3f", (double)frames / td); frames = 0; t0 = t; } @@ -107,24 +103,9 @@ _render_updates_process(Ecore_Evas *ee, Eina_List *updates) } static int -_ecore_evas_render(Ecore_Evas *ee) -{ - Eina_List *updates; - - updates = evas_render_updates(ee->evas); - if (updates) - { - evas_render_updates_free(updates); - _ecore_evas_idle_timeout_update(ee); - } - return updates ? 1 : 0; -} - -static int _ecore_evas_cocoa_render(Ecore_Evas *ee) { int rend = 0; - Eina_List *updates = NULL; Eina_List *ll; Ecore_Evas *ee2; static int render2 = -1; @@ -134,7 +115,7 @@ _ecore_evas_cocoa_render(Ecore_Evas *ee) if (ee->in_async_render) { - //EDBG("ee=%p is rendering asynchronously, skip.", ee); + DBG("ee=%p is rendering asynchronously, skip.", ee); return 0; } @@ -177,7 +158,7 @@ _ecore_evas_cocoa_render(Ecore_Evas *ee) } else if (evas_render_async(ee->evas)) { - //EDBG("ee=%p started asynchronous render.", ee); + DBG("ee=%p started asynchronous render.", ee); ee->in_async_render = EINA_TRUE; rend = 1; } @@ -190,61 +171,67 @@ _ecore_evas_cocoa_render(Ecore_Evas *ee) static Ecore_Evas * _ecore_evas_cocoa_match(Ecore_Cocoa_Window_Id wid) { - Eina_List *it; - Ecore_Evas *ee; + Eina_List *it; + Ecore_Evas *ee; - DBG("Match"); - EINA_LIST_FOREACH(ecore_evases, it, ee) - { - if (ecore_cocoa_window_get_window_id((Ecore_Cocoa_Window *)ee->prop.window) == wid) - return ee; - } - return NULL; + DBG(""); + EINA_LIST_FOREACH(ecore_evases, it, ee) + { + if (ecore_cocoa_window_get_window_id((Ecore_Cocoa_Window *)ee->prop.window) == wid) + return ee; + } + return NULL; } static Eina_Bool _ecore_evas_cocoa_event_got_focus(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { - Ecore_Cocoa_Event_Window *e = event; - Ecore_Evas *ee; + Ecore_Cocoa_Event_Window *e = event; + Ecore_Evas *ee; - DBG("Got Focus"); + DBG(""); - ee = _ecore_evas_cocoa_match(e->wid); + if (!e->wid) + return ECORE_CALLBACK_PASS_ON; - if (!ee) - { - printf("%s: Unregistered Ecore_Evas for window Id %p\n", __func__, e->wid); - return ECORE_CALLBACK_PASS_ON; - } - ee->prop.focused = EINA_TRUE; - evas_focus_in(ee->evas); - if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); + ee = _ecore_evas_cocoa_match(e->wid); + + if (!ee) + { + ERR("Unregistered Ecore_Evas for window Id %p", e->wid); + return ECORE_CALLBACK_PASS_ON; + } + ee->prop.focused = EINA_TRUE; + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); - return ECORE_CALLBACK_PASS_ON; + return ECORE_CALLBACK_PASS_ON; } static Eina_Bool _ecore_evas_cocoa_event_lost_focus(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { - Ecore_Cocoa_Event_Window *e = event; - Ecore_Evas *ee; + Ecore_Cocoa_Event_Window *e = event; + Ecore_Evas *ee; - DBG("Lost Focus"); + DBG(""); - ee = _ecore_evas_cocoa_match(e->wid); + if (!e->wid) + return ECORE_CALLBACK_PASS_ON; - if (!ee) - { - printf("%s: Unregistered Ecore_Evas for window Id %p\n", __func__, e->wid); - return ECORE_CALLBACK_PASS_ON; - } - evas_focus_out(ee->evas); - ee->prop.focused = EINA_FALSE; - if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); + ee = _ecore_evas_cocoa_match(e->wid); + + if (!ee) + { + ERR("Unregistered Ecore_Evas for window Id %p", e->wid); + return ECORE_CALLBACK_PASS_ON; + } + evas_focus_out(ee->evas); + ee->prop.focused = EINA_FALSE; + if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); - return ECORE_CALLBACK_PASS_ON; + return ECORE_CALLBACK_PASS_ON; } static Eina_Bool @@ -253,11 +240,15 @@ _ecore_evas_cocoa_event_video_resize(void *data EINA_UNUSED, int type EINA_UNUSE Ecore_Cocoa_Event_Video_Resize *e = event; Ecore_Evas *ee; - DBG("Video resize"); + DBG(""); + + if (!e->wid) + return ECORE_CALLBACK_PASS_ON; + ee = _ecore_evas_cocoa_match(e->wid); if (!ee) { - printf("%s: Unregistered Ecore_Evas for window Id %p\n", __func__, e->wid); + ERR("Unregistered Ecore_Evas for window Id %p", e->wid); return ECORE_CALLBACK_PASS_ON; } @@ -268,7 +259,7 @@ _ecore_evas_cocoa_event_video_resize(void *data EINA_UNUSED, int type EINA_UNUSE evas_output_viewport_set(ee->evas, 0, 0, e->w, e->h); evas_damage_rectangle_add(ee->evas, 0, 0, e->w, e->h); - if (ee->func.fn_resize) ee->func.fn_resize(ee); + if (ee->func.fn_resize) ee->func.fn_resize(ee); return ECORE_CALLBACK_PASS_ON; } @@ -276,24 +267,27 @@ _ecore_evas_cocoa_event_video_resize(void *data EINA_UNUSED, int type EINA_UNUSE static Eina_Bool _ecore_evas_cocoa_event_video_expose(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { - Ecore_Cocoa_Event_Window *e = event; - Ecore_Evas *ee; - int w; - int h; + Ecore_Cocoa_Event_Window *e = event; + Ecore_Evas *ee; + int w; + int h; - DBG("Video Expose"); + DBG(""); - ee = _ecore_evas_cocoa_match(e->wid); + if (!e->wid) + return ECORE_CALLBACK_PASS_ON; - if (!ee) - { - printf("%s: Unregistered Ecore_Evas for window Id %p\n", __func__, e->wid); - return ECORE_CALLBACK_PASS_ON; - } - evas_output_size_get(ee->evas, &w, &h); - evas_damage_rectangle_add(ee->evas, 0, 0, w, h); + ee = _ecore_evas_cocoa_match(e->wid); - return ECORE_CALLBACK_PASS_ON; + if (!ee) + { + ERR("Unregistered Ecore_Evas for window Id %p", e->wid); + return ECORE_CALLBACK_PASS_ON; + } + evas_output_size_get(ee->evas, &w, &h); + evas_damage_rectangle_add(ee->evas, 0, 0, w, h); + + return ECORE_CALLBACK_PASS_ON; } static Eina_Bool @@ -302,12 +296,15 @@ _ecore_evas_cocoa_event_window_destroy(void *data EINA_UNUSED, int type EINA_UNU Ecore_Cocoa_Event_Window *e = event; Ecore_Evas *ee; - DBG("Window destroy"); + DBG(""); + + if (!e->wid) + return ECORE_CALLBACK_PASS_ON; ee = _ecore_evas_cocoa_match(e->wid); if (!ee) { - WRN("%s: Unregistered Ecore_Evas for window Id %p\n", __func__, e->wid); + ERR("Unregistered Ecore_Evas for window Id %p", e->wid); return ECORE_CALLBACK_PASS_ON; } @@ -316,79 +313,58 @@ _ecore_evas_cocoa_event_window_destroy(void *data EINA_UNUSED, int type EINA_UNU return ECORE_CALLBACK_PASS_ON; } - -//static int -//_ecore_evas_idle_enter(void *data EINA_UNUSED) -//{ -// Ecore_Evas *ee; -// Eina_List *l; -// -// DBG("Idle enter"); -// -// EINA_LIST_FOREACH(ecore_evases, l, ee) -// { -// if (ee->visible) -// evas_render(ee->evas); -// else -// evas_norender(ee->evas); -// } -// -// return EINA_TRUE; -//} - - static int _ecore_evas_cocoa_init(void) { - DBG("Cocoa Init"); - _ecore_evas_init_count++; - if (_ecore_evas_init_count > 1) - return _ecore_evas_init_count; + DBG(""); + _ecore_evas_init_count++; + if (_ecore_evas_init_count > 1) + return _ecore_evas_init_count; - ecore_event_evas_init(); + ecore_event_evas_init(); - ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_COCOA_EVENT_GOT_FOCUS, _ecore_evas_cocoa_event_got_focus, NULL); - ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_COCOA_EVENT_LOST_FOCUS, _ecore_evas_cocoa_event_lost_focus, NULL); - ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_COCOA_EVENT_RESIZE, _ecore_evas_cocoa_event_video_resize, NULL); - ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_COCOA_EVENT_EXPOSE, _ecore_evas_cocoa_event_video_expose, NULL); - ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_COCOA_EVENT_WINDOW_DESTROY, _ecore_evas_cocoa_event_window_destroy, NULL); + ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_COCOA_EVENT_GOT_FOCUS, _ecore_evas_cocoa_event_got_focus, NULL); + ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_COCOA_EVENT_LOST_FOCUS, _ecore_evas_cocoa_event_lost_focus, NULL); + ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_COCOA_EVENT_RESIZE, _ecore_evas_cocoa_event_video_resize, NULL); + ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_COCOA_EVENT_EXPOSE, _ecore_evas_cocoa_event_video_expose, NULL); + ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_COCOA_EVENT_WINDOW_DESTROY, _ecore_evas_cocoa_event_window_destroy, NULL); - return _ecore_evas_init_count; + return _ecore_evas_init_count; } static int _ecore_evas_cocoa_shutdown(void) { - Ecore_Evas *ee; - DBG("Cocoa Shutdown"); - _ecore_evas_init_count--; - if (_ecore_evas_init_count == 0) - { - unsigned int i; + Ecore_Evas *ee; + DBG(""); + _ecore_evas_init_count--; + if (_ecore_evas_init_count == 0) + { + unsigned int i; - EINA_LIST_FREE(ecore_evases, ee) - _ecore_evas_free(ee); + EINA_LIST_FREE(ecore_evases, ee) + _ecore_evas_free(ee); - for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler*); i++) - ecore_event_handler_del(ecore_evas_event_handlers[i]); - ecore_event_evas_shutdown(); - ecore_idle_enterer_del(ecore_evas_idle_enterer); - ecore_evas_idle_enterer = NULL; + for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler*); i++) + ecore_event_handler_del(ecore_evas_event_handlers[i]); + ecore_event_evas_shutdown(); + ecore_idle_enterer_del(ecore_evas_idle_enterer); + ecore_evas_idle_enterer = NULL; - ecore_event_evas_shutdown(); - } - if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; - return _ecore_evas_init_count; + ecore_event_evas_shutdown(); + } + if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; + return _ecore_evas_init_count; } static void _ecore_evas_cocoa_free(Ecore_Evas *ee) { - DBG("Cocoa Free"); - ecore_evases = eina_list_remove(ecore_evases, ee); - ecore_event_window_unregister(0); - _ecore_evas_cocoa_shutdown(); - ecore_cocoa_shutdown(); + DBG(""); + ecore_evases = eina_list_remove(ecore_evases, ee); + ecore_event_window_unregister(0); + _ecore_evas_cocoa_shutdown(); + ecore_cocoa_shutdown(); } static void @@ -412,61 +388,61 @@ _ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h) static void _ecore_evas_move(Ecore_Evas *ee, int x, int y) { - DBG("Move"); + DBG(""); ecore_cocoa_window_move((Ecore_Cocoa_Window *)ee->prop.window, x, y); } static void _ecore_evas_resize(Ecore_Evas *ee, int w, int h) { - DBG("Resize"); - if ((w == ee->w) && (h == ee->h)) return; - ee->req.w = w; - ee->req.h = h; - ee->w = w; - ee->h = h; + DBG(""); + if ((w == ee->w) && (h == ee->h)) return; + ee->req.w = w; + ee->req.h = h; + ee->w = w; + ee->h = h; - printf("Ecore_Evas Resize %d %d\n", w, h); + DBG("Ecore_Evas Resize %d %d", w, h); - ecore_cocoa_window_resize((Ecore_Cocoa_Window *)ee->prop.window, w, h); + ecore_cocoa_window_resize((Ecore_Cocoa_Window *)ee->prop.window, w, h); - evas_output_size_set(ee->evas, ee->w, ee->h); - evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); - evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); - if (ee->func.fn_resize) ee->func.fn_resize(ee); + if (ee->func.fn_resize) ee->func.fn_resize(ee); } static void _ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h) { - DBG("Move Resize"); - if ((ee->w == w) && (ee->h == h) && (x == ee->x) && (y == ee->y)) - return; + DBG(""); + if ((ee->w == w) && (ee->h == h) && (x == ee->x) && (y == ee->y)) + return; - ee->req.x = x; - ee->req.y = y; - ee->req.w = w; - ee->req.h = h; - ee->w = w; - ee->h = h; - ee->x = x; - ee->y = y; + ee->req.x = x; + ee->req.y = y; + ee->req.w = w; + ee->req.h = h; + ee->w = w; + ee->h = h; + ee->x = x; + ee->y = y; - ecore_cocoa_window_move_resize((Ecore_Cocoa_Window *)ee->prop.window, x, y, w, h); + ecore_cocoa_window_move_resize((Ecore_Cocoa_Window *)ee->prop.window, x, y, w, h); - evas_output_size_set(ee->evas, ee->w, ee->h); - evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); - evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); - if (ee->func.fn_resize) ee->func.fn_resize(ee); + if (ee->func.fn_resize) ee->func.fn_resize(ee); } static void _ecore_evas_show(Ecore_Evas *ee) { - DBG("Show"); + DBG(""); ee->should_be_visible = 1; if (ee->prop.avoid_damage) _ecore_evas_cocoa_render(ee); @@ -479,7 +455,7 @@ _ecore_evas_show(Ecore_Evas *ee) static void _ecore_evas_hide(Ecore_Evas *ee) { - DBG("Hide"); + DBG(""); ecore_cocoa_window_hide((Ecore_Cocoa_Window *)ee->prop.window); ee->should_be_visible = 0; @@ -488,15 +464,15 @@ _ecore_evas_hide(Ecore_Evas *ee) static void _ecore_evas_raise(Ecore_Evas *ee) { - DBG("Raise"); - + DBG(""); + ecore_cocoa_window_raise((Ecore_Cocoa_Window *)ee->prop.window); } static void _ecore_evas_lower(Ecore_Evas *ee) { - DBG("Lower"); + DBG(""); ecore_cocoa_window_lower((Ecore_Cocoa_Window *)ee->prop.window); } @@ -504,7 +480,7 @@ _ecore_evas_lower(Ecore_Evas *ee) static void _ecore_evas_activate(Ecore_Evas *ee) { - DBG("Activate"); + DBG(""); ecore_cocoa_window_activate((Ecore_Cocoa_Window *)ee->prop.window); } @@ -512,7 +488,7 @@ _ecore_evas_activate(Ecore_Evas *ee) static void _ecore_evas_iconified_set(Ecore_Evas *ee, Eina_Bool on) { - DBG("IconifiedSet"); + DBG(""); ecore_cocoa_window_iconified_set((Ecore_Cocoa_Window *)ee->prop.window, on); } @@ -533,13 +509,13 @@ _ecore_evas_title_set(Ecore_Evas *ee, const char *title) static void _ecore_evas_object_cursor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { - Ecore_Evas *ee; + Ecore_Evas *ee; - DBG("Cursor DEL"); + DBG(""); - ee = data; - if (ee) - ee->prop.cursor.object = NULL; + ee = data; + if (ee) + ee->prop.cursor.object = NULL; } static void @@ -551,45 +527,45 @@ _ecore_evas_object_cursor_unset(Ecore_Evas *ee) static void _ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) { - int x, y; - DBG("Cursor Set"); - if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); + int x, y; + DBG(""); + if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); - if (obj == NULL) - { - ee->prop.cursor.object = NULL; - ee->prop.cursor.layer = 0; - ee->prop.cursor.hot.x = 0; - ee->prop.cursor.hot.y = 0; - return; - } + if (obj == NULL) + { + ee->prop.cursor.object = NULL; + ee->prop.cursor.layer = 0; + ee->prop.cursor.hot.x = 0; + ee->prop.cursor.hot.y = 0; + return; + } - ee->prop.cursor.object = obj; - ee->prop.cursor.layer = layer; - ee->prop.cursor.hot.x = hot_x; - ee->prop.cursor.hot.y = hot_y; + ee->prop.cursor.object = obj; + ee->prop.cursor.layer = layer; + ee->prop.cursor.hot.x = hot_x; + ee->prop.cursor.hot.y = hot_y; - evas_pointer_output_xy_get(ee->evas, &x, &y); - evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); - evas_object_move(ee->prop.cursor.object, - x - ee->prop.cursor.hot.x, - y - ee->prop.cursor.hot.y); + evas_pointer_output_xy_get(ee->evas, &x, &y); + evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + evas_object_move(ee->prop.cursor.object, + x - ee->prop.cursor.hot.x, + y - ee->prop.cursor.hot.y); - evas_object_pass_events_set(ee->prop.cursor.object, 1); + evas_object_pass_events_set(ee->prop.cursor.object, 1); - if (evas_pointer_inside_get(ee->evas)) - evas_object_show(ee->prop.cursor.object); + if (evas_pointer_inside_get(ee->evas)) + evas_object_show(ee->prop.cursor.object); - evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); } static void _ecore_evas_withdrawn_set(Ecore_Evas *ee, Eina_Bool on) { - if (on) - _ecore_evas_hide(ee); - else - _ecore_evas_show(ee); + if (on) + _ecore_evas_hide(ee); + else + _ecore_evas_show(ee); } static int @@ -599,7 +575,7 @@ _ecore_evas_engine_cocoa_init(Ecore_Evas *ee) const char *driver; int rmethod; - DBG("Cocoa Init"); + DBG(""); driver = "gl_cocoa"; @@ -613,10 +589,7 @@ _ecore_evas_engine_cocoa_init(Ecore_Evas *ee) einfo = (Evas_Engine_Info_GL_Cocoa *)evas_engine_info_get(ee->evas); if (einfo) { - /* FIXME: REDRAW_DEBUG missing for now */ einfo->window = (void *)ee->prop.window; - //einfo->info.depth = ecore_win32_screen_depth_get(); - //einfo->info.rotation = 0; if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) { ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); @@ -639,7 +612,7 @@ _ecore_evas_screen_geometry_get(const Ecore_Evas *ee EINA_UNUSED, int *x, int *y if (x) *x = 0; if (y) *y = 0; ecore_cocoa_screen_size_get(NULL, w, h); - printf("screen geometry_get %dx%d\n", *w, *h); + DBG("screen geometry_get %dx%d", *w, *h); } @@ -701,120 +674,112 @@ static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func = NULL, // profiles_set NULL, // profile_set - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - - NULL, // render - _ecore_evas_screen_geometry_get, - NULL, // screen_dpi_get - NULL, - NULL // msg_send + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + + NULL, // render + _ecore_evas_screen_geometry_get, + NULL, // screen_dpi_get + NULL, + NULL // msg_send }; EAPI Ecore_Evas * ecore_evas_cocoa_new_internal(Ecore_Cocoa_Window *parent EINA_UNUSED, int x, int y, int w, int h) { -// Evas_Engine_Info_GL_Cocoa *einfo; - Ecore_Evas *ee; - - DBG("Cocoa new"); - - if (!ecore_cocoa_init()) - return NULL; - - ee = calloc(1, sizeof(Ecore_Evas)); - if (!ee) - goto shutdown_ecore_cocoa; - - ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); - - _ecore_evas_cocoa_init(); - - ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_cocoa_engine_func; - - if (w < 1) w = 1; - if (h < 1) h = 1; - ee->visible = 1; - ee->x = x; - ee->y = y; - ee->w = w; - ee->h = h; - ee->req.x = ee->x; - ee->req.y = ee->y; - ee->req.w = ee->w - ee->y; - ee->req.h = ee->h; - - ee->semi_sync = 1; - - - ee->prop.max.w = 32767; - ee->prop.max.h = 32767; - ee->prop.layer = 4; - ee->prop.request_pos = EINA_FALSE; - ee->prop.sticky = EINA_FALSE; - ee->prop.window = 0; - ee->prop.withdrawn = EINA_TRUE; - - printf("Create New Evas\n"); - - ee->evas = evas_new(); - - if (!ee->evas) - goto free_name; - - evas_data_attach_set(ee->evas, ee); - evas_output_size_set(ee->evas, w, h); - evas_output_viewport_set(ee->evas, 0, 0, w, h); - - printf("Create New Cocoa Window\n"); - ee->prop.window = (Ecore_Window)ecore_cocoa_window_new(x, y, w, h); - printf("Window Created %p\n", (Ecore_Cocoa_Window *)ee->prop.window); - if (!ee->prop.window) - { - _ecore_evas_cocoa_shutdown(); - free(ee); - return NULL; - } - - printf("Init Evas engine cocoa\n"); - if (!_ecore_evas_engine_cocoa_init(ee)) - { - _ecore_evas_cocoa_shutdown(); - free(ee); - return NULL; - } - - - ee->engine.func->fn_render = _ecore_evas_cocoa_render; - _ecore_evas_register(ee); - ecore_event_window_register(ee->prop.window, ee, ee->evas, - (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, - (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, - (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, - (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); - - evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); - printf("Ecore Evas returned : %p\n", ee); - - ecore_evases = eina_list_append(ecore_evases, ee); - - return ee; - - //free_window: - /* FIXME: free window here */ - //free_evas: - // free(ee->evas); -free_name: - free(ee->name); - //free_ee: - _ecore_evas_cocoa_shutdown(); - free(ee); + Ecore_Evas *ee; + + if (!ecore_cocoa_init()) + return NULL; + + DBG(""); + + ee = calloc(1, sizeof(Ecore_Evas)); + if (!ee) + goto shutdown_ecore_cocoa; + + ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); + + _ecore_evas_cocoa_init(); + + ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_cocoa_engine_func; + + if (w < 1) w = 1; + if (h < 1) h = 1; + ee->visible = 1; + ee->x = x; + ee->y = y; + ee->w = w; + ee->h = h; + ee->req.x = ee->x; + ee->req.y = ee->y; + ee->req.w = ee->w - ee->y; + ee->req.h = ee->h; + + ee->semi_sync = 1; + + ee->prop.max.w = 32767; + ee->prop.max.h = 32767; + ee->prop.layer = 4; + ee->prop.request_pos = EINA_FALSE; + ee->prop.sticky = EINA_FALSE; + ee->prop.window = 0; + ee->prop.withdrawn = EINA_TRUE; + + ee->evas = evas_new(); + + if (!ee->evas) + goto free_name; + + evas_data_attach_set(ee->evas, ee); + evas_output_size_set(ee->evas, w, h); + evas_output_viewport_set(ee->evas, 0, 0, w, h); + + ee->prop.window = (Ecore_Window)ecore_cocoa_window_new(x, y, w, h); + + if (!ee->prop.window) + { + _ecore_evas_cocoa_shutdown(); + free(ee); + return NULL; + } + + if (!_ecore_evas_engine_cocoa_init(ee)) + { + _ecore_evas_cocoa_shutdown(); + free(ee); + return NULL; + } + + + ee->engine.func->fn_render = _ecore_evas_cocoa_render; + _ecore_evas_register(ee); + ecore_event_window_register(ee->prop.window, ee, ee->evas, + (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, + (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, + (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, + (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); + + evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); + ecore_evases = eina_list_append(ecore_evases, ee); + + return ee; + + //free_window: + /* FIXME: free window here */ + //free_evas: + // free(ee->evas); + free_name: + free(ee->name); + //free_ee: + _ecore_evas_cocoa_shutdown(); + free(ee); shutdown_ecore_cocoa: - ecore_cocoa_shutdown(); + ecore_cocoa_shutdown(); - return NULL; + return NULL; } diff --git a/src/modules/evas/engines/gl_cocoa/evas_engine.c b/src/modules/evas/engines/gl_cocoa/evas_engine.c index 00e670a..8597b05 100644 --- a/src/modules/evas/engines/gl_cocoa/evas_engine.c +++ b/src/modules/evas/engines/gl_cocoa/evas_engine.c @@ -45,7 +45,7 @@ struct _Render_Engine_GL_Surface struct _Render_Engine_GL_Context { int initialized; - // EGLContext context; + // EGLContext context; GLuint fbo; @@ -104,8 +104,8 @@ eng_setup(Evas *eo_e, void *in) e->engine.data.output = re; re->win = eng_window_new(info->window, - e->output.w, - e->output.h); + e->output.w, + e->output.h); info->view = re->win->view; if (!re->win) { @@ -121,8 +121,8 @@ eng_setup(Evas *eo_e, void *in) re = e->engine.data.output; eng_window_free(re->win); re->win = eng_window_new(info->window, - e->output.w, - e->output.h); + e->output.w, + e->output.h); info->view = re->win->view; } if (!e->engine.data.output) return 0; @@ -166,7 +166,7 @@ eng_output_resize(void *data, int w, int h) static void eng_output_tile_size_set(void *data EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED) { - DBG("tile size set"); + DBG("tile size set"); } static void @@ -235,10 +235,10 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i /* get the upate rect surface - return engine data as dummy */ if (!re->win->draw.redraw) { -// printf("GL: NO updates!\n"); + // printf("GL: NO updates!\n"); return NULL; } -// printf("GL: update....!\n"); + // printf("GL: update....!\n"); #ifdef SLOW_GL_COPY_RECT /* if any update - just return the whole canvas - works with swap * buffers then */ @@ -266,10 +266,10 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i if (cw) *cw = re->win->draw.x2 - re->win->draw.x1 + 1; if (ch) *ch = re->win->draw.y2 - re->win->draw.y1 + 1; #endif -// clear buffer. only needed for dest alpha -// glClearColor(0.0f, 0.0f, 0.0f, 0.0f); -// glClear(GL_COLOR_BUFFER_BIT); -//x// printf("frame -> new\n"); + // clear buffer. only needed for dest alpha + // glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + // glClear(GL_COLOR_BUFFER_BIT); + //x// printf("frame -> new\n"); return re->win->gl_context->def_surface; } @@ -382,10 +382,10 @@ eng_polygon_draw(void *data, void *context, void *surface EINA_UNUSED, void *pol static int eng_image_alpha_get(void *data EINA_UNUSED, void *image) { -// Render_Engine *re; + // Render_Engine *re; Evas_GL_Image *im; -// re = (Render_Engine *)data; + // re = (Render_Engine *)data; if (!image) return 1; im = image; return im->alpha; @@ -394,10 +394,10 @@ eng_image_alpha_get(void *data EINA_UNUSED, void *image) static Evas_Colorspace eng_image_colorspace_get(void *data EINA_UNUSED, void *image) { -// Render_Engine *re; + // Render_Engine *re; Evas_GL_Image *im; -// re = (Render_Engine *)data; + // re = (Render_Engine *)data; if (!image) return EVAS_COLORSPACE_ARGB8888; im = image; return im->cs.space; @@ -437,10 +437,10 @@ eng_image_alpha_set(void *data, void *image, int has_alpha) evas_cache_image_load_data(&im->im->cache_entry); evas_gl_common_image_alloc_ensure(im); im_new = evas_gl_common_image_new_from_copied_data - (im->gc, im->im->cache_entry.w, im->im->cache_entry.h, - im->im->image.data, - eng_image_alpha_get(data, image), - eng_image_colorspace_get(data, image)); + (im->gc, im->im->cache_entry.w, im->im->cache_entry.h, + im->im->image.data, + eng_image_alpha_get(data, image), + eng_image_colorspace_get(data, image)); if (!im_new) return im; evas_gl_common_image_free(im); im = im_new; @@ -448,34 +448,34 @@ eng_image_alpha_set(void *data, void *image, int has_alpha) else evas_gl_common_image_dirty(im, 0, 0, 0, 0); return evas_gl_common_image_alpha_set(im, has_alpha ? 1 : 0); -// im->im->cache_entry.flags.alpha = has_alpha ? 1 : 0; -// return image; + // im->im->cache_entry.flags.alpha = has_alpha ? 1 : 0; + // return image; } static void * eng_image_border_set(void *data EINA_UNUSED, void *image, int l EINA_UNUSED, int r EINA_UNUSED, int t EINA_UNUSED, int b EINA_UNUSED) { -// Render_Engine *re; -// -// re = (Render_Engine *)data; + // Render_Engine *re; + // + // re = (Render_Engine *)data; return image; } static void eng_image_border_get(void *data EINA_UNUSED, void *image EINA_UNUSED, int *l EINA_UNUSED, int *r EINA_UNUSED, int *t EINA_UNUSED, int *b EINA_UNUSED) { -// Render_Engine *re; -// -// re = (Render_Engine *)data; + // Render_Engine *re; + // + // re = (Render_Engine *)data; } static char * eng_image_comment_get(void *data EINA_UNUSED, void *image, char *key EINA_UNUSED) { -// Render_Engine *re; + // Render_Engine *re; Evas_GL_Image *im; -// re = (Render_Engine *)data; + // re = (Render_Engine *)data; if (!image) return NULL; im = image; if (!im->im) return NULL; @@ -485,10 +485,10 @@ eng_image_comment_get(void *data EINA_UNUSED, void *image, char *key EINA_UNUSED static char * eng_image_format_get(void *data EINA_UNUSED, void *image) { -// Render_Engine *re; + // Render_Engine *re; Evas_GL_Image *im; -// re = (Render_Engine *)data; + // re = (Render_Engine *)data; im = image; return NULL; } @@ -511,34 +511,34 @@ eng_image_colorspace_set(void *data, void *image, Evas_Colorspace cspace) switch (cspace) { case EVAS_COLORSPACE_ARGB8888: - if (im->cs.data) - { - if (!im->cs.no_free) free(im->cs.data); - im->cs.data = NULL; - im->cs.no_free = 0; - } - break; + if (im->cs.data) + { + if (!im->cs.no_free) free(im->cs.data); + im->cs.data = NULL; + im->cs.no_free = 0; + } + break; case EVAS_COLORSPACE_YCBCR422P601_PL: case EVAS_COLORSPACE_YCBCR422P709_PL: case EVAS_COLORSPACE_YCBCR422601_PL: case EVAS_COLORSPACE_YCBCR420NV12601_PL: case EVAS_COLORSPACE_YCBCR420TM12601_PL: - if (im->tex) evas_gl_common_texture_free(im->tex, EINA_TRUE); - im->tex = NULL; - if (im->cs.data) - { - if (!im->cs.no_free) free(im->cs.data); - } - if (im->im->cache_entry.h > 0) - im->cs.data = - calloc(1, im->im->cache_entry.h * sizeof(unsigned char *) * 2); - else - im->cs.data = NULL; - im->cs.no_free = 0; - break; + if (im->tex) evas_gl_common_texture_free(im->tex, EINA_TRUE); + im->tex = NULL; + if (im->cs.data) + { + if (!im->cs.no_free) free(im->cs.data); + } + if (im->im->cache_entry.h > 0) + im->cs.data = + calloc(1, im->im->cache_entry.h * sizeof(unsigned char *) * 2); + else + im->cs.data = NULL; + im->cs.no_free = 0; + break; default: - abort(); - break; + abort(); + break; } im->cs.space = cspace; } @@ -660,9 +660,9 @@ eng_image_size_set(void *data, void *image, int w, int h) case EVAS_COLORSPACE_YCBCR422601_PL: case EVAS_COLORSPACE_YCBCR420NV12601_PL: case EVAS_COLORSPACE_YCBCR420TM12601_PL: - w &= ~0x1; + w &= ~0x1; default: - break; + break; } evas_gl_common_image_alloc_ensure(im_old); @@ -726,41 +726,41 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, i switch (im->cs.space) { case EVAS_COLORSPACE_ARGB8888: - if (to_write) - { - if (im->references > 1) - { - Evas_GL_Image *im_new; + if (to_write) + { + if (im->references > 1) + { + Evas_GL_Image *im_new; - im_new = evas_gl_common_image_new_from_copied_data + im_new = evas_gl_common_image_new_from_copied_data (im->gc, im->im->cache_entry.w, im->im->cache_entry.h, - im->im->image.data, - eng_image_alpha_get(data, image), - eng_image_colorspace_get(data, image)); - if (!im_new) - { - *image_data = NULL; - if (err) *err = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; - return im; - } - evas_gl_common_image_free(im); - im = im_new; - } - else - evas_gl_common_image_dirty(im, 0, 0, 0, 0); - } - *image_data = im->im->image.data; - break; + im->im->image.data, + eng_image_alpha_get(data, image), + eng_image_colorspace_get(data, image)); + if (!im_new) + { + *image_data = NULL; + if (err) *err = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; + return im; + } + evas_gl_common_image_free(im); + im = im_new; + } + else + evas_gl_common_image_dirty(im, 0, 0, 0, 0); + } + *image_data = im->im->image.data; + break; case EVAS_COLORSPACE_YCBCR422P601_PL: case EVAS_COLORSPACE_YCBCR422P709_PL: case EVAS_COLORSPACE_YCBCR422601_PL: case EVAS_COLORSPACE_YCBCR420NV12601_PL: case EVAS_COLORSPACE_YCBCR420TM12601_PL: - *image_data = im->cs.data; - break; + *image_data = im->cs.data; + break; default: - abort(); - break; + abort(); + break; } if (err) *err = error; return im; @@ -803,34 +803,34 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data) switch (im->cs.space) { case EVAS_COLORSPACE_ARGB8888: - if (image_data != im->im->image.data) - { - int w, h; - - w = im->im->cache_entry.w; - h = im->im->cache_entry.h; - im2 = eng_image_new_from_data(data, w, h, image_data, - eng_image_alpha_get(data, image), - eng_image_colorspace_get(data, image)); - if (!im2) return im; - evas_gl_common_image_free(im); - im = im2; - } - break; + if (image_data != im->im->image.data) + { + int w, h; + + w = im->im->cache_entry.w; + h = im->im->cache_entry.h; + im2 = eng_image_new_from_data(data, w, h, image_data, + eng_image_alpha_get(data, image), + eng_image_colorspace_get(data, image)); + if (!im2) return im; + evas_gl_common_image_free(im); + im = im2; + } + break; case EVAS_COLORSPACE_YCBCR422P601_PL: case EVAS_COLORSPACE_YCBCR422P709_PL: - if (image_data != im->cs.data) - { - if (im->cs.data) - { - if (!im->cs.no_free) free(im->cs.data); - } - im->cs.data = image_data; - } - break; + if (image_data != im->cs.data) + { + if (im->cs.data) + { + if (!im->cs.no_free) free(im->cs.data); + } + im->cs.data = image_data; + } + break; default: - abort(); - break; + abort(); + break; } /* hmmm - but if we wrote... why bother? */ evas_gl_common_image_dirty(im, 0, 0, 0, 0); @@ -1030,31 +1030,31 @@ eng_font_draw(void *data, void *context, void *surface, Evas_Font_Set *font EINA evas_gl_common_context_target_surface_set(re->win->gl_context, surface); re->win->gl_context->dc = context; - { - if (!re->win->gl_context->font_surface) - re->win->gl_context->font_surface = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get()); - re->win->gl_context->font_surface->cache_entry.w = re->win->gl_context->shared->w; - re->win->gl_context->font_surface->cache_entry.h = re->win->gl_context->shared->h; - - evas_common_draw_context_font_ext_set(context, - re->win->gl_context, - evas_gl_font_texture_new, - evas_gl_font_texture_free, - evas_gl_font_texture_draw, - NULL, - NULL, - NULL); - evas_common_font_draw_prepare(intl_props); - evas_common_font_draw(re->win->gl_context->font_surface, context, x, y, intl_props->glyphs); - evas_common_draw_context_font_ext_set(context, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL); - } + { + if (!re->win->gl_context->font_surface) + re->win->gl_context->font_surface = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get()); + re->win->gl_context->font_surface->cache_entry.w = re->win->gl_context->shared->w; + re->win->gl_context->font_surface->cache_entry.h = re->win->gl_context->shared->h; + + evas_common_draw_context_font_ext_set(context, + re->win->gl_context, + evas_gl_font_texture_new, + evas_gl_font_texture_free, + evas_gl_font_texture_draw, + NULL, + NULL, + NULL); + evas_common_font_draw_prepare(intl_props); + evas_common_font_draw(re->win->gl_context->font_surface, context, x, y, intl_props->glyphs); + evas_common_draw_context_font_ext_set(context, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL); + } return EINA_FALSE; } @@ -1138,7 +1138,7 @@ evgl_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const #ifdef GL_GLES glShaderBinary(n, shaders, binaryformat, binary, length); #else -// FIXME: need to dlsym/getprocaddress for this + // FIXME: need to dlsym/getprocaddress for this return; n = binaryformat = length = 0; shaders = binary = 0; @@ -1172,7 +1172,7 @@ eng_gl_api_get(void *data, int version EINA_UNUSED) ORD(glCheckFramebufferStatus); ORD(glClear); ORD(glClearColor); -// ORD(glClearDepthf); + // ORD(glClearDepthf); ORD(glClearStencil); ORD(glColorMask); ORD(glCompileShader); @@ -1191,7 +1191,7 @@ eng_gl_api_get(void *data, int version EINA_UNUSED) ORD(glDeleteTextures); ORD(glDepthFunc); ORD(glDepthMask); -// ORD(glDepthRangef); + // ORD(glDepthRangef); ORD(glDetachShader); ORD(glDisable); ORD(glDisableVertexAttribArray); @@ -1224,7 +1224,7 @@ eng_gl_api_get(void *data, int version EINA_UNUSED) ORD(glGetRenderbufferParameteriv); ORD(glGetShaderiv); ORD(glGetShaderInfoLog); -// ORD(glGetShaderPrecisionFormat); + // ORD(glGetShaderPrecisionFormat); ORD(glGetShaderSource); ORD(glGetString); ORD(glGetTexParameterfv); @@ -1248,11 +1248,11 @@ eng_gl_api_get(void *data, int version EINA_UNUSED) ORD(glPixelStorei); ORD(glPolygonOffset); ORD(glReadPixels); -// ORD(glReleaseShaderCompiler); + // ORD(glReleaseShaderCompiler); ORD(glRenderbufferStorage); ORD(glSampleCoverage); ORD(glScissor); -// ORD(glShaderBinary); + // ORD(glShaderBinary); ORD(glShaderSource); ORD(glStencilFunc); ORD(glStencilFuncSeparate); @@ -1299,12 +1299,12 @@ eng_gl_api_get(void *data, int version EINA_UNUSED) ORD(glViewport); #undef ORD -// Override functions wrapped by Evas_GL + // Override functions wrapped by Evas_GL #define ORD(f) EVAS_API_OVERRIDE(f, &gl_funcs, evgl_) ORD(glBindFramebuffer); ORD(glBindRenderbuffer); -// GLES2.0 API compat on top of desktop gl + // GLES2.0 API compat on top of desktop gl ORD(glClearDepthf); ORD(glDepthRangef); ORD(glGetShaderPrecisionFormat); @@ -1340,16 +1340,16 @@ module_open(Evas_Module *em) if (!evas_gl_common_module_open()) return 0; /* get whatever engine module we inherit from */ if (!_evas_module_engine_inherit(&pfunc, "software_generic")) return 0; - _evas_engine_gl_cocoa_log_dom = eina_log_domain_register("EvasGLCocoa", EVAS_DEFAULT_LOG_COLOR); + _evas_engine_gl_cocoa_log_dom = eina_log_domain_register("evas-gl_cocoa", EVAS_DEFAULT_LOG_COLOR); if(_evas_engine_gl_cocoa_log_dom < 0) { - EINA_LOG_ERR("Impossible to create a log domain for GL (Cocoa) engine."); - return 0; + EINA_LOG_ERR("Impossible to create a log domain for GL (Cocoa) engine."); + return 0; } /* store it for later use */ func = pfunc; /* now to override methods */ - #define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_) +#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_) ORD(info); ORD(info_free); ORD(setup); @@ -1417,7 +1417,7 @@ module_open(Evas_Module *em) ORD(image_load_error_get); -#define LINK2GENERIC(sym) \ +#define LINK2GENERIC(sym) \ glsym_##sym = dlsym(RTLD_DEFAULT, #sym); LINK2GENERIC(evas_gl_symbols); @@ -1431,20 +1431,20 @@ module_open(Evas_Module *em) static void module_close(Evas_Module *em EINA_UNUSED) { - eina_log_domain_unregister(_evas_engine_gl_cocoa_log_dom); - evas_gl_common_module_close(); + eina_log_domain_unregister(_evas_engine_gl_cocoa_log_dom); + evas_gl_common_module_close(); } static Evas_Module_Api evas_modapi = -{ - EVAS_MODULE_API_VERSION, - "gl_cocoa", - "none", - { - module_open, - module_close - } -}; + { + EVAS_MODULE_API_VERSION, + "gl_cocoa", + "none", + { + module_open, + module_close + } + }; EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, gl_cocoa); diff --git a/src/modules/evas/engines/gl_cocoa/evas_gl_cocoa_main.m b/src/modules/evas/engines/gl_cocoa/evas_gl_cocoa_main.m index 882a7d7..ea29753 100644 --- a/src/modules/evas/engines/gl_cocoa/evas_gl_cocoa_main.m +++ b/src/modules/evas/engines/gl_cocoa/evas_gl_cocoa_main.m @@ -26,13 +26,13 @@ static NSOpenGLContext *_evas_gl_cocoa_shared_context = NULL; + (NSOpenGLPixelFormat*) basicPixelFormat { NSOpenGLPixelFormatAttribute attributes [] = { - NSOpenGLPFAWindow, - NSOpenGLPFAAccelerated, - NSOpenGLPFADoubleBuffer, - /*NSOpenGLPFAColorSize, 24, - NSOpenGLPFAAlphaSize, 8, - NSOpenGLPFADepthSize, 24,*/ - 0 + NSOpenGLPFAWindow, + NSOpenGLPFAAccelerated, + NSOpenGLPFADoubleBuffer, + /*NSOpenGLPFAColorSize, 24, + NSOpenGLPFAAlphaSize, 8, + NSOpenGLPFADepthSize, 24,*/ + 0 }; return [[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes] autorelease]; } @@ -47,10 +47,10 @@ static NSOpenGLContext *_evas_gl_cocoa_shared_context = NULL; NSOpenGLContext *ctx; if (!_evas_gl_cocoa_shared_context) { - _evas_gl_cocoa_shared_context = [[NSOpenGLContext alloc] initWithFormat: [EvasGLView basicPixelFormat] shareContext: nil]; - ctx = _evas_gl_cocoa_shared_context; + _evas_gl_cocoa_shared_context = [[NSOpenGLContext alloc] initWithFormat: [EvasGLView basicPixelFormat] shareContext: nil]; + ctx = _evas_gl_cocoa_shared_context; } else { - ctx = [[NSOpenGLContext alloc] initWithFormat: [EvasGLView basicPixelFormat] shareContext: _evas_gl_cocoa_shared_context]; + ctx = [[NSOpenGLContext alloc] initWithFormat: [EvasGLView basicPixelFormat] shareContext: _evas_gl_cocoa_shared_context]; } [self setOpenGLContext: ctx]; [ctx setView: self]; @@ -109,11 +109,11 @@ void eng_window_free(Evas_GL_Cocoa_Window *gw) { if (gw == _evas_gl_cocoa_window) - _evas_gl_cocoa_window = NULL; + _evas_gl_cocoa_window = NULL; evas_gl_common_context_free(gw->gl_context); [(EvasGLView*)gw->view release]; - free(gw); + free(gw); } void @@ -146,27 +146,26 @@ eng_window_vsync_set(int on EINA_UNUSED) void eng_window_resize(Evas_GL_Cocoa_Window *gw, int width, int height) { - NSRect view_frame; + NSRect view_frame; - INF("Resize %d %d\n", width, height); + INF("Resize %d %d\n", width, height); - view_frame = [(EvasGLView*)gw->view frame]; - printf("view_frame : %3.3f %3.3f\n", view_frame.size.height, view_frame.size.width); - view_frame.size.height = height; - view_frame.size.width = width; - printf("view_frame : %3.3f %3.3f\n", view_frame.size.height, view_frame.size.width); - [(EvasGLView*)gw->view setFrame:view_frame]; - [[(NSOpenGLView*)gw->view openGLContext] flushBuffer]; + view_frame = [(EvasGLView*)gw->view frame]; + view_frame.size.height = height; + view_frame.size.width = width; + + [(EvasGLView*)gw->view setFrame:view_frame]; + [[(NSOpenGLView*)gw->view openGLContext] flushBuffer]; } void eng_window_lock_focus(Evas_GL_Cocoa_Window *gw) { - [(NSOpenGLView*)gw->view lockFocus]; + [(NSOpenGLView*)gw->view lockFocus]; } void eng_window_unlock_focus(Evas_GL_Cocoa_Window *gw) { - [(NSOpenGLView*)gw->view unlockFocus]; + [(NSOpenGLView*)gw->view unlockFocus]; } -- 2.7.4