summaryrefslogtreecommitdiff
path: root/src/compositor/meta-shaped-texture.c
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2015-06-23 16:23:45 -0700
committerJasper St. Pierre <jstpierre@mecheye.net>2015-06-23 16:30:29 -0700
commit4c6866741d5ca53d028329f1626298985c005a0c (patch)
tree07f63b80fa8980bcb4b3b56226ef4ad127ce44ef /src/compositor/meta-shaped-texture.c
parent84baf4e1818ac887deed61a127f070a9b304d7f8 (diff)
downloadmutter-4c6866741d5ca53d028329f1626298985c005a0c.tar.gz
surface-actor-x11: Make sure to set a size when unredirected
When we're unredirected, we don't have a pixmap, and thus our allocation becomes 0x0. So when events come in, they pass right through our actor, going to the one underneath in the stack. Fix this by having a fallback size on the shaped texture actor when we're unredirected, causing it to always have a valid allocation. This fixes clicking on stuff in sloppy / mouse mode focus.
Diffstat (limited to 'src/compositor/meta-shaped-texture.c')
-rw-r--r--src/compositor/meta-shaped-texture.c49
1 files changed, 42 insertions, 7 deletions
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
index d1ed37968..685be36b4 100644
--- a/src/compositor/meta-shaped-texture.c
+++ b/src/compositor/meta-shaped-texture.c
@@ -86,6 +86,7 @@ struct _MetaShapedTexturePrivate
cairo_region_t *unobscured_region;
guint tex_width, tex_height;
+ guint fallback_width, fallback_height;
guint create_mipmaps : 1;
};
@@ -136,7 +137,20 @@ set_unobscured_region (MetaShapedTexture *self,
g_clear_pointer (&priv->unobscured_region, (GDestroyNotify) cairo_region_destroy);
if (unobscured_region)
{
- cairo_rectangle_int_t bounds = { 0, 0, priv->tex_width, priv->tex_height };
+ guint width, height;
+
+ if (priv->texture)
+ {
+ width = priv->tex_width;
+ height = priv->tex_height;
+ }
+ else
+ {
+ width = priv->fallback_width;
+ height = priv->fallback_height;
+ }
+
+ cairo_rectangle_int_t bounds = { 0, 0, width, height };
priv->unobscured_region = cairo_region_copy (unobscured_region);
cairo_region_intersect_rectangle (priv->unobscured_region, &bounds);
}
@@ -499,12 +513,17 @@ meta_shaped_texture_get_preferred_width (ClutterActor *self,
gfloat *natural_width_p)
{
MetaShapedTexturePrivate *priv = META_SHAPED_TEXTURE (self)->priv;
+ guint width;
- if (min_width_p)
- *min_width_p = priv->tex_width;
+ if (priv->texture)
+ width = priv->tex_width;
+ else
+ width = priv->fallback_width;
+ if (min_width_p)
+ *min_width_p = width;
if (natural_width_p)
- *natural_width_p = priv->tex_width;
+ *natural_width_p = width;
}
static void
@@ -514,12 +533,17 @@ meta_shaped_texture_get_preferred_height (ClutterActor *self,
gfloat *natural_height_p)
{
MetaShapedTexturePrivate *priv = META_SHAPED_TEXTURE (self)->priv;
+ guint height;
- if (min_height_p)
- *min_height_p = priv->tex_height;
+ if (priv->texture)
+ height = priv->tex_height;
+ else
+ height = priv->fallback_height;
+ if (min_height_p)
+ *min_height_p = height;
if (natural_height_p)
- *natural_height_p = priv->tex_height;
+ *natural_height_p = height;
}
static cairo_region_t *
@@ -852,6 +876,17 @@ meta_shaped_texture_get_image (MetaShapedTexture *stex,
return surface;
}
+void
+meta_shaped_texture_set_fallback_size (MetaShapedTexture *self,
+ guint fallback_width,
+ guint fallback_height)
+{
+ MetaShapedTexturePrivate *priv = self->priv;
+
+ priv->fallback_width = fallback_width;
+ priv->fallback_height = fallback_height;
+}
+
static void
meta_shaped_texture_cull_out (MetaCullable *cullable,
cairo_region_t *unobscured_region,