/* X Selection processing for Emacs.
Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs 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, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
DATA and SIZE describe the data to send, already converted.
FORMAT is the unit-size (in bits) of the data to be transmitted. */
+#ifdef TRACE_SELECTION
+static int x_reply_selection_request_cnt;
+#endif /* TRACE_SELECTION */
+
static void
x_reply_selection_request (event, format, data, size, type)
struct input_event *event;
#ifdef TRACE_SELECTION
{
- static int cnt;
char *sel = XGetAtomName (display, reply.selection);
char *tgt = XGetAtomName (display, reply.target);
- TRACE3 ("%s, target %s (%d)", sel, tgt, ++cnt);
+ TRACE3 ("%s, target %s (%d)", sel, tgt, ++x_reply_selection_request_cnt);
if (sel) XFree (sel);
if (tgt) XFree (tgt);
}
TRACE0 ("x_handle_selection_clear");
+#ifdef MULTI_KBOARD
/* If the new selection owner is also Emacs,
don't clear the new selection. */
BLOCK_INPUT;
}
}
UNBLOCK_INPUT;
-
+#endif
+
selection_symbol = x_atom_to_symbol (display, selection);
local_selection_data = assq_no_quit (selection_symbol, Vselection_alist);
}
}
- /* Convert a single 16 or small 32 bit number to a Lisp_Int.
- If the number is > 16 bits, convert it to a cons of integers,
- 16 bits in each half.
+ /* Convert a single 16-bit number or a small 32-bit number to a Lisp_Int.
+ If the number is 32 bits and won't fit in a Lisp_Int,
+ convert it to a cons of integers, 16 bits in each half.
*/
else if (format == 32 && size == sizeof (int))
return long_to_cons (((unsigned int *) data) [0]);
ret = make_string (name, strlen (name));
if (atom && name) XFree (name);
- if (NILP (ret)) ret = make_string ("", 0);
+ if (NILP (ret)) ret = empty_unibyte_string;
UNBLOCK_INPUT;
DEFVAR_LISP ("selection-coding-system", &Vselection_coding_system,
doc: /* Coding system for communicating with other X clients.
-When sending or receiving text via selection and clipboard, the text is
-encoded or decoded by this coding system.
+
+When sending text via selection and clipboard, if the requested
+data-type is not "UTF8_STRING", the text is encoded by this coding
+system.
+
+When receiving text, if the data-type of the received text is not
+"UTF8_STRING", it is decoded by this coding system.
+
+See also the documentation of the variable `x-select-request-type' how
+to control which data-type to request for receiving text.
+
The default value is `compound-text-with-extensions'. */);
Vselection_coding_system = intern ("compound-text-with-extensions");