mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
wayland: Abstract access to the actor corresponding to a wl_surface
The actor itself will be shuffled around, abstract all external access to it behind a function to make that easier later on.
This commit is contained in:
parent
44502be560
commit
70036429bd
@ -450,7 +450,7 @@ meta_window_actor_update_surface (MetaWindowActor *self)
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
if (window->surface)
|
||||
surface_actor = window->surface->surface_actor;
|
||||
surface_actor = meta_wayland_surface_get_actor (window->surface);
|
||||
else
|
||||
#endif
|
||||
if (!meta_is_wayland_compositor ())
|
||||
|
@ -699,12 +699,12 @@ meta_pointer_confinement_wayland_new (MetaWaylandPointerConstraint *constraint)
|
||||
confinement->constraint = constraint;
|
||||
|
||||
surface = meta_wayland_pointer_constraint_get_surface (constraint);
|
||||
g_signal_connect_object (surface->surface_actor,
|
||||
g_signal_connect_object (meta_wayland_surface_get_actor (surface),
|
||||
"notify::allocation",
|
||||
G_CALLBACK (surface_actor_allocation_notify),
|
||||
confinement,
|
||||
0);
|
||||
g_signal_connect_object (surface->surface_actor,
|
||||
g_signal_connect_object (meta_wayland_surface_get_actor (surface),
|
||||
"notify::position",
|
||||
G_CALLBACK (surface_actor_position_notify),
|
||||
confinement,
|
||||
|
@ -1083,6 +1083,7 @@ meta_wayland_data_device_start_drag (MetaWaylandDataDevice *data
|
||||
MetaWaylandDragGrab *drag_grab;
|
||||
ClutterPoint pos, surface_pos;
|
||||
ClutterModifierType modifiers;
|
||||
MetaSurfaceActor *surface_actor;
|
||||
|
||||
data_device->current_grab = drag_grab = g_slice_new0 (MetaWaylandDragGrab);
|
||||
|
||||
@ -1100,7 +1101,9 @@ meta_wayland_data_device_start_drag (MetaWaylandDataDevice *data
|
||||
wl_resource_add_destroy_listener (surface->resource,
|
||||
&drag_grab->drag_origin_listener);
|
||||
|
||||
clutter_actor_transform_stage_point (CLUTTER_ACTOR (meta_surface_actor_get_texture (surface->surface_actor)),
|
||||
surface_actor = meta_wayland_surface_get_actor (surface);
|
||||
|
||||
clutter_actor_transform_stage_point (CLUTTER_ACTOR (meta_surface_actor_get_texture (surface_actor)),
|
||||
seat->pointer->grab_x,
|
||||
seat->pointer->grab_y,
|
||||
&surface_pos.x, &surface_pos.y);
|
||||
@ -1121,19 +1124,22 @@ meta_wayland_data_device_start_drag (MetaWaylandDataDevice *data
|
||||
|
||||
if (icon_surface)
|
||||
{
|
||||
ClutterActor *drag_origin_actor;
|
||||
|
||||
drag_grab->drag_surface = icon_surface;
|
||||
|
||||
drag_grab->drag_icon_listener.notify = destroy_data_device_icon;
|
||||
wl_resource_add_destroy_listener (icon_surface->resource,
|
||||
&drag_grab->drag_icon_listener);
|
||||
|
||||
drag_grab->feedback_actor = meta_dnd_actor_new (CLUTTER_ACTOR (drag_grab->drag_origin->surface_actor),
|
||||
drag_origin_actor = CLUTTER_ACTOR (meta_wayland_surface_get_actor (drag_grab->drag_origin));
|
||||
|
||||
drag_grab->feedback_actor = meta_dnd_actor_new (drag_origin_actor,
|
||||
drag_grab->drag_start_x,
|
||||
drag_grab->drag_start_y);
|
||||
meta_feedback_actor_set_anchor (META_FEEDBACK_ACTOR (drag_grab->feedback_actor),
|
||||
0, 0);
|
||||
clutter_actor_add_child (drag_grab->feedback_actor,
|
||||
CLUTTER_ACTOR (drag_grab->drag_surface->surface_actor));
|
||||
clutter_actor_add_child (drag_grab->feedback_actor, drag_origin_actor);
|
||||
|
||||
clutter_input_device_get_coords (seat->pointer->device, NULL, &pos);
|
||||
meta_feedback_actor_set_position (META_FEEDBACK_ACTOR (drag_grab->feedback_actor),
|
||||
|
@ -54,7 +54,7 @@ G_DEFINE_TYPE (MetaWaylandSubsurface,
|
||||
static void
|
||||
sync_actor_subsurface_state (MetaWaylandSurface *surface)
|
||||
{
|
||||
ClutterActor *actor = CLUTTER_ACTOR (surface->surface_actor);
|
||||
ClutterActor *actor = CLUTTER_ACTOR (meta_wayland_surface_get_actor (surface));
|
||||
MetaWindow *toplevel_window;
|
||||
int geometry_scale;
|
||||
int x, y;
|
||||
@ -99,8 +99,8 @@ meta_wayland_subsurface_parent_state_applied (MetaWaylandSubsurface *subsurface)
|
||||
GSList *it;
|
||||
MetaWaylandSurface *parent = surface->sub.parent;
|
||||
ClutterActor *parent_actor =
|
||||
clutter_actor_get_parent (CLUTTER_ACTOR (parent->surface_actor));
|
||||
ClutterActor *surface_actor = CLUTTER_ACTOR (surface->surface_actor);
|
||||
clutter_actor_get_parent (CLUTTER_ACTOR (meta_wayland_surface_get_actor (parent)));
|
||||
ClutterActor *surface_actor = CLUTTER_ACTOR (meta_wayland_surface_get_actor (surface));
|
||||
|
||||
for (it = surface->sub.pending_placement_ops; it; it = it->next)
|
||||
{
|
||||
@ -113,7 +113,7 @@ meta_wayland_subsurface_parent_state_applied (MetaWaylandSubsurface *subsurface)
|
||||
continue;
|
||||
}
|
||||
|
||||
sibling_actor = CLUTTER_ACTOR (op->sibling->surface_actor);
|
||||
sibling_actor = CLUTTER_ACTOR (meta_wayland_surface_get_actor (op->sibling));
|
||||
|
||||
switch (op->placement)
|
||||
{
|
||||
@ -234,7 +234,7 @@ meta_wayland_subsurface_class_init (MetaWaylandSubsurfaceClass *klass)
|
||||
static void
|
||||
unparent_actor (MetaWaylandSurface *surface)
|
||||
{
|
||||
ClutterActor *actor = CLUTTER_ACTOR (surface->surface_actor);
|
||||
ClutterActor *actor = CLUTTER_ACTOR (meta_wayland_surface_get_actor (surface));
|
||||
ClutterActor *parent_actor;
|
||||
|
||||
parent_actor = clutter_actor_get_parent (actor);
|
||||
@ -471,10 +471,10 @@ wl_subcompositor_get_subsurface (struct wl_client *client,
|
||||
&surface->sub.parent_destroy_listener);
|
||||
parent->subsurfaces = g_list_append (parent->subsurfaces, surface);
|
||||
|
||||
clutter_actor_add_child (CLUTTER_ACTOR (parent->surface_actor),
|
||||
CLUTTER_ACTOR (surface->surface_actor));
|
||||
clutter_actor_add_child (CLUTTER_ACTOR (meta_wayland_surface_get_actor (parent)),
|
||||
CLUTTER_ACTOR (meta_wayland_surface_get_actor (surface)));
|
||||
|
||||
clutter_actor_set_reactive (CLUTTER_ACTOR (surface->surface_actor), TRUE);
|
||||
clutter_actor_set_reactive (CLUTTER_ACTOR (meta_wayland_surface_get_actor (surface)), TRUE);
|
||||
}
|
||||
|
||||
static const struct wl_subcompositor_interface meta_wayland_subcompositor_interface = {
|
||||
|
@ -1789,3 +1789,9 @@ meta_wayland_surface_is_shortcuts_inhibited (MetaWaylandSurface *surface,
|
||||
|
||||
return g_hash_table_contains (surface->shortcut_inhibited_seats, seat);
|
||||
}
|
||||
|
||||
MetaSurfaceActor *
|
||||
meta_wayland_surface_get_actor (MetaWaylandSurface *surface)
|
||||
{
|
||||
return surface->surface_actor;
|
||||
}
|
||||
|
@ -303,4 +303,6 @@ void meta_wayland_surface_restore_shortcuts (MetaWaylandSurface *
|
||||
gboolean meta_wayland_surface_is_shortcuts_inhibited (MetaWaylandSurface *surface,
|
||||
MetaWaylandSeat *seat);
|
||||
|
||||
MetaSurfaceActor * meta_wayland_surface_get_actor (MetaWaylandSurface *surface);
|
||||
|
||||
#endif
|
||||
|
@ -632,10 +632,13 @@ meta_wayland_tablet_tool_get_relative_coordinates (MetaWaylandTabletTool *tool,
|
||||
wl_fixed_t *sx,
|
||||
wl_fixed_t *sy)
|
||||
{
|
||||
MetaSurfaceActor *surface_actor;
|
||||
float xf, yf;
|
||||
|
||||
surface_actor = meta_wayland_surface_get_actor (surface);
|
||||
|
||||
clutter_event_get_coords (event, &xf, &yf);
|
||||
clutter_actor_transform_stage_point (CLUTTER_ACTOR (meta_surface_actor_get_texture (surface->surface_actor)),
|
||||
clutter_actor_transform_stage_point (CLUTTER_ACTOR (meta_surface_actor_get_texture (surface_actor)),
|
||||
xf, yf, &xf, &yf);
|
||||
|
||||
*sx = wl_fixed_from_double (xf) / surface->scale;
|
||||
|
Loading…
Reference in New Issue
Block a user