summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Aguirre <aguirre.nicolas@gmail.com>2015-08-06 23:33:24 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-10-13 15:40:00 -0700
commit44e945abbbd1c6962d9db9ccadbe8c2c9218826a (patch)
treed2b7f46d0f53cf8ec186b2a892cb0265be9f82cc
parente9c2d076965e60349e69eb7e6d842eb711d62f52 (diff)
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>
-rw-r--r--src/lib/ecore_cocoa/ecore_cocoa_app.h4
-rw-r--r--src/lib/ecore_cocoa/ecore_cocoa_app.m8
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 eac6aa85a2..bc2bbd8654 100644
--- a/src/lib/ecore_cocoa/ecore_cocoa_app.h
+++ b/src/lib/ecore_cocoa/ecore_cocoa_app.h
@@ -2,9 +2,11 @@
2#include "Ecore_Cocoa.h" 2#include "Ecore_Cocoa.h"
3#include <Ecore.h> 3#include <Ecore.h>
4 4
5#define ECORE_COCOA_MAINLOOP_PERIOD ( 0.0166)
6
5@interface Ecore_Cocoa_Application : NSApplication 7@interface Ecore_Cocoa_Application : NSApplication
6{ 8{
7 Ecore_Poller *_poller; 9 Ecore_Timer *_timer;
8 NSDate *_expiration; 10 NSDate *_expiration;
9} 11}
10 12
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_app.m b/src/lib/ecore_cocoa/ecore_cocoa_app.m
index d05070a586..00bdbfacac 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)
71 _running = 1; 71 _running = 1;
72 _expiration = [NSDate distantPast]; 72 _expiration = [NSDate distantPast];
73 73
74 _poller = ecore_poller_add(ECORE_POLLER_CORE, 74 _timer = ecore_timer_add(ECORE_COCOA_MAINLOOP_PERIOD,
75 ecore_poller_poll_interval_get(ECORE_POLLER_CORE), 75 _ecore_cocoa_run_loop_cb, NULL);
76 _ecore_cocoa_run_loop_cb, NULL);
77 if (_poller == NULL) {
78 // XXX ERROR
79 }
80} 76}
81 77
82 78