[mutter] wayland: Calculate the window geometry based on all subsurfaces
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland: Calculate the window geometry based on all subsurfaces
- Date: Thu, 17 Jul 2014 20:22:09 +0000 (UTC)
commit b5f46c9171f467b487b0e7345e72384e83c99821
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Jul 17 15:24:06 2014 -0400
wayland: Calculate the window geometry based on all subsurfaces
Not just the main surface.
src/wayland/meta-wayland-surface.c | 40 +++++++++++++++++++++++++++++++----
src/wayland/window-wayland.c | 17 +++++++++------
src/wayland/window-wayland.h | 9 +++----
3 files changed, 49 insertions(+), 17 deletions(-)
---
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index a091d51..9fdb647 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -163,6 +163,38 @@ cursor_surface_commit (MetaWaylandSurface *surface,
}
static void
+calculate_surface_window_geometry (MetaWaylandSurface *surface,
+ MetaRectangle *total_geometry,
+ float parent_x,
+ float parent_y)
+{
+ ClutterActor *surface_actor = CLUTTER_ACTOR (surface->surface_actor);
+ MetaRectangle geom;
+ float x, y;
+ GList *l;
+
+ /* Unmapped surfaces don't count. */
+ if (!CLUTTER_ACTOR_IS_VISIBLE (surface_actor))
+ return;
+
+ /* XXX: Is there a better way to do this using Clutter APIs? */
+ clutter_actor_get_position (surface_actor, &x, &y);
+
+ geom.x = parent_x + x;
+ geom.y = parent_x + y;
+ geom.width = cogl_texture_get_width (surface->buffer->texture);
+ geom.height = cogl_texture_get_height (surface->buffer->texture);
+
+ meta_rectangle_union (total_geometry, &geom, total_geometry);
+
+ for (l = surface->subsurfaces; l != NULL; l = l->next)
+ {
+ MetaWaylandSurface *subsurface = l->data;
+ calculate_surface_window_geometry (subsurface, total_geometry, x, y);
+ }
+}
+
+static void
toplevel_surface_commit (MetaWaylandSurface *surface,
MetaWaylandPendingState *pending)
{
@@ -183,12 +215,10 @@ toplevel_surface_commit (MetaWaylandSurface *surface,
/* We resize X based surfaces according to X events */
if (window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
{
- int new_width, new_height;
-
- new_width = cogl_texture_get_width (surface->buffer->texture);
- new_height = cogl_texture_get_height (surface->buffer->texture);
+ MetaRectangle geom;
- meta_window_wayland_move_resize (window, new_width, new_height, pending->dx, pending->dy);
+ calculate_surface_window_geometry (surface, &geom, 0, 0);
+ meta_window_wayland_move_resize (window, geom, pending->dx, pending->dy);
}
}
diff --git a/src/wayland/window-wayland.c b/src/wayland/window-wayland.c
index 3fca40b..8b512b3 100644
--- a/src/wayland/window-wayland.c
+++ b/src/wayland/window-wayland.c
@@ -337,17 +337,20 @@ meta_window_wayland_new (MetaDisplay *display,
* Complete a resize operation from a wayland client.
*/
void
-meta_window_wayland_move_resize (MetaWindow *window,
- int width,
- int height,
- int dx,
- int dy)
+meta_window_wayland_move_resize (MetaWindow *window,
+ MetaRectangle new_geom,
+ int dx,
+ int dy)
{
MetaWindowWayland *wl_window = META_WINDOW_WAYLAND (window);
int gravity;
MetaRectangle rect;
MetaMoveResizeFlags flags;
+ /* XXX: Find a better place to store the window geometry offsets. */
+ window->custom_frame_extents.left = -new_geom.x;
+ window->custom_frame_extents.top = -new_geom.y;
+
flags = META_IS_WAYLAND_RESIZE;
/* x/y are ignored when we're doing interactive resizing */
@@ -373,8 +376,8 @@ meta_window_wayland_move_resize (MetaWindow *window,
}
}
- rect.width = width;
- rect.height = height;
+ rect.width = new_geom.width;
+ rect.height = new_geom.height;
if (rect.width != window->rect.width || rect.height != window->rect.height)
flags |= META_IS_RESIZE_ACTION;
diff --git a/src/wayland/window-wayland.h b/src/wayland/window-wayland.h
index 1eb9200..3c32685 100644
--- a/src/wayland/window-wayland.h
+++ b/src/wayland/window-wayland.h
@@ -45,10 +45,9 @@ typedef struct _MetaWindowWaylandClass MetaWindowWaylandClass;
MetaWindow * meta_window_wayland_new (MetaDisplay *display,
MetaWaylandSurface *surface);
-void meta_window_wayland_move_resize (MetaWindow *window,
- int width,
- int height,
- int dx,
- int dy);
+void meta_window_wayland_move_resize (MetaWindow *window,
+ MetaRectangle new_geom,
+ int dx,
+ int dy);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]