emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 18050712a4: Speed up interning XDS atoms


From: Po Lu
Subject: master 18050712a4: Speed up interning XDS atoms
Date: Wed, 6 Jul 2022 01:44:24 -0400 (EDT)

branch: master
commit 18050712a4189dcc467f5345d2efcc77d43d1393
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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 1fda300c43..d1b6d454ab 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 996a441fda..0180ea3c78 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 b0f9200eea..6684d7839f 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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]