cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=44e945abbbd1c6962d9db9ccadbe8c2c9218826a
commit 44e945abbbd1c6962d9db9ccadbe8c2c9218826a Author: Nicolas Aguirre <aguirre.nico...@gmail.com> Date: Thu Aug 6 23:33:24 2015 +0200 ecore_cocoa: use a timer instead of a poller to be more responsive when dealing with cocoa Event. As all Mouse and Keyboard events comme from Cocoa, the poll period must be reduced. Backwards of this method is that when no signal are received for a long period, the timer fired anyway and consumes CPU for nothig but it seems there is no easy method to integrate NSApplication mainloop into an existing one. Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/lib/ecore_cocoa/ecore_cocoa_app.h | 4 +++- src/lib/ecore_cocoa/ecore_cocoa_app.m | 8 ++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/lib/ecore_cocoa/ecore_cocoa_app.h b/src/lib/ecore_cocoa/ecore_cocoa_app.h index eac6aa8..bc2bbd8 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa_app.h +++ b/src/lib/ecore_cocoa/ecore_cocoa_app.h @@ -2,9 +2,11 @@ #include "Ecore_Cocoa.h" #include <Ecore.h> +#define ECORE_COCOA_MAINLOOP_PERIOD ( 0.0166) + @interface Ecore_Cocoa_Application : NSApplication { - Ecore_Poller *_poller; + Ecore_Timer *_timer; NSDate *_expiration; } diff --git a/src/lib/ecore_cocoa/ecore_cocoa_app.m b/src/lib/ecore_cocoa/ecore_cocoa_app.m index d05070a..00bdbfa 100644 --- a/src/lib/ecore_cocoa/ecore_cocoa_app.m +++ b/src/lib/ecore_cocoa/ecore_cocoa_app.m @@ -71,12 +71,8 @@ _ecore_cocoa_run_loop_cb(void *data EINA_UNUSED) _running = 1; _expiration = [NSDate distantPast]; - _poller = ecore_poller_add(ECORE_POLLER_CORE, - ecore_poller_poll_interval_get(ECORE_POLLER_CORE), - _ecore_cocoa_run_loop_cb, NULL); - if (_poller == NULL) { - // XXX ERROR - } + _timer = ecore_timer_add(ECORE_COCOA_MAINLOOP_PERIOD, + _ecore_cocoa_run_loop_cb, NULL); } --