Sat Mar 7 14:43:27 1998 Pavel Roskin <pavel@absolute.spb.su>

* nt/Makefile.NT, nt/Makefile.VC4: rewritten for GNU make.
        Use gmake -f Makefile.VC4 to compile.

        * nt/*.c: config.h is included before all other code.

        * nt/config.h: added some definitions, because some
        compilers don't accept long command lines.

        * nt/Makefile.VC1: removed :-( It didn't work anyways.

        * nt/slint.nt.c: can be compiled under OS/2 too

        * nt/key.nt.c: correct_key_code was called twice. Shifted
        functional keys supported. Alt-F1 and Alt-F2 work as F11 and F12.
        Alt-F7 works as Shift-Alt-? (used for find file). Function
        alt_pressed() and ctrl_pressed() introduced.
This commit is contained in:
Miguel de Icaza 1998-03-07 20:36:45 +00:00
parent 177bbf7262
commit 74c6330a30
14 changed files with 246 additions and 228 deletions

20
nt/ChangeLog Normal file
View File

@ -0,0 +1,20 @@
Sat Mar 7 14:43:27 1998 Pavel Roskin <pavel@absolute.spb.su>
* nt/Makefile.NT, nt/Makefile.VC4: rewritten for GNU make.
Use gmake -f Makefile.VC4 to compile.
* nt/*.c: config.h is included before all other code.
* nt/config.h: added some definitions, because some
compilers don't accept long command lines.
* nt/Makefile.VC1: removed :-( It didn't work anyways.
* nt/slint.nt.c: can be compiled under OS/2 too
* nt/key.nt.c: correct_key_code was called twice. Shifted
functional keys supported. Alt-F1 and Alt-F2 work as F11 and F12.
Alt-F7 works as Shift-Alt-? (used for find file). Function
alt_pressed() and ctrl_pressed() introduced.

View File

@ -10,7 +10,7 @@ include ../Make.common
FILES = Makefile TODO dirent.c mc.ico bugs mc.rc config.h dirent.h \
Makefile.NT chmod.nt.c drive.nt.c slint.nt.c cons.handler.nt.c \
key.nt.c utilnt.c Makefile.NT Makefile.VC1 Makefile.VC4 \
key.nt.c utilnt.c Makefile.NT Makefile.VC4 \
util.WinNT.c util.debug.c util.Win32.c util.Win32.h util.debug.h \
drive.h

View File

@ -3,176 +3,151 @@
# 970423 hacked by Juan f. Grigera
# 970525 hacked again by jfg to add internal editor
# 971127 hacked by Pavel Roskin to make it work with mc-4.1.11
# 980206 hacked by Pavel Roskin to make it work with GNU make
#
# This is the Makefile for Midnight Commander under Win32.
#
# Supported Compilers:
#
#
# makefile.vc4: Microsoft Visual C++ 4.x
# ...
!IF "$(DEBUG)" == ""
DEBUG=1
!MESSAGE No configuration specified. Defaulting to Debug.
!ENDIF
!if "$(DEBUG)" == "0"
OBJS_DIR=release
!else
OBJS_DIR=debug
!endif
NULL=nul
# ---- Directories
MC_NT_DIR=.
MC_SRC_DIR=..\src
MC_NT_DIR=../nt
MC_SRC_DIR=../src
MC_INCLUDE_DIR=.
VFS_DIR=..\vfs
MCEDIT_SRC_DIR=..\edit
MCEDIT_OBJS_DIR=$(MCEDIT_SRC_DIR)\$(OBJS_DIR)
MCEDIT_LIB=$(MCEDIT_OBJS_DIR)\libedit.lib
SLANG_SRC_DIR=..\slang
SLANG_OBJS_DIR=$(SLANG_SRC_DIR)\$(OBJS_DIR)
SLANG_LIB=$(SLANG_OBJS_DIR)\slang.lib
# ---- Compiler specific defines
!include "makefile.vc4"
VFS_DIR=../vfs
MCEDIT_SRC_DIR=../edit
MCEDIT_OBJS_DIR=$(OBJS_DIR)/edit
SLANG_SRC_DIR=../slang
SLANG_OBJS_DIR=$(OBJS_DIR)/slang
# --- Midnight Defines
MC_DEFINES=$(SPECIFIC_DEFINES) -D_OS_NT -DOS2_NT -DWIN32 -D_CONSOLE -DHAVE_CONFIG_H -Dpc_system -DUSE_INTERNAL_EDIT
MC_DEFINES=$(SPECIFIC_DEFINES) -D_CONSOLE -DHAVE_CONFIG_H -DUSE_INTERNAL_EDIT
MC_INCLUDES=-I$(MC_SRC_DIR) -I$(MC_NT_DIR) -I$(SLANG_SRC_DIR)
SLANG_DEFINES=$(SPECIFIC_DEFINES) -DWIN32 -DWIN32_LEAN_AND_MEAN -D_WINDOWS -Dpc_system -Dpc -D_OS_NT -D__WIN32__ -D__STDC__ -DHAVE_STDLIB_H -DFLOAT_TYPE -DMSWINDOWS -DHAVE_MEMCPY -DHAVE_MEMSET
SLANG_DEFINES=$(SPECIFIC_DEFINES)
SLANG_INCLUDES=-I$(MC_NT_DIR) -I$(SLANG_SRC_DIR)
MCEDIT_DEFINES=$(SPECIFIC_DEFINES) -D_OS_NT -DWIN32 -D_CONSOLE -DHAVE_CONFIG_H -DMIDNIGHT
MCEDIT_INCLUDES=-I$(MC_SRC_DIR) -I$(MC_NT_DIR) -I$(MC_SRC_DIR)\.. -I$(SLANG_SRC_DIR)
MCEDIT_DEFINES=$(SPECIFIC_DEFINES) -D_CONSOLE -DHAVE_CONFIG_H
MCEDIT_INCLUDES=-I$(MC_NT_DIR) -I$(MC_SRC_DIR)/.. -I$(SLANG_SRC_DIR)
CFLAGS=$(SPECIFIC_MC_CFLAGS) $(MC_INCLUDES) $(MC_DEFINES) -c
LFLAGS=$(MC_LIBS) $(SLANG_LIB) $(MCEDIT_LIB) $(SPECIFIC_MC_LFLAGS)
SLANG_CFLAGS=$(SPECIFIC_SLANG_CFLAGS) $(SLANG_INCLUDES) $(SLANG_DEFINES) -c
SLANG_LINK_FLAGS=-nologo -out:"$(SLANG_LIB)"
MCEDIT_CFLAGS=$(SPECIFIC_MCEDIT_CFLAGS) $(MCEDIT_INCLUDES) $(MCEDIT_DEFINES) -c
MCEDIT_LINK_FLAGS=-nologo -out:"$(MCEDIT_LIB)"
RC_DEFINES=$(SPECIFIC_DEFINES)
RSC_FLAGS=-l 0x409 -fo"$(OBJS_DIR)\mc.res" $(RC_DEFINES)
RSC_FLAGS=$(RES_PLACE)$(OBJS_DIR)/mc.res $(RC_DEFINES)
# --- Dependencies
.PHONY: all object-dirs mc clean
all: object-dirs mc
object-dirs: $(OBJS_DIR) $(SLANG_OBJS_DIR) $(MCEDIT_OBJS_DIR)
mc: $(OBJS_DIR)\mc.exe
slang: $(SLANG_LIB)
libedit: $(MCEDIT_LIB)
mc: $(MC_EXE)
clean:
deltree -y $(OBJS_DIR)
deltree -y $(SLANG_OBJS_DIR)
deltree -y $(MCEDIT_OBJS_DIR)
deltree -y "$(SLANG_OBJS_DIR)"
deltree -y "$(MCEDIT_OBJS_DIR)"
deltree -y "$(OBJS_DIR)"
$(OBJS_DIR):
if not exist $@\$(NULL) mkdir $@
mkdir "$@"
$(SLANG_OBJS_DIR):
if not exist $@\$(NULL) mkdir $@
mkdir "$@"
$(MCEDIT_OBJS_DIR):
if not exist $@\$(NULL) mkdir $@
mkdir "$@"
.c{$(OBJS_DIR)}.obj:
$(CC) $(CFLAGS) -Fo$@ $<
$(OBJS_DIR)/%.$(OBJ_SUFFIX): $(MC_NT_DIR)/%.c
$(CC) $(CFLAGS) $(OBJ_PLACE)$@ $<
{$(MC_SRC_DIR)}.c{$(OBJS_DIR)}.obj:
$(CC) $(CFLAGS) -Fo$@ $<
$(OBJS_DIR)/%.$(OBJ_SUFFIX): $(MC_SRC_DIR)/%.c
$(CC) $(CFLAGS) $(OBJ_PLACE)$@ $<
{$(SLANG_SRC_DIR)}.c{$(SLANG_OBJS_DIR)}.obj:
$(CC) $(SLANG_CFLAGS) -Fo$@ $<
$(SLANG_OBJS_DIR)/%.$(OBJ_SUFFIX): $(SLANG_SRC_DIR)/%.c
$(CC) $(SLANG_CFLAGS) $(OBJ_PLACE)$@ $<
{$(MCEDIT_SRC_DIR)}.c{$(MCEDIT_OBJS_DIR)}.obj:
$(CC) $(MCEDIT_CFLAGS) -Fo$@ $<
$(MCEDIT_OBJS_DIR)/%.$(OBJ_SUFFIX): $(MCEDIT_SRC_DIR)/%.c
$(CC) $(MCEDIT_CFLAGS) $(OBJ_PLACE)$@ $<
OBJS= $(EXTRA_MC_OBJS)\
$(OBJS_DIR)\util.Win32.obj\
$(OBJS_DIR)\util.WinNT.obj\
$(OBJS_DIR)\terms.obj \
$(OBJS_DIR)\user.obj \
$(OBJS_DIR)\utilnt.obj \
$(OBJS_DIR)\subshell.obj \
$(OBJS_DIR)\file.obj \
$(OBJS_DIR)\listmode.obj \
$(OBJS_DIR)\cmd.obj \
$(OBJS_DIR)\dirent.obj \
$(OBJS_DIR)\command.obj \
$(OBJS_DIR)\help.obj \
$(OBJS_DIR)\menu.obj \
$(OBJS_DIR)\view.obj \
$(OBJS_DIR)\dir.obj \
$(OBJS_DIR)\info.obj \
$(OBJS_DIR)\widget.obj \
$(OBJS_DIR)\cons.handler.nt.obj \
$(OBJS_DIR)\option.obj \
$(OBJS_DIR)\dlg.obj \
$(OBJS_DIR)\panelize.obj \
$(OBJS_DIR)\profile.obj \
$(OBJS_DIR)\util.obj \
$(OBJS_DIR)\dialog.obj \
$(OBJS_DIR)\ext.obj \
$(OBJS_DIR)\color.obj \
$(OBJS_DIR)\drive.nt.obj \
$(OBJS_DIR)\key.nt.obj \
$(OBJS_DIR)\layout.obj \
$(OBJS_DIR)\setup.obj \
$(OBJS_DIR)\regex.obj \
$(OBJS_DIR)\hotlist.obj \
$(OBJS_DIR)\slint.nt.obj \
$(OBJS_DIR)\tree.obj \
$(OBJS_DIR)\win.obj \
$(OBJS_DIR)\chmod.nt.obj \
$(OBJS_DIR)\complete.obj \
$(OBJS_DIR)\find.obj \
$(OBJS_DIR)\wtools.obj \
$(OBJS_DIR)\boxes.obj \
$(OBJS_DIR)\background.obj \
$(OBJS_DIR)\dirhist.obj \
$(OBJS_DIR)\main.obj \
$(OBJS_DIR)\popt.obj \
$(OBJS_DIR)\mouse.obj \
$(OBJS_DIR)\text.obj \
$(OBJS_DIR)\screen.obj
SRCS= $(EXTRA_MC_SRCS) \
util.Win32.c \
util.WinNT.c \
terms.c \
user.c \
utilnt.c \
subshell.c \
file.c \
listmode.c \
cmd.c \
dirent.c \
command.c \
help.c \
menu.c \
view.c \
dir.c \
info.c \
widget.c \
cons.handler.nt.c \
option.c \
dlg.c \
panelize.c \
profile.c \
util.c \
dialog.c \
ext.c \
color.c \
drive.nt.c \
key.nt.c \
layout.c \
setup.c \
regex.c \
hotlist.c \
slint.nt.c \
tree.c \
win.c \
chmod.nt.c \
complete.c \
find.c \
wtools.c \
boxes.c \
background.c \
dirhist.c \
main.c \
popt.c \
mouse.c \
text.c \
screen.c
MC_RES=$(OBJS_DIR)\mc.res
SLANG_SRCS= \
slw32tty.c \
slerr.c \
slgetkey.c \
slsmg.c \
slvideo.c
SLANG_OBJS= \
$(SLANG_OBJS_DIR)\slw32tty.obj \
$(SLANG_OBJS_DIR)\slerr.obj \
$(SLANG_OBJS_DIR)\slgetkey.obj \
$(SLANG_OBJS_DIR)\slsmg.obj \
$(SLANG_OBJS_DIR)\slvideo.obj
MCEDIT_SRCS= \
edit.c \
editcmd.c \
editdraw.c \
editmenu.c \
editoptions.c \
editwidget.c \
wordproc.c
MCEDIT_OBJS= \
$(MCEDIT_OBJS_DIR)\edit.obj\
$(MCEDIT_OBJS_DIR)\editcmd.obj\
$(MCEDIT_OBJS_DIR)\editdraw.obj\
$(MCEDIT_OBJS_DIR)\editmenu.obj\
$(MCEDIT_OBJS_DIR)\editoptions.obj\
$(MCEDIT_OBJS_DIR)\editwidget.obj\
$(MCEDIT_OBJS_DIR)\wordproc.obj
OBJS=$(addprefix $(OBJS_DIR)/, \
$(patsubst %.c,%.$(OBJ_SUFFIX),$(SRCS)))
$(OBJS_DIR)\mc.exe : $(OBJS_DIR) $(SLANG_LIB) $(MCEDIT_LIB) $(MC_RES) $(DEF_FILE) $(OBJS)
$(LINK) $(LFLAGS) $(OBJS)
SLANG_OBJS=$(addprefix $(SLANG_OBJS_DIR)/, \
$(patsubst %.c,%.$(OBJ_SUFFIX),$(SLANG_SRCS)))
$(MC_NT_DIR)\mc.rc: $(MC_NT_DIR)\mc.ico $(MC_NT_DIR)\config.h ..\VERSION
MCEDIT_OBJS=$(addprefix $(MCEDIT_OBJS_DIR)/, \
$(patsubst %.c,%.$(OBJ_SUFFIX),$(MCEDIT_SRCS)))
$(OBJS_DIR)\mc.res : $(MC_NT_DIR)\mc.rc $(OBJS_DIR)
$(RSC) $(RSC_FLAGS) $(MC_NT_DIR)\mc.rc
$(OBJS_DIR)\Mc.bsc : $(OBJS_DIR) $(BSC32_SBRS)
$(BSC32) $(BSC32_FLAGS) $(BSC32_SBRS)
$(SLANG_LIB) : $(SLANG_OBJS_DIR) $(SLANG_OBJS)
$(SLANG_LINK) $(SLANG_LINK_FLAGS) $(SLANG_OBJS)
$(MCEDIT_LIB) : $(MCEDIT_OBJS_DIR) $(MCEDIT_OBJS)
$(MCEDIT_LINK) $(MCEDIT_LINK_FLAGS) $(MCEDIT_OBJS)
# --- Resources
ifdef RSC
MC_RES=$(OBJS_DIR)/mc.res
else
MC_RES=
endif
$(OBJS_DIR)/mc.res: $(MC_NT_DIR)/mc.rc $(MC_NT_DIR)/mc.ico $(MC_NT_DIR)/config.h ../VERSION
$(RSC) $(RSC_FLAGS) $(MC_NT_DIR)/mc.rc

View File

@ -5,33 +5,61 @@
#
# Hacked by Dan Nicolaescu from Visual IDE mak
# Hacked by Pavel Roskin to make it work with cmd.exe from Windows NT4
# 980206 hacked by Pavel Roskin to make it work with GNU make
# --------------------------------------------------------------------------
MC_LIBS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
NOLOGO=-nologo
MC_MISC_CFLAGS=-Fp"$(OBJS_DIR)\Mc.pch"
MC_LIBS=advapi32.lib
# ---- Path (case-sensitive!) is searched for executables
# If the command line contains quotes, it is passed to shell
# Errors are ignored in this case!
Path=c:/msdev/bin
CC=cl.exe
# Just comment RSC out if you have problems with resources
RSC=rc.exe
LINK=link.exe
BSC=bscmake.exe
SLANG_LINK=link.exe -lib
MCEDIT_LINK=link.exe -lib
OBJ_SUFFIX=obj
OBJ_PLACE=-Fo
RES_PLACE=-fo
EXE_PLACE=-out:
!if "$(DEBUG)" == "0"
EXTRA_MC_OBJS=
SPECIFIC_DEFINES=
SPECIFIC_MC_CFLAGS=$(NOLOGO) -ML -GX -O2 -YX0 $(MC_MISC_CFLAGS)
SPECIFIC_MC_LFLAGS_EXTRA=-incremental:no
SPECIFIC_SLANG_CFLAGS=-ML -W3 -GX -O2 -YX -Fp"$(SLANG_OBJS_DIR)\slang.pch"
SPECIFIC_MCEDIT_CFLAGS=-ML -W3 -GX -O2 -YX -Fp"$(MCEDIT_OBJS_DIR)\libedit.pch"
!else
EXTRA_MC_OBJS=$(OBJS_DIR)\util.debug.obj
# ---- Compiler-specific optional stuff
MC_MISC_CFLAGS=-nologo -YX -Fp$(OBJS_DIR)/mc.pch
ifndef RELEASE
# ---- Debug build
OBJS_DIR=debug
EXTRA_MC_SRCS=util.debug.c
SPECIFIC_DEFINES=-DHAVE_TRACE
SPECIFIC_MC_CFLAGS=$(NOLOGO) -MLd -Gm -GX -Zi -Od -YX -Fd"$(OBJS_DIR)\\" $(MC_MISC_CFLAGS)
SPECIFIC_MC_CFLAGS=-MLd -W3 -Gm -Zi -Od -Fd$(OBJS_DIR)/mc.pdb $(MC_MISC_CFLAGS)
SPECIFIC_MC_LFLAGS_EXTRA=-debug -incremental:yes
SPECIFIC_SLANG_CFLAGS=-MLd -W3 -GX -Zi -Od -YX -Fr"$(SLANG_OBJS_DIR)\\" -Fp"$(SLANG_OBJS_DIR)\slang.pch"
SPECIFIC_MCEDIT_CFLAGS=-MLd -W3 -GX -Zi -Od -YX -Fr"$(MCEDIT_OBJS_DIR)\\" -Fp"$(MCEDIT_OBJS_DIR)\libedit.pch"
!endif
SPECIFIC_SLANG_CFLAGS=$(SPECIFIC_MC_CFLAGS)
SPECIFIC_MCEDIT_CFLAGS=$(SPECIFIC_MC_CFLAGS)
RC_DEFINES=-D_DEBUG
else
# ---- Release build
OBJS_DIR=release
EXTRA_MC_SRCS=
SPECIFIC_DEFINES=
SPECIFIC_MC_CFLAGS=-ML -W3 -O2 $(MC_MISC_CFLAGS)
SPECIFIC_MC_LFLAGS_EXTRA=-incremental:no
SPECIFIC_SLANG_CFLAGS=$(SPECIFIC_MC_CFLAGS)
SPECIFIC_MCEDIT_CFLAGS=$(SPECIFIC_MC_CFLAGS)
RC_DEFINES=-DRELEASE=$(RELEASE)
endif
SPECIFIC_MC_LFLAGS=-subsystem:console -pdb:"$(OBJS_DIR)\Mc.pdb" -machine:I386 -out:"$(OBJS_DIR)\Mc.exe" $(SPECIFIC_MC_LFLAGS_EXTRA)
MC_EXE=$(OBJS_DIR)/mc.exe
# ---- Compiler independent defines
include Makefile.NT
# ---- Linkers are usualy compiler-specific
SPECIFIC_MC_LFLAGS= \
-nologo \
-subsystem:console \
-pdb:$(OBJS_DIR)/mc.pdb \
-machine:I386 \
$(SPECIFIC_MC_LFLAGS_EXTRA)
$(MC_EXE): $(MC_RES) $(OBJS) $(MCEDIT_OBJS) $(SLANG_OBJS)
$(LINK) $(EXE_PLACE)$(MC_EXE) $(MC_LIBS) $(SPECIFIC_MC_LFLAGS) $+

View File

@ -18,11 +18,11 @@
- Preliminar. Work to be done here. (Maybe should write a command to
change attributes and another to change rwx permissions.
*/
#include <config.h>
#ifndef _OS_NT
#error This file is for the NT operating system.
#else
#include <config.h>
#include <windows.h>
#include <string.h>
#include <stdio.h>
@ -321,17 +321,10 @@ static void apply_mask (struct stat *sf)
} while (cpanel->marked);
}
/* .ado: Chmod can now remove the R-flag */
static int my_chmod (char *path, int mode)
{
/* From _chmod MSVC:Crt\Src\CHMOD.C */
/* just set new attribute */
if (!SetFileAttributes((LPTSTR)path, mode)) {
/* error occured -- map error code and return */
_dosmaperr(GetLastError());
return -1;
}
return 0;
SetFileAttributes(path, mode);
return (GetFileAttributes(path) != mode);
}
void chmod_cmd (void)

View File

@ -30,12 +30,33 @@
#ifndef __CONFIG_HPP //Prevent multiple includes
#define __CONFIG_HPP
#include <../VERSION>
#ifndef WIN32
# define WIN32
#endif
#ifndef __WIN32__
# define __WIN32__
#endif
#ifndef MSWINDOWS
# define MSWINDOWS
#endif
#ifndef pc_system
# define pc_system
#endif
#define _OS_NT
#define OS2_NT
#define FLOAT_TYPE
#define MIDNIGHT
// ---------------------------------------------------------------------------
// Headers
#define STDC_HEADERS
#define HAVE_STDLIB_H
#define HAVE_STRING_H
#define HAVE_DIRENT_H
#define HAVE_LIMITS_H
@ -45,12 +66,14 @@
// ---------------------------------------------------------------------------
// "Standard" Library
#define HAS_MEMSET
#define HAS_MEMCHR
#define HAS_MEMCPY
#define HAS_MEMCMP
#define HAVE_MEMSET
#define HAVE_MEMCHR
#define HAVE_MEMCPY
#define HAVE_MEMCMP
#define HAVE_MEMMOVE
#define HAVE_STRDUP
#define HAVE_STRERROR
#define HAVE_TRUNCATE
#define REGEX_MALLOC
@ -137,6 +160,4 @@ typedef unsigned int nlink_t;
#define pclose _pclose
#define pipe(p) _pipe(p, 4096, 0x8000 /*_O_BINARY*/)
#define OS2_NT 1
#endif //__CONFIG_HPP

