summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2020-04-08 13:36:33 +0200
committerRobert Mader <robert.mader@posteo.de>2020-04-22 01:34:22 +0200
commite845bbd57971be792ae3317b7adf8665f888b740 (patch)
tree6291e880a0391b0fb9c2d95ff5d86a0175f73143
parent025730349d05b37137aaa09bcc22f44ff733aec9 (diff)
downloadmutter-e845bbd57971be792ae3317b7adf8665f888b740.tar.gz
core: Add private function to get the current selection owner
This is a bit untidy to expose, however may be necessary internally. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1186 (cherry picked from commit fbd6366eddf39704fb79be608dd22cb3fad328e6)
-rw-r--r--src/core/meta-selection-private.h32
-rw-r--r--src/core/meta-selection.c11
2 files changed, 43 insertions, 0 deletions
diff --git a/src/core/meta-selection-private.h b/src/core/meta-selection-private.h
new file mode 100644
index 000000000..de9caf9bf
--- /dev/null
+++ b/src/core/meta-selection-private.h
@@ -0,0 +1,32 @@
+/*
+ * 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
+#define 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 b8964065a..bf290de3f 100644
--- a/src/core/meta-selection.c
+++ b/src/core/meta-selection.c
@@ -21,6 +21,7 @@
#include "config.h"
+#include "core/meta-selection-private.h"
#include "meta/meta-selection.h"
typedef struct TransferRequest TransferRequest;
@@ -383,3 +384,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];
+}