Release 971116

Sun Nov 16 07:42:44 1997  Alex Korobka <alex@trantor.pharm.sunysb.edu>

	* [windows/dce.c] [windows/clipboard.c] [windows/nonclient.c]
	Bug fixes.

	* [misc/shell.c] [resources/*]
	New "About" dialog.

Sat Nov 15 17:30:18 1997  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [configure.in] [Makefile.in]
	Replaced --with-library option by --disable-emulator. The default
 	is now to build both the library and the emulator.
	Renamed --with options to --enable to follow autoconf guidelines.

	* [loader/main.c] [miscemu/main.c] (New file)
	Split initialization in WinelibInit/EmulatorInit.

	* [loader/*.c]
	Removed all remaining #ifdef's WINELIB.

	* [controls/widgets.c] [windows/mdi.c]
	Converted MDIClientWndProc to 32-bit.

	* [debugger/break.c] [if1632/signal.c] [include/selectors.h]
	  [scheduler/thread.c]
	Code and data selector values are now computed at run-time.

	* [library/libres.c]
	Moved to loader/ directory.

	* [misc/main.c] [misc/version.c] (New file)
	Moved all version stuff to version.c. Cleaned up a bit.

	* [msdos/dpmi.c]
	Update the REALMODECALL structure on return from real-mode
	interrupt.

	* [windows/event.c] [windows/keyboard.c]
	Changed the way event coordinates are determined. Don't rely on
	the ConfigureNotify event values. This should fix all problems
	with cursor position in -desktop and -managed modes.

Sat Nov 15 16:09:36 1997  Slaven Rezic  <eserte@cs.tu-berlin.de>

	* [controls/button.c]
	(BUTTON_CheckAutoRadioButton): Prevent possible endless loop.

Wed Nov 12 03:42:45 1997  Chris Faherty <chrisf@america.com>

	* [misc/ver.c]
	Changed VerInstall32A to assume srcdir as destination if destdir
	is blank.  This was causing alot of DLL installation into SYSTEM
	directory to fail.

	* [loader/ne_image.c]
	NE_LoadSegment buffer[100] was too small and getting overruns.
	Changed it to buffer[200].

Sat Nov  8 06:09:57 1997  Len White <phreak@cgocable.net>

	* [misc/ddeml.c] [include/ddeml.h] [if1632/ddeml.spec]
	Added stub functions DdeConnectList(), DdeQueryNextServer(),
	DdeDisconnectList(), DdeSetUserHandle(), DdeAbandonTransaction(),
	DdePostAdvise(), DdeCreateDataHandle(), DdeAddData(), DdeGetData(),
	DdeAccessData(), DdeUnaccessData(), DdeEnableCallback(),
	DdeCmpStringHandles().

Fri Nov  7 19:44:26 1997  Olaf Flebbe  <o.flebbe@science-computing.de>

	* [files/directory.c]
	Fix typo in directory.c [broke loading of cdplayer on nt40]

	* [misc/main.c]
	Implemented -winver nt40.

	* [loader/resource.c] [user32.spec]
	Stubs for CopyAcceleratorTable, Destroy AcceleratorTable.

Thu Nov  6 22:37:04 1997  Morten Welinder  <welinder@rentec.com>

	* [files/drive.c]
	(GetDiskFreeSpace32A): Cap at 2GB.

	* [include/windows.h]
	Prototype DrawIconEx and CreateDIBSection32.
	Define OBM_RADIOCHECK.
	Add DI_* macros.

	* [objects/dib.c] [if1632/gdi.spec]
	CreateDIBSection is a WINAPI.  Renamed to CreateDIBSection32.
	Implement CreateDIBSection16.

	* [if1632/user.spec] [if1632/user32.spec]
	Add DrawIconEx.

	* [objects/cursoricon.c]
	(CopyIcon32): Fix bogus implementation.

	* [objects/bitmap.c]
	(CopyBitmap32): New function.
	(CopyImage32): Do bitmaps.

	* [graphics/x11drv/text.c]
	(X11DRV_ExtTextOut): Change ascent and descent default to avoid
	zero-thinkness overstrike line.

	* [include/debugstr.h] [misc/debugstr.c]
	New files.

	* [msdos/dpmi.c]
	Don't prototype do_mscdex. In INT_Int31Handler, handle real-mode
	int 0x21, ah=0x52.

	* [msdos/int2f.c]
	Add dummys for 0x1681 and 0x1682.

	* [misc/registry.c]
	Fix memory leaks in RegDeleteKey32W.

	* [objects/text.c]
	In TEXT_NextLine, fix another off-by-one bug.

	* [include/bitmaps/obm_radiocheck]
	New file.  (It a small circle used to radio-button menu items
	when selected.)
	
	* [objects/oembitmap.c]
	Add obm_radiocheck.

	* [include/windows.h] [if1632/user32.spec] [controls/menu.c]
	  [if1632/user.spec]
	Define CheckMenuRadioItem{16,32}.  Define GetMenuItemRect{16,32}.

Wed Nov  5 11:30:14 1997  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
	* [misc/main.c]
	Auto adjust versions depending on binary.

Tue Nov  4 15:21:00 1997  Kristian Nielsen  <kristian.nielsen@risoe.dk>

	* [controls/listbox.c]
	Paint full background in listbox items with tab stops enabled.

	* [if1632/thunk.c]
	Copy some more message parameter structures (DRAWITEMSTRUCT16,
	COMPAREITEMSTRUCT16) to the stack segment to fix broken programs
	that need this.

	* [windows/dce.c]
	Only clip sibling windows when the parent has the WS_CLIPSIBLINGS
	style set.

	* [windows/focus.c]
	Make order of events in FOCUS_SwitchFocus() reflect API docs.

	* [windows/defdlg.c]
	Fix problem with loss of focus in some dialogs.

	* [win32/code_page.c]
	Fix return value for MultiByteToWideChar().

	* [BUGS]
	BCW now works.
diff --git a/windows/nonclient.c b/windows/nonclient.c
index 3638ebc..9235836 100644
--- a/windows/nonclient.c
+++ b/windows/nonclient.c
@@ -5,6 +5,7 @@
  *
  */
 
+#include "version.h"
 #include "win.h"
 #include "message.h"
 #include "sysmetrics.h"
@@ -1332,22 +1333,6 @@
 }
 
 /***********************************************************************
- *           NC_TrackSysMenu
- *
- * Track a mouse button press on the system menu.
- * TODO: Unify with NC_TrackMinMaxBox() (and without InternalGetMessage() calls).
- */
-static void NC_TrackSysMenu( HWND32 hwnd, POINT16 pt )
-{
-    WND*	wndPtr = WIN_FindWndPtr( hwnd );
-    
-    if (wndPtr->dwStyle & WS_SYSMENU)
-	SendMessage16( hwnd, WM_SYSCOMMAND, 
-		SC_MOUSEMENU + HTSYSMENU, *((LPARAM*)&pt));
-}
-
-
-/***********************************************************************
  *           NC_StartSizeMove
  *
  * Initialisation of a move or resize, when initiatied from a menu choice.
@@ -1450,7 +1435,7 @@
     WND *     wndPtr = WIN_FindWndPtr( hwnd );
     BOOL32    thickframe = HAS_THICKFRAME( wndPtr->dwStyle );
     BOOL32    iconic = wndPtr->dwStyle & WS_MINIMIZE;
-    int       moved = 0;
+    BOOL32    moved = FALSE;
 
     if (IsZoomed32(hwnd) || !IsWindowVisible32(hwnd) ||
         (wndPtr->flags & WIN_MANAGED)) return;
@@ -1521,19 +1506,12 @@
 	if (rootWindow == DefaultRootWindow(display)) XGrabServer( display );
     }
 
-    if( iconic )
+    if( iconic ) /* create a cursor for dragging */
     {
-	HICON16 hIcon = (wndPtr->class->hIcon)
-                      ? wndPtr->class->hIcon
+	HICON16 hIcon = (wndPtr->class->hIcon) ? wndPtr->class->hIcon
                       : (HICON16)SendMessage16( hwnd, WM_QUERYDRAGICON, 0, 0L);
-	if( hIcon )
-	{
-	    hDragCursor =  CURSORICON_IconToCursor( hIcon, TRUE );
-	    hOldCursor = SetCursor32(hDragCursor);
-	    ShowCursor32( TRUE );
-	} 
-	else iconic = FALSE;
-	WINPOS_ShowIconTitle( wndPtr, FALSE );
+	if( hIcon ) hDragCursor =  CURSORICON_IconToCursor( hIcon, TRUE );
+	if( !hDragCursor ) iconic = FALSE;
     }
 
     if( !iconic ) NC_DrawMovingFrame( hdc, &sizingRect, thickframe );
