summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Guyomarc'h <jean@guyomarch.bzh>2017-03-08 22:09:37 +0100
committerJean Guyomarc'h <jean@guyomarch.bzh>2017-03-09 00:57:55 +0100
commit863077ce9ae50b8918259f9dc6d28d88adf21dee (patch)
tree889bfe1ed56121c82f132a0a1e23da17751cb3bf
parent88e352efe826624c35033a0880c7654b548bbe4a (diff)
ecore_evas_cocoa: use ecore_event to match windows
-rw-r--r--src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c26
1 files changed, 4 insertions, 22 deletions
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 6a61a7bf20..a34969ae0a 100644
--- a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
+++ b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
@@ -29,9 +29,6 @@
29#endif 29#endif
30 30
31static int _ecore_evas_init_count = 0; 31static int _ecore_evas_init_count = 0;
32// FIXME: In case we have a lot of windows per app, we should probably use another container
33// like a rbtree or a dictionnary-based container
34static Eina_List *ecore_evases = NULL;
35static Ecore_Event_Handler *ecore_evas_event_handlers[4]; 32static Ecore_Event_Handler *ecore_evas_event_handlers[4];
36 33
37static const char *_iface_name = "opengl_cocoa"; 34static const char *_iface_name = "opengl_cocoa";
@@ -69,23 +66,12 @@ _ecore_evas_cocoa_render(Ecore_Evas *ee)
69 return (updates) ? 1 : rend; 66 return (updates) ? 1 : rend;
70} 67}
71 68
72 69static inline Ecore_Evas *
73static Ecore_Evas *
74_ecore_evas_cocoa_match(Ecore_Cocoa_Object *cocoa_win) 70_ecore_evas_cocoa_match(Ecore_Cocoa_Object *cocoa_win)
75{ 71{
76 Eina_List *it; 72 return ecore_event_window_match((Ecore_Window)cocoa_win);
77 Ecore_Evas *ee;
78
79 DBG("");
80 EINA_LIST_FOREACH(ecore_evases, it, ee)
81 {
82 if (ecore_cocoa_window_get((Ecore_Cocoa_Window *)ee->prop.window) == cocoa_win)
83 return ee;
84 }
85 return NULL;
86} 73}
87 74
88
89static Eina_Bool 75static Eina_Bool
90_ecore_evas_cocoa_event_got_focus(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) 76_ecore_evas_cocoa_event_got_focus(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
91{ 77{
@@ -219,16 +205,12 @@ _ecore_evas_cocoa_init(void)
219static int 205static int
220_ecore_evas_cocoa_shutdown(void) 206_ecore_evas_cocoa_shutdown(void)
221{ 207{
222 Ecore_Evas *ee;
223 DBG(""); 208 DBG("");
224 _ecore_evas_init_count--; 209 _ecore_evas_init_count--;
225 if (_ecore_evas_init_count == 0) 210 if (_ecore_evas_init_count == 0)
226 { 211 {
227 unsigned int i; 212 unsigned int i;
228 213
229 EINA_LIST_FREE(ecore_evases, ee)
230 _ecore_evas_free(ee);
231
232 for (i = 0; i < EINA_C_ARRAY_LENGTH(ecore_evas_event_handlers); i++) 214 for (i = 0; i < EINA_C_ARRAY_LENGTH(ecore_evas_event_handlers); i++)
233 ecore_event_handler_del(ecore_evas_event_handlers[i]); 215 ecore_event_handler_del(ecore_evas_event_handlers[i]);
234 216
@@ -241,7 +223,8 @@ static void
241_ecore_evas_cocoa_free(Ecore_Evas *ee) 223_ecore_evas_cocoa_free(Ecore_Evas *ee)
242{ 224{
243 DBG(""); 225 DBG("");
244 ecore_evases = eina_list_remove(ecore_evases, ee); 226
227 ecore_cocoa_window_free((Ecore_Cocoa_Window *)ee->prop.window);
245 ecore_event_window_unregister(ee->prop.window); 228 ecore_event_window_unregister(ee->prop.window);
246 _ecore_evas_cocoa_shutdown(); 229 _ecore_evas_cocoa_shutdown();
247 ecore_cocoa_shutdown(); 230 ecore_cocoa_shutdown();
@@ -658,7 +641,6 @@ ecore_evas_cocoa_new_internal(Ecore_Cocoa_Window *parent EINA_UNUSED, int x, int
658 _ecore_event_window_direct_cb_set(ee->prop.window, _ecore_evas_input_direct_cb); 641 _ecore_event_window_direct_cb_set(ee->prop.window, _ecore_evas_input_direct_cb);
659 642
660 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); 643 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
661 ecore_evases = eina_list_append(ecore_evases, ee);
662 644
663 return ee; 645 return ee;
664 646