[Xorg-commit] xc/programs/Xserver/hw/xwin InitOutput.c,1.1.4.1.2.1,1.1.4.1.2.2 win.h,1.1.4.1.2.1,1.1.4.1.2.2 winclipboard.h,1.1.4.1,1.1.4.1.2.1 winclipboardinit.c,1.1.4.1,1.1.4.1.2.1 winclipboardtextconv.c,1.1.4.1,1.1.4.1.2.1 winclipboardthread.c,1.1.4.1,1.1.4.1.2.1 winclipboardunicode.c,1.1.4.1,1.1.4.1.2.1 winclipboardxevents.c,1.1.4.1,1.1.4.1.2.1 winconfig.c,1.1.4.1,1.1.4.1.2.1 wincutpaste.c,1.1.4.1,1.1.4.1.2.1 winerror.c,1.1.4.1,1.1.4.1.2.1 winkeybd.c,1.1.4.1,1.1.4.1.2.1 winmouse.c,1.1,1.1.6.1 winmultiwindowwindow.c,1.1.4.1.2.1,1.1.4.1.2.2 winmultiwindowwm.c,1.1.4.1,1.1.4.1.2.1 winmultiwindowwndproc.c,1.1,1.1.6.1 winnativegdi.c,1.1.4.1.2.1,1.1.4.1.2.2 winpfbdd.c,1.1.4.1.2.1,1.1.4.1.2.2 winprefs.c,1.1,1.1.6.1 winprefs.h,1.1,1.1.6.1 winprefsyacc.y,1.1,1.1.6.1 winregistry.c,1.1,1.1.6.1 winrop.c,1.1,1.1.6.1 winscrinit.c,1.1.4.1.2.2,1.1.4.1.2.3 winshaddd.c,1.1.4.1.2.1,1.1.4.1.2.2 winshadddnl.c,1.1.4.1.2.1,1.1.4.1.2.2 winshadgdi.c,1.1.4.1.2.1,1.1.4.1.2.2 winvideo.c,1.1,1.1.6.1 winwakeup.c,1.1.4.1.2.1,1.1.4.1.2.2 winwindow.h,1.1.4.1,1.1.4.1.2.1 winwndproc.c,1.1.4.1.2.1,1.1.4.1.2.2

Alexander Gottwald xorg-commit at pdx.freedesktop.org
Tue Dec 9 03:37:18 EET 2003


Committed by: ago

Update of /cvs/xorg/xc/programs/Xserver/hw/xwin
In directory pdx:/tmp/cvs-serv11906

Modified Files:
      Tag: CYGWIN
	InitOutput.c win.h winclipboard.h winclipboardinit.c 
	winclipboardtextconv.c winclipboardthread.c 
	winclipboardunicode.c winclipboardxevents.c winconfig.c 
	wincutpaste.c winerror.c winkeybd.c winmouse.c 
	winmultiwindowwindow.c winmultiwindowwm.c 
	winmultiwindowwndproc.c winnativegdi.c winpfbdd.c winprefs.c 
	winprefs.h winprefsyacc.y winregistry.c winrop.c winscrinit.c 
	winshaddd.c winshadddnl.c winshadgdi.c winvideo.c winwakeup.c 
	winwindow.h winwndproc.c 
Log Message:
- transition from xoncygwin to xorg repository. 


Index: InitOutput.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/InitOutput.c,v
retrieving revision 1.1.4.1.2.1
retrieving revision 1.1.4.1.2.2
diff -u -d -r1.1.4.1.2.1 -r1.1.4.1.2.2
--- InitOutput.c	2 Dec 2003 06:52:01 -0000	1.1.4.1.2.1
+++ InitOutput.c	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.2
@@ -57,6 +57,7 @@
 char *		g_pszLogFile = WIN_LOG_FNAME;
 Bool		g_fLogInited = FALSE;
 const char *	g_pszQueryHost = NULL;
+Bool		g_fUnicodeClipboard = TRUE;
 
 
 /*
@@ -69,7 +70,7 @@
 FARPROC		g_fpDirectDrawCreateClipper = NULL;
 
 HMODULE		g_hmodCommonControls = NULL;
-FARPROC		g_fpTrackMouseEvent = (FARPROC) (void (*)())NoopDDA;
+FARPROC		g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA;
 
 
 /* Function prototypes */
@@ -77,6 +78,7 @@
 #ifdef DDXOSVERRORF
 void OsVendorVErrorF (const char *pszFormat, va_list va_args);
 #endif
+void winInitializeDefaultScreens (void);
 
 
 /*
@@ -106,7 +108,6 @@
 
 const int NUMFORMATS = sizeof (g_PixmapFormats) / sizeof (g_PixmapFormats[0]);
 
-
 void
 winInitializeDefaultScreens (void)
 {
@@ -221,7 +222,7 @@
     {
       FreeLibrary (g_hmodCommonControls);
       g_hmodCommonControls = NULL;
-      g_fpTrackMouseEvent = (FARPROC) (void (*)())NoopDDA;
+      g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA;
     }
   
   /* Tell Windows that we want to end the app */
@@ -367,6 +368,9 @@
 
   ErrorF ("-keyboard\n"
 	  "\tSpecify a keyboard device from the configuration file.\n");
+
+  ErrorF ("-nounicodeclipboard\n"
+	  "\tDo not use Unicode clipboard even if NT-based platform.\n");
 }
 
 
@@ -1241,6 +1245,27 @@
       return 2;
     }
 
+  /*
+   * Look for the '-nounicodeclipboard' argument
+   */
+  if (IS_OPTION ("-nounicodeclipboard"))
+    {
+      g_fUnicodeClipboard = FALSE;
+      /* Indicate that we have processed the argument */
+      return 1;
+    }
+
+#ifdef XKB
+  /*
+   * Look for the '-kb' argument
+   */
+  if (IS_OPTION ("-kb"))
+    {
+      g_cmdline.noXkbExtension = TRUE;  
+      return 0; /* Let DIX parse this again */
+    }
+#endif
+
   return 0;
 }
 
@@ -1312,7 +1337,7 @@
       g_hmodCommonControls = NULL;
 
       /* Set function pointer to point to no operation function */
-      g_fpTrackMouseEvent = (FARPROC) (void (*)())NoopDDA;
+      g_fpTrackMouseEvent = (FARPROC) (void (*)(void))NoopDDA;
     }
 
   /*

Index: win.h
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/win.h,v
retrieving revision 1.1.4.1.2.1
retrieving revision 1.1.4.1.2.2
diff -u -d -r1.1.4.1.2.1 -r1.1.4.1.2.2
--- win.h	5 Dec 2003 03:37:26 -0000	1.1.4.1.2.1
+++ win.h	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.2
@@ -158,7 +158,6 @@
 #include "windowstr.h"
 #include "mi.h"
 #include "micmap.h"
-#include "migc.h"
 #include "mifillarc.h"
 #include "mifpoly.h"
 #include "mibstore.h"
@@ -300,6 +299,8 @@
 
 typedef Bool (*winReleasePrimarySurfaceProcPtr)(ScreenPtr);
 
+typedef Bool (*winFinishCreateWindowsWindowProcPtr)(WindowPtr pWin);
+
 
 /*
  * GC (graphics context) privates
@@ -541,6 +542,9 @@
   winCreatePrimarySurfaceProcPtr	pwinCreatePrimarySurface;
   winReleasePrimarySurfaceProcPtr	pwinReleasePrimarySurface;
 
+  /* Window Procedures for MultiWindow mode */
+  winFinishCreateWindowsWindowProcPtr	pwinFinishCreateWindowsWindow;
+
   /* Window Procedures for Rootless mode */
   CreateWindowProcPtr			CreateWindow;
   DestroyWindowProcPtr			DestroyWindow;
@@ -767,7 +771,7 @@
  */
 
 void
-winDeinitClipboard ();
+winDeinitClipboard (void);
 
 
 /*
@@ -854,13 +858,13 @@
  */
 
 void
-winDetectSupportedEngines ();
+winDetectSupportedEngines (void);
 
 Bool
 winSetEngine (ScreenPtr pScreen);
 
 Bool
-winGetDDProcAddresses ();
+winGetDDProcAddresses (void);
 
 
 /*
@@ -971,16 +975,13 @@
 winInitializeModeKeyStates (void);
 
 void
-winStoreModeKeyStates (ScreenPtr pScreen);
-
-void
-winRestoreModeKeyStates (ScreenPtr pScreen);
+winRestoreModeKeyStates (void);
 
 Bool
 winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam);
 
 void
-winKeybdReleaseKeys ();
+winKeybdReleaseKeys (void);
 
 void
 winSendKeyEvent (DWORD dwKey, Bool fDown);
@@ -1461,10 +1462,6 @@
 HICON
 winXIconToHICON (WindowPtr pWin);
 
-void
-winUpdateIcon (Window id);
-
-
 /*
  * winmultiwindowshape.c
  */
