Merged clipboard driver into USER driver.
Moved all ttydrv source files to dlls/ttydrv.
Load functions pointer for the USER driver from the graphics driver
dll with GetProcAddress.

diff --git a/configure b/configure
index 0ddd743..c952fa8 100755
--- a/configure
+++ b/configure
@@ -6405,7 +6405,6 @@
 graphics/Makefile
 graphics/enhmetafiledrv/Makefile
 graphics/metafiledrv/Makefile
-graphics/ttydrv/Makefile
 graphics/win16drv/Makefile
 graphics/x11drv/Makefile
 if1632/Makefile
@@ -6450,7 +6449,6 @@
 unicode/Makefile
 win32/Makefile
 windows/Makefile
-windows/ttydrv/Makefile
 windows/x11drv/Makefile  include/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
 cat >> $CONFIG_STATUS <<EOF
@@ -6641,7 +6639,6 @@
 graphics/Makefile
 graphics/enhmetafiledrv/Makefile
 graphics/metafiledrv/Makefile
-graphics/ttydrv/Makefile
 graphics/win16drv/Makefile
 graphics/x11drv/Makefile
 if1632/Makefile
@@ -6686,7 +6683,6 @@
 unicode/Makefile
 win32/Makefile
 windows/Makefile
-windows/ttydrv/Makefile
 windows/x11drv/Makefile "}
 EOF
 cat >> $CONFIG_STATUS <<\EOF
diff --git a/configure.in b/configure.in
index 7ae4d84..7a51d93 100644
--- a/configure.in
+++ b/configure.in
@@ -1074,7 +1074,6 @@
 graphics/Makefile
 graphics/enhmetafiledrv/Makefile
 graphics/metafiledrv/Makefile
-graphics/ttydrv/Makefile
 graphics/win16drv/Makefile
 graphics/x11drv/Makefile
 if1632/Makefile
@@ -1119,7 +1118,6 @@
 unicode/Makefile
 win32/Makefile
 windows/Makefile
-windows/ttydrv/Makefile
 windows/x11drv/Makefile ])
 
 if test "$have_x" = "no"
diff --git a/controls/desktop.c b/controls/desktop.c
index 809e78d..859cfba 100644
--- a/controls/desktop.c
+++ b/controls/desktop.c
@@ -159,7 +159,7 @@
         return  1;
 	
     case WM_ERASEBKGND:
-	if(!USER_Driver->pIsSingleWindow())
+	if(!USER_Driver.pIsSingleWindow())
             return  1;
         return  DESKTOP_DoEraseBkgnd( hwnd, (HDC)wParam, desktopPtr );
 
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
index 0de9dc9..85cbdfa 100644
--- a/dlls/dinput/dinput_main.c
+++ b/dlls/dinput/dinput_main.c
@@ -787,7 +787,7 @@
 	LPDIRECTINPUTDEVICE2A iface,DWORD len,LPVOID ptr
 )
 {
-	return USER_Driver->pGetDIState(len, ptr)?DI_OK:E_FAIL;
+	return USER_Driver.pGetDIState(len, ptr)?DI_OK:E_FAIL;
 }
 
 static HRESULT WINAPI SysKeyboardAImpl_GetDeviceData(
@@ -802,7 +802,7 @@
 	TRACE("(this=%p,%ld,%p,%p(%ld)),0x%08lx)\n",
 	      This,dodsize,dod,entries,entries?*entries:0,flags);
 
-	ret=USER_Driver->pGetDIData(
+	ret=USER_Driver.pGetDIData(
 		This->keystate, dodsize, dod, entries, flags)?DI_OK:E_FAIL;
 	for (i=0;i<*entries;i++) {
 		dod[i].dwTimeStamp = GetTickCount();
@@ -821,11 +821,11 @@
 	  KEYBOARD_CONFIG no_auto;
 	  
 	  /* Save the original config */
-	  USER_Driver->pGetKeyboardConfig(&(This->initial_config));
+	  USER_Driver.pGetKeyboardConfig(&(This->initial_config));
 	  
 	  /* Now, remove auto-repeat */
 	  no_auto.auto_repeat = FALSE;
-	  USER_Driver->pSetKeyboardConfig(&no_auto, WINE_KEYBOARD_CONFIG_AUTO_REPEAT);
+	  USER_Driver.pSetKeyboardConfig(&no_auto, WINE_KEYBOARD_CONFIG_AUTO_REPEAT);
 
 	  This->acquired = 1;
 	}
@@ -840,7 +840,7 @@
 
 	if (This->acquired == 1) {
 	  /* Restore the original configuration */
-	  USER_Driver->pSetKeyboardConfig(&(This->initial_config), 0xFFFFFFFF);
+	  USER_Driver.pSetKeyboardConfig(&(This->initial_config), 0xFFFFFFFF);
 	  This->acquired = 0;
 	} else {
 	  ERR("Unacquiring a not-acquired device !!!\n");
@@ -1431,7 +1431,7 @@
       point.x = This->win_centerX;
       point.y = This->win_centerY;
       MapWindowPoints(This->win, HWND_DESKTOP, &point, 1);
-      USER_Driver->pMoveCursor( point.x, point.y );
+      USER_Driver.pMoveCursor( point.x, point.y );
       This->need_warp = WARP_STARTED;
     }
 
@@ -1493,7 +1493,7 @@
     point.x = This->win_centerX;
     point.y = This->win_centerY;
     MapWindowPoints(This->win, HWND_DESKTOP, &point, 1);
-    USER_Driver->pMoveCursor( point.x, point.y );
+    USER_Driver.pMoveCursor( point.x, point.y );
 
     This->need_warp = WARP_STARTED;
   }
@@ -1560,7 +1560,7 @@
     point.y = This->win_centerY;
     MapWindowPoints(This->win, HWND_DESKTOP, &point, 1);
 
-    USER_Driver->pMoveCursor( point.x, point.y );
+    USER_Driver.pMoveCursor( point.x, point.y );
 
     This->need_warp = WARP_STARTED;
   }
diff --git a/dlls/ttydrv/Makefile.in b/dlls/ttydrv/Makefile.in
index 24bb230..c2a88df 100644
--- a/dlls/ttydrv/Makefile.in
+++ b/dlls/ttydrv/Makefile.in
@@ -8,20 +8,16 @@
 IMPORTS   = user32 gdi32 kernel32
 
 C_SRCS = \
-	ttydrv_main.c
-
-EXTRA_OBJS = \
-	$(TOPOBJDIR)/graphics/ttydrv/ttydrv.o \
-	$(TOPOBJDIR)/windows/ttydrv/ttydrv.o
-
-SUBDIRS = \
-	$(TOPOBJDIR)/graphics/ttydrv \
-	$(TOPOBJDIR)/windows/ttydrv
+	bitmap.c \
+	dc.c \
+	graphics.c \
+	objects.c \
+	palette.c \
+	ttydrv_main.c \
+	user.c \
+	wnd.c
 
 @MAKE_DLL_RULES@
 
-$(EXTRA_OBJS): $(TOOLSUBDIRS) dummy
-	@cd `dirname $@` && $(MAKE) `basename $@`
-
 ### Dependencies:
 
diff --git a/graphics/ttydrv/bitmap.c b/dlls/ttydrv/bitmap.c
similarity index 65%
rename from graphics/ttydrv/bitmap.c
rename to dlls/ttydrv/bitmap.c
index 353c795..ddcc670 100644
--- a/graphics/ttydrv/bitmap.c
+++ b/dlls/ttydrv/bitmap.c
@@ -10,7 +10,7 @@
 #include "winbase.h"
 #include "debugtools.h"
 
-DEFAULT_DEBUG_CHANNEL(ttydrv)
+DEFAULT_DEBUG_CHANNEL(ttydrv);
 
 /**********************************************************************/
 
@@ -169,3 +169,78 @@
 
   return count;
 }
+
+/***********************************************************************
+ *		TTYDRV_BITMAP_CreateDIBSection
+ */
+HBITMAP TTYDRV_BITMAP_CreateDIBSection(
+  DC *dc, BITMAPINFO *bmi, UINT usage,
+  LPVOID *bits, HANDLE section, DWORD offset)
+{
+  FIXME("(%p, %p, %u, %p, 0x%04x, %ld): stub\n",
+	dc, bmi, usage, bits, section, offset);
+
+  return (HBITMAP) NULL;
+}
+
+/**********************************************************************
+ *		TTYDRV_BITMAP_CreateDIBSection16
+ */
+HBITMAP16 TTYDRV_DIB_CreateDIBSection16(
+  DC *dc, BITMAPINFO *bmi, UINT16 usage,
+  SEGPTR *bits, HANDLE section, DWORD offset)
+{
+  FIXME("(%p, %p, %u, %p, 0x%04x, %ld): stub\n",
+	dc, bmi, usage, bits, section, offset);
+
+  return (HBITMAP16) NULL;
+}
+
+/***********************************************************************
+ *		TTYDRV_BITMAP_DeleteDIBSection
+ */
+void TTYDRV_BITMAP_DeleteDIBSection(BITMAPOBJ *bmp)
+{
+  FIXME("(%p): stub\n", bmp);
+}
+
+/***********************************************************************
+ *		TTYDRV_BITMAP_GetDIBits
+ */
+INT TTYDRV_BITMAP_GetDIBits(
+  BITMAPOBJ *bmp, DC *dc, UINT startscan, UINT lines, 
+  LPVOID bits, BITMAPINFO *info, UINT coloruse, HBITMAP hbitmap)
+{
+  FIXME("(%p, %p, %u, %u, %p, %p, %u, 0x%04x): stub\n",
+	bmp, dc, startscan, lines, bits, info, coloruse, hbitmap);
+
+  return 0;
+}
+
+
+/***********************************************************************
+ *		TTYDRV_BITMAP_SetDIBits
+ */
+INT TTYDRV_BITMAP_SetDIBits(
+  BITMAPOBJ *bmp, DC *dc, UINT startscan, UINT lines, 
+  LPCVOID bits, const BITMAPINFO *info, UINT coloruse, HBITMAP hbitmap)
+{
+  FIXME("(%p, %p, %u, %u, %p, %p, %u, 0x%04x): stub\n",
+	bmp, dc, startscan, lines, bits, info, coloruse, hbitmap);
+
+  return 0;
+}
+
+/***********************************************************************
+ *		TTYDRV_DC_SetDIBitsToDevice
+ */
+INT TTYDRV_DC_SetDIBitsToDevice(DC *dc, INT xDest, INT yDest, DWORD cx,
+				DWORD cy, INT xSrc, INT ySrc,
+				UINT startscan, UINT lines, LPCVOID bits,
+				const BITMAPINFO *info, UINT coloruse)
+{
+  FIXME("(%p, %d, %d, %ld, %ld, %d, %d, %u, %u, %p, %p, %u): stub\n",
+	dc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, bits, info, coloruse);
+
+  return 0;
+}
diff --git a/graphics/ttydrv/init.c b/dlls/ttydrv/dc.c
similarity index 71%
rename from graphics/ttydrv/init.c
rename to dlls/ttydrv/dc.c
index c082036..0467fbb 100644
--- a/graphics/ttydrv/init.c
+++ b/dlls/ttydrv/dc.c
@@ -1,19 +1,22 @@
 /*
- * TTY driver
+ * TTY DC driver
  *
- * Copyright 1998-1999 Patrik Stridvall
+ * Copyright 1999 Patrik Stridvall
  */
 
 #include "config.h"
 
 #include "gdi.h"
 #include "bitmap.h"
-#include "color.h"
 #include "dc.h"
+#include "palette.h"
 #include "ttydrv.h"
+#include "winbase.h"
 #include "debugtools.h"
 
-DEFAULT_DEBUG_CHANNEL(ttydrv)
+DEFAULT_DEBUG_CHANNEL(ttydrv);
+
+/**********************************************************************/
 
 static const DC_FUNCTIONS TTYDRV_DC_Driver =
 {
@@ -169,7 +172,7 @@
   TTYDRV_DC_DevCaps.horzRes = 640;   /* FIXME: Screen width in pixel */
   TTYDRV_DC_DevCaps.vertRes = 480;   /* FIXME: Screen height in pixel */
   TTYDRV_DC_DevCaps.bitsPixel = 1;   /* FIXME: Bits per pixel */
-  TTYDRV_DC_DevCaps.sizePalette = 0; /* FIXME: ??? */
+  TTYDRV_DC_DevCaps.sizePalette = 256; /* FIXME: ??? */
   
   /* Resolution will be adjusted during the font init */
   
@@ -189,3 +192,89 @@
 {
     TTYDRV_PALETTE_Finalize();
 }
+
+/***********************************************************************
+ *	     TTYDRV_DC_CreateDC
+ */
+BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device,
+			LPCSTR output, const DEVMODEA *initData)
+{
+  TTYDRV_PDEVICE *physDev;
+  BITMAPOBJ *bmp;
+
+  TRACE("(%p, %s, %s, %s, %p)\n",
+    dc, debugstr_a(driver), debugstr_a(device), 
+    debugstr_a(output), initData);
+
+  dc->physDev = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
+			  sizeof(TTYDRV_PDEVICE));  
+  if(!dc->physDev) {
+    ERR("Can't allocate physDev\n");
+    return FALSE;
+  }
+  physDev = (TTYDRV_PDEVICE *) dc->physDev;
+  
+  dc->w.devCaps = &TTYDRV_DC_DevCaps;
+
+  if(dc->w.flags & DC_MEMORY){
+    physDev->window = NULL;
+    physDev->cellWidth = 1;
+    physDev->cellHeight = 1;
+
+    TTYDRV_DC_CreateBitmap(dc->w.hBitmap);
+    bmp = (BITMAPOBJ *) GDI_GetObjPtr(dc->w.hBitmap, BITMAP_MAGIC);
+				   
+    dc->w.bitsPerPixel = bmp->bitmap.bmBitsPixel;
+    
+    dc->w.totalExtent.left   = 0;
+    dc->w.totalExtent.top    = 0;
+    dc->w.totalExtent.right  = bmp->bitmap.bmWidth;
+    dc->w.totalExtent.bottom = bmp->bitmap.bmHeight;
+    dc->w.hVisRgn            = CreateRectRgnIndirect( &dc->w.totalExtent );
+    
+    GDI_HEAP_UNLOCK( dc->w.hBitmap );
+  } else {
+    physDev->window = TTYDRV_GetRootWindow();
+    physDev->cellWidth = cell_width;
+    physDev->cellHeight = cell_height;
+    
+    dc->w.bitsPerPixel       = 1;
+    dc->w.totalExtent.left   = 0;
+    dc->w.totalExtent.top    = 0;
+    dc->w.totalExtent.right  = cell_width * screen_cols;
+    dc->w.totalExtent.bottom = cell_height * screen_rows;
+    dc->w.hVisRgn            = CreateRectRgnIndirect( &dc->w.totalExtent );    
+  }
+
+  return TRUE;
+}
+
+/***********************************************************************
+ *	     TTYDRV_DC_DeleteDC
+ */
+BOOL TTYDRV_DC_DeleteDC(DC *dc)
+{
+  TRACE("(%p)\n", dc);
+
+  HeapFree( GetProcessHeap(), 0, dc->physDev );
+  dc->physDev = NULL;
+  
+  return TRUE;
+}
+
+/***********************************************************************
+ *           TTYDRV_DC_Escape
+ */
+INT TTYDRV_DC_Escape(DC *dc, INT nEscape, INT cbInput,
+		     SEGPTR lpInData, SEGPTR lpOutData)
+{
+  return 0;
+}
+
+/***********************************************************************
+ *		TTYDRV_DC_SetDeviceClipping
+ */
+void TTYDRV_DC_SetDeviceClipping(DC *dc)
+{
+  TRACE("(%p)\n", dc);
+}
diff --git a/graphics/ttydrv/graphics.c b/dlls/ttydrv/graphics.c
similarity index 64%
rename from graphics/ttydrv/graphics.c
rename to dlls/ttydrv/graphics.c
index 9108c38..049bd88 100644
--- a/graphics/ttydrv/graphics.c
+++ b/dlls/ttydrv/graphics.c
@@ -7,10 +7,11 @@
 #include "config.h"
 
 #include "dc.h"
+#include "heap.h"
 #include "debugtools.h"
 #include "ttydrv.h"
 
