Release 961201

Sat Nov 30 19:21:17 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [configure]
	Re-generated with autoconf 2.11. Let me know if you have
	problems.

	* [controls/listbox.c] [controls/oldlbox.c]
	Listboxes rewritten from scratch. Moved old code still used by
	comboboxes to oldlbox.c

	* [misc/registry.c]
	Use temporary file when saving registry.

	* [windows/dialog.c]
	Implemented Win32 version of DlgDirList() and DlgDirListComboBox().

	* [windows/winproc.c]
	Added translation for listbox Win32 messages.

Sat Nov 30 21:00:00 Alex Korobka <alex@trantor.pharm.sunysb.edu>

	* [controls/widgets.c] [controls/button.c]
	Fixed some incompatibilities with CTL3D DLL.

	* [windows/dialog.c]
	Made dialog windows fit into the desktop.

	* [misc/winsock.c] [misc/winsock_async.c]
	New Winsock engine.

	* [windows/message.c]
	GetMessage() fixes.

	* [windows/queue.c] [windows/hook.c] [windows/win.c]
	SetMessageQueue() fixes.

Fri Nov 29 10:25:12 1996  Slaven Rezic  <eserte@cs.tu-berlin.de>

	* [objects/text.c]
	DrawText16(): Fixed return value.

Tue Nov 26 14:47:09 1996  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [files/profile.c] [*/*]
	Added Win32 profile functions, updated to new naming standard.

	* [objects/font.c] [if1632/thunk.c] [include/windows.h]
	Added EnumFonts32*, EnumFontFamiliesEx*, changed prototypes and
	structures.

	* [misc/ole2nls.c] [if1632/thunk.c]
	Added EnumSystemLocales() (winhelp.exe).

	* [misc/registry.c]
	Added Windows 3.1 registry loader supplied by Tor Sjxwall, tor@sn.no

	* [win32/file.c]
	Partially fixed CreateFileMapping(), added UnmapViewOfFile().

Sat Nov 23 23:36:05 1996  Ronan Waide  <waider@waider.ie>

	* [misc/shell.c]
	Fixed some FIXMEs relating to ShellExec() and FindExecutable().

	* [misc/main.c]
	Implemented a few more of the SystemParametersInfo() cases.

Tue Nov 19 01:24:34 1996  Philippe De Muyter  <phdm@info.ucl.ac.be>

	* [include/keyboard.h]
	New file, new macro WINE_VKEY_MAPPINGS (using code taken from event.c).

	* [include/windows.h]
	New [VK_A, VK_Z] and [VK_0, VK9] macros.

	* [misc/keyboard.c]
	Fixes in KeyTable and ToAscii.

	* [objects/font.c]
	FONT_init : Give default value for MSWIN "system" font.
	FONT_MatchFont : Do not try every size of a font family if the
	family does not exist.

	* [windows/event.c]
	lastEventChar hack removed.
	KeyStateTable replaced by InputKeyStateTable (maintained in event.c)
	and QueueKeyStateTable (maintained in message.c).
	EVENT_key : Corrections to the extended bit setting.

	* [windows/message.c] [windows/keyboard.c]
	Implementation of a new QueueKeyStateTable : table of key states
	valid when messages are retrieved by GetMessage or PeekMessage,
	and valid for TranslateMessage.
	TranslateMessage : Convert WM*KEY messages using QueueKeyStateTable
	and ToAscii.
	
Mon Nov 18 16:59:01 1996  Robert Pouliot <krynos@clic.net>

	* [graphics/Makefile.in] [graphics/wing.c]
	  [if1632/wing.spec]
	Some functions for WinG support, mostly empty stubs.

	* [misc/crtdll.c] [if1632/crtdll.spec]
	Many functions added to CRTDLL, mostly calls to Unix C library.
diff --git a/controls/button.c b/controls/button.c
index 3367a66..1c4df7e 100644
--- a/controls/button.c
+++ b/controls/button.c
@@ -187,7 +187,8 @@
 
     case WM_KILLFOCUS:
         infoPtr->state &= ~BUTTON_HASFOCUS;
-        PAINT_BUTTON( wndPtr, style, ODA_FOCUS );
+	PAINT_BUTTON( wndPtr, style, ODA_FOCUS );
+	InvalidateRect16( hWnd, NULL, TRUE );
         break;
 
     case WM_SYSCOLORCHANGE:
@@ -369,57 +370,70 @@
 
 static void CB_Paint( WND *wndPtr, HDC32 hDC, WORD action )
 {
-    RECT16 rc;
+    RECT16 rbox, rtext, client;
     HBRUSH16 hBrush;
-    int textlen, delta, x, y;
-    TEXTMETRIC16 tm;
+    int textlen, delta;
     BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
 
-    GetClientRect16(wndPtr->hwndSelf, &rc);
+    textlen = 0;
+    GetClientRect16(wndPtr->hwndSelf, &client);
+    rbox = rtext = client;
 
     if (infoPtr->hFont) SelectObject32( hDC, infoPtr->hFont );
     hBrush = BUTTON_SEND_CTLCOLOR( wndPtr, hDC );
-    if (action == ODA_DRAWENTIRE) FillRect16( hDC, &rc, hBrush );
+    if (wndPtr->dwStyle & BS_LEFTTEXT) 
+    {
+	/* magic +4 is what CTL3D expects */
 
-    GetTextMetrics16(hDC, &tm);
-    delta = (rc.bottom - rc.top - tm.tmHeight) >> 1;
+        rtext.right -= checkBoxWidth + 4;
+        rbox.left = rbox.right - checkBoxWidth;
+    }
+    else 
+    {
+        rtext.left += checkBoxWidth + 4;
+        rbox.right = checkBoxWidth;
+    }
 
       /* Draw the check-box bitmap */
