Mercurial > emacs
comparison src/w32select.c @ 15235:440d937a60f7
(QCLIPBOARD): New symbol.
(Fx_selection_exists_p): New function.
(syms_of_win32select): Initialize/staticpro and defsubr them.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Tue, 14 May 1996 19:01:53 +0000 |
parents | e37489592e27 |
children | 481b7874a1e9 |
comparison
equal
deleted
inserted
replaced
15234:2af580000f27 | 15235:440d937a60f7 |
---|---|
24 #include "lisp.h" | 24 #include "lisp.h" |
25 #include "w32term.h" /* for all of the win32 includes */ | 25 #include "w32term.h" /* for all of the win32 includes */ |
26 #include "dispextern.h" /* frame.h seems to want this */ | 26 #include "dispextern.h" /* frame.h seems to want this */ |
27 #include "frame.h" /* Need this to get the X window of selected_frame */ | 27 #include "frame.h" /* Need this to get the X window of selected_frame */ |
28 #include "blockinput.h" | 28 #include "blockinput.h" |
29 | |
30 Lisp_Object QCLIPBOARD; | |
29 | 31 |
30 #if 0 | 32 #if 0 |
31 DEFUN ("win32-open-clipboard", Fwin32_open_clipboard, Swin32_open_clipboard, 0, 1, 0, | 33 DEFUN ("win32-open-clipboard", Fwin32_open_clipboard, Swin32_open_clipboard, 0, 1, 0, |
32 "This opens the clipboard with the given frame pointer.") | 34 "This opens the clipboard with the given frame pointer.") |
33 (frame) | 35 (frame) |
241 UNBLOCK_INPUT; | 243 UNBLOCK_INPUT; |
242 | 244 |
243 return (ret); | 245 return (ret); |
244 } | 246 } |
245 | 247 |
248 /* Support checking for a clipboard selection. */ | |
249 | |
250 DEFUN ("x-selection-exists-p", Fx_selection_exists_p, Sx_selection_exists_p, | |
251 0, 1, 0, | |
252 "Whether there is an owner for the given X Selection.\n\ | |
253 The arg should be the name of the selection in question, typically one of\n\ | |
254 the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.\n\ | |
255 \(Those are literal upper-case symbol names, since that's what X expects.)\n\ | |
256 For convenience, the symbol nil is the same as `PRIMARY',\n\ | |
257 and t is the same as `SECONDARY'.") | |
258 (selection) | |
259 Lisp_Object selection; | |
260 { | |
261 CHECK_SYMBOL (selection, 0); | |
262 | |
263 /* Return nil for PRIMARY and SECONDARY selections; for CLIPBOARD, check | |
264 if the clipboard currently has valid text format contents. */ | |
265 | |
266 if (EQ (selection, QCLIPBOARD)) | |
267 { | |
268 Lisp_Object val = Qnil; | |
269 | |
270 if (OpenClipboard (NULL)) | |
271 { | |
272 int format = 0; | |
273 while (format = EnumClipboardFormats (format)) | |
274 if (format == CF_TEXT) | |
275 { | |
276 val = Qt; | |
277 break; | |
278 } | |
279 CloseClipboard (); | |
280 } | |
281 return val; | |
282 } | |
283 return Qnil; | |
284 } | |
285 | |
246 void | 286 void |
247 syms_of_win32select () | 287 syms_of_win32select () |
248 { | 288 { |
249 #if 0 | 289 #if 0 |
250 defsubr (&Swin32_open_clipboard); | 290 defsubr (&Swin32_open_clipboard); |
251 defsubr (&Swin32_empty_clipboard); | 291 defsubr (&Swin32_empty_clipboard); |
252 defsubr (&Swin32_close_clipboard); | 292 defsubr (&Swin32_close_clipboard); |
253 #endif | 293 #endif |
254 defsubr (&Swin32_set_clipboard_data); | 294 defsubr (&Swin32_set_clipboard_data); |
255 defsubr (&Swin32_get_clipboard_data); | 295 defsubr (&Swin32_get_clipboard_data); |
256 } | 296 defsubr (&Sx_selection_exists_p); |
297 | |
298 QCLIPBOARD = intern ("CLIPBOARD"); staticpro (&QCLIPBOARD); | |
299 } |