@@ -1659,7 +1656,7 @@
  */
 
 void
-winWindowsWMExtensionInit ();
+winWindowsWMExtensionInit (void);
 
 
 /*

Index: winclipboard.h
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winclipboard.h,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.1.2.1
diff -u -d -r1.1.4.1 -r1.1.4.1.2.1
--- winclipboard.h	26 Nov 2003 22:49:05 -0000	1.1.4.1
+++ winclipboard.h	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.1
@@ -98,7 +98,7 @@
 		  DWORD dwScreen);
 
 HWND
-winClipboardCreateMessagingWindow ();
+winClipboardCreateMessagingWindow (void);
 
 
 /*
@@ -120,14 +120,14 @@
 winClipboardProc (void *pArg);
 
 void
-winDeinitClipboard ();
+winDeinitClipboard (void);
 
 /*
  * winclipboardunicode.c
  */
 
 Bool
-winClipboardDetectUnicodeSupport ();
+winClipboardDetectUnicodeSupport (void);
 
 
 /*

Index: winclipboardinit.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winclipboardinit.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.1.2.1
diff -u -d -r1.1.4.1 -r1.1.4.1.2.1
--- winclipboardinit.c	26 Nov 2003 22:49:05 -0000	1.1.4.1
+++ winclipboardinit.c	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.1
@@ -74,7 +74,7 @@
  */
 
 HWND
-winClipboardCreateMessagingWindow ()
+winClipboardCreateMessagingWindow (void)
 {
   WNDCLASS		wc;
   HWND			hwnd;

Index: winclipboardtextconv.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winclipboardtextconv.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.1.2.1
diff -u -d -r1.1.4.1 -r1.1.4.1.2.1
--- winclipboardtextconv.c	26 Nov 2003 22:49:05 -0000	1.1.4.1
+++ winclipboardtextconv.c	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.1
@@ -33,6 +33,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+void
+winClipboardDOStoUNIX (char *pszSrc, int iLength);
+void
+winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength);
 
 /*
  * Convert \r\n to \n

Index: winclipboardthread.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winclipboardthread.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.1.2.1
diff -u -d -r1.1.4.1 -r1.1.4.1.2.1
--- winclipboardthread.c	26 Nov 2003 22:49:05 -0000	1.1.4.1
+++ winclipboardthread.c	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.1
@@ -36,6 +36,7 @@
  */
 
 extern Bool g_fCalledSetLocale;
+extern Bool g_fUnicodeClipboard;
 
 
 /*
@@ -105,10 +106,10 @@
   ErrorF ("winClipboardProc - pthread_mutex_lock () returned.\n");
 
   /* Do we have Unicode support? */
-  fUnicodeSupport = winClipboardDetectUnicodeSupport ();
+  fUnicodeSupport = g_fUnicodeClipboard && winClipboardDetectUnicodeSupport ();
 
   /* Set the current locale?  What does this do? */
