diff options
| author | Po Lu | 2022-07-06 13:43:24 +0800 |
|---|---|---|
| committer | Po Lu | 2022-07-06 13:43:38 +0800 |
| commit | 18050712a4189dcc467f5345d2efcc77d43d1393 (patch) | |
| tree | a96c2d1cef562570ce18c8cff42991188255e6a9 /src | |
| parent | 27436451ecbf250db4d1704c586763cb40e6dfeb (diff) | |
| download | emacs-18050712a4189dcc467f5345d2efcc77d43d1393.tar.gz emacs-18050712a4189dcc467f5345d2efcc77d43d1393.zip | |
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'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xselect.c | 15 | ||||
| -rw-r--r-- | src/xterm.c | 4 | ||||
| -rw-r--r-- | src/xterm.h | 3 |
3 files changed, 22 insertions, 0 deletions
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) | |||
| 165 | return dpyinfo->Xatom_XmTRANSFER_SUCCESS; | 165 | return dpyinfo->Xatom_XmTRANSFER_SUCCESS; |
| 166 | if (EQ (sym, QXmTRANSFER_FAILURE)) | 166 | if (EQ (sym, QXmTRANSFER_FAILURE)) |
| 167 | return dpyinfo->Xatom_XmTRANSFER_FAILURE; | 167 | return dpyinfo->Xatom_XmTRANSFER_FAILURE; |
| 168 | if (EQ (sym, QXdndDirectSave0)) | ||
| 169 | return dpyinfo->Xatom_XdndDirectSave0; | ||
| 170 | if (EQ (sym, Qtext_plain)) | ||
| 171 | return dpyinfo->Xatom_text_plain; | ||
| 172 | if (EQ (sym, QXdndActionDirectSave)) | ||
| 173 | return dpyinfo->Xatom_XdndActionDirectSave; | ||
| 168 | 174 | ||
| 169 | if (!SYMBOLP (sym)) | 175 | if (!SYMBOLP (sym)) |
| 170 | emacs_abort (); | 176 | emacs_abort (); |
| @@ -233,6 +239,12 @@ x_atom_to_symbol (struct x_display_info *dpyinfo, Atom atom) | |||
| 233 | return QXmTRANSFER_SUCCESS; | 239 | return QXmTRANSFER_SUCCESS; |
| 234 | if (atom == dpyinfo->Xatom_XmTRANSFER_FAILURE) | 240 | if (atom == dpyinfo->Xatom_XmTRANSFER_FAILURE) |
| 235 | return QXmTRANSFER_FAILURE; | 241 | return QXmTRANSFER_FAILURE; |
| 242 | if (atom == dpyinfo->Xatom_XdndDirectSave0) | ||
| 243 | return QXdndDirectSave0; | ||
| 244 | if (atom == dpyinfo->Xatom_text_plain) | ||
| 245 | return Qtext_plain; | ||
| 246 | if (atom == dpyinfo->Xatom_XdndActionDirectSave) | ||
| 247 | return QXdndActionDirectSave; | ||
| 236 | 248 | ||
| 237 | x_catch_errors (dpyinfo->display); | 249 | x_catch_errors (dpyinfo->display); |
| 238 | str = x_get_atom_name (dpyinfo, atom, NULL); | 250 | str = x_get_atom_name (dpyinfo, atom, NULL); |
| @@ -2998,6 +3010,9 @@ Note that this does not affect setting or owning selections. */); | |||
| 2998 | DEFSYM (QCLIPBOARD_MANAGER, "CLIPBOARD_MANAGER"); | 3010 | DEFSYM (QCLIPBOARD_MANAGER, "CLIPBOARD_MANAGER"); |
| 2999 | DEFSYM (QSAVE_TARGETS, "SAVE_TARGETS"); | 3011 | DEFSYM (QSAVE_TARGETS, "SAVE_TARGETS"); |
| 3000 | DEFSYM (QNULL, "NULL"); | 3012 | DEFSYM (QNULL, "NULL"); |
| 3013 | DEFSYM (QXdndDirectSave0, "XdndDirectSave0"); | ||
| 3014 | DEFSYM (QXdndActionDirectSave, "XdndActionDirectSave"); | ||
| 3015 | DEFSYM (Qtext_plain, "text/plain"); | ||
| 3001 | DEFSYM (Qforeign_selection, "foreign-selection"); | 3016 | DEFSYM (Qforeign_selection, "foreign-selection"); |
| 3002 | DEFSYM (Qx_lost_selection_functions, "x-lost-selection-functions"); | 3017 | DEFSYM (Qx_lost_selection_functions, "x-lost-selection-functions"); |
| 3003 | DEFSYM (Qx_sent_selection_functions, "x-sent-selection-functions"); | 3018 | 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[] = | |||
| 1022 | ATOM_REFS_INIT ("XdndLeave", Xatom_XdndLeave) | 1022 | ATOM_REFS_INIT ("XdndLeave", Xatom_XdndLeave) |
| 1023 | ATOM_REFS_INIT ("XdndDrop", Xatom_XdndDrop) | 1023 | ATOM_REFS_INIT ("XdndDrop", Xatom_XdndDrop) |
| 1024 | ATOM_REFS_INIT ("XdndFinished", Xatom_XdndFinished) | 1024 | ATOM_REFS_INIT ("XdndFinished", Xatom_XdndFinished) |
| 1025 | /* XDS source and target. */ | ||
| 1026 | ATOM_REFS_INIT ("XdndDirectSave0", Xatom_XdndDirectSave0) | ||
| 1027 | ATOM_REFS_INIT ("XdndActionDirectSave", Xatom_XdndActionDirectSave) | ||
| 1028 | ATOM_REFS_INIT ("text/plain", Xatom_text_plain) | ||
| 1025 | /* Motif drop protocol support. */ | 1029 | /* Motif drop protocol support. */ |
| 1026 | ATOM_REFS_INIT ("_MOTIF_DRAG_WINDOW", Xatom_MOTIF_DRAG_WINDOW) | 1030 | ATOM_REFS_INIT ("_MOTIF_DRAG_WINDOW", Xatom_MOTIF_DRAG_WINDOW) |
| 1027 | ATOM_REFS_INIT ("_MOTIF_DRAG_TARGETS", Xatom_MOTIF_DRAG_TARGETS) | 1031 | 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 | |||
| 638 | Xatom_XdndPosition, Xatom_XdndStatus, Xatom_XdndLeave, Xatom_XdndDrop, | 638 | Xatom_XdndPosition, Xatom_XdndStatus, Xatom_XdndLeave, Xatom_XdndDrop, |
| 639 | Xatom_XdndFinished; | 639 | Xatom_XdndFinished; |
| 640 | 640 | ||
| 641 | /* XDS source and target. */ | ||
| 642 | Atom Xatom_XdndDirectSave0, Xatom_XdndActionDirectSave, Xatom_text_plain; | ||
| 643 | |||
| 641 | #ifdef HAVE_XKB | 644 | #ifdef HAVE_XKB |
| 642 | /* Virtual modifiers */ | 645 | /* Virtual modifiers */ |
| 643 | Atom Xatom_Meta, Xatom_Super, Xatom_Hyper, Xatom_ShiftLock, Xatom_Alt; | 646 | Atom Xatom_Meta, Xatom_Super, Xatom_Hyper, Xatom_ShiftLock, Xatom_Alt; |