Release 950918

Sun Sep 17 16:47:49 1995  Alexandre Julliard  <julliard@sunsite.unc.edu>

	* [configure.in] [*/Makefile.in] [Make.rules.in]
	Cleaned up makefiles, added configuration option for Winelib,
	grouped common make rules in Make.rules.in.

	* [Configure]
	Renamed to 'Configure.old'; please use 'configure' instead.

	* [controls/menu.c]
	Fixed DestroyMenu() to avoid deleting the same menu twice.
	More fixes to WM_MENUSELECT, and added WM_INITMENU.

	* [if1632/relay.c]
	Fixed wrong register values displayed by RELAY_DebugCall32().

	* [memory/local.c]
	Fixed LocalLock() and LocalUnlock() to increment/decrement the
	lock count for moveable blocks.

	* [misc/commdlg.c] [misc/shell.c] [rc/winerc.c]
	Modified the generated C file so that the resource information
	(size, etc.) is also exported.
	Modified common dialogs to use the new informations.

	* [misc/main.c] [ANNOUNCE]
	Update the list of contributors. Please let me know if I forgot
	someone.

	* [rc/sysres.rc] [rc/sysres_En.rc]
	Moved English resources to sysres_En.rc.
	Changed ids from numeric to symbolic for dialogs.

	* [windows/dialog.c]
	Modified template parsing to be able to pass segmented pointers to
	CreateWindow().

	* [windows/win.c]
	CreateWindow() now takes segmented pointers for class and window
	names.
	Maxmimize or minimize the window upon creation if the WS_MAXIMIZE
	or WS_MINIMIZE bits are set.

Thu Sep 14 17:19:57 1995  Paul Wilhelm  <paul@paul.accessone.com>

	* [controls/scroll.c]
	Fixed scroll-bar bugs for non-client windows.

Thu Sep 14 14:04:14 MET DST 1995 Jochen Hoenicke <Jochen.Hoenicke@arbi.Informatik.Uni-Oldenburg.de>

	* [include/cursor.h] [windows/cursor.c]
	Cursor is not mirrored any more and the hotspot is set right.

Wed Sep 13 14:22:31 1995  Marcus Meissner  <msmeissn@faui01.informatik.uni-erlangen.de>

	* [ole.h]
	Misc small fixes.

Mon Sep  4 00:01:23 1995  Jon Tombs <jon@gte.esi.us.es>

	* [rc/sysres_Es.rc]
	First attempt at Spanish [Es] language support.

Sun Sep  3 13:22:33 1995     Martin von Loewis <loewis@informatik.hu-berlin.de>

	* [include/alias.h][windows/alias.c][include/relay32.h]
	New files

	* [controls/widgets.c]
	WIDGETS_Init: register alias window procedures

	* [if1632/callback.c]
	CallWndProc: Call alias functions if necessary

	* [if1632/gdi32.spec]
	GetStockObject, TextOutA: new relays

	* [misc/user32.c][if1632/user32.spec][misc/Makefile.in][misc/Imakefile]
	user32.c: new file
	BeginPaint,CreateWindowExA,DefWindowProcA,DispatchMessage,EndPaint,
	GetMessageA,RegisterClassA,ShowWindow,UpdateWindow: new relays

	* [if1632/winprocs32.spec][loader/pe_image.c][loader/module.c]
	PE_Win32CallToStart: new function
	MODULE_CreateInstance: removed static attribute
	LoadModule: Try loading PE image on error 21
	PE_LoadModule: new function
	PE_LoadImage: initialize pe_data with 0
	
	* [include/dlls.h][include/peexe.h]
	moved pe_data and w_files to peexe.h
	
	* [misc/shell.c]
	ShellAbout: Register AboutWndProc aliases

	* [miscemu/int21.c]
	handle 0x440A and 0xDC

	* [miscemu/int2f.c]
	handle 0x84

	* [objects/dib.c]
	CreateDIBitmap: complain if BITMAPINFOHEADER is of wrong size

	* [tools/build.c]
	include windows.h and relay32.h into generated Win32 relays,
	don't declare the implementation as int (*)();
	limit in WIN32_builtin was off by one

	* [windows/caret.c]
	CARET_Initialize: new function, call on strategic places

	* [windows/messagebox.c]
	MessageBox: register message box proc aliases

	* [if1632/advapi32.spec][if1632/comdlg32.spec]
	New files

	* [if1632/Makefile.in][if1632/Imakefile][if1632/relay32.c]
	added new spec files
	RELAY32_GetBuiltinDLL: perform lookup case insensitive
	RELAY32_GetEntryPoint: start name search at 0

	* [if1632/user.spec][if1632/kernel.spec][if1632/gdi.spec]
	Added stubs for new Win95 API

Sat Sep 2 1995  Martin Roy

	* [misc/commdlg.c]
	In WM_INITDIALOG, current filter must reflect lpofn->nFilterIndex.
  	When process IDOK button in FILEDLG_WMCommand(),
 	lpofn->nFilterIndex should be updated to current selection.

Thu Aug 31 15:00:00 1995 Ram'on Garc'ia <ramon@ie3.clubs.etsit.upm.es>

	* [loader/module.c] [loader/ne_image.c]
	Added support of self-loading modules.
diff --git a/windows/win.c b/windows/win.c
index 5874ecb..d7e2d2d 100644
--- a/windows/win.c
+++ b/windows/win.c
@@ -279,7 +279,7 @@
 /***********************************************************************
  *           CreateWindow   (USER.41)
  */
-HWND CreateWindow( LPSTR className, LPSTR windowName,
+HWND CreateWindow( SEGPTR className, SEGPTR windowName,
 		   DWORD style, short x, short y, short width, short height,
 		   HWND parent, HMENU menu, HANDLE instance, SEGPTR data ) 
 {
@@ -291,7 +291,7 @@
 /***********************************************************************
  *           CreateWindowEx   (USER.452)
  */
-HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
+HWND CreateWindowEx( DWORD exStyle, SEGPTR className, SEGPTR windowName,
 		     DWORD style, short x, short y, short width, short height,
 		     HWND parent, HMENU menu, HANDLE instance, SEGPTR data ) 
 {
@@ -300,31 +300,25 @@
     WND *wndPtr;
     POINT maxSize, maxPos, minTrack, maxTrack;
     CREATESTRUCT createStruct;
-    HANDLE hwinName, hclassName;
     int wmcreate;
     XSetWindowAttributes win_attr;
 
     /* FIXME: windowName and className should be SEGPTRs */
 
+    dprintf_win( stddeb, "CreateWindowEx: " );
     if (HIWORD(windowName))
-	dprintf_win( stddeb, "CreateWindowEx: '%s' ", windowName );
+	dprintf_win( stddeb, "'%s' ", (char *)PTR_SEG_TO_LIN(windowName) );
     else
-	dprintf_win( stddeb, "CreateWindowEx: %04x ", LOWORD(windowName) );
+	dprintf_win( stddeb, "%04x ", LOWORD(windowName) );
     if (HIWORD(className))
-        dprintf_win( stddeb, "'%s' ", className );
+        dprintf_win( stddeb, "'%s' ", (char *)PTR_SEG_TO_LIN(className) );
     else
         dprintf_win( stddeb, "%04x ", LOWORD(className) );
 
     dprintf_win(stddeb, "%08lx %08lx %d,%d %dx%d %04x %04x %04x %08lx\n",
 		exStyle, style, x, y, width, height,
 		parent, menu, instance, data);
-    /* 'soundrec.exe' has negative position ! 
-       Why ? For now, here a patch : */
-    if (HIWORD(className) && !strcmp(className, "SoundRec"))
-    {
-	if (x < 0) x = 0;
-	if (y < 0) y = 0;
-    }
+
     if (x == CW_USEDEFAULT) x = y = 0;
     if (width == CW_USEDEFAULT)
     {
@@ -350,15 +344,14 @@
 	}
     }
 
+    if (!(class = CLASS_FindClassByName( className, GetExePtr(instance),
+                                         &classPtr )))
     {
-        /* FIXME!! */
-        char buff[256];
-        if (HIWORD(className)) strcpy( buff, className );
-        if (!(class = CLASS_FindClassByName( HIWORD(className) ? MAKE_SEGPTR(buff) : (SEGPTR)className,
-                                         GetExePtr( instance ), &classPtr ))) {
-            fprintf(stderr,"CreateWindow BAD CLASSNAME '%s' !\n", className);
-            return 0;
-        }
+        fprintf(stderr,"CreateWindow BAD CLASSNAME " );
+        if (HIWORD(className)) fprintf( stderr, "'%s'\n", 
+                                        (char *)PTR_SEG_TO_LIN(className) );
+        else fprintf( stderr, "%04x\n", LOWORD(className) );
+        return 0;
     }
 
       /* Correct the window style */
@@ -395,7 +388,7 @@
     wndPtr->hwndPrevActive = 0;
     wndPtr->hwndLastActive = hwnd;
     wndPtr->lpfnWndProc    = classPtr->wc.lpfnWndProc;
-    wndPtr->dwStyle        = style;
+    wndPtr->dwStyle        = style & ~WS_VISIBLE;
     wndPtr->dwExStyle      = exStyle;
     wndPtr->wIDmenu        = 0;
     wndPtr->hText          = 0;
@@ -462,7 +455,7 @@
                                         CWEventMask | CWOverrideRedirect |
                                         CWColormap | CWCursor | CWSaveUnder |
                                         CWBackingStore, &win_attr );
-        XStoreName( display, wndPtr->window, windowName );
+        XStoreName( display, wndPtr->window, PTR_SEG_TO_LIN(windowName) );
         EVENT_RegisterWindow( wndPtr->window, hwnd );
         GlobalUnlock( hCursor );
     }