-DEFAULT_DEBUG_CHANNEL(ttydrv)
+DEFAULT_DEBUG_CHANNEL(ttydrv);
 
 /***********************************************************************
  *		TTYDRV_DC_Arc
@@ -306,3 +307,164 @@
   return oldColor;
 }
 
+
+/***********************************************************************
+ *		TTYDRV_DC_BitBlt
+ */
+BOOL TTYDRV_DC_BitBlt(DC *dcDst, INT xDst, INT yDst,
+		      INT width, INT height, DC *dcSrc,
+		      INT xSrc, INT ySrc, DWORD rop)
+{
+  FIXME("(%p, %d, %d, %d, %d, %p, %d, %d, %lu): stub\n",
+	dcDst, xDst, yDst, width, height, 
+        dcSrc, xSrc, ySrc, rop
+  );
+
+  return TRUE;
+}
+
+/***********************************************************************
+ *		TTYDRV_DC_PatBlt
+ */
+BOOL TTYDRV_DC_PatBlt(DC *dc, INT left, INT top,
+		      INT width, INT height, DWORD rop)
+{
+  FIXME("(%p, %d, %d, %d, %d, %lu): stub\n",
+	dc, left, top, width, height, rop
+  );
+
+
+  return TRUE;
+}
+
+/***********************************************************************
+ *		TTYDRV_DC_StretchBlt
+ */
+BOOL TTYDRV_DC_StretchBlt(DC *dcDst, INT xDst, INT yDst,
+			  INT widthDst, INT heightDst,
+			  DC *dcSrc, INT xSrc, INT ySrc,
+			  INT widthSrc, INT heightSrc, DWORD rop)
+{
+  FIXME("(%p, %d, %d, %d, %d, %p, %d, %d, %d, %d, %lu): stub\n",
+	dcDst, xDst, yDst, widthDst, heightDst,
+	dcSrc, xSrc, ySrc, widthSrc, heightSrc, rop
+  );
+
+  return TRUE;
+}
+
+/***********************************************************************
+ *		TTYDRV_DC_ExtTextOut
+ */
+BOOL TTYDRV_DC_ExtTextOut(DC *dc, INT x, INT y, UINT flags,
+			  const RECT *lpRect, LPCWSTR str, UINT count,
+			  const INT *lpDx)
+{
+#ifdef WINE_CURSES
+  TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev;
+  INT row, col;
+  LPSTR ascii;
+
+  TRACE("(%p, %d, %d, 0x%08x, %p, %s, %d, %p)\n",
+	dc, x, y, flags, lpRect, debugstr_wn(str, count), count, lpDx);
+
+  if(!physDev->window)
+    return FALSE;
+
+  /* FIXME: Is this really correct? */
+  if(dc->w.textAlign & TA_UPDATECP) {
+    x = dc->w.CursPosX;
+    y = dc->w.CursPosY;
+  }
+
+  x = XLPTODP(dc, x);
+  y = YLPTODP(dc, y);
+  
+  row = (dc->w.DCOrgY + y) / physDev->cellHeight;
+  col = (dc->w.DCOrgX + x) / physDev->cellWidth;
+  ascii = HeapAlloc( GetProcessHeap(), 0, count+1 );
+  lstrcpynWtoA(ascii, str, count+1);
+  mvwaddnstr(physDev->window, row, col, ascii, count);
+  HeapFree( GetProcessHeap(), 0, ascii );
+  wrefresh(physDev->window);
+
+  if(dc->w.textAlign & TA_UPDATECP) {
+    dc->w.CursPosX += count * physDev->cellWidth;
+    dc->w.CursPosY += physDev->cellHeight;
+  }
+
+  return TRUE;
+#else /* defined(WINE_CURSES) */
+  FIXME("(%p, %d, %d, 0x%08x, %p, %s, %d, %p): stub\n",
+	dc, x, y, flags, lpRect, debugstr_wn(str,count), count, lpDx);
+
+  return TRUE;
+#endif /* defined(WINE_CURSES) */
+}
+
+/***********************************************************************
+ *		TTYDRV_DC_GetCharWidth
+ */
+BOOL TTYDRV_DC_GetCharWidth(DC *dc, UINT firstChar, UINT lastChar,
+			    LPINT buffer)
+{
+  UINT c;
+  TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev;
+
+  FIXME("(%p, %u, %u, %p): semistub\n", dc, firstChar, lastChar, buffer);
+
+  for(c=firstChar; c<=lastChar; c++) {
+    buffer[c-firstChar] = physDev->cellWidth;
+  }
+
+  return TRUE;
+}
+
+/***********************************************************************
+ *		TTYDRV_DC_GetTextExtentPoint
+ */
+BOOL TTYDRV_DC_GetTextExtentPoint(DC *dc, LPCWSTR str, INT count,
+				  LPSIZE size)
+{
+  TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev;
+
+  TRACE("(%p, %s, %d, %p)\n", dc, debugstr_wn(str, count), count, size);
+
+  size->cx = count * physDev->cellWidth;
+  size->cy = physDev->cellHeight;
+
+  return TRUE;
+}
+
+/***********************************************************************
+ *		TTYDRV_DC_GetTextMetrics
+ */
+BOOL TTYDRV_DC_GetTextMetrics(DC *dc, LPTEXTMETRICA lptm)
+{
+  TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev;
+
+  TRACE("(%p, %p)\n", dc, lptm);
+
+  lptm->tmHeight = physDev->cellHeight;
+  lptm->tmAscent = 0;
+  lptm->tmDescent = 0;
+  lptm->tmInternalLeading = 0;
+  lptm->tmExternalLeading = 0;
+  lptm->tmAveCharWidth = physDev->cellWidth; 
+  lptm->tmMaxCharWidth = physDev->cellWidth;
+  lptm->tmWeight = FW_MEDIUM;
+  lptm->tmOverhang = 0;
+  lptm->tmDigitizedAspectX = physDev->cellWidth;
+  lptm->tmDigitizedAspectY = physDev->cellHeight;
+  lptm->tmFirstChar = 32;
+  lptm->tmLastChar = 255;
+  lptm->tmDefaultChar = 0;
+  lptm->tmBreakChar = 32;
+  lptm->tmItalic = FALSE;
+  lptm->tmUnderlined = FALSE;
+  lptm->tmStruckOut = FALSE;
+  lptm->tmPitchAndFamily = TMPF_FIXED_PITCH|TMPF_DEVICE;
+  lptm->tmCharSet = ANSI_CHARSET;
+
+  return TRUE;
+}
diff --git a/graphics/ttydrv/objects.c b/dlls/ttydrv/objects.c
similarity index 67%
rename from graphics/ttydrv/objects.c
rename to dlls/ttydrv/objects.c
index efff629..f85dcc3 100644
--- a/graphics/ttydrv/objects.c
+++ b/dlls/ttydrv/objects.c
@@ -13,17 +13,59 @@
 #include "ttydrv.h"
 #include "debugtools.h"
 
-DEFAULT_DEBUG_CHANNEL(ttydrv)
+DEFAULT_DEBUG_CHANNEL(ttydrv);
 
 /**********************************************************************/
 
 extern HBITMAP TTYDRV_DC_BITMAP_SelectObject(DC *dc, HBITMAP hbitmap, BITMAPOBJ *bitmap);
-extern HBRUSH TTYDRV_DC_BRUSH_SelectObject(DC *dc, HBRUSH hbrush, BRUSHOBJ *brush);
-extern HFONT TTYDRV_DC_FONT_SelectObject(DC* dc, HFONT hfont, FONTOBJ *font);
-extern HPEN TTYDRV_DC_PEN_SelectObject(DC *dc, HBRUSH hpen, PENOBJ *pen);
-
 extern BOOL TTYDRV_DC_BITMAP_DeleteObject(HBITMAP hbitmap, BITMAPOBJ *bitmap);
 
+
+/***********************************************************************
+ *		TTYDRV_DC_BRUSH_SelectObject
+ */
+static HBRUSH TTYDRV_DC_BRUSH_SelectObject(DC *dc, HBRUSH hbrush, BRUSHOBJ *brush)
+{
+  HBRUSH hPreviousBrush;
+
+  TRACE("(%p, 0x%04x, %p)\n", dc, hbrush, brush);
+
+  hPreviousBrush = dc->w.hBrush;
+  dc->w.hBrush = hbrush;
+
+  return hPreviousBrush;
+}
+
+/***********************************************************************
+ *		TTYDRV_DC_FONT_SelectObject
+ */
+static HFONT TTYDRV_DC_FONT_SelectObject(DC* dc, HFONT hfont, FONTOBJ *font)
+{
+  HFONT hPreviousFont;
+
+  TRACE("(%p, 0x%04x, %p)\n", dc, hfont, font);
+
+  hPreviousFont = dc->w.hFont;
+  dc->w.hFont = hfont;
+
+  return hPreviousFont;
+}
+
+/***********************************************************************
+ *		TTYDRV_DC_PEN_SelectObject
+ */
+static HPEN TTYDRV_DC_PEN_SelectObject(DC *dc, HBRUSH hpen, PENOBJ *pen)
+{
+  HPEN hPreviousPen;
+
+  TRACE("(%p, 0x%04x, %p)\n", dc, hpen, pen);
+
+  hPreviousPen = dc->w.hPen;
+  dc->w.hPen = hpen;
+
+  return hPreviousPen;
+}
+
 /***********************************************************************
  *		TTYDRV_DC_SelectObject
  */
diff --git a/graphics/ttydrv/palette.c b/dlls/ttydrv/palette.c
similarity index 97%
rename from graphics/ttydrv/palette.c
rename to dlls/ttydrv/palette.c
index a8d4339..ec558f5 100644
--- a/graphics/ttydrv/palette.c
+++ b/dlls/ttydrv/palette.c
@@ -12,7 +12,7 @@
 #include "winbase.h"
 #include "ttydrv.h"
 
-DEFAULT_DEBUG_CHANNEL(ttydrv)
+DEFAULT_DEBUG_CHANNEL(ttydrv);
 
 /**********************************************************************/
 
@@ -35,8 +35,6 @@
 
   TRACE("(void)\n");
 
-  TTYDRV_DC_DevCaps.sizePalette = 256;
-
   COLOR_sysPal = (PALETTEENTRY *) HeapAlloc(GetProcessHeap(), 0, sizeof(PALETTEENTRY) * TTYDRV_DC_DevCaps.sizePalette);
   if(COLOR_sysPal == NULL) {
     WARN("No memory to create system palette!");
diff --git a/include/ttydrv.h b/dlls/ttydrv/ttydrv.h
similarity index 78%
rename from include/ttydrv.h
rename to dlls/ttydrv/ttydrv.h
index 81aba65..04046ff 100644
--- a/include/ttydrv.h
+++ b/dlls/ttydrv/ttydrv.h
@@ -127,52 +127,6 @@
 extern WINDOW *root_window;
 static inline WINDOW *TTYDRV_GetRootWindow(void) { return root_window; }
 
-extern BOOL TTYDRV_GetScreenSaveActive(void);
-extern void TTYDRV_SetScreenSaveActive(BOOL bActivate);
-extern int TTYDRV_GetScreenSaveTimeout(void);
-extern void TTYDRV_SetScreenSaveTimeout(int nTimeout);
-extern BOOL TTYDRV_IsSingleWindow(void);
-
-/* TTY clipboard driver */
-
-extern struct tagCLIPBOARD_DRIVER TTYDRV_CLIPBOARD_Driver;
-
-extern void TTYDRV_CLIPBOARD_Acquire(void);
-extern void TTYDRV_CLIPBOARD_Release(void);
-extern void TTYDRV_CLIPBOARD_SetData(UINT wFormat);
-extern BOOL TTYDRV_CLIPBOARD_GetData(UINT wFormat);
-extern BOOL TTYDRV_CLIPBOARD_IsFormatAvailable(UINT wFormat);
-extern BOOL TTYDRV_CLIPBOARD_RegisterFormat( LPCSTR FormatName );
-extern BOOL TTYDRV_CLIPBOARD_IsSelectionowner();
-extern void TTYDRV_CLIPBOARD_ResetOwner(struct tagWND *pWnd, BOOL bFooBar);
-
-/* TTY event driver */
-
-extern void TTYDRV_EVENT_Synchronize(void);
-extern BOOL TTYDRV_EVENT_CheckFocus(void);
-extern void TTYDRV_EVENT_UserRepaintDisable(BOOL bDisable);
-
-/* TTY keyboard driver */
-
-extern void TTYDRV_KEYBOARD_Init(void);
-extern WORD TTYDRV_KEYBOARD_VkKeyScan(CHAR cChar);
-extern UINT16 TTYDRV_KEYBOARD_MapVirtualKey(UINT16 wCode, UINT16 wMapType);
-extern INT16 TTYDRV_KEYBOARD_GetKeyNameText(LONG lParam, LPSTR lpBuffer, INT16 nSize);
-extern INT16 TTYDRV_KEYBOARD_ToAscii(UINT16 virtKey, UINT16 scanCode, LPBYTE lpKeyState, LPVOID lpChar, UINT16 flags);
-extern BOOL TTYDRV_KEYBOARD_GetBeepActive(void);
-extern void TTYDRV_KEYBOARD_SetBeepActive(BOOL bActivate);
-extern void TTYDRV_KEYBOARD_Beep(void);
-extern BOOL TTYDRV_KEYBOARD_GetDIState(DWORD len, LPVOID ptr);
-extern BOOL TTYDRV_KEYBOARD_GetDIData(BYTE *keystate, DWORD dodsize, struct DIDEVICEOBJECTDATA *dod, LPDWORD entries, DWORD flags);
-extern void TTYDRV_KEYBOARD_GetKeyboardConfig(struct tagKEYBOARD_CONFIG *cfg);
-extern void TTYDRV_KEYBOARD_SetKeyboardConfig(struct tagKEYBOARD_CONFIG *cfg, DWORD mask);
-
-/* TTY mouse driver */
-
-extern void TTYDRV_MOUSE_Init(LPMOUSE_EVENT_PROC);
-extern void TTYDRV_MOUSE_SetCursor(struct tagCURSORICONINFO *lpCursor);
-extern void TTYDRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY);
-
 /* TTY windows driver */
 
 extern struct tagWND_DRIVER TTYDRV_WND_Driver;
diff --git a/dlls/ttydrv/ttydrv.spec b/dlls/ttydrv/ttydrv.spec
index 1ae7142..fae6f66 100644
--- a/dlls/ttydrv/ttydrv.spec
+++ b/dlls/ttydrv/ttydrv.spec
@@ -5,3 +5,38 @@
 import	user32.dll
 import	gdi32.dll
 import	kernel32.dll
+
+# USER driver
+
+@ cdecl Synchronize() TTYDRV_Synchronize
+@ cdecl CheckFocus() TTYDRV_CheckFocus
+@ cdecl UserRepaintDisable(long) TTYDRV_UserRepaintDisable
+@ cdecl InitKeyboard() TTYDRV_InitKeyboard
+@ cdecl VkKeyScan(long) TTYDRV_VkKeyScan
+@ cdecl MapVirtualKey(long long) TTYDRV_MapVirtualKey
+@ cdecl GetKeyNameText(long str long) TTYDRV_GetKeyNameText
+@ cdecl ToAscii(long long ptr ptr long) TTYDRV_ToAscii
+@ cdecl GetBeepActive() TTYDRV_GetBeepActive
+@ cdecl SetBeepActive(long) TTYDRV_SetBeepActive
+@ cdecl Beep() TTYDRV_Beep
+@ cdecl GetDIState(long ptr) TTYDRV_GetDIState
+@ cdecl GetDIData(ptr long ptr ptr long) TTYDRV_GetDIData
+@ cdecl GetKeyboardConfig(ptr) TTYDRV_GetKeyboardConfig
+@ cdecl SetKeyboardConfig(ptr long) TTYDRV_SetKeyboardConfig
+@ cdecl InitMouse(ptr) TTYDRV_InitMouse
+@ cdecl SetCursor(ptr) TTYDRV_SetCursor
+@ cdecl MoveCursor(long long) TTYDRV_MoveCursor
+@ cdecl GetScreenSaveActive() TTYDRV_GetScreenSaveActive
+@ cdecl SetScreenSaveActive(long) TTYDRV_SetScreenSaveActive
+@ cdecl GetScreenSaveTimeout() TTYDRV_GetScreenSaveTimeout
+@ cdecl SetScreenSaveTimeout(long) TTYDRV_SetScreenSaveTimeout
+@ cdecl LoadOEMResource(long long) TTYDRV_LoadOEMResource
+@ cdecl IsSingleWindow() TTYDRV_IsSingleWindow
+@ cdecl AcquireClipboard() TTYDRV_AcquireClipboard
+@ cdecl ReleaseClipboard() TTYDRV_ReleaseClipboard
+@ cdecl SetClipboardData(long) TTYDRV_SetClipboardData
+@ cdecl GetClipboardData(long) TTYDRV_GetClipboardData
+@ cdecl IsClipboardFormatAvailable(long) TTYDRV_IsClipboardFormatAvailable
+@ cdecl RegisterClipboardFormat(str) TTYDRV_RegisterClipboardFormat
+@ cdecl IsSelectionOwner() TTYDRV_IsSelectionOwner
+@ cdecl ResetSelectionOwner(ptr long) TTYDRV_ResetSelectionOwner
diff --git a/dlls/ttydrv/ttydrv_main.c b/dlls/ttydrv/ttydrv_main.c
index 7b3b6ff..67ed429 100644
--- a/dlls/ttydrv/ttydrv_main.c
+++ b/dlls/ttydrv/ttydrv_main.c
@@ -8,7 +8,6 @@
 
 #include "winbase.h"
 #include "wine/winbase16.h"
-#include "clipboard.h"
 #include "gdi.h"
 #include "message.h"
 #include "user.h"
@@ -18,40 +17,6 @@
 
 DEFAULT_DEBUG_CHANNEL(ttydrv);
 
-static USER_DRIVER user_driver =
-{
-    /* event functions */
-    TTYDRV_EVENT_Synchronize,
-    TTYDRV_EVENT_CheckFocus,
-    TTYDRV_EVENT_UserRepaintDisable,
-    /* keyboard functions */
-    TTYDRV_KEYBOARD_Init,
-    TTYDRV_KEYBOARD_VkKeyScan,
-    TTYDRV_KEYBOARD_MapVirtualKey,
-    TTYDRV_KEYBOARD_GetKeyNameText,
-    TTYDRV_KEYBOARD_ToAscii,
-    TTYDRV_KEYBOARD_GetBeepActive,
-    TTYDRV_KEYBOARD_SetBeepActive,
-    TTYDRV_KEYBOARD_Beep,
-    TTYDRV_KEYBOARD_GetDIState,
-    TTYDRV_KEYBOARD_GetDIData,
-    TTYDRV_KEYBOARD_GetKeyboardConfig,
-    TTYDRV_KEYBOARD_SetKeyboardConfig,
-    /* mouse functions */
-    TTYDRV_MOUSE_Init,
-    TTYDRV_MOUSE_SetCursor,
-    TTYDRV_MOUSE_MoveCursor,
-    /* screen saver functions */
-    TTYDRV_GetScreenSaveActive,
-    TTYDRV_SetScreenSaveActive,
-    TTYDRV_GetScreenSaveTimeout,
-    TTYDRV_SetScreenSaveTimeout,
-    /* resource functions */
-    TTYDRV_LoadOEMResource,
-    /* windowing functions */
-    TTYDRV_IsSingleWindow
-};
-
 int cell_width = 8;
 int cell_height = 8;
 int screen_rows = 50;  /* default value */
