mutter/src/backends/meta-screen-cast-window.c
Olivier Fourdan 0f58c98386 screen-cast-window: Use buffer bounds in place of frame bounds
The frame bounds as returned by `meta_window_actor_get_frame_bounds()`
would be used as cropping values when streaming a window content.

But, as its name implies, it returns the actual frame bounds, whereas we
may want to include the whole buffer, to include client side shadows for
example.

Rename the `get_frame_bounds()` API to `get_buffer_bounds()` (which was
previously partly removed with commit 11bd84789) and return the actual
buffer bounds to use as the cropping area when streaming a window.

Fixes: 931934511 - "Implement MetaScreenCastWindow interface"
https://gitlab.gnome.org/GNOME/mutter/merge_requests/1022
Closes: https://gitlab.gnome.org/GNOME/mutter/issues/1018
2020-02-11 12:59:57 +00:00

89 lines
3.8 KiB
C

/*
* Copyright (C) 2018 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
*/
#include "config.h"
#include "backends/meta-screen-cast-window.h"
G_DEFINE_INTERFACE (MetaScreenCastWindow, meta_screen_cast_window, G_TYPE_OBJECT)
static void
meta_screen_cast_window_default_init (MetaScreenCastWindowInterface *iface)
{
}
void
meta_screen_cast_window_get_buffer_bounds (MetaScreenCastWindow *screen_cast_window,
MetaRectangle *bounds)
{
META_SCREEN_CAST_WINDOW_GET_IFACE (screen_cast_window)->get_buffer_bounds (screen_cast_window,
bounds);
}
void
meta_screen_cast_window_transform_relative_position (MetaScreenCastWindow *screen_cast_window,
double x,
double y,
double *x_out,
double *y_out)
{
META_SCREEN_CAST_WINDOW_GET_IFACE (screen_cast_window)->transform_relative_position (screen_cast_window,
x,
y,
x_out,
y_out);
}
gboolean
meta_screen_cast_window_transform_cursor_position (MetaScreenCastWindow *screen_cast_window,
MetaCursorSprite *cursor_sprite,
graphene_point_t *cursor_position,
float *out_cursor_scale,
graphene_point_t *out_relative_cursor_position)
{
MetaScreenCastWindowInterface *iface =
META_SCREEN_CAST_WINDOW_GET_IFACE (screen_cast_window);
return iface->transform_cursor_position (screen_cast_window,
cursor_sprite,
cursor_position,
out_cursor_scale,
out_relative_cursor_position);
}
void
meta_screen_cast_window_capture_into (MetaScreenCastWindow *screen_cast_window,
MetaRectangle *bounds,
uint8_t *data)
{
META_SCREEN_CAST_WINDOW_GET_IFACE (screen_cast_window)->capture_into (screen_cast_window,
bounds,
data);
}
gboolean
meta_screen_cast_window_has_damage (MetaScreenCastWindow *screen_cast_window)
{
MetaScreenCastWindowInterface *iface =
META_SCREEN_CAST_WINDOW_GET_IFACE (screen_cast_window);
return iface->has_damage (screen_cast_window);
}