From 442654b1ece1e3cac50c96a95f5df8664a3af25a Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Tue, 5 Apr 2011 12:08:53 +0000 Subject: [PATCH] ecore: remove user of deprecated Evas Quartz backend. SVN revision: 58355 --- legacy/ecore/ChangeLog | 9 +- legacy/ecore/configure.ac | 11 - legacy/ecore/src/lib/ecore_evas/Makefile.am | 10 +- .../src/lib/ecore_evas/ecore_evas_cocoa.c | 468 ------------------ 4 files changed, 8 insertions(+), 490 deletions(-) delete mode 100644 legacy/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c diff --git a/legacy/ecore/ChangeLog b/legacy/ecore/ChangeLog index bde7aded68..8ee700209c 100644 --- a/legacy/ecore/ChangeLog +++ b/legacy/ecore/ChangeLog @@ -116,5 +116,10 @@ 2011-04-01 Cedric Bail - * Add ecore_con_url_pipeline_set and ecore_con_url_pipeline_get for HTTP 1.1 - pipelining support. + * Add ecore_con_url_pipeline_set and ecore_con_url_pipeline_get for + HTTP 1.1 pipelining support. + +2011-04-05 Cedric Bail + + * Remove Ecore_Evas Cocoa backend that use depreacted Evas Quartz + backend. diff --git a/legacy/ecore/configure.ac b/legacy/ecore/configure.ac index 48c6edfdbd..060872ac41 100644 --- a/legacy/ecore/configure.ac +++ b/legacy/ecore/configure.ac @@ -156,7 +156,6 @@ want_ecore_evas_software_ddraw="no" want_ecore_evas_direct3d="no" want_ecore_evas_opengl_glew="no" want_ecore_evas_software_16_ddraw="no" -want_ecore_evas_cocoa="no" want_ecore_evas_software_sdl="no" want_ecore_evas_gl_sdl="no" want_ecore_evas_directfb="no" @@ -192,7 +191,6 @@ case "$host_os" in want_ecore_ipc="yes" want_ecore_imf="yes" want_ecore_cocoa="yes" - want_ecore_evas_cocoa="yes" want_ecore_evas_software_sdl="yes" want_ecore_evas_gl_sdl="yes" ;; @@ -1322,14 +1320,6 @@ if test "x${have_ecore_evas_software_gdi}" = "xyes" -o \ requirements_ecore_evas="ecore-win32 >= 1.0.0 ${requirements_ecore_evas}" fi -# ecore_evas_cocoa - -ECORE_EVAS_CHECK_MODULE([cocoa], - [${want_ecore_evas_cocoa}], - [Cocoa], - [${have_ecore_cocoa}], - [requirements_ecore_evas="ecore-cocoa >= 1.0.0 ${requirements_ecore_evas}"]) - # ecore_evas_software_sdl ECORE_EVAS_CHECK_MODULE([software-sdl], @@ -1559,7 +1549,6 @@ if test "x${have_ecore_evas}" = "xyes" ; then echo " Software DirectDraw........: $have_ecore_evas_software_ddraw" echo " Direct3D...................: $have_ecore_evas_direct3d" echo " OpenGL Glew................: $have_ecore_evas_opengl_glew" - echo " Cocoa......................: $have_ecore_evas_cocoa" echo " Software SDL...............: $have_ecore_evas_software_sdl" echo " OpenGL SDL.................: $have_ecore_evas_opengl_sdl" echo " DirectFB...................: $have_ecore_evas_directfb" diff --git a/legacy/ecore/src/lib/ecore_evas/Makefile.am b/legacy/ecore/src/lib/ecore_evas/Makefile.am index a4eba8526d..300b1e9db7 100644 --- a/legacy/ecore/src/lib/ecore_evas/Makefile.am +++ b/legacy/ecore/src/lib/ecore_evas/Makefile.am @@ -42,14 +42,6 @@ ECORE_SDL_LIB = ECORE_SDL_LIBADD = endif -if BUILD_ECORE_COCOA -ECORE_COCOA_INC = -I$(top_srcdir)/src/lib/ecore_cocoa -xobjective-c -ECORE_COCOA_LIB = $(top_builddir)/src/lib/ecore_cocoa/libecore_cocoa.la -else -ECORE_COCOA_INC = -ECORE_COCOA_LIB = -endif - if BUILD_ECORE_WINCE ECORE_WINCE_INC = -I$(top_srcdir)/src/lib/ecore_wince ECORE_WINCE_LIB = $(top_builddir)/src/lib/ecore_wince/libecore_wince.la @@ -114,7 +106,7 @@ $(top_builddir)/src/lib/ecore/libecore.la \ @EINA_LIBS@ \ @EVIL_LIBS@ -libecore_evas_la_LDFLAGS = @cocoa_ldflags@ -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ +libecore_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ EXTRA_DIST = \ ecore_evas_private.h diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c deleted file mode 100644 index e6fb541020..0000000000 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c +++ /dev/null @@ -1,468 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef BUILD_ECORE_EVAS_COCOA -#import -#endif - -#include "Ecore.h" -#include "ecore_private.h" -#include "Ecore_Input.h" -#include "Ecore_Input_Evas.h" - -#include "ecore_evas_private.h" -#include "Ecore_Evas.h" - -#ifdef BUILD_ECORE_EVAS_COCOA -#include "Ecore_Cocoa.h" -#include "Evas_Engine_Quartz.h" - -// FIXME: this engine has lots of problems. only 1 window at a time, drawRect looks wrong, doesn't handle resizes and more - -static int _ecore_evas_init_count = 0; -static Ecore_Evas *ecore_evases = NULL; -static Ecore_Event_Handler *ecore_evas_event_handlers[4] = { - NULL, NULL, NULL, NULL -}; -static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL; -static Ecore_Poller *ecore_evas_event = NULL; - -static const char *ecore_evas_cocoa_default = "EFL Cocoa"; - -@interface EvasView : NSView -{ - CGContextRef ctx; -} -@end - -static EvasView * evas_view; -static NSWindow * main_window; - -@implementation EvasView - -- (id) init -{ - self = [super init]; - if (self != nil) - { - ctx = NULL; - } - return self; -} - -- (void)drawRect:(NSRect)rect -{ - if(ctx != NULL) - { - Ecore_Evas *ee; - - EINA_INLIST_FOREACH(ecore_evases, ee) - { - if (ee->visible) - evas_damage_rectangle_add(ee->evas, 0, 0, 400, 400); - } - return; - } - - ctx = [[NSGraphicsContext currentContext] graphicsPort]; - CGContextRetain(ctx); -} - -- (CGContextRef)context -{ - return ctx; -} - -@end - -static Ecore_Evas * -_ecore_evas_cocoa_match(void) -{ - return ecore_evases; -} - -static Eina_Bool -_ecore_evas_cocoa_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - - ee = _ecore_evas_cocoa_match(); - - if (!ee) return EINA_TRUE; - ee->prop.focused = 1; - - return EINA_FALSE; -} - -static Eina_Bool -_ecore_evas_cocoa_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - Ecore_Evas *ee; - - ee = _ecore_evas_cocoa_match(); - - if (!ee) return EINA_TRUE; - ee->prop.focused = 0; - - return EINA_FALSE; -} - -static Eina_Bool -_ecore_evas_cocoa_event_video_resize(void *data __UNUSED__, int type __UNUSED__, void *event) -{ - /*Ecore_Cocoa_Event_Video_Resize *e; - Ecore_Evas *ee; - - e = event; - ee = _ecore_evas_cocoa_match(); - - if (!ee) return 1; // pass on event - evas_output_size_set(ee->evas, e->w, e->h); - - return 0;*/ -} - -static Eina_Bool -_ecore_evas_cocoa_event_video_expose(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) -{ - Ecore_Evas *ee; - int w; - int h; - - ee = _ecore_evas_cocoa_match(); - - if (!ee) return EINA_TRUE; - evas_output_size_get(ee->evas, &w, &h); - evas_damage_rectangle_add(ee->evas, 0, 0, w, h); - - return EINA_FALSE; -} - -static int -_ecore_evas_idle_enter(void *data __UNUSED__) -{ - Ecore_Evas *ee; - double t1 = 0.; - double t2 = 0.; - - EINA_INLIST_FOREACH(ecore_evases, ee) - { - if (ee->visible) - evas_render(ee->evas); - else - evas_norender(ee->evas); - } - - return 1; -} - -static int -_ecore_evas_cocoa_event(void *data) -{ - ecore_cocoa_feed_events(); - - return 1; -} - -static int -_ecore_evas_cocoa_init(int w, int h) -{ - _ecore_evas_init_count++; - if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; - - ecore_event_evas_init(); - - ecore_evas_idle_enterer = ecore_idle_enterer_add(_ecore_evas_idle_enter, NULL); - ecore_evas_event = ecore_poller_add(ECORE_POLLER_CORE, 1, ecore_evas_event, NULL); - ecore_poller_poll_interval_set(ECORE_POLLER_CORE, 0.006); - - 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); - - return _ecore_evas_init_count; -} - -static int -_ecore_evas_cocoa_shutdown(void) -{ - _ecore_evas_init_count--; - if (_ecore_evas_init_count == 0) - { - int i; - - while (ecore_evases) _ecore_evas_free(ecore_evases); - - 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_poller_del(ecore_evas_event); - ecore_evas_event = NULL; - - 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) -{ - ecore_evases = (Ecore_Evas *) eina_inlist_remove(EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee)); - ecore_event_window_unregister(0); - _ecore_evas_cocoa_shutdown(); - ecore_cocoa_shutdown(); -} - -static void -_ecore_evas_resize(Ecore_Evas *ee, int w, int h) -{ - if ((w == ee->w) && (h == ee->h)) return; - ee->w = w; - ee->h = 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); -} - -static void -_ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) -{ - if ((w == ee->w) && (h == ee->h)) return; - ee->w = w; - ee->h = 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); -} - -static void -_ecore_evas_object_cursor_del(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - Ecore_Evas *ee; - - ee = data; - if (ee) - ee->prop.cursor.object = NULL; -} - -static void -_ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) -{ - int x, y; - - if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); - - if (!obj) - { - 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; - - 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); - - 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); -} - -static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func = -{ - _ecore_evas_cocoa_free, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - _ecore_evas_resize, - _ecore_evas_move_resize, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - _ecore_evas_object_cursor_set, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, //transparent - - NULL // render -}; -#endif - -EAPI Ecore_Evas * -ecore_evas_cocoa_new(const char* name, int w, int h) -{ -#ifdef BUILD_ECORE_EVAS_COCOA - Evas_Engine_Info_Quartz *einfo; - Ecore_Evas *ee; - int rmethod; - - if (!name) - name = ecore_evas_cocoa_default; - - rmethod = evas_render_method_lookup("quartz"); - if (!rmethod) return NULL; - - if (!ecore_cocoa_init(name)) 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(w, h); - - ecore_event_window_register(0, 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); - - ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_cocoa_engine_func; - - ee->driver = "quartz"; - if (name) ee->name = strdup(name); - if (!ee->name) - goto free_ee; - - if (w < 1) w = 1; - if (h < 1) h = 1; - ee->visible = 1; - ee->w = w; - ee->h = h; - - ee->prop.max.w = 0; - ee->prop.max.h = 0; - ee->prop.layer = 0; - ee->prop.focused = 1; - ee->prop.borderless = 1; - ee->prop.override = 1; - ee->prop.maximized = 1; - ee->prop.withdrawn = 0; - ee->prop.sticky = 0; - - // init evas here - ee->evas = evas_new(); - if (!ee->evas) - goto free_name; - evas_data_attach_set(ee->evas, ee); - evas_output_method_set(ee->evas, rmethod); - - // Set up the Cocoa runtime - [[NSAutoreleasePool alloc] init]; - [NSApplication sharedApplication]; - - // Register ourselves as a full-fledged Cocoa app, instead of a NSUIElement. - // This gives benefits like window focus and a dock icon! - ProcessSerialNumber psn = { 0, kCurrentProcess }; - TransformProcessType (&psn, kProcessTransformToForegroundApplication); - - [NSApp finishLaunching]; - - // Create our main window, and embed an EvasView in it - main_window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,w,h) styleMask:(NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask | NSMiniaturizableWindowMask) backing:NSBackingStoreBuffered defer:NO screen:nil]; - /* FIXME: manage the case where main_window is NULL with a goto free_evas; */ - [main_window makeKeyAndOrderFront:NSApp]; - [main_window setTitle:[NSString stringWithUTF8String:name]]; - [main_window makeMainWindow]; - [main_window setAcceptsMouseMovedEvents:YES]; - [NSApp activateIgnoringOtherApps:YES]; - - evas_view = [[EvasView alloc] initWithFrame:NSMakeRect(0,0,w,h)]; - [[main_window contentView] addSubview:evas_view]; - - // drawRect: must be run at least once, to make sure we've set ctx - [evas_view display]; - - evas_output_size_set(ee->evas, w, h); - evas_output_viewport_set(ee->evas, 0, 0, w, h); - - einfo = (Evas_Engine_Info_Quartz*) evas_engine_info_get(ee->evas); - if (!einfo) - goto free_window; - - einfo->info.context = [[evas_view context] retain]; - if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) - { - ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); - } - - ecore_evases = (Ecore_Evas *) eina_inlist_prepend(EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee)); - - evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); - evas_focus_in(ee->evas); - - 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(); - - return NULL; -#else - ERR("OUTCH name='%s' size=%dx%d!", name ? name : "", w, h); - return NULL; -#endif -}