summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Guyomarc'h <jean.guyomarch@openwide.fr>2015-10-14 13:26:16 +0200
committerNicolas Aguirre <aguirre.nicolas@gmail.com>2015-11-10 08:32:49 +0100
commitf362d307772e03392cce50c89dc94180be26a518 (patch)
tree5c2cedcdd40ed06c15f2556f030961f8ad320d1e
parent8f5581c7045ec07026e258b68bebfd19bfbfe99f (diff)
ecore_evas_cocoa: factorize code
-rw-r--r--src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c55
1 files changed, 28 insertions, 27 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 6c4e64578d..0f9c3b6720 100644
--- a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
+++ b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
@@ -209,6 +209,30 @@ _ecore_evas_cocoa_event_lost_focus(void *data EINA_UNUSED, int type EINA_UNUSED,
209 return ECORE_CALLBACK_PASS_ON; 209 return ECORE_CALLBACK_PASS_ON;
210} 210}
211 211
212static void
213_ecore_evas_resize_common(Ecore_Evas *ee,
214 int w,
215 int h,
216 Eina_Bool resize_cocoa)
217{
218 if ((w == ee->w) && (h == ee->h)) return;
219 ee->req.w = w;
220 ee->req.h = h;
221 ee->w = w;
222 ee->h = h;
223
224 DBG("Ecore_Evas Resize %d %d", w, h);
225
226 if (resize_cocoa)
227 ecore_cocoa_window_resize((Ecore_Cocoa_Window *)ee->prop.window, w, h);
228
229 evas_output_size_set(ee->evas, ee->w, ee->h);
230 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
231 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
232
233 if (ee->func.fn_resize) ee->func.fn_resize(ee);
234}
235
212static Eina_Bool 236static Eina_Bool
213_ecore_evas_cocoa_event_video_resize(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) 237_ecore_evas_cocoa_event_video_resize(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
214{ 238{
@@ -217,24 +241,15 @@ _ecore_evas_cocoa_event_video_resize(void *data EINA_UNUSED, int type EINA_UNUSE
217 241
218 DBG(""); 242 DBG("");
219 243
220 if (!e->wid)
221 return ECORE_CALLBACK_PASS_ON;
222
223 ee = _ecore_evas_cocoa_match(e->wid); 244 ee = _ecore_evas_cocoa_match(e->wid);
224 if (!ee) 245 if (EINA_UNLIKELY(!ee))
225 { 246 {
226 ERR("Unregistered Ecore_Evas for window Id %p", e->wid); 247 ERR("Unregistered Ecore_Evas for window Id %p", e->wid);
227 return ECORE_CALLBACK_PASS_ON; 248 return ECORE_CALLBACK_PASS_ON;
228 } 249 }
229 250
230 ee->req.w = ee->w = e->w; 251 /* Do the resize */
231 ee->req.h = ee->h = e->h; 252 _ecore_evas_resize_common(ee, e->w, e->h, EINA_FALSE);
232
233 evas_output_size_set(ee->evas, e->w, e->h);
234 evas_output_viewport_set(ee->evas, 0, 0, e->w, e->h);
235 evas_damage_rectangle_add(ee->evas, 0, 0, e->w, e->h);
236
237 if (ee->func.fn_resize) ee->func.fn_resize(ee);
238 253
239 return ECORE_CALLBACK_PASS_ON; 254 return ECORE_CALLBACK_PASS_ON;
240} 255}
@@ -340,21 +355,7 @@ static void
340_ecore_evas_resize(Ecore_Evas *ee, int w, int h) 355_ecore_evas_resize(Ecore_Evas *ee, int w, int h)
341{ 356{
342 DBG(""); 357 DBG("");
343 if ((w == ee->w) && (h == ee->h)) return; 358 _ecore_evas_resize_common(ee, w, h, EINA_TRUE);
344 ee->req.w = w;
345 ee->req.h = h;
346 ee->w = w;
347 ee->h = h;
348
349 DBG("Ecore_Evas Resize %d %d", w, h);
350
351 ecore_cocoa_window_resize((Ecore_Cocoa_Window *)ee->prop.window, w, h);
352
353 evas_output_size_set(ee->evas, ee->w, ee->h);
354 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
355 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
356
357 if (ee->func.fn_resize) ee->func.fn_resize(ee);
358} 359}
359 360
360static void 361static void