@@ -1574,7 +1552,17 @@
 
 	if (dx || dy)
 	{
-            moved = 1;
+	    if( !moved )
+	    {
+		moved = TRUE;
+        	if( iconic ) /* ok, no system popup tracking */
+		{
+		    hOldCursor = SetCursor32(hDragCursor);
+		    ShowCursor32( TRUE );
+		    WINPOS_ShowIconTitle( wndPtr, FALSE );
+		}
+	    }
+
 	    if (msg.message == WM_KEYDOWN) SetCursorPos32( pt.x, pt.y );
 	    else
 	    {
@@ -1599,9 +1587,12 @@
     ReleaseCapture();
     if( iconic )
     {
-	ShowCursor32( FALSE );
-	SetCursor32(hOldCursor);
-	if( hDragCursor ) DestroyCursor32( hDragCursor );
+	if( moved ) /* restore cursors, show icon title later on */
+	{
+	    ShowCursor32( FALSE );
+	    SetCursor32( hOldCursor );
+	}
+        DestroyCursor32( hDragCursor );
     }
     else
 	NC_DrawMovingFrame( hdc, &sizingRect, thickframe );
@@ -1616,40 +1607,43 @@
 
     if (HOOK_IsHooked( WH_CBT ))
     {
-       RECT16* pr = SEGPTR_NEW(RECT16);
-       if( pr )
-       {
-           CONV_RECT32TO16( &sizingRect, pr );
-	  if( HOOK_CallHooks16( WH_CBT, HCBT_MOVESIZE, hwnd,
+	RECT16* pr = SEGPTR_NEW(RECT16);
+	if( pr )
+	{
+            CONV_RECT32TO16( &sizingRect, pr );
+	    if( HOOK_CallHooks16( WH_CBT, HCBT_MOVESIZE, hwnd,
 			        (LPARAM)SEGPTR_GET(pr)) )
-	      sizingRect = wndPtr->rectWindow;
-	  else
-	      CONV_RECT16TO32( pr, &sizingRect );
-	  SEGPTR_FREE(pr);
-       }
+		sizingRect = wndPtr->rectWindow;
+	    else
+		CONV_RECT16TO32( pr, &sizingRect );
+	    SEGPTR_FREE(pr);
+	}
     }
     SendMessage16( hwnd, WM_EXITSIZEMOVE, 0, 0 );
     SendMessage16( hwnd, WM_SETVISIBLE, !IsIconic16(hwnd), 0L);
 
-    /* Single click brings up the system menu when iconized */
-
-    if( moved )
+    if( moved && !((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) )
     {
-	if ((msg.message == WM_KEYDOWN) && (msg.wParam == VK_ESCAPE)) return;
-
 	/* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */
 	SetWindowPos32( hwnd, 0, sizingRect.left, sizingRect.top,
 			sizingRect.right - sizingRect.left,
 			sizingRect.bottom - sizingRect.top,
 		      ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
     }
-    if( wndPtr->dwStyle & WS_MINIMIZE )
-    {
-	WINPOS_ShowIconTitle( wndPtr, TRUE );
-	if (!moved && (wndPtr->dwStyle & WS_SYSMENU))
-            SendMessage16( hwnd, WM_SYSCOMMAND, SC_MOUSEMENU + HTSYSMENU,
-                           MAKELPARAM( pt.x, pt.y ) );
-    }
+
+    if( IsWindow32(hwnd) )
+	if( wndPtr->dwStyle & WS_MINIMIZE )
+	{
+	    /* Single click brings up the system menu when iconized */
+
+	    if( !moved ) 
+	    {
+		 if( wndPtr->dwStyle & WS_SYSMENU ) 
+		     SendMessage16( hwnd, WM_SYSCOMMAND,
+				    SC_MOUSEMENU + HTSYSMENU, *((LPARAM*)&pt));
+	    }
+	    else WINPOS_ShowIconTitle( wndPtr, TRUE );
+	}
 }
 
 
@@ -1663,18 +1657,15 @@
     MSG16 msg;
     HDC32 hdc = GetWindowDC32( hwnd );
     BOOL32 pressed = TRUE;
+    void  (*paintButton)(HWND32, HDC16, BOOL32);
 
     SetCapture32( hwnd );
     if (wParam == HTMINBUTTON)
-	if(TWEAK_Win95Look)
-	    NC_DrawMinButton95( hwnd, hdc, TRUE );
-	else
-	    NC_DrawMinButton( hwnd, hdc, TRUE );
+	paintButton = (TWEAK_Win95Look) ? &NC_DrawMinButton95 : &NC_DrawMinButton;
     else
-	if(TWEAK_Win95Look)
-	    NC_DrawMaxButton95( hwnd, hdc, TRUE );
-	else
-	    NC_DrawMaxButton( hwnd, hdc, TRUE );
+	paintButton = (TWEAK_Win95Look) ? &NC_DrawMaxButton95 : &NC_DrawMaxButton;
+
+    (*paintButton)( hwnd, hdc, TRUE );
 
     do
     {
@@ -1683,30 +1674,10 @@
 
 	pressed = (NC_HandleNCHitTest( hwnd, msg.pt ) == wParam);
 	if (pressed != oldstate)
-	{
-	    if (wParam == HTMINBUTTON)
-		if(TWEAK_Win95Look)
-		    NC_DrawMinButton95( hwnd, hdc, pressed );
-		else
-		    NC_DrawMinButton( hwnd, hdc, pressed );
-	    else
-		if(TWEAK_Win95Look)
-		    NC_DrawMaxButton95( hwnd, hdc, pressed );
-		else
-		    NC_DrawMaxButton( hwnd, hdc, pressed );
-	}
+	   (*paintButton)( hwnd, hdc, pressed );
     } while (msg.message != WM_LBUTTONUP);
 
-    if (wParam == HTMINBUTTON)
-	if(TWEAK_Win95Look)
-	    NC_DrawMinButton95( hwnd, hdc, FALSE );
-	else
-	    NC_DrawMinButton( hwnd, hdc, FALSE );
-    else
-	if(TWEAK_Win95Look)
-	    NC_DrawMaxButton95( hwnd, hdc, FALSE );
-	else
-	    NC_DrawMaxButton( hwnd, hdc, FALSE );
+    (*paintButton)( hwnd, hdc, FALSE );
 
     ReleaseCapture();
     ReleaseDC32( hwnd, hdc );
@@ -1781,20 +1752,34 @@
  *
  * Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc().
  */
-LONG NC_HandleNCLButtonDown( HWND32 hwnd, WPARAM16 wParam, LPARAM lParam )
+LONG NC_HandleNCLButtonDown( WND* pWnd, WPARAM16 wParam, LPARAM lParam )
 {
+    HWND32 hwnd = pWnd->hwndSelf;
+
     switch(wParam)  /* Hit test */
     {
     case HTCAPTION:
+	 hwnd = WIN_GetTopParent(hwnd);
 
-	if( WINPOS_SetActiveWindow(WIN_GetTopParent(hwnd), TRUE, TRUE)
-	    || (GetActiveWindow32() == WIN_GetTopParent(hwnd)) )
-		SendMessage16( hwnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, lParam );
-	break;
+	 if( WINPOS_SetActiveWindow(hwnd, TRUE, TRUE) || (GetActiveWindow32() == hwnd) )
+		SendMessage16( pWnd->hwndSelf, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, lParam );
+	 break;
 
     case HTSYSMENU:
-	SendMessage16( hwnd, WM_SYSCOMMAND, SC_MOUSEMENU + HTSYSMENU, lParam );
-	break;
+	 if( pWnd->dwStyle & WS_SYSMENU )
+	 {
+	     if( !(pWnd->dwStyle & WS_MINIMIZE) )
+	     {
+		HDC32 hDC = GetWindowDC32(hwnd);
+		if( TWEAK_Win95Look)
+		    NC_DrawSysButton95( hwnd, hDC, TRUE );
+		else
+		    NC_DrawSysButton( hwnd, hDC, TRUE );
+		ReleaseDC32( hwnd, hDC );
+	     }
+	     SendMessage16( hwnd, WM_SYSCOMMAND, SC_MOUSEMENU + HTSYSMENU, lParam );
+	 }
+	 break;
 
     case HTMENU:
 	SendMessage16( hwnd, WM_SYSCOMMAND, SC_MOUSEMENU, lParam );
@@ -1866,12 +1851,12 @@
 
     case HTHSCROLL:
 	SendMessage16( pWnd->hwndSelf, WM_SYSCOMMAND, SC_HSCROLL + HTHSCROLL,
-            lParam );
+		       lParam );
 	break;
 
     case HTVSCROLL:
 	SendMessage16( pWnd->hwndSelf, WM_SYSCOMMAND, SC_VSCROLL + HTVSCROLL,
-            lParam );
+		       lParam );
 	break;
     }
     return 0;
@@ -1938,10 +1923,7 @@
 
     case SC_SCREENSAVE:
 	if (wParam == SC_ABOUTWINE)
-	{   
-            extern const char people[];
-            ShellAbout32A(hwnd,"Wine",people,0);
-        }
+            ShellAbout32A(hwnd,"Wine", WINE_RELEASE_INFO, 0);
 	break;
   
     case SC_HOTKEY: