diff -ru Tk401.000/basic_demo Tk401.000.my/basic_demo
--- Tk401.000/basic_demo	Fri Oct  4 11:43:30 1996
+++ Tk401.000.my/basic_demo	Sat Dec 28 22:06:44 1996
@@ -321,7 +321,7 @@
 
 if (open(Gibberish,"</dev/tty"))
  {
-  $top->fileevent(Gibberish,'readable',[sub { my ($fh) = @_; print "stdin:",scalar <$fh> },\*Gibberish]);
+  #$top->fileevent(Gibberish,'readable',[sub { my ($fh) = @_; print "stdin:",scalar <$fh> },\*Gibberish]);
  }
 else
  {
diff -ru Tk401.000/Makefile.PL Tk401.000.my/Makefile.PL
--- Tk401.000/Makefile.PL	Sat Sep 28 02:37:34 1996
+++ Tk401.000.my/Makefile.PL	Thu Dec 26 19:11:14 1996
@@ -4,7 +4,7 @@
  {
   $VERSION = '401.000';
 
-  $win_arch = 'x';		# Currently 'x' and 'open32' supported
+  $win_arch = 'open32';		# Currently 'x' and 'open32' supported
 
   require "./myConfig";
   use lib ($Tk::MMutil::dir=getcwd);
diff -ru Tk401.000/pTk/mTk/generic/tkBind.c Tk401.000.my/pTk/mTk/generic/tkBind.c
--- Tk401.000/pTk/mTk/generic/tkBind.c	Sat Jun  8 10:11:48 1996
+++ Tk401.000.my/pTk/mTk/generic/tkBind.c	Sat Dec 28 22:26:48 1996
@@ -2038,6 +2038,9 @@
     return bestPtr;
 }
 
+#ifdef __OPEN32__
+extern char StashedKey;
+#endif 
 /*
  *--------------------------------------------------------------
  *
@@ -2495,6 +2498,11 @@
     register KeyCode *codePtr;
     KeySym keysym;
     int count, i, j, max, arraySize;
+#ifdef __OPEN32__
+    char oldStashed = StashedKey;
+    
+    StashedKey = 0;
+#endif 
 #define KEYCODE_ARRAY_SIZE 20
 
     dispPtr->bindInfoStale = 0;
@@ -2595,6 +2603,9 @@
 	nextModCode: continue;
     }
     XFreeModifiermap(modMapPtr);
+#ifdef __OPEN32__
+    StashedKey = oldStashed;
+#endif 
 }
 
 /*
diff -ru Tk401.000/pTk/mTk/tclUnix/tclUnixNotfy.c Tk401.000.my/pTk/mTk/tclUnix/tclUnixNotfy.c
--- Tk401.000/pTk/mTk/tclUnix/tclUnixNotfy.c	Sat Oct  5 10:22:12 1996
+++ Tk401.000.my/pTk/mTk/tclUnix/tclUnixNotfy.c	Sat Dec 28 20:27:22 1996
@@ -17,6 +17,11 @@
 #include "Lang.h"
 #include <signal.h> 
 
+#ifdef __EMX__
+#   include <sys/select.h>
+#   include <sys/time.h>
+#endif
+
 #ifndef MASK_SIZE
 #define MASK_SIZE 256
 #endif
@@ -159,6 +164,10 @@
     return result;
 }
 
+#if defined(__EMX__) && defined(__WIN32__)
+/* Backdoor into processing of events when from Tk. */
+int (*Tcl_WaitForEventProc)(int, fd_mask *, Tcl_Time *) = NULL;
+#endif
 /*
  *----------------------------------------------------------------------
  *
@@ -231,7 +240,11 @@
     memcpy((VOID *) readyMasks, (VOID *) checkMasks,
 	    3*MASK_SIZE*sizeof(fd_mask));
     if (timePtr == NULL) {
+#if defined(__EMX__) && defined(__WIN32__)
+	if (((numFdBits == 0) || (MaskEmpty((long *) readyMasks))) && !Tcl_WaitForEventProc) {
+#else
 	if ((numFdBits == 0) || (MaskEmpty((long *) readyMasks))) {
+#endif
 	    return TCL_ERROR;
 	}
 	timeoutPtr = NULL;
@@ -240,6 +253,11 @@
 	timeout.tv_sec = timePtr->sec;
 	timeout.tv_usec = timePtr->usec;
     }
+#if defined(__EMX__) && defined(__WIN32__)
+    if (Tcl_WaitForEventProc) {
+	numFound = (*Tcl_WaitForEventProc)(numFdBits, readyMasks, timePtr);
+    } else
+#endif
     numFound = select(numFdBits, (SELECT_MASK *) &readyMasks[0],
 	    (SELECT_MASK *) &readyMasks[MASK_SIZE],
 	    (SELECT_MASK *) &readyMasks[2*MASK_SIZE], timeoutPtr);
diff -ru Tk401.000/pTk/mTk/win/tkWinClipboard.c Tk401.000.my/pTk/mTk/win/tkWinClipboard.c
--- Tk401.000/pTk/mTk/win/tkWinClipboard.c	Sat Sep 28 02:41:44 1996
+++ Tk401.000.my/pTk/mTk/win/tkWinClipboard.c	Thu Dec 26 19:22:50 1996
@@ -55,7 +55,7 @@
 
     if ((selection == Tk_InternAtom(tkwin, "CLIPBOARD"))
 	    && (target == XA_STRING)) {
-	if (OpenClipboard(NULL)) {
+	if (OpenClipboard(tmpParent)) {
 	    handle = GetClipboardData(CF_TEXT);
 	    if (handle != NULL) {
 		data = GlobalLock(handle);
diff -ru Tk401.000/pTk/mTk/win/tkWinColor.c Tk401.000.my/pTk/mTk/win/tkWinColor.c
--- Tk401.000/pTk/mTk/win/tkWinColor.c	Fri Mar  8 09:14:48 1996
+++ Tk401.000.my/pTk/mTk/win/tkWinColor.c	Thu Dec 26 19:22:50 1996
@@ -157,6 +157,7 @@
     XColorEntry *colorPtr;
     Tcl_HashEntry *hPtr;
     int dummy;
+    char tmpclr[64];
 
     Tcl_InitHashTable(&colorTable, TCL_STRING_KEYS);
 
@@ -165,7 +166,8 @@
      */
 
     for (colorPtr = xColors; colorPtr->name != NULL; colorPtr++) {
-        hPtr = Tcl_CreateHashEntry(&colorTable, strlwr(colorPtr->name),
+	strcpy(tmpclr,colorPtr->name);
+        hPtr = Tcl_CreateHashEntry(&colorTable, strlwr(tmpclr),
 		&dummy);
         Tcl_SetHashValue(hPtr, colorPtr);
     }
@@ -176,7 +178,8 @@
 
     SetSystemColors();
     for (colorPtr = sysColors; colorPtr->name != NULL; colorPtr++) {
-        hPtr = Tcl_CreateHashEntry(&colorTable, strlwr(colorPtr->name),
+	strcpy(tmpclr,colorPtr->name);
+        hPtr = Tcl_CreateHashEntry(&colorTable, strlwr(tmpclr),
 		&dummy);
         Tcl_SetHashValue(hPtr, colorPtr);
     }
diff -ru Tk401.000/pTk/mTk/win/tkWinCursor.c Tk401.000.my/pTk/mTk/win/tkWinCursor.c
--- Tk401.000/pTk/mTk/win/tkWinCursor.c	Sat Sep 28 02:41:44 1996
+++ Tk401.000.my/pTk/mTk/win/tkWinCursor.c	Thu Dec 26 19:22:50 1996
@@ -105,7 +105,11 @@
 	cursorPtr->winCursor = LoadCursor(NULL, namePtr->id);
 	cursorPtr->system = 1;
     } else {
+#ifdef __OPEN32__
+	cursorPtr->winCursor = os2LoadCursor(TkWinGetTkModule(), string);
+#else
 	cursorPtr->winCursor = LoadCursor(TkWinGetTkModule(), string);
+#endif
 	cursorPtr->system = 0;
     }
     if (cursorPtr->winCursor == NULL) {
diff -ru Tk401.000/pTk/mTk/win/tkWinFont.c Tk401.000.my/pTk/mTk/win/tkWinFont.c
--- Tk401.000/pTk/mTk/win/tkWinFont.c	Sat Sep 28 02:41:46 1996
+++ Tk401.000.my/pTk/mTk/win/tkWinFont.c	Thu Dec 26 19:22:50 1996
@@ -23,6 +23,7 @@
 			    LOGFONT *logfont));
 static int		XNameToFont _ANSI_ARGS_((_Xconst char *name,
 			    LOGFONT *logfont));
+static char *lastname;
 
 /*
  *----------------------------------------------------------------------
@@ -56,6 +57,8 @@
     Tcl_Interp *dummy = Tcl_CreateInterp();
     LangFreeProc *freeProc = NULL, *freeProc2 = NULL;
 
+    goto nomatch;			/* XXXX name is not an Arg!!! */
+    
     if (Lang_SplitList(dummy, (char *) name, &argc, &args, &freeProc) != TCL_OK) {
 	goto nomatch;
     }
@@ -87,6 +90,10 @@
 	logfont->lfCharSet = SYMBOL_CHARSET;
     } else if (stricmp(logfont->lfFaceName, "WingDings") == 0) {
 	logfont->lfCharSet = SYMBOL_CHARSET;
+#ifdef __OPEN32__
+    } else if (stricmp(logfont->lfFaceName, "Symbol Set") == 0) {
+	logfont->lfCharSet = SYMBOL_CHARSET;
+#endif
     }
 	
     /*
@@ -278,6 +285,10 @@
 	    logfont->lfCharSet = SYMBOL_CHARSET;
 	} else if (stricmp(logfont->lfFaceName, "WingDings") == 0) {
 	    logfont->lfCharSet = SYMBOL_CHARSET;
+#ifdef __OPEN32__
+	} else if (stricmp(logfont->lfFaceName, "Symbol Set") == 0) {
+	    logfont->lfCharSet = SYMBOL_CHARSET;
+#endif
 	}
     }
 
@@ -392,6 +403,13 @@
     return TRUE;
 }
 
+static int
+myProc(LOGFONT *pLogFont, TEXTMETRIC *pTM, int iFT, LPARAM userData)
+{
+    LOGFONT *input = (LOGFONT*)userData;
+    *input = *pLogFont;
+    return 0;
+}
 /*
  *----------------------------------------------------------------------
  *
@@ -436,8 +454,16 @@
 	    object = DEVICE_DEFAULT_FONT;
 	} else if (stricmp(name, "oemfixed") == 0) {
 	    object = OEM_FIXED_FONT;
+	} else {
+	    HDC dc = GetDC(NULL);
+	    
+	    EnumFonts(dc, name, myProc, (LPARAM)&logfont);
+	    ReleaseDC(NULL, dc);
+	    font = CreateFontIndirect(&logfont);
+	    goto havefont;
 	}
 	font = GetStockObject(object);
+      havefont:
     }
     if (font == NULL) {
 	font = GetStockObject(SYSTEM_FONT);
@@ -492,6 +518,9 @@
 	fontPtr->max_byte1 = 0;
 	fontPtr->min_char_or_byte2 = tm.tmFirstChar;
 	fontPtr->max_char_or_byte2 = tm.tmLastChar;
+	if (strstr(lastname,"Symbol") && tm.tmLastChar == 126) {
+	    fontPtr->max_char_or_byte2 = 254;
+	}
 	fontPtr->all_chars_exist = True;
 	fontPtr->default_char = tm.tmDefaultChar;
 	fontPtr->n_properties = 0;
@@ -514,7 +543,7 @@
 
 	if (tm.tmAveCharWidth != tm.tmMaxCharWidth) {
 	    int i;
-	    int nchars = tm.tmLastChar - tm.tmFirstChar + 1;
+	    int nchars = fontPtr->max_char_or_byte2 - tm.tmFirstChar + 1;
 	    int minWidth = 30000;
 
 	    fontPtr->per_char =
@@ -538,7 +567,7 @@
 	    } else {
 		int *chars = (int *)ckalloc(sizeof(int) * nchars);
 
-		GetCharWidth(dc, tm.tmFirstChar, tm.tmLastChar, chars);
+		GetCharWidth(dc, tm.tmFirstChar, fontPtr->max_char_or_byte2, chars);
 
 		for (i = 0; i < nchars ; i++ ) {
 		    fontPtr->per_char[i] = bounds;
@@ -588,6 +617,8 @@
     _Xconst char* name;
 {
     Font font;
+
+    lastname = name;
     font = XLoadFont(display, name);
     return XQueryFont(display, font);
 }
diff -ru Tk401.000/pTk/mTk/win/tkWinPort.h Tk401.000.my/pTk/mTk/win/tkWinPort.h
--- Tk401.000/pTk/mTk/win/tkWinPort.h	Sat Sep 28 02:41:46 1996
+++ Tk401.000.my/pTk/mTk/win/tkWinPort.h	Thu Dec 26 19:22:50 1996
@@ -31,6 +31,9 @@
 #include <limits.h>
 #include <fcntl.h>
 #include <io.h>
+#ifdef __EMX__
+#   include <sys/types.h>
+#endif
 #include <sys/stat.h>
 #include <time.h>
 
@@ -38,7 +41,11 @@
 #    define strncasecmp strnicmp
 #    define hypot _hypot
 #else /* _MSC_VER */
