mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
screen-cast: Implement MetaEisViewport in all stream types
This will be used to describe a eis_region in a eis_device. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3228>
This commit is contained in:
parent
7faac2aef4
commit
d4559a9ca4
@ -20,6 +20,7 @@
|
||||
|
||||
#include "backends/meta-screen-cast-area-stream.h"
|
||||
|
||||
#include "backends/meta-eis.h"
|
||||
#include "backends/meta-screen-cast-area-stream-src.h"
|
||||
|
||||
struct _MetaScreenCastAreaStream
|
||||
@ -32,9 +33,13 @@ struct _MetaScreenCastAreaStream
|
||||
float scale;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaScreenCastAreaStream,
|
||||
meta_screen_cast_area_stream,
|
||||
META_TYPE_SCREEN_CAST_STREAM)
|
||||
static void meta_eis_viewport_iface_init (MetaEisViewportInterface *eis_viewport_iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (MetaScreenCastAreaStream,
|
||||
meta_screen_cast_area_stream,
|
||||
META_TYPE_SCREEN_CAST_STREAM,
|
||||
G_IMPLEMENT_INTERFACE (META_TYPE_EIS_VIEWPORT,
|
||||
meta_eis_viewport_iface_init))
|
||||
|
||||
ClutterStage *
|
||||
meta_screen_cast_area_stream_get_stage (MetaScreenCastAreaStream *area_stream)
|
||||
@ -116,6 +121,85 @@ meta_screen_cast_area_stream_new (MetaScreenCastSession *session,
|
||||
return area_stream;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_screen_cast_area_stream_is_standalone (MetaEisViewport *viewport)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const char *
|
||||
meta_screen_cast_area_stream_get_mapping_id (MetaEisViewport *viewport)
|
||||
{
|
||||
MetaScreenCastStream *stream = META_SCREEN_CAST_STREAM (viewport);
|
||||
|
||||
return meta_screen_cast_stream_get_mapping_id (stream);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_screen_cast_area_stream_get_position (MetaEisViewport *viewport,
|
||||
int *out_x,
|
||||
int *out_y)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_screen_cast_area_stream_get_size (MetaEisViewport *viewport,
|
||||
int *out_width,
|
||||
int *out_height)
|
||||
{
|
||||
MetaScreenCastAreaStream *area_stream =
|
||||
META_SCREEN_CAST_AREA_STREAM (viewport);
|
||||
|
||||
*out_width = (int) roundf (area_stream->area.width * area_stream->scale);
|
||||
*out_height = (int) roundf (area_stream->area.height * area_stream->scale);
|
||||
}
|
||||
|
||||
static double
|
||||
meta_screen_cast_area_stream_get_physical_scale (MetaEisViewport *viewport)
|
||||
{
|
||||
MetaScreenCastAreaStream *area_stream =
|
||||
META_SCREEN_CAST_AREA_STREAM (viewport);
|
||||
|
||||
return area_stream->scale;
|
||||
}
|
||||
|
||||
static void
|
||||
transform_position (MetaScreenCastAreaStream *area_stream,
|
||||
double x,
|
||||
double y,
|
||||
double *out_x,
|
||||
double *out_y)
|
||||
{
|
||||
*out_x = area_stream->area.x + (int) roundf (x / area_stream->scale);
|
||||
*out_y = area_stream->area.y + (int) roundf (y / area_stream->scale);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_screen_cast_area_stream_transform_coordinate (MetaEisViewport *viewport,
|
||||
double x,
|
||||
double y,
|
||||
double *out_x,
|
||||
double *out_y)
|
||||
{
|
||||
MetaScreenCastAreaStream *area_stream =
|
||||
META_SCREEN_CAST_AREA_STREAM (viewport);
|
||||
|
||||
transform_position (area_stream, x, y, out_x, out_y);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_eis_viewport_iface_init (MetaEisViewportInterface *eis_viewport_iface)
|
||||
{
|
||||
eis_viewport_iface->is_standalone = meta_screen_cast_area_stream_is_standalone;
|
||||
eis_viewport_iface->get_mapping_id = meta_screen_cast_area_stream_get_mapping_id;
|
||||
eis_viewport_iface->get_position = meta_screen_cast_area_stream_get_position;
|
||||
eis_viewport_iface->get_size = meta_screen_cast_area_stream_get_size;
|
||||
eis_viewport_iface->get_physical_scale = meta_screen_cast_area_stream_get_physical_scale;
|
||||
eis_viewport_iface->transform_coordinate = meta_screen_cast_area_stream_transform_coordinate;
|
||||
}
|
||||
|
||||
static MetaScreenCastStreamSrc *
|
||||
meta_screen_cast_area_stream_create_src (MetaScreenCastStream *stream,
|
||||
GError **error)
|
||||
@ -156,8 +240,7 @@ meta_screen_cast_area_stream_transform_position (MetaScreenCastStream *stream,
|
||||
MetaScreenCastAreaStream *area_stream =
|
||||
META_SCREEN_CAST_AREA_STREAM (stream);
|
||||
|
||||
*x = area_stream->area.x + (int) roundf (stream_x / area_stream->scale);
|
||||
*y = area_stream->area.y + (int) roundf (stream_y / area_stream->scale);
|
||||
transform_position (area_stream, stream_x, stream_y, x, y);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "backends/meta-screen-cast-monitor-stream.h"
|
||||
|
||||
#include "backends/meta-eis.h"
|
||||
#include "backends/meta-logical-monitor.h"
|
||||
#include "backends/meta-screen-cast-monitor-stream-src.h"
|
||||
|
||||
@ -42,9 +43,13 @@ struct _MetaScreenCastMonitorStream
|
||||
MetaLogicalMonitor *logical_monitor;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaScreenCastMonitorStream,
|
||||
meta_screen_cast_monitor_stream,
|
||||
META_TYPE_SCREEN_CAST_STREAM)
|
||||
static void meta_eis_viewport_iface_init (MetaEisViewportInterface *eis_viewport_iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (MetaScreenCastMonitorStream,
|
||||
meta_screen_cast_monitor_stream,
|
||||
META_TYPE_SCREEN_CAST_STREAM,
|
||||
G_IMPLEMENT_INTERFACE (META_TYPE_EIS_VIEWPORT,
|
||||
meta_eis_viewport_iface_init))
|
||||
|
||||
static gboolean
|
||||
update_monitor (MetaScreenCastMonitorStream *monitor_stream,
|
||||
@ -214,6 +219,81 @@ meta_screen_cast_monitor_stream_transform_position (MetaScreenCastStream *stream
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_screen_cast_monitor_stream_is_standalone (MetaEisViewport *viewport)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static const char *
|
||||
meta_screen_cast_monitor_stream_get_mapping_id (MetaEisViewport *viewport)
|
||||
{
|
||||
MetaScreenCastStream *stream = META_SCREEN_CAST_STREAM (viewport);
|
||||
|
||||
return meta_screen_cast_stream_get_mapping_id (stream);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_screen_cast_monitor_stream_get_position (MetaEisViewport *viewport,
|
||||
int *out_x,
|
||||
int *out_y)
|
||||
{
|
||||
MetaScreenCastMonitorStream *monitor_stream =
|
||||
META_SCREEN_CAST_MONITOR_STREAM (viewport);
|
||||
MtkRectangle layout;
|
||||
|
||||
layout = meta_logical_monitor_get_layout (monitor_stream->logical_monitor);
|
||||
*out_x = layout.x;
|
||||
*out_y = layout.y;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_screen_cast_monitor_stream_get_size (MetaEisViewport *viewport,
|
||||
int *out_width,
|
||||
int *out_height)
|
||||
{
|
||||
MetaScreenCastMonitorStream *monitor_stream =
|
||||
META_SCREEN_CAST_MONITOR_STREAM (viewport);
|
||||
MtkRectangle layout;
|
||||
|
||||
layout = meta_logical_monitor_get_layout (monitor_stream->logical_monitor);
|
||||
*out_width = layout.width;
|
||||
*out_height = layout.height;
|
||||
}
|
||||
|
||||
static double
|
||||
meta_screen_cast_monitor_stream_get_physical_scale (MetaEisViewport *viewport)
|
||||
{
|
||||
MetaScreenCastMonitorStream *monitor_stream =
|
||||
META_SCREEN_CAST_MONITOR_STREAM (viewport);
|
||||
|
||||
return meta_logical_monitor_get_scale (monitor_stream->logical_monitor);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_screen_cast_monitor_stream_transform_coordinate (MetaEisViewport *viewport,
|
||||
double x,
|
||||
double y,
|
||||
double *out_x,
|
||||
double *out_y)
|
||||
{
|
||||
*out_x = x;
|
||||
*out_y = y;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_eis_viewport_iface_init (MetaEisViewportInterface *eis_viewport_iface)
|
||||
{
|
||||
eis_viewport_iface->is_standalone = meta_screen_cast_monitor_stream_is_standalone;
|
||||
eis_viewport_iface->get_mapping_id = meta_screen_cast_monitor_stream_get_mapping_id;
|
||||
eis_viewport_iface->get_position = meta_screen_cast_monitor_stream_get_position;
|
||||
eis_viewport_iface->get_size = meta_screen_cast_monitor_stream_get_size;
|
||||
eis_viewport_iface->get_physical_scale = meta_screen_cast_monitor_stream_get_physical_scale;
|
||||
eis_viewport_iface->transform_coordinate = meta_screen_cast_monitor_stream_transform_coordinate;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_screen_cast_monitor_stream_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "backends/meta-screen-cast-stream.h"
|
||||
|
||||
#include "backends/meta-remote-desktop-session.h"
|
||||
#include "backends/meta-screen-cast-session.h"
|
||||
|
||||
#include "meta-private-enum-types.h"
|
||||
@ -59,6 +60,8 @@ typedef struct _MetaScreenCastStreamPrivate
|
||||
MetaScreenCastFlag flags;
|
||||
|
||||
MetaScreenCastStreamSrc *src;
|
||||
|
||||
char *mapping_id;
|
||||
} MetaScreenCastStreamPrivate;
|
||||
|
||||
static void
|
||||
@ -217,6 +220,15 @@ meta_screen_cast_stream_get_flags (MetaScreenCastStream *stream)
|
||||
return priv->flags;
|
||||
}
|
||||
|
||||
const char *
|
||||
meta_screen_cast_stream_get_mapping_id (MetaScreenCastStream *stream)
|
||||
{
|
||||
MetaScreenCastStreamPrivate *priv =
|
||||
meta_screen_cast_stream_get_instance_private (stream);
|
||||
|
||||
return priv->mapping_id;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_screen_cast_stream_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
@ -286,6 +298,7 @@ meta_screen_cast_stream_finalize (GObject *object)
|
||||
meta_screen_cast_stream_close (stream);
|
||||
|
||||
g_clear_pointer (&priv->object_path, g_free);
|
||||
g_clear_pointer (&priv->mapping_id, g_free);
|
||||
|
||||
G_OBJECT_CLASS (meta_screen_cast_stream_parent_class)->finalize (object);
|
||||
}
|
||||
@ -358,6 +371,7 @@ meta_screen_cast_stream_initable_init (GInitable *initable,
|
||||
MetaDBusScreenCastStream *skeleton = META_DBUS_SCREEN_CAST_STREAM (stream);
|
||||
MetaScreenCastStreamPrivate *priv =
|
||||
meta_screen_cast_stream_get_instance_private (stream);
|
||||
MetaRemoteDesktopSession *remote_desktop_session;
|
||||
GVariantBuilder parameters_builder;
|
||||
GVariant *parameters_variant;
|
||||
static unsigned int global_stream_number = 0;
|
||||
@ -365,6 +379,20 @@ meta_screen_cast_stream_initable_init (GInitable *initable,
|
||||
g_variant_builder_init (¶meters_builder, G_VARIANT_TYPE_VARDICT);
|
||||
meta_screen_cast_stream_set_parameters (stream, ¶meters_builder);
|
||||
|
||||
remote_desktop_session =
|
||||
meta_screen_cast_session_get_remote_desktop_session (priv->session);
|
||||
if (remote_desktop_session)
|
||||
{
|
||||
const char *mapping_id;
|
||||
|
||||
mapping_id =
|
||||
meta_remote_desktop_session_acquire_mapping_id (remote_desktop_session);
|
||||
priv->mapping_id = g_strdup (mapping_id);
|
||||
g_variant_builder_add (¶meters_builder, "{sv}",
|
||||
"mapping-id",
|
||||
g_variant_new ("s", priv->mapping_id));
|
||||
}
|
||||
|
||||
parameters_variant = g_variant_builder_end (¶meters_builder);
|
||||
meta_dbus_screen_cast_stream_set_parameters (skeleton, parameters_variant);
|
||||
|
||||
|
@ -68,3 +68,4 @@ MetaScreenCastCursorMode meta_screen_cast_stream_get_cursor_mode (MetaScreenCast
|
||||
|
||||
MetaScreenCastFlag meta_screen_cast_stream_get_flags (MetaScreenCastStream *stream);
|
||||
|
||||
const char * meta_screen_cast_stream_get_mapping_id (MetaScreenCastStream *stream);
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
#include "backends/meta-crtc-mode.h"
|
||||
#include "backends/meta-cursor-tracker-private.h"
|
||||
#include "backends/meta-monitor.h"
|
||||
#include "backends/meta-output.h"
|
||||
#include "backends/meta-screen-cast-session.h"
|
||||
#include "backends/meta-stage-private.h"
|
||||
#include "backends/meta-virtual-monitor.h"
|
||||
@ -108,6 +110,16 @@ meta_screen_cast_virtual_stream_src_get_view (MetaScreenCastVirtualStreamSrc *vi
|
||||
return view_from_src (META_SCREEN_CAST_STREAM_SRC (virtual_src));
|
||||
}
|
||||
|
||||
MetaLogicalMonitor *
|
||||
meta_screen_cast_virtual_stream_src_logical_monitor (MetaScreenCastVirtualStreamSrc *virtual_src)
|
||||
{
|
||||
MetaVirtualMonitor *virtual_monitor = virtual_src->virtual_monitor;
|
||||
MetaOutput *output = meta_virtual_monitor_get_output (virtual_monitor);
|
||||
MetaMonitor *monitor = meta_output_get_monitor (output);
|
||||
|
||||
return meta_monitor_get_logical_monitor (monitor);
|
||||
}
|
||||
|
||||
static void
|
||||
sync_cursor_state (MetaScreenCastVirtualStreamSrc *virtual_src)
|
||||
{
|
||||
|
@ -31,3 +31,5 @@ MetaScreenCastVirtualStreamSrc * meta_screen_cast_virtual_stream_src_new (MetaSc
|
||||
GError **error);
|
||||
|
||||
ClutterStageView * meta_screen_cast_virtual_stream_src_get_view (MetaScreenCastVirtualStreamSrc *virtual_src);
|
||||
|
||||
MetaLogicalMonitor * meta_screen_cast_virtual_stream_src_logical_monitor (MetaScreenCastVirtualStreamSrc *virtual_src);
|
||||
|
@ -20,18 +20,23 @@
|
||||
|
||||
#include "backends/meta-screen-cast-virtual-stream.h"
|
||||
|
||||
#include "backends/meta-eis.h"
|
||||
#include "backends/meta-logical-monitor.h"
|
||||
#include "backends/meta-screen-cast-virtual-stream-src.h"
|
||||
#include "backends/meta-virtual-monitor.h"
|
||||
|
||||
|
||||
struct _MetaScreenCastVirtualStream
|
||||
{
|
||||
MetaScreenCastStream parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaScreenCastVirtualStream,
|
||||
meta_screen_cast_virtual_stream,
|
||||
META_TYPE_SCREEN_CAST_STREAM)
|
||||
static void meta_eis_viewport_iface_init (MetaEisViewportInterface *eis_viewport_iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (MetaScreenCastVirtualStream,
|
||||
meta_screen_cast_virtual_stream,
|
||||
META_TYPE_SCREEN_CAST_STREAM,
|
||||
G_IMPLEMENT_INTERFACE (META_TYPE_EIS_VIEWPORT,
|
||||
meta_eis_viewport_iface_init))
|
||||
|
||||
MetaScreenCastVirtualStream *
|
||||
meta_screen_cast_virtual_stream_new (MetaScreenCastSession *session,
|
||||
@ -56,6 +61,99 @@ meta_screen_cast_virtual_stream_new (MetaScreenCastSession *session,
|
||||
return virtual_stream;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_screen_cast_virtual_stream_is_standalone (MetaEisViewport *viewport)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static const char *
|
||||
meta_screen_cast_virtual_stream_get_mapping_id (MetaEisViewport *viewport)
|
||||
{
|
||||
MetaScreenCastStream *stream = META_SCREEN_CAST_STREAM (viewport);
|
||||
|
||||
return meta_screen_cast_stream_get_mapping_id (stream);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_screen_cast_virtual_stream_get_position (MetaEisViewport *viewport,
|
||||
int *out_x,
|
||||
int *out_y)
|
||||
{
|
||||
MetaScreenCastVirtualStream *virtual_stream =
|
||||
META_SCREEN_CAST_VIRTUAL_STREAM (viewport);
|
||||
MetaScreenCastStream *stream = META_SCREEN_CAST_STREAM (virtual_stream);
|
||||
MetaScreenCastStreamSrc *src = meta_screen_cast_stream_get_src (stream);
|
||||
MetaScreenCastVirtualStreamSrc *virtual_src =
|
||||
META_SCREEN_CAST_VIRTUAL_STREAM_SRC (src);
|
||||
MetaLogicalMonitor *logical_monitor =
|
||||
meta_screen_cast_virtual_stream_src_logical_monitor (virtual_src);
|
||||
MtkRectangle layout;
|
||||
|
||||
layout = meta_logical_monitor_get_layout (logical_monitor);
|
||||
*out_x = layout.x;
|
||||
*out_y = layout.y;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_screen_cast_virtual_stream_get_size (MetaEisViewport *viewport,
|
||||
int *out_width,
|
||||
int *out_height)
|
||||
{
|
||||
MetaScreenCastVirtualStream *virtual_stream =
|
||||
META_SCREEN_CAST_VIRTUAL_STREAM (viewport);
|
||||
MetaScreenCastStream *stream = META_SCREEN_CAST_STREAM (virtual_stream);
|
||||
MetaScreenCastStreamSrc *src = meta_screen_cast_stream_get_src (stream);
|
||||
MetaScreenCastVirtualStreamSrc *virtual_src =
|
||||
META_SCREEN_CAST_VIRTUAL_STREAM_SRC (src);
|
||||
MetaLogicalMonitor *logical_monitor =
|
||||
meta_screen_cast_virtual_stream_src_logical_monitor (virtual_src);
|
||||
MtkRectangle layout;
|
||||
|
||||
layout = meta_logical_monitor_get_layout (logical_monitor);
|
||||
*out_width = layout.width;
|
||||
*out_height = layout.height;
|
||||
}
|
||||
|
||||
static double
|
||||
meta_screen_cast_virtual_stream_get_physical_scale (MetaEisViewport *viewport)
|
||||
{
|
||||
MetaScreenCastVirtualStream *virtual_stream =
|
||||
META_SCREEN_CAST_VIRTUAL_STREAM (viewport);
|
||||
MetaScreenCastStream *stream = META_SCREEN_CAST_STREAM (virtual_stream);
|
||||
MetaScreenCastStreamSrc *src = meta_screen_cast_stream_get_src (stream);
|
||||
MetaScreenCastVirtualStreamSrc *virtual_src =
|
||||
META_SCREEN_CAST_VIRTUAL_STREAM_SRC (src);
|
||||
MetaLogicalMonitor *logical_monitor =
|
||||
meta_screen_cast_virtual_stream_src_logical_monitor (virtual_src);
|
||||
|
||||
return meta_logical_monitor_get_scale (logical_monitor);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_screen_cast_virtual_stream_transform_coordinate (MetaEisViewport *viewport,
|
||||
double x,
|
||||
double y,
|
||||
double *out_x,
|
||||
double *out_y)
|
||||
{
|
||||
*out_x = x;
|
||||
*out_y = y;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_eis_viewport_iface_init (MetaEisViewportInterface *eis_viewport_iface)
|
||||
{
|
||||
eis_viewport_iface->is_standalone = meta_screen_cast_virtual_stream_is_standalone;
|
||||
eis_viewport_iface->get_mapping_id = meta_screen_cast_virtual_stream_get_mapping_id;
|
||||
eis_viewport_iface->get_position = meta_screen_cast_virtual_stream_get_position;
|
||||
eis_viewport_iface->get_size = meta_screen_cast_virtual_stream_get_size;
|
||||
eis_viewport_iface->get_physical_scale = meta_screen_cast_virtual_stream_get_physical_scale;
|
||||
eis_viewport_iface->transform_coordinate = meta_screen_cast_virtual_stream_transform_coordinate;
|
||||
}
|
||||
|
||||
static MetaScreenCastStreamSrc *
|
||||
meta_screen_cast_virtual_stream_create_src (MetaScreenCastStream *stream,
|
||||
GError **error)
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "backends/meta-screen-cast-window-stream.h"
|
||||
|
||||
#include "backends/meta-eis.h"
|
||||
#include "backends/meta-logical-monitor.h"
|
||||
#include "backends/meta-monitor-manager-private.h"
|
||||
#include "backends/meta-screen-cast-session.h"
|
||||
@ -54,11 +55,15 @@ static GInitableIface *initable_parent_iface;
|
||||
static void
|
||||
meta_screen_cast_window_stream_init_initable_iface (GInitableIface *iface);
|
||||
|
||||
static void meta_eis_viewport_iface_init (MetaEisViewportInterface *eis_viewport_iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (MetaScreenCastWindowStream,
|
||||
meta_screen_cast_window_stream,
|
||||
META_TYPE_SCREEN_CAST_STREAM,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
|
||||
meta_screen_cast_window_stream_init_initable_iface))
|
||||
meta_screen_cast_window_stream_init_initable_iface)
|
||||
G_IMPLEMENT_INTERFACE (META_TYPE_EIS_VIEWPORT,
|
||||
meta_eis_viewport_iface_init))
|
||||
|
||||
MetaWindow *
|
||||
meta_screen_cast_window_stream_get_window (MetaScreenCastWindowStream *window_stream)
|
||||
@ -271,6 +276,77 @@ meta_screen_cast_window_stream_init_initable_iface (GInitableIface *iface)
|
||||
iface->init = meta_screen_cast_window_stream_initable_init;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_screen_cast_window_stream_is_standalone (MetaEisViewport *viewport)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const char *
|
||||
meta_screen_cast_window_stream_get_mapping_id (MetaEisViewport *viewport)
|
||||
{
|
||||
MetaScreenCastStream *stream = META_SCREEN_CAST_STREAM (viewport);
|
||||
|
||||
return meta_screen_cast_stream_get_mapping_id (stream);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_screen_cast_window_stream_get_position (MetaEisViewport *viewport,
|
||||
int *out_x,
|
||||
int *out_y)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_screen_cast_window_stream_get_size (MetaEisViewport *viewport,
|
||||
int *out_width,
|
||||
int *out_height)
|
||||
{
|
||||
MetaScreenCastWindowStream *window_stream =
|
||||
META_SCREEN_CAST_WINDOW_STREAM (viewport);
|
||||
|
||||
*out_width = window_stream->stream_width;
|
||||
*out_height = window_stream->stream_height;
|
||||
}
|
||||
|
||||
static double
|
||||
meta_screen_cast_window_stream_get_physical_scale (MetaEisViewport *viewport)
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_screen_cast_window_stream_transform_coordinate (MetaEisViewport *viewport,
|
||||
double x,
|
||||
double y,
|
||||
double *out_x,
|
||||
double *out_y)
|
||||
{
|
||||
MetaScreenCastWindowStream *window_stream =
|
||||
META_SCREEN_CAST_WINDOW_STREAM (viewport);
|
||||
MetaScreenCastWindow *screen_cast_window =
|
||||
META_SCREEN_CAST_WINDOW (meta_window_actor_from_window (window_stream->window));
|
||||
|
||||
meta_screen_cast_window_transform_relative_position (screen_cast_window,
|
||||
x,
|
||||
y,
|
||||
out_x,
|
||||
out_y);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_eis_viewport_iface_init (MetaEisViewportInterface *eis_viewport_iface)
|
||||
{
|
||||
eis_viewport_iface->is_standalone = meta_screen_cast_window_stream_is_standalone;
|
||||
eis_viewport_iface->get_mapping_id = meta_screen_cast_window_stream_get_mapping_id;
|
||||
eis_viewport_iface->get_position = meta_screen_cast_window_stream_get_position;
|
||||
eis_viewport_iface->get_size = meta_screen_cast_window_stream_get_size;
|
||||
eis_viewport_iface->get_physical_scale = meta_screen_cast_window_stream_get_physical_scale;
|
||||
eis_viewport_iface->transform_coordinate = meta_screen_cast_window_stream_transform_coordinate;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_screen_cast_window_stream_init (MetaScreenCastWindowStream *window_stream)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user