/* Selection processing for Emacs on the Microsoft W32 API.
Copyright (C) 1993, 1994 Free Software Foundation.
-
+
This file is part of GNU Emacs.
GNU Emacs is free software; you can redistribute it and/or modify
Lisp_Object frame;
{
BOOL ok = FALSE;
-
+
if (!NILP (frame))
CHECK_LIVE_FRAME (frame, 0);
-
+
BLOCK_INPUT;
-
+
ok = OpenClipboard ((!NILP (frame) && FRAME_W32_P (XFRAME (frame))) ? FRAME_W32_WINDOW (XFRAME (frame)) : NULL);
-
+
UNBLOCK_INPUT;
-
+
return (ok ? frame : Qnil);
}
()
{
BOOL ok = FALSE;
-
+
BLOCK_INPUT;
-
+
ok = EmptyClipboard ();
-
+
UNBLOCK_INPUT;
-
+
return (ok ? Qt : Qnil);
}
()
{
BOOL ok = FALSE;
-
+
BLOCK_INPUT;
-
+
ok = CloseClipboard ();
-
+
UNBLOCK_INPUT;
-
+
return (ok ? Qt : Qnil);
}
unsigned char *dst;
CHECK_STRING (string, 0);
-
+
if (!NILP (frame))
CHECK_LIVE_FRAME (frame, 0);
-
+
BLOCK_INPUT;
nbytes = STRING_BYTES (XSTRING (string)) + 1;
if ((dst = (unsigned char *) GlobalLock (htext)) == NULL)
goto error;
-
+
/* convert to CRLF line endings expected by clipboard */
while (1)
{
next[-1] = '\r';
next[0] = '\n';
dst = next + 1;
- }
+ }
else
/* copied remaining partial line -> now finished */
break;
}
-
+
GlobalUnlock (htext);
Vlast_coding_system_used = Qraw_text;
if (htext2 != NULL) htext = htext2;
}
}
-
+
if (!OpenClipboard ((!NILP (frame) && FRAME_W32_P (XFRAME (frame))) ? FRAME_W32_WINDOW (XFRAME (frame)) : NULL))
goto error;
ok = EmptyClipboard () && SetClipboardData (CF_TEXT, htext);
-
+
CloseClipboard ();
-
+
if (ok) goto done;
error:
-
+
ok = FALSE;
if (htext) GlobalFree (htext);
if (last_clipboard_text)
done:
UNBLOCK_INPUT;
-
+
return (ok ? string : Qnil);
}
{
HANDLE htext;
Lisp_Object ret = Qnil;
-
+
if (!NILP (frame))
CHECK_LIVE_FRAME (frame, 0);
-
+
BLOCK_INPUT;
-
+
if (!OpenClipboard ((!NILP (frame) && FRAME_W32_P (XFRAME (frame))) ? FRAME_W32_WINDOW (XFRAME (frame)) : NULL))
goto done;
-
+
if ((htext = GetClipboardData (CF_TEXT)) == NULL)
goto closeclip;
int nbytes;
int truelen;
int require_decoding = 0;
-
+
if ((src = (unsigned char *) GlobalLock (htext)) == NULL)
goto closeclip;
-
+
nbytes = strlen (src);
/* If the text in clipboard is identical to what we put there
}
}
}
-
+
if (require_decoding)
{
int bufsize;
closeclip:
CloseClipboard ();
-
+
done:
UNBLOCK_INPUT;
-
+
return (ret);
}
return Qnil;
}
-void
+void
syms_of_w32select ()
{
#if 0
"Coding system for communicating with other X clients.\n\
When sending or receiving text via cut_buffer, selection, and clipboard,\n\
the text is encoded or decoded by this coding system.\n\
-A default value is `compound-text'");
- Vselection_coding_system=intern ("iso-latin-1-dos");
+The default value is `iso-latin-1-dos'.");
+ Vselection_coding_system = intern ("iso-latin-1-dos");
DEFVAR_LISP ("next-selection-coding-system", &Vnext_selection_coding_system,
"Coding system for the next communication with other X clients.\n\