From 3f8e561e17d2c4df7f2dcb29f7d031f1dc9d565d Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Tue, 30 Oct 2012 13:07:46 +0400 Subject: [PATCH] Tweak sources for --with-x/--without-x option. Signed-off-by: Andrew Borodin --- lib/tty/Makefile.am | 7 +++++-- lib/tty/key.c | 6 ++++-- lib/tty/x11conn.c | 6 ------ m4.include/mc-with-x.m4 | 1 + 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/tty/Makefile.am b/lib/tty/Makefile.am index 0b7c11f86..5a5e739f5 100644 --- a/lib/tty/Makefile.am +++ b/lib/tty/Makefile.am @@ -17,8 +17,11 @@ TTY_SRC = \ key.c key.h keyxdef.c \ mouse.c mouse.h \ tty.c tty.h tty-internal.h \ - win.c win.h \ - x11conn.c x11conn.h + win.c win.h + +if HAVE_TEXTMODE_X11_SUPPORT +TTY_SRC += x11conn.c x11conn.h +endif libmctty_la_SOURCES = $(TTY_SRC) $(TTY_SCREEN_SRC) diff --git a/lib/tty/key.c b/lib/tty/key.c index f05020284..40a761727 100644 --- a/lib/tty/key.c +++ b/lib/tty/key.c @@ -668,10 +668,10 @@ define_sequences (const key_define_t * kd) /* --------------------------------------------------------------------------------------------- */ +#ifdef HAVE_TEXTMODE_X11_SUPPORT static void init_key_x11 (void) { -#ifdef HAVE_TEXTMODE_X11_SUPPORT if (getenv ("DISPLAY") != NULL && !mc_global.tty.disable_x11) { x11_display = mc_XOpenDisplay (0); @@ -679,8 +679,8 @@ init_key_x11 (void) if (x11_display != NULL) x11_window = DefaultRootWindow (x11_display); } -#endif /* HAVE_TEXTMODE_X11_SUPPORT */ } +#endif /* HAVE_TEXTMODE_X11_SUPPORT */ /* --------------------------------------------------------------------------------------------- */ /* Workaround for System V Curses vt100 bug */ @@ -1437,7 +1437,9 @@ init_key (void) } #endif /* __QNX__ */ +#ifdef HAVE_TEXTMODE_X11_SUPPORT init_key_x11 (); +#endif /* Load the qansi-m key definitions if we are running under the qansi-m terminal */ diff --git a/lib/tty/x11conn.c b/lib/tty/x11conn.c index 87f58d06d..0ce1f22f6 100644 --- a/lib/tty/x11conn.c +++ b/lib/tty/x11conn.c @@ -31,10 +31,6 @@ #include -#ifndef HAVE_TEXTMODE_X11_SUPPORT -typedef int dummy; /* C99 forbids empty compilation unit */ -#else - #include #include #ifdef HAVE_GMODULE @@ -250,5 +246,3 @@ mc_XQueryPointer (Display * display, Window win, Window * root_return, } /* --------------------------------------------------------------------------------------------- */ - -#endif /* HAVE_TEXTMODE_X11_SUPPORT */ diff --git a/m4.include/mc-with-x.m4 b/m4.include/mc-with-x.m4 index 4eaab915a..a2d1f4748 100644 --- a/m4.include/mc-with-x.m4 +++ b/m4.include/mc-with-x.m4 @@ -19,4 +19,5 @@ AC_DEFUN([MC_WITH_X], [ fi fi + AM_CONDITIONAL([HAVE_TEXTMODE_X11_SUPPORT], [test x"$textmode_x11_support" = x"yes"]) ]) -- 2.11.4.GIT