@@ -64,8 +29,6 @@
  */
 static void process_attach(void)
 {
-    USER_Driver      = &user_driver;
-    CLIPBOARD_Driver = &TTYDRV_CLIPBOARD_Driver;
     WND_Driver       = &TTYDRV_WND_Driver;
 
 #ifdef WINE_CURSES
@@ -95,8 +58,6 @@
     if (root_window) endwin();
 #endif  /* WINE_CURSES */
 
-    USER_Driver      = NULL;
-    CLIPBOARD_Driver = NULL;
     WND_Driver       = NULL;
 }
 
@@ -120,52 +81,3 @@
     }
     return TRUE;
 }
-
-
-/***********************************************************************
- *              TTYDRV_GetScreenSaveActive
- *
- * Returns the active status of the screen saver
- */
-BOOL TTYDRV_GetScreenSaveActive(void)
-{
-    return FALSE;
-}
-
-/***********************************************************************
- *              TTYDRV_SetScreenSaveActive
- *
- * Activate/Deactivate the screen saver
- */
-void TTYDRV_SetScreenSaveActive(BOOL bActivate)
-{
-    FIXME("(%d): stub\n", bActivate);
-}
-
-/***********************************************************************
- *              TTYDRV_GetScreenSaveTimeout
- *
- * Return the screen saver timeout
- */
-int TTYDRV_GetScreenSaveTimeout(void)
-{
-    return 0;
-}
-
-/***********************************************************************
- *              TTYDRV_SetScreenSaveTimeout
- *
- * Set the screen saver timeout
- */
-void TTYDRV_SetScreenSaveTimeout(int nTimeout)
-{
-    FIXME("(%d): stub\n", nTimeout);
-}
-
-/***********************************************************************
- *              TTYDRV_IsSingleWindow
- */
-BOOL TTYDRV_IsSingleWindow(void)
-{
-    return TRUE;
-}
diff --git a/dlls/ttydrv/user.c b/dlls/ttydrv/user.c
new file mode 100644
index 0000000..90b17f0
--- /dev/null
+++ b/dlls/ttydrv/user.c
@@ -0,0 +1,287 @@
+/*
+ * TTYDRV USER driver functions
+ *
+ * Copyright 1998 Patrik Stridvall
+ */
+
+#include "dinput.h"
+#include "gdi.h"
+#include "ttydrv.h"
+#include "debugtools.h"
+
+DEFAULT_DEBUG_CHANNEL(ttydrv);
+
+/***********************************************************************
+ *		TTYDRV_Synchronize
+ */
+void TTYDRV_Synchronize( void )
+{
+}
+
+/***********************************************************************
+ *		TTYDRV_CheckFocus
+ */
+BOOL TTYDRV_CheckFocus(void)
+{
+  return TRUE;
+}
+
+/***********************************************************************
+ *		TTYDRV_UserRepaintDisable
+ */
+void TTYDRV_UserRepaintDisable( BOOL bDisable )
+{
+}
+
+
+/***********************************************************************
+ *		TTYDRV_InitKeyboard
+ */
+void TTYDRV_InitKeyboard(void)
+{
+}
+
+/***********************************************************************
+ *		TTYDRV_VkKeyScan
+ */
+WORD TTYDRV_VkKeyScan(CHAR cChar)
+{
+  return 0;
+}
+
+/***********************************************************************
+ *		TTYDRV_MapVirtualKey
+ */
+UINT16 TTYDRV_MapVirtualKey(UINT16 wCode, UINT16 wMapType)
+{
+  return 0;
+}
+
+/***********************************************************************
+ *		TTYDRV_GetKeyNameText
+ */
+INT16 TTYDRV_GetKeyNameText( LONG lParam, LPSTR lpBuffer, INT16 nSize )
+{  
+  if(lpBuffer && nSize)
+    {
+      *lpBuffer = 0;
+    }
+  return 0;
+}
+
+/***********************************************************************
+ *		TTYDRV_ToAscii
+ */
+INT16 TTYDRV_ToAscii( UINT16 virtKey, UINT16 scanCode,
+                      LPBYTE lpKeyState, LPVOID lpChar, UINT16 flags )
+{
+  return 0;
+}
+
+/***********************************************************************
+ *		TTYDRV_GetBeepActive
+ */
+BOOL TTYDRV_GetBeepActive(void)
+{
+  return FALSE;
+}
+
+/***********************************************************************
+ *		TTYDRV_SetBeepActive
+ */
+void TTYDRV_SetBeepActive(BOOL bActivate)
+{
+}
+
+/***********************************************************************
+ *		TTYDRV_Beep
+ */
+void TTYDRV_Beep(void)
+{
+}
+
+/***********************************************************************
+ *		TTYDRV_GetDIState
+ */
+BOOL TTYDRV_GetDIState(DWORD len, LPVOID ptr)
+{
+  return TRUE;
+}
+
+/***********************************************************************
+ *		TTYDRV_GetDIData
+ */
+BOOL TTYDRV_GetDIData( BYTE *keystate, DWORD dodsize, LPDIDEVICEOBJECTDATA dod,
+                       LPDWORD entries, DWORD flags )
+{
+  return TRUE;
+}
+
+/***********************************************************************
+ *		TTYDRV_GetKeyboardConfig
+ */
+void TTYDRV_GetKeyboardConfig(KEYBOARD_CONFIG *cfg)
+{
+}
+
+/***********************************************************************
+ *		TTYDRV_SetKeyboardConfig
+ */
+extern void TTYDRV_SetKeyboardConfig(KEYBOARD_CONFIG *cfg, DWORD mask)
+{
+}
+
+/***********************************************************************
+ *           TTYDRV_InitMouse
+ */
+void TTYDRV_InitMouse(LPMOUSE_EVENT_PROC proc)
+{
+}
+
+/***********************************************************************
+ *		TTYDRV_SetCursor
+ */
+void TTYDRV_SetCursor( struct tagCURSORICONINFO *lpCursor )
+{
+}
+
+/***********************************************************************
+ *		TTYDRV_MoveCursor
+ */
+void TTYDRV_MoveCursor(WORD wAbsX, WORD wAbsY)
+{
+}
+
+/***********************************************************************
+ *              TTYDRV_GetScreenSaveActive
+ *
+ * Returns the active status of the screen saver
+ */
+BOOL TTYDRV_GetScreenSaveActive(void)
+{
+    return FALSE;
+}
+
+/***********************************************************************
+ *              TTYDRV_SetScreenSaveActive
+ *
+ * Activate/Deactivate the screen saver
+ */
+void TTYDRV_SetScreenSaveActive(BOOL bActivate)
+{
+    FIXME("(%d): stub\n", bActivate);
+}
+
+/***********************************************************************
+ *              TTYDRV_GetScreenSaveTimeout
+ *
+ * Return the screen saver timeout
+ */
+int TTYDRV_GetScreenSaveTimeout(void)
+{
+    return 0;
+}
+
+/***********************************************************************
+ *              TTYDRV_SetScreenSaveTimeout
+ *
+ * Set the screen saver timeout
+ */
+void TTYDRV_SetScreenSaveTimeout(int nTimeout)
+{
+    FIXME("(%d): stub\n", nTimeout);
+}
+
+/**********************************************************************
+ *		TTYDRV_LoadOEMResource
+ */
+HANDLE TTYDRV_LoadOEMResource(WORD resid, WORD type)
+{
+  HBITMAP hbitmap;
+  switch(type)
+  {
+    case OEM_BITMAP:
+        hbitmap = CreateBitmap(1, 1, 1, 1, NULL);
+        TTYDRV_DC_CreateBitmap(hbitmap);
+        return hbitmap;
+    case OEM_CURSOR:
+    case OEM_ICON:
+        break;
+    default:
+      ERR("unknown type (%d)\n", type);
+  }
+  return 0;
+}
+
+/***********************************************************************
+ *              TTYDRV_IsSingleWindow
+ */
+BOOL TTYDRV_IsSingleWindow(void)
+{
+    return TRUE;
+}
+
+/***********************************************************************
+ *		TTYDRV_AcquireClipboard
+ */
+void TTYDRV_AcquireClipboard(void)
+{
+}
+
+/***********************************************************************
+ *		TTYDRV_ReleaseClipboard
+ */
+void TTYDRV_ReleaseClipboard(void)
+{
+}
+
+/***********************************************************************
+ *		TTYDRV_SetClipboardData
+ */
+void TTYDRV_SetClipboardData(UINT wFormat)
+{
+}
+
+/***********************************************************************
+ *		TTYDRV_GetClipboardData
+ */
+BOOL TTYDRV_GetClipboardData(UINT wFormat)
+{
+  return FALSE;
+}
+
+/***********************************************************************
+ *		TTYDRV_IsClipboardFormatAvailable
+ */
+BOOL TTYDRV_IsClipboardFormatAvailable(UINT wFormat)
+{
+  return FALSE;
+}
+
+/**************************************************************************
+ *		TTYDRV_RegisterClipboardFormat
+ *
+ * Registers a custom clipboard format
+ * Returns: TRUE - new format registered, FALSE - Format already registered
+ */
+BOOL TTYDRV_RegisterClipboardFormat( LPCSTR FormatName )
+{
+  return TRUE;
+}
+
+/**************************************************************************
+ *		TTYDRV_IsSelectionOwner
+ *
+ * Returns: TRUE - We(WINE) own the selection, FALSE - Selection not owned by us
+ */
+BOOL TTYDRV_IsSelectionOwner(void)
+{
+    return FALSE;
+}
+
+/***********************************************************************
+ *		TTYDRV_ResetSelectionOwner
+ */
+void TTYDRV_ResetSelectionOwner(struct tagWND *pWnd, BOOL bFooBar)
+{
+}
diff --git a/windows/ttydrv/wnd.c b/dlls/ttydrv/wnd.c
similarity index 91%
rename from windows/ttydrv/wnd.c
rename to dlls/ttydrv/wnd.c
index df64709..a3acb7e 100644
--- a/windows/ttydrv/wnd.c
+++ b/dlls/ttydrv/wnd.c
@@ -13,7 +13,29 @@
 #include "win.h"
 #include "debugtools.h"
 
-DEFAULT_DEBUG_CHANNEL(ttydrv)
+DEFAULT_DEBUG_CHANNEL(ttydrv);
+
+WND_DRIVER TTYDRV_WND_Driver =
+{
+  TTYDRV_WND_Initialize,
+  TTYDRV_WND_Finalize,
+  TTYDRV_WND_CreateDesktopWindow,
+  TTYDRV_WND_CreateWindow,
+  TTYDRV_WND_DestroyWindow,
+  TTYDRV_WND_SetParent,
+  TTYDRV_WND_ForceWindowRaise,
+  TTYDRV_WND_SetWindowPos,
+  TTYDRV_WND_SetText,
+  TTYDRV_WND_SetFocus,
+  TTYDRV_WND_PreSizeMove,
+  TTYDRV_WND_PostSizeMove,
+  TTYDRV_WND_ScrollWindow,
+  TTYDRV_WND_SetDrawable,
+  TTYDRV_WND_SetHostAttr,
+  TTYDRV_WND_IsSelfClipping,
+  TTYDRV_WND_SetWindowRgn
+};
+
 
 /***********************************************************************
  *		TTYDRV_WND_GetCursesWindow
diff --git a/dlls/user/display.c b/dlls/user/display.c
index 5eb9ad7..822174a 100644
--- a/dlls/user/display.c
+++ b/dlls/user/display.c
@@ -36,7 +36,7 @@
  */
 VOID WINAPI DISPLAY_SetCursor( struct tagCURSORICONINFO *lpCursor )
 {
-    USER_Driver->pSetCursor(lpCursor);
+    USER_Driver.pSetCursor(lpCursor);
 }
 
 /***********************************************************************
@@ -44,7 +44,7 @@
  */
 VOID WINAPI DISPLAY_MoveCursor( WORD wAbsX, WORD wAbsY )
 {
-    USER_Driver->pMoveCursor(wAbsX, wAbsY);
+    USER_Driver.pMoveCursor(wAbsX, wAbsY);
 }
 
 /***********************************************************************
@@ -76,6 +76,6 @@
  */
 VOID WINAPI UserRepaintDisable16( BOOL16 disable )
 {
-    USER_Driver->pUserRepaintDisable( disable );
+    USER_Driver.pUserRepaintDisable( disable );
 }
 
diff --git a/dlls/user/mouse.c b/dlls/user/mouse.c
index a74a8a3..1d8371d 100644
--- a/dlls/user/mouse.c
+++ b/dlls/user/mouse.c
@@ -63,7 +63,7 @@
 {
     THUNK_Free( (FARPROC)DefMouseEventProc );
     DefMouseEventProc = lpMouseEventProc;
-    USER_Driver->pInitMouse( lpMouseEventProc );
+    USER_Driver.pInitMouse( lpMouseEventProc );
 }
 
 static VOID WINAPI MOUSE_CallMouseEventProc( FARPROC16 proc,
@@ -100,5 +100,5 @@
 {
     THUNK_Free( (FARPROC)DefMouseEventProc );
     DefMouseEventProc = 0;
-    USER_Driver->pInitMouse( 0 );
+    USER_Driver.pInitMouse( 0 );
 }
diff --git a/dlls/user/user_main.c b/dlls/user/user_main.c
index f64a202..3d717ee 100644
--- a/dlls/user/user_main.c
+++ b/dlls/user/user_main.c
@@ -22,6 +22,15 @@
 #include "win.h"
 #include "debugtools.h"
 
+DEFAULT_DEBUG_CHANNEL(graphics);
+
+USER_DRIVER USER_Driver;
+
+static HMODULE graphics_driver;
+
+#define GET_USER_FUNC(name) \
+   if (!(USER_Driver.p##name = (void*)GetProcAddress( graphics_driver, #name ))) \
+      FIXME("%s not found in graphics driver\n", #name)
 
 /* load the graphics driver */
 static BOOL load_driver(void)
@@ -41,11 +50,45 @@
         strcpy( buffer, "x11drv" );  /* default value */
     RegCloseKey( hkey );
 
-    if (!LoadLibraryA( buffer ))
+    if (!(graphics_driver = LoadLibraryA( buffer )))
     {
         MESSAGE( "Could not load graphics driver '%s'\n", buffer );
         return FALSE;
     }
+
+    GET_USER_FUNC(Synchronize);
+    GET_USER_FUNC(CheckFocus);
+    GET_USER_FUNC(UserRepaintDisable);
+    GET_USER_FUNC(InitKeyboard);
+    GET_USER_FUNC(VkKeyScan);
+    GET_USER_FUNC(MapVirtualKey);
+    GET_USER_FUNC(GetKeyNameText);
+    GET_USER_FUNC(ToAscii);
+    GET_USER_FUNC(GetBeepActive);
+    GET_USER_FUNC(SetBeepActive);
+    GET_USER_FUNC(Beep);
+    GET_USER_FUNC(GetDIState);
+    GET_USER_FUNC(GetDIData);
+    GET_USER_FUNC(GetKeyboardConfig);
+    GET_USER_FUNC(SetKeyboardConfig);
+    GET_USER_FUNC(InitMouse);
+    GET_USER_FUNC(SetCursor);
+    GET_USER_FUNC(MoveCursor);
+    GET_USER_FUNC(GetScreenSaveActive);
+    GET_USER_FUNC(SetScreenSaveActive);
+    GET_USER_FUNC(GetScreenSaveTimeout);
+    GET_USER_FUNC(SetScreenSaveTimeout);
+    GET_USER_FUNC(LoadOEMResource);
+    GET_USER_FUNC(IsSingleWindow);
+    GET_USER_FUNC(AcquireClipboard);
+    GET_USER_FUNC(ReleaseClipboard);
+    GET_USER_FUNC(SetClipboardData);
+    GET_USER_FUNC(GetClipboardData);
+    GET_USER_FUNC(IsClipboardFormatAvailable);
+    GET_USER_FUNC(RegisterClipboardFormat);
+    GET_USER_FUNC(IsSelectionOwner);
+    GET_USER_FUNC(ResetSelectionOwner);
+
     return TRUE;
 }
 
@@ -115,7 +158,7 @@
     MOUSE_Enable( mouse_event );
 
     /* Start processing X events */
-    USER_Driver->pUserRepaintDisable( FALSE );
+    USER_Driver.pUserRepaintDisable( FALSE );
 
     return TRUE;
 }
diff --git a/dlls/x11drv/x11drv.spec b/dlls/x11drv/x11drv.spec
index 9fb6d95..535ff47 100644
--- a/dlls/x11drv/x11drv.spec
+++ b/dlls/x11drv/x11drv.spec
@@ -5,3 +5,38 @@
 import	user32.dll
 import	gdi32.dll
 import	kernel32.dll
+
+# USER driver
+
+@ cdecl Synchronize() X11DRV_Synchronize
+@ cdecl CheckFocus() X11DRV_CheckFocus
+@ cdecl UserRepaintDisable(long) X11DRV_UserRepaintDisable
+@ cdecl InitKeyboard() X11DRV_InitKeyboard
+@ cdecl VkKeyScan(long) X11DRV_VkKeyScan
+@ cdecl MapVirtualKey(long long) X11DRV_MapVirtualKey
+@ cdecl GetKeyNameText(long str long) X11DRV_GetKeyNameText
+@ cdecl ToAscii(long long ptr ptr long) X11DRV_ToAscii
+@ cdecl GetBeepActive() X11DRV_GetBeepActive
+@ cdecl SetBeepActive(long) X11DRV_SetBeepActive
+@ cdecl Beep() X11DRV_Beep
+@ cdecl GetDIState(long ptr) X11DRV_GetDIState
+@ cdecl GetDIData(ptr long ptr ptr long) X11DRV_GetDIData
+@ cdecl GetKeyboardConfig(ptr) X11DRV_GetKeyboardConfig
+@ cdecl SetKeyboardConfig(ptr long) X11DRV_SetKeyboardConfig
+@ cdecl InitMouse(ptr) X11DRV_InitMouse
+@ cdecl SetCursor(ptr) X11DRV_SetCursor
+@ cdecl MoveCursor(long long) X11DRV_MoveCursor
+@ cdecl GetScreenSaveActive() X11DRV_GetScreenSaveActive
+@ cdecl SetScreenSaveActive(long) X11DRV_SetScreenSaveActive
+@ cdecl GetScreenSaveTimeout() X11DRV_GetScreenSaveTimeout
+@ cdecl SetScreenSaveTimeout(long) X11DRV_SetScreenSaveTimeout
+@ cdecl LoadOEMResource(long long) X11DRV_LoadOEMResource
+@ cdecl IsSingleWindow() X11DRV_IsSingleWindow
+@ cdecl AcquireClipboard() X11DRV_AcquireClipboard
+@ cdecl ReleaseClipboard() X11DRV_ReleaseClipboard
+@ cdecl SetClipboardData(long) X11DRV_SetClipboardData
+@ cdecl GetClipboardData(long) X11DRV_GetClipboardData
+@ cdecl IsClipboardFormatAvailable(long) X11DRV_IsClipboardFormatAvailable
+@ cdecl RegisterClipboardFormat(str) X11DRV_RegisterClipboardFormat
+@ cdecl IsSelectionOwner() X11DRV_IsSelectionOwner
+@ cdecl ResetSelectionOwner(ptr long) X11DRV_ResetSelectionOwner
diff --git a/dlls/x11drv/x11drv_main.c b/dlls/x11drv/x11drv_main.c
index 03cfbf5..3326c1a 100644
--- a/dlls/x11drv/x11drv_main.c
+++ b/dlls/x11drv/x11drv_main.c
@@ -20,7 +20,6 @@
 #include "winreg.h"
 
 #include "callback.h"
-#include "clipboard.h"
 #include "debugtools.h"
 #include "gdi.h"
 #include "options.h"
@@ -31,40 +30,6 @@
 
 DEFAULT_DEBUG_CHANNEL(x11drv);
 
-static USER_DRIVER user_driver =
-{
-    /* event functions */
-    X11DRV_EVENT_Synchronize,
-    X11DRV_EVENT_CheckFocus,
-    X11DRV_EVENT_UserRepaintDisable,
-    /* keyboard functions */
-    X11DRV_KEYBOARD_Init,
-    X11DRV_KEYBOARD_VkKeyScan,
-    X11DRV_KEYBOARD_MapVirtualKey,
-    X11DRV_KEYBOARD_GetKeyNameText,
-    X11DRV_KEYBOARD_ToAscii,
-    X11DRV_KEYBOARD_GetBeepActive,
-    X11DRV_KEYBOARD_SetBeepActive,
-    X11DRV_KEYBOARD_Beep,
-    X11DRV_KEYBOARD_GetDIState,
-    X11DRV_KEYBOARD_GetDIData,
-    X11DRV_KEYBOARD_GetKeyboardConfig,
-    X11DRV_KEYBOARD_SetKeyboardConfig,
-    /* mouse functions */
-    X11DRV_MOUSE_Init,
-    X11DRV_MOUSE_SetCursor,
-    X11DRV_MOUSE_MoveCursor,
-    /* screen saver functions */
-    X11DRV_GetScreenSaveActive,
-    X11DRV_SetScreenSaveActive,
-    X11DRV_GetScreenSaveTimeout,
-    X11DRV_SetScreenSaveTimeout,
-    /* resource functions */
-    X11DRV_LoadOEMResource,
-    /* windowing functions */
-    X11DRV_IsSingleWindow
-};
-
 static XKeyboardState keyboard_state;
 
 Display *display;
@@ -249,8 +214,6 @@
  */
 static void process_attach(void)
 {
-    USER_Driver      = &user_driver;
-    CLIPBOARD_Driver = &X11DRV_CLIPBOARD_Driver;
     WND_Driver       = &X11DRV_WND_Driver;
 
     setup_options();
@@ -344,8 +307,6 @@
     XCloseDisplay( display );
     display = NULL;
 
-    USER_Driver      = NULL;
-    CLIPBOARD_Driver = NULL;
     WND_Driver       = NULL;
 #endif
 }
diff --git a/graphics/ttydrv/.cvsignore b/graphics/ttydrv/.cvsignore
deleted file mode 100644
index f3c7a7c..0000000
--- a/graphics/ttydrv/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-Makefile
diff --git a/graphics/ttydrv/Makefile.in b/graphics/ttydrv/Makefile.in
deleted file mode 100644
index e5d8650..0000000
--- a/graphics/ttydrv/Makefile.in
+++ /dev/null
@@ -1,28 +0,0 @@
-DEFS      = @DLLFLAGS@ -D__WINE__
-TOPSRCDIR = @top_srcdir@
-TOPOBJDIR = ../..
-SRCDIR    = @srcdir@
-VPATH     = @srcdir@
-MODULE    = ttydrv
-
-C_SRCS = \
-	bitblt.c \
-	bitmap.c \
-	brush.c \
-	clipping.c \
-	dc.c \
-	dib.c \
-	font.c \
-	graphics.c \
-	init.c \
-	objects.c \
-	oembitmap.c \
-	palette.c \
-	pen.c \
-	text.c
-
-all: $(MODULE).o
-
-@MAKE_RULES@
-
-### Dependencies:
diff --git a/graphics/ttydrv/bitblt.c b/graphics/ttydrv/bitblt.c
deleted file mode 100644
index 757af0b..0000000
--- a/graphics/ttydrv/bitblt.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * TTY DC bit blit
- *
- * Copyright 1999 Patrik Stridvall
- */
-
-#include "dc.h"
-#include "debugtools.h"
-#include "pen.h"
-#include "ttydrv.h"
-
-DEFAULT_DEBUG_CHANNEL(ttydrv)
-
-/***********************************************************************
- *		TTYDRV_DC_BitBlt
- */
-BOOL TTYDRV_DC_BitBlt(DC *dcDst, INT xDst, INT yDst,
-		      INT width, INT height, DC *dcSrc,
-		      INT xSrc, INT ySrc, DWORD rop)
-{
-  FIXME("(%p, %d, %d, %d, %d, %p, %d, %d, %lu): stub\n",
-	dcDst, xDst, yDst, width, height, 
-        dcSrc, xSrc, ySrc, rop
-  );
-
-  return TRUE;
-}
-
-/***********************************************************************
- *		TTYDRV_DC_PatBlt
- */
-BOOL TTYDRV_DC_PatBlt(DC *dc, INT left, INT top,
-		      INT width, INT height, DWORD rop)
-{
-  FIXME("(%p, %d, %d, %d, %d, %lu): stub\n",
-	dc, left, top, width, height, rop
-  );
-
-
-  return TRUE;
-}
-
-/***********************************************************************
- *		TTYDRV_DC_StretchBlt
- */
-BOOL TTYDRV_DC_StretchBlt(DC *dcDst, INT xDst, INT yDst,
-			  INT widthDst, INT heightDst,
-			  DC *dcSrc, INT xSrc, INT ySrc,
-			  INT widthSrc, INT heightSrc, DWORD rop)
-{
-  FIXME("(%p, %d, %d, %d, %d, %p, %d, %d, %d, %d, %lu): stub\n",
-	dcDst, xDst, yDst, widthDst, heightDst,
-	dcSrc, xSrc, ySrc, widthSrc, heightSrc, rop
-  );
-
-  return TRUE;
-}
-
diff --git a/graphics/ttydrv/brush.c b/graphics/ttydrv/brush.c
deleted file mode 100644
index 86c2724..0000000
--- a/graphics/ttydrv/brush.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * TTY DC brush
- *
- * Copyright 1999 Patrik Stridvall
- */
-
-#include "brush.h"
-#include "dc.h"
-#include "debugtools.h"
-#include "ttydrv.h"
-
-DEFAULT_DEBUG_CHANNEL(ttydrv)
-
-/***********************************************************************
- *		TTYDRV_DC_BRUSH_SelectObject
- */
-HBRUSH TTYDRV_DC_BRUSH_SelectObject(DC *dc, HBRUSH hbrush, BRUSHOBJ *brush)
-{
-  HBRUSH hPreviousBrush;
-
-  TRACE("(%p, 0x%04x, %p)\n", dc, hbrush, brush);
-
-  hPreviousBrush = dc->w.hBrush;
-  dc->w.hBrush = hbrush;
-
-  return hPreviousBrush;
-}
diff --git a/graphics/ttydrv/clipping.c b/graphics/ttydrv/clipping.c
deleted file mode 100644
index 386722e..0000000
--- a/graphics/ttydrv/clipping.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * TTY DC clipping
- *
- * Copyright 1999 Patrik Stridvall
- */
-
-#include "dc.h"
-#include "debugtools.h"
-#include "ttydrv.h"
-
-DEFAULT_DEBUG_CHANNEL(ttydrv)
-
-/***********************************************************************
- *		TTYDRV_DC_SetDeviceClipping
- */
-void TTYDRV_DC_SetDeviceClipping(DC *dc)
-{
-  TRACE("(%p)\n", dc);
-}
-
-
diff --git a/graphics/ttydrv/dc.c b/graphics/ttydrv/dc.c
deleted file mode 100644
index 7c9a8d9..0000000
--- a/graphics/ttydrv/dc.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * TTY DC driver
- *
- * Copyright 1999 Patrik Stridvall
- */
-
-#include "config.h"
-
-#include "gdi.h"
-#include "bitmap.h"
-#include "dc.h"
-#include "ttydrv.h"
-#include "winbase.h"
-#include "debugtools.h"
-
-DEFAULT_DEBUG_CHANNEL(ttydrv);
-
-/**********************************************************************/
-
-extern DeviceCaps TTYDRV_DC_DevCaps;
-
-/***********************************************************************
- *	     TTYDRV_DC_CreateDC
- */
-BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device,
-			LPCSTR output, const DEVMODEA *initData)
-{
-  TTYDRV_PDEVICE *physDev;
-  BITMAPOBJ *bmp;
-
-  TRACE("(%p, %s, %s, %s, %p)\n",
-    dc, debugstr_a(driver), debugstr_a(device), 
-    debugstr_a(output), initData);
-
-  dc->physDev = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
-			  sizeof(TTYDRV_PDEVICE));  
-  if(!dc->physDev) {
-    ERR("Can't allocate physDev\n");
-    return FALSE;
-  }
-  physDev = (TTYDRV_PDEVICE *) dc->physDev;
-  
-  dc->w.devCaps = &TTYDRV_DC_DevCaps;
-
-  if(dc->w.flags & DC_MEMORY){
-    physDev->window = NULL;
-    physDev->cellWidth = 1;
-    physDev->cellHeight = 1;
-
-    TTYDRV_DC_CreateBitmap(dc->w.hBitmap);
-    bmp = (BITMAPOBJ *) GDI_GetObjPtr(dc->w.hBitmap, BITMAP_MAGIC);
-				   
-    dc->w.bitsPerPixel = bmp->bitmap.bmBitsPixel;
-    
-    dc->w.totalExtent.left   = 0;
-    dc->w.totalExtent.top    = 0;
-    dc->w.totalExtent.right  = bmp->bitmap.bmWidth;
-    dc->w.totalExtent.bottom = bmp->bitmap.bmHeight;
-    dc->w.hVisRgn            = CreateRectRgnIndirect( &dc->w.totalExtent );
-    
-    GDI_HEAP_UNLOCK( dc->w.hBitmap );
-  } else {
-    physDev->window = TTYDRV_GetRootWindow();
-    physDev->cellWidth = cell_width;
-    physDev->cellHeight = cell_height;
-    
-    dc->w.bitsPerPixel       = 1;
-    dc->w.totalExtent.left   = 0;
-    dc->w.totalExtent.top    = 0;
-    dc->w.totalExtent.right  = cell_width * screen_cols;
-    dc->w.totalExtent.bottom = cell_height * screen_rows;
-    dc->w.hVisRgn            = CreateRectRgnIndirect( &dc->w.totalExtent );    
-  }
-
-  return TRUE;
-}
-
-/***********************************************************************
- *	     TTYDRV_DC_DeleteDC
- */
-BOOL TTYDRV_DC_DeleteDC(DC *dc)
-{
-  TRACE("(%p)\n", dc);
-
-  HeapFree( GetProcessHeap(), 0, dc->physDev );
-  dc->physDev = NULL;
-  
-  return TRUE;
-}
-
-/***********************************************************************
- *           TTYDRV_DC_Escape
- */
-INT TTYDRV_DC_Escape(DC *dc, INT nEscape, INT cbInput,
-		     SEGPTR lpInData, SEGPTR lpOutData)
-{
-  return 0;
-}
-
diff --git a/graphics/ttydrv/dib.c b/graphics/ttydrv/dib.c
deleted file mode 100644
index 1b6ce4d..0000000
--- a/graphics/ttydrv/dib.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * TTY DC dib
- *
- * Copyright 1999 Patrik Stridvall
- */
-
-#include "bitmap.h"
-#include "dc.h"
-#include "ttydrv.h"
-#include "winbase.h"
-#include "debugtools.h"
-
-DEFAULT_DEBUG_CHANNEL(ttydrv)
-
-/***********************************************************************
- *		TTYDRV_BITMAP_CreateDIBSection
- */
-HBITMAP TTYDRV_BITMAP_CreateDIBSection(
-  DC *dc, BITMAPINFO *bmi, UINT usage,
-  LPVOID *bits, HANDLE section, DWORD offset)
-{
-  FIXME("(%p, %p, %u, %p, 0x%04x, %ld): stub\n",
-	dc, bmi, usage, bits, section, offset);
-
-  return (HBITMAP) NULL;
-}
-
-/**********************************************************************
- *		TTYDRV_BITMAP_CreateDIBSection16
- */
-HBITMAP16 TTYDRV_DIB_CreateDIBSection16(
-  DC *dc, BITMAPINFO *bmi, UINT16 usage,
-  SEGPTR *bits, HANDLE section, DWORD offset)
-{
-  FIXME("(%p, %p, %u, %p, 0x%04x, %ld): stub\n",
-	dc, bmi, usage, bits, section, offset);
-
-  return (HBITMAP16) NULL;
-}
-
-/***********************************************************************
- *		TTYDRV_BITMAP_DeleteDIBSection
- */
-void TTYDRV_BITMAP_DeleteDIBSection(BITMAPOBJ *bmp)
-{
-  FIXME("(%p): stub\n", bmp);
-}
-
-/***********************************************************************
- *		TTYDRV_BITMAP_GetDIBits
- */
-INT TTYDRV_BITMAP_GetDIBits(
-  BITMAPOBJ *bmp, DC *dc, UINT startscan, UINT lines, 
-  LPVOID bits, BITMAPINFO *info, UINT coloruse, HBITMAP hbitmap)
-{
-  FIXME("(%p, %p, %u, %u, %p, %p, %u, 0x%04x): stub\n",
-	bmp, dc, startscan, lines, bits, info, coloruse, hbitmap);
-
-  return 0;
-}
-
-
-/***********************************************************************
- *		TTYDRV_BITMAP_SetDIBits
- */
-INT TTYDRV_BITMAP_SetDIBits(
-  BITMAPOBJ *bmp, DC *dc, UINT startscan, UINT lines, 
-  LPCVOID bits, const BITMAPINFO *info, UINT coloruse, HBITMAP hbitmap)
-{
-  FIXME("(%p, %p, %u, %u, %p, %p, %u, 0x%04x): stub\n",
-	bmp, dc, startscan, lines, bits, info, coloruse, hbitmap);
-
-  return 0;
-}
-
-/***********************************************************************
- *		TTYDRV_DC_SetDIBitsToDevice
- */
-INT TTYDRV_DC_SetDIBitsToDevice(DC *dc, INT xDest, INT yDest, DWORD cx,
-				DWORD cy, INT xSrc, INT ySrc,
-				UINT startscan, UINT lines, LPCVOID bits,
-				const BITMAPINFO *info, UINT coloruse)
-{
-  FIXME("(%p, %d, %d, %ld, %ld, %d, %d, %u, %u, %p, %p, %u): stub\n",
-	dc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, bits, info, coloruse);
-
-  return 0;
-}
-
diff --git a/graphics/ttydrv/font.c b/graphics/ttydrv/font.c
deleted file mode 100644
index 75ab5a0..0000000
--- a/graphics/ttydrv/font.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * TTY font driver
- *
- * Copyright 1999 Patrik Stridvall
- */
-#include "dc.h"
-#include "debugtools.h"
-#include "font.h"
-#include "ttydrv.h"
-#include "wingdi.h"
-
-DEFAULT_DEBUG_CHANNEL(ttydrv)
-
-/***********************************************************************
- *		TTYDRV_DC_GetCharWidth
- */
-BOOL TTYDRV_DC_GetCharWidth(DC *dc, UINT firstChar, UINT lastChar,
-			    LPINT buffer)
-{
-  UINT c;
-  TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev;
-
-  FIXME("(%p, %u, %u, %p): semistub\n", dc, firstChar, lastChar, buffer);
-
-  for(c=firstChar; c<=lastChar; c++) {
-    buffer[c-firstChar] = physDev->cellWidth;
-  }
-
-  return TRUE;
-}
-
-/***********************************************************************
- *		TTYDRV_DC_GetTextExtentPoint
- */
-BOOL TTYDRV_DC_GetTextExtentPoint(DC *dc, LPCWSTR str, INT count,
-				  LPSIZE size)
-{
-  TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev;
-
-  TRACE("(%p, %s, %d, %p)\n", dc, debugstr_wn(str, count), count, size);
-
-  size->cx = count * physDev->cellWidth;
-  size->cy = physDev->cellHeight;
-
-  return TRUE;
-}
-
-/***********************************************************************
- *		TTYDRV_DC_GetTextMetrics
- */
-BOOL TTYDRV_DC_GetTextMetrics(DC *dc, LPTEXTMETRICA lptm)
-{
-  TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev;
-
-  TRACE("(%p, %p)\n", dc, lptm);
-
-  lptm->tmHeight = physDev->cellHeight;
-  lptm->tmAscent = 0;
-  lptm->tmDescent = 0;
-  lptm->tmInternalLeading = 0;
-  lptm->tmExternalLeading = 0;
-  lptm->tmAveCharWidth = physDev->cellWidth; 
-  lptm->tmMaxCharWidth = physDev->cellWidth;
-  lptm->tmWeight = FW_MEDIUM;
-  lptm->tmOverhang = 0;
-  lptm->tmDigitizedAspectX = physDev->cellWidth;
-  lptm->tmDigitizedAspectY = physDev->cellHeight;
-  lptm->tmFirstChar = 32;
-  lptm->tmLastChar = 255;
-  lptm->tmDefaultChar = 0;
-  lptm->tmBreakChar = 32;
-  lptm->tmItalic = FALSE;
-  lptm->tmUnderlined = FALSE;
-  lptm->tmStruckOut = FALSE;
-  lptm->tmPitchAndFamily = TMPF_FIXED_PITCH|TMPF_DEVICE;
-  lptm->tmCharSet = ANSI_CHARSET;
-
-  return TRUE;
-}
-
-/***********************************************************************
- *		TTYDRV_DC_FONT_SelectObject
- */
-HFONT TTYDRV_DC_FONT_SelectObject(DC* dc, HFONT hfont, FONTOBJ *font)
-{
-  HFONT hPreviousFont;
-
-  TRACE("(%p, 0x%04x, %p)\n", dc, hfont, font);
-
-  hPreviousFont = dc->w.hFont;
-  dc->w.hFont = hfont;
-
-  return hPreviousFont;
-}
diff --git a/graphics/ttydrv/oembitmap.c b/graphics/ttydrv/oembitmap.c
deleted file mode 100644
index d4060b9..0000000
--- a/graphics/ttydrv/oembitmap.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * TTY DC OEM bitmap
- *
- * Copyright 1999 Patrik Stridvall
- */
-
-#include "bitmap.h"
-#include "ttydrv.h"
-#include "debugtools.h"
-
-DEFAULT_DEBUG_CHANNEL(ttydrv)
-
-/**********************************************************************
- *		TTYDRV_LoadOEMBitmap
- */
-static HANDLE TTYDRV_LoadOEMBitmap(WORD resid)
-{
-  HBITMAP hbitmap;
-
-  TRACE("(%d)\n", resid);
- 
-  hbitmap = CreateBitmap(1, 1, 1, 1, NULL);
-  TTYDRV_DC_CreateBitmap(hbitmap);
-
-  return hbitmap;
-}
-
-/**********************************************************************
- *		TTYDRV_LoadOEMCursorIcon
- */
-static HANDLE TTYDRV_LoadOEMCursorIcon(WORD resid, BOOL bCursor)
-{
-  return (HANDLE) NULL;
-}
-
-/**********************************************************************
- *		TTYDRV_LoadOEMResource
- */
-HANDLE TTYDRV_LoadOEMResource(WORD resid, WORD type)
-{
-  switch(type)
-  {
-    case OEM_BITMAP:
-      return TTYDRV_LoadOEMBitmap(resid);
-    case OEM_CURSOR:
-      return TTYDRV_LoadOEMCursorIcon(resid, TRUE);
-    case OEM_ICON:
-      return TTYDRV_LoadOEMCursorIcon(resid, FALSE);
-    default:
-      ERR("unknown type (%d)\n", type);
-  }
-
-  return (HANDLE) NULL;
-}
diff --git a/graphics/ttydrv/pen.c b/graphics/ttydrv/pen.c
deleted file mode 100644
index 45fed40..0000000
--- a/graphics/ttydrv/pen.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * TTY DC pen
- *
- * Copyright 1999 Patrik Stridvall
- */
-
-#include "dc.h"
-#include "debugtools.h"
-#include "pen.h"
-#include "ttydrv.h"
-
-DEFAULT_DEBUG_CHANNEL(ttydrv)
-
-/***********************************************************************
- *		TTYDRV_DC_PEN_SelectObject
- */
-HPEN TTYDRV_DC_PEN_SelectObject(DC *dc, HBRUSH hpen, PENOBJ *pen)
-{
-  HPEN hPreviousPen;
-
-  TRACE("(%p, 0x%04x, %p)\n", dc, hpen, pen);
-
-  hPreviousPen = dc->w.hPen;
-  dc->w.hPen = hpen;
-
-  return hPreviousPen;
-}
diff --git a/graphics/ttydrv/text.c b/graphics/ttydrv/text.c
deleted file mode 100644
index db35deb..0000000
--- a/graphics/ttydrv/text.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * TTY DC text
- *
- * Copyright 1999 Patrik Stridvall
- */
-
-#include "config.h"
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "dc.h"
-#include "debugtools.h"
-#include "gdi.h"
-#include "ttydrv.h"
-
-DEFAULT_DEBUG_CHANNEL(ttydrv);
-
-/***********************************************************************
- *		TTYDRV_DC_ExtTextOut
- */
-BOOL TTYDRV_DC_ExtTextOut(DC *dc, INT x, INT y, UINT flags,
-			  const RECT *lpRect, LPCWSTR str, UINT count,
-			  const INT *lpDx)
-{
-#ifdef WINE_CURSES
-  TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev;
-  INT row, col;
-  LPSTR ascii;
-
-  TRACE("(%p, %d, %d, 0x%08x, %p, %s, %d, %p)\n",
-	dc, x, y, flags, lpRect, debugstr_wn(str, count), count, lpDx);
-
-  if(!physDev->window)
-    return FALSE;
-
-  /* FIXME: Is this really correct? */
-  if(dc->w.textAlign & TA_UPDATECP) {
-    x = dc->w.CursPosX;
-    y = dc->w.CursPosY;
-  }
-
-  x = XLPTODP(dc, x);
-  y = YLPTODP(dc, y);
-  
-  row = (dc->w.DCOrgY + y) / physDev->cellHeight;
-  col = (dc->w.DCOrgX + x) / physDev->cellWidth;
-  ascii = HeapAlloc( GetProcessHeap(), 0, count+1 );
-  lstrcpynWtoA(ascii, str, count+1);
-  mvwaddnstr(physDev->window, row, col, ascii, count);
-  HeapFree( GetProcessHeap(), 0, ascii );
-  wrefresh(physDev->window);
-
-  if(dc->w.textAlign & TA_UPDATECP) {
-    dc->w.CursPosX += count * physDev->cellWidth;
-    dc->w.CursPosY += physDev->cellHeight;
-  }
-
-  return TRUE;
-#else /* defined(WINE_CURSES) */
-  FIXME("(%p, %d, %d, 0x%08x, %p, %s, %d, %p): stub\n",
-	dc, x, y, flags, lpRect, debugstr_wn(str,count), count, lpDx);
-
-  return TRUE;
-#endif /* defined(WINE_CURSES) */
-}
diff --git a/include/clipboard.h b/include/clipboard.h
index f6439fb..c1173bb 100644
--- a/include/clipboard.h
+++ b/include/clipboard.h
@@ -18,20 +18,6 @@
     struct tagWINE_CLIPFORMAT *NextFormat;
 } WINE_CLIPFORMAT, *LPWINE_CLIPFORMAT;
 
