summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2013-09-17 07:33:30 +0100
committerChris Michael <cp.michael@samsung.com>2013-09-17 07:41:08 +0100
commit43fda7c835cc9ee4af9ba5e483730f9782a8a35a (patch)
tree5cd6899ea36f0aaed98b58152277c6459065fc25
parent677fdbf81c089f5e397413fd5276106128ae027b (diff)
Add API functions for window_rotation set/get and Fix Protruding surfaces on rotated, opaque windows
Phab Ticket T359 https://phab.enlightenment.org/T359 NB: When setting the window opaque region, take into account any existing window rotation, and set opaque region accordingly. Signed-off-by: Chris Michael <cp.michael@samsung.com>
-rw-r--r--src/lib/ecore_wayland/ecore_wl_window.c78
1 files changed, 54 insertions, 24 deletions
diff --git a/src/lib/ecore_wayland/ecore_wl_window.c b/src/lib/ecore_wayland/ecore_wl_window.c
index 555ebc6dd8..748aa76a20 100644
--- a/src/lib/ecore_wayland/ecore_wl_window.c
+++ b/src/lib/ecore_wayland/ecore_wl_window.c
@@ -79,6 +79,7 @@ ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, int w, int h, int buf
79 win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL; 79 win->type = ECORE_WL_WINDOW_TYPE_TOPLEVEL;
80 win->buffer_type = buffer_type; 80 win->buffer_type = buffer_type;
81 win->id = _win_id++; 81 win->id = _win_id++;
82 win->rotation = 0;
82 83
83 win->opaque.x = x; 84 win->opaque.x = x;
84 win->opaque.y = y; 85 win->opaque.y = y;
@@ -417,11 +418,8 @@ ecore_wl_window_transparent_set(Ecore_Wl_Window *win, Eina_Bool transparent)
417 418
418 if (!win) return; 419 if (!win) return;
419 win->transparent = transparent; 420 win->transparent = transparent;
420 if (win->transparent) 421 ecore_wl_window_opaque_region_set(win, win->opaque.x, win->opaque.y,
421 ecore_wl_window_opaque_region_set(win, 0, 0, 0, 0); 422 win->opaque.w, win->opaque.h);
422 else
423 ecore_wl_window_opaque_region_set(win, win->opaque.x, win->opaque.y,
424 win->opaque.w, win->opaque.h);
425} 423}
426 424
427EAPI Eina_Bool 425EAPI Eina_Bool
@@ -441,11 +439,8 @@ ecore_wl_window_alpha_set(Ecore_Wl_Window *win, Eina_Bool alpha)
441 439
442 if (!win) return; 440 if (!win) return;
443 win->alpha = alpha; 441 win->alpha = alpha;
444 if (win->alpha) 442 ecore_wl_window_opaque_region_set(win, win->opaque.x, win->opaque.y,
445 ecore_wl_window_opaque_region_set(win, 0, 0, 0, 0); 443 win->opaque.w, win->opaque.h);
446 else
447 ecore_wl_window_opaque_region_set(win, win->opaque.x, win->opaque.y,
448 win->opaque.w, win->opaque.h);
449} 444}
450 445
451EAPI Eina_Bool 446EAPI Eina_Bool
@@ -619,6 +614,8 @@ ecore_wl_window_input_region_set(Ecore_Wl_Window *win, int x, int y, int w, int
619 else 614 else
620 wl_surface_set_input_region(win->surface, NULL); 615 wl_surface_set_input_region(win->surface, NULL);
621 } 616 }
617
618 ecore_wl_window_commit(win);
622} 619}
623 620
624/* @since 1.8 */ 621/* @since 1.8 */
@@ -629,28 +626,61 @@ ecore_wl_window_opaque_region_set(Ecore_Wl_Window *win, int x, int y, int w, int
629 626
630 if (!win) return; 627 if (!win) return;
631 628
629 win->opaque.x = x;
630 win->opaque.y = y;
631 win->opaque.w = w;
632 win->opaque.h = h;
633
632 if ((!win->transparent) && (!win->alpha)) 634 if ((!win->transparent) && (!win->alpha))
633 { 635 {
634 if ((w > 0) && (h > 0)) 636 struct wl_region *region = NULL;
635 {
636 struct wl_region *region = NULL;
637 637
638 region = 638 region =
639 wl_compositor_create_region(_ecore_wl_disp->wl.compositor); 639 wl_compositor_create_region(_ecore_wl_disp->wl.compositor);
640 wl_region_add(region, x, y, w, h);
641 wl_surface_set_opaque_region(win->surface, region);
642 wl_region_destroy(region);
643 640
644 win->opaque.x = x; 641 switch (win->rotation)
645 win->opaque.y = y; 642 {
646 win->opaque.w = w; 643 case 0:
647 win->opaque.h = h; 644 wl_region_add(region, x, y, w, h);
645 break;
646 case 180:
647 wl_region_add(region, x, x + y, w, h);
648 break;
649 case 90:
650 wl_region_add(region, y, x, h, w);
651 break;
652 case 270:
653 wl_region_add(region, x + y, x, h, w);
654 break;
648 } 655 }
649 else 656
650 wl_surface_set_opaque_region(win->surface, NULL); 657 wl_surface_set_opaque_region(win->surface, region);
658 wl_region_destroy(region);
651 } 659 }
652 else 660 else
653 wl_surface_set_opaque_region(win->surface, NULL); 661 wl_surface_set_opaque_region(win->surface, NULL);
662
663 ecore_wl_window_commit(win);
664}
665
666/* @since 1.8 */
667EAPI void
668ecore_wl_window_rotation_set(Ecore_Wl_Window *win, int rotation)
669{
670 LOGFN(__FILE__, __LINE__, __FUNCTION__);
671
672 if (!win) return;
673 win->rotation = rotation;
674}
675
676/* @since 1.8 */
677EAPI int
678ecore_wl_window_rotation_get(Ecore_Wl_Window *win)
679{
680 LOGFN(__FILE__, __LINE__, __FUNCTION__);
681
682 if (!win) return 0;
683 return win->rotation;
654} 684}
655 685
656/* local functions */ 686/* local functions */