-  if (fUnicodeSupport && !g_fCalledSetLocale)
+  if (!g_fCalledSetLocale)
     {
       ErrorF ("winClipboardProc - Calling setlocale ()\n");
       if (!setlocale (LC_ALL, ""))
@@ -477,7 +478,7 @@
  */
 
 void
-winDeinitClipboard ()
+winDeinitClipboard (void)
 {
   ErrorF ("winDeinitClipboard - Noting shutdown in progress\n");
   g_shutdown = TRUE;

Index: winclipboardunicode.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winclipboardunicode.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.1.2.1
diff -u -d -r1.1.4.1 -r1.1.4.1.2.1
--- winclipboardunicode.c	26 Nov 2003 22:49:05 -0000	1.1.4.1
+++ winclipboardunicode.c	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.1
@@ -31,6 +31,8 @@
 
 #include "win.h"
 
+Bool
+winClipboardDetectUnicodeSupport (void);
 
 /*
  * Determine whether we suport Unicode or not.
@@ -38,7 +40,7 @@
  */
 
 Bool
-winClipboardDetectUnicodeSupport ()
+winClipboardDetectUnicodeSupport (void)
 {
   Bool			fReturn = FALSE;
   OSVERSIONINFO		osvi;

Index: winclipboardxevents.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winclipboardxevents.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.1.2.1
diff -u -d -r1.1.4.1 -r1.1.4.1.2.1
--- winclipboardxevents.c	26 Nov 2003 22:49:05 -0000	1.1.4.1
+++ winclipboardxevents.c	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.1
@@ -48,9 +48,11 @@
 			  Display *pDisplay,
 			  Bool fUnicodeSupport)
 {
+#if 0
   Atom			atomReturnType;
   int			iReturnFormat;
   unsigned long		ulReturnItems;
+#endif
   XTextProperty		xtpText;
   XEvent		event;
   XSelectionEvent	eventSelection;
@@ -61,13 +63,15 @@
   HGLOBAL		hGlobal;
   Bool			fReturn = TRUE;
   XICCEncodingStyle	xiccesStyle;
-  int			iUTF8;
-  char			*pszUTF8 = NULL;
+  int			iConvertDataLen = 0;
+  char			*pszConvertData = NULL;
   char			*pszTextList[2];
   int			iCount;
   char			**ppszTextList = NULL;
   wchar_t		*pwszUnicodeStr = NULL;
   int			iUnicodeLen = 0;
+  int			iReturnDataLen = 0;
+  int			i;
 
   /* Process all pending events */
   while (XPending (pDisplay))
@@ -251,7 +255,7 @@
 	  /* Convert the Unicode string to UTF8 (MBCS) */
 	  if (fUnicodeSupport)
 	    {
-	      iUTF8 = WideCharToMultiByte (CP_UTF8,
+	      iConvertDataLen = WideCharToMultiByte (CP_UTF8,
 					   0,
 					   (LPCWSTR)pszGlobalData,
 					   -1,
@@ -259,57 +263,62 @@
 					   0,
 					   NULL,
 					   NULL);
-	      pszUTF8 = (char *) malloc (iUTF8); /* Don't need +1 */
+	      /* NOTE: iConvertDataLen includes space for null terminator */
+	      pszConvertData = (char *) malloc (iConvertDataLen);
 	      WideCharToMultiByte (CP_UTF8,
 				   0,
 				   (LPCWSTR)pszGlobalData,
 				   -1,
-				   pszUTF8,
-				   iUTF8,
+				   pszConvertData,
+				   iConvertDataLen,
 				   NULL,
 				   NULL);
 	    }
+	  else
+	    {
+	      pszConvertData = strdup (pszGlobalData);
+	      iConvertDataLen = strlen (pszConvertData) + 1;
+	    }
 
 	  /* Convert DOS string to UNIX string */
-	  if (fUnicodeSupport)
-	    {
-	      winClipboardDOStoUNIX (pszUTF8, strlen (pszUTF8));
+	  winClipboardDOStoUNIX (pszConvertData, strlen (pszConvertData));
 
 	      /* Setup our text list */
-	      pszTextList[0] = pszUTF8;
+	  pszTextList[0] = pszConvertData;
 	      pszTextList[1] = NULL;
 	      
 	      /* Initialize the text property */
 	      xtpText.value = NULL;
 	      
 	      /* Create the text property from the text list */
+	  if (fUnicodeSupport)
+	    {
 	      iReturn = Xutf8TextListToTextProperty (pDisplay,
 						     pszTextList,
 						     1,
 						     xiccesStyle,
 						     &xtpText);
+	    }
+	  else
+	    {
+	      iReturn = XmbTextListToTextProperty (pDisplay,
+						   pszTextList,
+						   1,
+						   xiccesStyle,
+						   &xtpText);
+	    }
 	      if (iReturn == XNoMemory || iReturn == XLocaleNotSupported)
 		{
 		  ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
-			  "Xutf8TextListToTextProperty failed: %d\n",
+		      "X*TextListToTextProperty failed: %d\n",
 			  iReturn);
 		  exit(1);
 		}
 	      
-	      /* Free the UTF8 string */
-	      free (pszUTF8);
-	    }
-	  else
-	    winClipboardDOStoUNIX (pszGlobalData, strlen (pszGlobalData));
-
-	  /*
-	   * FIXME: Pass pszGlobalData and strlen (pszGlobalData(
-	   * on 1 byte, pass xtpText.value and xtpText.nitems
-	   * on 2 byte.
-	   */
+	  /* Free the converted string */
+	  free (pszConvertData);
 
 	  /* Copy the clipboard text to the requesting window */
-	  if (fUnicodeSupport)
 	    iReturn = XChangeProperty (pDisplay,
 				       event.xselectionrequest.requestor,
 				       event.xselectionrequest.property,
@@ -318,15 +327,6 @@
 				       PropModeReplace,
 				       xtpText.value,
 				       xtpText.nitems);
-	  else
-	    iReturn = XChangeProperty (pDisplay,
-				       event.xselectionrequest.requestor,
-				       event.xselectionrequest.property,
-				       event.xselectionrequest.target,
-				       8,
-				       PropModeReplace,
-				       pszGlobalData,
-				       strlen (pszGlobalData));
 	  if (iReturn == BadAlloc || iReturn == BadAtom
 	      || iReturn == BadMatch || iReturn == BadValue
 	      || iReturn == BadWindow)
@@ -342,12 +342,9 @@
 	  pszGlobalData = NULL;
 	  CloseClipboard ();
 
-	  /* FIXME: Don't clean up on 1 byte. */
-	  if (fUnicodeSupport)
-	    {
+	  /* Clean up */
 	      XFree (xtpText.value);
 	      xtpText.value = NULL;
-	    }
 
 	  /* Setup selection notify event */
 	  eventSelection.type = SelectionNotify;
@@ -408,8 +405,6 @@
 	   * What are we doing here?
 	   *
 	   */
-	  if (fUnicodeSupport)
-	    {
 	      if (event.xselection.property == None)
 		{
 		  if(event.xselection.target == XA_STRING)
@@ -462,10 +457,8 @@
 		      return fReturn;
 		    }
 		}
-	    }
 
 	  /* Retrieve the size of the stored data */
-	  if (fUnicodeSupport)
 	    iReturn = XGetWindowProperty (pDisplay,
 					  iWindow,
 					  atomLocalProperty,
@@ -478,19 +471,6 @@
 					  &xtpText.nitems,
 					  &ulReturnBytesLeft,
 					  &xtpText.value);
-	  else
-	    iReturn = XGetWindowProperty (pDisplay,
-					  iWindow,
-					  atomLocalProperty,
-					  0,
-					  0, /* Don't get data, just size */
-					  False,
-					  AnyPropertyType,
-					  &atomReturnType,
-					  &iReturnFormat,
-					  &ulReturnItems,
-					  &ulReturnBytesLeft,
-					  &pszReturnData);
 	  if (iReturn != Success)
 	    {
 	      ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
@@ -499,16 +479,11 @@
 	    }
 
 #if 0
-	  if (fUnicodeSupport)
 	    ErrorF ("SelectionNotify - returned data %d left %d\n",
 		    xtpText.nitems, ulReturnBytesLeft);
-	  else
-	    ErrorF ("SelectionNotify - returned data %d left %d\n",
-		    ulReturnItems, ulReturnBytesLeft);
 #endif
 
 	  /* Request the selection data */
-	  if (fUnicodeSupport)
 	    iReturn = XGetWindowProperty (pDisplay,
 					  iWindow,
 					  atomLocalProperty,
@@ -521,19 +496,6 @@
 					  &xtpText.nitems,
 					  &ulReturnBytesLeft,
 					  &xtpText.value);
-	  else
-	    iReturn = XGetWindowProperty (pDisplay,
-					  iWindow,
-					  atomLocalProperty,
-					  0,
-					  ulReturnBytesLeft,
-					  False,
-					  AnyPropertyType,
-					  &atomReturnType,
-					  &iReturnFormat,
-					  &ulReturnItems,
-					  &ulReturnBytesLeft,
-					  &pszReturnData);
 	  if (iReturn != Success)
 	    {
 	      ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
@@ -541,40 +503,80 @@
 	      pthread_exit (NULL);
 	    }
 
-	  if (fUnicodeSupport)
-	    {
 #if 0
+	    {
 	      char		*pszAtomName = NULL;
 
 	      ErrorF ("SelectionNotify - returned data %d left %d\n",
-		      prop.nitems, ulReturnBytesLeft);
+		      xtpText.nitems, ulReturnBytesLeft);
 	      
-	      pszAtomName = XGetAtomName(pDisplay, prop.encoding);
+	      pszAtomName = XGetAtomName(pDisplay, xtpText.encoding);
 	      ErrorF ("Notify atom name %s\n", pszAtomName);
 	      XFree (pszAtomName);
 	      pszAtomName = NULL;
+	    }
 #endif
 	      
+	  if (fUnicodeSupport)
+	    {
 	      /* Convert the text property to a text list */
-	      Xutf8TextPropertyToTextList (pDisplay,
+	      iReturn = Xutf8TextPropertyToTextList (pDisplay,
+						     &xtpText,
+						     &ppszTextList,
+						     &iCount);
+	    }
+	  else
+	    {
+	      iReturn = XmbTextPropertyToTextList (pDisplay,
 					   &xtpText,
 					   &ppszTextList,
 					   &iCount);
-	      if (iCount > 0)
+	    }
+	  if (iReturn == Success || iReturn > 0)
+	    {
+	      /* Conversion succeeded or some unconvertible characters */
+	      if (ppszTextList != NULL)
 		{
-		  pszReturnData = malloc (strlen (ppszTextList[0]) + 1);
-		  strcpy (pszReturnData, ppszTextList[0]);
+		  for (i = 0; i < iCount; i++)
+		    {
+		      iReturnDataLen += strlen(ppszTextList[i]);
+		    }
+		  pszReturnData = malloc (iReturnDataLen + 1);
+		  pszReturnData[0] = '\0';
+		  for (i = 0; i < iCount; i++)
+		{
+		      strcat (pszReturnData, ppszTextList[i]);
+		    }
 		}
 	      else
 		{
+		  ErrorF ("winClipboardFlushXEvents - SelectionNotify - "
+			  "X*TextPropertyToTextList list_return is NULL\n");
 		  pszReturnData = malloc (1);
-		  pszReturnData[0] = 0;
+		  pszReturnData[0] = '\0';
+		}
+	    }
+	  else
+	    {
+	      switch (iReturn)
+		{
+		case XNoMemory:
+		  ErrorF ("winClipboardFlushXEvents - SelectionNotify - XNoMemory\n");
+		  break;
+		case XConverterNotFound:
+		  ErrorF ("winClipboardFlushXEvents - SelectionNotify - XConverterNotFound\n");
+		  break;
+		default:
+		  ErrorF ("winClipboardFlushXEvents - SelectionNotify - Unknown Error\n");
+		  break;
+		}
+	      pszReturnData = malloc (1);
+	      pszReturnData[0] = '\0';
 		}
 	      
 	      /* Free the data returned from XGetWindowProperty */
 	      XFreeStringList (ppszTextList);
 	      XFree (xtpText.value);
-	    }
 	      
 	  /* Convert the X clipboard string to DOS format */
 	  winClipboardUNIXtoDOS (&pszReturnData, strlen (pszReturnData));
@@ -601,6 +603,11 @@
 				   pwszUnicodeStr,
 				   iUnicodeLen);
 	    }
+	  else
+	    {
+	      pszConvertData = strdup (pszReturnData);
+	      iConvertDataLen = strlen (pszConvertData) + 1;
+	    }
 
 	  /* Access the Windows clipboard */
 	  if (!OpenClipboard (hwnd))
@@ -623,7 +630,7 @@
 	    hGlobal = GlobalAlloc (GMEM_MOVEABLE,
 				   sizeof (wchar_t) * (iUnicodeLen + 1));
 	  else
-	    hGlobal = GlobalAlloc (GMEM_MOVEABLE, strlen (pszReturnData) + 1);
+	    hGlobal = GlobalAlloc (GMEM_MOVEABLE, iConvertDataLen);
 
 	  /* Obtain a pointer to the global memory */
 	  pszGlobalData = GlobalLock (hGlobal);
@@ -640,7 +647,7 @@
 		    pwszUnicodeStr,
 		    sizeof (wchar_t) * (iUnicodeLen + 1));
 	  else
-	    strcpy (pszGlobalData, pszReturnData);
+	    strcpy (pszGlobalData, pszConvertData);
 
 	  /* Free the data returned from XGetWindowProperty */
 	  if (fUnicodeSupport)
@@ -650,8 +657,8 @@
 	    }
 	  else
 	    {
-	      XFree (pszReturnData);
-	      pszReturnData = NULL;
+	      free (pszConvertData);
+	      pszConvertData = NULL;
 	    }
 
 	  /* Release the pointer to the global memory */

Index: winconfig.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winconfig.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.1.2.1
diff -u -d -r1.1.4.1 -r1.1.4.1.2.1
--- winconfig.c	26 Nov 2003 22:49:05 -0000	1.1.4.1
+++ winconfig.c	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.1
@@ -227,7 +227,7 @@
     {  0x40c, -1, "pc105", "fr",      NULL, NULL, "French (Standard)"},
     {  0x80c, -1, "pc105", "be",      NULL, NULL, "French (Belgian)"},
     {  0x410, -1, "pc105", "it",      NULL, NULL, "Italian"},
-    {  0x411, -1, "jp",    "jp",      NULL, NULL, "Japanese"},
+    {  0x411,  7, "jp",    "jp",      NULL, NULL, "Japanese"},
     {  0x414, -1, "pc105", "no",      NULL, NULL, "Norwegian"},
     {  0x416, -1, "pc105", "pt",      NULL, NULL, "Portuguese (Brazil, ABNT)"},
     {0x10416, -1, "abnt2", "br",      NULL, NULL, "Portuguese (Brazil, ABNT2)"},
@@ -265,6 +265,32 @@
   g_winInfo.xkb.options = NULL;
 # endif	/* PC98 */
 
+#ifdef XKB
+  /*
+   * Query the windows autorepeat settings and change the xserver defaults.   
+   * If XKB is disabled then windows handles the autorepeat and the special 
+   * treatment is not needed
+   */
+  {
+    int kbd_delay;
+    DWORD kbd_speed;  
+    if (SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &kbd_delay, 0) &&
+        SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &kbd_speed, 0))
+      {
+        switch (kbd_delay) 
+          {
+            case 0:  g_winInfo.keyboard.delay = 250; break;
+            case 1:  g_winInfo.keyboard.delay = 500; break;
+            case 2:  g_winInfo.keyboard.delay = 750; break;
+            default:         
+            case 3:  g_winInfo.keyboard.delay = 1000; break;
+          }
+        g_winInfo.keyboard.rate = max(1,kbd_speed);
+        winMsgVerb(X_PROBED, 1, "Setting autorepeat to delay=%d, rate=%d\n",
+                g_winInfo.keyboard.delay, g_winInfo.keyboard.rate);
+      }
+  }       
+#endif  
   
 
   keyboardType = GetKeyboardType (0);
@@ -280,7 +306,7 @@
 	  too */
         layoutNum = (layoutNum & 0xffff);
     }
-    winMsg (X_DEFAULT, "winConfigKeyboard - Layout: \"%s\" (%08x) \n", 
+    winMsg (X_PROBED, "winConfigKeyboard - Layout: \"%s\" (%08x) \n", 
             layoutName, layoutNum);
 
     for (pLayout = winKBLayouts; pLayout->winlayout != -1; pLayout++)
@@ -290,9 +316,9 @@
 	if (pLayout->winkbtype > 0 && pLayout->winkbtype != keyboardType)
 	  continue;
 	
-	winMsg (X_DEFAULT,
-		"Using preset keyboard for \"%s\" (%s), type \"%d\"\n",
-		pLayout->layoutname, layoutName, keyboardType);
+	winMsg (X_PROBED,
+		"Using preset keyboard for \"%s\" (%x), type \"%d\"\n",
+		pLayout->layoutname, pLayout->winlayout, keyboardType);
 	
 	g_winInfo.xkb.model = pLayout->xkbmodel;
 	g_winInfo.xkb.layout = pLayout->xkblayout;
@@ -300,6 +326,18 @@
 	g_winInfo.xkb.options = pLayout->xkboptions; 
 	break;
       }
+
+    if ((layoutNum == 0x411) && keyboardType == 7)
+      {
+	/* Japanese layouts have problems with key event messages
+	   such as the lack of WM_KEYUP for Caps Lock key.
+	   Loading US layout fixes this problem. */
+	if (LoadKeyboardLayout("00000409", KLF_ACTIVATE) != NULL)
+	  winMsg (X_INFO, "Loading US keyboard layout.\n");
+	else
+	  winMsg (X_ERROR, "LoadKeyboardLaout failed.\n");
+      }
+	   
   }  
   
   g_winInfo.xkb.initialMap = NULL;
@@ -339,10 +377,29 @@
 
   if (kbd != NULL)
     {
+      char *s;
+
       if (kbd->inp_identifier)
 	winMsg (kbdfrom, "Using keyboard \"%s\" as primary keyboard\n",
 		kbd->inp_identifier);
 
+      if ((s = winSetStrOption(kbd->inp_option_lst, "AutoRepeat", NULL)))
+        {
+          if ((sscanf(s, "%ld %ld", &g_winInfo.keyboard.delay, 
+                      &g_winInfo.keyboard.rate) != 2) ||
+                  (g_winInfo.keyboard.delay < 1) || 
+                  (g_winInfo.keyboard.rate == 0) || 
+                  (1000 / g_winInfo.keyboard.rate) < 1) 
+            {
+              winErrorFVerb (2, "\"%s\" is not a valid AutoRepeat value", s);
+              xfree(s);
+              return FALSE;
+            }
+          xfree(s);
+          winMsg (X_CONFIG, "AutoRepeat: %ld %ld\n", 
+                  g_winInfo.keyboard.delay, g_winInfo.keyboard.rate);
+        }
+      
 #ifdef XKB
       from = X_DEFAULT;
       if (g_cmdline.noXkbExtension)
@@ -365,8 +422,6 @@
 	}
       else
 	{
-	  char *s;
-
 	  if ((s = winSetStrOption (kbd->inp_option_lst, "XkbRules", NULL)))
 	    {
 	      g_winInfo.xkb.rules = NULL_IF_EMPTY (s);
@@ -456,6 +511,13 @@
     {
       winMsg (X_ERROR, "No primary keyboard configured\n");
       winMsg (X_DEFAULT, "Using compiletime defaults for keyboard\n");
+#ifdef XKB
+      if (g_cmdline.noXkbExtension)
+        {
+          g_winInfo.xkb.disable = TRUE;
+          winMsg (X_CMDLINE, "XkbExtension disabled\n");
+        }
+#endif
     }
 
   return TRUE;

Index: wincutpaste.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/wincutpaste.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.1.2.1
diff -u -d -r1.1.4.1 -r1.1.4.1.2.1
--- wincutpaste.c	26 Nov 2003 22:49:05 -0000	1.1.4.1
+++ wincutpaste.c	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.1
@@ -68,8 +68,12 @@
 Display		*g_display = NULL;
 Window		g_window = 0;
 
+/* Prototypes */
 Bool
-winInitializeClipboard ()
+winInitializeClipboard (void);
+
+Bool
+winInitializeClipboard (void)
 {
   g_display = XOpenDisplay (NULL);
   if (g_display == NULL)

Index: winerror.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winerror.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.1.2.1
diff -u -d -r1.1.4.1 -r1.1.4.1.2.1
--- winerror.c	26 Nov 2003 22:49:05 -0000	1.1.4.1
+++ winerror.c	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.1
@@ -32,6 +32,10 @@
 #include "win.h"
 
 #ifdef DDXOSVERRORF
+/* Prototype */
+void
+OsVendorVErrorF (const char *pszFormat, va_list va_args);
+
 void
 OsVendorVErrorF (const char *pszFormat, va_list va_args)
 {

Index: winkeybd.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winkeybd.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.1.2.1
diff -u -d -r1.1.4.1 -r1.1.4.1.2.1
--- winkeybd.c	26 Nov 2003 22:49:05 -0000	1.1.4.1
+++ winkeybd.c	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.1
@@ -41,9 +41,12 @@
 #define XKB_IN_SERVER
 #include "XKBsrv.h"
 #endif
+#include "../../Xext/xf86miscproc.h"
 
 static Bool g_winKeyState[NUM_KEYCODES];
 
+/* Stored to get internal mode key states.  Must be read-only.  */
+static unsigned short const *g_winInternalModeKeyStatesPtr = NULL;
 
 #if WIN_NEW_KEYBOARD_SUPPORT
 
@@ -353,6 +356,8 @@
   DevicePtr		pDevice = (DevicePtr) pDeviceInt;
 #ifdef XKB
   XkbComponentNamesRec names;
+  XkbSrvInfoPtr       xkbi;
+  XkbControlsPtr      ctrl;
 #endif
 
   switch (iState)
@@ -415,7 +420,29 @@
 				       modMap, winKeybdBell, winKeybdCtrl);
 	}
 #endif
+
+#ifdef XKB
+      if (!g_winInfo.xkb.disable)
+        {  
+          xkbi = pDeviceInt->key->xkbInfo;
+          if (xkbi != NULL)
+            {  
+              ctrl = xkbi->desc->ctrls;
+              ctrl->repeat_delay = g_winInfo.keyboard.delay;
+              ctrl->repeat_interval = 1000/g_winInfo.keyboard.rate;
+            }
+          else
+            {  
+              ErrorF ("winKeybdProc - Error initializing keyboard AutoRepeat (No XKB)\n");
+            }
+        }
+#endif
+
+      
+
+      g_winInternalModeKeyStatesPtr = &(pDeviceInt->key->state);
       break;
+      
     case DEVICE_ON: 
       pDevice->on = TRUE;
       break;
@@ -473,46 +500,27 @@
 
 
 /*
- * We have to store the last state of each mode
- * key before we lose the keyboard focus.
- */
-
-void
-winStoreModeKeyStates (ScreenPtr pScreen)
-{
-#if !WIN_NEW_KEYBOARD_SUPPORT
-  winScreenPriv(pScreen);
-
-  /* Initialize all mode key states to off */
-  pScreenPriv->dwModeKeyStates = 0x0L;
-
-  pScreenPriv->dwModeKeyStates |= 
-    (GetKeyState (VK_NUMLOCK) & 0x0001) << NumLockMapIndex;
-
-  pScreenPriv->dwModeKeyStates |=
-    (GetKeyState (VK_SCROLL) & 0x0001) << ScrollLockMapIndex;
-
-  pScreenPriv->dwModeKeyStates |=
-    (GetKeyState (VK_CAPITAL) & 0x0001) << LockMapIndex;
-
-  pScreenPriv->dwModeKeyStates |=
-    (GetKeyState (VK_KANA) & 0x0001) << KanaMapIndex;
-#endif
-}
-
-
-/*
  * Upon regaining the keyboard focus we must
  * resynchronize our internal mode key states
  * with the actual state of the keys.
  */
 
 void
-winRestoreModeKeyStates (ScreenPtr pScreen)
+winRestoreModeKeyStates ()
 {
 #if !WIN_NEW_KEYBOARD_SUPPORT
-  winScreenPriv(pScreen);
   DWORD			dwKeyState;
+  unsigned short internalKeyStates;
+
+  /* X server is being initialized */
+  if (!g_winInternalModeKeyStatesPtr)
+    return;
+
+  /* Force to process all pending events in the mi event queue */
+  mieqProcessInputEvents ();
+  
+  /* Read the mode key states of our X server */
+  internalKeyStates = *g_winInternalModeKeyStatesPtr;
 
   /* 
    * NOTE: The C XOR operator, ^, will not work here because it is
@@ -522,7 +530,7 @@
 
   /* Has the key state changed? */
   dwKeyState = GetKeyState (VK_NUMLOCK) & 0x0001;
-  if (WIN_XOR (pScreenPriv->dwModeKeyStates & NumLockMask, dwKeyState))
+  if (WIN_XOR (internalKeyStates & NumLockMask, dwKeyState))
     {
       winSendKeyEvent (KEY_NumLock, TRUE);
       winSendKeyEvent (KEY_NumLock, FALSE);
@@ -530,7 +538,7 @@
 
   /* Has the key state changed? */
   dwKeyState = GetKeyState (VK_CAPITAL) & 0x0001;
-  if (WIN_XOR (pScreenPriv->dwModeKeyStates & LockMask, dwKeyState))
+  if (WIN_XOR (internalKeyStates & LockMask, dwKeyState))
     {
       winSendKeyEvent (KEY_CapsLock, TRUE);
       winSendKeyEvent (KEY_CapsLock, FALSE);
@@ -538,7 +546,7 @@
 
   /* Has the key state changed? */
   dwKeyState = GetKeyState (VK_SCROLL) & 0x0001;
-  if (WIN_XOR (pScreenPriv->dwModeKeyStates & ScrollLockMask, dwKeyState))
+  if (WIN_XOR (internalKeyStates & ScrollLockMask, dwKeyState))
     {
       winSendKeyEvent (KEY_ScrollLock, TRUE);
       winSendKeyEvent (KEY_ScrollLock, FALSE);
@@ -546,7 +554,7 @@
 
   /* Has the key state changed? */
   dwKeyState = GetKeyState (VK_KANA) & 0x0001;
-  if (WIN_XOR (pScreenPriv->dwModeKeyStates & KanaMask, dwKeyState))
+  if (WIN_XOR (internalKeyStates & KanaMask, dwKeyState))
     {
       winSendKeyEvent (KEY_HKTG, TRUE);
       winSendKeyEvent (KEY_HKTG, FALSE);

Index: winmouse.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winmouse.c,v
retrieving revision 1.1
retrieving revision 1.1.6.1
diff -u -d -r1.1 -r1.1.6.1
--- winmouse.c	14 Nov 2003 16:48:56 -0000	1.1
+++ winmouse.c	9 Dec 2003 01:37:16 -0000	1.1.6.1
@@ -34,6 +34,13 @@
 
 #include "win.h"
 
+#if defined(XFree86Server) && defined(XINPUT)
+#include "inputstr.h"
+
+/* Peek the internal button mapping */
+static CARD8 const *g_winMouseButtonMap = NULL;
+#endif
+
 void
 winMouseCtrl (DeviceIntPtr pDevice, PtrCtrl *pCtrl)
 {
@@ -65,6 +72,10 @@
 			       miPointerGetMotionEvents,
 			       winMouseCtrl,
 			       miPointerGetMotionBufferSize ());
+
+#if defined(XFree86Server) && defined(XINPUT)
+      g_winMouseButtonMap = pDeviceInt->button->map;
+#endif
       break;
 
     case DEVICE_ON:
@@ -85,7 +96,7 @@
 winMouseWheel (ScreenPtr pScreen, int iDeltaZ)
 {
   winScreenPriv(pScreen);
-  xEvent		xCurrentEvent;
+  int button; /* Button4 or Button5 */
 
   /* Button4 = WheelUp */
   /* Button5 = WheelDown */
@@ -136,11 +147,11 @@
   /* Set the button to indicate up or down wheel delta */
   if (iDeltaZ > 0)
     {
-      xCurrentEvent.u.u.detail = Button4;
+      button = Button4;
     }
   else
     {
-      xCurrentEvent.u.u.detail = Button5;
+      button = Button5;
     }
 
   /*
@@ -157,16 +168,10 @@
   while (iDeltaZ--)
     {
       /* Push the wheel button */
-      xCurrentEvent.u.u.type = ButtonPress;
-      xCurrentEvent.u.keyButtonPointer.time
-	= g_c32LastInputEventTime = GetTickCount ();
-      mieqEnqueue (&xCurrentEvent);
+      winMouseButtonsSendEvent (ButtonPress, button);
 
       /* Release the wheel button */
-      xCurrentEvent.u.u.type = ButtonRelease;
-      xCurrentEvent.u.keyButtonPointer.time
-	= g_c32LastInputEventTime = GetTickCount ();
-      mieqEnqueue (&xCurrentEvent);
+      winMouseButtonsSendEvent (ButtonRelease, button);
     }
 
   return 0;
@@ -184,6 +189,11 @@
 
   /* Load an xEvent and enqueue the event */
   xCurrentEvent.u.u.type = iEventType;
+#if defined(XFree86Server) && defined(XINPUT)
+  if (g_winMouseButtonMap)
+    xCurrentEvent.u.u.detail = g_winMouseButtonMap[iButton];
+  else
+#endif
   xCurrentEvent.u.u.detail = iButton;
   xCurrentEvent.u.keyButtonPointer.time
     = g_c32LastInputEventTime = GetTickCount ();

Index: winmultiwindowwindow.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winmultiwindowwindow.c,v
retrieving revision 1.1.4.1.2.1
retrieving revision 1.1.4.1.2.2
diff -u -d -r1.1.4.1.2.1 -r1.1.4.1.2.2
--- winmultiwindowwindow.c	2 Dec 2003 02:46:18 -0000	1.1.4.1.2.1
+++ winmultiwindowwindow.c	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.2
@@ -458,6 +458,7 @@
   char                  pszClass[CLASS_NAME_LENGTH], pszWindowID[12];
   char                  *res_name, *res_class, *res_role;
   static int		s_iWindowID = 0;
+  winPrivScreenPtr	pScreenPriv = pWinPriv->pScreenPriv;
 
 #if CYGMULTIWINDOW_DEBUG
   ErrorF ("winCreateWindowsWindow - pWin: %08x\n", pWin);
@@ -560,6 +561,9 @@
 
   /* Flag that this Windows window handles its own activation */
   SetProp (pWinPriv->hWnd, WIN_NEEDMANAGE_PROP, (HANDLE) 0);
+
+  /* Call engine-specific create window procedure */
+  (*pScreenPriv->pwinFinishCreateWindowsWindow) (pWin);
 }
 
 

Index: winmultiwindowwm.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winmultiwindowwm.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.1.2.1
diff -u -d -r1.1.4.1 -r1.1.4.1.2.1
--- winmultiwindowwm.c	26 Nov 2003 22:49:05 -0000	1.1.4.1
+++ winmultiwindowwm.c	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.1
@@ -51,8 +51,13 @@
 #include <windows.h>
 
 /* Local headers */
+#include "obj_base.h"
+#include "ddraw.h"
 #include "winwindow.h"
 
+#ifndef CYGDEBUG 
+#define CYGDEBUG NO
+#endif
 
 /*
  * Constant defines
@@ -399,10 +404,10 @@
       /* */
       if (nNum && ppList && *ppList)
 	{
-	  XFree (xtpName.value);
 	  *ppName = strdup (*ppList);
 	  XFreeStringList (ppList);
 	}
+      XFree (xtpName.value);
 
 #if CYGMULTIWINDOW_DEBUG
       ErrorF ("GetWindowName - %s %s\n",
@@ -974,16 +979,12 @@
  * winInitMultiWindowWM - 
  */
 
-Bool
-winClipboardDetectUnicodeSupport ();
-
 static void
 winInitMultiWindowWM (WMInfoPtr pWMInfo, WMProcArgPtr pProcArg)
 {
   int                   iRetries = 0;
   char			pszDisplay[512];
   int			iReturn;
-  Bool			fUnicodeSupport;
 
   ErrorF ("winInitMultiWindowWM - Hello\n");
 
@@ -1007,11 +1008,8 @@
 
   ErrorF ("winInitMultiWindowWM - pthread_mutex_lock () returned.\n");
 
-  /* Do we have Unicode support? */
-  fUnicodeSupport = winClipboardDetectUnicodeSupport ();
-
   /* Set the current locale?  What does this do? */
-  if (fUnicodeSupport && !g_fCalledSetLocale)
+  if (!g_fCalledSetLocale)
     {
       ErrorF ("winInitMultiWindowWM - Calling setlocale ()\n");
       if (!setlocale (LC_ALL, ""))

Index: winmultiwindowwndproc.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winmultiwindowwndproc.c,v
retrieving revision 1.1
retrieving revision 1.1.6.1
diff -u -d -r1.1 -r1.1.6.1
--- winmultiwindowwndproc.c	25 Nov 2003 19:28:56 -0000	1.1
+++ winmultiwindowwndproc.c	9 Dec 2003 01:37:16 -0000	1.1.6.1
@@ -599,6 +599,13 @@
       SendMessage (hwndScreen, message, wParam, lParam);
       return 0;
 
+    case WM_SETFOCUS:
+      if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
+	break;
+
+      winRestoreModeKeyStates ();
+      return 0;
+      
     case WM_KILLFOCUS:
       /* Pop any pressed keys since we are losing keyboard focus */
       winKeybdReleaseKeys ();
@@ -878,8 +885,10 @@
 		pwindPos->hwndInsertAfter);
 #endif
 	
+#if 0
 	/* Pass the message to the root window */
 	SendMessage (hwndScreen, message, wParam, lParam);
+#endif
 	
 	if (s_pScreenPriv != NULL)
 	  s_pScreenPriv->fWindowOrderChanged = TRUE;

Index: winnativegdi.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winnativegdi.c,v
retrieving revision 1.1.4.1.2.1
retrieving revision 1.1.4.1.2.2
diff -u -d -r1.1.4.1.2.1 -r1.1.4.1.2.2
--- winnativegdi.c	2 Dec 2003 06:52:01 -0000	1.1.4.1.2.1
+++ winnativegdi.c	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.2
@@ -476,7 +476,7 @@
   pScreenPriv->pwinStoreColors = winStoreColorsNativeGDI;
   pScreenPriv->pwinCreateColormap = winCreateColormapNativeGDI;
   pScreenPriv->pwinDestroyColormap = winDestroyColormapNativeGDI;
-  pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)())NoopDDA;
+  pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA;
 
   return TRUE;
 }

Index: winpfbdd.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winpfbdd.c,v
retrieving revision 1.1.4.1.2.1
retrieving revision 1.1.4.1.2.2
diff -u -d -r1.1.4.1.2.1 -r1.1.4.1.2.2
--- winpfbdd.c	2 Dec 2003 06:52:01 -0000	1.1.4.1.2.1
+++ winpfbdd.c	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.2
@@ -636,7 +636,7 @@
   /* Set our pointers */
   pScreenPriv->pwinAllocateFB = winAllocateFBPrimaryDD;
   pScreenPriv->pwinShadowUpdate
-    = (winShadowUpdateProcPtr) (void (*)())NoopDDA;
+    = (winShadowUpdateProcPtr) (void (*)(void))NoopDDA;
   pScreenPriv->pwinCloseScreen = winCloseScreenPrimaryDD;
   pScreenPriv->pwinInitVisuals = winInitVisualsPrimaryDD;
   pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModePrimaryDD;
@@ -646,9 +646,11 @@
     pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
   pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
   pScreenPriv->pwinBltExposedRegions
-    = (winBltExposedRegionsProcPtr) (void (*)())NoopDDA;
+    = (winBltExposedRegionsProcPtr) (void (*)(void))NoopDDA;
   pScreenPriv->pwinActivateApp = winActivateAppPrimaryDD;
   pScreenPriv->pwinHotKeyAltTab = winHotKeyAltTabPrimaryDD;
+  pScreenPriv->pwinFinishCreateWindowsWindow =
+    (winFinishCreateWindowsWindowProcPtr) (void (*)(void))NoopDDA;
 
   return TRUE;
 }

Index: winprefs.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winprefs.c,v
retrieving revision 1.1
retrieving revision 1.1.6.1
diff -u -d -r1.1 -r1.1.6.1
--- winprefs.c	25 Nov 2003 19:28:56 -0000	1.1
+++ winprefs.c	9 Dec 2003 01:37:16 -0000	1.1.6.1
@@ -201,7 +201,7 @@
  * Set custom icons and menus again.
  */
 static void
-ReloadPrefs ()
+ReloadPrefs (void)
 {
   int i;
 

Index: winprefs.h
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winprefs.h,v
retrieving revision 1.1
retrieving revision 1.1.6.1
diff -u -d -r1.1 -r1.1.6.1
--- winprefs.h	25 Nov 2003 19:28:56 -0000	1.1
+++ winprefs.h	9 Dec 2003 01:37:16 -0000	1.1.6.1
@@ -120,7 +120,7 @@
 
 /* Functions */
 void
-LoadPreferences();
+LoadPreferences(void);
 
 void
 SetupRootMenu (unsigned long hmenuRoot);
@@ -143,5 +143,5 @@
 winOverrideIcon (unsigned long longpWin);
 
 unsigned long
-winOverrideDefaultIcon();
+winOverrideDefaultIcon(void);
 

Index: winprefsyacc.y
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winprefsyacc.y,v
retrieving revision 1.1
retrieving revision 1.1.6.1
diff -u -d -r1.1 -r1.1.6.1
--- winprefsyacc.y	25 Nov 2003 19:28:56 -0000	1.1
+++ winprefsyacc.y	9 Dec 2003 01:37:16 -0000	1.1.6.1
@@ -54,15 +54,15 @@
 
 static void OpenMenu(char *menuname);
 static void AddMenuLine(char *name, MENUCOMMANDTYPE cmd, char *param);
-static void CloseMenu();
+static void CloseMenu(void);
 
-static void OpenIcons();
+static void OpenIcons(void);
 static void AddIconLine(char *matchstr, char *iconfile);
-static void CloseIcons();
+static void CloseIcons(void);
 
-static void OpenSysMenu();
+static void OpenSysMenu(void);
 static void AddSysMenuLine(char *matchstr, char *menuname, int pos);
-static void CloseSysMenu();
+static void CloseSysMenu(void);
 
 static int yyerror (char *s);
 

Index: winregistry.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winregistry.c,v
retrieving revision 1.1
retrieving revision 1.1.6.1
diff -u -d -r1.1 -r1.1.6.1
--- winregistry.c	14 Nov 2003 16:48:56 -0000	1.1
+++ winregistry.c	9 Dec 2003 01:37:16 -0000	1.1.6.1
@@ -31,6 +31,9 @@
 
 #include "win.h"
 
+/* Prototypes */
+DWORD
+winGetRegistryDWORD (HKEY hkey, char *pszRegistryKey);
 
 DWORD
 winGetRegistryDWORD (HKEY hkey, char *pszRegistryKey)

Index: winrop.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winrop.c,v
retrieving revision 1.1
retrieving revision 1.1.6.1
diff -u -d -r1.1 -r1.1.6.1
--- winrop.c	25 Nov 2003 19:28:56 -0000	1.1
+++ winrop.c	9 Dec 2003 01:37:16 -0000	1.1.6.1
@@ -34,6 +34,9 @@
  */
 #include "win.h"
 
+void
+ROP16 (HDC hdc, int rop);
+
 int g_copyROP[16] = { 	0xFF0062, /* GXclear 		- 0 */
 		 	0x8800C6, /* GXand 		- S & D */
 		 	0x440328, /* GXandReverse  	- S & !D */

Index: winscrinit.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winscrinit.c,v
retrieving revision 1.1.4.1.2.2
retrieving revision 1.1.4.1.2.3
diff -u -d -r1.1.4.1.2.2 -r1.1.4.1.2.3
--- winscrinit.c	5 Dec 2003 03:37:26 -0000	1.1.4.1.2.2
+++ winscrinit.c	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.3
@@ -34,32 +34,6 @@
 /* $XFree86: xc/programs/Xserver/hw/xwin/winscrinit.c,v 1.28 2003/08/07 23:47:58 alanh Exp $ */
 
 #include "win.h"
-#include "safeAlpha.h"
-
-
-static RootlessFrameProcsRec winWin32RootlessProcs = {
-    winWin32RootlessCreateFrame,
-    winWin32RootlessDestroyFrame,
-
-    winWin32RootlessMoveFrame,
-    winWin32RootlessResizeFrame,
-    winWin32RootlessRestackFrame,
-    winWin32RootlessReshapeFrame,
-    winWin32RootlessUnmapFrame,
-
-    winWin32RootlessStartDrawing,
-    winWin32RootlessStopDrawing,
-    winWin32RootlessUpdateRegion,
-#ifndef ROOTLESS_TRACK_DAMAGE
-    winWin32RootlessDamageRects,
-#endif
-    winWin32RootlessRootlessSwitchWindow,
-
-    NULL,//winWin32RootlessCopyBytes,
-    NULL,//winWin32RootlessFillBytes,
-    NULL,//winWin32RootlessCompositePixels,
-    winWin32RootlessCopyWindow
-};
 
 
 /*
@@ -82,6 +56,20 @@
 	  pScreenInfo->dwWidth, pScreenInfo->dwHeight);
 #endif
 
+  /* Bail if -rootless and -multiwindow flags both present */
+  if (pScreenInfo->fRootless && pScreenInfo->fMultiWindow)
+    {
+      ErrorF ("winScreenInit - The -rootless and -multiwindow parameters\n"
+	      "\tcannot be used together.  Note that the -rootless parameter\n"
+	      "\trequires an external window manager (e.g. twm), while the\n"
+	      "\t-multiwindow parameter forbids an external window manager\n"
+	      "\tsince it uses an internal window manager.  Please correct\n"
+	      "\tyour command-line parameters; do not forget to stop\n"
+	      "\tlaunching an external window manager if you are using\n"
+	      "\tthe -multiwindow command-line parameter.");
+      return FALSE;
+    }
+
   /* Allocate privates for this screen */
   if (!winAllocatePrivates (pScreen))
     {
@@ -415,10 +403,9 @@
 
 #if !WIN_LAYER_SUPPORT
   /* Initialize the shadow framebuffer layer */
-  if ((pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
+  if (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
        || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
        || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL)
-      &&(!pScreenInfo->fRootless))
     {
 #if CYGDEBUG
       ErrorF ("winFinishScreenInitFB - Calling shadowInit ()\n");
@@ -437,22 +424,39 @@
   /* Handle pseudo-rootless mode */
   if (pScreenInfo->fRootless)
     {
-      ErrorF ("winScreenInit - RootlessInit\n");
-      
-      RootlessInit(pScreen, &winWin32RootlessProcs);
+      /* Define the WRAP macro temporarily for local use */
+#define WRAP(a) \
+    if (pScreen->a) { \
+        pScreenPriv->a = pScreen->a; \
+    } else { \
+        ErrorF("null screen fn " #a "\n"); \
+        pScreenPriv->a = NULL; \
+    }
       
-      ErrorF ("winScreenInit - RootlessInit - done\n");
+      /* Save a pointer to each lower-level window procedure */
+      WRAP(CreateWindow);
+      WRAP(DestroyWindow);
+      WRAP(RealizeWindow);
+      WRAP(UnrealizeWindow);
+      WRAP(PositionWindow);
+      WRAP(ChangeWindowAttributes);
+#ifdef SHAPE
+      WRAP(SetShape);
+#endif
       
-      rootless_CopyBytes_threshold = 0;
-      rootless_FillBytes_threshold = 0;
-      rootless_CompositePixels_threshold = 0;
-      rootless_CopyWindow_threshold = 1;/* FIXME: How many? Profiling needed? */
+      /* Assign pseudo-rootless window procedures to be top level procedures */
+      pScreen->CreateWindow = winCreateWindowPRootless;
+      pScreen->DestroyWindow = winDestroyWindowPRootless;
+      pScreen->PositionWindow = winPositionWindowPRootless;
+      pScreen->ChangeWindowAttributes = winChangeWindowAttributesPRootless;
+      pScreen->RealizeWindow = winMapWindowPRootless;
+      pScreen->UnrealizeWindow = winUnmapWindowPRootless;
+#ifdef SHAPE
+      pScreen->SetShape = winSetShapePRootless;
+#endif
 
-      if (!winWin32RootlessInitCursor (pScreen))
-	{
-	  return FALSE;
-	}
-      winWindowsWMExtensionInit ();
+      /* Undefine the WRAP macro, as it is not needed elsewhere */
+#undef WRAP
     }
   /* Handle multi window mode */
   else if (pScreenInfo->fMultiWindow)
@@ -688,11 +692,11 @@
 
   /* Colormap Routines */
   pScreen->CreateColormap = miInitializeColormap;
-  pScreen->DestroyColormap = (DestroyColormapProcPtr) (void (*)()) NoopDDA;
+  pScreen->DestroyColormap = (DestroyColormapProcPtr) (void (*)(void)) NoopDDA;
   pScreen->InstallColormap = miInstallColormap;
   pScreen->UninstallColormap = miUninstallColormap;
   pScreen->ListInstalledColormaps = miListInstalledColormaps;
-  pScreen->StoreColors = (StoreColorsProcPtr) (void (*)()) NoopDDA;
+  pScreen->StoreColors = (StoreColorsProcPtr) (void (*)(void)) NoopDDA;
   pScreen->ResolveColor = miResolveColor;
 
   /* Bitmap */

Index: winshaddd.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winshaddd.c,v
retrieving revision 1.1.4.1.2.1
retrieving revision 1.1.4.1.2.2
diff -u -d -r1.1.4.1.2.1 -r1.1.4.1.2.2
--- winshaddd.c	2 Dec 2003 06:52:01 -0000	1.1.4.1.2.1
+++ winshaddd.c	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.2
@@ -1365,10 +1365,11 @@
   pScreenPriv->pwinStoreColors = winStoreColorsShadowDD;
   pScreenPriv->pwinCreateColormap = winCreateColormapShadowDD;
   pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDD;
-  pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)())NoopDDA;
+  pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA;
   pScreenPriv->pwinCreatePrimarySurface = winCreatePrimarySurfaceShadowDD;
   pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDD;
+  pScreenPriv->pwinFinishCreateWindowsWindow =
+    (winFinishCreateWindowsWindowProcPtr) (void (*)(void))NoopDDA;
 
   return TRUE;
 }
-

Index: winshadddnl.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winshadddnl.c,v
retrieving revision 1.1.4.1.2.1
retrieving revision 1.1.4.1.2.2
diff -u -d -r1.1.4.1.2.1 -r1.1.4.1.2.2
--- winshadddnl.c	2 Dec 2003 06:52:01 -0000	1.1.4.1.2.1
+++ winshadddnl.c	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.2
@@ -453,6 +453,53 @@
 
 
 /*
+ * Create a DirectDraw surface for the new multi-window window
+ */
+
+static
+Bool
+winFinishCreateWindowsWindowDDNL (WindowPtr pWin)
+{
+  winWindowPriv(pWin);
+  winPrivScreenPtr	pScreenPriv = pWinPriv->pScreenPriv;
+  HRESULT		ddrval = DD_OK;
+  DDSURFACEDESC2	ddsd;
+  int			iWidth, iHeight;
+  int			iX, iY;
+
+  ErrorF ("\nwinFinishCreateWindowsWindowDDNL!\n\n");
+
+  iX = pWin->drawable.x + GetSystemMetrics (SM_XVIRTUALSCREEN);
+  iY = pWin->drawable.y + GetSystemMetrics (SM_YVIRTUALSCREEN);
+  
+  iWidth = pWin->drawable.width;
+  iHeight = pWin->drawable.height;
+
+  /* Describe the primary surface */
+  ZeroMemory (&ddsd, sizeof (ddsd));
+  ddsd.dwSize = sizeof (ddsd);
+  ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
+  ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
+  ddsd.dwHeight = iHeight;
+  ddsd.dwWidth = iWidth;
+
+  /* Create the primary surface */
+  ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4,
+				       &ddsd,
+				       &pWinPriv->pddsPrimary4,
+				       NULL);
+  if (FAILED (ddrval))
+    {
+      ErrorF ("winFinishCreateWindowsWindowDDNL - Could not create primary "
+	      "surface: %08x\n",
+	      (unsigned int)ddrval);
+      return FALSE;
+    }
+  return TRUE;
+}
+
+
+/*
  * Transfer the damaged regions of the shadow framebuffer to the display.
  */
 
@@ -1307,11 +1354,11 @@
   pScreenPriv->pwinStoreColors = winStoreColorsShadowDDNL;
   pScreenPriv->pwinCreateColormap = winCreateColormapShadowDDNL;
   pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowDDNL;
-  pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)())NoopDDA;
+  pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA;
   pScreenPriv->pwinCreatePrimarySurface = winCreatePrimarySurfaceShadowDDNL;
   pScreenPriv->pwinReleasePrimarySurface = winReleasePrimarySurfaceShadowDDNL;
+  pScreenPriv->pwinFinishCreateWindowsWindow
+    = winFinishCreateWindowsWindowDDNL;
 
   return TRUE;
 }
-
-

Index: winshadgdi.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winshadgdi.c,v
retrieving revision 1.1.4.1.2.1
retrieving revision 1.1.4.1.2.2
diff -u -d -r1.1.4.1.2.1 -r1.1.4.1.2.2
--- winshadgdi.c	2 Dec 2003 06:52:01 -0000	1.1.4.1.2.1
+++ winshadgdi.c	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.2
@@ -37,6 +37,8 @@
 
 BOOL CALLBACK
 winRedrawAllProcShadowGDI (HWND hwnd, LPARAM lParam);
+Bool
+winBltExposedRegionsShadowGDI (ScreenPtr pScreen);
 
 
 /*
@@ -1170,11 +1172,11 @@
   pScreenPriv->pwinStoreColors = winStoreColorsShadowGDI;
   pScreenPriv->pwinCreateColormap = winCreateColormapShadowGDI;
   pScreenPriv->pwinDestroyColormap = winDestroyColormapShadowGDI;
-  pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)())NoopDDA;
+  pScreenPriv->pwinHotKeyAltTab = (winHotKeyAltTabProcPtr) (void (*)(void))NoopDDA;
   pScreenPriv->pwinCreatePrimarySurface
-    = (winCreatePrimarySurfaceProcPtr) (void (*)())NoopDDA;
+    = (winCreatePrimarySurfaceProcPtr) (void (*)(void))NoopDDA;
   pScreenPriv->pwinReleasePrimarySurface
-    = (winReleasePrimarySurfaceProcPtr) (void (*)())NoopDDA;
+    = (winReleasePrimarySurfaceProcPtr) (void (*)(void))NoopDDA;
 
   return TRUE;
 }

Index: winvideo.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winvideo.c,v
retrieving revision 1.1
retrieving revision 1.1.6.1
diff -u -d -r1.1 -r1.1.6.1
--- winvideo.c	25 Nov 2003 19:28:56 -0000	1.1
+++ winvideo.c	9 Dec 2003 01:37:16 -0000	1.1.6.1
@@ -33,6 +33,8 @@
 #include "Xv.h"
 #include "Xvproto.h"
 
+void
+winInitVideo (ScreenPtr pScreen);
 
 /*
  * winInitVideo - Initialize support for the X Video (Xv) Extension.

Index: winwakeup.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winwakeup.c,v
retrieving revision 1.1.4.1.2.1
retrieving revision 1.1.4.1.2.2
diff -u -d -r1.1.4.1.2.1 -r1.1.4.1.2.2
--- winwakeup.c	5 Dec 2003 03:37:26 -0000	1.1.4.1.2.1
+++ winwakeup.c	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.2
@@ -41,7 +41,9 @@
 		  unsigned long ulResult,
 		  pointer pReadmask)
 {
+#if 0
   winScreenPriv((ScreenPtr)pWakeupData);
+#endif
   MSG			msg;
 
   /* Process all messages on our queue */
@@ -55,12 +57,5 @@
 	  DispatchMessage (&msg);
 	}
     }
-
-  if (pScreenPriv->pScreenInfo->fMultiWindow)
     winReorderWindowsMultiWindow ((ScreenPtr)pWakeupData);
-
-  if (pScreenPriv->pScreenInfo->fRootless)
-    winWin32RootlessReorderWindows ((ScreenPtr)pWakeupData);
 }
