allow s_ee_get_clipboard to use the pastebuffer on macOS even when X11 is not available.

expeditor.c

original commit: f8cf536720fe43d07ca83d284e5bd1733c97372a
This commit is contained in:
Andy Keep 2018-07-01 11:45:10 -04:00
parent 72719ccd71
commit c090b317bd
2 changed files with 8 additions and 5 deletions

3
LOG
View File

@ -962,3 +962,6 @@
csug/foreign.stex, examples/socket.ss csug/foreign.stex, examples/socket.ss
- add an option --disable-x11 - add an option --disable-x11
c/version.h, configure c/version.h, configure
- allow s_ee_get_clipboard to use the pastebuffer on macOS even when X11 is not
available.
expeditor.c

View File

@ -888,8 +888,10 @@ static void s_ee_line_feed(void) {
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include <sys/select.h> #include <sys/select.h>
#endif /* LIBX11 */
static ptr s_ee_get_clipboard(void) { static ptr s_ee_get_clipboard(void) {
#ifdef LIBX11
static enum {UNINITIALIZED, INITIALIZED, FAILED} status = UNINITIALIZED; static enum {UNINITIALIZED, INITIALIZED, FAILED} status = UNINITIALIZED;
static int (*pXConvertSelection)(Display *, Atom, Atom, Atom, Window, Time); static int (*pXConvertSelection)(Display *, Atom, Atom, Atom, Window, Time);
static int (*pXPending)(Display *display); static int (*pXPending)(Display *display);
@ -899,9 +901,11 @@ static ptr s_ee_get_clipboard(void) {
static Display *D; static Display *D;
static Window R, W; static Window R, W;
#endif /* LIBX11 */
ptr p = S_G.null_string; ptr p = S_G.null_string;
#ifdef LIBX11
if (status == UNINITIALIZED) { if (status == UNINITIALIZED) {
char *display_name; char *display_name;
void *handle; void *handle;
@ -986,6 +990,7 @@ static ptr s_ee_get_clipboard(void) {
} }
} }
} }
#endif /* LIBX11 */
#ifdef MACOSX #ifdef MACOSX
#define PBPASTEBUFSIZE 1024 #define PBPASTEBUFSIZE 1024
@ -1013,11 +1018,6 @@ static ptr s_ee_get_clipboard(void) {
return p; 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) { static void s_ee_write_char(wchar_t wch) {
locale_t old; char buf[MB_LEN_MAX]; size_t n; locale_t old; char buf[MB_LEN_MAX]; size_t n;