[mutter/wip/carlosg/on-demand-forward-selections: 1/2] core: Add private function to get the current selection owner



commit dcaadd2734df36dd38b578674b8cb3811cf25416
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Apr 8 13:36:33 2020 +0200

    core: Add private function to get the current selection owner
    
    This is a bit untidy to expose, however may be necessary internally.

 src/core/meta-selection-private.h | 31 +++++++++++++++++++++++++++++++
 src/core/meta-selection.c         | 10 ++++++++++
 2 files changed, 41 insertions(+)
---
diff --git a/src/core/meta-selection-private.h b/src/core/meta-selection-private.h
new file mode 100644
index 000000000..858ce5a74
--- /dev/null
+++ b/src/core/meta-selection-private.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2020 Red Hat
+ *
+ * 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.
+ *
+ * Written by:
+ *     Carlos Garnacho <carlosg gnome org>
+ */
+
+#ifndef META_SELECTION_PRIVATE_H
+
+#include <meta/meta-selection.h>
+
+MetaSelectionSource *
+  meta_selection_get_current_owner (MetaSelection     *selection,
+                                    MetaSelectionType  selection_type);
+
+#endif /* META_SELECTION_PRIVATE_H */
diff --git a/src/core/meta-selection.c b/src/core/meta-selection.c
index 7e86c5269..9a044e744 100644
--- a/src/core/meta-selection.c
+++ b/src/core/meta-selection.c
@@ -364,3 +364,13 @@ meta_selection_transfer_finish (MetaSelection  *selection,
 
   return g_task_propagate_boolean (G_TASK (result), error);
 }
+
+MetaSelectionSource *
+meta_selection_get_current_owner (MetaSelection     *selection,
+                                  MetaSelectionType  selection_type)
+{
+  g_return_val_if_fail (META_IS_SELECTION (selection), NULL);
+  g_return_val_if_fail (selection_type < META_N_SELECTION_TYPES, NULL);
+
+  return selection->owners[selection_type];
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]