wayland: Fix subsurface positioning on HiDPI

Keep the active position state in its original coordinate space, and
synchronize the surface actor with it when it changes and when
synchronizing the rest of the surface state, in case the surface scale
had changed.

https://bugzilla.gnome.org/show_bug.cgi?id=745655
This commit is contained in:
Jonas Ådahl
2015-03-05 11:11:09 +08:00
parent 117f57f74c
commit 3b993131e8
4 changed files with 64 additions and 17 deletions

View File

@ -382,18 +382,13 @@ static void
subsurface_surface_commit (MetaWaylandSurface *surface,
MetaWaylandPendingState *pending)
{
MetaSurfaceActor *surface_actor = surface->surface_actor;
float x, y;
MetaSurfaceActorWayland *surface_actor =
META_SURFACE_ACTOR_WAYLAND (surface->surface_actor);
if (surface->buffer != NULL)
clutter_actor_show (CLUTTER_ACTOR (surface_actor));
else
clutter_actor_hide (CLUTTER_ACTOR (surface_actor));
clutter_actor_get_position (CLUTTER_ACTOR (surface_actor), &x, &y);
x += pending->dx;
y += pending->dy;
clutter_actor_set_position (CLUTTER_ACTOR (surface_actor), x, y);
}
/* A non-subsurface is always desynchronized.
@ -427,9 +422,8 @@ parent_surface_state_applied (gpointer data, gpointer user_data)
if (surface->sub.pending_pos)
{
clutter_actor_set_position (CLUTTER_ACTOR (surface->surface_actor),
surface->sub.pending_x,
surface->sub.pending_y);
surface->sub.x = surface->sub.pending_x;
surface->sub.y = surface->sub.pending_y;
surface->sub.pending_pos = FALSE;
}
@ -477,6 +471,9 @@ parent_surface_state_applied (gpointer data, gpointer user_data)
if (is_surface_effectively_synchronized (surface))
apply_pending_state (surface, &surface->sub.pending);
meta_surface_actor_wayland_sync_subsurface_state (
META_SURFACE_ACTOR_WAYLAND (surface->surface_actor));
}
static void
@ -522,9 +519,6 @@ apply_pending_state (MetaWaylandSurface *surface,
surface->input_region = cairo_region_reference (pending->input_region);
}
meta_surface_actor_wayland_sync_state (
META_SURFACE_ACTOR_WAYLAND (surface->surface_actor));
/* wl_surface.frame */
wl_list_insert_list (&compositor->frame_callbacks, &pending->frame_callback_list);
wl_list_init (&pending->frame_callback_list);
@ -549,6 +543,9 @@ apply_pending_state (MetaWaylandSurface *surface,
break;
}
meta_surface_actor_wayland_sync_state (
META_SURFACE_ACTOR_WAYLAND (surface->surface_actor));
pending_state_reset (pending);
g_list_foreach (surface->subsurfaces, parent_surface_state_applied, NULL);