-#    define strncasecmp strncmpi
+#    ifdef __EMX__
+#        define strncasecmp strnicmp
+#    else
+#        define strncasecmp strncmpi
+#    endif
 #endif /* _MSC_VER */
 
 #define NBBY 8
diff -ru Tk401.000/pTk/mTk/win/tkWinWindow.c Tk401.000.my/pTk/mTk/win/tkWinWindow.c
--- Tk401.000/pTk/mTk/win/tkWinWindow.c	Sat Apr 13 16:14:18 1996
+++ Tk401.000.my/pTk/mTk/win/tkWinWindow.c	Thu Dec 26 19:22:50 1996
@@ -62,8 +62,22 @@
 	parentWin = TkWinGetHWND(parent);
 	style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
     } else {
+#ifdef __OPEN32__
+	/* Open32 treats topmost windows specially, so we keep any
+	   window as not a toplevel. */
+	if (tmpParent == NULL) {
+	    tmpParent = CreateWindow(TK_WIN_CHILD_CLASS_NAME, "", WS_POPUP,
+				     0, 0,
+				     0, 0,
+				     NULL, NULL, TkWinGetAppInstance(), NULL);
+	    ShowWindow(tmpParent, SW_HIDE);
+	}
+	parentWin = tmpParent;
+	style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
+#else
 	parentWin = NULL;
 	style = WS_POPUP | WS_CLIPCHILDREN;
+#endif
     }
 
     twdPtr->window.handle = CreateWindow(TK_WIN_CHILD_CLASS_NAME, "", style,
diff -ru Tk401.000/pTk/mTk/win/tkWinWm.c Tk401.000.my/pTk/mTk/win/tkWinWm.c
--- Tk401.000/pTk/mTk/win/tkWinWm.c	Sat Sep 28 02:41:46 1996
+++ Tk401.000.my/pTk/mTk/win/tkWinWm.c	Thu Dec 26 19:22:50 1996
@@ -664,6 +664,31 @@
 		WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
 	SetParent(child, window);
 
+#ifdef __OPEN32__
+	{
+	    static int tmpParentMoved;
+	    if (!tmpParentMoved) {
+		tmpParentMoved = 1;
+/* 		DestroyWindow(tmpParent);  */
+		tmpParent = window; 
+	    }
+	}
+/* The window was created "without" a parent, so due to differences
+   in window origin it is created, say, at position 0 x 768 instead of 0 x 0.
+   Anyway, it looks like some event is missing here.
+ */
+
+	MoveWindow(child, 0, 0, 
+		       winPtr->changes.width, winPtr->changes.height, TRUE);
+	if (!(wmPtr->sizeHintsFlags & (USPosition | PPosition))) {
+	    RECT r;
+	    GetWindowRect(window, &r);
+	    wmPtr->flags &= ~(WM_NEGATIVE_X | WM_NEGATIVE_Y);
+	    wmPtr->x = winPtr->changes.x = r.left;
+	    wmPtr->y = winPtr->changes.y = r.top;
+	}
+#endif
+
 	/*
 	 * Generate a reparent event.
 	 */
@@ -2397,6 +2422,10 @@
 		    width + wmPtr->borderWidth,
 		    height + wmPtr->borderHeight, TRUE);
 	    wmPtr->flags &= ~WM_SYNC_PENDING;
