Mercurial > hg > xemacs-beta
comparison src/select.c @ 2620:5e906dd5c3e9
[xemacs-hg @ 2005-02-28 20:21:43 by aidan]
(Revised) General X11 selection cleanup. Content negotiation for incoming
data, UTF8_STRING support, the ability to paste images (purely cosmetic at
this point), TIMESTAMP as one of the selection types offered,
author | aidan |
---|---|
date | Mon, 28 Feb 2005 20:21:50 +0000 |
parents | 79c6ff3eef26 |
children | 7844ab77b582 |
comparison
equal
deleted
inserted
replaced
2619:935833be8506 | 2620:5e906dd5c3e9 |
---|---|
287 | 287 |
288 GCPRO1 (selection_data); | 288 GCPRO1 (selection_data); |
289 | 289 |
290 /* have to do device specific stuff last so that methods can access the | 290 /* have to do device specific stuff last so that methods can access the |
291 selection_alist */ | 291 selection_alist */ |
292 | |
293 /* If you are re-implementing this for another redisplay type, either make | |
294 certain that the selection time will fit within thirty-two bits, or | |
295 redesign get-xemacs-selection-timestamp to return, say, a bignum, and | |
296 convert the device-specific timestamp to a bignum before storing it in | |
297 this list. The current practice is to blindly assume that the timestamp | |
298 is thirty-two bits, which will work for extant architectures. */ | |
299 | |
292 if (HAS_DEVMETH_P (XDEVICE (device), own_selection)) | 300 if (HAS_DEVMETH_P (XDEVICE (device), own_selection)) |
293 selection_time = DEVMETH (XDEVICE (device), own_selection, | 301 selection_time = DEVMETH (XDEVICE (device), own_selection, |
294 (selection_name, selection_value, | 302 (selection_name, selection_value, |
295 how_to_add, data_type, owned_p)); | 303 how_to_add, data_type, owned_p)); |
296 else | 304 else |
490 return HAS_DEVMETH_P (XDEVICE (device), selection_exists_p) ? | 498 return HAS_DEVMETH_P (XDEVICE (device), selection_exists_p) ? |
491 DEVMETH (XDEVICE (device), selection_exists_p, (selection, data_type)) | 499 DEVMETH (XDEVICE (device), selection_exists_p, (selection, data_type)) |
492 : Qnil; | 500 : Qnil; |
493 } | 501 } |
494 | 502 |
503 Lisp_Object | |
504 get_selection_raw_time(Lisp_Object selection) | |
505 { | |
506 Lisp_Object local_value = assq_no_quit (selection, Vselection_alist); | |
507 | |
508 if (!NILP (local_value)) | |
509 { | |
510 return XCAR (XCDR (XCDR (local_value))); | |
511 } | |
512 return Qnil; | |
513 } | |
514 | |
495 /* Get the timestamp of the given selection */ | 515 /* Get the timestamp of the given selection */ |
496 DEFUN ("get-selection-timestamp", Fget_selection_timestamp, 1, 1, 0, /* | 516 DEFUN ("get-xemacs-selection-timestamp", Fget_selection_timestamp, 1, 1, 0, /* |
497 Return the timestamp associated with the specified SELECTION, if it exists. | 517 Return timestamp for SELECTION, if belongs to XEmacs and exists. |
498 Note that the timestamp is a device-specific object, and may not actually be | 518 |
499 visible from Lisp. | 519 The timestamp is a cons of two integers, the first being the higher-order |
520 sixteen bits of the device-specific thirty-two-bit quantity, the second | |
521 being the lower-order sixteen bits of same. Expect to see this API change | |
522 when and if redisplay on a window system with timestamps wider than 32bits | |
523 happens. | |
500 */ | 524 */ |
501 (selection)) | 525 (selection)) |
502 { | 526 { |
503 Lisp_Object local_value = assq_no_quit (selection, Vselection_alist); | 527 Lisp_Object val = get_selection_raw_time(selection); |
504 | 528 |
505 if (!NILP (local_value)) | 529 if (!NILP (val)) |
506 return XCAR (XCDR (XCDR (local_value))); | 530 { |
531 return word_to_lisp(* (UINT_32_BIT *) XOPAQUE_DATA (val)); | |
532 } | |
507 | 533 |
508 return Qnil; | 534 return Qnil; |
509 } | 535 } |
510 | 536 |
511 /* Request the selection value from the owner. If we are the owner, | 537 /* Request the selection value from the owner. If we are the owner, |