Speed up interning XDS atoms

* src/xselect.c (symbol_to_x_atom, x_atom_to_symbol)
(syms_of_xselect): Handle new atoms.
* src/xterm.c (x_atom_refs):
* src/xterm.h (struct x_display_info): New atoms
`XdndDirectSave0', `XdndActionDirectSave' and `text/plain'.
This commit is contained in:
Po Lu 2022-07-06 13:43:24 +08:00
parent 27436451ec
commit 18050712a4
3 changed files with 22 additions and 0 deletions

View file

@ -165,6 +165,12 @@ symbol_to_x_atom (struct x_display_info *dpyinfo, Lisp_Object sym)
return dpyinfo->Xatom_XmTRANSFER_SUCCESS;
if (EQ (sym, QXmTRANSFER_FAILURE))
return dpyinfo->Xatom_XmTRANSFER_FAILURE;
if (EQ (sym, QXdndDirectSave0))
return dpyinfo->Xatom_XdndDirectSave0;
if (EQ (sym, Qtext_plain))
return dpyinfo->Xatom_text_plain;
if (EQ (sym, QXdndActionDirectSave))
return dpyinfo->Xatom_XdndActionDirectSave;
if (!SYMBOLP (sym))
emacs_abort ();
@ -233,6 +239,12 @@ x_atom_to_symbol (struct x_display_info *dpyinfo, Atom atom)
return QXmTRANSFER_SUCCESS;
if (atom == dpyinfo->Xatom_XmTRANSFER_FAILURE)
return QXmTRANSFER_FAILURE;
if (atom == dpyinfo->Xatom_XdndDirectSave0)
return QXdndDirectSave0;
if (atom == dpyinfo->Xatom_text_plain)
return Qtext_plain;
if (atom == dpyinfo->Xatom_XdndActionDirectSave)
return QXdndActionDirectSave;
x_catch_errors (dpyinfo->display);
str = x_get_atom_name (dpyinfo, atom, NULL);
@ -2998,6 +3010,9 @@ Note that this does not affect setting or owning selections. */);
DEFSYM (QCLIPBOARD_MANAGER, "CLIPBOARD_MANAGER");
DEFSYM (QSAVE_TARGETS, "SAVE_TARGETS");
DEFSYM (QNULL, "NULL");
DEFSYM (QXdndDirectSave0, "XdndDirectSave0");
DEFSYM (QXdndActionDirectSave, "XdndActionDirectSave");
DEFSYM (Qtext_plain, "text/plain");
DEFSYM (Qforeign_selection, "foreign-selection");
DEFSYM (Qx_lost_selection_functions, "x-lost-selection-functions");
DEFSYM (Qx_sent_selection_functions, "x-sent-selection-functions");

View file

@ -1022,6 +1022,10 @@ static const struct x_atom_ref x_atom_refs[] =
ATOM_REFS_INIT ("XdndLeave", Xatom_XdndLeave)
ATOM_REFS_INIT ("XdndDrop", Xatom_XdndDrop)
ATOM_REFS_INIT ("XdndFinished", Xatom_XdndFinished)
/* XDS source and target. */
ATOM_REFS_INIT ("XdndDirectSave0", Xatom_XdndDirectSave0)
ATOM_REFS_INIT ("XdndActionDirectSave", Xatom_XdndActionDirectSave)
ATOM_REFS_INIT ("text/plain", Xatom_text_plain)
/* Motif drop protocol support. */
ATOM_REFS_INIT ("_MOTIF_DRAG_WINDOW", Xatom_MOTIF_DRAG_WINDOW)
ATOM_REFS_INIT ("_MOTIF_DRAG_TARGETS", Xatom_MOTIF_DRAG_TARGETS)

View file

@ -638,6 +638,9 @@ struct x_display_info
Xatom_XdndPosition, Xatom_XdndStatus, Xatom_XdndLeave, Xatom_XdndDrop,
Xatom_XdndFinished;
/* XDS source and target. */
Atom Xatom_XdndDirectSave0, Xatom_XdndActionDirectSave, Xatom_text_plain;
#ifdef HAVE_XKB
/* Virtual modifiers */
Atom Xatom_Meta, Xatom_Super, Xatom_Hyper, Xatom_ShiftLock, Xatom_Alt;