ecore-wayland: Improve opaque setting logic.
authorChristopher Michael <cpmichael1@comcast.net>
Tue, 8 Jan 2013 07:21:32 +0000 (07:21 +0000)
committerChristopher Michael <cpmichael1@comcast.net>
Tue, 8 Jan 2013 07:21:32 +0000 (07:21 +0000)
1. Update win->region.opaque in ecore_wl_window_update_size, so that
the opaque info is synced with the geometry.

2. Add win->surface checking in ecore_wl_window_buffer_attach
before send any wl_surface related request, it will avoid segfault
in case that calling ecore_wl_window_buffer_attach() before
ecore_wl_window_show().

SVN revision: 82384

src/lib/ecore_wayland/ecore_wl_window.c

index 13ea38f..f20b3c6 100644 (file)
@@ -241,6 +241,9 @@ ecore_wl_window_buffer_attach(Ecore_Wl_Window *win, struct wl_buffer *buffer, in
         return;
      }
 
+   if (!win->surface)
+      return;
+
    if (win->region.input)
      {
         wl_surface_set_input_region(win->surface, win->region.input);
@@ -421,6 +424,15 @@ ecore_wl_window_update_size(Ecore_Wl_Window *win, int w, int h)
    if (!win) return;
    win->allocation.w = w;
    win->allocation.h = h;
+
+   if (!win->transparent || !win->alpha)
+     {
+        if (win->region.opaque) wl_region_destroy(win->region.opaque);
+        win->region.opaque = 
+          wl_compositor_create_region(_ecore_wl_disp->wl.compositor);
+        wl_region_add(win->region.opaque, win->allocation.x, win->allocation.y, 
+                      win->allocation.w, win->allocation.h);
+     }
 }
 
 EAPI void