+#ifdef __OPEN32__
+	    MoveWindow(TkWinGetHWND(winPtr->window), 0, 0, 
+		       width, height, TRUE);
+#endif
 	} else {
 	    winPtr->changes.x = x;
 	    winPtr->changes.y = y;
diff -ru Tk401.000/pTk/mTk/win/tkWinX.c Tk401.000.my/pTk/mTk/win/tkWinX.c
--- Tk401.000/pTk/mTk/win/tkWinX.c	Sat Apr 13 16:14:22 1996
+++ Tk401.000.my/pTk/mTk/win/tkWinX.c	Thu Dec 26 19:22:50 1996
@@ -107,8 +107,17 @@
 HMODULE
 TkWinGetTkModule()
 {
+#ifdef __OPEN32__
+#   ifdef _LANG /* Perl */
+    char libName[13] = "Tk_";
+    return dllHandle;
+#   else
+    char libName[13] = "tksys.dll";
+#   endif
+#else
     char libName[13];
     sprintf(libName, "tk%d%d.dll", TK_MAJOR_VERSION, TK_MINOR_VERSION);
+#endif
     return GetModuleHandle(libName);
 }
 
@@ -177,7 +186,11 @@
 
     class.lpszClassName = TK_WIN_TOPLEVEL_CLASS_NAME;
     class.lpfnWndProc = TkWinTopLevelProc;
+#ifdef __OPEN32__
+    class.hIcon = os2LoadIcon(TkWinGetTkModule(), "tk");
+#else
     class.hIcon = LoadIcon(TkWinGetTkModule(), "tk");
+#endif
     class.hCursor = LoadCursor(NULL, IDC_ARROW);
 
     topLevelAtom = RegisterClass(&class);
@@ -196,7 +209,9 @@
 
     childAtom = RegisterClass(&class);
     if (childAtom == 0) {
+#ifndef __OPEN32__
 	UnregisterClass((LPCTSTR)topLevelAtom, hInstance);
+#endif
 	panic("Unable to register TkChild class");
     }
 }
