mirror of
https://github.com/brl/mutter.git
synced 2024-11-28 02:50:41 -05:00
screen-cast-session: Add support for RecordWindow
Add support for the RecordWindow screencast method, casting the
currently focused window.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/306
(cherry picked from commit ec25f3a6b7
)
This commit is contained in:
parent
591e7c5760
commit
c60c2f997c
@ -26,9 +26,11 @@
|
|||||||
|
|
||||||
#include "backends/meta-backend-private.h"
|
#include "backends/meta-backend-private.h"
|
||||||
#include "backends/meta-dbus-session-watcher.h"
|
#include "backends/meta-dbus-session-watcher.h"
|
||||||
|
#include "backends/meta-remote-access-controller-private.h"
|
||||||
#include "backends/meta-screen-cast-monitor-stream.h"
|
#include "backends/meta-screen-cast-monitor-stream.h"
|
||||||
#include "backends/meta-screen-cast-stream.h"
|
#include "backends/meta-screen-cast-stream.h"
|
||||||
#include "backends/meta-remote-access-controller-private.h"
|
#include "backends/meta-screen-cast-window-stream.h"
|
||||||
|
#include "core/display-private.h"
|
||||||
|
|
||||||
#define META_SCREEN_CAST_SESSION_DBUS_PATH "/org/gnome/Mutter/ScreenCast/Session"
|
#define META_SCREEN_CAST_SESSION_DBUS_PATH "/org/gnome/Mutter/ScreenCast/Session"
|
||||||
|
|
||||||
@ -333,6 +335,14 @@ handle_record_window (MetaDBusScreenCastSession *skeleton,
|
|||||||
GVariant *properties_variant)
|
GVariant *properties_variant)
|
||||||
{
|
{
|
||||||
MetaScreenCastSession *session = META_SCREEN_CAST_SESSION (skeleton);
|
MetaScreenCastSession *session = META_SCREEN_CAST_SESSION (skeleton);
|
||||||
|
GDBusInterfaceSkeleton *interface_skeleton;
|
||||||
|
GDBusConnection *connection;
|
||||||
|
MetaWindow *window;
|
||||||
|
GError *error = NULL;
|
||||||
|
MetaDisplay *display;
|
||||||
|
MetaScreenCastWindowStream *window_stream;
|
||||||
|
MetaScreenCastStream *stream;
|
||||||
|
char *stream_path;
|
||||||
|
|
||||||
if (!check_permission (session, invocation))
|
if (!check_permission (session, invocation))
|
||||||
{
|
{
|
||||||
@ -342,9 +352,43 @@ handle_record_window (MetaDBusScreenCastSession *skeleton,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
display = meta_get_display ();
|
||||||
G_DBUS_ERROR_FAILED,
|
window = meta_display_get_focus_window (display);
|
||||||
"Recording a window not yet supported");
|
if (!window)
|
||||||
|
{
|
||||||
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||||
|
G_DBUS_ERROR_FAILED,
|
||||||
|
"Window not found");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface_skeleton = G_DBUS_INTERFACE_SKELETON (skeleton);
|
||||||
|
connection = g_dbus_interface_skeleton_get_connection (interface_skeleton);
|
||||||
|
|
||||||
|
window_stream = meta_screen_cast_window_stream_new (connection,
|
||||||
|
window,
|
||||||
|
&error);
|
||||||
|
if (!window_stream)
|
||||||
|
{
|
||||||
|
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||||
|
G_DBUS_ERROR_FAILED,
|
||||||
|
"Failed to record window: %s",
|
||||||
|
error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
stream = META_SCREEN_CAST_STREAM (window_stream);
|
||||||
|
stream_path = meta_screen_cast_stream_get_object_path (stream);
|
||||||
|
|
||||||
|
session->streams = g_list_append (session->streams, stream);
|
||||||
|
|
||||||
|
g_signal_connect (stream, "closed", G_CALLBACK (on_stream_closed), session);
|
||||||
|
|
||||||
|
meta_dbus_screen_cast_session_complete_record_window (skeleton,
|
||||||
|
invocation,
|
||||||
|
stream_path);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user