-typedef struct tagCLIPBOARD_DRIVER
-{
-    void (*pAcquire)(void);                     /* Acquire selection */
-    void (*pRelease)(void);                     /* Release selection */
-    void (*pSetData)(UINT);                     /* Set specified selection data */
-    BOOL (*pGetData)(UINT);                     /* Get specified selection data */
-    BOOL (*pIsFormatAvailable)(UINT);           /* Check if specified format is available */
-    BOOL (*pRegisterFormat)(LPCSTR);            /* Register a clipboard format */
-    BOOL (*pIsSelectionOwner)(void);            /* Check if we own the selection */
-    void (*pResetOwner)(struct tagWND *, BOOL);
-} CLIPBOARD_DRIVER;
-
-extern CLIPBOARD_DRIVER *CLIPBOARD_Driver;
-
 extern LPWINE_CLIPFORMAT CLIPBOARD_LookupFormat( WORD wID );
 extern BOOL CLIPBOARD_IsCacheRendered();
 extern void CLIPBOARD_DeleteRecord(LPWINE_CLIPFORMAT lpFormat, BOOL bChange);
@@ -40,5 +26,4 @@
 extern char * CLIPBOARD_GetFormatName(UINT wFormat);
 extern void CLIPBOARD_ReleaseOwner();
 
-
 #endif /* __WINE_CLIPBOARD_H */
diff --git a/include/user.h b/include/user.h
index a91da00..a4cf5a8 100644
--- a/include/user.h
+++ b/include/user.h
@@ -39,6 +39,8 @@
 
 typedef VOID CALLBACK (*LPMOUSE_EVENT_PROC)(DWORD,DWORD,DWORD,DWORD,DWORD);
 
+struct tagWND;
+
 typedef struct tagUSER_DRIVER {
     /* event functions */
     void   (*pSynchronize)(void);
@@ -67,12 +69,21 @@
     int    (*pGetScreenSaveTimeout)(void);
     void   (*pSetScreenSaveTimeout)(int);
     /* resource functions */
-    HANDLE   (*pLoadOEMResource)(WORD,WORD);
+    HANDLE (*pLoadOEMResource)(WORD,WORD);
     /* windowing functions */
     BOOL   (*pIsSingleWindow)(void);
+    /* clipboard functions */
+    void   (*pAcquireClipboard)(void);            /* Acquire selection */
+    void   (*pReleaseClipboard)(void);            /* Release selection */
+    void   (*pSetClipboardData)(UINT);            /* Set specified selection data */
+    BOOL   (*pGetClipboardData)(UINT);            /* Get specified selection data */
+    BOOL   (*pIsClipboardFormatAvailable)(UINT);  /* Check if specified format is available */
+    BOOL   (*pRegisterClipboardFormat)(LPCSTR);   /* Register a clipboard format */
+    BOOL   (*pIsSelectionOwner)(void);            /* Check if we own the selection */
+    void   (*pResetSelectionOwner)(struct tagWND *, BOOL);
 } USER_DRIVER;
 
-extern USER_DRIVER *USER_Driver;
+extern USER_DRIVER USER_Driver;
 
 WORD WINAPI UserSignalProc( UINT uCode, DWORD dwThreadOrProcessID,
                             DWORD dwFlags, HMODULE16 hModule );
diff --git a/include/x11drv.h b/include/x11drv.h
index 7887971..adbaa88 100644
--- a/include/x11drv.h
+++ b/include/x11drv.h
@@ -331,41 +331,23 @@
 static inline Window X11DRV_GetXRootWindow(void) { return root_window; }
 static inline unsigned int X11DRV_GetDepth(void) { return screen_depth; }
 
-extern BOOL X11DRV_GetScreenSaveActive(void);
-extern void X11DRV_SetScreenSaveActive(BOOL bActivate);
-extern int X11DRV_GetScreenSaveTimeout(void);
-extern void X11DRV_SetScreenSaveTimeout(int nTimeout);
-extern HANDLE X11DRV_LoadOEMResource( WORD id, WORD type );
-extern BOOL X11DRV_IsSingleWindow(void);
-
 /* X11 clipboard driver */
 
-extern struct tagCLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver;
-
 extern void X11DRV_CLIPBOARD_FreeResources( Atom property );
 extern BOOL X11DRV_CLIPBOARD_RegisterPixmapResource( Atom property, Pixmap pixmap );
-    
-extern void X11DRV_CLIPBOARD_Acquire(void);
-extern void X11DRV_CLIPBOARD_Release(void);
-extern void X11DRV_CLIPBOARD_SetData(UINT wFormat);
-extern BOOL X11DRV_CLIPBOARD_GetData(UINT wFormat);
-extern BOOL X11DRV_CLIPBOARD_IsFormatAvailable(UINT wFormat);
 extern BOOL X11DRV_CLIPBOARD_IsNativeProperty(Atom prop);
-extern BOOL X11DRV_CLIPBOARD_RegisterFormat( LPCSTR FormatName );
-extern BOOL X11DRV_CLIPBOARD_IsSelectionowner();
 extern UINT X11DRV_CLIPBOARD_MapPropertyToFormat(char *itemFmtName);
 extern Atom X11DRV_CLIPBOARD_MapFormatToProperty(UINT id);
-extern void X11DRV_CLIPBOARD_ResetOwner(struct tagWND *pWnd, BOOL bFooBar);
 extern void X11DRV_CLIPBOARD_ReleaseSelection(Atom selType, Window w, HWND hwnd);
+extern BOOL X11DRV_IsSelectionOwner(void);
+extern BOOL X11DRV_GetClipboardData(UINT wFormat);
 
 /* X11 event driver */
 
 extern WORD X11DRV_EVENT_XStateToKeyState( int state ) ;
 
 extern BOOL X11DRV_EVENT_Init(void);
-extern void X11DRV_EVENT_Synchronize( void );
-extern BOOL X11DRV_EVENT_CheckFocus( void );
-extern void X11DRV_EVENT_UserRepaintDisable( BOOL bDisable );
+extern void X11DRV_Synchronize( void );
 
 typedef enum {
   X11DRV_INPUT_RELATIVE,
@@ -380,27 +362,24 @@
 
 /* X11 keyboard driver */
 
-extern void X11DRV_KEYBOARD_Init(void);
-extern WORD X11DRV_KEYBOARD_VkKeyScan(CHAR cChar);
-extern UINT16 X11DRV_KEYBOARD_MapVirtualKey(UINT16 wCode, UINT16 wMapType);
-extern INT16 X11DRV_KEYBOARD_GetKeyNameText(LONG lParam, LPSTR lpBuffer, INT16 nSize);
-extern INT16 X11DRV_KEYBOARD_ToAscii(UINT16 virtKey, UINT16 scanCode, LPBYTE lpKeyState, LPVOID lpChar, UINT16 flags);
-extern BOOL X11DRV_KEYBOARD_GetBeepActive(void);
-extern void X11DRV_KEYBOARD_SetBeepActive(BOOL bActivate);
-extern void X11DRV_KEYBOARD_Beep(void);
-extern BOOL X11DRV_KEYBOARD_GetDIState(DWORD len, LPVOID ptr);
-extern BOOL X11DRV_KEYBOARD_GetDIData(BYTE *keystate, DWORD dodsize, struct DIDEVICEOBJECTDATA *dod, LPDWORD entries, DWORD flags);
-extern void X11DRV_KEYBOARD_GetKeyboardConfig(struct tagKEYBOARD_CONFIG *cfg);
-extern void X11DRV_KEYBOARD_SetKeyboardConfig(struct tagKEYBOARD_CONFIG *cfg, DWORD mask);
+extern void X11DRV_InitKeyboard(void);
+extern WORD X11DRV_VkKeyScan(CHAR cChar);
+extern UINT16 X11DRV_MapVirtualKey(UINT16 wCode, UINT16 wMapType);
+extern INT16 X11DRV_GetKeyNameText(LONG lParam, LPSTR lpBuffer, INT16 nSize);
+extern INT16 X11DRV_ToAscii(UINT16 virtKey, UINT16 scanCode, LPBYTE lpKeyState, LPVOID lpChar, UINT16 flags);
+extern BOOL X11DRV_GetDIState(DWORD len, LPVOID ptr);
+extern BOOL X11DRV_GetDIData(BYTE *keystate, DWORD dodsize, struct DIDEVICEOBJECTDATA *dod, LPDWORD entries, DWORD flags);
+extern void X11DRV_GetKeyboardConfig(struct tagKEYBOARD_CONFIG *cfg);
+extern void X11DRV_SetKeyboardConfig(struct tagKEYBOARD_CONFIG *cfg, DWORD mask);
 
-extern void X11DRV_KEYBOARD_HandleEvent(struct tagWND *pWnd, XKeyEvent *event);
+extern void X11DRV_HandleEvent(struct tagWND *pWnd, XKeyEvent *event);
 
 /* X11 mouse driver */
 
-extern void X11DRV_MOUSE_Init(LPMOUSE_EVENT_PROC);
-extern void X11DRV_MOUSE_SetCursor(struct tagCURSORICONINFO *lpCursor);
-extern void X11DRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY);
-extern void X11DRV_MOUSE_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY,
+extern void X11DRV_InitMouse(LPMOUSE_EVENT_PROC);
+extern void X11DRV_SetCursor(struct tagCURSORICONINFO *lpCursor);
+extern void X11DRV_MoveCursor(WORD wAbsX, WORD wAbsY);
+extern void X11DRV_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY,
                                     DWORD keyState, DWORD time, HWND hWnd );
 
 /* X11 windows driver */
diff --git a/misc/main.c b/misc/main.c
index 6ad71a4..1ba0d83 100644
--- a/misc/main.c
+++ b/misc/main.c
@@ -25,18 +25,12 @@
 #include "debugdefs.h"
 #include "module.h"
 #include "winnls.h"
-#include "user.h"
 #include "windef.h"
 #include "wingdi.h"
 #include "wine/winuser16.h"
 #include "tweak.h"
 #include "winerror.h"
 
-/**********************************************************************/
-
-USER_DRIVER *USER_Driver = NULL;
-
-
 
 /***********************************************************************
  *          MAIN_ParseDebugOptions
diff --git a/windows/clipboard.c b/windows/clipboard.c
index 0977a87..bb44967 100644
--- a/windows/clipboard.c
+++ b/windows/clipboard.c
@@ -32,10 +32,11 @@
 #include "message.h"
 #include "task.h"
 #include "queue.h"
+#include "user.h"
 #include "clipboard.h"
 #include "debugtools.h"
 
-DEFAULT_DEBUG_CHANNEL(clipboard)
+DEFAULT_DEBUG_CHANNEL(clipboard);
 
 #define  CF_REGFORMATBASE 	0xC000
 
@@ -43,8 +44,6 @@
  *	  Clipboard context global variables
  */
 