@@ -449,14 +464,30 @@
 	    TkWinDrawable *twdPtr =
 		(TkWinDrawable *) GetWindowLong(hwnd, GWL_USERDATA);
 
+#ifdef __OPEN32__
+	    RECT r;
+	    /* Somehow sometimes it is not translated upside-down... */
+	    GetWindowRect(hwnd, &r);
+	    pos->x = r.left;
+	    pos->y = r.top;
+	    pos->cx = r.right - r.left;
+	    pos->cy = r.bottom - r.top;
+#endif
 	    TkWinWmConfigure(TkWinGetWinPtr(twdPtr), pos);
+#ifdef __OPEN32__
+	    break;			/* To update child PM window */
+#endif
 	    return 0;
 	}
 
-	case WM_CLOSE:
 	case WM_LBUTTONDOWN:
 	case WM_MBUTTONDOWN:
 	case WM_RBUTTONDOWN:
+	    TranslateEvent(hwnd, message, wParam, lParam);
+	    /* To NOT get focus. */
+	    return 0;
+
+	case WM_CLOSE:
 	case WM_LBUTTONUP:
 	case WM_MBUTTONUP:
 	case WM_RBUTTONUP:
@@ -553,11 +584,15 @@
 	    return 0;
 	}
 
-	case WM_DESTROYCLIPBOARD:
-	case WM_PAINT:
 	case WM_LBUTTONDOWN:
 	case WM_MBUTTONDOWN:
 	case WM_RBUTTONDOWN:
