[mutter] MetaWindow: Make buffer_rect and rect share coordinate space
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] MetaWindow: Make buffer_rect and rect share coordinate space
- Date: Tue, 3 May 2016 02:17:40 +0000 (UTC)
commit bca041b68e436c3d8f9341bd3a6b5f1059b3a62a
Author: Jonas Ådahl <jadahl gmail com>
Date: Fri Mar 4 16:14:33 2016 +0800
MetaWindow: Make buffer_rect and rect share coordinate space
Before this commit, on Wayland, the buffer rect would have the size of
the attached Wayland buffer, no matter the scale. The scale would then
be applied ad-hoc by callers when a sane rectangle was needed. This
commit changes buffer_rect to rather represent the surface rect (i.e.
what is drawn on the stage, including client side shadow). The users of
buffer_rect will no longer need to scale the buffer_rect themself to
get a usable rectangle.
https://bugzilla.gnome.org/show_bug.cgi?id=763431
src/compositor/meta-window-actor.c | 14 --------------
src/core/window-private.h | 6 ++++--
src/wayland/meta-wayland-surface.c | 8 ++++++--
3 files changed, 10 insertions(+), 18 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 1d4c29f..5ab79c5 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -612,20 +612,6 @@ meta_window_actor_get_shape_bounds (MetaWindowActor *self,
MetaWindowActorPrivate *priv = self->priv;
cairo_region_get_extents (priv->shape_region, bounds);
-
-#ifdef HAVE_WAYLAND
- if (META_IS_SURFACE_ACTOR_WAYLAND (priv->surface))
- {
- MetaSurfaceActorWayland *surface_actor =
- META_SURFACE_ACTOR_WAYLAND (priv->surface);
- double scale = meta_surface_actor_wayland_get_scale (surface_actor);
-
- bounds->x *= scale;
- bounds->y *= scale;
- bounds->width *= scale;
- bounds->height *= scale;
- }
-#endif
}
static void
diff --git a/src/core/window-private.h b/src/core/window-private.h
index eb89b4c..4e187ce 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -416,8 +416,10 @@ struct _MetaWindow
*
* For X11 windows, this matches XGetGeometry of the toplevel.
*
- * For Wayland windows, this matches the buffer size and where
- * the surface actor is positioned. */
+ * For Wayland windows, the position matches the position of the
+ * surface associated with shell surface (wl_shell_surface, xdg_surface
+ * etc). The size matches the size surface size as displayed in the stage.
+ */
MetaRectangle buffer_rect;
/* Cached net_wm_icon_geometry */
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index e6038f2..e52d17f 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -361,12 +361,16 @@ void
meta_wayland_surface_apply_window_state (MetaWaylandSurface *surface,
MetaWaylandPendingState *pending)
{
+ MetaSurfaceActorWayland *actor =
+ META_SURFACE_ACTOR_WAYLAND (surface->surface_actor);
MetaWindow *window = surface->window;
MetaWaylandBuffer *buffer = surface->buffer_ref.buffer;
CoglTexture *texture = buffer->texture;
+ double scale;
- window->buffer_rect.width = cogl_texture_get_width (texture);
- window->buffer_rect.height = cogl_texture_get_height (texture);
+ scale = meta_surface_actor_wayland_get_scale (actor);
+ window->buffer_rect.width = cogl_texture_get_width (texture) * scale;
+ window->buffer_rect.height = cogl_texture_get_height (texture) * scale;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]