428
|
1 /* X Selection processing for XEmacs
|
|
2 Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
793
|
3 Copyright (C) 2001, 2002 Ben Wing.
|
428
|
4
|
|
5 This file is part of XEmacs.
|
|
6
|
|
7 XEmacs is free software; you can redistribute it and/or modify it
|
|
8 under the terms of the GNU General Public License as published by the
|
|
9 Free Software Foundation; either version 2, or (at your option) any
|
|
10 later version.
|
|
11
|
|
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
15 for more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License
|
|
18 along with XEmacs; see the file COPYING. If not, write to
|
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
20 Boston, MA 02111-1307, USA. */
|
|
21
|
|
22 /* Synched up with: Not synched with FSF. */
|
|
23
|
|
24 /* Rewritten by jwz */
|
|
25
|
|
26 #include <config.h>
|
|
27 #include "lisp.h"
|
|
28
|
771
|
29 #include "charset.h"
|
872
|
30 #include "device-impl.h"
|
|
31 #include "frame-impl.h"
|
800
|
32 #include "opaque.h"
|
|
33 #include "select.h"
|
|
34
|
872
|
35 #include "console-x-impl.h"
|
428
|
36 #include "objects-x.h"
|
|
37
|
|
38 #include "systime.h"
|
|
39
|
|
40 int lisp_to_time (Lisp_Object, time_t *);
|
|
41 Lisp_Object time_to_lisp (time_t);
|
|
42
|
|
43 #ifdef LWLIB_USES_MOTIF
|
|
44 # define MOTIF_CLIPBOARDS
|
|
45 #endif
|
|
46
|
|
47 #ifdef MOTIF_CLIPBOARDS
|
1315
|
48 # include "xmotif.h"
|
|
49 /* Kludge around shadowing warnings */
|
|
50 # define index index_
|
428
|
51 # include <Xm/CutPaste.h>
|
1315
|
52 # undef index
|
428
|
53 static void hack_motif_clipboard_selection (Atom selection_atom,
|
|
54 Lisp_Object selection_value,
|
|
55 Time thyme, Display *display,
|
456
|
56 Window selecting_window,
|
|
57 int owned_p);
|
428
|
58 #endif
|
|
59
|
|
60 #define CUT_BUFFER_SUPPORT
|
|
61
|
|
62 #ifdef CUT_BUFFER_SUPPORT
|
|
63 Lisp_Object QCUT_BUFFER0, QCUT_BUFFER1, QCUT_BUFFER2, QCUT_BUFFER3,
|
|
64 QCUT_BUFFER4, QCUT_BUFFER5, QCUT_BUFFER6, QCUT_BUFFER7;
|
|
65 #endif
|
|
66
|
|
67 Lisp_Object Vx_sent_selection_hooks;
|
|
68
|
|
69 /* If this is a smaller number than the max-request-size of the display,
|
|
70 emacs will use INCR selection transfer when the selection is larger
|
|
71 than this. The max-request-size is usually around 64k, so if you want
|
|
72 emacs to use incremental selection transfers when the selection is
|
|
73 smaller than that, set this. I added this mostly for debugging the
|
|
74 incremental transfer stuff, but it might improve server performance.
|
|
75 */
|
|
76 #define MAX_SELECTION_QUANTUM 0xFFFFFF
|
|
77
|
|
78 #define SELECTION_QUANTUM(dpy) ((XMaxRequestSize (dpy) << 2) - 100)
|
|
79
|
|
80 /* If the selection owner takes too long to reply to a selection request,
|
|
81 we give up on it. This is in seconds (0 = no timeout).
|
|
82 */
|
458
|
83 Fixnum x_selection_timeout;
|
428
|
84
|
456
|
85 /* Enable motif selection optimizations. */
|
|
86 int x_selection_strict_motif_ownership;
|
|
87
|
428
|
88
|
|
89 /* Utility functions */
|
|
90
|
|
91 static Lisp_Object x_get_window_property_as_lisp_data (Display *,
|
|
92 Window,
|
|
93 Atom property,
|
|
94 Lisp_Object target_type,
|
|
95 Atom selection_atom);
|
|
96
|
|
97 static int expect_property_change (Display *, Window, Atom prop, int state);
|
|
98 static void wait_for_property_change (long);
|
|
99 static void unexpect_property_change (int);
|
|
100 static int waiting_for_other_props_on_window (Display *, Window);
|
|
101
|
|
102 /* This converts a Lisp symbol to a server Atom, avoiding a server
|
|
103 roundtrip whenever possible.
|
|
104 */
|
|
105 static Atom
|
|
106 symbol_to_x_atom (struct device *d, Lisp_Object sym, int only_if_exists)
|
|
107 {
|
|
108 Display *display = DEVICE_X_DISPLAY (d);
|
|
109
|
|
110 if (NILP (sym)) return XA_PRIMARY;
|
|
111 if (EQ (sym, Qt)) return XA_SECONDARY;
|
|
112 if (EQ (sym, QPRIMARY)) return XA_PRIMARY;
|
|
113 if (EQ (sym, QSECONDARY)) return XA_SECONDARY;
|
|
114 if (EQ (sym, QSTRING)) return XA_STRING;
|
|
115 if (EQ (sym, QINTEGER)) return XA_INTEGER;
|
|
116 if (EQ (sym, QATOM)) return XA_ATOM;
|
|
117 if (EQ (sym, QCLIPBOARD)) return DEVICE_XATOM_CLIPBOARD (d);
|
|
118 if (EQ (sym, QTIMESTAMP)) return DEVICE_XATOM_TIMESTAMP (d);
|
|
119 if (EQ (sym, QTEXT)) return DEVICE_XATOM_TEXT (d);
|
|
120 if (EQ (sym, QDELETE)) return DEVICE_XATOM_DELETE (d);
|
|
121 if (EQ (sym, QMULTIPLE)) return DEVICE_XATOM_MULTIPLE (d);
|
|
122 if (EQ (sym, QINCR)) return DEVICE_XATOM_INCR (d);
|
|
123 if (EQ (sym, QEMACS_TMP)) return DEVICE_XATOM_EMACS_TMP (d);
|
|
124 if (EQ (sym, QTARGETS)) return DEVICE_XATOM_TARGETS (d);
|
|
125 if (EQ (sym, QNULL)) return DEVICE_XATOM_NULL (d);
|
|
126 if (EQ (sym, QATOM_PAIR)) return DEVICE_XATOM_ATOM_PAIR (d);
|
|
127 if (EQ (sym, QCOMPOUND_TEXT)) return DEVICE_XATOM_COMPOUND_TEXT (d);
|
|
128
|
|
129 #ifdef CUT_BUFFER_SUPPORT
|
|
130 if (EQ (sym, QCUT_BUFFER0)) return XA_CUT_BUFFER0;
|
|
131 if (EQ (sym, QCUT_BUFFER1)) return XA_CUT_BUFFER1;
|
|
132 if (EQ (sym, QCUT_BUFFER2)) return XA_CUT_BUFFER2;
|
|
133 if (EQ (sym, QCUT_BUFFER3)) return XA_CUT_BUFFER3;
|
|
134 if (EQ (sym, QCUT_BUFFER4)) return XA_CUT_BUFFER4;
|
|
135 if (EQ (sym, QCUT_BUFFER5)) return XA_CUT_BUFFER5;
|
|
136 if (EQ (sym, QCUT_BUFFER6)) return XA_CUT_BUFFER6;
|
|
137 if (EQ (sym, QCUT_BUFFER7)) return XA_CUT_BUFFER7;
|
|
138 #endif /* CUT_BUFFER_SUPPORT */
|
|
139
|
|
140 {
|
647
|
141 const Extbyte *nameext;
|
442
|
142 LISP_STRING_TO_EXTERNAL (Fsymbol_name (sym), nameext, Qctext);
|
428
|
143 return XInternAtom (display, nameext, only_if_exists ? True : False);
|
|
144 }
|
|
145 }
|
|
146
|
|
147
|
|
148 /* This converts a server Atom to a Lisp symbol, avoiding server roundtrips
|
|
149 and calls to intern whenever possible.
|
|
150 */
|
|
151 static Lisp_Object
|
|
152 x_atom_to_symbol (struct device *d, Atom atom)
|
|
153 {
|
|
154 Display *display = DEVICE_X_DISPLAY (d);
|
|
155
|
|
156 if (! atom) return Qnil;
|
|
157 if (atom == XA_PRIMARY) return QPRIMARY;
|
|
158 if (atom == XA_SECONDARY) return QSECONDARY;
|
|
159 if (atom == XA_STRING) return QSTRING;
|
|
160 if (atom == XA_INTEGER) return QINTEGER;
|
|
161 if (atom == XA_ATOM) return QATOM;
|
|
162 if (atom == DEVICE_XATOM_CLIPBOARD (d)) return QCLIPBOARD;
|
|
163 if (atom == DEVICE_XATOM_TIMESTAMP (d)) return QTIMESTAMP;
|
|
164 if (atom == DEVICE_XATOM_TEXT (d)) return QTEXT;
|
|
165 if (atom == DEVICE_XATOM_DELETE (d)) return QDELETE;
|
|
166 if (atom == DEVICE_XATOM_MULTIPLE (d)) return QMULTIPLE;
|
|
167 if (atom == DEVICE_XATOM_INCR (d)) return QINCR;
|
|
168 if (atom == DEVICE_XATOM_EMACS_TMP (d)) return QEMACS_TMP;
|
|
169 if (atom == DEVICE_XATOM_TARGETS (d)) return QTARGETS;
|
|
170 if (atom == DEVICE_XATOM_NULL (d)) return QNULL;
|
|
171 if (atom == DEVICE_XATOM_ATOM_PAIR (d)) return QATOM_PAIR;
|
|
172 if (atom == DEVICE_XATOM_COMPOUND_TEXT (d)) return QCOMPOUND_TEXT;
|
|
173
|
|
174 #ifdef CUT_BUFFER_SUPPORT
|
|
175 if (atom == XA_CUT_BUFFER0) return QCUT_BUFFER0;
|
|
176 if (atom == XA_CUT_BUFFER1) return QCUT_BUFFER1;
|
|
177 if (atom == XA_CUT_BUFFER2) return QCUT_BUFFER2;
|
|
178 if (atom == XA_CUT_BUFFER3) return QCUT_BUFFER3;
|
|
179 if (atom == XA_CUT_BUFFER4) return QCUT_BUFFER4;
|
|
180 if (atom == XA_CUT_BUFFER5) return QCUT_BUFFER5;
|
|
181 if (atom == XA_CUT_BUFFER6) return QCUT_BUFFER6;
|
|
182 if (atom == XA_CUT_BUFFER7) return QCUT_BUFFER7;
|
|
183 #endif
|
|
184
|
|
185 {
|
867
|
186 Ibyte *intstr;
|
771
|
187 Extbyte *str = XGetAtomName (display, atom);
|
428
|
188
|
|
189 if (! str) return Qnil;
|
|
190
|
440
|
191 TO_INTERNAL_FORMAT (C_STRING, str,
|
|
192 C_STRING_ALLOCA, intstr,
|
|
193 Qctext);
|
428
|
194 XFree (str);
|
771
|
195 return intern_int (intstr);
|
428
|
196 }
|
|
197 }
|
|
198
|
647
|
199 #define PROCESSING_X_CODE
|
|
200 #include "select-common.h"
|
|
201 #undef PROCESSING_X_CODE
|
428
|
202
|
|
203 /* Do protocol to assert ourself as a selection owner.
|
|
204 */
|
|
205 static Lisp_Object
|
2286
|
206 x_own_selection (Lisp_Object selection_name,
|
|
207 #ifdef MOTIF_CLIPBOARDS
|
|
208 Lisp_Object selection_value,
|
|
209 #else
|
|
210 Lisp_Object UNUSED (selection_value),
|
|
211 #endif
|
|
212 Lisp_Object UNUSED (how_to_add),
|
|
213 Lisp_Object UNUSED (selection_type),
|
|
214 #ifdef MOTIF_CLIPBOARDS
|
|
215 int owned_p
|
|
216 #else
|
|
217 int UNUSED (owned_p)
|
|
218 #endif
|
|
219 )
|
428
|
220 {
|
|
221 struct device *d = decode_x_device (Qnil);
|
|
222 Display *display = DEVICE_X_DISPLAY (d);
|
|
223 struct frame *sel_frame = selected_frame ();
|
|
224 Window selecting_window = XtWindow (FRAME_X_TEXT_WIDGET (sel_frame));
|
|
225 Lisp_Object selection_time;
|
|
226 /* Use the time of the last-read mouse or keyboard event.
|
|
227 For selection purposes, we use this as a sleazy way of knowing what the
|
|
228 current time is in server-time. This assumes that the most recently read
|
|
229 mouse or keyboard event has something to do with the assertion of the
|
|
230 selection, which is probably true.
|
|
231 */
|
|
232 Time thyme = DEVICE_X_MOUSE_TIMESTAMP (d);
|
|
233 Atom selection_atom;
|
|
234
|
|
235 CHECK_SYMBOL (selection_name);
|
|
236 selection_atom = symbol_to_x_atom (d, selection_name, 0);
|
|
237
|
|
238 XSetSelectionOwner (display, selection_atom, selecting_window, thyme);
|
|
239
|
|
240 /* We do NOT use time_to_lisp() here any more, like we used to.
|
|
241 That assumed equivalence of time_t and Time, which is not
|
|
242 necessarily the case (e.g. under OSF on the Alphas, where
|
|
243 Time is a 64-bit quantity and time_t is a 32-bit quantity).
|
442
|
244
|
428
|
245 Opaque pointers are the clean way to go here.
|
|
246 */
|
440
|
247 selection_time = make_opaque (&thyme, sizeof (thyme));
|
428
|
248
|
|
249 #ifdef MOTIF_CLIPBOARDS
|
|
250 hack_motif_clipboard_selection (selection_atom, selection_value,
|
456
|
251 thyme, display, selecting_window, owned_p);
|
428
|
252 #endif
|
|
253 return selection_time;
|
|
254 }
|
|
255
|
|
256 #ifdef MOTIF_CLIPBOARDS /* Bend over baby. Take it and like it. */
|
|
257
|
|
258 # ifdef MOTIF_INCREMENTAL_CLIPBOARDS_WORK
|
|
259 static void motif_clipboard_cb ();
|
|
260 # endif
|
|
261
|
|
262 static void
|
|
263 hack_motif_clipboard_selection (Atom selection_atom,
|
|
264 Lisp_Object selection_value,
|
|
265 Time thyme,
|
|
266 Display *display,
|
456
|
267 Window selecting_window,
|
|
268 int owned_p)
|
428
|
269 {
|
|
270 struct device *d = get_device_from_display (display);
|
|
271 /* Those Motif wankers can't be bothered to follow the ICCCM, and do
|
|
272 their own non-Xlib non-Xt clipboard processing. So we have to do
|
|
273 this so that linked-in Motif widgets don't get themselves wedged.
|
|
274 */
|
|
275 if (selection_atom == DEVICE_XATOM_CLIPBOARD (d)
|
|
276 && STRINGP (selection_value)
|
|
277
|
|
278 /* If we already own the clipboard, don't own it again in the Motif
|
|
279 way. This might lose in some subtle way, since the timestamp won't
|
|
280 be current, but owning the selection on the Motif way does a
|
|
281 SHITLOAD of X protocol, and it makes killing text be incredibly
|
|
282 slow when using an X terminal. ARRRRGGGHHH!!!!
|
|
283 */
|
|
284 /* No, this is no good, because then Motif text fields don't bother
|
|
285 to look up the new value, and you can't Copy from a buffer, Paste
|
|
286 into a text field, then Copy something else from the buffer and
|
|
287 paste it into the text field -- it pastes the first thing again. */
|
456
|
288 && (!owned_p
|
|
289 /* Selectively re-enable this because for most users its
|
|
290 just too painful - especially over a remote link. */
|
|
291 || x_selection_strict_motif_ownership)
|
428
|
292 )
|
|
293 {
|
|
294 #ifdef MOTIF_INCREMENTAL_CLIPBOARDS_WORK
|
|
295 Widget widget = FRAME_X_TEXT_WIDGET (selected_frame());
|
|
296 #endif
|
|
297 long itemid;
|
|
298 #if XmVersion >= 1002
|
|
299 long dataid;
|
|
300 #else
|
|
301 int dataid; /* 1.2 wants long, but 1.1.5 wants int... */
|
|
302 #endif
|
|
303 XmString fmh;
|
|
304 String encoding = "STRING";
|
867
|
305 const Ibyte *data = XSTRING_DATA (selection_value);
|
444
|
306 Bytecount bytes = XSTRING_LENGTH (selection_value);
|
428
|
307
|
|
308 #ifdef MULE
|
|
309 {
|
|
310 enum { ASCII, LATIN_1, WORLD } chartypes = ASCII;
|
867
|
311 const Ibyte *ptr = data, *end = ptr + bytes;
|
428
|
312 /* Optimize for the common ASCII case */
|
|
313 while (ptr <= end)
|
|
314 {
|
826
|
315 if (byte_ascii_p (*ptr))
|
428
|
316 {
|
|
317 ptr++;
|
|
318 continue;
|
|
319 }
|
|
320
|
|
321 if ((*ptr) == LEADING_BYTE_LATIN_ISO8859_1 ||
|
|
322 (*ptr) == LEADING_BYTE_CONTROL_1)
|
|
323 {
|
|
324 chartypes = LATIN_1;
|
|
325 ptr += 2;
|
|
326 continue;
|
|
327 }
|
|
328
|
|
329 chartypes = WORLD;
|
|
330 break;
|
|
331 }
|
|
332
|
|
333 if (chartypes == LATIN_1)
|
440
|
334 TO_EXTERNAL_FORMAT (LISP_STRING, selection_value,
|
|
335 ALLOCA, (data, bytes),
|
|
336 Qbinary);
|
428
|
337 else if (chartypes == WORLD)
|
|
338 {
|
440
|
339 TO_EXTERNAL_FORMAT (LISP_STRING, selection_value,
|
|
340 ALLOCA, (data, bytes),
|
|
341 Qctext);
|
428
|
342 encoding = "COMPOUND_TEXT";
|
|
343 }
|
|
344 }
|
|
345 #endif /* MULE */
|
|
346
|
|
347 fmh = XmStringCreateLtoR ("Clipboard", XmSTRING_DEFAULT_CHARSET);
|
|
348 while (ClipboardSuccess !=
|
|
349 XmClipboardStartCopy (display, selecting_window, fmh, thyme,
|
|
350 #ifdef MOTIF_INCREMENTAL_CLIPBOARDS_WORK
|
|
351 widget, motif_clipboard_cb,
|
|
352 #else
|
|
353 0, NULL,
|
|
354 #endif
|
|
355 &itemid))
|
|
356 ;
|
|
357 XmStringFree (fmh);
|
|
358 while (ClipboardSuccess !=
|
|
359 XmClipboardCopy (display, selecting_window, itemid, encoding,
|
|
360 #ifdef MOTIF_INCREMENTAL_CLIPBOARDS_WORK
|
|
361 /* O'Reilly examples say size can be 0,
|
|
362 but this clearly is not the case. */
|
|
363 0, bytes, (int) selecting_window, /* private id */
|
|
364 #else /* !MOTIF_INCREMENTAL_CLIPBOARDS_WORK */
|
|
365 (XtPointer) data, bytes, 0,
|
|
366 #endif /* !MOTIF_INCREMENTAL_CLIPBOARDS_WORK */
|
|
367 &dataid))
|
|
368 ;
|
|
369 while (ClipboardSuccess !=
|
|
370 XmClipboardEndCopy (display, selecting_window, itemid))
|
|
371 ;
|
|
372 }
|
|
373 }
|
|
374
|
|
375 # ifdef MOTIF_INCREMENTAL_CLIPBOARDS_WORK
|
|
376 /* I tried to treat the clipboard like a real selection, and not send
|
|
377 the data until it was requested, but it looks like that just doesn't
|
|
378 work at all unless the selection owner and requestor are in different
|
|
379 processes. From reading the Motif source, it looks like they never
|
|
380 even considered having two widgets in the same application transfer
|
|
381 data between each other using "by-name" clipboard values. What a
|
|
382 bunch of fuckups.
|
|
383 */
|
|
384 static void
|
|
385 motif_clipboard_cb (Widget widget, int *data_id, int *private_id, int *reason)
|
|
386 {
|
|
387 switch (*reason)
|
|
388 {
|
|
389 case XmCR_CLIPBOARD_DATA_REQUEST:
|
|
390 {
|
|
391 Display *dpy = XtDisplay (widget);
|
|
392 Window window = (Window) *private_id;
|
442
|
393 Lisp_Object selection = select_convert_out (QCLIPBOARD, Qnil, Qnil);
|
|
394
|
2500
|
395 /* Whichever lazy git wrote this originally just called ABORT()
|
442
|
396 when anything didn't go their way... */
|
|
397
|
|
398 /* Try some other text types */
|
|
399 if (NILP (selection))
|
|
400 selection = select_convert_out (QCLIPBOARD, QSTRING, Qnil);
|
|
401 if (NILP (selection))
|
|
402 selection = select_convert_out (QCLIPBOARD, QTEXT, Qnil);
|
|
403 if (NILP (selection))
|
|
404 selection = select_convert_out (QCLIPBOARD, QCOMPOUND_TEXT, Qnil);
|
|
405
|
|
406 if (CONSP (selection) && SYMBOLP (XCAR (selection))
|
|
407 && (EQ (XCAR (selection), QSTRING)
|
|
408 || EQ (XCAR (selection), QTEXT)
|
|
409 || EQ (XCAR (selection), QCOMPOUND_TEXT)))
|
|
410 selection = XCDR (selection);
|
|
411
|
|
412 if (NILP (selection))
|
563
|
413 signal_error (Qselection_conversion_error, "no selection",
|
|
414 Qunbound);
|
442
|
415
|
|
416 if (!STRINGP (selection))
|
|
417 signal_error (Qselection_conversion_error,
|
563
|
418 "couldn't convert selection to string", Qunbound);
|
442
|
419
|
|
420
|
428
|
421 XmClipboardCopyByName (dpy, window, *data_id,
|
|
422 (char *) XSTRING_DATA (selection),
|
|
423 XSTRING_LENGTH (selection) + 1,
|
|
424 0);
|
|
425 }
|
|
426 break;
|
|
427 case XmCR_CLIPBOARD_DATA_DELETE:
|
|
428 default:
|
|
429 /* don't need to free anything */
|
|
430 break;
|
|
431 }
|
|
432 }
|
|
433 # endif /* MOTIF_INCREMENTAL_CLIPBOARDS_WORK */
|
|
434 #endif /* MOTIF_CLIPBOARDS */
|
|
435
|
|
436
|
|
437
|
|
438
|
|
439 /* Send a SelectionNotify event to the requestor with property=None, meaning
|
|
440 we were unable to do what they wanted.
|
|
441 */
|
|
442 static void
|
|
443 x_decline_selection_request (XSelectionRequestEvent *event)
|
|
444 {
|
|
445 XSelectionEvent reply;
|
|
446 reply.type = SelectionNotify;
|
|
447 reply.display = event->display;
|
|
448 reply.requestor = event->requestor;
|
|
449 reply.selection = event->selection;
|
|
450 reply.time = event->time;
|
|
451 reply.target = event->target;
|
|
452 reply.property = None;
|
|
453
|
|
454 XSendEvent (reply.display, reply.requestor, False, 0L, (XEvent *) &reply);
|
|
455 XFlush (reply.display);
|
|
456 }
|
|
457
|
|
458
|
|
459 /* Used as an unwind-protect clause so that, if a selection-converter signals
|
|
460 an error, we tell the requestor that we were unable to do what they wanted
|
|
461 before we throw to top-level or go into the debugger or whatever.
|
|
462 */
|
|
463 static Lisp_Object
|
|
464 x_selection_request_lisp_error (Lisp_Object closure)
|
|
465 {
|
|
466 XSelectionRequestEvent *event = (XSelectionRequestEvent *)
|
|
467 get_opaque_ptr (closure);
|
|
468
|
|
469 free_opaque_ptr (closure);
|
|
470 if (event->type == 0) /* we set this to mean "completed normally" */
|
|
471 return Qnil;
|
|
472 x_decline_selection_request (event);
|
|
473 return Qnil;
|
|
474 }
|
|
475
|
|
476
|
|
477 /* Convert our selection to the requested type, and put that data where the
|
|
478 requestor wants it. Then tell them whether we've succeeded.
|
|
479 */
|
|
480 static void
|
|
481 x_reply_selection_request (XSelectionRequestEvent *event, int format,
|
2367
|
482 Rawbyte *data, Bytecount size, Atom type)
|
428
|
483 {
|
|
484 /* This function can GC */
|
|
485 XSelectionEvent reply;
|
|
486 Display *display = event->display;
|
|
487 struct device *d = get_device_from_display (display);
|
|
488 Window window = event->requestor;
|
665
|
489 Bytecount bytes_remaining;
|
428
|
490 int format_bytes = format/8;
|
665
|
491 Bytecount max_bytes = SELECTION_QUANTUM (display);
|
428
|
492 if (max_bytes > MAX_SELECTION_QUANTUM) max_bytes = MAX_SELECTION_QUANTUM;
|
|
493
|
|
494 reply.type = SelectionNotify;
|
|
495 reply.display = display;
|
|
496 reply.requestor = window;
|
|
497 reply.selection = event->selection;
|
|
498 reply.time = event->time;
|
|
499 reply.target = event->target;
|
|
500 reply.property = (event->property == None ? event->target : event->property);
|
|
501
|
|
502 /* #### XChangeProperty can generate BadAlloc, and we must handle it! */
|
|
503
|
|
504 /* Store the data on the requested property.
|
|
505 If the selection is large, only store the first N bytes of it.
|
|
506 */
|
|
507 bytes_remaining = size * format_bytes;
|
|
508 if (bytes_remaining <= max_bytes)
|
|
509 {
|
|
510 /* Send all the data at once, with minimal handshaking. */
|
|
511 #if 0
|
|
512 stderr_out ("\nStoring all %d\n", bytes_remaining);
|
|
513 #endif
|
|
514 XChangeProperty (display, window, reply.property, type, format,
|
|
515 PropModeReplace, data, size);
|
|
516 /* At this point, the selection was successfully stored; ack it. */
|
|
517 XSendEvent (display, window, False, 0L, (XEvent *) &reply);
|
|
518 XFlush (display);
|
|
519 }
|
|
520 else
|
|
521 {
|
|
522 /* Send an INCR selection. */
|
|
523 int prop_id;
|
|
524
|
|
525 if (x_window_to_frame (d, window)) /* #### debug */
|
563
|
526 invalid_operation ("attempt to transfer an INCR to ourself!", Qunbound);
|
428
|
527 #if 0
|
|
528 stderr_out ("\nINCR %d\n", bytes_remaining);
|
|
529 #endif
|
|
530 prop_id = expect_property_change (display, window, reply.property,
|
|
531 PropertyDelete);
|
|
532
|
|
533 XChangeProperty (display, window, reply.property, DEVICE_XATOM_INCR (d),
|
2367
|
534 32, PropModeReplace, (Rawbyte *)
|
428
|
535 &bytes_remaining, 1);
|
|
536 XSelectInput (display, window, PropertyChangeMask);
|
|
537 /* Tell 'em the INCR data is there... */
|
|
538 XSendEvent (display, window, False, 0L, (XEvent *) &reply);
|
|
539 XFlush (display);
|
|
540
|
|
541 /* First, wait for the requestor to ack by deleting the property.
|
|
542 This can run random lisp code (process handlers) or signal.
|
|
543 */
|
|
544 wait_for_property_change (prop_id);
|
|
545
|
|
546 while (bytes_remaining)
|
|
547 {
|
665
|
548 Bytecount i = ((bytes_remaining < max_bytes)
|
428
|
549 ? bytes_remaining
|
|
550 : max_bytes);
|
|
551 prop_id = expect_property_change (display, window, reply.property,
|
|
552 PropertyDelete);
|
|
553 #if 0
|
|
554 stderr_out (" INCR adding %d\n", i);
|
|
555 #endif
|
|
556 /* Append the next chunk of data to the property. */
|
|
557 XChangeProperty (display, window, reply.property, type, format,
|
|
558 PropModeAppend, data, i / format_bytes);
|
|
559 bytes_remaining -= i;
|
|
560 data += i;
|
|
561
|
|
562 /* Now wait for the requestor to ack this chunk by deleting the
|
|
563 property. This can run random lisp code or signal.
|
|
564 */
|
|
565 wait_for_property_change (prop_id);
|
|
566 }
|
|
567 /* Now write a zero-length chunk to the property to tell the requestor
|
|
568 that we're done. */
|
|
569 #if 0
|
|
570 stderr_out (" INCR done\n");
|
|
571 #endif
|
|
572 if (! waiting_for_other_props_on_window (display, window))
|
|
573 XSelectInput (display, window, 0L);
|
|
574
|
|
575 XChangeProperty (display, window, reply.property, type, format,
|
|
576 PropModeReplace, data, 0);
|
|
577 }
|
|
578 }
|
|
579
|
|
580
|
|
581
|
|
582 /* Called from the event-loop in response to a SelectionRequest event.
|
|
583 */
|
|
584 void
|
|
585 x_handle_selection_request (XSelectionRequestEvent *event)
|
|
586 {
|
|
587 /* This function can GC */
|
442
|
588 struct gcpro gcpro1, gcpro2;
|
|
589 Lisp_Object temp_obj;
|
428
|
590 Lisp_Object selection_symbol;
|
|
591 Lisp_Object target_symbol = Qnil;
|
|
592 Lisp_Object converted_selection = Qnil;
|
|
593 Time local_selection_time;
|
|
594 Lisp_Object successful_p = Qnil;
|
|
595 int count;
|
|
596 struct device *d = get_device_from_display (event->display);
|
|
597
|
442
|
598 GCPRO2 (converted_selection, target_symbol);
|
428
|
599
|
|
600 selection_symbol = x_atom_to_symbol (d, event->selection);
|
442
|
601 target_symbol = x_atom_to_symbol (d, event->target);
|
428
|
602
|
442
|
603 #if 0 /* #### MULTIPLE doesn't work yet */
|
|
604 if (EQ (target_symbol, QMULTIPLE))
|
|
605 target_symbol = fetch_multiple_target (event);
|
428
|
606 #endif
|
|
607
|
442
|
608 temp_obj = Fget_selection_timestamp (selection_symbol);
|
|
609
|
|
610 if (NILP (temp_obj))
|
428
|
611 {
|
442
|
612 /* We don't appear to have the selection. */
|
428
|
613 x_decline_selection_request (event);
|
442
|
614
|
428
|
615 goto DONE_LABEL;
|
|
616 }
|
|
617
|
442
|
618 local_selection_time = * (Time *) XOPAQUE_DATA (temp_obj);
|
428
|
619
|
|
620 if (event->time != CurrentTime &&
|
|
621 local_selection_time > event->time)
|
|
622 {
|
|
623 /* Someone asked for the selection, and we have one, but not the one
|
|
624 they're looking for. */
|
|
625 x_decline_selection_request (event);
|
|
626 goto DONE_LABEL;
|
|
627 }
|
|
628
|
442
|
629 converted_selection = select_convert_out (selection_symbol,
|
|
630 target_symbol, Qnil);
|
|
631
|
|
632 /* #### Is this the right thing to do? I'm no X expert. -- ajh */
|
|
633 if (NILP (converted_selection))
|
|
634 {
|
|
635 /* We don't appear to have a selection in that data type. */
|
|
636 x_decline_selection_request (event);
|
|
637 goto DONE_LABEL;
|
|
638 }
|
|
639
|
428
|
640 count = specpdl_depth ();
|
|
641 record_unwind_protect (x_selection_request_lisp_error,
|
|
642 make_opaque_ptr (event));
|
|
643
|
442
|
644 {
|
2367
|
645 Rawbyte *data;
|
665
|
646 Bytecount size;
|
442
|
647 int format;
|
|
648 Atom type;
|
|
649 lisp_data_to_selection_data (d, converted_selection,
|
|
650 &data, &type, &size, &format);
|
428
|
651
|
442
|
652 x_reply_selection_request (event, format, data, size, type);
|
|
653 successful_p = Qt;
|
|
654 /* Tell x_selection_request_lisp_error() it's cool. */
|
|
655 event->type = 0;
|
2367
|
656 xfree (data, Rawbyte *);
|
442
|
657 }
|
|
658
|
771
|
659 unbind_to (count);
|
428
|
660
|
|
661 DONE_LABEL:
|
|
662
|
|
663 UNGCPRO;
|
|
664
|
|
665 /* Let random lisp code notice that the selection has been asked for. */
|
|
666 {
|
|
667 Lisp_Object val = Vx_sent_selection_hooks;
|
|
668 if (!UNBOUNDP (val) && !NILP (val))
|
|
669 {
|
442
|
670 Lisp_Object rest;
|
428
|
671 if (CONSP (val) && !EQ (XCAR (val), Qlambda))
|
|
672 for (rest = val; !NILP (rest); rest = Fcdr (rest))
|
442
|
673 call3 (Fcar (rest), selection_symbol, target_symbol, successful_p);
|
428
|
674 else
|
442
|
675 call3 (val, selection_symbol, target_symbol, successful_p);
|
428
|
676 }
|
|
677 }
|
|
678 }
|
|
679
|
|
680
|
|
681 /* Called from the event-loop in response to a SelectionClear event.
|
|
682 */
|
|
683 void
|
|
684 x_handle_selection_clear (XSelectionClearEvent *event)
|
|
685 {
|
|
686 Display *display = event->display;
|
|
687 struct device *d = get_device_from_display (display);
|
|
688 Atom selection = event->selection;
|
|
689 Time changed_owner_time = event->time;
|
|
690
|
442
|
691 Lisp_Object selection_symbol, local_selection_time_lisp;
|
428
|
692 Time local_selection_time;
|
|
693
|
|
694 selection_symbol = x_atom_to_symbol (d, selection);
|
|
695
|
442
|
696 local_selection_time_lisp = Fget_selection_timestamp (selection_symbol);
|
428
|
697
|
442
|
698 /* We don't own the selection, so that's fine. */
|
|
699 if (NILP (local_selection_time_lisp))
|
|
700 return;
|
428
|
701
|
442
|
702 local_selection_time = * (Time *) XOPAQUE_DATA (local_selection_time_lisp);
|
428
|
703
|
|
704 /* This SelectionClear is for a selection that we no longer own, so we can
|
|
705 disregard it. (That is, we have reasserted the selection since this
|
|
706 request was generated.)
|
|
707 */
|
|
708 if (changed_owner_time != CurrentTime &&
|
|
709 local_selection_time > changed_owner_time)
|
|
710 return;
|
442
|
711
|
428
|
712 handle_selection_clear (selection_symbol);
|
|
713 }
|
|
714
|
|
715
|
|
716 /* This stuff is so that INCR selections are reentrant (that is, so we can
|
|
717 be servicing multiple INCR selection requests simultaneously). I haven't
|
|
718 actually tested that yet.
|
|
719 */
|
|
720
|
|
721 static int prop_location_tick;
|
|
722
|
|
723 static struct prop_location {
|
|
724 int tick;
|
|
725 Display *display;
|
|
726 Window window;
|
|
727 Atom property;
|
|
728 int desired_state;
|
|
729 struct prop_location *next;
|
|
730 } *for_whom_the_bell_tolls;
|
|
731
|
|
732
|
|
733 static int
|
|
734 property_deleted_p (void *tick)
|
|
735 {
|
|
736 struct prop_location *rest = for_whom_the_bell_tolls;
|
|
737 while (rest)
|
|
738 if (rest->tick == (long) tick)
|
|
739 return 0;
|
|
740 else
|
|
741 rest = rest->next;
|
|
742 return 1;
|
|
743 }
|
|
744
|
|
745 static int
|
|
746 waiting_for_other_props_on_window (Display *display, Window window)
|
|
747 {
|
|
748 struct prop_location *rest = for_whom_the_bell_tolls;
|
|
749 while (rest)
|
|
750 if (rest->display == display && rest->window == window)
|
|
751 return 1;
|
|
752 else
|
|
753 rest = rest->next;
|
|
754 return 0;
|
|
755 }
|
|
756
|
|
757
|
|
758 static int
|
|
759 expect_property_change (Display *display, Window window,
|
|
760 Atom property, int state)
|
|
761 {
|
|
762 struct prop_location *pl = xnew (struct prop_location);
|
|
763 pl->tick = ++prop_location_tick;
|
|
764 pl->display = display;
|
|
765 pl->window = window;
|
|
766 pl->property = property;
|
|
767 pl->desired_state = state;
|
|
768 pl->next = for_whom_the_bell_tolls;
|
|
769 for_whom_the_bell_tolls = pl;
|
|
770 return pl->tick;
|
|
771 }
|
|
772
|
|
773 static void
|
|
774 unexpect_property_change (int tick)
|
|
775 {
|
|
776 struct prop_location *prev = 0, *rest = for_whom_the_bell_tolls;
|
|
777 while (rest)
|
|
778 {
|
|
779 if (rest->tick == tick)
|
|
780 {
|
|
781 if (prev)
|
|
782 prev->next = rest->next;
|
|
783 else
|
|
784 for_whom_the_bell_tolls = rest->next;
|
1726
|
785 xfree (rest, struct prop_location *);
|
428
|
786 return;
|
|
787 }
|
|
788 prev = rest;
|
|
789 rest = rest->next;
|
|
790 }
|
|
791 }
|
|
792
|
|
793 static void
|
|
794 wait_for_property_change (long tick)
|
|
795 {
|
|
796 /* This function can GC */
|
|
797 wait_delaying_user_input (property_deleted_p, (void *) tick);
|
|
798 }
|
|
799
|
|
800
|
|
801 /* Called from the event-loop in response to a PropertyNotify event.
|
|
802 */
|
|
803 void
|
|
804 x_handle_property_notify (XPropertyEvent *event)
|
|
805 {
|
|
806 struct prop_location *prev = 0, *rest = for_whom_the_bell_tolls;
|
|
807 while (rest)
|
|
808 {
|
|
809 if (rest->property == event->atom &&
|
|
810 rest->window == event->window &&
|
|
811 rest->display == event->display &&
|
|
812 rest->desired_state == event->state)
|
|
813 {
|
|
814 #if 0
|
|
815 stderr_out ("Saw expected prop-%s on %s\n",
|
793
|
816 (event->state == PropertyDelete ? "delete" : "change"),
|
|
817 XSTRING_DATA
|
|
818 (XSYMBOL (x_atom_to_symbol
|
|
819 (get_device_from_display (event->display),
|
1726
|
820 event->atom))->name));
|
428
|
821 #endif
|
|
822 if (prev)
|
|
823 prev->next = rest->next;
|
|
824 else
|
|
825 for_whom_the_bell_tolls = rest->next;
|
1726
|
826 xfree (rest, struct prop_location *);
|
428
|
827 return;
|
|
828 }
|
|
829 prev = rest;
|
|
830 rest = rest->next;
|
|
831 }
|
|
832 #if 0
|
|
833 stderr_out ("Saw UNexpected prop-%s on %s\n",
|
793
|
834 (event->state == PropertyDelete ? "delete" : "change"),
|
|
835 XSTRING_DATA (XSYMBOL (x_atom_to_symbol
|
|
836 (get_device_from_display (event->display),
|
|
837 event->atom))->name));
|
428
|
838 #endif
|
|
839 }
|
|
840
|
|
841
|
|
842
|
|
843 #if 0 /* #### MULTIPLE doesn't work yet */
|
|
844
|
|
845 static Lisp_Object
|
|
846 fetch_multiple_target (XSelectionRequestEvent *event)
|
|
847 {
|
|
848 /* This function can GC */
|
|
849 Display *display = event->display;
|
|
850 Window window = event->requestor;
|
|
851 Atom target = event->target;
|
|
852 Atom selection_atom = event->selection;
|
|
853 int result;
|
|
854
|
|
855 return
|
|
856 Fcons (QMULTIPLE,
|
|
857 x_get_window_property_as_lisp_data (display, window, target,
|
|
858 QMULTIPLE,
|
|
859 selection_atom));
|
|
860 }
|
|
861
|
|
862 static Lisp_Object
|
|
863 copy_multiple_data (Lisp_Object obj)
|
|
864 {
|
|
865 Lisp_Object vec;
|
665
|
866 Elemcount i;
|
|
867 Elemcount len;
|
428
|
868 if (CONSP (obj))
|
|
869 return Fcons (XCAR (obj), copy_multiple_data (XCDR (obj)));
|
|
870
|
|
871 CHECK_VECTOR (obj);
|
|
872 len = XVECTOR_LENGTH (obj);
|
|
873 vec = make_vector (len, Qnil);
|
|
874 for (i = 0; i < len; i++)
|
|
875 {
|
|
876 Lisp_Object vec2 = XVECTOR_DATA (obj) [i];
|
|
877 CHECK_VECTOR (vec2);
|
|
878 if (XVECTOR_LENGTH (vec2) != 2)
|
563
|
879 sferror ("vectors must be of length 2", vec2);
|
428
|
880 XVECTOR_DATA (vec) [i] = make_vector (2, Qnil);
|
|
881 XVECTOR_DATA (XVECTOR_DATA (vec) [i]) [0] = XVECTOR_DATA (vec2) [0];
|
|
882 XVECTOR_DATA (XVECTOR_DATA (vec) [i]) [1] = XVECTOR_DATA (vec2) [1];
|
|
883 }
|
|
884 return vec;
|
|
885 }
|
|
886
|
|
887 #endif /* 0 */
|
|
888
|
|
889
|
|
890 static Window reading_selection_reply;
|
|
891 static Atom reading_which_selection;
|
|
892 static int selection_reply_timed_out;
|
|
893
|
|
894 static int
|
2286
|
895 selection_reply_done (void *UNUSED (unused))
|
428
|
896 {
|
|
897 return !reading_selection_reply;
|
|
898 }
|
|
899
|
|
900 static Lisp_Object Qx_selection_reply_timeout_internal;
|
|
901
|
|
902 DEFUN ("x-selection-reply-timeout-internal", Fx_selection_reply_timeout_internal,
|
|
903 1, 1, 0, /*
|
|
904 */
|
2286
|
905 (UNUSED (arg)))
|
428
|
906 {
|
|
907 selection_reply_timed_out = 1;
|
|
908 reading_selection_reply = 0;
|
|
909 return Qnil;
|
|
910 }
|
|
911
|
|
912
|
|
913 /* Do protocol to read selection-data from the server.
|
|
914 Converts this to lisp data and returns it.
|
|
915 */
|
|
916 static Lisp_Object
|
|
917 x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type)
|
|
918 {
|
|
919 /* This function can GC */
|
|
920 struct device *d = decode_x_device (Qnil);
|
|
921 Display *display = DEVICE_X_DISPLAY (d);
|
|
922 struct frame *sel_frame = selected_frame ();
|
|
923 Window requestor_window = XtWindow (FRAME_X_TEXT_WIDGET (sel_frame));
|
|
924 Time requestor_time = DEVICE_X_MOUSE_TIMESTAMP (d);
|
|
925 Atom target_property = DEVICE_XATOM_EMACS_TMP (d);
|
|
926 Atom selection_atom = symbol_to_x_atom (d, selection_symbol, 0);
|
|
927 int speccount;
|
|
928 Atom type_atom = symbol_to_x_atom (d, (CONSP (target_type) ?
|
|
929 XCAR (target_type) : target_type), 0);
|
|
930
|
|
931 XConvertSelection (display, selection_atom, type_atom, target_property,
|
|
932 requestor_window, requestor_time);
|
|
933
|
|
934 /* Block until the reply has been read. */
|
|
935 reading_selection_reply = requestor_window;
|
|
936 reading_which_selection = selection_atom;
|
|
937 selection_reply_timed_out = 0;
|
|
938
|
|
939 speccount = specpdl_depth ();
|
|
940
|
|
941 /* add a timeout handler */
|
|
942 if (x_selection_timeout > 0)
|
|
943 {
|
|
944 Lisp_Object id = Fadd_timeout (make_int (x_selection_timeout),
|
|
945 Qx_selection_reply_timeout_internal,
|
|
946 Qnil, Qnil);
|
|
947 record_unwind_protect (Fdisable_timeout, id);
|
|
948 }
|
|
949
|
|
950 /* This is ^Gable */
|
|
951 wait_delaying_user_input (selection_reply_done, 0);
|
|
952
|
|
953 if (selection_reply_timed_out)
|
563
|
954 signal_error (Qselection_conversion_error, "timed out waiting for reply from selection owner", Qunbound);
|
428
|
955
|
771
|
956 unbind_to (speccount);
|
428
|
957
|
|
958 /* otherwise, the selection is waiting for us on the requested property. */
|
442
|
959
|
|
960 return select_convert_in (selection_symbol,
|
|
961 target_type,
|
|
962 x_get_window_property_as_lisp_data(display,
|
|
963 requestor_window,
|
|
964 target_property,
|
|
965 target_type,
|
|
966 selection_atom));
|
428
|
967 }
|
|
968
|
|
969
|
|
970 static void
|
|
971 x_get_window_property (Display *display, Window window, Atom property,
|
2367
|
972 Rawbyte **data_ret, Bytecount *bytes_ret,
|
428
|
973 Atom *actual_type_ret, int *actual_format_ret,
|
|
974 unsigned long *actual_size_ret, int delete_p)
|
|
975 {
|
665
|
976 Bytecount total_size;
|
428
|
977 unsigned long bytes_remaining;
|
665
|
978 Bytecount offset = 0;
|
2367
|
979 Rawbyte *tmp_data = 0;
|
428
|
980 int result;
|
665
|
981 Bytecount buffer_size = SELECTION_QUANTUM (display);
|
428
|
982 if (buffer_size > MAX_SELECTION_QUANTUM) buffer_size = MAX_SELECTION_QUANTUM;
|
|
983
|
|
984 /* First probe the thing to find out how big it is. */
|
|
985 result = XGetWindowProperty (display, window, property,
|
|
986 0, 0, False, AnyPropertyType,
|
|
987 actual_type_ret, actual_format_ret,
|
|
988 actual_size_ret,
|
|
989 &bytes_remaining, &tmp_data);
|
|
990 if (result != Success)
|
|
991 {
|
|
992 *data_ret = 0;
|
|
993 *bytes_ret = 0;
|
|
994 return;
|
|
995 }
|
|
996 XFree ((char *) tmp_data);
|
|
997
|
|
998 if (*actual_type_ret == None || *actual_format_ret == 0)
|
|
999 {
|
|
1000 if (delete_p) XDeleteProperty (display, window, property);
|
|
1001 *data_ret = 0;
|
|
1002 *bytes_ret = 0;
|
|
1003 return;
|
|
1004 }
|
|
1005
|
|
1006 total_size = bytes_remaining + 1;
|
2367
|
1007 *data_ret = xnew_rawbytes (total_size);
|
428
|
1008
|
|
1009 /* Now read, until we've gotten it all. */
|
|
1010 while (bytes_remaining)
|
|
1011 {
|
|
1012 #if 0
|
665
|
1013 Bytecount last = bytes_remaining;
|
428
|
1014 #endif
|
|
1015 result =
|
|
1016 XGetWindowProperty (display, window, property,
|
|
1017 offset/4, buffer_size/4,
|
|
1018 (delete_p ? True : False),
|
|
1019 AnyPropertyType,
|
|
1020 actual_type_ret, actual_format_ret,
|
|
1021 actual_size_ret, &bytes_remaining, &tmp_data);
|
|
1022 #if 0
|
|
1023 stderr_out ("<< read %d\n", last-bytes_remaining);
|
|
1024 #endif
|
|
1025 /* If this doesn't return Success at this point, it means that
|
|
1026 some clod deleted the selection while we were in the midst of
|
|
1027 reading it. Deal with that, I guess....
|
|
1028 */
|
|
1029 if (result != Success) break;
|
|
1030 *actual_size_ret *= *actual_format_ret / 8;
|
|
1031 memcpy ((*data_ret) + offset, tmp_data, *actual_size_ret);
|
|
1032 offset += *actual_size_ret;
|
|
1033 XFree ((char *) tmp_data);
|
|
1034 }
|
|
1035 *bytes_ret = offset;
|
|
1036 }
|
|
1037
|
|
1038
|
|
1039 static void
|
|
1040 receive_incremental_selection (Display *display, Window window, Atom property,
|
|
1041 /* this one is for error messages only */
|
2286
|
1042 Lisp_Object UNUSED (target_type),
|
665
|
1043 Bytecount min_size_bytes,
|
2367
|
1044 Rawbyte **data_ret,
|
665
|
1045 Bytecount *size_bytes_ret,
|
428
|
1046 Atom *type_ret, int *format_ret,
|
|
1047 unsigned long *size_ret)
|
|
1048 {
|
|
1049 /* This function can GC */
|
665
|
1050 Bytecount offset = 0;
|
428
|
1051 int prop_id;
|
|
1052 *size_bytes_ret = min_size_bytes;
|
2367
|
1053 *data_ret = xnew_rawbytes (*size_bytes_ret);
|
428
|
1054 #if 0
|
|
1055 stderr_out ("\nread INCR %d\n", min_size_bytes);
|
|
1056 #endif
|
|
1057 /* At this point, we have read an INCR property, and deleted it (which
|
|
1058 is how we ack its receipt: the sending window will be selecting
|
|
1059 PropertyNotify events on our window to notice this).
|
|
1060
|
|
1061 Now, we must loop, waiting for the sending window to put a value on
|
|
1062 that property, then reading the property, then deleting it to ack.
|
|
1063 We are done when the sender places a property of length 0.
|
|
1064 */
|
|
1065 prop_id = expect_property_change (display, window, property,
|
|
1066 PropertyNewValue);
|
|
1067 while (1)
|
|
1068 {
|
2367
|
1069 Rawbyte *tmp_data;
|
665
|
1070 Bytecount tmp_size_bytes;
|
428
|
1071 wait_for_property_change (prop_id);
|
|
1072 /* expect it again immediately, because x_get_window_property may
|
|
1073 .. no it won't, I don't get it.
|
|
1074 .. Ok, I get it now, the Xt code that implements INCR is broken.
|
|
1075 */
|
|
1076 prop_id = expect_property_change (display, window, property,
|
|
1077 PropertyNewValue);
|
|
1078 x_get_window_property (display, window, property,
|
|
1079 &tmp_data, &tmp_size_bytes,
|
|
1080 type_ret, format_ret, size_ret, 1);
|
|
1081
|
|
1082 if (tmp_size_bytes == 0) /* we're done */
|
|
1083 {
|
|
1084 #if 0
|
|
1085 stderr_out (" read INCR done\n");
|
|
1086 #endif
|
|
1087 unexpect_property_change (prop_id);
|
1726
|
1088 if (tmp_data)
|
2367
|
1089 xfree (tmp_data, Rawbyte *);
|
428
|
1090 break;
|
|
1091 }
|
|
1092 #if 0
|
|
1093 stderr_out (" read INCR %d\n", tmp_size_bytes);
|
|
1094 #endif
|
|
1095 if (*size_bytes_ret < offset + tmp_size_bytes)
|
|
1096 {
|
|
1097 #if 0
|
|
1098 stderr_out (" read INCR realloc %d -> %d\n",
|
|
1099 *size_bytes_ret, offset + tmp_size_bytes);
|
|
1100 #endif
|
|
1101 *size_bytes_ret = offset + tmp_size_bytes;
|
2367
|
1102 *data_ret = (Rawbyte *) xrealloc (*data_ret, *size_bytes_ret);
|
428
|
1103 }
|
|
1104 memcpy ((*data_ret) + offset, tmp_data, tmp_size_bytes);
|
|
1105 offset += tmp_size_bytes;
|
2367
|
1106 xfree (tmp_data, Rawbyte *);
|
428
|
1107 }
|
|
1108 }
|
|
1109
|
|
1110
|
|
1111 static Lisp_Object
|
|
1112 x_get_window_property_as_lisp_data (Display *display,
|
|
1113 Window window,
|
|
1114 Atom property,
|
|
1115 /* next two for error messages only */
|
|
1116 Lisp_Object target_type,
|
|
1117 Atom selection_atom)
|
|
1118 {
|
|
1119 /* This function can GC */
|
|
1120 Atom actual_type;
|
|
1121 int actual_format;
|
|
1122 unsigned long actual_size;
|
2367
|
1123 Rawbyte *data = NULL;
|
665
|
1124 Bytecount bytes = 0;
|
428
|
1125 Lisp_Object val;
|
|
1126 struct device *d = get_device_from_display (display);
|
|
1127
|
|
1128 x_get_window_property (display, window, property, &data, &bytes,
|
|
1129 &actual_type, &actual_format, &actual_size, 1);
|
|
1130 if (! data)
|
|
1131 {
|
|
1132 if (XGetSelectionOwner (display, selection_atom))
|
|
1133 /* there is a selection owner */
|
563
|
1134 signal_error (Qselection_conversion_error,
|
|
1135 "selection owner couldn't convert",
|
|
1136 Fcons (Qunbound,
|
|
1137 Fcons (x_atom_to_symbol (d, selection_atom),
|
|
1138 actual_type ?
|
|
1139 list2 (target_type,
|
|
1140 x_atom_to_symbol (d, actual_type)) :
|
|
1141 list1 (target_type))));
|
428
|
1142 else
|
563
|
1143 signal_error (Qselection_conversion_error,
|
|
1144 "no selection",
|
|
1145 x_atom_to_symbol (d, selection_atom));
|
428
|
1146 }
|
|
1147
|
|
1148 if (actual_type == DEVICE_XATOM_INCR (d))
|
|
1149 {
|
|
1150 /* Ok, that data wasn't *the* data, it was just the beginning. */
|
|
1151
|
665
|
1152 Bytecount min_size_bytes =
|
647
|
1153 /* careful here. */
|
665
|
1154 (Bytecount) (* ((unsigned int *) data));
|
2367
|
1155 xfree (data, Rawbyte *);
|
428
|
1156 receive_incremental_selection (display, window, property, target_type,
|
|
1157 min_size_bytes, &data, &bytes,
|
|
1158 &actual_type, &actual_format,
|
|
1159 &actual_size);
|
|
1160 }
|
|
1161
|
|
1162 /* It's been read. Now convert it to a lisp object in some semi-rational
|
|
1163 manner. */
|
|
1164 val = selection_data_to_lisp_data (d, data, bytes,
|
|
1165 actual_type, actual_format);
|
|
1166
|
2367
|
1167 xfree (data, Rawbyte *);
|
428
|
1168 return val;
|
|
1169 }
|
|
1170
|
|
1171
|
|
1172 /* Called from the event loop to handle SelectionNotify events.
|
|
1173 I don't think this needs to be reentrant.
|
|
1174 */
|
|
1175 void
|
|
1176 x_handle_selection_notify (XSelectionEvent *event)
|
|
1177 {
|
|
1178 if (! reading_selection_reply)
|
|
1179 message ("received an unexpected SelectionNotify event");
|
|
1180 else if (event->requestor != reading_selection_reply)
|
|
1181 message ("received a SelectionNotify event for the wrong window");
|
|
1182 else if (event->selection != reading_which_selection)
|
|
1183 message ("received the wrong selection type in SelectionNotify!");
|
|
1184 else
|
|
1185 reading_selection_reply = 0; /* we're done now. */
|
|
1186 }
|
|
1187
|
|
1188 static void
|
|
1189 x_disown_selection (Lisp_Object selection, Lisp_Object timeval)
|
|
1190 {
|
|
1191 struct device *d = decode_x_device (Qnil);
|
|
1192 Display *display = DEVICE_X_DISPLAY (d);
|
|
1193 Time timestamp;
|
|
1194 Atom selection_atom;
|
|
1195
|
|
1196 CHECK_SYMBOL (selection);
|
|
1197 if (NILP (timeval))
|
|
1198 timestamp = DEVICE_X_MOUSE_TIMESTAMP (d);
|
|
1199 else
|
|
1200 {
|
|
1201 /* #### This is bogus. See the comment above about problems
|
|
1202 on OSF/1 and DEC Alphas. Yet another reason why it sucks
|
|
1203 to have the implementation (i.e. cons of two 16-bit
|
|
1204 integers) exposed. */
|
|
1205 time_t the_time;
|
|
1206 lisp_to_time (timeval, &the_time);
|
|
1207 timestamp = (Time) the_time;
|
|
1208 }
|
|
1209
|
|
1210 selection_atom = symbol_to_x_atom (d, selection, 0);
|
|
1211
|
|
1212 XSetSelectionOwner (display, selection_atom, None, timestamp);
|
|
1213 }
|
|
1214
|
|
1215 static Lisp_Object
|
442
|
1216 x_selection_exists_p (Lisp_Object selection,
|
2286
|
1217 Lisp_Object UNUSED (selection_type))
|
428
|
1218 {
|
|
1219 struct device *d = decode_x_device (Qnil);
|
|
1220 Display *dpy = DEVICE_X_DISPLAY (d);
|
|
1221 return XGetSelectionOwner (dpy, symbol_to_x_atom (d, selection, 0)) != None ?
|
|
1222 Qt : Qnil;
|
|
1223 }
|
|
1224
|
|
1225
|
|
1226 #ifdef CUT_BUFFER_SUPPORT
|
|
1227
|
|
1228 static int cut_buffers_initialized; /* Whether we're sure they all exist */
|
|
1229
|
|
1230 /* Ensure that all 8 cut buffers exist. ICCCM says we gotta... */
|
|
1231 static void
|
|
1232 initialize_cut_buffers (Display *display, Window window)
|
|
1233 {
|
442
|
1234 static unsigned const char * const data = (unsigned const char *) "";
|
428
|
1235 #define FROB(atom) XChangeProperty (display, window, atom, XA_STRING, 8, \
|
|
1236 PropModeAppend, data, 0)
|
|
1237 FROB (XA_CUT_BUFFER0);
|
|
1238 FROB (XA_CUT_BUFFER1);
|
|
1239 FROB (XA_CUT_BUFFER2);
|
|
1240 FROB (XA_CUT_BUFFER3);
|
|
1241 FROB (XA_CUT_BUFFER4);
|
|
1242 FROB (XA_CUT_BUFFER5);
|
|
1243 FROB (XA_CUT_BUFFER6);
|
|
1244 FROB (XA_CUT_BUFFER7);
|
|
1245 #undef FROB
|
|
1246 cut_buffers_initialized = 1;
|
|
1247 }
|
|
1248
|
|
1249 #define CHECK_CUTBUFFER(symbol) do { \
|
|
1250 CHECK_SYMBOL (symbol); \
|
|
1251 if (! (EQ (symbol, QCUT_BUFFER0) || \
|
|
1252 EQ (symbol, QCUT_BUFFER1) || \
|
|
1253 EQ (symbol, QCUT_BUFFER2) || \
|
|
1254 EQ (symbol, QCUT_BUFFER3) || \
|
|
1255 EQ (symbol, QCUT_BUFFER4) || \
|
|
1256 EQ (symbol, QCUT_BUFFER5) || \
|
|
1257 EQ (symbol, QCUT_BUFFER6) || \
|
|
1258 EQ (symbol, QCUT_BUFFER7))) \
|
563
|
1259 invalid_constant ("Doesn't name a cutbuffer", symbol); \
|
428
|
1260 } while (0)
|
|
1261
|
|
1262 DEFUN ("x-get-cutbuffer-internal", Fx_get_cutbuffer_internal, 1, 1, 0, /*
|
|
1263 Return the value of the named CUTBUFFER (typically CUT_BUFFER0).
|
|
1264 */
|
|
1265 (cutbuffer))
|
|
1266 {
|
|
1267 struct device *d = decode_x_device (Qnil);
|
|
1268 Display *display = DEVICE_X_DISPLAY (d);
|
|
1269 Window window = RootWindow (display, 0); /* Cutbuffers are on frame 0 */
|
|
1270 Atom cut_buffer_atom;
|
2367
|
1271 Rawbyte *data;
|
665
|
1272 Bytecount bytes;
|
428
|
1273 Atom type;
|
|
1274 int format;
|
|
1275 unsigned long size;
|
|
1276 Lisp_Object ret;
|
|
1277
|
|
1278 CHECK_CUTBUFFER (cutbuffer);
|
|
1279 cut_buffer_atom = symbol_to_x_atom (d, cutbuffer, 0);
|
|
1280
|
|
1281 x_get_window_property (display, window, cut_buffer_atom, &data, &bytes,
|
|
1282 &type, &format, &size, 0);
|
|
1283 if (!data) return Qnil;
|
|
1284
|
|
1285 if (format != 8 || type != XA_STRING)
|
563
|
1286 invalid_state_2 ("Cut buffer doesn't contain 8-bit STRING data",
|
|
1287 x_atom_to_symbol (d, type),
|
|
1288 make_int (format));
|
428
|
1289
|
|
1290 /* We cheat - if the string contains an ESC character, that's
|
|
1291 technically not allowed in a STRING, so we assume it's
|
|
1292 COMPOUND_TEXT that we stored there ourselves earlier,
|
|
1293 in x-store-cutbuffer-internal */
|
|
1294 ret = (bytes ?
|
647
|
1295 make_ext_string ((Extbyte *) data, bytes,
|
428
|
1296 memchr (data, 0x1b, bytes) ?
|
440
|
1297 Qctext : Qbinary)
|
428
|
1298 : Qnil);
|
2367
|
1299 xfree (data, Rawbyte *);
|
428
|
1300 return ret;
|
|
1301 }
|
|
1302
|
|
1303
|
|
1304 DEFUN ("x-store-cutbuffer-internal", Fx_store_cutbuffer_internal, 2, 2, 0, /*
|
|
1305 Set the value of the named CUTBUFFER (typically CUT_BUFFER0) to STRING.
|
|
1306 */
|
|
1307 (cutbuffer, string))
|
|
1308 {
|
|
1309 struct device *d = decode_x_device (Qnil);
|
|
1310 Display *display = DEVICE_X_DISPLAY (d);
|
|
1311 Window window = RootWindow (display, 0); /* Cutbuffers are on frame 0 */
|
|
1312 Atom cut_buffer_atom;
|
867
|
1313 const Ibyte *data = XSTRING_DATA (string);
|
444
|
1314 Bytecount bytes = XSTRING_LENGTH (string);
|
|
1315 Bytecount bytes_remaining;
|
665
|
1316 Bytecount max_bytes = SELECTION_QUANTUM (display);
|
428
|
1317 #ifdef MULE
|
867
|
1318 const Ibyte *ptr, *end;
|
428
|
1319 enum { ASCII, LATIN_1, WORLD } chartypes = ASCII;
|
|
1320 #endif
|
|
1321
|
|
1322 if (max_bytes > MAX_SELECTION_QUANTUM)
|
|
1323 max_bytes = MAX_SELECTION_QUANTUM;
|
|
1324
|
|
1325 CHECK_CUTBUFFER (cutbuffer);
|
|
1326 CHECK_STRING (string);
|
|
1327 cut_buffer_atom = symbol_to_x_atom (d, cutbuffer, 0);
|
|
1328
|
|
1329 if (! cut_buffers_initialized)
|
|
1330 initialize_cut_buffers (display, window);
|
|
1331
|
|
1332 /* We use the STRING encoding (Latin-1 only) if we can, else COMPOUND_TEXT.
|
|
1333 We cheat and use type = `STRING' even when using COMPOUND_TEXT.
|
|
1334 The ICCCM requires that this be so, and other clients assume it,
|
|
1335 as we do ourselves in initialize_cut_buffers. */
|
|
1336
|
|
1337 #ifdef MULE
|
|
1338 /* Optimize for the common ASCII case */
|
|
1339 for (ptr = data, end = ptr + bytes; ptr <= end; )
|
|
1340 {
|
826
|
1341 if (byte_ascii_p (*ptr))
|
428
|
1342 {
|
|
1343 ptr++;
|
|
1344 continue;
|
|
1345 }
|
|
1346
|
|
1347 if ((*ptr) == LEADING_BYTE_LATIN_ISO8859_1 ||
|
|
1348 (*ptr) == LEADING_BYTE_CONTROL_1)
|
|
1349 {
|
|
1350 chartypes = LATIN_1;
|
|
1351 ptr += 2;
|
|
1352 continue;
|
|
1353 }
|
|
1354
|
|
1355 chartypes = WORLD;
|
|
1356 break;
|
|
1357 }
|
|
1358
|
|
1359 if (chartypes == LATIN_1)
|
440
|
1360 TO_EXTERNAL_FORMAT (LISP_STRING, string,
|
|
1361 ALLOCA, (data, bytes),
|
|
1362 Qbinary);
|
428
|
1363 else if (chartypes == WORLD)
|
440
|
1364 TO_EXTERNAL_FORMAT (LISP_STRING, string,
|
|
1365 ALLOCA, (data, bytes),
|
|
1366 Qctext);
|
428
|
1367 #endif /* MULE */
|
|
1368
|
|
1369 bytes_remaining = bytes;
|
|
1370
|
|
1371 while (bytes_remaining)
|
|
1372 {
|
665
|
1373 Bytecount chunk =
|
647
|
1374 bytes_remaining < max_bytes ? bytes_remaining : max_bytes;
|
428
|
1375 XChangeProperty (display, window, cut_buffer_atom, XA_STRING, 8,
|
|
1376 (bytes_remaining == bytes
|
|
1377 ? PropModeReplace : PropModeAppend),
|
|
1378 data, chunk);
|
|
1379 data += chunk;
|
|
1380 bytes_remaining -= chunk;
|
|
1381 }
|
|
1382 return string;
|
|
1383 }
|
|
1384
|
|
1385
|
|
1386 DEFUN ("x-rotate-cutbuffers-internal", Fx_rotate_cutbuffers_internal, 1, 1, 0, /*
|
|
1387 Rotate the values of the cutbuffers by the given number of steps;
|
|
1388 positive means move values forward, negative means backward.
|
|
1389 */
|
|
1390 (n))
|
|
1391 {
|
|
1392 struct device *d = decode_x_device (Qnil);
|
|
1393 Display *display = DEVICE_X_DISPLAY (d);
|
|
1394 Window window = RootWindow (display, 0); /* Cutbuffers are on frame 0 */
|
|
1395 Atom props [8];
|
|
1396
|
|
1397 CHECK_INT (n);
|
|
1398 if (XINT (n) == 0)
|
|
1399 return n;
|
|
1400 if (! cut_buffers_initialized)
|
|
1401 initialize_cut_buffers (display, window);
|
|
1402 props[0] = XA_CUT_BUFFER0;
|
|
1403 props[1] = XA_CUT_BUFFER1;
|
|
1404 props[2] = XA_CUT_BUFFER2;
|
|
1405 props[3] = XA_CUT_BUFFER3;
|
|
1406 props[4] = XA_CUT_BUFFER4;
|
|
1407 props[5] = XA_CUT_BUFFER5;
|
|
1408 props[6] = XA_CUT_BUFFER6;
|
|
1409 props[7] = XA_CUT_BUFFER7;
|
|
1410 XRotateWindowProperties (display, window, props, 8, XINT (n));
|
|
1411 return n;
|
|
1412 }
|
|
1413
|
|
1414 #endif /* CUT_BUFFER_SUPPORT */
|
|
1415
|
|
1416
|
|
1417
|
|
1418 /************************************************************************/
|
|
1419 /* initialization */
|
|
1420 /************************************************************************/
|
|
1421
|
|
1422 void
|
440
|
1423 syms_of_select_x (void)
|
428
|
1424 {
|
|
1425
|
|
1426 #ifdef CUT_BUFFER_SUPPORT
|
|
1427 DEFSUBR (Fx_get_cutbuffer_internal);
|
|
1428 DEFSUBR (Fx_store_cutbuffer_internal);
|
|
1429 DEFSUBR (Fx_rotate_cutbuffers_internal);
|
|
1430 #endif /* CUT_BUFFER_SUPPORT */
|
|
1431
|
|
1432 /* Unfortunately, timeout handlers must be lisp functions. */
|
563
|
1433 DEFSYMBOL (Qx_selection_reply_timeout_internal);
|
428
|
1434 DEFSUBR (Fx_selection_reply_timeout_internal);
|
|
1435
|
|
1436 #ifdef CUT_BUFFER_SUPPORT
|
|
1437 defsymbol (&QCUT_BUFFER0, "CUT_BUFFER0");
|
|
1438 defsymbol (&QCUT_BUFFER1, "CUT_BUFFER1");
|
|
1439 defsymbol (&QCUT_BUFFER2, "CUT_BUFFER2");
|
|
1440 defsymbol (&QCUT_BUFFER3, "CUT_BUFFER3");
|
|
1441 defsymbol (&QCUT_BUFFER4, "CUT_BUFFER4");
|
|
1442 defsymbol (&QCUT_BUFFER5, "CUT_BUFFER5");
|
|
1443 defsymbol (&QCUT_BUFFER6, "CUT_BUFFER6");
|
|
1444 defsymbol (&QCUT_BUFFER7, "CUT_BUFFER7");
|
|
1445 #endif /* CUT_BUFFER_SUPPORT */
|
|
1446 }
|
|
1447
|
|
1448 void
|
|
1449 console_type_create_select_x (void)
|
|
1450 {
|
|
1451 CONSOLE_HAS_METHOD (x, own_selection);
|
|
1452 CONSOLE_HAS_METHOD (x, disown_selection);
|
|
1453 CONSOLE_HAS_METHOD (x, get_foreign_selection);
|
|
1454 CONSOLE_HAS_METHOD (x, selection_exists_p);
|
|
1455 }
|
|
1456
|
|
1457 void
|
440
|
1458 reinit_vars_of_select_x (void)
|
428
|
1459 {
|
|
1460 reading_selection_reply = 0;
|
|
1461 reading_which_selection = 0;
|
|
1462 selection_reply_timed_out = 0;
|
|
1463 for_whom_the_bell_tolls = 0;
|
|
1464 prop_location_tick = 0;
|
|
1465 }
|
|
1466
|
|
1467 void
|
440
|
1468 vars_of_select_x (void)
|
428
|
1469 {
|
|
1470 #ifdef CUT_BUFFER_SUPPORT
|
|
1471 cut_buffers_initialized = 0;
|
|
1472 Fprovide (intern ("cut-buffer"));
|
|
1473 #endif
|
|
1474
|
|
1475 DEFVAR_LISP ("x-sent-selection-hooks", &Vx_sent_selection_hooks /*
|
|
1476 A function or functions to be called after we have responded to some
|
|
1477 other client's request for the value of a selection that we own. The
|
|
1478 function(s) will be called with four arguments:
|
|
1479 - the name of the selection (typically PRIMARY, SECONDARY, or CLIPBOARD);
|
|
1480 - the name of the selection-type which we were requested to convert the
|
|
1481 selection into before sending (for example, STRING or LENGTH);
|
|
1482 - and whether we successfully transmitted the selection.
|
|
1483 We might have failed (and declined the request) for any number of reasons,
|
|
1484 including being asked for a selection that we no longer own, or being asked
|
|
1485 to convert into a type that we don't know about or that is inappropriate.
|
|
1486 This hook doesn't let you change the behavior of emacs's selection replies,
|
|
1487 it merely informs you that they have happened.
|
|
1488 */ );
|
|
1489 Vx_sent_selection_hooks = Qunbound;
|
|
1490
|
|
1491 DEFVAR_INT ("x-selection-timeout", &x_selection_timeout /*
|
|
1492 If the selection owner doesn't reply in this many seconds, we give up.
|
|
1493 A value of 0 means wait as long as necessary. This is initialized from the
|
|
1494 \"*selectionTimeout\" resource (which is expressed in milliseconds).
|
|
1495 */ );
|
|
1496 x_selection_timeout = 0;
|
456
|
1497
|
|
1498 DEFVAR_BOOL ("x-selection-strict-motif-ownership", &x_selection_strict_motif_ownership /*
|
863
|
1499 *If nil and XEmacs already owns the clipboard, don't own it again in the
|
456
|
1500 Motif way. Owning the selection on the Motif way does a huge amount of
|
|
1501 X protocol, and it makes killing text incredibly slow when using an
|
|
1502 X terminal. However, when enabled Motif text fields don't bother to look up
|
|
1503 the new value, and you can't Copy from a buffer, Paste into a text
|
|
1504 field, then Copy something else from the buffer and paste it into the
|
|
1505 text field; it pastes the first thing again.
|
|
1506 */ );
|
|
1507 x_selection_strict_motif_ownership = 1;
|
428
|
1508 }
|
|
1509
|
|
1510 void
|
440
|
1511 Xatoms_of_select_x (struct device *d)
|
428
|
1512 {
|
|
1513 Display *D = DEVICE_X_DISPLAY (d);
|
|
1514
|
|
1515 /* Non-predefined atoms that we might end up using a lot */
|
|
1516 DEVICE_XATOM_CLIPBOARD (d) = XInternAtom (D, "CLIPBOARD", False);
|
|
1517 DEVICE_XATOM_TIMESTAMP (d) = XInternAtom (D, "TIMESTAMP", False);
|
|
1518 DEVICE_XATOM_TEXT (d) = XInternAtom (D, "TEXT", False);
|
|
1519 DEVICE_XATOM_DELETE (d) = XInternAtom (D, "DELETE", False);
|
|
1520 DEVICE_XATOM_MULTIPLE (d) = XInternAtom (D, "MULTIPLE", False);
|
|
1521 DEVICE_XATOM_INCR (d) = XInternAtom (D, "INCR", False);
|
|
1522 DEVICE_XATOM_TARGETS (d) = XInternAtom (D, "TARGETS", False);
|
|
1523 DEVICE_XATOM_NULL (d) = XInternAtom (D, "NULL", False);
|
|
1524 DEVICE_XATOM_ATOM_PAIR (d) = XInternAtom (D, "ATOM_PAIR", False);
|
|
1525 DEVICE_XATOM_COMPOUND_TEXT (d) = XInternAtom (D, "COMPOUND_TEXT", False);
|
442
|
1526
|
|
1527 /* #### I don't like the looks of this... what is it for? - ajh */
|
428
|
1528 DEVICE_XATOM_EMACS_TMP (d) = XInternAtom (D, "_EMACS_TMP_", False);
|
|
1529 }
|