summaryrefslogtreecommitdiff
path: root/src/lib/ecore_wayland/ecore_wl_window.c
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2015-01-07 14:46:14 -0500
committerChris Michael <cp.michael@samsung.com>2015-01-07 14:50:00 -0500
commit080b9e473064e84af804a9fdc2148891327b59f7 (patch)
treef97958ef053043409bbbd70781acbe5ebd24a279 /src/lib/ecore_wayland/ecore_wl_window.c
parentd136391108deaf4725b9fc9c4836b59b45892ad7 (diff)
ecore-wayland: Simplify opaque and input region handling.
Summary: We can make opaque and input region handling simplier if we just use one opaque & input region per window. Previous code would always create a new region, set it to the surface, then destroy it. This code works much nicer in that it hammers the protocol with less region create/destroy calls. @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/ecore_wayland/ecore_wl_window.c')
-rw-r--r--src/lib/ecore_wayland/ecore_wl_window.c131
1 files changed, 63 insertions, 68 deletions
diff --git a/src/lib/ecore_wayland/ecore_wl_window.c b/src/lib/ecore_wayland/ecore_wl_window.c
index ecf3ac95f2..55c7097f6b 100644
--- a/src/lib/ecore_wayland/ecore_wl_window.c
+++ b/src/lib/ecore_wayland/ecore_wl_window.c
@@ -101,6 +101,12 @@ ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, int w, int h, int buf
101 win->opaque.w = w; 101 win->opaque.w = w;
102 win->opaque.h = h; 102 win->opaque.h = h;
103 103
104 win->opaque_region =
105 wl_compositor_create_region(_ecore_wl_compositor_get());
106
107 win->input_region =
108 wl_compositor_create_region(_ecore_wl_compositor_get());
109
104 win->title = NULL; 110 win->title = NULL;
105 win->class_name = NULL; 111 win->class_name = NULL;
106 112
@@ -132,6 +138,9 @@ ecore_wl_window_free(Ecore_Wl_Window *win)
132 138
133 if (win->subsurfs) _ecore_wl_subsurfs_del_all(win); 139 if (win->subsurfs) _ecore_wl_subsurfs_del_all(win);
134 140
141 if (win->input_region) wl_region_destroy(win->input_region);
142 if (win->opaque_region) wl_region_destroy(win->opaque_region);
143
135#ifdef USE_IVI_SHELL 144#ifdef USE_IVI_SHELL
136 if (win->ivi_surface) ivi_surface_destroy(win->ivi_surface); 145 if (win->ivi_surface) ivi_surface_destroy(win->ivi_surface);
137 win->ivi_surface = NULL; 146 win->ivi_surface = NULL;
@@ -228,6 +237,19 @@ ecore_wl_window_commit(Ecore_Wl_Window *win)
228 LOGFN(__FILE__, __LINE__, __FUNCTION__); 237 LOGFN(__FILE__, __LINE__, __FUNCTION__);
229 238
230 if (!win) return; 239 if (!win) return;
240
241 if (win->opaque_region)
242 {
243 if (win->surface)
244 wl_surface_set_opaque_region(win->surface, win->opaque_region);
245 }
246
247 if (win->input_region)
248 {
249 if (win->surface)
250 wl_surface_set_input_region(win->surface, win->input_region);
251 }
252
231 if ((win->surface) && (win->has_buffer)) 253 if ((win->surface) && (win->has_buffer))
232 wl_surface_commit(win->surface); 254 wl_surface_commit(win->surface);
233} 255}
@@ -253,7 +275,7 @@ ecore_wl_window_buffer_attach(Ecore_Wl_Window *win, struct wl_buffer *buffer, in
253 wl_surface_attach(win->surface, buffer, x, y); 275 wl_surface_attach(win->surface, buffer, x, y);
254 wl_surface_damage(win->surface, 0, 0, 276 wl_surface_damage(win->surface, 0, 0,
255 win->allocation.w, win->allocation.h); 277 win->allocation.w, win->allocation.h);
256 wl_surface_commit(win->surface); 278 ecore_wl_window_commit(win);
257 } 279 }
258 break; 280 break;
259 default: 281 default:
@@ -796,39 +818,27 @@ ecore_wl_window_input_region_set(Ecore_Wl_Window *win, int x, int y, int w, int
796 818
797 win->input.x = x; 819 win->input.x = x;
798 win->input.y = y; 820 win->input.y = y;
799 if ((w > 0) && (h > 0)) 821 win->input.w = w;
800 { 822 win->input.h = h;
801 if ((win->input.w == w) && (win->input.h == h))
802 return;
803
804 win->input.w = w;
805 win->input.h = h;
806 }
807 823
808 if ((win->type != ECORE_WL_WINDOW_TYPE_FULLSCREEN) || 824 if (win->type != ECORE_WL_WINDOW_TYPE_DND)
809 (win->type != ECORE_WL_WINDOW_TYPE_DND))
810 { 825 {
811 if ((w > 0) && (h > 0)) 826 switch (win->rotation)
812 { 827 {
813 struct wl_region *region = NULL; 828 case 0:
814 829 wl_region_add(win->input_region, x, y, w, h);
815 region = 830 break;
816 wl_compositor_create_region(_ecore_wl_compositor_get()); 831 case 180:
817 if (!region) 832 wl_region_add(win->input_region, x, x + y, w, h);
818 { 833 break;
819 wl_surface_set_input_region(win->surface, NULL); 834 case 90:
820 return; 835 wl_region_add(win->input_region, y, x, h, w);
821 } 836 break;
822 837 case 270:
823 wl_region_add(region, x, y, w, h); 838 wl_region_add(win->input_region, x + y, x, h, w);
824 wl_surface_set_input_region(win->surface, region); 839 break;
825 wl_region_destroy(region);
826 } 840 }
827 else
828 wl_surface_set_input_region(win->surface, NULL);
829 } 841 }
830
831 /* ecore_wl_window_commit(win); */
832} 842}
833 843
834/* @since 1.8 */ 844/* @since 1.8 */
@@ -841,50 +851,35 @@ ecore_wl_window_opaque_region_set(Ecore_Wl_Window *win, int x, int y, int w, int
841 851
842 win->opaque.x = x; 852 win->opaque.x = x;
843 win->opaque.y = y; 853 win->opaque.y = y;
844 if ((w > 0) && (h > 0)) 854 win->opaque.w = w;
845 { 855 win->opaque.h = h;
846 if ((win->opaque.w == w) && (win->opaque.h == h))
847 return;
848 856
849 win->opaque.w = w; 857 if ((win->transparent) || (win->alpha)) return;
850 win->opaque.h = h;
851 }
852 858
853 if (((w > 0) && (h > 0)) && ((!win->transparent) && (!win->alpha))) 859 switch (win->rotation)
854 { 860 {
855 struct wl_region *region = NULL; 861 case 0:
856 862 wl_region_add(win->opaque_region, x, y, w, h);
857 region = 863 break;
858 wl_compositor_create_region(_ecore_wl_compositor_get()); 864 case 180:
859 if (!region) 865 wl_region_add(win->opaque_region, x, x + y, w, h);
860 { 866 break;
861 wl_surface_set_opaque_region(win->surface, NULL); 867 case 90:
862 return; 868 wl_region_add(win->opaque_region, y, x, h, w);
863 } 869 break;
864 870 case 270:
865 switch (win->rotation) 871 wl_region_add(win->opaque_region, x + y, x, h, w);
866 { 872 break;
867 case 0:
868 wl_region_add(region, x, y, w, h);
869 break;
870 case 180:
871 wl_region_add(region, x, x + y, w, h);
872 break;
873 case 90:
874 wl_region_add(region, y, x, h, w);
875 break;
876 case 270:
877 wl_region_add(region, x + y, x, h, w);
878 break;
879 }
880
881 wl_surface_set_opaque_region(win->surface, region);
882 wl_region_destroy(region);
883 } 873 }
884 else
885 wl_surface_set_opaque_region(win->surface, NULL);
886 874
887 /* ecore_wl_window_commit(win); */ 875 /* if ((w > 0) && (h > 0)) */
876 /* { */
877 /* if ((win->opaque.w == w) && (win->opaque.h == h)) */
878 /* return; */
879
880 /* win->opaque.w = w; */
881 /* win->opaque.h = h; */
882 /* } */
888} 883}
889 884
890/* @since 1.8 */ 885/* @since 1.8 */