mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-02-01 20:06:00 +00:00
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.
This commit is contained in:
parent
be520aca79
commit
a9f737eef6
@ -1,3 +1,11 @@
|
||||
2011-05-27 Chong Yidong <cyd@stupidchicken.com>
|
||||
|
||||
* select.el: Support clipboard managers with built-in function
|
||||
x-clipboard-manager-save, via delete-frame-functions and
|
||||
kill-emacs-hook.
|
||||
(xselect-convert-to-targets): Add MULTIPLE target to list.
|
||||
(xselect-convert-to-save-targets): New function.
|
||||
|
||||
2011-05-27 Kenichi Handa <handa@m17n.org>
|
||||
|
||||
* mail/sendmail.el (mail-encode-header): Avoid double encoding by
|
||||
|
@ -289,7 +289,9 @@ two markers or an overlay. Otherwise, it is nil."
|
||||
|
||||
(defun xselect-convert-to-targets (_selection _type _value)
|
||||
;; return a vector of atoms, but remove duplicates first.
|
||||
(let* ((all (cons 'TIMESTAMP (mapcar 'car selection-converter-alist)))
|
||||
(let* ((all (cons 'TIMESTAMP
|
||||
(cons 'MULTIPLE
|
||||
(mapcar 'car selection-converter-alist))))
|
||||
(rest all))
|
||||
(while rest
|
||||
(cond ((memq (car rest) (cdr rest))
|
||||
@ -365,6 +367,12 @@ This function returns the string \"emacs\"."
|
||||
(defun xselect-convert-to-identity (_selection _type value) ; used internally
|
||||
(vector value))
|
||||
|
||||
;; Null target that tells clipboard managers we support SAVE_TARGETS
|
||||
;; (see freedesktop.org Clipboard Manager spec).
|
||||
(defun xselect-convert-to-save-targets (selection _type _value)
|
||||
(when (eq selection 'CLIPBOARD)
|
||||
'NULL))
|
||||
|
||||
(setq selection-converter-alist
|
||||
'((TEXT . xselect-convert-to-string)
|
||||
(COMPOUND_TEXT . xselect-convert-to-string)
|
||||
@ -384,8 +392,13 @@ This function returns the string \"emacs\"."
|
||||
(NAME . xselect-convert-to-name)
|
||||
(ATOM . xselect-convert-to-atom)
|
||||
(INTEGER . xselect-convert-to-integer)
|
||||
(SAVE_TARGETS . xselect-convert-to-save-targets)
|
||||
(_EMACS_INTERNAL . xselect-convert-to-identity)))
|
||||
|
||||
(when (fboundp 'x-clipboard-manager-save)
|
||||
(add-hook 'delete-frame-functions 'x-clipboard-manager-save)
|
||||
(add-hook 'kill-emacs-hook 'x-clipboard-manager-save))
|
||||
|
||||
(provide 'select)
|
||||
|
||||
;;; select.el ends here
|
||||
|
@ -1,3 +1,31 @@
|
||||
2011-05-27 Chong Yidong <cyd@stupidchicken.com>
|
||||
|
||||
* termhooks.h (Vselection_alist): Make it terminal-local.
|
||||
|
||||
* terminal.c (create_terminal): Initialize it.
|
||||
|
||||
* 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.
|
||||
|
||||
* xterm.c (x_term_init): Intern ATOM and CLIPBOARD_MANAGER atoms.
|
||||
|
||||
* xterm.h: Add support for those atoms.
|
||||
|
||||
2011-05-26 Chong Yidong <cyd@stupidchicken.com>
|
||||
|
||||
* xselect.c: ICCCM-compliant handling of MULTIPLE targets.
|
||||
|
@ -335,6 +335,22 @@ struct terminal
|
||||
the member terminal_coding. */
|
||||
Lisp_Object charset_list;
|
||||
|
||||
/* This is an association list containing the X selections that
|
||||
Emacs might own on this terminal. Each element has the form
|
||||
(SELECTION-NAME SELECTION-VALUE SELECTION-TIMESTAMP FRAME)
|
||||
SELECTION-NAME is a lisp symbol, whose name is the name of an X Atom.
|
||||
SELECTION-VALUE is the value that emacs owns for that selection.
|
||||
It may be any kind of Lisp object.
|
||||
SELECTION-TIMESTAMP is the time at which emacs began owning this
|
||||
selection, as a cons of two 16-bit numbers (making a 32 bit
|
||||
time.)
|
||||
FRAME is the frame for which we made the selection. If there is
|
||||
an entry in this alist, then it can be assumed that Emacs owns
|
||||
that selection.
|
||||
The only (eq) parts of this list that are visible from Lisp are
|
||||
the selection-values. */
|
||||
Lisp_Object Vselection_alist;
|
||||
|
||||
/* All fields before `next_terminal' should be Lisp_Object and are traced
|
||||
by the GC. All fields afterwards are ignored by the GC. */
|
||||
|
||||
|
@ -256,6 +256,8 @@ create_terminal (void)
|
||||
setup_coding_system (terminal_coding, terminal->terminal_coding);
|
||||
|
||||
terminal->param_alist = Qnil;
|
||||
terminal->charset_list = Qnil;
|
||||
terminal->Vselection_alist = Qnil;
|
||||
return terminal;
|
||||
}
|
||||
|
||||
|
650
src/xselect.c
650
src/xselect.c
File diff suppressed because it is too large
Load Diff
@ -10186,7 +10186,9 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
|
||||
{ "_EMACS_TMP_", &dpyinfo->Xatom_EMACS_TMP },
|
||||
{ "TARGETS", &dpyinfo->Xatom_TARGETS },
|
||||
{ "NULL", &dpyinfo->Xatom_NULL },
|
||||
{ "ATOM", &dpyinfo->Xatom_ATOM },
|
||||
{ "ATOM_PAIR", &dpyinfo->Xatom_ATOM_PAIR },
|
||||
{ "CLIPBOARD_MANAGER", &dpyinfo->Xatom_CLIPBOARD_MANAGER },
|
||||
{ "_XEMBED_INFO", &dpyinfo->Xatom_XEMBED_INFO },
|
||||
/* For properties of font. */
|
||||
{ "PIXEL_SIZE", &dpyinfo->Xatom_PIXEL_SIZE },
|
||||
|
@ -254,7 +254,7 @@ struct x_display_info
|
||||
Atom Xatom_CLIPBOARD, Xatom_TIMESTAMP, Xatom_TEXT, Xatom_DELETE,
|
||||
Xatom_COMPOUND_TEXT, Xatom_UTF8_STRING,
|
||||
Xatom_MULTIPLE, Xatom_INCR, Xatom_EMACS_TMP, Xatom_TARGETS, Xatom_NULL,
|
||||
Xatom_ATOM_PAIR;
|
||||
Xatom_ATOM, Xatom_ATOM_PAIR, Xatom_CLIPBOARD_MANAGER;
|
||||
|
||||
/* More atoms for font properties. The last three are private
|
||||
properties, see the comments in src/fontset.h. */
|
||||
@ -1027,7 +1027,7 @@ extern Lisp_Object x_property_data_to_lisp (struct frame *,
|
||||
|
||||
/* Defined in xfns.c */
|
||||
|
||||
extern struct x_display_info * check_x_display_info (Lisp_Object frame);
|
||||
extern struct x_display_info * check_x_display_info (Lisp_Object);
|
||||
extern Lisp_Object x_get_focus_frame (struct frame *);
|
||||
|
||||
#ifdef USE_GTK
|
||||
|
Loading…
Reference in New Issue
Block a user