forked from enlightenment/efl
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 <cedric@osg.samsung.com>
This commit is contained in:
parent
e9c2d07696
commit
44e945abbb
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue