kathenas / rpms / mutter

Forked from rpms/mutter 5 years ago
Clone

Blame SOURCES/0005-screen-cast-Add-screen-cast-window-interface.patch

776610
From be6ba9eb1e28cc339e691f02c7c1cb6ae627d87a Mon Sep 17 00:00:00 2001
776610
From: Olivier Fourdan <ofourdan@redhat.com>
776610
Date: Wed, 5 Dec 2018 08:48:41 +0100
776610
Subject: [PATCH 05/12] screen-cast: Add screen-cast-window interface
776610
776610
Typically, to stream the content of a window, we need a way to copy the
776610
content of its window-actor into a buffer, transform relative input
776610
coordinates to relative position within the window-actor and a mean to
776610
get the window bounds within the buffer.
776610
776610
For this purpose, add a new GType interface `MetaScreenCastWindow` with
776610
the methods needed for screen-cast window mode:
776610
776610
 * meta_screen_cast_window_get_buffer_bounds()
776610
 * meta_screen_cast_window_get_frame_bounds()
776610
 * meta_screen_cast_window_transform_relative_position()
776610
 * meta_screen_cast_window_capture_into()
776610
776610
This interface is meant to be implemented by `MetaWindowActor` which has
776610
access to all the necessary bits to implement them.
776610
776610
https://gitlab.gnome.org/GNOME/mutter/merge_requests/306
776610
(cherry picked from commit 20c9ca25c01a9160d4a2ddfad29b48eb86a9142a)
776610
---
776610
 src/Makefile.am                        |  2 +
776610
 src/backends/meta-screen-cast-window.c | 71 ++++++++++++++++++++++++
776610
 src/backends/meta-screen-cast-window.h | 74 ++++++++++++++++++++++++++
776610
 3 files changed, 147 insertions(+)
776610
 create mode 100644 src/backends/meta-screen-cast-window.c
776610
 create mode 100644 src/backends/meta-screen-cast-window.h
776610
776610
diff --git a/src/Makefile.am b/src/Makefile.am
776610
index bd879f2..93586a2 100644
776610
--- a/src/Makefile.am
776610
+++ b/src/Makefile.am
776610
@@ -159,6 +159,8 @@ libmutter_@LIBMUTTER_API_VERSION@_la_SOURCES =	\
776610
 	backends/meta-output.h			\
776610
 	backends/meta-pointer-constraint.c	\
776610
 	backends/meta-pointer-constraint.h	\
776610
+	backends/meta-screen-cast-window.c	\
776610
+	backends/meta-screen-cast-window.h	\
776610
 	backends/meta-settings.c		\
776610
 	backends/meta-settings-private.h	\
776610
 	backends/meta-stage-private.h		\
776610
diff --git a/src/backends/meta-screen-cast-window.c b/src/backends/meta-screen-cast-window.c
776610
new file mode 100644
776610
index 0000000..21629a0
776610
--- /dev/null
776610
+++ b/src/backends/meta-screen-cast-window.c
776610
@@ -0,0 +1,71 @@
776610
+/*
776610
+ * Copyright (C) 2018 Red Hat Inc.
776610
+ *
776610
+ * This program is free software; you can redistribute it and/or
776610
+ * modify it under the terms of the GNU General Public License as
776610
+ * published by the Free Software Foundation; either version 2 of the
776610
+ * License, or (at your option) any later version.
776610
+ *
776610
+ * This program is distributed in the hope that it will be useful, but
776610
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
776610
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
776610
+ * General Public License for more details.
776610
+ *
776610
+ * You should have received a copy of the GNU General Public License
776610
+ * along with this program; if not, write to the Free Software
776610
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
776610
+ * 02111-1307, USA.
776610
+ *
776610
+ */
776610
+
776610
+#include "config.h"
776610
+
776610
+#include "backends/meta-screen-cast-window.h"
776610
+
776610
+G_DEFINE_INTERFACE (MetaScreenCastWindow, meta_screen_cast_window, G_TYPE_OBJECT)
776610
+
776610
+static void
776610
+meta_screen_cast_window_default_init (MetaScreenCastWindowInterface *iface)
776610
+{
776610
+}
776610
+
776610
+void
776610
+meta_screen_cast_window_get_buffer_bounds (MetaScreenCastWindow *screen_cast_window,
776610
+                                           MetaRectangle        *bounds)
776610
+{
776610
+  META_SCREEN_CAST_WINDOW_GET_IFACE (screen_cast_window)->get_buffer_bounds (screen_cast_window,
776610
+                                                                             bounds);
776610
+}
776610
+
776610
+void
776610
+meta_screen_cast_window_get_frame_bounds (MetaScreenCastWindow *screen_cast_window,
776610
+                                          MetaRectangle        *bounds)
776610
+{
776610
+  META_SCREEN_CAST_WINDOW_GET_IFACE (screen_cast_window)->get_frame_bounds (screen_cast_window,
776610
+                                                                            bounds);
776610
+}
776610
+
776610
+void
776610
+meta_screen_cast_window_transform_relative_position (MetaScreenCastWindow *screen_cast_window,
776610
+                                                     double                x,
776610
+                                                     double                y,
776610
+                                                     double               *x_out,
776610
+                                                     double               *y_out)
776610
+{
776610
+  META_SCREEN_CAST_WINDOW_GET_IFACE (screen_cast_window)->transform_relative_position (screen_cast_window,
776610
+                                                                                       x,
776610
+                                                                                       y,
776610
+                                                                                       x_out,
776610
+                                                                                       y_out);
776610
+}
776610
+
776610
+
776610
+void
776610
+meta_screen_cast_window_capture_into (MetaScreenCastWindow *screen_cast_window,
776610
+                                      MetaRectangle        *bounds,
776610
+                                      uint8_t              *data)
776610
+{
776610
+  META_SCREEN_CAST_WINDOW_GET_IFACE (screen_cast_window)->capture_into (screen_cast_window,
776610
+                                                                        bounds,
776610
+                                                                        data);
776610
+}
776610
diff --git a/src/backends/meta-screen-cast-window.h b/src/backends/meta-screen-cast-window.h
776610
new file mode 100644
776610
index 0000000..e023d3e
776610
--- /dev/null
776610
+++ b/src/backends/meta-screen-cast-window.h
776610
@@ -0,0 +1,74 @@
776610
+/*
776610
+ * Copyright (C) 2018 Red Hat Inc.
776610
+ *
776610
+ * This program is free software; you can redistribute it and/or
776610
+ * modify it under the terms of the GNU General Public License as
776610
+ * published by the Free Software Foundation; either version 2 of the
776610
+ * License, or (at your option) any later version.
776610
+ *
776610
+ * This program is distributed in the hope that it will be useful, but
776610
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
776610
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
776610
+ * General Public License for more details.
776610
+ *
776610
+ * You should have received a copy of the GNU General Public License
776610
+ * along with this program; if not, write to the Free Software
776610
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
776610
+ * 02111-1307, USA.
776610
+ *
776610
+ */
776610
+
776610
+#ifndef META_SCREEN_CAST_WINDOW_H
776610
+#define META_SCREEN_CAST_WINDOW_H
776610
+
776610
+#include <stdint.h>
776610
+#include <glib-object.h>
776610
+
776610
+#include "meta/boxes.h"
776610
+
776610
+G_BEGIN_DECLS
776610
+
776610
+#define META_TYPE_SCREEN_CAST_WINDOW (meta_screen_cast_window_get_type ())
776610
+G_DECLARE_INTERFACE (MetaScreenCastWindow, meta_screen_cast_window,
776610
+                     META, SCREEN_CAST_WINDOW, GObject)
776610
+
776610
+struct _MetaScreenCastWindowInterface
776610
+{
776610
+  GTypeInterface parent_iface;
776610
+
776610
+  void (*get_buffer_bounds) (MetaScreenCastWindow *screen_cast_window,
776610
+                             MetaRectangle        *bounds);
776610
+
776610
+  void (*get_frame_bounds) (MetaScreenCastWindow *screen_cast_window,
776610
+                            MetaRectangle        *bounds);
776610
+
776610
+  void (*transform_relative_position) (MetaScreenCastWindow *screen_cast_window,
776610
+                                       double                x,
776610
+                                       double                y,
776610
+                                       double               *x_out,
776610
+                                       double               *y_out);
776610
+
776610
+  void (*capture_into) (MetaScreenCastWindow *screen_cast_window,
776610
+                        MetaRectangle        *bounds,
776610
+                        uint8_t              *data);
776610
+};
776610
+
776610
+void meta_screen_cast_window_get_buffer_bounds (MetaScreenCastWindow *screen_cast_window,
776610
+                                                MetaRectangle        *bounds);
776610
+
776610
+void meta_screen_cast_window_get_frame_bounds (MetaScreenCastWindow *screen_cast_window,
776610
+                                               MetaRectangle        *bounds);
776610
+
776610
+void meta_screen_cast_window_transform_relative_position (MetaScreenCastWindow *screen_cast_window,
776610
+                                                          double                x,
776610
+                                                          double                y,
776610
+                                                          double               *x_out,
776610
+                                                          double               *y_out);
776610
+
776610
+void meta_screen_cast_window_capture_into (MetaScreenCastWindow *screen_cast_window,
776610
+                                           MetaRectangle        *bounds,
776610
+                                           uint8_t              *data);
776610
+
776610
+G_END_DECLS
776610
+
776610
+#endif /* META_SCREEN_CAST_WINDOW_H */
776610
-- 
776610
2.19.2
776610