@@ -486,33 +479,13 @@
     createStruct.x              = x;
     createStruct.y              = y;
     createStruct.style          = style;
+    createStruct.lpszName       = windowName;
+    createStruct.lpszClass      = className;
     createStruct.dwExStyle      = 0;
-    if (HIWORD(className))
-    {
-        hclassName = USER_HEAP_ALLOC( strlen(className)+1 );
-        strcpy( USER_HEAP_LIN_ADDR(hclassName), className );
-        createStruct.lpszClass = (LPSTR)USER_HEAP_SEG_ADDR(hclassName);
-    }
-    else
-    {
-        hclassName = 0;
-        createStruct.lpszClass = className;
-    }
-
-    if (HIWORD(windowName))
-    {
-        hwinName = USER_HEAP_ALLOC( strlen(windowName)+1 );
-        strcpy( USER_HEAP_LIN_ADDR(hwinName), windowName );
-        createStruct.lpszName = (LPSTR)USER_HEAP_SEG_ADDR(hwinName);
-    }
-    else
-    {
-        hwinName = 0;
-        createStruct.lpszName = windowName;
-    }
 
     wmcreate = SendMessage( hwnd, WM_NCCREATE, 0, MAKE_SEGPTR(&createStruct) );
-    if (!wmcreate) {
+    if (!wmcreate)
+    {
 	dprintf_win(stddeb,"CreateWindowEx: WM_NCCREATE return 0\n");
 	wmcreate = -1;
     }
@@ -523,9 +496,6 @@
 	wmcreate = SendMessage(hwnd, WM_CREATE, 0, MAKE_SEGPTR(&createStruct));
     }
 
-    if (hclassName) USER_HEAP_FREE( hclassName );
-    if (hwinName) USER_HEAP_FREE( hwinName );
-
     if (wmcreate == -1)
     {
 	  /* Abort window creation */
@@ -538,9 +508,25 @@
     if (style & WS_SYSMENU) wndPtr->hSysMenu = CopySysMenu();
 
     WIN_SendParentNotify( hwnd, WM_CREATE, MAKELONG( hwnd, wndPtr->wIDmenu ) );
-    
-    if (style & WS_VISIBLE) ShowWindow( hwnd, SW_SHOW );
-/*    if (style & WS_MINIMIZE) ShowWindow( hwnd, SW_MINIMIZE ); */
+
+    /* Show the window, maximizing or minimizing if needed */
+
+    if (wndPtr->dwStyle & WS_MINIMIZE)
+    {
+        wndPtr->dwStyle &= ~WS_MAXIMIZE;
+        WINPOS_FindIconPos( hwnd );
+        SetWindowPos( hwnd, 0, wndPtr->ptIconPos.x, wndPtr->ptIconPos.y,
+                      SYSMETRICS_CXICON, SYSMETRICS_CYICON,
+                      SWP_FRAMECHANGED |
+                      (style & WS_VISIBLE) ? SWP_SHOWWINDOW : 0 );
+    }
+    else if (wndPtr->dwStyle & WS_MAXIMIZE)
+    {
+        SetWindowPos( hwnd, 0, maxPos.x, maxPos.y, maxSize.x, maxSize.y,
+                      SWP_FRAMECHANGED |
+                      (style & WS_VISIBLE) ? SWP_SHOWWINDOW : 0 );
+    }
+    else if (style & WS_VISIBLE) ShowWindow( hwnd, SW_SHOW );
 
     dprintf_win(stddeb, "CreateWindowEx: return %04X \n", hwnd);
     return hwnd;