From 18050712a4189dcc467f5345d2efcc77d43d1393 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Wed, 6 Jul 2022 13:43:24 +0800 Subject: [PATCH] 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'. --- src/xselect.c | 15 +++++++++++++++ src/xterm.c | 4 ++++ src/xterm.h | 3 +++ 3 files changed, 22 insertions(+) diff --git a/src/xselect.c b/src/xselect.c index 1fda300c431..d1b6d454abd 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -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"); diff --git a/src/xterm.c b/src/xterm.c index 996a441fda3..0180ea3c788 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -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) diff --git a/src/xterm.h b/src/xterm.h index b0f9200eeaf..6684d7839f3 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -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; -- 2.39.5