Release 960824

Sat Aug 24 13:57:01 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [controls/scroll.c]
	Renamed SCROLLINFO to SCROLLBAR_INFO to avoid conflict with Win32.

	* [graphics/driver.c] [include/x11drv.h]
	New files for graphics driver handling.

	* [if1632/relay.c] [include/registers.h] [tools/build.c]
	Implemented Win32 register functions. Not really tested yet.

	* [include/gdi.h]
	Added a lot of functions to the DC func table.

	* [loader/pe_image.c]
	Initialise %fs before calling out to 32-bit code.

	* [windows/hook.c]
	Fixed bug in HOOK_GetHook().

	* [windows/win.c]
	Fixed FindWindow to return an error if the class name doesn't exist.

Wed Aug 21 15:15:53 1996  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [if1632/Makefile.in] [misc/mpr.c] [if1632/mpr.spec]
	mpr.dll specs added.

	* [if1632/kernel32.spec] [win32/newfns.c] [memory/global.c]
	QueryPerformanceCounter(), GlobalMemoryStatus() added.

	* [if1632/user32.spec] [win32/error.c]
	SetLastErrorEx() added.

	* [misc/commdlg.c]
	lpstrFilter might be NULL in FILE_WMInitDialog (NS 3.0 setup).

	* [misc/registry.c]
	Some missing NULL ptr checks added, misc clean up.

Tue Aug 20 21:00:00 1996 Alex Korobka  <alex@pharm.sunysb.edu>

	* [controls/menu.c]
	Adjust popup menu coordinates so that it always stays within 
	the desktop.

	* [misc/main.c]
	Fixed GetEnvironment() return value for lpEnv == NULL case.

Mon Aug 19 22:48:36 1996  Jukka Iivonen <iivonen@cc.helsinki.fi>

	* [misc/crtdll.c] [if1632/crtdll.spec]
	Added some is* functions, strlen and tolower.
	
Mon Aug 19 13:33:13 1996  Stephen Simmons  <ssimmons@vitsemi.com>

	* [tools/wineconf]
	New perl script to generate the wine.conf file.

Fri Aug 16 15:31:44 1996   John Harvey <john@division.co.uk>

	* [if1632/gdi.spec]
        Lots of printer functions.
	
	* [include/callback.h]
        New functions for printer driver support.

	* [include/gdi.h]
        New/changed structures to support printer driver.

	* [misc/escape.c]
        New version that uses function table in DC structure.

	* [objects/dc.c]
        CreateDC copes with things other than Display.
	X code for CreateDC moved to graphics/x11drv directory.
	CreateCompatibleDC copies func table from original DC.

	* [objects/font.c]
        GetTextExtentPoint32A,GetTextMetrics16 use function table in
        DC and code moved to drivers directory.

	* [misc/printdrv.c] [graphics/*/*] [include/win16drv.h]
        New files for printer support. 

Fri Aug 16 12:33:00 1996  Bruce Milner <Bruce.Milner@genetics.utah.edu>

	* [controls/scroll.c]
	Added SetScrollInfo32 and GetScrollInfo32.  These just call existing
	code. There are a few options in which I'm probably the wrong person
	for the job (page size and disable bar). There are comments in the
	code as to what they should do.

	* [objects/gdiobj.c] [objects/font.c] [include/font.h]
	Added 32 bit version of FONT_GetObject.
diff --git a/objects/dc.c b/objects/dc.c
index 58529ac..f8d552f 100644
--- a/objects/dc.c
+++ b/objects/dc.c
@@ -17,8 +17,6 @@
 #include "callback.h"
 #include "xmalloc.h"
 
-static DeviceCaps * displayDevCaps = NULL;
-
 extern void CLIPPING_UpdateGCRegion( DC * dc );     /* objects/clipping.c */
 extern BOOL DCHook( HDC, WORD, DWORD, DWORD );      /* windows/dce.c */
 
@@ -158,8 +156,6 @@
     SelectObject( dc->hSelf, dc->w.hPen );
     SelectObject( dc->hSelf, dc->w.hBrush );
     SelectObject( dc->hSelf, dc->w.hFont );
-    XSetGraphicsExposures( display, dc->u.x.gc, False );
-    XSetSubwindowMode( display, dc->u.x.gc, IncludeInferiors );
     CLIPPING_UpdateGCRegion( dc );
 }
 
