Blame SOURCES/0001-surface-actor-x11-Make-sure-to-set-a-size-when-unred.patch

d1d875
From 75776b869cfd533335610908f36297114ca24a86 Mon Sep 17 00:00:00 2001
d1d875
From: "Jasper St. Pierre" <jstpierre@mecheye.net>
d1d875
Date: Tue, 23 Jun 2015 16:23:45 -0700
d1d875
Subject: [PATCH] surface-actor-x11: Make sure to set a size when unredirected
d1d875
d1d875
When we're unredirected, we don't have a pixmap, and thus our allocation
d1d875
becomes 0x0. So when events come in, they pass right through our actor,
d1d875
going to the one underneath in the stack.
d1d875
d1d875
Fix this by having a fallback size on the shaped texture actor when
d1d875
we're unredirected, causing it to always have a valid allocation.
d1d875
d1d875
This fixes clicking on stuff in sloppy / mouse mode focus.
d1d875
---
d1d875
 src/compositor/meta-shaped-texture-private.h |  3 ++
d1d875
 src/compositor/meta-shaped-texture.c         | 50 +++++++++++++++++++++++++---
d1d875
 src/compositor/meta-surface-actor-x11.c      |  2 ++
d1d875
 3 files changed, 50 insertions(+), 5 deletions(-)
d1d875
d1d875
diff --git a/src/compositor/meta-shaped-texture-private.h b/src/compositor/meta-shaped-texture-private.h
d1d875
index 4ee8027..21c6335 100644
d1d875
--- a/src/compositor/meta-shaped-texture-private.h
d1d875
+++ b/src/compositor/meta-shaped-texture-private.h
d1d875
@@ -32,6 +32,9 @@
d1d875
 ClutterActor *meta_shaped_texture_new (void);
d1d875
 void meta_shaped_texture_set_texture (MetaShapedTexture *stex,
d1d875
                                       CoglTexture       *texture);
d1d875
+void meta_shaped_texture_set_fallback_size (MetaShapedTexture *stex,
d1d875
+                                            guint              fallback_width,
d1d875
+                                            guint              fallback_height);
d1d875
 gboolean meta_shaped_texture_is_obscured (MetaShapedTexture *self);
d1d875
 
d1d875
 #endif
d1d875
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
d1d875
index 163c5e6..e2d6060 100644
d1d875
--- a/src/compositor/meta-shaped-texture.c
d1d875
+++ b/src/compositor/meta-shaped-texture.c
d1d875
@@ -86,6 +86,7 @@ struct _MetaShapedTexturePrivate
d1d875
   cairo_region_t *unobscured_region;
d1d875
 
d1d875
   guint tex_width, tex_height;
d1d875
+  guint fallback_width, fallback_height;
d1d875
 
d1d875
   guint create_mipmaps : 1;
d1d875
 };
