aboutsummaryrefslogtreecommitdiffstats
path: root/src/haikuselect.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/haikuselect.c')
-rw-r--r--src/haikuselect.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/haikuselect.c b/src/haikuselect.c
index 2e619c69f7a..e65ab827c51 100644
--- a/src/haikuselect.c
+++ b/src/haikuselect.c
@@ -166,6 +166,36 @@ clipboard. */)
166 return Qnil; 166 return Qnil;
167} 167}
168 168
169DEFUN ("haiku-selection-owner-p", Fhaiku_selection_owner_p, Shaiku_selection_owner_p,
170 0, 1, 0,
171 doc: /* Whether the current Emacs process owns the given SELECTION.
172The arg should be the name of the selection in question, typically one
173of the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. For
174convenience, the symbol nil is the same as `PRIMARY', and t is the
175same as `SECONDARY'. */)
176 (Lisp_Object selection)
177{
178 bool value;
179
180 if (NILP (selection))
181 selection = QPRIMARY;
182 else if (EQ (selection, Qt))
183 selection = QSECONDARY;
184
185 block_input ();
186 if (EQ (selection, QPRIMARY))
187 value = BClipboard_owns_primary ();
188 else if (EQ (selection, QSECONDARY))
189 value = BClipboard_owns_secondary ();
190 else if (EQ (selection, QCLIPBOARD))
191 value = BClipboard_owns_clipboard ();
192 else
193 value = false;
194 unblock_input ();
195
196 return value ? Qt : Qnil;
197}
198
169void 199void
170syms_of_haikuselect (void) 200syms_of_haikuselect (void)
171{ 201{
@@ -179,4 +209,5 @@ syms_of_haikuselect (void)
179 defsubr (&Shaiku_selection_data); 209 defsubr (&Shaiku_selection_data);
180 defsubr (&Shaiku_selection_put); 210 defsubr (&Shaiku_selection_put);
181 defsubr (&Shaiku_selection_targets); 211 defsubr (&Shaiku_selection_targets);
212 defsubr (&Shaiku_selection_owner_p);
182} 213}