-    x = y = 0;
-    if (infoPtr->state & BUTTON_HIGHLIGHTED) x += 2 * checkBoxWidth;
-    if (infoPtr->state & (BUTTON_CHECKED | BUTTON_3STATE)) x += checkBoxWidth;
-    if (((wndPtr->dwStyle & 0x0f) == BS_RADIOBUTTON) ||
-        ((wndPtr->dwStyle & 0x0f) == BS_AUTORADIOBUTTON)) y += checkBoxHeight;
-    else if (infoPtr->state & BUTTON_3STATE) y += 2 * checkBoxHeight;
-    GRAPH_DrawBitmap( hDC, hbitmapCheckBoxes, rc.left, rc.top + delta,
-                      x, y, checkBoxWidth, checkBoxHeight );
-    rc.left += checkBoxWidth + tm.tmAveCharWidth / 2;
 
-    if (!wndPtr->text) return;
-    textlen = strlen( wndPtr->text );
+    if (wndPtr->text) textlen = strlen( wndPtr->text );
+    if (action == ODA_DRAWENTIRE || action == ODA_SELECT)
+    { 
+        int x = 0, y = 0;
+        delta = (rbox.bottom - rbox.top - checkBoxHeight) >> 1;
 
-    if (action == ODA_DRAWENTIRE)
-    {
-        if (wndPtr->dwStyle & WS_DISABLED)
-            SetTextColor( hDC, GetSysColor(COLOR_GRAYTEXT) );
-        DrawText16( hDC, wndPtr->text, textlen, &rc,
-                    DT_SINGLELINE | DT_VCENTER | DT_NOCLIP );
+        if (action == ODA_SELECT) FillRect16( hDC, &rbox, hBrush );
+        else FillRect16( hDC, &client, hBrush );
+
+        if (infoPtr->state & BUTTON_HIGHLIGHTED) x += 2 * checkBoxWidth;
+        if (infoPtr->state & (BUTTON_CHECKED | BUTTON_3STATE)) x += checkBoxWidth;
+        if (((wndPtr->dwStyle & 0x0f) == BS_RADIOBUTTON) ||
+            ((wndPtr->dwStyle & 0x0f) == BS_AUTORADIOBUTTON)) y += checkBoxHeight;
+        else if (infoPtr->state & BUTTON_3STATE) y += 2 * checkBoxHeight;
+
+        GRAPH_DrawBitmap( hDC, hbitmapCheckBoxes, rbox.left, rbox.top + delta,
+                          x, y, checkBoxWidth, checkBoxHeight );
+        if( textlen && action != ODA_SELECT )
+        {
+            if (wndPtr->dwStyle & WS_DISABLED)
+                SetTextColor( hDC, GetSysColor(COLOR_GRAYTEXT) );
+            DrawText16( hDC, wndPtr->text, textlen, &rtext,
+                        DT_SINGLELINE | DT_VCENTER );
+        }
     }
-    
+
     if ((action == ODA_FOCUS) ||
         ((action == ODA_DRAWENTIRE) && (infoPtr->state & BUTTON_HASFOCUS)))
     {
-        RECT16 rect = { 0, 0, 0, 0 };
-        DrawText16( hDC, wndPtr->text, textlen, &rect,
-                    DT_SINGLELINE | DT_CALCRECT );
-        if (delta > 1)
-        {
-            rc.top += delta - 1;
-            rc.bottom -= delta + 1;
-        }
-        rc.left--;
-        rc.right = rc.left + rect.right + 2;
-        DrawFocusRect16( hDC, &rc );
+	/* again, this is what CTL3D expects */
+
+        DWORD tm = (textlen) ? GetTextExtent( hDC, wndPtr->text, textlen) : 0x00020002;
+        delta = (rtext.bottom - rtext.top - HIWORD(tm) - 1)/2;
+
+        rbox.bottom = (rbox.top = rtext.top + delta - 1) + HIWORD(tm) + 2;
+        rbox.right = (rbox.left = --rtext.left) + LOWORD(tm) + 2;
+        IntersectRect16(&rbox, &rbox, &rtext);
+        DrawFocusRect16( hDC, &rbox );
     }
 }