-CLIPBOARD_DRIVER *CLIPBOARD_Driver = NULL;
-
 static HANDLE hClipLock   = 0;
 static BOOL bCBHasChanged  = FALSE;
 
@@ -60,24 +59,24 @@
  * declared in clipboard.h
  */
 WINE_CLIPFORMAT ClipFormats[17]  = {
-    { CF_TEXT, 1, 0, "Text",  (HANDLE16)NULL, (HANDLE)NULL, (HANDLE)NULL, 0, NULL, &ClipFormats[1]},
-    { CF_BITMAP, 1, 0, "Bitmap", (HANDLE16)NULL, (HANDLE)NULL, (HANDLE)NULL, 0, &ClipFormats[0], &ClipFormats[2]},
-    { CF_METAFILEPICT, 1, 0, "MetaFile Picture", (HANDLE16)NULL, (HANDLE)NULL, (HANDLE)NULL, 0, &ClipFormats[1], &ClipFormats[3]},
-    { CF_SYLK, 1, 0, "Sylk", (HANDLE16)NULL, (HANDLE)NULL, (HANDLE)NULL, 0, &ClipFormats[2], &ClipFormats[4]},
-    { CF_DIF, 1, 0, "DIF", (HANDLE16)NULL, (HANDLE)NULL, (HANDLE)NULL, 0, &ClipFormats[3], &ClipFormats[5]},
-    { CF_TIFF, 1, 0, "TIFF", (HANDLE16)NULL, (HANDLE)NULL, (HANDLE)NULL, 0, &ClipFormats[4], &ClipFormats[6]},
-    { CF_OEMTEXT, 1, 0, "OEM Text", (HANDLE16)NULL, (HANDLE)NULL, (HANDLE)NULL, 0, &ClipFormats[5], &ClipFormats[7]},
-    { CF_DIB, 1, 0, "DIB", (HANDLE16)NULL, (HANDLE)NULL, (HANDLE)NULL, 0, &ClipFormats[6], &ClipFormats[8]},
-    { CF_PALETTE, 1, 0, "Palette", (HANDLE16)NULL, (HANDLE)NULL, (HANDLE)NULL, 0, &ClipFormats[7], &ClipFormats[9]},
-    { CF_PENDATA, 1, 0, "PenData", (HANDLE16)NULL, (HANDLE)NULL, (HANDLE)NULL, 0, &ClipFormats[8], &ClipFormats[10]},
-    { CF_RIFF, 1, 0, "RIFF", (HANDLE16)NULL, (HANDLE)NULL, (HANDLE)NULL, 0, &ClipFormats[9], &ClipFormats[11]},
-    { CF_WAVE, 1, 0, "Wave", (HANDLE16)NULL, (HANDLE)NULL, (HANDLE)NULL, 0, &ClipFormats[10], &ClipFormats[12]},
-    { CF_OWNERDISPLAY, 1, 0, "Owner Display", (HANDLE16)NULL, (HANDLE)NULL, (HANDLE)NULL, 0, &ClipFormats[11], &ClipFormats[13]},
-    { CF_DSPTEXT, 1, 0, "DSPText", (HANDLE16)NULL, (HANDLE)NULL, (HANDLE)NULL, 0, &ClipFormats[12], &ClipFormats[14]},
-    { CF_DSPMETAFILEPICT, 1, 0, "DSPMetaFile Picture", (HANDLE16)NULL, (HANDLE)NULL, (HANDLE)NULL, 0, &ClipFormats[13], &ClipFormats[15]},
-    { CF_DSPBITMAP, 1, 0, "DSPBitmap", (HANDLE16)NULL, (HANDLE)NULL, (HANDLE)NULL, 0, &ClipFormats[14], &ClipFormats[16]},
-    { CF_HDROP, 1, 0, "HDROP", (HANDLE16)NULL, (HANDLE)NULL, (HANDLE)NULL, 0, &ClipFormats[15], NULL}
-    };
+    { CF_TEXT, 1, 0, "Text",  0, 0, 0, 0, NULL, &ClipFormats[1]},
+    { CF_BITMAP, 1, 0, "Bitmap", 0, 0, 0, 0, &ClipFormats[0], &ClipFormats[2]},
+    { CF_METAFILEPICT, 1, 0, "MetaFile Picture", 0, 0, 0, 0, &ClipFormats[1], &ClipFormats[3]},
+    { CF_SYLK, 1, 0, "Sylk", 0, 0, 0, 0, &ClipFormats[2], &ClipFormats[4]},
+    { CF_DIF, 1, 0, "DIF", 0, 0, 0, 0, &ClipFormats[3], &ClipFormats[5]},
+    { CF_TIFF, 1, 0, "TIFF", 0, 0, 0, 0, &ClipFormats[4], &ClipFormats[6]},
+    { CF_OEMTEXT, 1, 0, "OEM Text", 0, 0, 0, 0, &ClipFormats[5], &ClipFormats[7]},
+    { CF_DIB, 1, 0, "DIB", 0, 0, 0, 0, &ClipFormats[6], &ClipFormats[8]},
+    { CF_PALETTE, 1, 0, "Palette", 0, 0, 0, 0, &ClipFormats[7], &ClipFormats[9]},
+    { CF_PENDATA, 1, 0, "PenData", 0, 0, 0, 0, &ClipFormats[8], &ClipFormats[10]},
+    { CF_RIFF, 1, 0, "RIFF", 0, 0, 0, 0, &ClipFormats[9], &ClipFormats[11]},
+    { CF_WAVE, 1, 0, "Wave", 0, 0, 0, 0, &ClipFormats[10], &ClipFormats[12]},
+    { CF_OWNERDISPLAY, 1, 0, "Owner Display", 0, 0, 0, 0, &ClipFormats[11], &ClipFormats[13]},
+    { CF_DSPTEXT, 1, 0, "DSPText", 0, 0, 0, 0, &ClipFormats[12], &ClipFormats[14]},
+    { CF_DSPMETAFILEPICT, 1, 0, "DSPMetaFile Picture", 0, 0, 0, 0, &ClipFormats[13], &ClipFormats[15]},
+    { CF_DSPBITMAP, 1, 0, "DSPBitmap", 0, 0, 0, 0, &ClipFormats[14], &ClipFormats[16]},
+    { CF_HDROP, 1, 0, "HDROP", 0, 0, 0, 0, &ClipFormats[15], NULL}
+};
 
 
 /**************************************************************************
@@ -389,10 +388,10 @@
    * If WINE is not the selection owner, and the format is available
    * we must ask the the driver to render the data to the clipboard cache.
    */
-  if ( !CLIPBOARD_Driver->pIsSelectionOwner() 
-       && CLIPBOARD_Driver->pIsFormatAvailable( lpFormat->wFormatID ) )
+  if ( !USER_Driver.pIsSelectionOwner() 
+       && USER_Driver.pIsClipboardFormatAvailable( lpFormat->wFormatID ) )
   {
-    if ( !CLIPBOARD_Driver->pGetData( lpFormat->wFormatID ) )
+    if ( !USER_Driver.pGetClipboardData( lpFormat->wFormatID ) )
       return FALSE;
   }
   /*
@@ -621,7 +620,7 @@
     hTaskClipOwner = GetCurrentTask();
     
     /* Tell the driver to acquire the selection */
-    CLIPBOARD_Driver->pAcquire();
+    USER_Driver.pAcquireClipboard();
 
     return TRUE;
 }
@@ -673,7 +672,7 @@
     }
 
     /* Pass on the request to the driver */
-    CLIPBOARD_Driver->pSetData(wFormat);
+    USER_Driver.pSetClipboardData(wFormat);
 
     if ( lpFormat->wDataPresent || lpFormat->hData16 || lpFormat->hData32 ) 
     {
@@ -726,7 +725,7 @@
     }
 
     /* Tell the driver to acquire the selection */
-    CLIPBOARD_Driver->pAcquire();
+    USER_Driver.pAcquireClipboard();
 
     if ( lpFormat->wDataPresent &&
          (lpFormat->hData16 || lpFormat->hData32) )
@@ -927,8 +926,8 @@
            *    available to the clipboard driver.
            */
           if ( lpFormat->wDataPresent ||
-               ( !CLIPBOARD_Driver->pIsSelectionOwner()
-                 && CLIPBOARD_Driver->pIsFormatAvailable( lpFormat->wFormatID ) ) )
+               ( !USER_Driver.pIsSelectionOwner()
+                 && USER_Driver.pIsClipboardFormatAvailable( lpFormat->wFormatID ) ) )
           {
               TRACE("\tdata found for format 0x%04x(%s)\n",
                     lpFormat->wFormatID, CLIPBOARD_GetFormatName(lpFormat->wFormatID));
@@ -995,10 +994,10 @@
 	   (lpFormat->wFormatID == CF_TEXT && ClipFormats[CF_OEMTEXT-1].wDataPresent) );
 
         /* Query the driver if not yet in the cache */
-        if (!bFormatPresent && !CLIPBOARD_Driver->pIsSelectionOwner())
+        if (!bFormatPresent && !USER_Driver.pIsSelectionOwner())
         {
             bFormatPresent =
-               CLIPBOARD_Driver->pIsFormatAvailable( (lpFormat->wFormatID == CF_TEXT) ?
+               USER_Driver.pIsClipboardFormatAvailable( (lpFormat->wFormatID == CF_TEXT) ?
                                                       CF_OEMTEXT : lpFormat->wFormatID );
         }
 
@@ -1066,7 +1065,7 @@
     lpNewFormat->NextFormat = NULL;
 
     /* Pass on the registration request to the driver */
-    CLIPBOARD_Driver->pRegisterFormat( FormatName );
+    USER_Driver.pRegisterClipboardFormat( FormatName );
     
     return LastRegFormat++;
 }
@@ -1231,8 +1230,8 @@
         bRet = FALSE;
 
     /* If WINE is not the clipboard selection owner ask the clipboard driver */
-    else if ( !CLIPBOARD_Driver->pIsSelectionOwner() )
-        bRet = CLIPBOARD_Driver->pIsFormatAvailable( (wFormat == CF_TEXT) ?
+    else if ( !USER_Driver.pIsSelectionOwner() )
+        bRet = USER_Driver.pIsClipboardFormatAvailable( (wFormat == CF_TEXT) ?
                                                      CF_OEMTEXT : wFormat );
     /* Check if the format is in the local cache */
     else 
diff --git a/windows/cursoricon.c b/windows/cursoricon.c
index 7b37d4a..437be3a 100644
--- a/windows/cursoricon.c
+++ b/windows/cursoricon.c
@@ -707,7 +707,7 @@
             }
         }
         else resid = LOWORD(name);
-        h = USER_Driver->pLoadOEMResource( resid, fCursor ? OEM_CURSOR : OEM_ICON );
+        h = USER_Driver.pLoadOEMResource( resid, fCursor ? OEM_CURSOR : OEM_ICON );
     }
 
     else  /* Load from resource */
@@ -1392,7 +1392,7 @@
     /* Change the cursor shape only if it is visible */
     if (CURSOR_ShowCount >= 0)
     {
-        USER_Driver->pSetCursor( (CURSORICONINFO*)GlobalLock16( hActiveCursor ) );
+        USER_Driver.pSetCursor( (CURSORICONINFO*)GlobalLock16( hActiveCursor ) );
         GlobalUnlock16( hActiveCursor );
     }
     return hOldCursor;
@@ -1413,7 +1413,7 @@
  */
 BOOL WINAPI SetCursorPos( INT x, INT y )
 {
-    USER_Driver->pMoveCursor( x, y );
+    USER_Driver.pMoveCursor( x, y );
     return TRUE;
 }
 
@@ -1439,14 +1439,14 @@
     {
         if (++CURSOR_ShowCount == 0)  /* Show it */
         {
-            USER_Driver->pSetCursor( (CURSORICONINFO*)GlobalLock16( hActiveCursor ) );
+            USER_Driver.pSetCursor( (CURSORICONINFO*)GlobalLock16( hActiveCursor ) );
             GlobalUnlock16( hActiveCursor );
         }
     }
     else
     {
         if (--CURSOR_ShowCount == -1)  /* Hide it */
-            USER_Driver->pSetCursor( NULL );
+            USER_Driver.pSetCursor( NULL );
     }
     return CURSOR_ShowCount;
 }
@@ -2096,7 +2096,7 @@
       if (!instance)  /* OEM bitmap */
       {
 	  if (HIWORD((int)name)) return 0;
-          return USER_Driver->pLoadOEMResource( LOWORD((int)name), OEM_BITMAP );
+          return USER_Driver.pLoadOEMResource( LOWORD((int)name), OEM_BITMAP );
       }
 
       if (!(hRsrc = FindResourceW( instance, name, RT_BITMAPW ))) return 0;
diff --git a/windows/dce.c b/windows/dce.c
index c19f8b0..d6492e2 100644
--- a/windows/dce.c
+++ b/windows/dce.c
@@ -838,7 +838,7 @@
             WIN_ReleaseWndPtr(parentPtr);
         }
         else
-	    if ((hwnd == GetDesktopWindow()) && !USER_Driver->pIsSingleWindow())
+	    if ((hwnd == GetDesktopWindow()) && !USER_Driver.pIsSingleWindow())
                  hrgnVisible = CreateRectRgn( 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN) );
 	    else 
             {
diff --git a/windows/event.c b/windows/event.c
index 37dd5b9..da5041e6 100644
--- a/windows/event.c
+++ b/windows/event.c
@@ -20,7 +20,7 @@
 void EVENT_Synchronize( void )
 {
     int iWndsLocks = WIN_SuspendWndsLock();
-    USER_Driver->pSynchronize();
+    USER_Driver.pSynchronize();
     WIN_RestoreWndsLock(iWndsLocks);
 }
 
@@ -29,7 +29,7 @@
  */
 BOOL EVENT_CheckFocus(void)
 {
-  return USER_Driver->pCheckFocus();
+  return USER_Driver.pCheckFocus();
 }
 
 
diff --git a/windows/keyboard.c b/windows/keyboard.c
index ccfe803..83e0dd4 100644
--- a/windows/keyboard.c
+++ b/windows/keyboard.c
@@ -66,7 +66,7 @@
   /* all states to false */
   memset( lpKeyState, 0, 256 );
   
-  if (!initDone) USER_Driver->pInitKeyboard();
+  if (!initDone) USER_Driver.pInitKeyboard();
   initDone = TRUE;
 }
 
@@ -180,7 +180,7 @@
 
 WORD WINAPI VkKeyScan16(CHAR cChar)
 {
-    return USER_Driver->pVkKeyScan(cChar);
+    return USER_Driver.pVkKeyScan(cChar);
 }
 
 /******************************************************************************
@@ -213,7 +213,7 @@
  */
 UINT16 WINAPI MapVirtualKey16(UINT16 wCode, UINT16 wMapType)
 {
-    return USER_Driver->pMapVirtualKey(wCode,wMapType);
+    return USER_Driver.pMapVirtualKey(wCode,wMapType);
 }
 
 /****************************************************************************
@@ -230,7 +230,7 @@
  */
 INT16 WINAPI GetKeyNameText16(LONG lParam, LPSTR lpBuffer, INT16 nSize)
 {
-    return USER_Driver->pGetKeyNameText(lParam, lpBuffer, nSize);
+    return USER_Driver.pGetKeyNameText(lParam, lpBuffer, nSize);
 }
 
 /****************************************************************************
@@ -254,7 +254,7 @@
 INT16 WINAPI ToAscii16(UINT16 virtKey,UINT16 scanCode, LPBYTE lpKeyState, 
                        LPVOID lpChar, UINT16 flags) 
 {
-    return USER_Driver->pToAscii( virtKey, scanCode, lpKeyState, lpChar, flags );
+    return USER_Driver.pToAscii( virtKey, scanCode, lpKeyState, lpChar, flags );
 }
 
 /***********************************************************************
@@ -262,7 +262,7 @@
  */
 BOOL KEYBOARD_GetBeepActive()
 {
-    return USER_Driver->pGetBeepActive();
+    return USER_Driver.pGetBeepActive();
 }
 
 /***********************************************************************
@@ -270,7 +270,7 @@
  */
 void KEYBOARD_SetBeepActive(BOOL bActivate)
 {
-    USER_Driver->pSetBeepActive(bActivate);
+    USER_Driver.pSetBeepActive(bActivate);
 }
 
 /***********************************************************************
@@ -286,6 +286,6 @@
  */
 BOOL WINAPI MessageBeep( UINT i )
 {
-    USER_Driver->pBeep();
+    USER_Driver.pBeep();
     return TRUE;
 }
diff --git a/windows/sysparams.c b/windows/sysparams.c
index 0a3ff01..00d65e8 100644
--- a/windows/sysparams.c
+++ b/windows/sysparams.c
@@ -91,7 +91,7 @@
 		break;
 
 	case SPI_GETSCREENSAVEACTIVE:	        
