summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Aguirre <aguirre.nicolas@gmail.com>2015-08-06 19:06:34 +0200
committerNicolas Aguirre <aguirre.nicolas@gmail.com>2015-11-10 08:32:49 +0100
commit0c12f9d881a832b0074f7a6651bf830d35f41aa4 (patch)
tree2306277c3138f26b1cbacf79915e8bbd74eeb67e
parent247c860aac234b2183c8c6d12f5f87dee4e23229 (diff)
ecore_cocoa/evas_gl_cocoa: Fix indent, remove printf, and add DBG messages
-rw-r--r--src/lib/ecore_cocoa/ecore_cocoa.m26
-rw-r--r--src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c607
-rw-r--r--src/modules/evas/engines/gl_cocoa/evas_engine.c314
-rw-r--r--src/modules/evas/engines/gl_cocoa/evas_gl_cocoa_main.m45
4 files changed, 471 insertions, 521 deletions
diff --git a/src/lib/ecore_cocoa/ecore_cocoa.m b/src/lib/ecore_cocoa/ecore_cocoa.m
index 568a828e23..d4e85804b2 100644
--- a/src/lib/ecore_cocoa/ecore_cocoa.m
+++ b/src/lib/ecore_cocoa/ecore_cocoa.m
@@ -33,8 +33,6 @@ ecore_cocoa_init(void)
33 if (++_ecore_cocoa_init_count != 1) 33 if (++_ecore_cocoa_init_count != 1)
34 return _ecore_cocoa_init_count; 34 return _ecore_cocoa_init_count;
35 35
36 DBG("Ecore Cocoa Init");
37
38 if (!ecore_init()) 36 if (!ecore_init())
39 return --_ecore_cocoa_init_count; 37 return --_ecore_cocoa_init_count;
40 38
@@ -48,6 +46,8 @@ ecore_cocoa_init(void)
48 return 0; 46 return 0;
49 } 47 }
50 48
49 DBG("");
50
51 ECORE_COCOA_EVENT_GOT_FOCUS = ecore_event_type_new(); 51 ECORE_COCOA_EVENT_GOT_FOCUS = ecore_event_type_new();
52 ECORE_COCOA_EVENT_LOST_FOCUS = ecore_event_type_new(); 52 ECORE_COCOA_EVENT_LOST_FOCUS = ecore_event_type_new();
53 ECORE_COCOA_EVENT_RESIZE = ecore_event_type_new(); 53 ECORE_COCOA_EVENT_RESIZE = ecore_event_type_new();
@@ -163,20 +163,6 @@ _ecore_cocoa_event_key(NSEvent *event, int keyType)
163 return ev; 163 return ev;
164} 164}
165 165
166static inline Eina_Bool
167_nsevent_window_is_type_of(NSEvent *event, Class class)
168{
169 /* An NSPeriodic event has no window (undefined behaviour) */
170 if ([event type] == NSPeriodic) return EINA_FALSE;
171 return [[event window] isKindOfClass:class];
172}
173
174static inline Eina_Bool
175_has_ecore_cocoa_window(NSEvent *event)
176{
177 return _nsevent_window_is_type_of(event, [EcoreCocoaWindow class]);
178}
179
180EAPI Eina_Bool 166EAPI Eina_Bool
181ecore_cocoa_feed_events(void *anEvent) 167ecore_cocoa_feed_events(void *anEvent)
182{ 168{
@@ -186,7 +172,7 @@ ecore_cocoa_feed_events(void *anEvent)
186 unsigned int time = (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff); 172 unsigned int time = (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff);
187 Eina_Bool pass = EINA_FALSE; 173 Eina_Bool pass = EINA_FALSE;
188 174
189 DBG("Feed events, event type ; %d", [event type]); 175 DBG("Feed events, event type ; %lu", [event type]);
190 176
191 switch ([event type]) 177 switch ([event type])
192 { 178 {
@@ -381,14 +367,14 @@ ecore_cocoa_feed_events(void *anEvent)
381} 367}
382 368
383EAPI void 369EAPI void
384ecore_cocoa_screen_size_get(Ecore_Cocoa_Screen *screen, int *w, int *h) 370ecore_cocoa_screen_size_get(Ecore_Cocoa_Screen *screen EINA_UNUSED, int *w, int *h)
385{ 371{
386 NSSize pt = [[[NSScreen screens] objectAtIndex:0] frame].size; 372 NSSize pt = [[[NSScreen screens] objectAtIndex:0] frame].size;
387 373
388 DBG("Screen size get : %dx%d", w, h);
389
390 if (w) *w = (int)pt.width; 374 if (w) *w = (int)pt.width;
391 if (h) *h = (int)pt.height; 375 if (h) *h = (int)pt.height;
376
377 DBG("Screen size get : %dx%d", (int)pt.width, (int)pt.height);
392} 378}
393 379
394EAPI int 380EAPI int
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 5fe7a7335c..fc0241f6f2 100644
--- a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
+++ b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
@@ -41,13 +41,9 @@ static int _ecore_evas_init_count = 0;
41// FIXME: In case we have a lot of windows per app, we should probably use another container 41// FIXME: In case we have a lot of windows per app, we should probably use another container
42// like a rbtree or a dictionnary-based container 42// like a rbtree or a dictionnary-based container
43static Eina_List *ecore_evases = NULL; 43static Eina_List *ecore_evases = NULL;
44static Ecore_Event_Handler *ecore_evas_event_handlers[5] = { 44static Ecore_Event_Handler *ecore_evas_event_handlers[5] = { 0 };
45 0
46};
47static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL; 45static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL;
48 46
49//static const char *ecore_evas_cocoa_default = "EFL Cocoa";
50
51static int 47static int
52_render_updates_process(Ecore_Evas *ee, Eina_List *updates) 48_render_updates_process(Ecore_Evas *ee, Eina_List *updates)
53{ 49{
@@ -55,11 +51,11 @@ _render_updates_process(Ecore_Evas *ee, Eina_List *updates)
55 51
56 if (ee->prop.avoid_damage) 52 if (ee->prop.avoid_damage)
57 { 53 {
58 if (updates) 54 if (updates)
59 { 55 {
60 _ecore_evas_idle_timeout_update(ee); 56 _ecore_evas_idle_timeout_update(ee);
61 rend = 1; 57 rend = 1;
62 } 58 }
63 59
64 } 60 }
65 else if (((ee->visible) && (ee->draw_ok)) || 61 else if (((ee->visible) && (ee->draw_ok)) ||
@@ -70,11 +66,11 @@ _render_updates_process(Ecore_Evas *ee, Eina_List *updates)
70 { 66 {
71 if (ee->shaped) 67 if (ee->shaped)
72 { 68 {
73 //TODO 69 //TODO
74 } 70 }
75 if (ee->alpha) 71 if (ee->alpha)
76 { 72 {
77 //TODO 73 //TODO
78 } 74 }
79 _ecore_evas_idle_timeout_update(ee); 75 _ecore_evas_idle_timeout_update(ee);
80 rend = 1; 76 rend = 1;
@@ -97,7 +93,7 @@ _render_updates_process(Ecore_Evas *ee, Eina_List *updates)
97 if ((t - t0) > 1.0) 93 if ((t - t0) > 1.0)
98 { 94 {
99 td = t - t0; 95 td = t - t0;
100 printf("FPS: %3.3f\n", (double)frames / td); 96 DBG("FPS: %3.3f", (double)frames / td);
101 frames = 0; 97 frames = 0;
102 t0 = t; 98 t0 = t;
103 } 99 }
@@ -107,24 +103,9 @@ _render_updates_process(Ecore_Evas *ee, Eina_List *updates)
107} 103}
108 104
109static int 105static int
110_ecore_evas_render(Ecore_Evas *ee)
111{
112 Eina_List *updates;
113
114 updates = evas_render_updates(ee->evas);
115 if (updates)
116 {
117 evas_render_updates_free(updates);
118 _ecore_evas_idle_timeout_update(ee);
119 }
120 return updates ? 1 : 0;
121}
122
123static int
124_ecore_evas_cocoa_render(Ecore_Evas *ee) 106_ecore_evas_cocoa_render(Ecore_Evas *ee)
125{ 107{
126 int rend = 0; 108 int rend = 0;
127 Eina_List *updates = NULL;
128 Eina_List *ll; 109 Eina_List *ll;
129 Ecore_Evas *ee2; 110 Ecore_Evas *ee2;
130 static int render2 = -1; 111 static int render2 = -1;
@@ -134,7 +115,7 @@ _ecore_evas_cocoa_render(Ecore_Evas *ee)
134 115
135 if (ee->in_async_render) 116 if (ee->in_async_render)
136 { 117 {
137 //EDBG("ee=%p is rendering asynchronously, skip.", ee); 118 DBG("ee=%p is rendering asynchronously, skip.", ee);
138 return 0; 119 return 0;
139 } 120 }
140 121
@@ -177,7 +158,7 @@ _ecore_evas_cocoa_render(Ecore_Evas *ee)
177 } 158 }
178 else if (evas_render_async(ee->evas)) 159 else if (evas_render_async(ee->evas))
179 { 160 {
180 //EDBG("ee=%p started asynchronous render.", ee); 161 DBG("ee=%p started asynchronous render.", ee);
181 ee->in_async_render = EINA_TRUE; 162 ee->in_async_render = EINA_TRUE;
182 rend = 1; 163 rend = 1;
183 } 164 }
@@ -190,61 +171,67 @@ _ecore_evas_cocoa_render(Ecore_Evas *ee)
190static Ecore_Evas * 171static Ecore_Evas *
191_ecore_evas_cocoa_match(Ecore_Cocoa_Window_Id wid) 172_ecore_evas_cocoa_match(Ecore_Cocoa_Window_Id wid)
192{ 173{
193 Eina_List *it; 174 Eina_List *it;
194 Ecore_Evas *ee; 175 Ecore_Evas *ee;
195 176
196 DBG("Match"); 177 DBG("");
197 EINA_LIST_FOREACH(ecore_evases, it, ee) 178 EINA_LIST_FOREACH(ecore_evases, it, ee)
198 { 179 {
199 if (ecore_cocoa_window_get_window_id((Ecore_Cocoa_Window *)ee->prop.window) == wid) 180 if (ecore_cocoa_window_get_window_id((Ecore_Cocoa_Window *)ee->prop.window) == wid)
200 return ee; 181 return ee;
201 } 182 }
202 return NULL; 183 return NULL;
203} 184}
204 185
205 186
206static Eina_Bool 187static Eina_Bool
207_ecore_evas_cocoa_event_got_focus(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) 188_ecore_evas_cocoa_event_got_focus(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
208{ 189{
209 Ecore_Cocoa_Event_Window *e = event; 190 Ecore_Cocoa_Event_Window *e = event;
210 Ecore_Evas *ee; 191 Ecore_Evas *ee;
211 192
212 DBG("Got Focus"); 193 DBG("");
213 194
214 ee = _ecore_evas_cocoa_match(e->wid); 195 if (!e->wid)
196 return ECORE_CALLBACK_PASS_ON;
215 197
216 if (!ee) 198 ee = _ecore_evas_cocoa_match(e->wid);
217 { 199
218 printf("%s: Unregistered Ecore_Evas for window Id %p\n", __func__, e->wid); 200 if (!ee)
219 return ECORE_CALLBACK_PASS_ON; 201 {
220 } 202 ERR("Unregistered Ecore_Evas for window Id %p", e->wid);
221 ee->prop.focused = EINA_TRUE; 203 return ECORE_CALLBACK_PASS_ON;
222 evas_focus_in(ee->evas); 204 }
223 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); 205 ee->prop.focused = EINA_TRUE;
206 evas_focus_in(ee->evas);
207 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
224 208
225 return ECORE_CALLBACK_PASS_ON; 209 return ECORE_CALLBACK_PASS_ON;
226} 210}
227 211
228static Eina_Bool 212static Eina_Bool
229_ecore_evas_cocoa_event_lost_focus(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) 213_ecore_evas_cocoa_event_lost_focus(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
230{ 214{
231 Ecore_Cocoa_Event_Window *e = event; 215 Ecore_Cocoa_Event_Window *e = event;
232 Ecore_Evas *ee; 216 Ecore_Evas *ee;
233 217
234 DBG("Lost Focus"); 218 DBG("");
235 219
236 ee = _ecore_evas_cocoa_match(e->wid); 220 if (!e->wid)
221 return ECORE_CALLBACK_PASS_ON;
237 222
238 if (!ee) 223 ee = _ecore_evas_cocoa_match(e->wid);
239 { 224
240 printf("%s: Unregistered Ecore_Evas for window Id %p\n", __func__, e->wid); 225 if (!ee)
241 return ECORE_CALLBACK_PASS_ON; 226 {
242 } 227 ERR("Unregistered Ecore_Evas for window Id %p", e->wid);
243 evas_focus_out(ee->evas); 228 return ECORE_CALLBACK_PASS_ON;
244 ee->prop.focused = EINA_FALSE; 229 }
245 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); 230 evas_focus_out(ee->evas);
231 ee->prop.focused = EINA_FALSE;
232 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
246 233
247 return ECORE_CALLBACK_PASS_ON; 234 return ECORE_CALLBACK_PASS_ON;
248} 235}
249 236
250static Eina_Bool 237static Eina_Bool
@@ -253,11 +240,15 @@ _ecore_evas_cocoa_event_video_resize(void *data EINA_UNUSED, int type EINA_UNUSE
253 Ecore_Cocoa_Event_Video_Resize *e = event; 240 Ecore_Cocoa_Event_Video_Resize *e = event;
254 Ecore_Evas *ee; 241 Ecore_Evas *ee;
255 242
256 DBG("Video resize"); 243 DBG("");
244
245 if (!e->wid)
246 return ECORE_CALLBACK_PASS_ON;
247
257 ee = _ecore_evas_cocoa_match(e->wid); 248 ee = _ecore_evas_cocoa_match(e->wid);
258 if (!ee) 249 if (!ee)
259 { 250 {
260 printf("%s: Unregistered Ecore_Evas for window Id %p\n", __func__, e->wid); 251 ERR("Unregistered Ecore_Evas for window Id %p", e->wid);
261 return ECORE_CALLBACK_PASS_ON; 252 return ECORE_CALLBACK_PASS_ON;
262 } 253 }
263 254
@@ -268,7 +259,7 @@ _ecore_evas_cocoa_event_video_resize(void *data EINA_UNUSED, int type EINA_UNUSE
268 evas_output_viewport_set(ee->evas, 0, 0, e->w, e->h); 259 evas_output_viewport_set(ee->evas, 0, 0, e->w, e->h);
269 evas_damage_rectangle_add(ee->evas, 0, 0, e->w, e->h); 260 evas_damage_rectangle_add(ee->evas, 0, 0, e->w, e->h);
270 261
271 if (ee->func.fn_resize) ee->func.fn_resize(ee); 262 if (ee->func.fn_resize) ee->func.fn_resize(ee);
272 263
273 return ECORE_CALLBACK_PASS_ON; 264 return ECORE_CALLBACK_PASS_ON;
274} 265}
@@ -276,24 +267,27 @@ _ecore_evas_cocoa_event_video_resize(void *data EINA_UNUSED, int type EINA_UNUSE
276static Eina_Bool 267static Eina_Bool
277_ecore_evas_cocoa_event_video_expose(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) 268_ecore_evas_cocoa_event_video_expose(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
278{ 269{
279 Ecore_Cocoa_Event_Window *e = event; 270 Ecore_Cocoa_Event_Window *e = event;
280 Ecore_Evas *ee; 271 Ecore_Evas *ee;
281 int w; 272 int w;
282 int h; 273 int h;
283 274
284 DBG("Video Expose"); 275 DBG("");
285 276
286 ee = _ecore_evas_cocoa_match(e->wid); 277 if (!e->wid)
278 return ECORE_CALLBACK_PASS_ON;
287 279
288 if (!ee) 280 ee = _ecore_evas_cocoa_match(e->wid);
289 {
290 printf("%s: Unregistered Ecore_Evas for window Id %p\n", __func__, e->wid);
291 return ECORE_CALLBACK_PASS_ON;
292 }
293 evas_output_size_get(ee->evas, &w, &h);
294 evas_damage_rectangle_add(ee->evas, 0, 0, w, h);
295 281
296 return ECORE_CALLBACK_PASS_ON; 282 if (!ee)
283 {
284 ERR("Unregistered Ecore_Evas for window Id %p", e->wid);
285 return ECORE_CALLBACK_PASS_ON;
286 }
287 evas_output_size_get(ee->evas, &w, &h);
288 evas_damage_rectangle_add(ee->evas, 0, 0, w, h);
289
290 return ECORE_CALLBACK_PASS_ON;
297} 291}
298 292
299static Eina_Bool 293static Eina_Bool
@@ -302,12 +296,15 @@ _ecore_evas_cocoa_event_window_destroy(void *data EINA_UNUSED, int type EINA_UNU
302 Ecore_Cocoa_Event_Window *e = event; 296 Ecore_Cocoa_Event_Window *e = event;
303 Ecore_Evas *ee; 297 Ecore_Evas *ee;
304 298
305 DBG("Window destroy"); 299 DBG("");
300
301 if (!e->wid)
302 return ECORE_CALLBACK_PASS_ON;
306 303
307 ee = _ecore_evas_cocoa_match(e->wid); 304 ee = _ecore_evas_cocoa_match(e->wid);
308 if (!ee) 305 if (!ee)
309 { 306 {
310 WRN("%s: Unregistered Ecore_Evas for window Id %p\n", __func__, e->wid); 307 ERR("Unregistered Ecore_Evas for window Id %p", e->wid);
311 return ECORE_CALLBACK_PASS_ON; 308 return ECORE_CALLBACK_PASS_ON;
312 } 309 }
313 310
@@ -316,79 +313,58 @@ _ecore_evas_cocoa_event_window_destroy(void *data EINA_UNUSED, int type EINA_UNU
316 return ECORE_CALLBACK_PASS_ON; 313 return ECORE_CALLBACK_PASS_ON;
317} 314}
318 315
319
320//static int
321//_ecore_evas_idle_enter(void *data EINA_UNUSED)
322//{
323// Ecore_Evas *ee;
324// Eina_List *l;
325//
326// DBG("Idle enter");
327//
328// EINA_LIST_FOREACH(ecore_evases, l, ee)
329// {
330// if (ee->visible)
331// evas_render(ee->evas);
332// else
333// evas_norender(ee->evas);
334// }
335//
336// return EINA_TRUE;
337//}
338
339
340static int 316static int
341_ecore_evas_cocoa_init(void) 317_ecore_evas_cocoa_init(void)
342{ 318{
343 DBG("Cocoa Init"); 319 DBG("");
344 _ecore_evas_init_count++; 320 _ecore_evas_init_count++;
345 if (_ecore_evas_init_count > 1) 321 if (_ecore_evas_init_count > 1)
346 return _ecore_evas_init_count; 322 return _ecore_evas_init_count;
347 323
348 ecore_event_evas_init(); 324 ecore_event_evas_init();
349 325
350 ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_COCOA_EVENT_GOT_FOCUS, _ecore_evas_cocoa_event_got_focus, NULL); 326 ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_COCOA_EVENT_GOT_FOCUS, _ecore_evas_cocoa_event_got_focus, NULL);
351 ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_COCOA_EVENT_LOST_FOCUS, _ecore_evas_cocoa_event_lost_focus, NULL); 327 ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_COCOA_EVENT_LOST_FOCUS, _ecore_evas_cocoa_event_lost_focus, NULL);
352 ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_COCOA_EVENT_RESIZE, _ecore_evas_cocoa_event_video_resize, NULL); 328 ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_COCOA_EVENT_RESIZE, _ecore_evas_cocoa_event_video_resize, NULL);
353 ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_COCOA_EVENT_EXPOSE, _ecore_evas_cocoa_event_video_expose, NULL); 329 ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_COCOA_EVENT_EXPOSE, _ecore_evas_cocoa_event_video_expose, NULL);
354 ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_COCOA_EVENT_WINDOW_DESTROY, _ecore_evas_cocoa_event_window_destroy, NULL); 330 ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_COCOA_EVENT_WINDOW_DESTROY, _ecore_evas_cocoa_event_window_destroy, NULL);
355 331
356 return _ecore_evas_init_count; 332 return _ecore_evas_init_count;
357} 333}
358 334
359static int 335static int
360_ecore_evas_cocoa_shutdown(void) 336_ecore_evas_cocoa_shutdown(void)
361{ 337{
362 Ecore_Evas *ee; 338 Ecore_Evas *ee;
363 DBG("Cocoa Shutdown"); 339 DBG("");
364 _ecore_evas_init_count--; 340 _ecore_evas_init_count--;
365 if (_ecore_evas_init_count == 0) 341 if (_ecore_evas_init_count == 0)
366 { 342 {
367 unsigned int i; 343 unsigned int i;
368 344
369 EINA_LIST_FREE(ecore_evases, ee) 345 EINA_LIST_FREE(ecore_evases, ee)
370 _ecore_evas_free(ee); 346 _ecore_evas_free(ee);
371 347
372 for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler*); i++) 348 for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler*); i++)
373 ecore_event_handler_del(ecore_evas_event_handlers[i]); 349 ecore_event_handler_del(ecore_evas_event_handlers[i]);
374 ecore_event_evas_shutdown(); 350 ecore_event_evas_shutdown();
375 ecore_idle_enterer_del(ecore_evas_idle_enterer); 351 ecore_idle_enterer_del(ecore_evas_idle_enterer);
376 ecore_evas_idle_enterer = NULL; 352 ecore_evas_idle_enterer = NULL;
377 353
378 ecore_event_evas_shutdown(); 354 ecore_event_evas_shutdown();
379 } 355 }
380 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; 356 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
381 return _ecore_evas_init_count; 357 return _ecore_evas_init_count;
382} 358}
383 359
384static void 360static void
385_ecore_evas_cocoa_free(Ecore_Evas *ee) 361_ecore_evas_cocoa_free(Ecore_Evas *ee)
386{ 362{
387 DBG("Cocoa Free"); 363 DBG("");
388 ecore_evases = eina_list_remove(ecore_evases, ee); 364 ecore_evases = eina_list_remove(ecore_evases, ee);
389 ecore_event_window_unregister(0); 365 ecore_event_window_unregister(0);
390 _ecore_evas_cocoa_shutdown(); 366 _ecore_evas_cocoa_shutdown();
391 ecore_cocoa_shutdown(); 367 ecore_cocoa_shutdown();
392} 368}
393 369
394static void 370static void
@@ -412,61 +388,61 @@ _ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h)
412static void 388static void
413_ecore_evas_move(Ecore_Evas *ee, int x, int y) 389_ecore_evas_move(Ecore_Evas *ee, int x, int y)
414{ 390{
415 DBG("Move"); 391 DBG("");
416 ecore_cocoa_window_move((Ecore_Cocoa_Window *)ee->prop.window, x, y); 392 ecore_cocoa_window_move((Ecore_Cocoa_Window *)ee->prop.window, x, y);
417} 393}
418 394
419static void 395static void
420_ecore_evas_resize(Ecore_Evas *ee, int w, int h) 396_ecore_evas_resize(Ecore_Evas *ee, int w, int h)
421{ 397{
422 DBG("Resize"); 398 DBG("");
423 if ((w == ee->w) && (h == ee->h)) return; 399 if ((w == ee->w) && (h == ee->h)) return;
424 ee->req.w = w; 400 ee->req.w = w;
425 ee->req.h = h; 401 ee->req.h = h;
426 ee->w = w; 402 ee->w = w;
427 ee->h = h; 403 ee->h = h;
428 404
429 printf("Ecore_Evas Resize %d %d\n", w, h); 405 DBG("Ecore_Evas Resize %d %d", w, h);
430 406
431 ecore_cocoa_window_resize((Ecore_Cocoa_Window *)ee->prop.window, w, h); 407 ecore_cocoa_window_resize((Ecore_Cocoa_Window *)ee->prop.window, w, h);
432 408
433 evas_output_size_set(ee->evas, ee->w, ee->h); 409 evas_output_size_set(ee->evas, ee->w, ee->h);
434 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); 410 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
435 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); 411 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
436 412
437 if (ee->func.fn_resize) ee->func.fn_resize(ee); 413 if (ee->func.fn_resize) ee->func.fn_resize(ee);
438} 414}
439 415
440static void 416static void
441_ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h) 417_ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
442{ 418{
443 DBG("Move Resize"); 419 DBG("");
444 if ((ee->w == w) && (ee->h == h) && (x == ee->x) && (y == ee->y)) 420 if ((ee->w == w) && (ee->h == h) && (x == ee->x) && (y == ee->y))
445 return; 421 return;
446 422
447 ee->req.x = x; 423 ee->req.x = x;
448 ee->req.y = y; 424 ee->req.y = y;
449 ee->req.w = w; 425 ee->req.w = w;
450 ee->req.h = h; 426 ee->req.h = h;
451 ee->w = w; 427 ee->w = w;
452 ee->h = h; 428 ee->h = h;
453 ee->x = x; 429 ee->x = x;
454 ee->y = y; 430 ee->y = y;
455 431
456 ecore_cocoa_window_move_resize((Ecore_Cocoa_Window *)ee->prop.window, x, y, w, h); 432 ecore_cocoa_window_move_resize((Ecore_Cocoa_Window *)ee->prop.window, x, y, w, h);
457 433
458 evas_output_size_set(ee->evas, ee->w, ee->h); 434 evas_output_size_set(ee->evas, ee->w, ee->h);
459 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); 435 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
460 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); 436 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
461 437
462 if (ee->func.fn_resize) ee->func.fn_resize(ee); 438 if (ee->func.fn_resize) ee->func.fn_resize(ee);
463} 439}
464 440
465 441
466static void 442static void
467_ecore_evas_show(Ecore_Evas *ee) 443_ecore_evas_show(Ecore_Evas *ee)
468{ 444{
469 DBG("Show"); 445 DBG("");
470 ee->should_be_visible = 1; 446 ee->should_be_visible = 1;
471 if (ee->prop.avoid_damage) 447 if (ee->prop.avoid_damage)
472 _ecore_evas_cocoa_render(ee); 448 _ecore_evas_cocoa_render(ee);
@@ -479,7 +455,7 @@ _ecore_evas_show(Ecore_Evas *ee)
479static void 455static void
480_ecore_evas_hide(Ecore_Evas *ee) 456_ecore_evas_hide(Ecore_Evas *ee)
481{ 457{
482 DBG("Hide"); 458 DBG("");
483 459
484 ecore_cocoa_window_hide((Ecore_Cocoa_Window *)ee->prop.window); 460 ecore_cocoa_window_hide((Ecore_Cocoa_Window *)ee->prop.window);
485 ee->should_be_visible = 0; 461 ee->should_be_visible = 0;
@@ -488,15 +464,15 @@ _ecore_evas_hide(Ecore_Evas *ee)
488static void 464static void
489_ecore_evas_raise(Ecore_Evas *ee) 465_ecore_evas_raise(Ecore_Evas *ee)
490{ 466{
491 DBG("Raise"); 467 DBG("");
492 468
493 ecore_cocoa_window_raise((Ecore_Cocoa_Window *)ee->prop.window); 469 ecore_cocoa_window_raise((Ecore_Cocoa_Window *)ee->prop.window);
494} 470}
495 471
496static void 472static void
497_ecore_evas_lower(Ecore_Evas *ee) 473_ecore_evas_lower(Ecore_Evas *ee)
498{ 474{
499 DBG("Lower"); 475 DBG("");
500 476
501 ecore_cocoa_window_lower((Ecore_Cocoa_Window *)ee->prop.window); 477 ecore_cocoa_window_lower((Ecore_Cocoa_Window *)ee->prop.window);
502} 478}
@@ -504,7 +480,7 @@ _ecore_evas_lower(Ecore_Evas *ee)
504static void 480static void
505_ecore_evas_activate(Ecore_Evas *ee) 481_ecore_evas_activate(Ecore_Evas *ee)
506{ 482{
507 DBG("Activate"); 483 DBG("");
508 484
509 ecore_cocoa_window_activate((Ecore_Cocoa_Window *)ee->prop.window); 485 ecore_cocoa_window_activate((Ecore_Cocoa_Window *)ee->prop.window);
510} 486}
@@ -512,7 +488,7 @@ _ecore_evas_activate(Ecore_Evas *ee)
512static void 488static void
513_ecore_evas_iconified_set(Ecore_Evas *ee, Eina_Bool on) 489_ecore_evas_iconified_set(Ecore_Evas *ee, Eina_Bool on)
514{ 490{
515 DBG("IconifiedSet"); 491 DBG("");
516 492
517 ecore_cocoa_window_iconified_set((Ecore_Cocoa_Window *)ee->prop.window, on); 493 ecore_cocoa_window_iconified_set((Ecore_Cocoa_Window *)ee->prop.window, on);
518} 494}
@@ -533,13 +509,13 @@ _ecore_evas_title_set(Ecore_Evas *ee, const char *title)
533static void 509static void
534_ecore_evas_object_cursor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 510_ecore_evas_object_cursor_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
535{ 511{
536 Ecore_Evas *ee; 512 Ecore_Evas *ee;
537 513
538 DBG("Cursor DEL"); 514 DBG("");
539 515
540 ee = data; 516 ee = data;
541 if (ee) 517 if (ee)
542 ee->prop.cursor.object = NULL; 518 ee->prop.cursor.object = NULL;
543} 519}
544 520
545static void 521static void
@@ -551,45 +527,45 @@ _ecore_evas_object_cursor_unset(Ecore_Evas *ee)
551static void 527static void
552_ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) 528_ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y)
553{ 529{
554 int x, y; 530 int x, y;
555 DBG("Cursor Set"); 531 DBG("");
556 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); 532 if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object);
557 533
558 if (obj == NULL) 534 if (obj == NULL)
559 { 535 {
560 ee->prop.cursor.object = NULL; 536 ee->prop.cursor.object = NULL;
561 ee->prop.cursor.layer = 0; 537 ee->prop.cursor.layer = 0;
562 ee->prop.cursor.hot.x = 0; 538 ee->prop.cursor.hot.x = 0;
563 ee->prop.cursor.hot.y = 0; 539 ee->prop.cursor.hot.y = 0;
564 return; 540 return;
565 } 541 }
566 542
567 ee->prop.cursor.object = obj; 543 ee->prop.cursor.object = obj;
568 ee->prop.cursor.layer = layer; 544 ee->prop.cursor.layer = layer;
569 ee->prop.cursor.hot.x = hot_x; 545 ee->prop.cursor.hot.x = hot_x;
570 ee->prop.cursor.hot.y = hot_y; 546 ee->prop.cursor.hot.y = hot_y;
571 547
572 evas_pointer_output_xy_get(ee->evas, &x, &y); 548 evas_pointer_output_xy_get(ee->evas, &x, &y);
573 evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); 549 evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer);
574 evas_object_move(ee->prop.cursor.object, 550 evas_object_move(ee->prop.cursor.object,
575 x - ee->prop.cursor.hot.x, 551 x - ee->prop.cursor.hot.x,
576 y - ee->prop.cursor.hot.y); 552 y - ee->prop.cursor.hot.y);
577 553
578 evas_object_pass_events_set(ee->prop.cursor.object, 1); 554 evas_object_pass_events_set(ee->prop.cursor.object, 1);
579 555
580 if (evas_pointer_inside_get(ee->evas)) 556 if (evas_pointer_inside_get(ee->evas))
581 evas_object_show(ee->prop.cursor.object); 557 evas_object_show(ee->prop.cursor.object);
582 558
583 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); 559 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee);
584} 560}
585 561
586static void 562static void
587_ecore_evas_withdrawn_set(Ecore_Evas *ee, Eina_Bool on) 563_ecore_evas_withdrawn_set(Ecore_Evas *ee, Eina_Bool on)
588{ 564{
589 if (on) 565 if (on)
590 _ecore_evas_hide(ee); 566 _ecore_evas_hide(ee);
591 else 567 else
592 _ecore_evas_show(ee); 568 _ecore_evas_show(ee);
593} 569}
594 570
595static int 571static int
@@ -599,7 +575,7 @@ _ecore_evas_engine_cocoa_init(Ecore_Evas *ee)
599 const char *driver; 575 const char *driver;
600 int rmethod; 576 int rmethod;
601 577
602 DBG("Cocoa Init"); 578 DBG("");
603 579
604 driver = "gl_cocoa"; 580 driver = "gl_cocoa";
605 581
@@ -613,10 +589,7 @@ _ecore_evas_engine_cocoa_init(Ecore_Evas *ee)
613 einfo = (Evas_Engine_Info_GL_Cocoa *)evas_engine_info_get(ee->evas); 589 einfo = (Evas_Engine_Info_GL_Cocoa *)evas_engine_info_get(ee->evas);
614 if (einfo) 590 if (einfo)
615 { 591 {
616 /* FIXME: REDRAW_DEBUG missing for now */
617 einfo->window = (void *)ee->prop.window; 592 einfo->window = (void *)ee->prop.window;
618 //einfo->info.depth = ecore_win32_screen_depth_get();
619 //einfo->info.rotation = 0;
620 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) 593 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
621 { 594 {
622 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); 595 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
@@ -639,7 +612,7 @@ _ecore_evas_screen_geometry_get(const Ecore_Evas *ee EINA_UNUSED, int *x, int *y
639 if (x) *x = 0; 612 if (x) *x = 0;
640 if (y) *y = 0; 613 if (y) *y = 0;
641 ecore_cocoa_screen_size_get(NULL, w, h); 614 ecore_cocoa_screen_size_get(NULL, w, h);
642 printf("screen geometry_get %dx%d\n", *w, *h); 615 DBG("screen geometry_get %dx%d", *w, *h);
643} 616}
644 617
645 618
@@ -701,120 +674,112 @@ static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func =
701 NULL, // profiles_set 674 NULL, // profiles_set
702 NULL, // profile_set 675 NULL, // profile_set
703 676
704 NULL, 677 NULL,
705 NULL, 678 NULL,
706 NULL, 679 NULL,
707 NULL, 680 NULL,
708 NULL, 681 NULL,
709 NULL, 682 NULL,
710 683
711 NULL, // render 684 NULL, // render
712 _ecore_evas_screen_geometry_get, 685 _ecore_evas_screen_geometry_get,
713 NULL, // screen_dpi_get 686 NULL, // screen_dpi_get
714 NULL, 687 NULL,
715 NULL // msg_send 688 NULL // msg_send
716 }; 689 };
717 690
718EAPI Ecore_Evas * 691EAPI Ecore_Evas *
719ecore_evas_cocoa_new_internal(Ecore_Cocoa_Window *parent EINA_UNUSED, int x, int y, int w, int h) 692ecore_evas_cocoa_new_internal(Ecore_Cocoa_Window *parent EINA_UNUSED, int x, int y, int w, int h)
720{ 693{
721// Evas_Engine_Info_GL_Cocoa *einfo; 694 Ecore_Evas *ee;
722 Ecore_Evas *ee; 695
723 696 if (!ecore_cocoa_init())
724 DBG("Cocoa new"); 697 return NULL;
725 698
726 if (!ecore_cocoa_init()) 699 DBG("");
727 return NULL; 700
728 701 ee = calloc(1, sizeof(Ecore_Evas));
729 ee = calloc(1, sizeof(Ecore_Evas)); 702 if (!ee)
730 if (!ee) 703 goto shutdown_ecore_cocoa;
731 goto shutdown_ecore_cocoa; 704
732 705 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
733 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); 706
734 707 _ecore_evas_cocoa_init();
735 _ecore_evas_cocoa_init(); 708
736 709 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_cocoa_engine_func;
737 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_cocoa_engine_func; 710
738 711 if (w < 1) w = 1;
739 if (w < 1) w = 1; 712 if (h < 1) h = 1;
740 if (h < 1) h = 1; 713 ee->visible = 1;
741 ee->visible = 1; 714 ee->x = x;
742 ee->x = x; 715 ee->y = y;
743 ee->y = y; 716 ee->w = w;
744 ee->w = w; 717 ee->h = h;
745 ee->h = h; 718 ee->req.x = ee->x;
746 ee->req.x = ee->x; 719 ee->req.y = ee->y;
747 ee->req.y = ee->y; 720 ee->req.w = ee->w - ee->y;
748 ee->req.w = ee->w - ee->y; 721 ee->req.h = ee->h;
749 ee->req.h = ee->h; 722
750 723 ee->semi_sync = 1;
751 ee->semi_sync = 1; 724
752 725 ee->prop.max.w = 32767;
753 726 ee->prop.max.h = 32767;
754 ee->prop.max.w = 32767; 727 ee->prop.layer = 4;
755 ee->prop.max.h = 32767; 728 ee->prop.request_pos = EINA_FALSE;
756 ee->prop.layer = 4; 729 ee->prop.sticky = EINA_FALSE;
757 ee->prop.request_pos = EINA_FALSE; 730 ee->prop.window = 0;
758 ee->prop.sticky = EINA_FALSE; 731 ee->prop.withdrawn = EINA_TRUE;
759 ee->prop.window = 0; 732
760 ee->prop.withdrawn = EINA_TRUE; 733 ee->evas = evas_new();
761 734
762 printf("Create New Evas\n"); 735 if (!ee->evas)
763 736 goto free_name;
764 ee->evas = evas_new(); 737
765 738 evas_data_attach_set(ee->evas, ee);
766 if (!ee->evas) 739 evas_output_size_set(ee->evas, w, h);
767 goto free_name; 740 evas_output_viewport_set(ee->evas, 0, 0, w, h);
768 741
769 evas_data_attach_set(ee->evas, ee); 742 ee->prop.window = (Ecore_Window)ecore_cocoa_window_new(x, y, w, h);
770 evas_output_size_set(ee->evas, w, h); 743
771 evas_output_viewport_set(ee->evas, 0, 0, w, h); 744 if (!ee->prop.window)
772 745 {
773 printf("Create New Cocoa Window\n"); 746 _ecore_evas_cocoa_shutdown();
774 ee->prop.window = (Ecore_Window)ecore_cocoa_window_new(x, y, w, h); 747 free(ee);
775 printf("Window Created %p\n", (Ecore_Cocoa_Window *)ee->prop.window); 748 return NULL;
776 if (!ee->prop.window) 749 }
777 { 750
778 _ecore_evas_cocoa_shutdown(); 751 if (!_ecore_evas_engine_cocoa_init(ee))
779 free(ee); 752 {
780 return NULL; 753 _ecore_evas_cocoa_shutdown();
781 } 754 free(ee);
782 755 return NULL;
783 printf("Init Evas engine cocoa\n"); 756 }
784 if (!_ecore_evas_engine_cocoa_init(ee)) 757
785 { 758
786 _ecore_evas_cocoa_shutdown(); 759 ee->engine.func->fn_render = _ecore_evas_cocoa_render;
787 free(ee); 760 _ecore_evas_register(ee);
788 return NULL; 761 ecore_event_window_register(ee->prop.window, ee, ee->evas,
789 } 762 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
790 763 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
791 764 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
792 ee->engine.func->fn_render = _ecore_evas_cocoa_render; 765 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
793 _ecore_evas_register(ee); 766
794 ecore_event_window_register(ee->prop.window, ee, ee->evas, 767 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
795 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, 768 ecore_evases = eina_list_append(ecore_evases, ee);
796 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, 769
797 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, 770 return ee;
798 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); 771
799 772 //free_window:
800 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); 773 /* FIXME: free window here */
801 printf("Ecore Evas returned : %p\n", ee); 774 //free_evas:
802 775 // free(ee->evas);
803 ecore_evases = eina_list_append(ecore_evases, ee); 776 free_name:
804 777 free(ee->name);
805 return ee; 778 //free_ee:
806 779 _ecore_evas_cocoa_shutdown();
807 //free_window: 780 free(ee);
808 /* FIXME: free window here */
809 //free_evas:
810 // free(ee->evas);
811free_name:
812 free(ee->name);
813 //free_ee:
814 _ecore_evas_cocoa_shutdown();
815 free(ee);
816 shutdown_ecore_cocoa: 781 shutdown_ecore_cocoa:
817 ecore_cocoa_shutdown(); 782 ecore_cocoa_shutdown();
818 783
819 return NULL; 784 return NULL;
820} 785}
diff --git a/src/modules/evas/engines/gl_cocoa/evas_engine.c b/src/modules/evas/engines/gl_cocoa/evas_engine.c
index 00e670ac22..8597b05809 100644
--- a/src/modules/evas/engines/gl_cocoa/evas_engine.c
+++ b/src/modules/evas/engines/gl_cocoa/evas_engine.c
@@ -45,7 +45,7 @@ struct _Render_Engine_GL_Surface
45struct _Render_Engine_GL_Context 45struct _Render_Engine_GL_Context
46{ 46{
47 int initialized; 47 int initialized;
48 // EGLContext context; 48 // EGLContext context;
49 49
50 GLuint fbo; 50 GLuint fbo;
51 51
@@ -104,8 +104,8 @@ eng_setup(Evas *eo_e, void *in)
104 104
105 e->engine.data.output = re; 105 e->engine.data.output = re;
106 re->win = eng_window_new(info->window, 106 re->win = eng_window_new(info->window,
107 e->output.w, 107 e->output.w,
108 e->output.h); 108 e->output.h);
109 info->view = re->win->view; 109 info->view = re->win->view;
110 if (!re->win) 110 if (!re->win)
111 { 111 {
@@ -121,8 +121,8 @@ eng_setup(Evas *eo_e, void *in)
121 re = e->engine.data.output; 121 re = e->engine.data.output;
122 eng_window_free(re->win); 122 eng_window_free(re->win);
123 re->win = eng_window_new(info->window, 123 re->win = eng_window_new(info->window,
124 e->output.w, 124 e->output.w,
125 e->output.h); 125 e->output.h);
126 info->view = re->win->view; 126 info->view = re->win->view;
127 } 127 }
128 if (!e->engine.data.output) return 0; 128 if (!e->engine.data.output) return 0;
@@ -166,7 +166,7 @@ eng_output_resize(void *data, int w, int h)
166static void 166static void
167eng_output_tile_size_set(void *data EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED) 167eng_output_tile_size_set(void *data EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED)
168{ 168{
169 DBG("tile size set"); 169 DBG("tile size set");
170} 170}
171 171
172static void 172static void
@@ -235,10 +235,10 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i
235 /* get the upate rect surface - return engine data as dummy */ 235 /* get the upate rect surface - return engine data as dummy */
236 if (!re->win->draw.redraw) 236 if (!re->win->draw.redraw)
237 { 237 {
238// printf("GL: NO updates!\n"); 238 // printf("GL: NO updates!\n");
239 return NULL; 239 return NULL;
240 } 240 }
241// printf("GL: update....!\n"); 241 // printf("GL: update....!\n");
242#ifdef SLOW_GL_COPY_RECT 242#ifdef SLOW_GL_COPY_RECT
243 /* if any update - just return the whole canvas - works with swap 243 /* if any update - just return the whole canvas - works with swap
244 * buffers then */ 244 * buffers then */
@@ -266,10 +266,10 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i
266 if (cw) *cw = re->win->draw.x2 - re->win->draw.x1 + 1; 266 if (cw) *cw = re->win->draw.x2 - re->win->draw.x1 + 1;
267 if (ch) *ch = re->win->draw.y2 - re->win->draw.y1 + 1; 267 if (ch) *ch = re->win->draw.y2 - re->win->draw.y1 + 1;
268#endif 268#endif
269// clear buffer. only needed for dest alpha 269 // clear buffer. only needed for dest alpha
270// glClearColor(0.0f, 0.0f, 0.0f, 0.0f); 270 // glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
271// glClear(GL_COLOR_BUFFER_BIT); 271 // glClear(GL_COLOR_BUFFER_BIT);
272//x// printf("frame -> new\n"); 272 //x// printf("frame -> new\n");
273 return re->win->gl_context->def_surface; 273 return re->win->gl_context->def_surface;
274} 274}
275 275
@@ -382,10 +382,10 @@ eng_polygon_draw(void *data, void *context, void *surface EINA_UNUSED, void *pol
382static int 382static int
383eng_image_alpha_get(void *data EINA_UNUSED, void *image) 383eng_image_alpha_get(void *data EINA_UNUSED, void *image)
384{ 384{
385// Render_Engine *re; 385 // Render_Engine *re;
386 Evas_GL_Image *im; 386 Evas_GL_Image *im;
387 387
388// re = (Render_Engine *)data; 388 // re = (Render_Engine *)data;
389 if (!image) return 1; 389 if (!image) return 1;
390 im = image; 390 im = image;
391 return im->alpha; 391 return im->alpha;
@@ -394,10 +394,10 @@ eng_image_alpha_get(void *data EINA_UNUSED, void *image)
394static Evas_Colorspace 394static Evas_Colorspace
395eng_image_colorspace_get(void *data EINA_UNUSED, void *image) 395eng_image_colorspace_get(void *data EINA_UNUSED, void *image)
396{ 396{
397// Render_Engine *re; 397 // Render_Engine *re;
398 Evas_GL_Image *im; 398 Evas_GL_Image *im;
399 399
400// re = (Render_Engine *)data; 400 // re = (Render_Engine *)data;
401 if (!image) return EVAS_COLORSPACE_ARGB8888; 401 if (!image) return EVAS_COLORSPACE_ARGB8888;
402 im = image; 402 im = image;
403 return im->cs.space; 403 return im->cs.space;
@@ -437,10 +437,10 @@ eng_image_alpha_set(void *data, void *image, int has_alpha)
437 evas_cache_image_load_data(&im->im->cache_entry); 437 evas_cache_image_load_data(&im->im->cache_entry);
438 evas_gl_common_image_alloc_ensure(im); 438 evas_gl_common_image_alloc_ensure(im);
439 im_new = evas_gl_common_image_new_from_copied_data 439 im_new = evas_gl_common_image_new_from_copied_data
440 (im->gc, im->im->cache_entry.w, im->im->cache_entry.h, 440 (im->gc, im->im->cache_entry.w, im->im->cache_entry.h,
441 im->im->image.data, 441 im->im->image.data,
442 eng_image_alpha_get(data, image), 442 eng_image_alpha_get(data, image),
443 eng_image_colorspace_get(data, image)); 443 eng_image_colorspace_get(data, image));
444 if (!im_new) return im; 444 if (!im_new) return im;
445 evas_gl_common_image_free(im); 445 evas_gl_common_image_free(im);
446 im = im_new; 446 im = im_new;
@@ -448,34 +448,34 @@ eng_image_alpha_set(void *data, void *image, int has_alpha)
448 else 448 else
449 evas_gl_common_image_dirty(im, 0, 0, 0, 0); 449 evas_gl_common_image_dirty(im, 0, 0, 0, 0);
450 return evas_gl_common_image_alpha_set(im, has_alpha ? 1 : 0); 450 return evas_gl_common_image_alpha_set(im, has_alpha ? 1 : 0);
451// im->im->cache_entry.flags.alpha = has_alpha ? 1 : 0; 451 // im->im->cache_entry.flags.alpha = has_alpha ? 1 : 0;
452// return image; 452 // return image;
453} 453}
454 454
455static void * 455static void *
456eng_image_border_set(void *data EINA_UNUSED, void *image, int l EINA_UNUSED, int r EINA_UNUSED, int t EINA_UNUSED, int b EINA_UNUSED) 456eng_image_border_set(void *data EINA_UNUSED, void *image, int l EINA_UNUSED, int r EINA_UNUSED, int t EINA_UNUSED, int b EINA_UNUSED)
457{ 457{
458// Render_Engine *re; 458 // Render_Engine *re;
459// 459 //
460// re = (Render_Engine *)data; 460 // re = (Render_Engine *)data;
461 return image; 461 return image;
462} 462}
463 463
464static void 464static void
465eng_image_border_get(void *data EINA_UNUSED, void *image EINA_UNUSED, int *l EINA_UNUSED, int *r EINA_UNUSED, int *t EINA_UNUSED, int *b EINA_UNUSED) 465eng_image_border_get(void *data EINA_UNUSED, void *image EINA_UNUSED, int *l EINA_UNUSED, int *r EINA_UNUSED, int *t EINA_UNUSED, int *b EINA_UNUSED)
466{ 466{
467// Render_Engine *re; 467 // Render_Engine *re;
468// 468 //
469// re = (Render_Engine *)data; 469 // re = (Render_Engine *)data;
470} 470}
471 471
472static char * 472static char *
473eng_image_comment_get(void *data EINA_UNUSED, void *image, char *key EINA_UNUSED) 473eng_image_comment_get(void *data EINA_UNUSED, void *image, char *key EINA_UNUSED)
474{ 474{
475// Render_Engine *re; 475 // Render_Engine *re;
476 Evas_GL_Image *im; 476 Evas_GL_Image *im;
477 477
478// re = (Render_Engine *)data; 478 // re = (Render_Engine *)data;
479 if (!image) return NULL; 479 if (!image) return NULL;
480 im = image; 480 im = image;
481 if (!im->im) return NULL; 481 if (!im->im) return NULL;
@@ -485,10 +485,10 @@ eng_image_comment_get(void *data EINA_UNUSED, void *image, char *key EINA_UNUSED
485static char * 485static char *
486eng_image_format_get(void *data EINA_UNUSED, void *image) 486eng_image_format_get(void *data EINA_UNUSED, void *image)
487{ 487{
488// Render_Engine *re; 488 // Render_Engine *re;
489 Evas_GL_Image *im; 489 Evas_GL_Image *im;
490 490
491// re = (Render_Engine *)data; 491 // re = (Render_Engine *)data;
492 im = image; 492 im = image;
493 return NULL; 493 return NULL;
494} 494}
@@ -511,34 +511,34 @@ eng_image_colorspace_set(void *data, void *image, Evas_Colorspace cspace)
511 switch (cspace) 511 switch (cspace)
512 { 512 {
513 case EVAS_COLORSPACE_ARGB8888: 513 case EVAS_COLORSPACE_ARGB8888:
514 if (im->cs.data) 514 if (im->cs.data)
515 { 515 {
516 if (!im->cs.no_free) free(im->cs.data); 516 if (!im->cs.no_free) free(im->cs.data);
517 im->cs.data = NULL; 517 im->cs.data = NULL;
518 im->cs.no_free = 0; 518 im->cs.no_free = 0;
519 } 519 }
520 break; 520 break;
521 case EVAS_COLORSPACE_YCBCR422P601_PL: 521 case EVAS_COLORSPACE_YCBCR422P601_PL:
522 case EVAS_COLORSPACE_YCBCR422P709_PL: 522 case EVAS_COLORSPACE_YCBCR422P709_PL:
523 case EVAS_COLORSPACE_YCBCR422601_PL: 523 case EVAS_COLORSPACE_YCBCR422601_PL:
524 case EVAS_COLORSPACE_YCBCR420NV12601_PL: 524 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
525 case EVAS_COLORSPACE_YCBCR420TM12601_PL: 525 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
526 if (im->tex) evas_gl_common_texture_free(im->tex, EINA_TRUE); 526 if (im->tex) evas_gl_common_texture_free(im->tex, EINA_TRUE);
527 im->tex = NULL; 527 im->tex = NULL;
528 if (im->cs.data) 528 if (im->cs.data)
529 { 529 {
530 if (!im->cs.no_free) free(im->cs.data); 530 if (!im->cs.no_free) free(im->cs.data);
531 } 531 }
532 if (im->im->cache_entry.h > 0) 532 if (im->im->cache_entry.h > 0)
533 im->cs.data = 533 im->cs.data =
534 calloc(1, im->im->cache_entry.h * sizeof(unsigned char *) * 2); 534 calloc(1, im->im->cache_entry.h * sizeof(unsigned char *) * 2);
535 else 535 else
536 im->cs.data = NULL; 536 im->cs.data = NULL;
537 im->cs.no_free = 0; 537 im->cs.no_free = 0;
538 break; 538 break;
539 default: 539 default:
540 abort(); 540 abort();
541 break; 541 break;
542 } 542 }
543 im->cs.space = cspace; 543 im->cs.space = cspace;
544} 544}
@@ -660,9 +660,9 @@ eng_image_size_set(void *data, void *image, int w, int h)
660 case EVAS_COLORSPACE_YCBCR422601_PL: 660 case EVAS_COLORSPACE_YCBCR422601_PL:
661 case EVAS_COLORSPACE_YCBCR420NV12601_PL: 661 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
662 case EVAS_COLORSPACE_YCBCR420TM12601_PL: 662 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
663 w &= ~0x1; 663 w &= ~0x1;
664 default: 664 default:
665 break; 665 break;
666 } 666 }
667 667
668 evas_gl_common_image_alloc_ensure(im_old); 668 evas_gl_common_image_alloc_ensure(im_old);
@@ -726,41 +726,41 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, i
726 switch (im->cs.space) 726 switch (im->cs.space)
727 { 727 {
728 case EVAS_COLORSPACE_ARGB8888: 728 case EVAS_COLORSPACE_ARGB8888:
729 if (to_write) 729 if (to_write)
730 { 730 {
731 if (im->references > 1) 731 if (im->references > 1)
732 { 732 {
733 Evas_GL_Image *im_new; 733 Evas_GL_Image *im_new;
734 734
735 im_new = evas_gl_common_image_new_from_copied_data 735 im_new = evas_gl_common_image_new_from_copied_data
736 (im->gc, im->im->cache_entry.w, im->im->cache_entry.h, 736 (im->gc, im->im->cache_entry.w, im->im->cache_entry.h,
737 im->im->image.data, 737 im->im->image.data,
738 eng_image_alpha_get(data, image), 738 eng_image_alpha_get(data, image),
739 eng_image_colorspace_get(data, image)); 739 eng_image_colorspace_get(data, image));
740 if (!im_new) 740 if (!im_new)
741 { 741 {
742 *image_data = NULL; 742 *image_data = NULL;
743 if (err) *err = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED; 743 if (err) *err = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
744 return im; 744 return im;
745 } 745 }
746 evas_gl_common_image_free(im); 746 evas_gl_common_image_free(im);
747 im = im_new; 747 im = im_new;
748 } 748 }
749 else 749 else
750 evas_gl_common_image_dirty(im, 0, 0, 0, 0); 750 evas_gl_common_image_dirty(im, 0, 0, 0, 0);
751 } 751 }
752 *image_data = im->im->image.data; 752 *image_data = im->im->image.data;
753 break; 753 break;
754 case EVAS_COLORSPACE_YCBCR422P601_PL: 754 case EVAS_COLORSPACE_YCBCR422P601_PL:
755 case EVAS_COLORSPACE_YCBCR422P709_PL: 755 case EVAS_COLORSPACE_YCBCR422P709_PL:
756 case EVAS_COLORSPACE_YCBCR422601_PL: 756 case EVAS_COLORSPACE_YCBCR422601_PL:
757 case EVAS_COLORSPACE_YCBCR420NV12601_PL: 757 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
758 case EVAS_COLORSPACE_YCBCR420TM12601_PL: 758 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
759 *image_data = im->cs.data; 759 *image_data = im->cs.data;
760 break; 760 break;
761 default: 761 default:
762 abort(); 762 abort();
763 break; 763 break;
764 } 764 }
765 if (err) *err = error; 765 if (err) *err = error;
766 return im; 766 return im;
@@ -803,34 +803,34 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data)
803 switch (im->cs.space) 803 switch (im->cs.space)
804 { 804 {
805 case EVAS_COLORSPACE_ARGB8888: 805 case EVAS_COLORSPACE_ARGB8888:
806 if (image_data != im->im->image.data) 806 if (image_data != im->im->image.data)
807 { 807 {
808 int w, h; 808 int w, h;
809 809
810 w = im->im->cache_entry.w; 810 w = im->im->cache_entry.w;
811 h = im->im->cache_entry.h; 811 h = im->im->cache_entry.h;
812 im2 = eng_image_new_from_data(data, w, h, image_data, 812 im2 = eng_image_new_from_data(data, w, h, image_data,
813 eng_image_alpha_get(data, image), 813 eng_image_alpha_get(data, image),
814 eng_image_colorspace_get(data, image)); 814 eng_image_colorspace_get(data, image));
815 if (!im2) return im; 815 if (!im2) return im;
816 evas_gl_common_image_free(im); 816 evas_gl_common_image_free(im);
817 im = im2; 817 im = im2;
818 } 818 }
819 break; 819 break;
820 case EVAS_COLORSPACE_YCBCR422P601_PL: 820 case EVAS_COLORSPACE_YCBCR422P601_PL:
821 case EVAS_COLORSPACE_YCBCR422P709_PL: 821 case EVAS_COLORSPACE_YCBCR422P709_PL:
822 if (image_data != im->cs.data) 822 if (image_data != im->cs.data)
823 { 823 {
824 if (im->cs.data) 824 if (im->cs.data)
825 { 825 {
826 if (!im->cs.no_free) free(im->cs.data); 826 if (!im->cs.no_free) free(im->cs.data);
827 } 827 }
828 im->cs.data = image_data; 828 im->cs.data = image_data;
829 } 829 }
830 break; 830 break;
831 default: 831 default:
832 abort(); 832 abort();
833 break; 833 break;
834 } 834 }
835 /* hmmm - but if we wrote... why bother? */ 835 /* hmmm - but if we wrote... why bother? */
836 evas_gl_common_image_dirty(im, 0, 0, 0, 0); 836 evas_gl_common_image_dirty(im, 0, 0, 0, 0);
@@ -1030,31 +1030,31 @@ eng_font_draw(void *data, void *context, void *surface, Evas_Font_Set *font EINA
1030 1030
1031 evas_gl_common_context_target_surface_set(re->win->gl_context, surface); 1031 evas_gl_common_context_target_surface_set(re->win->gl_context, surface);
1032 re->win->gl_context->dc = context; 1032 re->win->gl_context->dc = context;
1033 { 1033 {
1034 if (!re->win->gl_context->font_surface) 1034 if (!re->win->gl_context->font_surface)
1035 re->win->gl_context->font_surface = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get()); 1035 re->win->gl_context->font_surface = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
1036 re->win->gl_context->font_surface->cache_entry.w = re->win->gl_context->shared->w; 1036 re->win->gl_context->font_surface->cache_entry.w = re->win->gl_context->shared->w;
1037 re->win->gl_context->font_surface->cache_entry.h = re->win->gl_context->shared->h; 1037 re->win->gl_context->font_surface->cache_entry.h = re->win->gl_context->shared->h;
1038 1038
1039 evas_common_draw_context_font_ext_set(context, 1039 evas_common_draw_context_font_ext_set(context,
1040 re->win->gl_context, 1040 re->win->gl_context,
1041 evas_gl_font_texture_new, 1041 evas_gl_font_texture_new,
1042 evas_gl_font_texture_free, 1042 evas_gl_font_texture_free,
1043 evas_gl_font_texture_draw, 1043 evas_gl_font_texture_draw,
1044 NULL, 1044 NULL,
1045 NULL, 1045 NULL,
1046 NULL); 1046 NULL);
1047 evas_common_font_draw_prepare(intl_props); 1047 evas_common_font_draw_prepare(intl_props);
1048 evas_common_font_draw(re->win->gl_context->font_surface, context, x, y, intl_props->glyphs); 1048 evas_common_font_draw(re->win->gl_context->font_surface, context, x, y, intl_props->glyphs);
1049 evas_common_draw_context_font_ext_set(context, 1049 evas_common_draw_context_font_ext_set(context,
1050 NULL, 1050 NULL,
1051 NULL, 1051 NULL,
1052 NULL, 1052 NULL,
1053 NULL, 1053 NULL,
1054 NULL, 1054 NULL,
1055 NULL, 1055 NULL,
1056 NULL); 1056 NULL);
1057 } 1057 }
1058 1058
1059 return EINA_FALSE; 1059 return EINA_FALSE;
1060} 1060}
@@ -1138,7 +1138,7 @@ evgl_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const
1138#ifdef GL_GLES 1138#ifdef GL_GLES
1139 glShaderBinary(n, shaders, binaryformat, binary, length); 1139 glShaderBinary(n, shaders, binaryformat, binary, length);
1140#else 1140#else
1141// FIXME: need to dlsym/getprocaddress for this 1141 // FIXME: need to dlsym/getprocaddress for this
1142 return; 1142 return;
1143 n = binaryformat = length = 0; 1143 n = binaryformat = length = 0;
1144 shaders = binary = 0; 1144 shaders = binary = 0;
@@ -1172,7 +1172,7 @@ eng_gl_api_get(void *data, int version EINA_UNUSED)
1172 ORD(glCheckFramebufferStatus); 1172 ORD(glCheckFramebufferStatus);
1173 ORD(glClear); 1173 ORD(glClear);
1174 ORD(glClearColor); 1174 ORD(glClearColor);
1175// ORD(glClearDepthf); 1175 // ORD(glClearDepthf);
1176 ORD(glClearStencil); 1176 ORD(glClearStencil);
1177 ORD(glColorMask); 1177 ORD(glColorMask);
1178 ORD(glCompileShader); 1178 ORD(glCompileShader);
@@ -1191,7 +1191,7 @@ eng_gl_api_get(void *data, int version EINA_UNUSED)
1191 ORD(glDeleteTextures); 1191 ORD(glDeleteTextures);
1192 ORD(glDepthFunc); 1192 ORD(glDepthFunc);
1193 ORD(glDepthMask); 1193 ORD(glDepthMask);
1194// ORD(glDepthRangef); 1194 // ORD(glDepthRangef);
1195 ORD(glDetachShader); 1195 ORD(glDetachShader);
1196 ORD(glDisable); 1196 ORD(glDisable);
1197 ORD(glDisableVertexAttribArray); 1197 ORD(glDisableVertexAttribArray);
@@ -1224,7 +1224,7 @@ eng_gl_api_get(void *data, int version EINA_UNUSED)
1224 ORD(glGetRenderbufferParameteriv); 1224 ORD(glGetRenderbufferParameteriv);
1225 ORD(glGetShaderiv); 1225 ORD(glGetShaderiv);
1226 ORD(glGetShaderInfoLog); 1226 ORD(glGetShaderInfoLog);
1227// ORD(glGetShaderPrecisionFormat); 1227 // ORD(glGetShaderPrecisionFormat);
1228 ORD(glGetShaderSource); 1228 ORD(glGetShaderSource);
1229 ORD(glGetString); 1229 ORD(glGetString);
1230 ORD(glGetTexParameterfv); 1230 ORD(glGetTexParameterfv);
@@ -1248,11 +1248,11 @@ eng_gl_api_get(void *data, int version EINA_UNUSED)
1248 ORD(glPixelStorei); 1248 ORD(glPixelStorei);
1249 ORD(glPolygonOffset); 1249 ORD(glPolygonOffset);
1250 ORD(glReadPixels); 1250 ORD(glReadPixels);
1251// ORD(glReleaseShaderCompiler); 1251 // ORD(glReleaseShaderCompiler);
1252 ORD(glRenderbufferStorage); 1252 ORD(glRenderbufferStorage);
1253 ORD(glSampleCoverage); 1253 ORD(glSampleCoverage);
1254 ORD(glScissor); 1254 ORD(glScissor);
1255// ORD(glShaderBinary); 1255 // ORD(glShaderBinary);
1256 ORD(glShaderSource); 1256 ORD(glShaderSource);
1257 ORD(glStencilFunc); 1257 ORD(glStencilFunc);
1258 ORD(glStencilFuncSeparate); 1258 ORD(glStencilFuncSeparate);
@@ -1299,12 +1299,12 @@ eng_gl_api_get(void *data, int version EINA_UNUSED)
1299 ORD(glViewport); 1299 ORD(glViewport);
1300#undef ORD 1300#undef ORD
1301 1301
1302// Override functions wrapped by Evas_GL 1302 // Override functions wrapped by Evas_GL
1303#define ORD(f) EVAS_API_OVERRIDE(f, &gl_funcs, evgl_) 1303#define ORD(f) EVAS_API_OVERRIDE(f, &gl_funcs, evgl_)
1304 ORD(glBindFramebuffer); 1304 ORD(glBindFramebuffer);
1305 ORD(glBindRenderbuffer); 1305 ORD(glBindRenderbuffer);
1306 1306
1307// GLES2.0 API compat on top of desktop gl 1307 // GLES2.0 API compat on top of desktop gl
1308 ORD(glClearDepthf); 1308 ORD(glClearDepthf);
1309 ORD(glDepthRangef); 1309 ORD(glDepthRangef);
1310 ORD(glGetShaderPrecisionFormat); 1310 ORD(glGetShaderPrecisionFormat);
@@ -1340,16 +1340,16 @@ module_open(Evas_Module *em)
1340 if (!evas_gl_common_module_open()) return 0; 1340 if (!evas_gl_common_module_open()) return 0;
1341 /* get whatever engine module we inherit from */ 1341 /* get whatever engine module we inherit from */
1342 if (!_evas_module_engine_inherit(&pfunc, "software_generic")) return 0; 1342 if (!_evas_module_engine_inherit(&pfunc, "software_generic")) return 0;
1343 _evas_engine_gl_cocoa_log_dom = eina_log_domain_register("EvasGLCocoa", EVAS_DEFAULT_LOG_COLOR); 1343 _evas_engine_gl_cocoa_log_dom = eina_log_domain_register("evas-gl_cocoa", EVAS_DEFAULT_LOG_COLOR);
1344 if(_evas_engine_gl_cocoa_log_dom < 0) 1344 if(_evas_engine_gl_cocoa_log_dom < 0)
1345 { 1345 {
1346 EINA_LOG_ERR("Impossible to create a log domain for GL (Cocoa) engine."); 1346 EINA_LOG_ERR("Impossible to create a log domain for GL (Cocoa) engine.");
1347 return 0; 1347 return 0;
1348 } 1348 }
1349 /* store it for later use */ 1349 /* store it for later use */
1350 func = pfunc; 1350 func = pfunc;
1351 /* now to override methods */ 1351 /* now to override methods */
1352 #define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_) 1352#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
1353 ORD(info); 1353 ORD(info);
1354 ORD(info_free); 1354 ORD(info_free);
1355 ORD(setup); 1355 ORD(setup);
@@ -1417,7 +1417,7 @@ module_open(Evas_Module *em)
1417 1417
1418 ORD(image_load_error_get); 1418 ORD(image_load_error_get);
1419 1419
1420#define LINK2GENERIC(sym) \ 1420#define LINK2GENERIC(sym) \
1421 glsym_##sym = dlsym(RTLD_DEFAULT, #sym); 1421 glsym_##sym = dlsym(RTLD_DEFAULT, #sym);
1422 1422
1423 LINK2GENERIC(evas_gl_symbols); 1423 LINK2GENERIC(evas_gl_symbols);
@@ -1431,20 +1431,20 @@ module_open(Evas_Module *em)
1431static void 1431static void
1432module_close(Evas_Module *em EINA_UNUSED) 1432module_close(Evas_Module *em EINA_UNUSED)
1433{ 1433{
1434 eina_log_domain_unregister(_evas_engine_gl_cocoa_log_dom); 1434 eina_log_domain_unregister(_evas_engine_gl_cocoa_log_dom);
1435 evas_gl_common_module_close(); 1435 evas_gl_common_module_close();
1436} 1436}
1437 1437
1438static Evas_Module_Api evas_modapi = 1438static Evas_Module_Api evas_modapi =
1439{ 1439 {
1440 EVAS_MODULE_API_VERSION, 1440 EVAS_MODULE_API_VERSION,
1441 "gl_cocoa", 1441 "gl_cocoa",
1442 "none", 1442 "none",
1443 { 1443 {
1444 module_open, 1444 module_open,
1445 module_close 1445 module_close
1446 } 1446 }
1447}; 1447 };
1448 1448
1449EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, gl_cocoa); 1449EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, gl_cocoa);
1450 1450
diff --git a/src/modules/evas/engines/gl_cocoa/evas_gl_cocoa_main.m b/src/modules/evas/engines/gl_cocoa/evas_gl_cocoa_main.m
index 882a7d7a2b..ea29753a43 100644
--- a/src/modules/evas/engines/gl_cocoa/evas_gl_cocoa_main.m
+++ b/src/modules/evas/engines/gl_cocoa/evas_gl_cocoa_main.m
@@ -26,13 +26,13 @@ static NSOpenGLContext *_evas_gl_cocoa_shared_context = NULL;
26+ (NSOpenGLPixelFormat*) basicPixelFormat 26+ (NSOpenGLPixelFormat*) basicPixelFormat
27{ 27{
28 NSOpenGLPixelFormatAttribute attributes [] = { 28 NSOpenGLPixelFormatAttribute attributes [] = {
29 NSOpenGLPFAWindow, 29 NSOpenGLPFAWindow,
30 NSOpenGLPFAAccelerated, 30 NSOpenGLPFAAccelerated,
31 NSOpenGLPFADoubleBuffer, 31 NSOpenGLPFADoubleBuffer,
32 /*NSOpenGLPFAColorSize, 24, 32 /*NSOpenGLPFAColorSize, 24,
33 NSOpenGLPFAAlphaSize, 8, 33 NSOpenGLPFAAlphaSize, 8,
34 NSOpenGLPFADepthSize, 24,*/ 34 NSOpenGLPFADepthSize, 24,*/
35 0 35 0
36 }; 36 };
37 return [[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes] autorelease]; 37 return [[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes] autorelease];
38} 38}
@@ -47,10 +47,10 @@ static NSOpenGLContext *_evas_gl_cocoa_shared_context = NULL;
47 47
48 NSOpenGLContext *ctx; 48 NSOpenGLContext *ctx;
49 if (!_evas_gl_cocoa_shared_context) { 49 if (!_evas_gl_cocoa_shared_context) {
50 _evas_gl_cocoa_shared_context = [[NSOpenGLContext alloc] initWithFormat: [EvasGLView basicPixelFormat] shareContext: nil]; 50 _evas_gl_cocoa_shared_context = [[NSOpenGLContext alloc] initWithFormat: [EvasGLView basicPixelFormat] shareContext: nil];
51 ctx = _evas_gl_cocoa_shared_context; 51 ctx = _evas_gl_cocoa_shared_context;
52 } else { 52 } else {
53 ctx = [[NSOpenGLContext alloc] initWithFormat: [EvasGLView basicPixelFormat] shareContext: _evas_gl_cocoa_shared_context]; 53 ctx = [[NSOpenGLContext alloc] initWithFormat: [EvasGLView basicPixelFormat] shareContext: _evas_gl_cocoa_shared_context];
54 } 54 }
55 [self setOpenGLContext: ctx]; 55 [self setOpenGLContext: ctx];
56 [ctx setView: self]; 56 [ctx setView: self];
@@ -109,11 +109,11 @@ void
109eng_window_free(Evas_GL_Cocoa_Window *gw) 109eng_window_free(Evas_GL_Cocoa_Window *gw)
110{ 110{
111 if (gw == _evas_gl_cocoa_window) 111 if (gw == _evas_gl_cocoa_window)
112 _evas_gl_cocoa_window = NULL; 112 _evas_gl_cocoa_window = NULL;
113 113
114 evas_gl_common_context_free(gw->gl_context); 114 evas_gl_common_context_free(gw->gl_context);
115 [(EvasGLView*)gw->view release]; 115 [(EvasGLView*)gw->view release];
116 free(gw); 116 free(gw);
117} 117}
118 118
119void 119void
@@ -146,27 +146,26 @@ eng_window_vsync_set(int on EINA_UNUSED)
146void 146void
147eng_window_resize(Evas_GL_Cocoa_Window *gw, int width, int height) 147eng_window_resize(Evas_GL_Cocoa_Window *gw, int width, int height)
148{ 148{
149 NSRect view_frame; 149 NSRect view_frame;
150 150
151 INF("Resize %d %d\n", width, height); 151 INF("Resize %d %d\n", width, height);
152 152
153 view_frame = [(EvasGLView*)gw->view frame]; 153 view_frame = [(EvasGLView*)gw->view frame];
154 printf("view_frame : %3.3f %3.3f\n", view_frame.size.height, view_frame.size.width); 154 view_frame.size.height = height;
155 view_frame.size.height = height; 155 view_frame.size.width = width;
156 view_frame.size.width = width; 156
157 printf("view_frame : %3.3f %3.3f\n", view_frame.size.height, view_frame.size.width); 157 [(EvasGLView*)gw->view setFrame:view_frame];
158 [(EvasGLView*)gw->view setFrame:view_frame]; 158 [[(NSOpenGLView*)gw->view openGLContext] flushBuffer];
159 [[(NSOpenGLView*)gw->view openGLContext] flushBuffer];
160} 159}
161 160
162void 161void
163eng_window_lock_focus(Evas_GL_Cocoa_Window *gw) 162eng_window_lock_focus(Evas_GL_Cocoa_Window *gw)
164{ 163{
165 [(NSOpenGLView*)gw->view lockFocus]; 164 [(NSOpenGLView*)gw->view lockFocus];
166} 165}
167 166
168void 167void
169eng_window_unlock_focus(Evas_GL_Cocoa_Window *gw) 168eng_window_unlock_focus(Evas_GL_Cocoa_Window *gw)
170{ 169{
171 [(NSOpenGLView*)gw->view unlockFocus]; 170 [(NSOpenGLView*)gw->view unlockFocus];
172} 171}