This patch set adds a new feature to the text edtion (off by default).

`--with-tm-x-support'
     This option enables minimal X Window support in the text edition. It
     enables MC to query the status of the modifiers CONTROL and SHIFT
     when invoked in a terminal emulation under X11. That's necessary
     to recognice key combinations like C-HOME or S-Cursor key.


Wed Apr 21 20:37:32 1999  Norbert Warmuth  <nwarmuth@privat.circular.de>

* configure.in: New option --with-tm-x-support, use MCCFLAGS and
MCLIBS for build flags which are specific to the text edition.

* INSTALL: Added documentation for --with-tm-x-support

* src/Makefile.in: use MCCFLAGS and MCLIBS


Wed Apr 21 20:19:45 1999  Norbert Warmuth  <nwarmuth@privat.circular.de>

* src/key.c (get_modifier): Query the state of the modifier keys when
running inside a terminal emulation under X11.

* src/key.c (init_textmode_x11_support, done_textmode_x11_support): new
functions, only used in the text edition. Connect to and disconnect
from the X Server when DISPLAY is set.

* src/key.h: added prototypes for the new functions

* src/main.c (main): call (init|done)_textmode_x11_support
This commit is contained in:
Norbert Warmuth 1999-04-21 19:18:31 +00:00
parent 27a09e8635
commit 3fd90ce83b
10 changed files with 133 additions and 15 deletions

View File

@ -1,3 +1,10 @@
Wed Apr 21 20:44:41 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
* configure.in: New option --with-tm-x-support, use MCCFLAGS and
MCLIBS which are specific to the text edition.
* INSTALL: Added documentation for --with-tm-x-support
Sun Apr 18 17:51:54 EDT 1999 Gregory McLean <gregm@comstar.net>
* mc.spec.in : Folded in some changes from the 'offical' rpm

View File

@ -162,6 +162,12 @@ installed the gpm package.
Default is somewhere in your XView binaries directory,
$OPENWINHOME/bin.
`--with-tm-x-support'
This option enables minimal X Window support in the text edition. It
enables MC to query the status of the modifiers CONTROL and SHIFT
when invoked in a terminal emulation under X11. That's necessary
to recognice key combinations like C-HOME or S-Cursor key.
`--without-vfs'
This option disables the Virtual File System switch code in the
Midnight Commander and uses the standard file system calls for

View File

@ -62,6 +62,9 @@
/* Is the program using the GPM library? */
#undef HAVE_LIBGPM
/* Is the text edition compiled with X11 support? */
#undef HAVE_TEXTMODE_X11_SUPPORT
/* Is the program using the distributed slang library? */
#undef HAVE_SLANG

View File

@ -295,6 +295,27 @@ dnl ])
AC_PATH_XTRA
dnl
dnl X11 support in the textmode edition.
dnl
dnl These variables are only used when building the text edition MC binary
MCCFLAGS=""
MCLIBS=""
AC_SUBST(MCCFLAGS)
AC_SUBST(MCLIBS)
textmode_x11_support="no"
AC_ARG_WITH(tm-x-support,
[--with-tm-x-support Add X Window System support to the text edition],
if test x$withval = xyes; then
MCCFLAGS="$X_CFLAGS"
MCLIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
AC_DEFINE(HAVE_TEXTMODE_X11_SUPPORT)
textmode_x11_support="yes"
fi
)
dnl
dnl Network related functions
dnl
@ -696,11 +717,10 @@ AC_ARG_WITH(debug,
mem_debug="Janne's MAD library"
AC_DEFINE(HAVE_MAD)
AC_DEFINE(MCDEBUG)
if [ echo `uname -s -r` | grep 'SunOS 4.1' ]
if [ echo `uname -s -r` | grep -q 'SunOS 4.1' ]
then
CFLAGS="$CFLAGS -Wno-implicit"
fi >& /dev/null
fi
if echo "$CFLAGS" | grep -e -g >/dev/null 2>&1; then
:
else
@ -721,10 +741,10 @@ AC_ARG_WITH(efence,
CFLAGS="$CFLAGS -Wall"
AC_DEFINE(MCDEBUG)
LIBS="$LIBS -lefence"
if [ echo `uname -s -r` | grep 'SunOS 4.1' ]
if [ echo `uname -s -r` | grep -q 'SunOS 4.1' ]
then
CFLAGS="$CFLAGS -Wno-implicit"
fi >& /dev/null
fi
if echo "$CFLAGS" | grep -e -g >/dev/null 2>&1; then
:
else
@ -1247,9 +1267,9 @@ if test x$srcdir != x; then
fi
fi
if echo "$screen_manager" | grep "SLang" ; then
if echo "$screen_manager" | grep -q "SLang" ; then
screen_manager="${screen_manager}${slang_term}"
fi >& /dev/null
fi
echo "
Configuration:
@ -1262,6 +1282,7 @@ Configuration:
Text mode screen manager: ${screen_manager}
Install console saver: ${install_saver}
Text mode mouse library: ${mouse_lib}
Text mode X11 support: ${textmode_x11_support}
Debugger code: ${mem_debug}
With subshell support: ${subshell}
X11 versions: ${xvers}

View File

@ -1,3 +1,20 @@
Wed Apr 21 20:40:38 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
* Makefile.in: use MCCFLAGS and MCLIBS
Wed Apr 21 20:19:45 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
* key.c (get_modifier): Query the state of the modifier keys when
running inside a terminal emulation under X11.
* key.c (init_textmode_x11_support, done_textmode_x11_support): new
functions, only used in the text edition. Connect to and disconnect
from the X Server when DISPLAY is set.
* key.h: added prototypes for the new functions
* main.c (main): call (init|done)_textmode_x11_support
Sat Apr 17 13:04:19 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
* view.c (do_view_init): Enable viewing of files with negative

View File

@ -5,11 +5,11 @@ SHELL = @SHELL@
rootdir = $(srcdir)/..
@MCFG@@MCF@
CFLAGS = $(XCFLAGS)
CFLAGS = $(XCFLAGS) @MCCFLAGS@
CPPFLAGS = $(XCPPFLAGS) -DREGEX_MALLOC
LDFLAGS = $(XLDFLAGS)
DEFS = $(XDEFS)
LIBS = $(XLIBS) @TERMNET@ $(XLIB) @TERMNET@
LIBS = $(XLIBS) @TERMNET@ $(XLIB) @TERMNET@ @MCLIBS@
OURLIBS = @LVFS@ @LSLANG@ @LEDIT@ @LGPM@ @LINTL@
INSTALL = @INSTALL@

View File

@ -14,6 +14,9 @@ char *features =
# endif
#else
"text mode"
#ifdef HAVE_TEXTMODE_X11_SUPPORT
" with X11 support to read modifiers"
#endif
#endif
".\n"

View File

@ -44,6 +44,10 @@
#include "cons.saver.h"
#include "../vfs/vfs.h"
#if defined (HAVE_TEXTMODE_X11_SUPPORT) && !defined (HAVE_X)
#include <X11/Xlib.h>
#endif
#ifdef __linux__
# if defined(__GLIBC__) && (__GLIBC__ < 2)
# include <linux/termios.h> /* This is needed for TIOCLINUX */
@ -226,6 +230,19 @@ define_sequences (key_define_t *kd)
#endif
}
#if defined (HAVE_TEXTMODE_X11_SUPPORT) && !defined (HAVE_X)
Display *display;
Window w;
void
init_textmode_x11_support (void)
{
display = XOpenDisplay (0);
if (display)
w = DefaultRootWindow (display);
}
#endif
/* This has to be called before slang_init or whatever routine
calls any define_sequence */
void init_key (void)
@ -963,15 +980,38 @@ int is_idle (void)
int
get_modifier (void)
{
#if defined (HAVE_TEXTMODE_X11_SUPPORT) && !defined (HAVE_X)
if (display) {
Window root, child;
int root_x, root_y;
int win_x, win_y;
unsigned int mask;
Bool b;
int result = 0;
b = XQueryPointer(display, w, &root, &child,
&root_x, &root_y,
&win_x, &win_y,
&mask);
if (mask & ShiftMask)
result |= SHIFT_PRESSED;
if (mask & ControlMask)
result |= CONTROL_PRESSED;
return result;
} else
#endif
#ifdef __linux__
unsigned char modifiers;
{
unsigned char modifiers;
modifiers = 6;
modifiers = 6;
if (ioctl (0, TIOCLINUX, &modifiers) < 0)
return 0;
if (ioctl (0, TIOCLINUX, &modifiers) < 0)
return 0;
return (int) modifiers;
return (int) modifiers;
}
#else
return 0;
#endif
@ -989,6 +1029,7 @@ ctrl_pressed ()
#ifdef HAVE_MAD
#ifndef HAVE_X
void k_dispose (key_def *k)
{
if (!k)
@ -1014,10 +1055,18 @@ void done_key ()
}
#else
void done_key ()
{
}
#endif /* HAVE_X */
#endif /* HAVE_MAD */
#if defined (HAVE_TEXTMODE_X11_SUPPORT) && !defined (HAVE_X)
void
done_textmode_x11_support (void)
{
if (display)
XCloseDisplay (display);
}
#endif

View File

@ -4,6 +4,9 @@
void init_key (void);
void init_key_input_fd (void);
void done_key (void);
void init_textmode_x11_support (void);
void done_textmode_x11_support (void);
int get_event (Gpm_Event *event, int redo_event, int block);
int is_idle (void);
int ctrl_pressed (void);

View File

@ -2990,6 +2990,10 @@ main (int argc, char *argv [])
calls any define_sequence */
init_key ();
#if defined (HAVE_TEXTMODE_X11_SUPPORT) && !defined (HAVE_X)
init_textmode_x11_support ();
#endif
#ifndef HAVE_GNOME
handle_args (argc, argv);
#endif
@ -3170,6 +3174,11 @@ main (int argc, char *argv [])
#ifdef HAVE_MAD
done_key ();
#endif
#if defined (HAVE_TEXTMODE_X11_SUPPORT) && !defined (HAVE_X)
done_textmode_x11_support ();
#endif
mad_finalize (__FILE__, __LINE__);
#ifdef HAVE_X
xtoolkit_end ();