mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
wayland/surface: Add get_width() and get_height() helper functions
With viewporter / transformations it get's more complicated to figure out the dimensions of a surface. Bundle it in this helper- functions.
This commit is contained in:
parent
5f99eeb926
commit
ad864083f9
@ -1747,3 +1747,37 @@ meta_wayland_surface_notify_geometry_changed (MetaWaylandSurface *surface)
|
||||
{
|
||||
g_signal_emit (surface, surface_signals[SURFACE_GEOMETRY_CHANGED], 0);
|
||||
}
|
||||
|
||||
int
|
||||
meta_wayland_surface_get_width (MetaWaylandSurface *surface)
|
||||
{
|
||||
MetaWaylandBuffer *buffer;
|
||||
|
||||
buffer = surface->buffer_ref.buffer;
|
||||
if (buffer)
|
||||
{
|
||||
CoglTexture *texture = meta_wayland_buffer_get_texture (buffer);
|
||||
return cogl_texture_get_width (texture) / surface->scale;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
meta_wayland_surface_get_height (MetaWaylandSurface *surface)
|
||||
{
|
||||
MetaWaylandBuffer *buffer;
|
||||
|
||||
buffer = surface->buffer_ref.buffer;
|
||||
if (buffer)
|
||||
{
|
||||
CoglTexture *texture = meta_wayland_buffer_get_texture (buffer);
|
||||
return cogl_texture_get_height (texture) / surface->scale;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -302,4 +302,7 @@ MetaSurfaceActor * meta_wayland_surface_get_actor (MetaWaylandSurface *surface)
|
||||
|
||||
void meta_wayland_surface_notify_geometry_changed (MetaWaylandSurface *surface);
|
||||
|
||||
int meta_wayland_surface_get_width (MetaWaylandSurface *surface);
|
||||
int meta_wayland_surface_get_height (MetaWaylandSurface *surface);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user