Просмотр исходного кода

Tweak sources for --with-x/--without-x option.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Andrew Borodin 12 лет назад
Родитель
Сommit
3f8e561e17
4 измененных файлов с 10 добавлено и 10 удалено
  1. 5 2
      lib/tty/Makefile.am
  2. 4 2
      lib/tty/key.c
  3. 0 6
      lib/tty/x11conn.c
  4. 1 0
      m4.include/mc-with-x.m4

+ 5 - 2
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)
 

+ 4 - 2
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 */

+ 0 - 6
lib/tty/x11conn.c

@@ -31,10 +31,6 @@
 
 #include <config.h>
 
-#ifndef HAVE_TEXTMODE_X11_SUPPORT
-typedef int dummy;              /* C99 forbids empty compilation unit */
-#else
-
 #include <setjmp.h>
 #include <X11/Xlib.h>
 #ifdef HAVE_GMODULE
@@ -250,5 +246,3 @@ mc_XQueryPointer (Display * display, Window win, Window * root_return,
 }
 
 /* --------------------------------------------------------------------------------------------- */
-
-#endif /* HAVE_TEXTMODE_X11_SUPPORT */

+ 1 - 0
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"])
 ])