[gtk+/gtk-3-8] gdkwindow: Apply layered areas to the shape for native windows



commit 8c02e290c443f7f99d8b26855cef17ab66a5bad6
Author: Alexander Larsson <alexl redhat com>
Date:   Wed Mar 27 11:47:37 2013 +0100

    gdkwindow: Apply layered areas to the shape for native windows
    
    If a window is overlapped by a layered (i.e. partially transparent)
    window then that region will not disappear from the native window clip
    region. This lets us handle compositing multiple layers of windows.
    
    For native subwindows this doesn't really work. For them we apply the
    clip region as a shape to the native window which lets us have client
    side windows overlapping the native window. However, with the addition
    of the layered stuff the "overlapped-by-alpha-csw" part got broken, as
    this area is not removed from the clip region of the native window.
    
    We fix this by also removing the layered area when applying the shape.
    This means alpha and alpha backgrounds don't work over native windows,
    but there is not much to do about that.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=696370

 gdk/gdkwindow.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 7686200..f9628f3 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -940,19 +940,26 @@ static void
 apply_clip_as_shape (GdkWindow *window)
 {
   GdkRectangle r;
+  cairo_region_t *region;
 
   r.x = r.y = 0;
   r.width = window->width;
   r.height = window->height;
 
+  region = cairo_region_copy (window->clip_region);
+  if (window->layered_region)
+    cairo_region_subtract (region, window->layered_region);
+
   /* We only apply the clip region if would differ
      from the actual clip region implied by the size
      of the window. This is to avoid unneccessarily
      adding meaningless shapes to all native subwindows */
-  if (!region_rect_equal (window->clip_region, &r))
-    apply_shape (window, window->clip_region);
+  if (!region_rect_equal (region, &r))
+    apply_shape (window, region);
   else
     apply_shape (window, NULL);
+
+  cairo_region_destroy (region);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]