-	       if(USER_Driver->pGetScreenSaveActive() || 
+	       if(USER_Driver.pGetScreenSaveActive() || 
 		  GetProfileIntA( "windows", "ScreenSaveActive", 1 ) == 1)
 	        	*(BOOL*)lpvParam = TRUE;
 		else
@@ -99,7 +99,7 @@
 		break;
 
 	case SPI_GETSCREENSAVETIMEOUT:
-	        timeout = USER_Driver->pGetScreenSaveTimeout();
+	        timeout = USER_Driver.pGetScreenSaveTimeout();
 		if(!timeout)
 			timeout = GetProfileIntA( "windows", "ScreenSaveTimeout", 300 );
 		*(INT *) lpvParam = timeout * 1000;
@@ -328,7 +328,7 @@
 			break;
 
 		case SPI_GETSCREENSAVEACTIVE:
-		  if(USER_Driver->pGetScreenSaveActive() ||
+		  if(USER_Driver.pGetScreenSaveActive() ||
 		     GetProfileIntA( "windows", "ScreenSaveActive", 1 ) == 1)
    		        *(BOOL16 *) lpvParam = TRUE;
                     else
@@ -336,7 +336,7 @@
                     break;
 
 		case SPI_GETSCREENSAVETIMEOUT:
-			timeout = USER_Driver->pGetScreenSaveTimeout();
+			timeout = USER_Driver.pGetScreenSaveTimeout();
 			if(!timeout)
 			    timeout = GetProfileIntA( "windows", "ScreenSaveTimeout", 300 );
 			*(INT16 *) lpvParam = timeout;
@@ -363,11 +363,11 @@
 			break;
 
 		case SPI_SETSCREENSAVEACTIVE:
-			USER_Driver->pSetScreenSaveActive(uParam);
+			USER_Driver.pSetScreenSaveActive(uParam);
 			break;
 
 		case SPI_SETSCREENSAVETIMEOUT:
-			USER_Driver->pSetScreenSaveTimeout(uParam);
+			USER_Driver.pSetScreenSaveTimeout(uParam);
 			break;
 
 		case SPI_SETDESKWALLPAPER:
diff --git a/windows/ttydrv/Makefile.in b/windows/ttydrv/Makefile.in
deleted file mode 100644
index 8e24494..0000000
--- a/windows/ttydrv/Makefile.in
+++ /dev/null
@@ -1,20 +0,0 @@
-DEFS      = @DLLFLAGS@ -D__WINE__
-TOPSRCDIR = @top_srcdir@
-TOPOBJDIR = ../..
-SRCDIR    = @srcdir@
-VPATH     = @srcdir@
-MODULE    = ttydrv
-
-C_SRCS = \
-	clipboard.c \
-	event.c \
-	init.c \
-	keyboard.c \
-	mouse.c \
-	wnd.c
-
-all: $(MODULE).o
-
-@MAKE_RULES@
-
-### Dependencies:
diff --git a/windows/ttydrv/clipboard.c b/windows/ttydrv/clipboard.c
deleted file mode 100644
index c9ef3aa..0000000
--- a/windows/ttydrv/clipboard.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * TTY clipboard driver
- *
- * Copyright 1998-1999 Patrik Stridvall
- */
-
-#include "heap.h"
-#include "ttydrv.h"
-#include "win.h"
-
-/**********************************************************************/
-
-char *TTYDRV_CLIPBOARD_szSelection = NULL;
-
-/***********************************************************************
- *		TTYDRV_CLIPBOARD_Acquire
- */
-void TTYDRV_CLIPBOARD_Acquire()
-{
-}
-
-/***********************************************************************
- *		TTYDRV_CLIPBOARD_Release
- */
-void TTYDRV_CLIPBOARD_Release()
-{
-  if(TTYDRV_CLIPBOARD_szSelection)
-    {
-      HeapFree(SystemHeap, 0, TTYDRV_CLIPBOARD_szSelection);
-      TTYDRV_CLIPBOARD_szSelection = NULL;
-    }
-}
-
-/***********************************************************************
- *		TTYDRV_CLIPBOARD_SetData
- */
-void TTYDRV_CLIPBOARD_SetData(UINT wFormat)
-{
-}
-
-/***********************************************************************
- *		TTYDRV_CLIPBOARD_GetData
- */
-BOOL TTYDRV_CLIPBOARD_GetData(UINT wFormat)
-{
-  return FALSE;
-}
-
-/***********************************************************************
- *		TTYDRV_CLIPBOARD_IsFormatAvailable
- */
-BOOL TTYDRV_CLIPBOARD_IsFormatAvailable(UINT wFormat)
-{
-  return FALSE;
-}
-
-/**************************************************************************
- *		TTYDRV_CLIPBOARD_RegisterFormat
- *
- * Registers a custom clipboard format
- * Returns: TRUE - new format registered, FALSE - Format already registered
- */
-BOOL TTYDRV_CLIPBOARD_RegisterFormat( LPCSTR FormatName )
-{
-  return TRUE;
-}
-
-/**************************************************************************
- *		TTYDRV_CLIPBOARD_IsSelectionowner
- *
- * Returns: TRUE - We(WINE) own the selection, FALSE - Selection not owned by us
- */
-BOOL TTYDRV_CLIPBOARD_IsSelectionowner()
-{
-    return FALSE;
-}
-
-/***********************************************************************
- *		TTYDRV_CLIPBOARD_ResetOwner
- */
-void TTYDRV_CLIPBOARD_ResetOwner(WND *pWnd, BOOL bFooBar)
-{
-}
diff --git a/windows/ttydrv/event.c b/windows/ttydrv/event.c
deleted file mode 100644
index 3997379..0000000
--- a/windows/ttydrv/event.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * TTY event driver
- *
- * Copyright 1998-1999 Patrik Stridvall
- */
-
-#include "ttydrv.h"
-
-/***********************************************************************
- *		TTYDRV_EVENT_Synchronize
- */
-void TTYDRV_EVENT_Synchronize( void )
-{
-}
-
-/***********************************************************************
- *		TTYDRV_EVENT_CheckFocus
- */
-BOOL TTYDRV_EVENT_CheckFocus(void)
-{
-  return TRUE;
-}
-
-/***********************************************************************
- *		TTYDRV_EVENT_UserRepaintDisable
- */
-void TTYDRV_EVENT_UserRepaintDisable( BOOL bDisable )
-{
-}
-
diff --git a/windows/ttydrv/init.c b/windows/ttydrv/init.c
deleted file mode 100644
index dedd860..0000000
--- a/windows/ttydrv/init.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * TTY driver
- *
- * Copyright 1998-1999 Patrik Stridvall
- */
-
-#include "clipboard.h"
-#include "user.h"
-#include "win.h"
-#include "ttydrv.h"
-
-CLIPBOARD_DRIVER TTYDRV_CLIPBOARD_Driver =
-{
-  TTYDRV_CLIPBOARD_Acquire,
-  TTYDRV_CLIPBOARD_Release,
-  TTYDRV_CLIPBOARD_SetData,
-  TTYDRV_CLIPBOARD_GetData,
-  TTYDRV_CLIPBOARD_IsFormatAvailable,
-  TTYDRV_CLIPBOARD_RegisterFormat,
-  TTYDRV_CLIPBOARD_IsSelectionowner,
-  TTYDRV_CLIPBOARD_ResetOwner
-};
-
-WND_DRIVER TTYDRV_WND_Driver =
-{
-  TTYDRV_WND_Initialize,
-  TTYDRV_WND_Finalize,
-  TTYDRV_WND_CreateDesktopWindow,
-  TTYDRV_WND_CreateWindow,
-  TTYDRV_WND_DestroyWindow,
-  TTYDRV_WND_SetParent,
-  TTYDRV_WND_ForceWindowRaise,
-  TTYDRV_WND_SetWindowPos,
-  TTYDRV_WND_SetText,
-  TTYDRV_WND_SetFocus,
-  TTYDRV_WND_PreSizeMove,
-  TTYDRV_WND_PostSizeMove,
-  TTYDRV_WND_ScrollWindow,
-  TTYDRV_WND_SetDrawable,
-  TTYDRV_WND_SetHostAttr,
-  TTYDRV_WND_IsSelfClipping,
-  TTYDRV_WND_SetWindowRgn
-};
-
-
diff --git a/windows/ttydrv/keyboard.c b/windows/ttydrv/keyboard.c
deleted file mode 100644
index d03e35c..0000000
--- a/windows/ttydrv/keyboard.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * TTY keyboard driver
- *
- * Copyright 1998 Patrik Stridvall
- */
-
-#include "dinput.h"
-#include "user.h"
-#include "keyboard.h"
-#include "ttydrv.h"
-
-/***********************************************************************
- *		TTYDRV_KEYBOARD_Init
- */
-void TTYDRV_KEYBOARD_Init(void)
-{
-}
-
-/***********************************************************************
- *		TTYDRV_KEYBOARD_VkKeyScan
- */
-WORD TTYDRV_KEYBOARD_VkKeyScan(CHAR cChar)
-{
-  return 0;
-}
-
-/***********************************************************************
- *		TTYDRV_KEYBOARD_MapVirtualKey
- */
-UINT16 TTYDRV_KEYBOARD_MapVirtualKey(UINT16 wCode, UINT16 wMapType)
-{
-  return 0;
-}
-
-/***********************************************************************
- *		TTYDRV_KEYBOARD_GetKeyNameText
- */
-INT16 TTYDRV_KEYBOARD_GetKeyNameText(
-  LONG lParam, LPSTR lpBuffer, INT16 nSize)
-{  
-  if(lpBuffer && nSize)
-    {
-      *lpBuffer = 0;
-    }
-  return 0;
-}
-
-/***********************************************************************
- *		TTYDRV_KEYBOARD_ToAscii
- */
-INT16 TTYDRV_KEYBOARD_ToAscii(
-   UINT16 virtKey, UINT16 scanCode,
-   LPBYTE lpKeyState, LPVOID lpChar, UINT16 flags)
-{
-  return 0;
-}
-
-/***********************************************************************
- *		TTYDRV_KEYBOARD_GetBeepActive
- */
-BOOL TTYDRV_KEYBOARD_GetBeepActive()
-{
-  return FALSE;
-}
-
-/***********************************************************************
- *		TTYDRV_KEYBOARD_SetBeepActive
- */
-void TTYDRV_KEYBOARD_SetBeepActive(BOOL bActivate)
-{
-}
-
-/***********************************************************************
- *		TTYDRV_KEYBOARD_Beep
- */
-void TTYDRV_KEYBOARD_Beep()
-{
-}
-
-/***********************************************************************
- *		TTYDRV_KEYBOARD_GetDIState
- */
-BOOL TTYDRV_KEYBOARD_GetDIState(DWORD len, LPVOID ptr)
-{
-  return TRUE;
-}
-
-/***********************************************************************
- *		TTYDRV_KEYBOARD_GetDIData
- */
-BOOL TTYDRV_KEYBOARD_GetDIData(
-  BYTE *keystate,
-  DWORD dodsize, LPDIDEVICEOBJECTDATA dod,
-  LPDWORD entries, DWORD flags)
-{
-  return TRUE;
-}
-
-/***********************************************************************
- *		TTYDRV_KEYBOARD_GetKeyboardConfig
- */
-void TTYDRV_KEYBOARD_GetKeyboardConfig(KEYBOARD_CONFIG *cfg) {
-
-}
-
-/***********************************************************************
- *		TTYDRV_KEYBOARD_SetKeyboardConfig
- */
-extern void TTYDRV_KEYBOARD_SetKeyboardConfig(KEYBOARD_CONFIG *cfg, DWORD mask) {
-
-}
-
diff --git a/windows/ttydrv/mouse.c b/windows/ttydrv/mouse.c
deleted file mode 100644
index 1804256..0000000
--- a/windows/ttydrv/mouse.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * TTY mouse driver
- *
- * Copyright 1998,1999 Patrik Stridvall
- */
-
-#include "ttydrv.h"
-
-/***********************************************************************
- *		TTYDRV_MOUSE_SetCursor
- */
-void TTYDRV_MOUSE_SetCursor( struct tagCURSORICONINFO *lpCursor )
-{
-}
-
-/***********************************************************************
- *		TTYDRV_MOUSE_MoveCursor
- */
-void TTYDRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY)
-{
-}
-
-/***********************************************************************
- *           TTYDRV_MOUSE_Init
- */
-void TTYDRV_MOUSE_Init(LPMOUSE_EVENT_PROC proc)
-{
-}
diff --git a/windows/win.c b/windows/win.c
index 7d5b896..74c8f37 100644
--- a/windows/win.c
+++ b/windows/win.c
@@ -1233,7 +1233,7 @@
     WIN_CheckFocus(pWnd);
 
     if( CARET_GetHwnd() == pWnd->hwndSelf ) DestroyCaret();
-    CLIPBOARD_Driver->pResetOwner( pWnd, TRUE ); 
+    USER_Driver.pResetSelectionOwner( pWnd, TRUE ); 
 
     /*
      * Send the WM_DESTROY to the window.
@@ -1374,7 +1374,7 @@
             }
 	}
 
-    CLIPBOARD_Driver->pResetOwner( wndPtr, FALSE ); /* before the window is unmapped */
+    USER_Driver.pResetSelectionOwner( wndPtr, FALSE ); /* before the window is unmapped */
 
       /* Hide the window */
 
diff --git a/windows/x11drv/Makefile.in b/windows/x11drv/Makefile.in
index 3159c15..69e327f 100644
--- a/windows/x11drv/Makefile.in
+++ b/windows/x11drv/Makefile.in
@@ -8,7 +8,6 @@
 C_SRCS = \
 	clipboard.c \
 	event.c \
-	init.c \
 	keyboard.c \
 	mouse.c \
 	wnd.c
diff --git a/windows/x11drv/clipboard.c b/windows/x11drv/clipboard.c
index 52ce5dc..8c85501 100644
--- a/windows/x11drv/clipboard.c
+++ b/windows/x11drv/clipboard.c
@@ -126,7 +126,7 @@
          * and if CF_DIB exists in the cache.
          * If wine dowsn't own the selection we always return CF_DIB
          */
-        if ( !X11DRV_CLIPBOARD_IsSelectionowner() )
+        if ( !X11DRV_IsSelectionOwner() )
             return CF_DIB;
         else if ( CLIPBOARD_IsPresent(CF_DIB) )
             return CF_DIB;
@@ -161,7 +161,7 @@
              * Request a PIXMAP, only if WINE is NOT the selection owner,
              * AND the requested format is not in the cache.
              */
-            if ( !X11DRV_CLIPBOARD_IsSelectionowner() && !CLIPBOARD_IsPresent(wFormat) )
+            if ( !X11DRV_IsSelectionOwner() && !CLIPBOARD_IsPresent(wFormat) )
             {
               prop = XA_PIXMAP;
               break;
@@ -793,10 +793,10 @@
 }
 
 /**************************************************************************
- *		X11DRV_CLIPBOARD_Empty
+ *		X11DRV_ReleaseClipboard
  *  Voluntarily release all currently owned X selections
  */
-void X11DRV_CLIPBOARD_Release()
+void X11DRV_ReleaseClipboard(void)
 {
     if( selectionAcquired )
     {
@@ -845,9 +845,9 @@
 }
 
 /**************************************************************************
- *		X11DRV_CLIPBOARD_Acquire()
+ *		X11DRV_AcquireClipboard
  */
-void X11DRV_CLIPBOARD_Acquire()
+void X11DRV_AcquireClipboard(void)
 {
     Window       owner;
     HWND         hWndClipWindow = GetOpenClipboardWindow();
@@ -895,12 +895,12 @@
 }
 
 /**************************************************************************
- *		X11DRV_CLIPBOARD_IsFormatAvailable
+ *		X11DRV_IsClipboardFormatAvailable
  *
  * Checks if the specified format is available in the current selection
  * Only invoked when WINE is not the selection owner
  */
-BOOL X11DRV_CLIPBOARD_IsFormatAvailable(UINT wFormat)
+BOOL X11DRV_IsClipboardFormatAvailable(UINT wFormat)
 {
     Atom xaClipboard = TSXInternAtom(display, _CLIPBOARD, False);
     Window ownerPrimary = TSXGetSelectionOwner(display,XA_PRIMARY);
@@ -943,18 +943,18 @@
      * try to convert the selection to the requested type.
      */
     if ( !cSelectionTargets )
-        return X11DRV_CLIPBOARD_GetData( wFormat );
+        return X11DRV_GetClipboardData( wFormat );
         
     return FALSE;
 }
 
 /**************************************************************************
- *		X11DRV_CLIPBOARD_RegisterFormat
+ *		X11DRV_RegisterClipboardFormat
  *
  * Registers a custom X clipboard format
  * Returns: TRUE - success,  FALSE - failure
  */
-BOOL X11DRV_CLIPBOARD_RegisterFormat( LPCSTR FormatName )
+BOOL X11DRV_RegisterClipboardFormat( LPCSTR FormatName )
 {
     Atom prop = None;
     char str[256];
@@ -975,30 +975,30 @@
 }
 
 /**************************************************************************
- *		X11DRV_CLIPBOARD_IsSelectionowner
+ *		X11DRV_IsSelectionOwner
  *
  * Returns: TRUE - We(WINE) own the selection, FALSE - Selection not owned by us
  */
-BOOL X11DRV_CLIPBOARD_IsSelectionowner()
+BOOL X11DRV_IsSelectionOwner(void)
 {
     return selectionAcquired;
 }
 
 /**************************************************************************
- *		X11DRV_CLIPBOARD_SetData
+ *		X11DRV_SetClipboardData
  *
  * We don't need to do anything special here since the clipboard code
  * maintains the cache. 
  *
  */
-void X11DRV_CLIPBOARD_SetData(UINT wFormat)
+void X11DRV_SetClipboardData(UINT wFormat)
 {
     /* Make sure we have acquired the X selection */
-    X11DRV_CLIPBOARD_Acquire();
+    X11DRV_AcquireClipboard();
 }
 
 /**************************************************************************
- *		X11DRV_CLIPBOARD_GetData
+ *		X11DRV_GetClipboardData
  *
  * This method is invoked only when we DO NOT own the X selection
  *
@@ -1007,7 +1007,7 @@
  * We always get the data from the selection client each time,
  * since we have no way of determining if the data in our cache is stale.
  */
-BOOL X11DRV_CLIPBOARD_GetData(UINT wFormat)
+BOOL X11DRV_GetClipboardData(UINT wFormat)
 {
     BOOL bRet = selectionAcquired;
     HWND hWndClipWindow = GetOpenClipboardWindow();
@@ -1074,7 +1074,7 @@
 }
 
 /**************************************************************************
- *		X11DRV_CLIPBOARD_ResetOwner
+ *		X11DRV_ResetSelectionOwner
  *
  * Called from DestroyWindow() to prevent X selection from being lost when
  * a top level window is destroyed, by switching ownership to another top
@@ -1082,7 +1082,7 @@
  * Any top level window can own the selection. See X11DRV_CLIPBOARD_Acquire
  * for a more detailed description of this.
  */
-void X11DRV_CLIPBOARD_ResetOwner(WND *pWnd, BOOL bFooBar)
+void X11DRV_ResetSelectionOwner(WND *pWnd, BOOL bFooBar)
 {
     HWND hWndClipOwner = 0;
     Window XWnd = X11DRV_WND_GetXWindow(pWnd);
diff --git a/windows/x11drv/event.c b/windows/x11drv/event.c
index 0c484f4..01f9321 100644
--- a/windows/x11drv/event.c
+++ b/windows/x11drv/event.c
@@ -202,20 +202,20 @@
 }
 
 /***********************************************************************
- *           EVENT_Synchronize
+ *           X11DRV_Synchronize
  *
  * Synchronize with the X server. Should not be used too often.
  */
-void X11DRV_EVENT_Synchronize( void )
+void X11DRV_Synchronize( void )
 {
     TSXSync( display, False );
     EVENT_ProcessAllEvents( 0 );
 }
 
 /***********************************************************************
- *           EVENT_UserRepaintDisable
+ *           X11DRV_UserRepaintDisable
  */
-void X11DRV_EVENT_UserRepaintDisable( BOOL bDisabled )
+void X11DRV_UserRepaintDisable( BOOL bDisabled )
 {
     bUserRepaintDisabled = bDisabled;
 }
@@ -715,12 +715,12 @@
     int yOffset = pWnd? pWnd->rectWindow.top  : 0;
     WIN_ReleaseWndPtr(pWnd);
     
-    X11DRV_MOUSE_SendEvent( MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE, 
+    X11DRV_SendEvent( MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE, 
                             xOffset + event->x, yOffset + event->y,
                             X11DRV_EVENT_XStateToKeyState( event->state ), 
                             event->time, hWnd);
   } else {
-    X11DRV_MOUSE_SendEvent( MOUSEEVENTF_MOVE,
+    X11DRV_SendEvent( MOUSEEVENTF_MOVE,
                             event->x_root, event->y_root,
                             X11DRV_EVENT_XStateToKeyState( event->state ), 
                             event->time, hWnd);
@@ -774,7 +774,7 @@
         break;
   }
   
-  X11DRV_MOUSE_SendEvent( statusCodes[buttonNum], 
+  X11DRV_SendEvent( statusCodes[buttonNum], 
                           xOffset + event->x, yOffset + event->y,
                           MAKEWPARAM(keystate,wData),
                           event->time, hWnd);
@@ -822,7 +822,7 @@
       return;
   }
 
-  X11DRV_MOUSE_SendEvent( statusCodes[buttonNum], 
+  X11DRV_SendEvent( statusCodes[buttonNum], 
                           xOffset + event->x, yOffset + event->y,
                           keystate, event->time, hWnd);
 }
@@ -865,9 +865,9 @@
 }
 
 /**********************************************************************
- *              X11DRV_EVENT_CheckFocus
+ *              X11DRV_CheckFocus
  */
-BOOL X11DRV_EVENT_CheckFocus(void)
+BOOL X11DRV_CheckFocus(void)
 {
   HWND   hWnd;
   Window xW;
@@ -1489,7 +1489,7 @@
       TRACE("\tPropertyDelete for atom %s on window %ld\n",
             TSXGetAtomName(event->display, event->atom), (long)event->window);
       
-      if (X11DRV_CLIPBOARD_IsSelectionowner())
+      if (X11DRV_IsSelectionOwner())
           X11DRV_CLIPBOARD_FreeResources( event->atom );
       break;
     }
@@ -1899,7 +1899,7 @@
     TSXRefreshKeyboardMapping(event);
 
     /* reinitialize Wine-X11 driver keyboard table */
-    X11DRV_KEYBOARD_Init();
+    X11DRV_InitKeyboard();
 }
 
 
@@ -1940,7 +1940,7 @@
 /* DGA2 event handlers */
 static void EVENT_DGAMotionEvent( XDGAMotionEvent *event )
 {
-  X11DRV_MOUSE_SendEvent( MOUSEEVENTF_MOVE, 
+  X11DRV_SendEvent( MOUSEEVENTF_MOVE, 
 		   event->dx, event->dy,
 		   X11DRV_EVENT_XStateToKeyState( event->state ), 
 		   event->time, DGAhwnd );
@@ -1971,7 +1971,7 @@
       break;
   }
   
-  X11DRV_MOUSE_SendEvent( statusCodes[buttonNum], 0, 0, keystate, event->time, DGAhwnd );
+  X11DRV_SendEvent( statusCodes[buttonNum], 0, 0, keystate, event->time, DGAhwnd );
 }
 
 static void EVENT_DGAButtonReleaseEvent( XDGAButtonEvent *event )
@@ -1999,7 +1999,7 @@
       break;
   }
   
