Release 0.6

Tue Jan  4 13:01:33 1994  David Metcalfe <david@prism.demon.co.uk>

        * [window/caret.c]
        Modified code to use system timer.

Jan 9, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)

	* [windows/win.c]
	Windows create if required new XLIB MenuBar & CaptionBar.

	* [windows/defwnd.c]
	WM_CALCSIZE Move & Resize caption, menubar & scrollbars.
	(I'm not sure it's the good place for it, but it work...)

	* [loader/resource.c]
	optimize in FindResourceByNumber, make lseek() if next type ...

	* [controls/scroll.c]
	scrollbar buttons are now using system resources bitmaps.

	* [controls/caption.c] - new file ...
	captionbar showing title, close button with SysMenu,
	and other buttons using system resources bitmaps.

	* [controls/menu.c]
	New functions: SetMenuItemBitmaps() with 'glues',
	Make new version of LoadMenu() & ParseMenu(),
	( put #define USE_POPUPMENU ).
	Implementation of MenuBar functions.
	
	* [sysres.dll]
	New bitmaps for system such OBM_CLOSE, OBM_MINIMIZE, OBM_UPARROWI.
	New SYSMENU menu, it don't work yet ! :-((

Tue Jan 11 05:27:45 1994  julliard@di.epfl.ch (Alexandre Julliard

	* [memory/atom.c]
	Fixed a bug that could cause atoms to be case-sensitive.

	* [misc/rect.c]
	Bug fix in SubtractRect().

	* [objects/clipping.c]
	Bug fix when setting the clip mask to an empty region.

	* [windows/dce.c]
	Bug fix in ReleaseDC().

	* [windows/dialog.c]
	Call AdjustWindowRectEx() before creating the dialog window.
	Added support for DS_MODALFRAME style.

	* [windows/event.c]
	Cleaned up event handling and removed old Xt stuff.
	Moved double-click handling to windows/message.c

	* [windows/focus.c]
	Bug fix: only set the X focus when the window is viewable.

	* [windows/graphics.c]
	Rewritten DrawReliefRect() to use brush instead of pen, and
	to use the system colors.

	* [windows/message.c]
	Implemented WM_NCHITTEST message sending, and non-client
	mouse messages.
	Cleaned up double-click handling, and removed the Xt code.

	* [windows/nonclient.c]  (New file)
	Implemented AdjustWindowRect().
	Implemented WM_NCCALCSIZE, WM_NCHITTEST and WM_NCPAINT handling.

	* [windows/painting.c]
	Added sending of the WM_NCPAINT message in BeginPaint().

	* [windows/sysmetrics.c] [include/sysmetrics.h]  (New files)
	Implemented system metrics.

	* [windows/win.c]
	Bug fix in setting the parent and owner in CreateWindow().
	Removed the Xt code.

	* [windows/winpos.c]
	Added sending of the WM_NCPAINT message in SetWindowPos().
	Removed the Xt code.
diff --git a/misc/Makefile b/misc/Makefile
index 8cdcee9..6fa5c19 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -2,7 +2,7 @@
 
 OBJS=kernel.o user.o xt.o rect.o file.o sound.o emulate.o \
      keyboard.o profile.o lstr.o exec.o message.o int1a.o int21.o \
-     dos_fs.o comm.o
+     dos_fs.o comm.o spy.o
 
 default: misc.o
 
diff --git a/misc/dos_fs.c b/misc/dos_fs.c
index e072274..57aed8d 100644
--- a/misc/dos_fs.c
+++ b/misc/dos_fs.c
@@ -661,7 +661,7 @@
 
 char *WinIniFileName()
 {
-	char name[256];
+	static char name[256];
 	
 	strcpy(name,GetDirectUnixFileName(WindowsDirectory));	
 	strcat(name,"win.ini");
diff --git a/misc/lstr.c b/misc/lstr.c
index 77e178c..bd30f88 100644
--- a/misc/lstr.c
+++ b/misc/lstr.c
@@ -52,7 +52,7 @@
 /* KERNEL.90 */
 int lstrlen(LPCSTR str)
 {
-  strlen(str);
+  return strlen(str);
 }
 
 /* AnsiUpper USER.431 */
diff --git a/misc/profile.c b/misc/profile.c
index 12d12fe..f150c9c 100644
--- a/misc/profile.c
+++ b/misc/profile.c
@@ -125,7 +125,7 @@
 	    if (c == ' ' || c == '\t')
 		break;
 	    
-	    if (c == '\n' || overflow) /* Abort Definition */
+	    if (c == '\n' || c == ';' || overflow) /* Abort Definition */
 		next = CharBuffer;
 	    
 	    if (c == '=' || overflow){
diff --git a/misc/rect.c b/misc/rect.c
index 4fd7be4..6adc0a5 100644
--- a/misc/rect.c
+++ b/misc/rect.c
@@ -152,8 +152,12 @@
     *dest = *src1;
     if (IntersectRect( &tmp, src1, src2 ))
     {
-	if (EqualRect( &tmp, dest )) SetRectEmpty( src1 );
-	else if ((tmp.top == dest->top) && (tmp.bottom == dest->bottom))
+	if (EqualRect( &tmp, dest ))
+	{
+	    SetRectEmpty( dest );
+	    return FALSE;
+	}
+	if ((tmp.top == dest->top) && (tmp.bottom == dest->bottom))
 	{
 	    if (tmp.left == dest->left) dest->right = tmp.right;
 	    else if (tmp.right == dest->right) dest->left = tmp.left;
diff --git a/misc/spy.c b/misc/spy.c
new file mode 100644
index 0000000..d45ebb2
--- /dev/null
+++ b/misc/spy.c
@@ -0,0 +1,257 @@
+/* SPY.C
+ *
+ * Copyright 1994, Bob Amstadt
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "wineopts.h"
+#include "windows.h"
+#include "wine.h"
+
+#ifndef NOSPY
+
+#define SPY_MAX_MSGNUM		0x0210
+
+const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
+{
+    "WM_NULL",			/* 0x00 */
+    "WM_CREATE",	
+    "WM_DESTROY",    
+    "WM_MOVE",
+    "WM_UNUSED0",
+    "WM_SIZE",
+    "WM_ACTIVATE",
+    "WM_SETFOCUS",
+    "WM_KILLFOCUS",
+    "WM_UNUSED1",
+    "WM_ENABLE",
+    "WM_SETREDRAW",
+    "WM_SETTEXT",
+    "WM_GETTEXT",
+    "WM_GETTEXTLENGTH",
+    "WM_PAINT",
+    "WM_CLOSE",			/* 0x10 */
+    "WM_QUERYENDSESSION",
+    "WM_QUIT",
+    "WM_QUERYOPEN",
+    "WM_ERASEBKGND",
+    "WM_SYSCOLORCHANGE",
+    "WM_ENDSESSION",
+    "WM_UNUSED2",
+    "WM_SHOWWINDOW",
+    "WM_CTLCOLOR",
+    "WM_WININICHANGE",
+    "WM_DEVMODECHANGE",
+    "WM_ACTIVATEAPP",
+    "WM_FONTCHANGE",
+    "WM_TIMECHANGE",
+    "WM_CANCELMODE",
+    "WM_SETCURSOR",		/* 0x20 */
+    "WM_MOUSEACTIVATE",
+    "WM_CHILDACTIVATE",
+    "WM_QUEUESYNC",
+    "WM_GETMINMAXINFO",
+    "WM_UNUSED3",
+    "WM_PAINTICON",
+    "WM_ICONERASEBKGND",
+    "WM_NEXTDLGCTL",
+    "WM_UNUSED4",
+    "WM_SPOOLERSTATUS",
+    "WM_DRAWITEM",
+    "WM_MEASUREITEM",
+    "WM_DELETEITEM",
+    "WM_VKEYTOITEM",
+    "WM_CHARTOITEM",
+    "WM_SETFONT",		/* 0x30 */
+    "WM_GETFONT", NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x40 */
+    NULL, NULL, NULL, NULL, NULL, NULL,
+    "WM_WINDOWPOSCHANGING",	/* 0x0046 */
+    "WM_WINDOWPOSCHANGED",	/* 0x0047 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x0050 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x0060 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x0070 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    NULL,			/* 0x0080 */
+    "WM_NCCREATE",		/* 0x0081 */
+    "WM_NCDESTROY",		/* 0x0082 */
+    "WM_NCCALCSIZE",		/* 0x0083 */
+    NULL, NULL, NULL,
+    "WM_GETDLGCODE",		/* 0x0087 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x0090 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x00A0 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x00B0 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x00C0 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x00D0 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x00E0 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x00F0 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    "WM_KEYDOWN",		/* 0x0100 */
+    "WM_KEYUP",			/* 0x0101 */
+    "WM_CHAR",			/* 0x0102 */
+    "WM_DEADCHAR",		/* 0x0103 */
+    "WM_SYSKEYDOWN",		/* 0x0104 */
+    "WM_SYSKEYUP",		/* 0x0105 */
+    "WM_SYSCHAR",		/* 0x0106 */
+    "WM_SYSDEADCHAR",		/* 0x0107 */
+    "WM_KEYLAST",		/* 0x0108 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    "WM_INITDIALOG",		/* 0x0110  */
+    "WM_COMMAND",		/* 0x0111 */
+    NULL,
+    "WM_TIMER",			/* 0x0113 */
+    "WM_HSCROLL",		/* 0x0114 */
+    "WM_VSCROLL",		/* 0x0115 */
+    NULL, NULL,
+    "WM_SYSTIMER",		/* 0x0118 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x0120 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x0130 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x0140 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x0150 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x0160 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x0170 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x0180 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x0190 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x01A0 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x01B0 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x01C0 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x01D0 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x01E0 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    /* 0x01F0 */
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+
+    "WM_MOUSEMOVE",		/* 0x0200 */
+    "WM_LBUTTONDOWN",		/* 0x0201 */
+    "WM_LBUTTONUP",		/* 0x0202 */
+    "WM_LBUTTONDBLCLK",		/* 0x0203 */
+    "WM_RBUTTONDOWN",		/* 0x0204 */
+    "WM_RBUTTONUP",		/* 0x0205 */
+    "WM_RBUTTONDBLCLK",		/* 0x0206 */
+    "WM_MBUTTONDOWN",		/* 0x0207 */
+    "WM_MBUTTONUP",		/* 0x0208 */
+    "WM_MBUTTONDBLCLK",		/* 0x0209 */
+    "WM_PARENTNOTIFY",		/* 0x0210 */
+};
+
+#endif /* NOSPY */
+
+/**********************************************************************
+ *					SpyMessage
+ */
+void SpyMessage(HWND hwnd, WORD msg, WORD wParam, LONG lParam)
+{
+#ifndef NOSPY
+    if (SpyFp == NULL)
+	return;
+    
+    if (msg > SPY_MAX_MSGNUM || MessageTypeNames[msg] == NULL)
+    {
+	fprintf(SpyFp, "%04.4x                  %04.4x  %04.4x  %08.8x\n",
+		hwnd, msg, wParam, lParam);
+    }
+    else
+    {
+	fprintf(SpyFp, "%04.4x  %20.20s  %04.4x  %08.8x\n",
+		hwnd, MessageTypeNames[msg], wParam, lParam);
+    }
+#endif
+}
+
+/**********************************************************************
+ *					SpyInit
+ */
+void SpyInit(void)
+{
+    char filename[100];
+
+    if (SpyFp == NULL)
+	return;
+    
+    GetPrivateProfileString("spy", "file", "", filename, sizeof(filename),
+			    WINE_INI);
+
+    if (strcasecmp(filename, "CON") == 0)
+	SpyFp = stdout;
+    else if (strlen(filename))
+	SpyFp = fopen(filename, "a");
+    else
+	SpyFp = NULL;
+}
diff --git a/misc/user.c b/misc/user.c
index 501448c..d8e0596 100644
--- a/misc/user.c
+++ b/misc/user.c
@@ -16,6 +16,7 @@
 
 extern BOOL ATOM_Init();
 extern BOOL GDI_Init();
+extern void SYSMETRICS_Init();
 
 /***********************************************************************
  *           USER_HeapInit
@@ -40,13 +41,16 @@
 {
     int queueSize;
 
+    SpyInit();
+
       /* Global atom table initialisation */
     if (!ATOM_Init()) return 0;
     
       /* GDI initialisation */
     if (!GDI_Init()) return 0;
 
-      /* Initialize system colors */
+      /* Initialize system colors and metrics*/
+    SYSMETRICS_Init();
     SYSCOLOR_Init();
     
       /* Create USER heap */
diff --git a/misc/xt.c b/misc/xt.c
index a829a5b..4458521 100644
--- a/misc/xt.c
+++ b/misc/xt.c
@@ -22,6 +22,8 @@
 
 Display * XT_display;
 Screen * XT_screen;
+Display * display;
+Screen * screen;
 XtAppContext XT_app_context;
 
 static Widget topLevelWidget;
@@ -40,6 +42,8 @@
 				       NULL );
     XT_display = XtDisplay( topLevelWidget );
     XT_screen  = XtScreen( topLevelWidget );
+    display = XtDisplay( topLevelWidget );
+    screen  = XtScreen( topLevelWidget );
     
     DOS_InitFS();
     Comm_Init();
@@ -68,32 +72,3 @@
     struct tms dummy;
     return (times(&dummy) * 1000) / HZ;
 }
-
-
-int GetSystemMetrics( short index )
-{
-    printf( "GetSystemMetrics: %d\n", index );
-    switch(index)
-    {
-      case SM_CXSCREEN:
-	return DisplayWidth( XT_display, DefaultScreen( XT_display ));
-
-      case SM_CYSCREEN:
-	return DisplayHeight( XT_display, DefaultScreen( XT_display ));
-
-      default:
-	  return 0;
-    }
-}
-
-void AdjustWindowRect( LPRECT rect, DWORD style, BOOL menu )
-{
-    printf( "AdjustWindowRect: (%d,%d)-(%d,%d) %d %d\n", rect->left, rect->top,
-	   rect->right, rect->bottom, style, menu );
-#ifdef USE_XLIB
-    rect->right += 8;
-    rect->bottom += 34;
-#endif
-}
-
-