d1d875
@@ -136,7 +137,23 @@ set_unobscured_region (MetaShapedTexture *self,
d1d875
   g_clear_pointer (&priv->unobscured_region, (GDestroyNotify) cairo_region_destroy);
d1d875
   if (unobscured_region)
d1d875
     {
d1d875
-      cairo_rectangle_int_t bounds = { 0, 0, priv->tex_width, priv->tex_height };
d1d875
+      cairo_rectangle_int_t bounds;
d1d875
+      guint width, height;
d1d875
+
d1d875
+      if (priv->texture)
d1d875
+        {
d1d875
+          width = priv->tex_width;
d1d875
+          height = priv->tex_height;
d1d875
+        }
d1d875
+      else
d1d875
+        {
d1d875
+          width = priv->fallback_width;
d1d875
+          height = priv->fallback_height;
d1d875
+        }
d1d875
+
d1d875
+      bounds.x = bounds.y = 0;
d1d875
+      bounds.width = width;
d1d875
+      bounds.height = height;
d1d875
       priv->unobscured_region = cairo_region_copy (unobscured_region);
d1d875
       cairo_region_intersect_rectangle (priv->unobscured_region, &bounds);
d1d875
     }
d1d875
@@ -499,16 +516,22 @@ meta_shaped_texture_get_preferred_width (ClutterActor *self,
d1d875
                                          gfloat       *natural_width_p)
d1d875
 {
d1d875
   MetaShapedTexturePrivate *priv;
d1d875
+  guint width;
d1d875
 
d1d875
   g_return_if_fail (META_IS_SHAPED_TEXTURE (self));
d1d875
 
d1d875
   priv = META_SHAPED_TEXTURE (self)->priv;
d1d875
 
d1d875
+  if (priv->texture)
d1d875
+    width = priv->tex_width;
d1d875
+  else
d1d875
+    width = priv->fallback_width;
d1d875
+
d1d875
   if (min_width_p)
d1d875
-    *min_width_p = priv->tex_width;
d1d875
+    *min_width_p = width;
d1d875
 
d1d875
   if (natural_width_p)
d1d875
-    *natural_width_p = priv->tex_width;
d1d875
+    *natural_width_p = width;
d1d875
 }
d1d875
 
d1d875
 static void
d1d875
@@ -518,16 +541,22 @@ meta_shaped_texture_get_preferred_height (ClutterActor *self,
d1d875
                                           gfloat       *natural_height_p)
d1d875
 {
d1d875
   MetaShapedTexturePrivate *priv;
d1d875
+  guint height;
d1d875
 
d1d875
   g_return_if_fail (META_IS_SHAPED_TEXTURE (self));
d1d875
 
d1d875
   priv = META_SHAPED_TEXTURE (self)->priv;
d1d875
 
d1d875
+  if (priv->texture)
d1d875
+    height = priv->tex_height;
d1d875
+  else
d1d875
+    height = priv->fallback_height;
d1d875
+
d1d875
   if (min_height_p)
d1d875
-    *min_height_p = priv->tex_height;
d1d875
+    *min_height_p = height;
d1d875
 
d1d875
   if (natural_height_p)
d1d875
-    *natural_height_p = priv->tex_height;
d1d875
+    *natural_height_p = height;
d1d875
 }
d1d875
 
d1d875
 static cairo_region_t *
d1d875
@@ -860,6 +889,17 @@ meta_shaped_texture_get_image (MetaShapedTexture     *stex,
d1d875
   return surface;
d1d875
 }
d1d875
 
d1d875
+void
d1d875
+meta_shaped_texture_set_fallback_size (MetaShapedTexture *self,
d1d875
+                                       guint              fallback_width,
d1d875
+                                       guint              fallback_height)
d1d875
+{
d1d875
+  MetaShapedTexturePrivate *priv = self->priv;
d1d875
+
d1d875
+  priv->fallback_width = fallback_width;
d1d875
+  priv->fallback_height = fallback_height;
d1d875
+}
d1d875
+
d1d875
 static void
d1d875
 meta_shaped_texture_cull_out (MetaCullable   *cullable,
d1d875
                               cairo_region_t *unobscured_region,
d1d875
diff --git a/src/compositor/meta-surface-actor-x11.c b/src/compositor/meta-surface-actor-x11.c
d1d875
index 4aa7ecd..b50b8f2 100644
d1d875
--- a/src/compositor/meta-surface-actor-x11.c
d1d875
+++ b/src/compositor/meta-surface-actor-x11.c
d1d875
@@ -416,6 +416,7 @@ meta_surface_actor_x11_set_size (MetaSurfaceActorX11 *self,
d1d875
                                  int width, int height)
d1d875
 {
d1d875
   MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
d1d875
+  MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
d1d875
 
d1d875
   if (priv->last_width == width &&
d1d875
       priv->last_height == height)
d1d875
@@ -424,4 +425,5 @@ meta_surface_actor_x11_set_size (MetaSurfaceActorX11 *self,
d1d875
   priv->size_changed = TRUE;
d1d875
   priv->last_width = width;
d1d875
   priv->last_height = height;
d1d875
+  meta_shaped_texture_set_fallback_size (stex, width, height);
d1d875
 }
d1d875
-- 
d1d875
2.5.0
d1d875