summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Antognolli <rafael.antognolli@intel.com>2013-04-24 15:21:44 -0300
committerRafael Antognolli <rafael.antognolli@intel.com>2013-04-24 15:24:37 -0300
commit0745e46d122ad58a57507f6aef3242e75fe9cfaa (patch)
tree278eaf7c7baaf7e7bf3dd6ef168399d78fdd0c9e
parentf2b1039e05378087f69b0e112dea3396abf94829 (diff)
ecore_evas/wayland: Add support for rotation on wayland_egl backend.
Also move the common code for rotation_set from the shm engine to wayland_common.
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c88
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c35
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h1
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c98
-rw-r--r--src/modules/evas/engines/wayland_egl/evas_engine.c5
5 files changed, 130 insertions, 97 deletions
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
index 146d607..805c3cf 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
@@ -253,6 +253,94 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_
253 return ECORE_CALLBACK_PASS_ON; 253 return ECORE_CALLBACK_PASS_ON;
254} 254}
255 255
256void
257_ecore_evas_wl_common_rotation_set(Ecore_Evas *ee, int rotation, int resize)
258{
259 Ecore_Evas_Engine_Wl_Data *wdata;
260 int rot_dif;
261
262 wdata = ee->engine.data;
263
264 rot_dif = ee->rotation - rotation;
265 if (rot_dif < 0) rot_dif = -rot_dif;
266
267 if (rot_dif != 180)
268 {
269 int minw, minh, maxw, maxh, basew, baseh, stepw, steph;
270 int ww, hh;
271
272 if (!resize)
273 {
274 if (!ee->prop.fullscreen)
275 {
276 int fw, fh;
277 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
278 ecore_wl_window_resize(wdata->win, ee->h + fh, ee->w + fw, 0);
279 ecore_wl_window_update_size(wdata->win, ee->h + fh, ee->w + fw);
280 evas_output_size_set(ee->evas, ee->req.w + fw, ee->req.h + fh);
281 evas_output_viewport_set(ee->evas, 0, 0, ee->req.w + fw, ee->req.h + fh);
282 }
283 else
284 {
285 evas_output_size_set(ee->evas, ee->req.w, ee->req.h);
286 evas_output_viewport_set(ee->evas, 0, 0, ee->req.w, ee->req.h);
287 if (ee->func.fn_resize) ee->func.fn_resize(ee);
288 }
289 if ((ee->rotation == 90) || (ee->rotation == 270))
290 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.h, ee->req.w);
291 else
292 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
293 ww = ee->h;
294 hh = ee->w;
295 ee->w = ww;
296 ee->h = hh;
297 ee->req.w = ww;
298 ee->req.h = hh;
299 }
300 else
301 {
302 if ((rotation == 0) || (rotation == 180))
303 {
304 evas_output_size_set(ee->evas, ee->w, ee->h);
305 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
306 }
307 else
308 {
309 evas_output_size_set(ee->evas, ee->h, ee->w);
310 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
311 }
312 if (ee->func.fn_resize) ee->func.fn_resize(ee);
313 if ((ee->rotation == 90) || (ee->rotation == 270))
314 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
315 else
316 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
317 }
318 ecore_evas_size_min_get(ee, &minw, &minh);
319 ecore_evas_size_max_get(ee, &maxw, &maxh);
320 ecore_evas_size_base_get(ee, &basew, &baseh);
321 ecore_evas_size_step_get(ee, &stepw, &steph);
322 ee->rotation = rotation;
323 ecore_evas_size_min_set(ee, minh, minw);
324 ecore_evas_size_max_set(ee, maxh, maxw);
325 ecore_evas_size_base_set(ee, baseh, basew);
326 ecore_evas_size_step_set(ee, steph, stepw);
327 _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
328 ecore_loop_time_get());
329 }
330 else
331 {
332 ee->rotation = rotation;
333 _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
334 ecore_loop_time_get());
335 if (ee->func.fn_resize) ee->func.fn_resize(ee);
336
337 if ((ee->rotation == 90) || (ee->rotation == 270))
338 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
339 else
340 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
341 }
342}
343
256int 344int
257_ecore_evas_wl_common_init(void) 345_ecore_evas_wl_common_init(void)
258{ 346{
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
index cbad243..fb8d19a 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_egl.c
@@ -15,6 +15,7 @@ static void _ecore_evas_wl_show(Ecore_Evas *ee);
15static void _ecore_evas_wl_hide(Ecore_Evas *ee); 15static void _ecore_evas_wl_hide(Ecore_Evas *ee);
16static void _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha); 16static void _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha);
17static void _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent); 17static void _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent);
18static void _ecore_evas_wl_rotation_set(Ecore_Evas *ee, int rotation, int resize);
18 19
19static Ecore_Evas_Engine_Func _ecore_wl_engine_func = 20static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
20{ 21{
@@ -37,7 +38,7 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
37 NULL, // managed_move 38 NULL, // managed_move
38 _ecore_evas_wl_resize, 39 _ecore_evas_wl_resize,
39 NULL, // move_resize 40 NULL, // move_resize
40 NULL, // rotation_set 41 _ecore_evas_wl_rotation_set,
41 NULL, // shaped_set 42 NULL, // shaped_set
42 _ecore_evas_wl_show, 43 _ecore_evas_wl_show,
43 _ecore_evas_wl_hide, 44 _ecore_evas_wl_hide,
@@ -263,8 +264,16 @@ _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
263 orig_h = h; 264 orig_h = h;
264 265
265 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh); 266 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
266 w += fw; 267 if ((ee->rotation == 90) || (ee->rotation == 270))
267 h += fh; 268 {
269 w += fh;
270 h += fw;
271 }
272 else
273 {
274 w += fw;
275 h += fh;
276 }
268 } 277 }
269 278
270 if ((ee->w != w) || (ee->h != h)) 279 if ((ee->w != w) || (ee->h != h))
@@ -313,6 +322,26 @@ _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h)
313 } 322 }
314} 323}
315 324
325static void
326_ecore_evas_wl_rotation_set(Ecore_Evas *ee, int rotation, int resize)
327{
328 Evas_Engine_Info_Wayland_Egl *einfo;
329 LOGFN(__FILE__, __LINE__, __FUNCTION__);
330
331 if (ee->rotation == rotation) return;
332
333 einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas);
334 if (!einfo)
335 return;
336 einfo->info.rotation = rotation;
337 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
338 {
339 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
340 }
341
342 _ecore_evas_wl_common_rotation_set(ee, rotation, resize);
343}
344
316static void 345static void
317_ecore_evas_wl_show(Ecore_Evas *ee) 346_ecore_evas_wl_show(Ecore_Evas *ee)
318{ 347{
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h
index 7ecb098..df6957f 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h
@@ -68,6 +68,7 @@ void _ecore_evas_wl_common_screen_geometry_get(const Ecore_Evas *ee, int *x, int
68void _ecore_evas_wl_common_screen_dpi_get(const Ecore_Evas *ee, int *xdpi, int *ydpi); 68void _ecore_evas_wl_common_screen_dpi_get(const Ecore_Evas *ee, int *xdpi, int *ydpi);
69void _ecore_evas_wl_common_state_change(void *data); 69void _ecore_evas_wl_common_state_change(void *data);
70void _ecore_evas_wl_common_render_updates(void *data, Evas *evas, void *event); 70void _ecore_evas_wl_common_render_updates(void *data, Evas *evas, void *event);
71void _ecore_evas_wl_common_rotation_set(Ecore_Evas *ee, int rotation, int resize);
71 72
72Evas_Object * _ecore_evas_wl_common_frame_add(Evas *evas); 73Evas_Object * _ecore_evas_wl_common_frame_add(Evas *evas);
73void _ecore_evas_wl_common_frame_border_size_set(Evas_Object *obj, int fx, int fy, int fw, int fh); 74void _ecore_evas_wl_common_frame_border_size_set(Evas_Object *obj, int fx, int fy, int fw, int fh);
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
index 01b50fa..3070697 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_shm.c
@@ -354,9 +354,6 @@ static void
354_ecore_evas_wl_rotation_set(Ecore_Evas *ee, int rotation, int resize) 354_ecore_evas_wl_rotation_set(Ecore_Evas *ee, int rotation, int resize)
355{ 355{
356 Evas_Engine_Info_Wayland_Shm *einfo; 356 Evas_Engine_Info_Wayland_Shm *einfo;
357 Ecore_Evas_Engine_Wl_Data *wdata;
358 int rot_dif;
359
360 LOGFN(__FILE__, __LINE__, __FUNCTION__); 357 LOGFN(__FILE__, __LINE__, __FUNCTION__);
361 358
362 if (ee->rotation == rotation) return; 359 if (ee->rotation == rotation) return;
@@ -365,97 +362,12 @@ _ecore_evas_wl_rotation_set(Ecore_Evas *ee, int rotation, int resize)
365 if (!einfo) 362 if (!einfo)
366 return; 363 return;
367 einfo->info.rotation = rotation; 364 einfo->info.rotation = rotation;
365 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
366 {
367 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
368 }
368 369
369 wdata = ee->engine.data; 370 _ecore_evas_wl_common_rotation_set(ee, rotation, resize);
370
371 rot_dif = ee->rotation - rotation;
372 if (rot_dif < 0) rot_dif = -rot_dif;
373
374 if (rot_dif != 180)
375 {
376 int minw, minh, maxw, maxh, basew, baseh, stepw, steph;
377 int ww, hh;
378
379 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
380 {
381 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
382 }
383
384 if (!resize)
385 {
386 // wdata->configure_coming = 1;
387 if (!ee->prop.fullscreen)
388 {
389 int fw, fh;
390 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
391 ecore_wl_window_resize(wdata->win, ee->h + fh, ee->w + fw, 0);
392 ecore_wl_window_update_size(wdata->win, ee->h + fh, ee->w + fw);
393 evas_output_size_set(ee->evas, ee->req.w + fw, ee->req.h + fh);
394 evas_output_viewport_set(ee->evas, 0, 0, ee->req.w + fw, ee->req.h + fh);
395 }
396 else
397 {
398 evas_output_size_set(ee->evas, ee->req.w, ee->req.h);
399 evas_output_viewport_set(ee->evas, 0, 0, ee->req.w, ee->req.h);
400 if (ee->func.fn_resize) ee->func.fn_resize(ee);
401 }
402 if ((ee->rotation == 90) || (ee->rotation == 270))
403 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.h, ee->req.w);
404 else
405 evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h);
406 ww = ee->h;
407 hh = ee->w;
408 ee->w = ww;
409 ee->h = hh;
410 ee->req.w = ww;
411 ee->req.h = hh;
412 }
413 else
414 {
415 if ((rotation == 0) || (rotation == 180))
416 {
417 evas_output_size_set(ee->evas, ee->w, ee->h);
418 evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h);
419 }
420 else
421 {
422 evas_output_size_set(ee->evas, ee->h, ee->w);
423 evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w);
424 }
425 if (ee->func.fn_resize) ee->func.fn_resize(ee);
426 if ((ee->rotation == 90) || (ee->rotation == 270))
427 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
428 else
429 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
430 }
431 ecore_evas_size_min_get(ee, &minw, &minh);
432 ecore_evas_size_max_get(ee, &maxw, &maxh);
433 ecore_evas_size_base_get(ee, &basew, &baseh);
434 ecore_evas_size_step_get(ee, &stepw, &steph);
435 ee->rotation = rotation;
436 ecore_evas_size_min_set(ee, minh, minw);
437 ecore_evas_size_max_set(ee, maxh, maxw);
438 ecore_evas_size_base_set(ee, baseh, basew);
439 ecore_evas_size_step_set(ee, steph, stepw);
440 _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
441 ecore_loop_time_get());
442 }
443 else
444 {
445 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
446 {
447 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
448 }
449 ee->rotation = rotation;
450 // _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y,
451 // ecore_x_current_time_get());
452 if (ee->func.fn_resize) ee->func.fn_resize(ee);
453
454 if ((ee->rotation == 90) || (ee->rotation == 270))
455 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
456 else
457 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
458 }
459} 371}
460 372
461static void 373static void
diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.c b/src/modules/evas/engines/wayland_egl/evas_engine.c
index 776bdfb..56cac55 100644
--- a/src/modules/evas/engines/wayland_egl/evas_engine.c
+++ b/src/modules/evas/engines/wayland_egl/evas_engine.c
@@ -894,7 +894,10 @@ eng_output_resize(void *data, int w, int h)
894 else 894 else
895 dy = 0; 895 dy = 0;
896 896
897 wl_egl_window_resize(re->win->win, w, h, dx, dy); 897 if ((re->win->rot == 90) || (re->win->rot == 270))
898 wl_egl_window_resize(re->win->win, h, w, dy, dx);
899 else
900 wl_egl_window_resize(re->win->win, w, h, dx, dy);
898 } 901 }
899 902
900 evas_gl_common_context_resize(re->win->gl_context, w, h, re->win->rot); 903 evas_gl_common_context_resize(re->win->gl_context, w, h, re->win->rot);