-  X11DRV_MOUSE_SendEvent( statusCodes[buttonNum], 0, 0, keystate, event->time, DGAhwnd );
+  X11DRV_SendEvent( statusCodes[buttonNum], 0, 0, keystate, event->time, DGAhwnd );
 }
 
 #endif
diff --git a/windows/x11drv/init.c b/windows/x11drv/init.c
deleted file mode 100644
index 525e041..0000000
--- a/windows/x11drv/init.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * X11 driver
- *
- * Copyright 1998 Patrik Stridvall
- */
-
-#include "clipboard.h"
-#include "user.h"
-#include "win.h"
-#include "x11drv.h"
-
-CLIPBOARD_DRIVER X11DRV_CLIPBOARD_Driver =
-{
-  X11DRV_CLIPBOARD_Acquire,
-  X11DRV_CLIPBOARD_Release,
-  X11DRV_CLIPBOARD_SetData,
-  X11DRV_CLIPBOARD_GetData,
-  X11DRV_CLIPBOARD_IsFormatAvailable,
-  X11DRV_CLIPBOARD_RegisterFormat,
-  X11DRV_CLIPBOARD_IsSelectionowner,
-  X11DRV_CLIPBOARD_ResetOwner
-};
-
-WND_DRIVER X11DRV_WND_Driver =
-{
-  X11DRV_WND_Initialize,
-  X11DRV_WND_Finalize,
-  X11DRV_WND_CreateDesktopWindow,
-  X11DRV_WND_CreateWindow,
-  X11DRV_WND_DestroyWindow,
-  X11DRV_WND_SetParent,
-  X11DRV_WND_ForceWindowRaise,
-  X11DRV_WND_SetWindowPos,
-  X11DRV_WND_SetText,
-  X11DRV_WND_SetFocus,
-  X11DRV_WND_PreSizeMove,
-  X11DRV_WND_PostSizeMove,
-  X11DRV_WND_SurfaceCopy,
-  X11DRV_WND_SetDrawable,
-  X11DRV_WND_SetHostAttr,
-  X11DRV_WND_IsSelfClipping,
-  X11DRV_WND_SetWindowRgn
-};
-
-
diff --git a/windows/x11drv/keyboard.c b/windows/x11drv/keyboard.c
index 9f8bb1e..56d3440 100644
--- a/windows/x11drv/keyboard.c
+++ b/windows/x11drv/keyboard.c
@@ -718,7 +718,7 @@
 /**********************************************************************
  *		X11DRV_KEYBOARD_DetectLayout
  *
- * Called from X11DRV_KEYBOARD_Init
+ * Called from X11DRV_InitKeyboard
  *  This routine walks through the defined keyboard layouts and selects
  *  whichever matches most closely.
  */
@@ -816,9 +816,9 @@
 }
 
 /**********************************************************************
- *		X11DRV_KEYBOARD_Init
+ *		X11DRV_InitKeyboard
  */
-void X11DRV_KEYBOARD_Init(void)
+void X11DRV_InitKeyboard(void)
 {
     KeySym *ksp;
     XModifierKeymap *mmp;
@@ -1029,9 +1029,9 @@
 }
 
 /***********************************************************************
- *		X11DRV_KEYBOARD_VkKeyScan
+ *		X11DRV_VkKeyScan
  */
-WORD X11DRV_KEYBOARD_VkKeyScan(CHAR cChar)
+WORD X11DRV_VkKeyScan(CHAR cChar)
 {
 	KeyCode keycode;
 	KeySym keysym;    	
@@ -1077,9 +1077,9 @@
 }
 
 /***********************************************************************
- *		X11DRV_KEYBOARD_MapVirtualKey
+ *		X11DRV_MapVirtualKey
  */
-UINT16 X11DRV_KEYBOARD_MapVirtualKey(UINT16 wCode, UINT16 wMapType)
+UINT16 X11DRV_MapVirtualKey(UINT16 wCode, UINT16 wMapType)
 {
 #define returnMVK(value) { TRACE("returning 0x%x.\n",value); return value; }
 
@@ -1161,9 +1161,9 @@
 }
 
 /***********************************************************************
- *		X11DRV_KEYBOARD_GetKeyNameText
+ *		X11DRV_GetKeyNameText
  */
-INT16 X11DRV_KEYBOARD_GetKeyNameText(LONG lParam, LPSTR lpBuffer, INT16 nSize)
+INT16 X11DRV_GetKeyNameText(LONG lParam, LPSTR lpBuffer, INT16 nSize)
 {
   int vkey, ansi, scanCode;
   KeyCode keyc;
@@ -1174,7 +1174,7 @@
   scanCode &= 0x1ff;  /* keep "extended-key" flag with code */
 
   /* FIXME: should use MVK type 3 (NT version that distinguishes right and left */
-  vkey = X11DRV_KEYBOARD_MapVirtualKey(scanCode, 1);
+  vkey = X11DRV_MapVirtualKey(scanCode, 1);
 
   /*  handle "don't care" bit (0x02000000) */
   if (!(lParam & 0x02000000)) {
@@ -1196,7 +1196,7 @@
     }
   }
 
-  ansi = X11DRV_KEYBOARD_MapVirtualKey(vkey, 2);
+  ansi = X11DRV_MapVirtualKey(vkey, 2);
   TRACE("scan 0x%04x, vkey 0x%04x, ANSI 0x%04x\n", scanCode, vkey, ansi);
 
   /* first get the name of the "regular" keys which is the Upper case
@@ -1333,7 +1333,7 @@
 }
 
 /***********************************************************************
- *		X11DRV_KEYBOARD_ToAscii
+ *		X11DRV_ToAscii
  *
  * The ToAscii function translates the specified virtual-key code and keyboard
  * state to the corresponding Windows character or characters.
@@ -1350,7 +1350,7 @@
  * FIXME : should do the above (return 2 for non matching deadchar+char combinations)
  *
  */
-INT16 X11DRV_KEYBOARD_ToAscii(
+INT16 X11DRV_ToAscii(
     UINT16 virtKey,UINT16 scanCode, LPBYTE lpKeyState, 
     LPVOID lpChar, UINT16 flags)
 {
@@ -1469,9 +1469,9 @@
 }
 
 /***********************************************************************
- *		X11DRV_KEYBOARD_GetBeepActive
+ *		X11DRV_GetBeepActive
  */
-BOOL X11DRV_KEYBOARD_GetBeepActive()
+BOOL X11DRV_GetBeepActive()
 {
   XKeyboardState  keyboard_state;
 
@@ -1481,9 +1481,9 @@
 }
 
 /***********************************************************************
- *		X11DRV_KEYBOARD_SetBeepActive
+ *		X11DRV_SetBeepActive
  */
-void X11DRV_KEYBOARD_SetBeepActive(BOOL bActivate)
+void X11DRV_SetBeepActive(BOOL bActivate)
 {
   XKeyboardControl keyboard_value;
   
@@ -1496,17 +1496,17 @@
 }
 
 /***********************************************************************
- *		X11DRV_KEYBOARD_Beep
+ *		X11DRV_Beep
  */
-void X11DRV_KEYBOARD_Beep()
+void X11DRV_Beep()
 {
   TSXBell(display, 0);
 }
 
 /***********************************************************************
- *		X11DRV_KEYBOARD_GetDIState
+ *		X11DRV_GetDIState
  */
-BOOL X11DRV_KEYBOARD_GetDIState(DWORD len, LPVOID ptr)
+BOOL X11DRV_GetDIState(DWORD len, LPVOID ptr)
 {
   if (len==256) {
     int keyc,vkey;
@@ -1524,14 +1524,14 @@
       }
     return TRUE;
   }
-  WARN("whoops, X11DRV_KEYBOARD_GetState got len %ld?\n", len);
+  WARN("whoops, got len %ld?\n", len);
   return TRUE;
 }
 
 /***********************************************************************
- *		X11DRV_KEYBOARD_GetDIData
+ *		X11DRV_GetDIData
  */
-BOOL X11DRV_KEYBOARD_GetDIData(
+BOOL X11DRV_GetDIData(
   BYTE *keystate,
   DWORD dodsize, LPDIDEVICEOBJECTDATA dod,
   LPDWORD entries, DWORD flags)
@@ -1573,9 +1573,9 @@
 }
 
 /***********************************************************************
- *		X11DRV_KEYBOARD_GetKeyboardConfig
+ *		X11DRV_GetKeyboardConfig
  */
-void X11DRV_KEYBOARD_GetKeyboardConfig(KEYBOARD_CONFIG *cfg) {
+void X11DRV_GetKeyboardConfig(KEYBOARD_CONFIG *cfg) {
   XKeyboardState   xks;
 
   /* For the moment, only get the auto-repeat mode */
@@ -1584,9 +1584,9 @@
 }
 
 /***********************************************************************
- *		X11DRV_KEYBOARD_SetKeyboardConfig
+ *		X11DRV_SetKeyboardConfig
  */
-extern void X11DRV_KEYBOARD_SetKeyboardConfig(KEYBOARD_CONFIG *cfg, DWORD mask) {
+extern void X11DRV_SetKeyboardConfig(KEYBOARD_CONFIG *cfg, DWORD mask) {
   XKeyboardControl xkc;
   unsigned long X_mask = 0;
   
diff --git a/windows/x11drv/mouse.c b/windows/x11drv/mouse.c
index 96c6f80..a973c2a 100644
--- a/windows/x11drv/mouse.c
+++ b/windows/x11drv/mouse.c
@@ -161,9 +161,9 @@
 }
 
 /***********************************************************************
- *		X11DRV_MOUSE_SetCursor
+ *		X11DRV_SetCursor
  */
-void X11DRV_MOUSE_SetCursor( CURSORICONINFO *lpCursor )
+void X11DRV_SetCursor( CURSORICONINFO *lpCursor )
 {
     BOOL success;
 
@@ -199,9 +199,9 @@
 }
 
 /***********************************************************************
- *		X11DRV_MOUSE_MoveCursor
+ *		X11DRV_MoveCursor
  */
-void X11DRV_MOUSE_MoveCursor(WORD wAbsX, WORD wAbsY)
+void X11DRV_MoveCursor(WORD wAbsX, WORD wAbsY)
 {
   /* 
    * We do not want the to create MotionNotify events here, 
@@ -241,9 +241,9 @@
 }
 
 /***********************************************************************
- *           X11DRV_MOUSE_Init
+ *           X11DRV_InitMouse
  */
-void X11DRV_MOUSE_Init( LPMOUSE_EVENT_PROC proc )
+void X11DRV_InitMouse( LPMOUSE_EVENT_PROC proc )
 {
     static int init_done;
 
@@ -260,7 +260,7 @@
            movement to initialize the mouse global variables */
         TSXQueryPointer( display, X11DRV_GetXRootWindow(), &root, &child,
                          &root_x, &root_y, &child_x, &child_y, &KeyState);
-        X11DRV_MOUSE_SendEvent(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
+        X11DRV_SendEvent(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
                                root_x, root_y, X11DRV_EVENT_XStateToKeyState(KeyState),
                                GetTickCount(), 0 );
     }
@@ -268,9 +268,9 @@
 
 
 /***********************************************************************
- *           X11DRV_MOUSE_SendEvent
+ *           X11DRV_SendEvent
  */
-void X11DRV_MOUSE_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY, 
+void X11DRV_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY, 
                              DWORD keyState, DWORD time, HWND hWnd )
 {
     int width  = GetSystemMetrics( SM_CXSCREEN );
diff --git a/windows/x11drv/wnd.c b/windows/x11drv/wnd.c
index 3a4c1d8..f34513f 100644
--- a/windows/x11drv/wnd.c
+++ b/windows/x11drv/wnd.c
@@ -46,6 +46,28 @@
 
 /**********************************************************************/
 
+WND_DRIVER X11DRV_WND_Driver =
+{
+  X11DRV_WND_Initialize,
+  X11DRV_WND_Finalize,
+  X11DRV_WND_CreateDesktopWindow,
+  X11DRV_WND_CreateWindow,
+  X11DRV_WND_DestroyWindow,
+  X11DRV_WND_SetParent,
+  X11DRV_WND_ForceWindowRaise,
+  X11DRV_WND_SetWindowPos,
+  X11DRV_WND_SetText,
+  X11DRV_WND_SetFocus,
+  X11DRV_WND_PreSizeMove,
+  X11DRV_WND_PostSizeMove,
+  X11DRV_WND_SurfaceCopy,
+  X11DRV_WND_SetDrawable,
+  X11DRV_WND_SetHostAttr,
+  X11DRV_WND_IsSelfClipping,
+  X11DRV_WND_SetWindowRgn
+};
+
+
 /* X context to associate a hwnd to an X window */
 XContext winContext = 0;