+	    TranslateEvent(hwnd, message, wParam, lParam);
+	    /* To NOT get focus. */
+	    return 0;
+
+	case WM_DESTROYCLIPBOARD:
+	case WM_PAINT:
 	case WM_LBUTTONUP:
 	case WM_MBUTTONUP:
 	case WM_RBUTTONUP:
@@ -640,8 +675,8 @@
 	    BeginPaint(hwnd, &ps);
 	    event.xexpose.x = ps.rcPaint.left;
 	    event.xexpose.y = ps.rcPaint.top;
-	    event.xexpose.width = ps.rcPaint.right - ps.rcPaint.left;
-	    event.xexpose.height = ps.rcPaint.bottom - ps.rcPaint.top;
+	    event.xexpose.width = max(ps.rcPaint.right - ps.rcPaint.left,0);
+	    event.xexpose.height = max(ps.rcPaint.bottom - ps.rcPaint.top,0);
 	    EndPaint(hwnd, &ps);
 	    event.xexpose.count = 0;
 	    break;
@@ -766,6 +801,9 @@
 		     * Check for translated characters in the event queue.
 		     */
 
+#ifdef __OPEN32__
+		    StashedKey = 0;
+#endif
 		    event.type = KeyPress;
 		    event.xkey.keycode = wParam;
 		    GetTranslatedKey(&event.xkey);
