From c81f5795de828ab88232f5a7481437f17b9e6831 Mon Sep 17 00:00:00 2001 From: Kim Woelders Date: Tue, 10 Aug 2010 18:08:44 +0000 Subject: [PATCH] Eliminate use of Xmu. This causes the following change: In script.c and term.c XA_CLIPBOARD(Xdisplay) used to expand to XA_PRIMARY, i.e. the identifier of the "PRIMARY" atom, now it will be the identifier of the "CLIPBOARD" atom. SVN revision: 50969 --- configure.ac | 8 +------- src/screen.c | 15 +++++---------- src/screen.h | 6 +----- src/script.c | 4 ++-- src/startup.c | 4 ++++ src/startup.h | 4 ++++ src/term.c | 6 +++--- 7 files changed, 20 insertions(+), 27 deletions(-) diff --git a/configure.ac b/configure.ac index 90f796c..707bc1b 100644 --- a/configure.ac +++ b/configure.ac @@ -205,8 +205,7 @@ sys/ioctl.h sys/select.h sys/time.h \ sys/sockio.h sys/byteorder.h malloc.h \ utmpx.h unistd.h bsd/signal.h regex.h \ regexp.h stdarg.h X11/X.h X11/Xlib.h \ -X11/Xmu/Atoms.h X11/Sunkeysym.h \ -X11/Xlocale.h \ +X11/Sunkeysym.h X11/Xlocale.h \ ) AC_HEADER_TIME @@ -872,11 +871,6 @@ AC_ARG_ENABLE(xim, XIM="TRUE" ]) -# For multibyte selection handling -#if test "$MULTICHAR_ENCODING" != "none"; then - AC_CHECK_LIB(Xmu, XmuInternAtom) -#fi - # check X11R6 for XIM if test "$XIM" = "TRUE"; then AC_CHECK_LIB(X11, XRegisterIMInstantiateCallback, AC_DEFINE(USE_X11R6_XIM, , [Define if we have X11R6 XIM.])) diff --git a/src/screen.c b/src/screen.c index b4d6255..006856b 100644 --- a/src/screen.c +++ b/src/screen.c @@ -26,9 +26,6 @@ static const char cvs_ident[] = "$Id$"; #include #include #include /* CARD32 */ -#ifdef HAVE_X11_XMU_ATOMS_H -# include -#endif #include "buttons.h" #include "command.h" @@ -2596,9 +2593,9 @@ selection_paste(Atom sel) form (usually XA_STRING) and save it for us in the VT_SELECTION property. We'll then get a SelectionNotify. */ D_SELECT(("Requesting current selection (%d) -> VT_SELECTION (%d)\n", sel, props[PROP_SELECTION_DEST])); -#if defined(MULTI_CHARSET) && defined(HAVE_X11_XMU_ATOMS_H) +#if defined(MULTI_CHARSET) if (encoding_method != LATIN1) { - XConvertSelection(Xdisplay, sel, XA_COMPOUND_TEXT(Xdisplay), props[PROP_SELECTION_DEST], TermWin.vt, CurrentTime); + XConvertSelection(Xdisplay, sel, props[PROP_COMPOUND_TEXT], props[PROP_SELECTION_DEST], TermWin.vt, CurrentTime); } else { XConvertSelection(Xdisplay, sel, XA_STRING, props[PROP_SELECTION_DEST], TermWin.vt, CurrentTime); } @@ -3346,7 +3343,7 @@ selection_send(XSelectionRequestEvent * rq) ev.xselection.property = rq->property; #ifdef MULTI_CHARSET # ifdef X_HAVE_UTF8_STRING - } else if (rq->target == XA_UTF8_STRING(Xdisplay)) { + } else if (rq->target == props[PROP_UTF8_STRING]) { XTextProperty xtextp; char *l[1]; @@ -3362,8 +3359,7 @@ selection_send(XSelectionRequestEvent * rq) } } # endif /* X_HAVE_UTF8_STRING */ -# ifdef HAVE_X11_XMU_ATOMS_H - } else if (rq->target == XA_TEXT(Xdisplay) || rq->target == XA_COMPOUND_TEXT(Xdisplay)) { + } else if (rq->target == props[PROP_TEXT] || rq->target == props[PROP_COMPOUND_TEXT]) { XTextProperty xtextp; char *l[1]; @@ -3372,13 +3368,12 @@ selection_send(XSelectionRequestEvent * rq) xtextp.nitems = 0; if (XmbTextListToTextProperty(Xdisplay, l, 1, XCompoundTextStyle, &xtextp) == Success) { if (xtextp.nitems > 0 && xtextp.value != NULL) { - XChangeProperty(Xdisplay, rq->requestor, rq->property, XA_COMPOUND_TEXT(Xdisplay), + XChangeProperty(Xdisplay, rq->requestor, rq->property, props[PROP_COMPOUND_TEXT], 8, PropModeReplace, xtextp.value, xtextp.nitems); ev.xselection.property = rq->property; XFree(xtextp.value); } } -# endif /* HAVE_X11_XMU_ATOMS_H */ #endif /* MULTI_CHARSET */ } else { XChangeProperty(Xdisplay, rq->requestor, rq->property, XA_STRING, 8, PropModeReplace, selection.text, selection.len); diff --git a/src/screen.h b/src/screen.h index e9281f2..21336b3 100644 --- a/src/screen.h +++ b/src/screen.h @@ -16,16 +16,12 @@ #include #include "startup.h" -#ifndef XA_CLIPBOARD -# define XA_CLIPBOARD(d) XA_PRIMARY -#endif - /************ Macros and Definitions ************/ #define WRAP_CHAR (0xff) #define PROP_SIZE 4096 #define TABSIZE 8 /* default tab size */ -#define IS_SELECTION(a) (((a) == XA_PRIMARY) || ((a) == XA_SECONDARY) || ((a) == XA_CLIPBOARD(Xdisplay))) +#define IS_SELECTION(a) (((a) == XA_PRIMARY) || ((a) == XA_SECONDARY) || ((a) == props[PROP_CLIPBOARD])) #define IS_CUT_BUFFER(a) (((a) >= XA_CUT_BUFFER0) && ((a) <= XA_CUT_BUFFER7)) #define ZERO_SCROLLBACK do { \ diff --git a/src/script.c b/src/script.c index 7b9c8ea..2424904 100644 --- a/src/script.c +++ b/src/script.c @@ -165,7 +165,7 @@ script_handler_copy(spif_charptr_t *params) if (*buffer_id >= '0' && *buffer_id <= '7') { sel = (Atom) ((int) XA_CUT_BUFFER0 + (int) (*buffer_id - '0')); } else if (!BEG_STRCASECMP(buffer_id, "clipboard")) { - sel = XA_CLIPBOARD(Xdisplay); + sel = props[PROP_CLIPBOARD]; } else if (!BEG_STRCASECMP(buffer_id, "primary")) { sel = XA_PRIMARY; } else if (!BEG_STRCASECMP(buffer_id, "secondary")) { @@ -266,7 +266,7 @@ script_handler_paste(spif_charptr_t *params) if (*buffer_id >= '0' && *buffer_id <= '7') { sel = (Atom) ((int) XA_CUT_BUFFER0 + (int) (*buffer_id - '0')); } else if (!BEG_STRCASECMP(buffer_id, "clipboard")) { - sel = XA_CLIPBOARD(Xdisplay); + sel = props[PROP_CLIPBOARD]; } else if (!BEG_STRCASECMP(buffer_id, "primary")) { sel = XA_PRIMARY; } else if (!BEG_STRCASECMP(buffer_id, "secondary")) { diff --git a/src/startup.c b/src/startup.c index b676a75..6f54066 100644 --- a/src/startup.c +++ b/src/startup.c @@ -138,6 +138,10 @@ eterm_bootstrap(int argc, char *argv[]) /* Get all our properties set up. */ MEMSET(props, 0, sizeof(props)); + props[PROP_TEXT] = XInternAtom(Xdisplay, "TEXT", False); + props[PROP_COMPOUND_TEXT] = XInternAtom(Xdisplay, "COMPOUND_TEXT", False); + props[PROP_UTF8_STRING] = XInternAtom(Xdisplay, "UTF8_STRING", False); + props[PROP_CLIPBOARD] = XInternAtom(Xdisplay, "CLIPBOARD", False); props[PROP_DESKTOP] = XInternAtom(Xdisplay, "_NET_WM_DESKTOP", False); props[PROP_TRANS_PIXMAP] = XInternAtom(Xdisplay, "_XROOTPMAP_ID", False); props[PROP_TRANS_COLOR] = XInternAtom(Xdisplay, "_XROOTCOLOR_PIXEL", False); diff --git a/src/startup.h b/src/startup.h index 9c78bea..50ae17c 100644 --- a/src/startup.h +++ b/src/startup.h @@ -91,6 +91,10 @@ #endif enum { + PROP_TEXT, + PROP_COMPOUND_TEXT, + PROP_UTF8_STRING, + PROP_CLIPBOARD, PROP_DESKTOP, PROP_TRANS_PIXMAP, PROP_TRANS_COLOR, diff --git a/src/term.c b/src/term.c index de2f90d..8435da1 100644 --- a/src/term.c +++ b/src/term.c @@ -561,15 +561,15 @@ lookup_key(XEvent * ev) } #endif -#if defined(HAVE_X11_SUNKEYSYM_H) && defined(HAVE_X11_XMU_ATOMS_H) +#if defined(HAVE_X11_SUNKEYSYM_H) switch (keysym) { case SunXK_Copy: case SunXK_Cut: - selection_copy(XA_CLIPBOARD(Xdisplay)); + selection_copy(props[PROP_CLIPBOARD]); LK_RET(); break; case SunXK_Paste: - selection_paste(XA_CLIPBOARD(Xdisplay)); + selection_paste(props[PROP_CLIPBOARD]); LK_RET(); break; case SunXK_Front: