diff options
| author | Karl Heuer | 1996-05-14 19:01:53 +0000 |
|---|---|---|
| committer | Karl Heuer | 1996-05-14 19:01:53 +0000 |
| commit | 9aa94bd50ca204c3549ee75c31bc970c1bf4b45d (patch) | |
| tree | 012fe2637cb8667ae7a104de6331c7975a5affd1 /src/w32select.c | |
| parent | e3be3bfdfb080a6e7d01fc3ee996bfcddd8170c4 (diff) | |
| download | emacs-9aa94bd50ca204c3549ee75c31bc970c1bf4b45d.tar.gz emacs-9aa94bd50ca204c3549ee75c31bc970c1bf4b45d.zip | |
(QCLIPBOARD): New symbol.
(Fx_selection_exists_p): New function.
(syms_of_win32select): Initialize/staticpro and defsubr them.
Diffstat (limited to 'src/w32select.c')
| -rw-r--r-- | src/w32select.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/w32select.c b/src/w32select.c index b99e94a6472..6b3b0acf8b0 100644 --- a/src/w32select.c +++ b/src/w32select.c | |||
| @@ -27,6 +27,8 @@ Boston, MA 02111-1307, USA. */ | |||
| 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 | 29 | ||
| 30 | Lisp_Object QCLIPBOARD; | ||
| 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.") |
| @@ -243,6 +245,44 @@ DEFUN ("win32-get-clipboard-data", Fwin32_get_clipboard_data, Swin32_get_clipboa | |||
| 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 | { |
| @@ -253,4 +293,7 @@ syms_of_win32select () | |||
| 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); |
| 296 | defsubr (&Sx_selection_exists_p); | ||
| 297 | |||
| 298 | QCLIPBOARD = intern ("CLIPBOARD"); staticpro (&QCLIPBOARD); | ||
| 256 | } | 299 | } |