@@ -778,6 +816,9 @@
 		     * because Tk won't know what to do with them.  Instead, we
 		     * wait for the WM_CHAR messages which will follow.
 		     */
+#ifdef __OPEN32__
+		    StashedKey = 0;
+#endif
 		    event.type = KeyRelease;
 		    event.xkey.keycode = wParam;
 		    event.xkey.nchars = 0;
@@ -789,6 +830,9 @@
 		     * Synthesize both a KeyPress and a KeyRelease.
 		     */
 
+#ifdef __OPEN32__
+		    StashedKey = (char) lParam;
+#endif
 		    event.type = KeyPress;
 		    event.xkey.keycode = 0;
 		    event.xkey.nchars = 1;
@@ -951,6 +995,9 @@
 	    && PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
 	if ((msg.message == WM_CHAR) || (msg.message == WM_SYSCHAR)) {
 	    xkey->trans_chars[xkey->nchars] = (char) msg.wParam;
+#ifdef __OPEN32__
+	    StashedKey = (char) msg.wParam;
+#endif
 	    xkey->nchars++;
 	    GetMessage(&msg, NULL, 0, 0);
 	    if ((msg.message == WM_CHAR) && (msg.lParam & 0x20000000)) {
diff -ru Tk401.000/pTk/tclUnixNotfy.c Tk401.000.my/pTk/tclUnixNotfy.c
--- Tk401.000/pTk/tclUnixNotfy.c	Sat Oct  5 10:38:08 1996
+++ Tk401.000.my/pTk/tclUnixNotfy.c	Sat Dec 28 20:27:50 1996
@@ -17,6 +17,11 @@
 #include "Lang.h"
 #include <signal.h> 
 
+#ifdef __EMX__
+#   include <sys/select.h>
+#   include <sys/time.h>
+#endif
+
 #ifndef MASK_SIZE
 #define MASK_SIZE 256
 #endif
@@ -159,6 +164,10 @@
     return result;
 }
 
+#if defined(__EMX__) && defined(__WIN32__)
+/* Backdoor into processing of events when from Tk. */
+int (*Tcl_WaitForEventProc)(int, fd_mask *, Tcl_Time *) = NULL;
+#endif
 /*
  *----------------------------------------------------------------------
  *
@@ -231,7 +240,11 @@
     memcpy((VOID *) readyMasks, (VOID *) checkMasks,
 	    3*MASK_SIZE*sizeof(fd_mask));
     if (timePtr == NULL) {
+#if defined(__EMX__) && defined(__WIN32__)
+	if (((numFdBits == 0) || (MaskEmpty((long *) readyMasks))) && !Tcl_WaitForEventProc) {
+#else
 	if ((numFdBits == 0) || (MaskEmpty((long *) readyMasks))) {
+#endif
 	    return TCL_ERROR;
 	}
 	timeoutPtr = NULL;
@@ -240,6 +253,11 @@
 	timeout.tv_sec = timePtr->sec;
 	timeout.tv_usec = timePtr->usec;
     }
+#if defined(__EMX__) && defined(__WIN32__)
+    if (Tcl_WaitForEventProc) {
+	numFound = (*Tcl_WaitForEventProc)(numFdBits, readyMasks, timePtr);
+    } else
+#endif
     numFound = select(numFdBits, (SELECT_MASK *) &readyMasks[0],
 	    (SELECT_MASK *) &readyMasks[MASK_SIZE],
 	    (SELECT_MASK *) &readyMasks[2*MASK_SIZE], timeoutPtr);
diff -ru Tk401.000/pTk/tkBind.c Tk401.000.my/pTk/tkBind.c
--- Tk401.000/pTk/tkBind.c	Sat Sep 28 02:53:50 1996
+++ Tk401.000.my/pTk/tkBind.c	Sun Dec 29 02:52:04 1996
@@ -2038,6 +2038,9 @@
     return bestPtr;
 }
 
+#ifdef __OPEN32__
+extern char StashedKey;
+#endif 
 /*
  *--------------------------------------------------------------
  *
@@ -2495,6 +2498,11 @@
     register KeyCode *codePtr;
     KeySym keysym;
     int count, i, j, max, arraySize;
+#ifdef __OPEN32__
+    char oldStashed = StashedKey;
+    
+    StashedKey = 0;
+#endif 
 #define KEYCODE_ARRAY_SIZE 20
 
     dispPtr->bindInfoStale = 0;
@@ -2595,6 +2603,9 @@
 	nextModCode: continue;
     }
     XFreeModifiermap(modMapPtr);
+#ifdef __OPEN32__
+    StashedKey = oldStashed;
+#endif 
 }
 
 /*
diff -ru Tk401.000/pTk/tkWinPort.h Tk401.000.my/pTk/tkWinPort.h
--- Tk401.000/pTk/tkWinPort.h	Sat Sep 28 02:54:18 1996
+++ Tk401.000.my/pTk/tkWinPort.h	Thu Dec 26 19:24:26 1996
@@ -31,6 +31,9 @@
 #include <limits.h>
 #include <fcntl.h>
 #include <io.h>
+#ifdef __EMX__
+#   include <sys/types.h>
+#endif
 #include <sys/stat.h>
 #include <time.h>
 
@@ -38,7 +41,11 @@
 #    define strncasecmp strnicmp
 #    define hypot _hypot
 #else /* _MSC_VER */
-#    define strncasecmp strncmpi
+#    ifdef __EMX__
+#        define strncasecmp strnicmp
+#    else
+#        define strncasecmp strncmpi
+#    endif
 #endif /* _MSC_VER */
 
 #define NBBY 8