View File

@ -20,11 +20,11 @@
show_console_contents doesn't know how to write to its window
the rest works fine.
*/
#include <config.h>
#ifndef _OS_NT
#error This file is for Win32 operating systems.
#else
#include <config.h>
#include <windows.h>
#include "util.debug.h"

View File

@ -19,11 +19,11 @@
can fit in a panel.
*/
#include <config.h>
#ifndef _OS_NT
#error This file is for the Win32 operating systems.
#else
#include <config.h>
#include <windows.h>
#include <string.h>
#include <stdio.h>

View File

@ -18,17 +18,12 @@
Bugs:
Have trouble with non-US keyboards, "Alt-gr"+keys (API tells CTRL-ALT is pressed)
*/
#include <config.h>
#ifndef _OS_NT
#error This file is for Win32 systems.
#else
#include <windows.h>
/* Linux and Win32 names are the same, but values are different */
const int win_shift_pressed = SHIFT_PRESSED;
#undef SHIFT_PRESSED
#include <config.h>
#include <stdio.h>
#include "mouse.h"
#include "global.h"
@ -191,7 +186,7 @@ pend_send:
pending_keys = 0;
seq_append = 0;
}
return correct_key_code (d);
return d;
}
@ -206,8 +201,8 @@ pend_send:
ch = ir.Event.KeyEvent.uChar.AsciiChar;
dwSaved_ControlState = ir.Event.KeyEvent.dwControlKeyState;
j = VKtoCurses(vkcode);
return correct_key_code (j ? j : ch);
j = VKtoCurses(vkcode);
return j ? j : ch;
case MOUSE_EVENT:
// Save event as a GPM-like event
@ -246,39 +241,23 @@ static int VKtoCurses (int a_vkc)
static int correct_key_code (int c)
{
static char AltGrPressed = 0;
/* Ugly hacks */
/* Make Ctrl-Tab same as reserved Alt-Tab */
if (c == '\t' && ctrl_pressed())
c = ALT('\t');
/* FIXME: Ignore Left-Ctrl+Right-Alt combination in non-US keyboards,
as it means Alt-Gr+key */
if (dwSaved_ControlState & RIGHT_ALT_PRESSED &&
dwSaved_ControlState & LEFT_CTRL_PRESSED)
return c;
/* No, AltGR Key is the combination with ENHANCED_KEY
and RIGHT_ALT_PRESSED .ado */
if (dwSaved_ControlState & RIGHT_ALT_PRESSED &&
dwSaved_ControlState & ENHANCED_KEY) {
/* AltGr Key pressed */
AltGrPressed = 1;
return c;
}
/* Other hacks */
/* Check Control State */
if (ctrl_pressed())
c = XCTRL(c);
if (!AltGrPressed &&
(dwSaved_ControlState & RIGHT_ALT_PRESSED ||
dwSaved_ControlState & LEFT_ALT_PRESSED))
c = ALT(c);
else
AltGrPressed = 0;
if (c == '\t')
/* Make Ctrl-Tab same as reserved Alt-Tab */
c = ALT('\t');
else
c = XCTRL(c);
if (alt_pressed())
c = ALT(c);
if (shift_pressed() && (c >= KEY_F(1)) && (c <= KEY_F(10)))
c += 10;
if (alt_pressed() && (c >= KEY_F(1)) && (c <= KEY_F(2)))
c += 10;
if (alt_pressed() && (c == KEY_F(7)))
c = ALT('?');
switch (c) {
case KEY_KP_ADD:
c = alternate_plus_minus ? ALT('+') : '+';
@ -419,8 +398,6 @@ int is_idle (void)
return 1;
}
extern long SLsys_GetLastkeyControlState ();
/* get_modifier */
int get_modifier()
{
@ -435,7 +412,7 @@ int get_modifier()
dwSaved_ControlState & LEFT_CTRL_PRESSED)
retval |= CONTROL_PRESSED;
if (dwSaved_ControlState & win_shift_pressed)
if (dwSaved_ControlState & SHIFT_PRESSED)
retval |= SHIFT_PRESSED;
return retval;
@ -443,12 +420,19 @@ int get_modifier()
int ctrl_pressed ()
{
if (dwSaved_ControlState & RIGHT_CTRL_PRESSED ||
dwSaved_ControlState & LEFT_CTRL_PRESSED)
return 1;
return 0;
return dwSaved_ControlState & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED);
}
int shift_pressed ()
{
return dwSaved_ControlState & SHIFT_PRESSED;
}
int alt_pressed ()
{
return dwSaved_ControlState & (RIGHT_ALT_PRESSED | LEFT_ALT_PRESSED);
}
/* void functions for UNIX copatibility */
void try_channels (int set_timeout)
{

View File

@ -1,4 +1,4 @@
/* Slang interface to the Midnight Commander for Windows NT
/* Slang interface to the Midnight Commander for Windows NT and OS/2
This emulates some features of ncurses on top of slang
S-lang is not fully consistent between its Unix and non-Unix versions.
@ -19,7 +19,6 @@
#include <config.h>
#include <stdio.h>
#include <windows.h>
#include "tty.h"
#include "mad.h"
#include "color.h"
@ -253,7 +252,7 @@ int got_interrupt ()
void mc_refresh (void)
{
/* if (!we_are_background) (no background mode in win32) */
/* if (!we_are_background) (no background mode yet) */
refresh ();
}

View File

@ -18,6 +18,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <config.h>
#include <windows.h>
#include "util.win32.h"
#include "util.debug.h"

View File

@ -17,6 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <config.h>
#include <windows.h>
#include "util.win32.h"
#include "util.debug.h"

View File

@ -17,6 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <config.h>
#ifdef HAVE_TRACE
#include <stdio.h>

View File

@ -20,13 +20,9 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <config.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <windows.h>
#include <io.h>
#include <fcntl.h>
@ -35,7 +31,6 @@
#include <errno.h>
#include <sys/time.h> /* select: timeout */
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdarg.h>
#include <process.h>