comparison src/xselect.c @ 2:ac2d302a0011 r19-15b2

Import from CVS: tag r19-15b2
author cvs
date Mon, 13 Aug 2007 08:46:35 +0200
parents 376386a54a3c
children 0293115a14e9
comparison
equal deleted inserted replaced
1:c0c6a60d29db 2:ac2d302a0011
351 slow when using an X terminal. ARRRRGGGHHH!!!! 351 slow when using an X terminal. ARRRRGGGHHH!!!!
352 */ 352 */
353 /* No, this is no good, because then Motif text fields don't bother 353 /* No, this is no good, because then Motif text fields don't bother
354 to look up the new value, and you can't Copy from a buffer, Paste 354 to look up the new value, and you can't Copy from a buffer, Paste
355 into a text field, then Copy something else from the buffer and 355 into a text field, then Copy something else from the buffer and
356 paste it intot he text field -- it pastes the first thing again. */ 356 paste it into the text field -- it pastes the first thing again. */
357 /* && !owned_p */ 357 /* && !owned_p */
358 ) 358 )
359 { 359 {
360 #ifdef MOTIF_INCREMENTAL_CLIPBOARDS_WORK 360 #ifdef MOTIF_INCREMENTAL_CLIPBOARDS_WORK
361 Widget widget = FRAME_X_TEXT_WIDGET (selected_frame()); 361 Widget widget = FRAME_X_TEXT_WIDGET (selected_frame());
365 long dataid; 365 long dataid;
366 #else 366 #else
367 int dataid; /* 1.2 wants long, but 1.1.5 wants int... */ 367 int dataid; /* 1.2 wants long, but 1.1.5 wants int... */
368 #endif 368 #endif
369 XmString fmh; 369 XmString fmh;
370 fmh = XmStringCreateLtoR ("Clipboard", XmSTRING_DEFAULT_CHARSET); 370 fmh = XmStringCreateLtoR ((String) "Clipboard",
371 XmSTRING_DEFAULT_CHARSET);
371 while (ClipboardSuccess != 372 while (ClipboardSuccess !=
372 XmClipboardStartCopy (display, selecting_window, fmh, thyme, 373 XmClipboardStartCopy (display, selecting_window, fmh, thyme,
373 #ifdef MOTIF_INCREMENTAL_CLIPBOARDS_WORK 374 #ifdef MOTIF_INCREMENTAL_CLIPBOARDS_WORK
374 widget, motif_clipboard_cb, 375 widget, motif_clipboard_cb,
375 #else 376 #else
377 #endif 378 #endif
378 &itemid)) 379 &itemid))
379 ; 380 ;
380 XmStringFree (fmh); 381 XmStringFree (fmh);
381 while (ClipboardSuccess != 382 while (ClipboardSuccess !=
382 XmClipboardCopy (display, selecting_window, itemid, "STRING", 383 XmClipboardCopy (display, selecting_window, itemid,
384 (String) "STRING",
383 #ifdef MOTIF_INCREMENTAL_CLIPBOARDS_WORK 385 #ifdef MOTIF_INCREMENTAL_CLIPBOARDS_WORK
384 /* O'Reilly examples say size can be 0, 386 /* O'Reilly examples say size can be 0,
385 but this clearly is not the case. */ 387 but this clearly is not the case. */
386 0, string_length (XSTRING (selection_value)) + 1, 388 0, string_length (XSTRING (selection_value)) + 1,
387 (int) selecting_window, /* private id */ 389 (int) selecting_window, /* private id */
501 small enough, otherwise 32 bits are used. 503 small enough, otherwise 32 bits are used.
502 */ 504 */
503 if (STRINGP (check) || 505 if (STRINGP (check) ||
504 VECTORP (check) || 506 VECTORP (check) ||
505 SYMBOLP (check) || 507 SYMBOLP (check) ||
506 INTP (check) || 508 INTP (check) ||
507 CHARP (check) || 509 CHARP (check) ||
508 NILP (value)) 510 NILP (value))
509 return value; 511 return value;
510 512
511 /* (N . M) or (N M) get turned into a 32 bit quantity. So if you want to 513 /* (N . M) or (N M) get turned into a 32 bit quantity. So if you want to
512 always return a small quantity as 32 bits, your converter routine needs 514 always return a small quantity as 32 bits, your converter routine needs
2110 2112
2111 void 2113 void
2112 Xatoms_of_xselect (struct device *d) 2114 Xatoms_of_xselect (struct device *d)
2113 { 2115 {
2114 #define ATOM(x) XInternAtom (DEVICE_X_DISPLAY (d), (x), False) 2116 #define ATOM(x) XInternAtom (DEVICE_X_DISPLAY (d), (x), False)
2117 #define ATOMIZE(x) DEVICE_XATOM_##x (d) = ATOM(#x)
2115 2118
2116 /* Non-predefined atoms that we might end up using a lot */ 2119 /* Non-predefined atoms that we might end up using a lot */
2117 DEVICE_XATOM_CLIPBOARD (d) = ATOM ("CLIPBOARD"); 2120 ATOMIZE (CLIPBOARD);
2118 DEVICE_XATOM_TIMESTAMP (d) = ATOM ("TIMESTAMP"); 2121 ATOMIZE (TIMESTAMP);
2119 DEVICE_XATOM_TEXT (d) = ATOM ("TEXT"); 2122 ATOMIZE (TEXT);
2120 DEVICE_XATOM_DELETE (d) = ATOM ("DELETE"); 2123 ATOMIZE (DELETE);
2121 DEVICE_XATOM_MULTIPLE (d) = ATOM ("MULTIPLE"); 2124 ATOMIZE (MULTIPLE);
2122 DEVICE_XATOM_INCR (d) = ATOM ("INCR"); 2125 ATOMIZE (INCR);
2123 DEVICE_XATOM_EMACS_TMP (d) = ATOM ("_EMACS_TMP_"); 2126 ATOMIZE (TARGETS);
2124 DEVICE_XATOM_TARGETS (d) = ATOM ("TARGETS"); 2127 ATOMIZE (NULL);
2125 DEVICE_XATOM_NULL (d) = ATOM ("NULL"); 2128 ATOMIZE (ATOM_PAIR);
2126 DEVICE_XATOM_ATOM_PAIR (d) = ATOM ("ATOM_PAIR"); 2129 ATOMIZE (COMPOUND_TEXT);
2127 DEVICE_XATOM_COMPOUND_TEXT (d) = ATOM ("COMPOUND_TEXT"); 2130 DEVICE_XATOM_EMACS_TMP (d) = ATOM ("_EMACS_TMP_");
2128 } 2131 }