@@ -491,8 +487,11 @@
 HDC CreateDC( LPCSTR driver, LPCSTR device, LPCSTR output, const DEVMODE* initData )
 {
     DC * dc;
-    HANDLE handle;
-    
+    HDC16 handle;
+    const DC_FUNCTIONS *funcs;
+
+    if (!(funcs = DRIVER_FindDriver( driver ))) return 0;
+
     handle = GDI_AllocObject( sizeof(DC), DC_MAGIC );
     if (!handle) return 0;
     dc = (DC *) GDI_HEAP_LIN_ADDR( handle );
@@ -500,29 +499,20 @@
     dprintf_dc(stddeb, "CreateDC(%s %s %s): returning %04x\n",
 	    driver, device, output, handle );
 
-    if (!displayDevCaps)
-    {
-	displayDevCaps = (DeviceCaps *) xmalloc( sizeof(DeviceCaps) );
-	DC_FillDevCaps( displayDevCaps );
-    }
-
-    dc->hSelf = (HDC)handle;
-    dc->saveLevel = 0;
+    dc->hSelf      = handle;
+    dc->funcs      = funcs;
+    dc->physDev    = NULL;
+    dc->saveLevel  = 0;
     dc->dwHookData = 0L;
-    dc->hookProc = (SEGPTR)NULL;
+    dc->hookProc   = (SEGPTR)0;
 
     memcpy( &dc->w, &DC_defaultValues, sizeof(DC_defaultValues) );
-    memset( &dc->u.x, 0, sizeof(dc->u.x) );
+    dc->w.flags = 0;
 
-    dc->u.x.drawable   = rootWindow;
-    dc->u.x.gc         = XCreateGC( display, dc->u.x.drawable, 0, NULL );
-    dc->w.flags        = 0;
-    dc->w.devCaps      = displayDevCaps;
-    dc->w.bitsPerPixel = displayDevCaps->bitsPixel;
-    dc->w.hVisRgn      = CreateRectRgn( 0, 0, displayDevCaps->horzRes,
-                                        displayDevCaps->vertRes );
-    if (!dc->w.hVisRgn)
+    if (dc->funcs->pCreateDC &&
+        !dc->funcs->pCreateDC( dc, driver, device, output, initData ))
     {
+        dprintf_dc( stddeb, "CreateDC: creation aborted by device\n" );
         GDI_HEAP_FREE( handle );
         return 0;
     }
@@ -548,10 +538,14 @@
  */
 HDC CreateCompatibleDC( HDC hdc )
 {
-    DC * dc;
-    HANDLE handle;
+    DC *dc, *origDC;
+    HDC16 handle;
     HBITMAP hbitmap;
-    BITMAPOBJ *bmp;
+    const DC_FUNCTIONS *funcs;
+
+    if ((origDC = (DC *)GDI_GetObjPtr( hdc, DC_MAGIC ))) funcs = origDC->funcs;
+    else funcs = DRIVER_FindDriver( "DISPLAY" );
+    if (!funcs) return 0;
 
     handle = GDI_AllocObject( sizeof(DC), DC_MAGIC );
     if (!handle) return 0;
@@ -565,34 +559,29 @@
 	GDI_HEAP_FREE( handle );
 	return 0;
     }
-    bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
-
-    dc->hSelf = (HDC)handle;    
-    dc->saveLevel = 0;
-    dc->dwHookData = 0L; 
-    dc->hookProc = (SEGPTR)NULL;
 
     memcpy( &dc->w, &DC_defaultValues, sizeof(DC_defaultValues) );
-    memset( &dc->u.x, 0, sizeof(dc->u.x) );
 
-    dc->u.x.drawable   = bmp->pixmap;
-    dc->u.x.gc         = XCreateGC( display, dc->u.x.drawable, 0, NULL );
+    dc->hSelf          = handle;
+    dc->funcs          = funcs;
+    dc->physDev        = NULL;
+    dc->saveLevel      = 0;
+    dc->dwHookData     = 0L;
+    dc->hookProc       = (SEGPTR)0;
     dc->w.flags        = DC_MEMORY;
     dc->w.bitsPerPixel = 1;
-    dc->w.devCaps      = displayDevCaps;
     dc->w.hBitmap      = hbitmap;
     dc->w.hFirstBitmap = hbitmap;
-    dc->w.hVisRgn      = CreateRectRgn( 0, 0, 1, 1 );
 
-    if (!dc->w.hVisRgn)
+    if (dc->funcs->pCreateDC &&
+        !dc->funcs->pCreateDC( dc, NULL, NULL, NULL, NULL ))
     {
+        dprintf_dc( stddeb, "CreateDC: creation aborted by device\n" );
         DeleteObject( hbitmap );
         GDI_HEAP_FREE( handle );
         return 0;
     }
 
-    DC_InitDC( dc );
-
     return handle;
 }
 
@@ -622,8 +611,8 @@
 	SelectObject( hdc, STOCK_BLACK_PEN );
 	SelectObject( hdc, STOCK_WHITE_BRUSH );
 	SelectObject( hdc, STOCK_SYSTEM_FONT );
-	XFreeGC( display, dc->u.x.gc );
         if (dc->w.flags & DC_MEMORY) DeleteObject( dc->w.hFirstBitmap );
+        if (dc->funcs->pDeleteDC) dc->funcs->pDeleteDC(dc);
     }
 
     if (dc->w.hClipRgn) DeleteObject( dc->w.hClipRgn );