]> git.eshelyaron.com Git - emacs.git/commitdiff
Speed up interning XDS atoms
authorPo Lu <luangruo@yahoo.com>
Wed, 6 Jul 2022 05:43:24 +0000 (13:43 +0800)
committerPo Lu <luangruo@yahoo.com>
Wed, 6 Jul 2022 05:43:38 +0000 (13:43 +0800)
* 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
src/xterm.c
src/xterm.h

index 1fda300c431f8140d9fe7d3ad9af4fc6a31dca89..d1b6d454abd0098cdacb8968a950005cac66904a 100644 (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");
index 996a441fda3f7ac2e24148cfc151ed5a63e472e2..0180ea3c788f3c36dacbdb5296db0f418f907b7f 100644 (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)
index b0f9200eeaf4181a6acbff4105348f4b81b3cff4..6684d7839f31c974039ea3284d1bbc95ebb93ecc 100644 (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;