aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/select.el
diff options
context:
space:
mode:
authorChong Yidong2011-05-27 12:17:59 -0400
committerChong Yidong2011-05-27 12:17:59 -0400
commita9f737eef69ffe03dd045df555300ae6b41d0edf (patch)
tree515b335a2f07a324ecc71b6a9331b7e0bc712586 /lisp/select.el
parentbe520aca79dd429d55012a1916bdc97f06773fc5 (diff)
downloademacs-a9f737eef69ffe03dd045df555300ae6b41d0edf.tar.gz
emacs-a9f737eef69ffe03dd045df555300ae6b41d0edf.zip
Support X clipboard managers.
* lisp/select.el (xselect-convert-to-targets): Add MULTIPLE target to list. (xselect-convert-to-save-targets): New function. * src/xselect.c: Support for clipboard managers. (Vselection_alist): Move to termhooks.h as terminal-local var. (LOCAL_SELECTION): New macro. (x_atom_to_symbol): Handle x_display_info_for_display fail case. (symbol_to_x_atom): Remove gratuitous arg. (x_handle_selection_request, lisp_data_to_selection_data) (x_get_foreign_selection, Fx_register_dnd_atom): Callers changed. (x_own_selection, x_get_local_selection, x_convert_selection): New arg, specifying work frame. Use terminal-local Vselection_alist. (some_frame_on_display): Delete unused function. (Fx_own_selection_internal, Fx_get_selection_internal) (Fx_disown_selection_internal, Fx_selection_owner_p) (Fx_selection_exists_p): New optional frame arg. (frame_for_x_selection, Fx_clipboard_manager_save): New functions. (x_handle_selection_clear): Don't treat other terminals with the same keyboard specially. Use the terminal-local Vselection_alist. (x_clear_frame_selections): Use Frun_hook_with_args. * src/termhooks.h (Vselection_alist): Make it terminal-local. * src/terminal.c (create_terminal): Initialize it. * src/xterm.c (x_term_init): Intern ATOM and CLIPBOARD_MANAGER atoms. * src/xterm.h: Add support for those atoms.
Diffstat (limited to 'lisp/select.el')
-rw-r--r--lisp/select.el15
1 files changed, 14 insertions, 1 deletions
diff --git a/lisp/select.el b/lisp/select.el
index 1f5191e86c1..5abbf8f795d 100644
--- a/lisp/select.el
+++ b/lisp/select.el
@@ -289,7 +289,9 @@ two markers or an overlay. Otherwise, it is nil."
289 289
290(defun xselect-convert-to-targets (_selection _type _value) 290(defun xselect-convert-to-targets (_selection _type _value)
291 ;; return a vector of atoms, but remove duplicates first. 291 ;; return a vector of atoms, but remove duplicates first.
292 (let* ((all (cons 'TIMESTAMP (mapcar 'car selection-converter-alist))) 292 (let* ((all (cons 'TIMESTAMP
293 (cons 'MULTIPLE
294 (mapcar 'car selection-converter-alist))))
293 (rest all)) 295 (rest all))
294 (while rest 296 (while rest
295 (cond ((memq (car rest) (cdr rest)) 297 (cond ((memq (car rest) (cdr rest))
@@ -365,6 +367,12 @@ This function returns the string \"emacs\"."
365(defun xselect-convert-to-identity (_selection _type value) ; used internally 367(defun xselect-convert-to-identity (_selection _type value) ; used internally
366 (vector value)) 368 (vector value))
367 369
370;; Null target that tells clipboard managers we support SAVE_TARGETS
371;; (see freedesktop.org Clipboard Manager spec).
372(defun xselect-convert-to-save-targets (selection _type _value)
373 (when (eq selection 'CLIPBOARD)
374 'NULL))
375
368(setq selection-converter-alist 376(setq selection-converter-alist
369 '((TEXT . xselect-convert-to-string) 377 '((TEXT . xselect-convert-to-string)
370 (COMPOUND_TEXT . xselect-convert-to-string) 378 (COMPOUND_TEXT . xselect-convert-to-string)
@@ -384,8 +392,13 @@ This function returns the string \"emacs\"."
384 (NAME . xselect-convert-to-name) 392 (NAME . xselect-convert-to-name)
385 (ATOM . xselect-convert-to-atom) 393 (ATOM . xselect-convert-to-atom)
386 (INTEGER . xselect-convert-to-integer) 394 (INTEGER . xselect-convert-to-integer)
395 (SAVE_TARGETS . xselect-convert-to-save-targets)
387 (_EMACS_INTERNAL . xselect-convert-to-identity))) 396 (_EMACS_INTERNAL . xselect-convert-to-identity)))
388 397
398(when (fboundp 'x-clipboard-manager-save)
399 (add-hook 'delete-frame-functions 'x-clipboard-manager-save)
400 (add-hook 'kill-emacs-hook 'x-clipboard-manager-save))
401
389(provide 'select) 402(provide 'select)
390 403
391;;; select.el ends here 404;;; select.el ends here