mirror of
https://github.com/brl/mutter.git
synced 2025-02-08 17:44:09 +00:00
wayland: Add global to surface coordinate helper
https://bugzilla.gnome.org/show_bug.cgi?id=744104
This commit is contained in:
parent
5b0eabec51
commit
bc8ec2d90d
@ -924,11 +924,10 @@ meta_wayland_pointer_get_relative_coordinates (MetaWaylandPointer *pointer,
|
|||||||
ClutterPoint pos;
|
ClutterPoint pos;
|
||||||
|
|
||||||
clutter_input_device_get_coords (pointer->device, NULL, &pos);
|
clutter_input_device_get_coords (pointer->device, NULL, &pos);
|
||||||
clutter_actor_transform_stage_point (CLUTTER_ACTOR (meta_surface_actor_get_texture (surface->surface_actor)),
|
meta_wayland_surface_get_relative_coordinates (surface, pos.x, pos.y, &xf, &yf);
|
||||||
pos.x, pos.y, &xf, &yf);
|
|
||||||
|
|
||||||
*sx = wl_fixed_from_double (xf) / surface->scale;
|
*sx = wl_fixed_from_double (xf);
|
||||||
*sy = wl_fixed_from_double (yf) / surface->scale;
|
*sy = wl_fixed_from_double (yf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2417,6 +2417,21 @@ meta_wayland_surface_get_toplevel_window (MetaWaylandSurface *surface)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_wayland_surface_get_relative_coordinates (MetaWaylandSurface *surface,
|
||||||
|
float abs_x,
|
||||||
|
float abs_y,
|
||||||
|
float *sx,
|
||||||
|
float *sy)
|
||||||
|
{
|
||||||
|
ClutterActor *actor =
|
||||||
|
CLUTTER_ACTOR (meta_surface_actor_get_texture (surface->surface_actor));
|
||||||
|
|
||||||
|
clutter_actor_transform_stage_point (actor, abs_x, abs_y, sx, sy);
|
||||||
|
*sx /= surface->scale;
|
||||||
|
*sy /= surface->scale;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_wayland_surface_init (MetaWaylandSurface *surface)
|
meta_wayland_surface_init (MetaWaylandSurface *surface)
|
||||||
{
|
{
|
||||||
|
@ -253,6 +253,12 @@ void meta_wayland_surface_queue_pending_frame_callbacks (MetaWayl
|
|||||||
void meta_wayland_surface_queue_pending_state_frame_callbacks (MetaWaylandSurface *surface,
|
void meta_wayland_surface_queue_pending_state_frame_callbacks (MetaWaylandSurface *surface,
|
||||||
MetaWaylandPendingState *pending);
|
MetaWaylandPendingState *pending);
|
||||||
|
|
||||||
|
void meta_wayland_surface_get_relative_coordinates (MetaWaylandSurface *surface,
|
||||||
|
float abs_x,
|
||||||
|
float abs_y,
|
||||||
|
float *sx,
|
||||||
|
float *sy);
|
||||||
|
|
||||||
MetaWaylandSurface * meta_wayland_surface_role_get_surface (MetaWaylandSurfaceRole *role);
|
MetaWaylandSurface * meta_wayland_surface_role_get_surface (MetaWaylandSurfaceRole *role);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user