From c090b317bd155edc0dcf0296c6fb0fb4c70ab0d9 Mon Sep 17 00:00:00 2001 From: Andy Keep Date: Sun, 1 Jul 2018 11:45:10 -0400 Subject: [PATCH] allow s_ee_get_clipboard to use the pastebuffer on macOS even when X11 is not available. expeditor.c original commit: f8cf536720fe43d07ca83d284e5bd1733c97372a --- LOG | 3 +++ c/expeditor.c | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/LOG b/LOG index b0623bb23e..3fe7ea217c 100644 --- a/LOG +++ b/LOG @@ -962,3 +962,6 @@ csug/foreign.stex, examples/socket.ss - add an option --disable-x11 c/version.h, configure +- allow s_ee_get_clipboard to use the pastebuffer on macOS even when X11 is not + available. + expeditor.c diff --git a/c/expeditor.c b/c/expeditor.c index 84c38971ca..78f6be3bfb 100644 --- a/c/expeditor.c +++ b/c/expeditor.c @@ -888,8 +888,10 @@ static void s_ee_line_feed(void) { #include #include #include +#endif /* LIBX11 */ static ptr s_ee_get_clipboard(void) { +#ifdef LIBX11 static enum {UNINITIALIZED, INITIALIZED, FAILED} status = UNINITIALIZED; static int (*pXConvertSelection)(Display *, Atom, Atom, Atom, Window, Time); static int (*pXPending)(Display *display); @@ -899,9 +901,11 @@ static ptr s_ee_get_clipboard(void) { static Display *D; static Window R, W; +#endif /* LIBX11 */ ptr p = S_G.null_string; +#ifdef LIBX11 if (status == UNINITIALIZED) { char *display_name; void *handle; @@ -986,6 +990,7 @@ static ptr s_ee_get_clipboard(void) { } } } +#endif /* LIBX11 */ #ifdef MACOSX #define PBPASTEBUFSIZE 1024 @@ -1013,11 +1018,6 @@ static ptr s_ee_get_clipboard(void) { return p; } -#else /* LIBX11 */ -static ptr s_ee_get_clipboard(void) { - return S_G.null_string; -} -#endif static void s_ee_write_char(wchar_t wch) { locale_t old; char buf[MB_LEN_MAX]; size_t n;