-
-

Index: winwindow.h
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winwindow.h,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.1.2.1
diff -u -d -r1.1.4.1 -r1.1.4.1.2.1
--- winwindow.h	26 Nov 2003 22:49:06 -0000	1.1.4.1
+++ winwindow.h	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.1
@@ -75,6 +75,15 @@
   Bool			fXKilled;
   Bool                  fNeedRestore;
   POINT                 ptRestore;
+
+  /* Privates used by primary fb DirectDraw server */
+  LPDDSURFACEDESC	pddsdPrimary;
+
+  /* Privates used by shadow fb DirectDraw Nonlocking server */
+  LPDIRECTDRAWSURFACE4	pddsPrimary4;
+
+  /* Privates used by both shadow fb DirectDraw servers */
+  LPDIRECTDRAWCLIPPER	pddcPrimary;
 } winPrivWinRec, *winPrivWinPtr;
 
 typedef struct _winWMMessageRec{
@@ -119,12 +128,11 @@
 	   int dwScreen);
 
 void
-winDeinitMultiWindowWM ();
+winDeinitMultiWindowWM (void);
 
 void
 winMinimizeWindow (Window id);
 
-
 /*
  * winmultiwindowicons.c
  */

Index: winwndproc.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winwndproc.c,v
retrieving revision 1.1.4.1.2.1
retrieving revision 1.1.4.1.2.2
diff -u -d -r1.1.4.1.2.1 -r1.1.4.1.2.2
--- winwndproc.c	2 Dec 2003 06:52:01 -0000	1.1.4.1.2.1
+++ winwndproc.c	9 Dec 2003 01:37:16 -0000	1.1.4.1.2.2
@@ -36,6 +36,7 @@
 #include "win.h"
 #include <commctrl.h>
 #include "winprefs.h"
+#include "winconfig.h"
 
 /*
  * Global variables
@@ -118,9 +119,6 @@
       s_hwndLastPrivates = hwnd;
       SetProp (hwnd, WIN_SCR_PROP, s_pScreenPriv);
 
-      /* Store the mode key states so restore doesn't try to restore them */
-      winStoreModeKeyStates (s_pScreen);
-
       /* Setup tray icon */
       if (!s_pScreenInfo->fNoTrayIcon)
 	{
@@ -837,16 +835,13 @@
 	break;
 
       /* Restore the state of all mode keys */
-      winRestoreModeKeyStates (s_pScreen);
+      winRestoreModeKeyStates ();
       return 0;
 
     case WM_KILLFOCUS:
       if (s_pScreenPriv == NULL || s_pScreenInfo->fIgnoreInput)
 	break;
 
-      /* Store the state of all mode keys */
-      winStoreModeKeyStates (s_pScreen);
-
       /* Release any pressed keys */
       winKeybdReleaseKeys ();
       return 0;
@@ -911,12 +906,30 @@
       if (wParam == VK_LWIN || wParam == VK_RWIN)
 	break;
 
+#ifdef XKB
+      /* 
+       * Discard presses generated from Windows auto-repeat
+       * ago: Only discard them if XKB is not disabled 
+       */
+      if (!g_winInfo.xkb.disable) 
+        {  
+          if (lParam & (1<<30))
+	    return 0;
+        } 
+#endif 
+      
       /* Discard fake Ctrl_L presses that precede AltGR on non-US keyboards */
       if (winIsFakeCtrl_L (message, wParam, lParam))
 	return 0;
       
-      /* Send the key event(s) */
+      /* Translate Windows key code to X scan code */
       winTranslateKey (wParam, lParam, &iScanCode);
+
+      /* Ignore repeats for CapsLock */
+      if (wParam == VK_CAPITAL)
+	lParam = 1;
+
+      /* Send the key event(s) */
       for (i = 0; i < LOWORD(lParam); ++i)
 	winSendKeyEvent (iScanCode, TRUE);
       return 0;
@@ -1055,6 +1068,7 @@
 	}
       break;
 
+    case WM_ENDSESSION:
     case WM_GIVEUP:
        /* Tell X that we are giving up */
       winDeinitClipboard ();





More information about the xorg-commit mailing list