[Xorg-commit] xc/programs/Xserver/hw/xwin InitOutput.c,1.1.4.1.2.11,1.1.4.1.2.12 winclipboardwrappers.c,1.1.2.8,1.1.2.9 winclipboardxevents.c,1.1.4.1.2.9,1.1.4.1.2.10 winglobals.c,1.1.2.4,1.1.2.5 winmsg.h,1.1.4.1,1.1.4.1.2.1 winmultiwindowwm.c,1.1.4.1.2.3,1.1.4.1.2.4

Harold L Hunt II xorg-commit at pdx.freedesktop.org
Fri Jan 16 23:26:41 EET 2004


Committed by: harold

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

Modified Files:
      Tag: CYGWIN
	InitOutput.c winclipboardwrappers.c winclipboardxevents.c 
	winglobals.c winmsg.h winmultiwindowwm.c 
Log Message:
Sync with XWin Server 4.3.0-42 release.  Minor fixes to clipboard code to hopefully fix some crashes.  Cleanup of multi-window mode exit messages.

Index: InitOutput.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/InitOutput.c,v
retrieving revision 1.1.4.1.2.11
retrieving revision 1.1.4.1.2.12
diff -u -d -r1.1.4.1.2.11 -r1.1.4.1.2.12
--- InitOutput.c	15 Jan 2004 06:06:44 -0000	1.1.4.1.2.11
+++ InitOutput.c	16 Jan 2004 21:26:36 -0000	1.1.4.1.2.12
@@ -57,6 +57,9 @@
 char *		g_pszLogFile = WIN_LOG_FNAME;
 Bool		g_fLogInited = FALSE;
 
+extern Bool			g_fClipboardLaunched;
+extern Bool			g_fClipboardStarted;
+
 extern HMODULE			g_hmodDirectDraw;
 extern FARPROC			g_fpDirectDrawCreate;
 extern FARPROC			g_fpDirectDrawCreateClipper;
@@ -123,7 +126,7 @@
   ErrorF ("OsVendorReset - Hello\n");
 
   /* Close down clipboard resources */
-  if (g_fClipboard)
+  if (g_fClipboard && g_fClipboardLaunched && g_fClipboardStarted)
     {
       /* Synchronously destroy the clipboard window */
       if (g_hwndClipboard != NULL)

Index: winclipboardwrappers.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/Attic/winclipboardwrappers.c,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -d -r1.1.2.8 -r1.1.2.9
--- winclipboardwrappers.c	15 Jan 2004 06:06:44 -0000	1.1.2.8
+++ winclipboardwrappers.c	16 Jan 2004 21:26:36 -0000	1.1.2.9
@@ -102,6 +102,17 @@
       return iReturn;
     }
 
+  /* Make errors more obvious */
+  winProcQueryTreeOrig = NULL;
+
+  /* Do nothing if clipboard is not enabled */
+  if (!g_fClipboard)
+    {
+      ErrorF ("winProcQueryTree - Clipboard is not enabled, "
+	      "returning.\n");
+      return iReturn;
+    }
+
   /* If the clipboard client has already been started, abort */
   if (g_fClipboardLaunched)
     {
@@ -172,6 +183,19 @@
 
   ErrorF ("winProcEstablishConnection - Hello\n");
 
+  /* Do nothing if clipboard is not enabled */
+  if (!g_fClipboard)
+    {
+      ErrorF ("winProcEstablishConnection - Clipboard is not enabled, "
+	      "returning.\n");
+      
+      /* Unwrap the original function, call it, and return */
+      InitialVector[2] = winProcEstablishConnectionOrig;
+      iReturn = (*winProcEstablishConnectionOrig) (client);
+      winProcEstablishConnectionOrig = NULL;
+      return iReturn;
+    }
+
   /* Watch for server reset */
   if (s_ulServerGeneration != serverGeneration)
     {

Index: winclipboardxevents.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winclipboardxevents.c,v
retrieving revision 1.1.4.1.2.9
retrieving revision 1.1.4.1.2.10
diff -u -d -r1.1.4.1.2.9 -r1.1.4.1.2.10
--- winclipboardxevents.c	15 Jan 2004 06:06:44 -0000	1.1.4.1.2.9
+++ winclipboardxevents.c	16 Jan 2004 21:26:36 -0000	1.1.4.1.2.10
@@ -78,6 +78,7 @@
       int			i;
       Bool			fAbort = FALSE;
       Bool			fCloseClipboard = FALSE;
+      Bool			fSetClipboardData = TRUE;
 
       /* Get the next event - will not block because one is ready */
       XNextEvent (pDisplay, &event);
@@ -734,6 +735,9 @@
 	  else
 	    SetClipboardData (CF_TEXT, hGlobal);
 
+	  /* Flag that SetClipboardData has been called */
+	  fSetClipboardData = FALSE;
+
 	  /*
 	   * NOTE: Do not try to free pszGlobalData, it is owned by
 	   * Windows after the call to SetClipboardData ().
@@ -751,6 +755,10 @@
 	    free (pwszUnicodeStr);
 	  if (hGlobal && pszGlobalData)
 	    GlobalUnlock (hGlobal);
+	  if (fSetClipboardData && fUnicodeSupport)
+	    SetClipboardData (CF_UNICODETEXT, NULL);
+	  if (fSetClipboardData && !fUnicodeSupport)
+	    SetClipboardData (CF_TEXT, NULL);
 	  break;
 
 	default:

Index: winglobals.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/Attic/winglobals.c,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -d -r1.1.2.4 -r1.1.2.5
--- winglobals.c	15 Jan 2004 06:06:44 -0000	1.1.2.4
+++ winglobals.c	16 Jan 2004 21:26:36 -0000	1.1.2.5
@@ -85,7 +85,6 @@
 Bool			g_fClipboardLaunched = FALSE;
 Bool			g_fClipboardStarted = FALSE;
 pthread_t		g_ptClipboardProc;
-Bool			g_fClipboardStarted;
 HWND			g_hwndClipboard;
 void			*g_pClipboardDisplay;
 Window			g_iClipboardWindow;
@@ -98,7 +97,12 @@
  */
 
 void
-winInitializeGlobals ()
+winInitializeGlobals (void)
 {
   g_fClipboardLaunched = FALSE;
+  g_fClipboardStarted = FALSE;
+  g_iClipboardWindow = None;
+  g_pClipboardDisplay = NULL;
+  g_atomLastOwnedSelection = None;
+  g_hwndClipboard = NULL;
 }

Index: winmsg.h
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winmsg.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
--- winmsg.h	26 Nov 2003 22:49:05 -0000	1.1.4.1
+++ winmsg.h	16 Jan 2004 21:26:36 -0000	1.1.4.1.2.1
@@ -1,3 +1,5 @@
+#ifndef __WIN_MSG_H__
+#define __WIN_MSG_H__
 /*
  *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
  *
@@ -29,8 +31,6 @@
  */
 /* $XFree86: xc/programs/Xserver/hw/xwin/winmsg.h,v 1.2 2003/10/02 13:30:10 eich Exp $ */
 
-#ifndef __WIN_MSG_H__
-#define __WIN_MSG_H__
 
 /*
  * Function prototypes

Index: winmultiwindowwm.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winmultiwindowwm.c,v
retrieving revision 1.1.4.1.2.3
retrieving revision 1.1.4.1.2.4
diff -u -d -r1.1.4.1.2.3 -r1.1.4.1.2.4
--- winmultiwindowwm.c	13 Jan 2004 01:08:37 -0000	1.1.4.1.2.3
+++ winmultiwindowwm.c	16 Jan 2004 21:26:36 -0000	1.1.4.1.2.4
@@ -661,7 +661,7 @@
 	  break;
 
 	default:
-	  ErrorF ("winMultiWindowWMProc - Unknown Message.\n");
+	  ErrorF ("winMultiWindowWMProc - Unknown Message.  Exiting.\n");
 	  pthread_exit (NULL);
 	  break;
 	}
@@ -688,7 +688,6 @@
 }
 
 
-
 /*
  * X message procedure
  */
@@ -712,7 +711,7 @@
   /* Check that argument pointer is not invalid */
   if (pProcArg == NULL)
     {
-      ErrorF ("winMultiWindowXMsgProc - pProcArg is NULL, bailing.\n");
+      ErrorF ("winMultiWindowXMsgProc - pProcArg is NULL.  Exiting.\n");
       pthread_exit (NULL);
     }
 
@@ -722,7 +721,8 @@
   iReturn = pthread_mutex_lock (pProcArg->ppmServerStarted);
   if (iReturn != 0)
     {
-      ErrorF ("winMultiWindowXMsgProc - pthread_mutex_lock () failed: %d\n",
+      ErrorF ("winMultiWindowXMsgProc - pthread_mutex_lock () failed: %d.  "
+	      "Exiting.\n",
 	      iReturn);
       pthread_exit (NULL);
     }
@@ -732,7 +732,7 @@
   /* Allow multiple threads to access Xlib */
   if (XInitThreads () == 0)
     {
-      ErrorF ("winMultiWindowXMsgProc - XInitThreads () failed.\n");
+      ErrorF ("winMultiWindowXMsgProc - XInitThreads () failed.  Exiting.\n");
       pthread_exit (NULL);
     }
 
@@ -757,13 +757,13 @@
       && iReturn != WIN_JMP_OKAY)
     {
       /* setjmp returned an unknown value, exit */
-      ErrorF ("winInitMultiWindowXMsgProc - setjmp returned: %d exiting\n",
+      ErrorF ("winInitMultiWindowXMsgProc - setjmp returned: %d.  Exiting.\n",
 	      iReturn);
       pthread_exit (NULL);
     }
   else if (iReturn == WIN_JMP_ERROR_IO)
     {
-      ErrorF ("winInitMultiWindowXMsgProc - Caught IO Error, shutting down\n");
+      ErrorF ("winInitMultiWindowXMsgProc - Caught IO Error.  Exiting.\n");
       pthread_exit (NULL);
     }
 
@@ -803,8 +803,8 @@
   /* Make sure that the display opened */
   if (pProcArg->pDisplay == NULL)
     {
-      ErrorF ("winMultiWindowXMsgProc - "
-	      "Failed opening the display, giving up.\n\f");
+      ErrorF ("winMultiWindowXMsgProc - Failed opening the display.  "
+	      "Exiting.\n");
       pthread_exit (NULL);
     }
 
@@ -978,7 +978,7 @@
   /* Check that argument pointer is not invalid */
   if (pProcArg == NULL)
     {
-      ErrorF ("winInitMultiWindowWM - pProcArg is NULL, bailing.\n");
+      ErrorF ("winInitMultiWindowWM - pProcArg is NULL.  Exiting.\n");
       pthread_exit (NULL);
     }
 
@@ -988,7 +988,8 @@
   iReturn = pthread_mutex_lock (pProcArg->ppmServerStarted);
   if (iReturn != 0)
     {
-      ErrorF ("winInitMultiWindowWM - pthread_mutex_lock () failed: %d\n",
+      ErrorF ("winInitMultiWindowWM - pthread_mutex_lock () failed: %d.  "
+	      "Exiting.\n",
 	      iReturn);
       pthread_exit (NULL);
     }
@@ -998,7 +999,7 @@
   /* Allow multiple threads to access Xlib */
   if (XInitThreads () == 0)
     {
-      ErrorF ("winInitMultiWindowWM - XInitThreads () failed.\n");
+      ErrorF ("winInitMultiWindowWM - XInitThreads () failed.  Exiting.\n");
       pthread_exit (NULL);
     }
 
@@ -1022,13 +1023,13 @@
       && iReturn != WIN_JMP_OKAY)
     {
       /* setjmp returned an unknown value, exit */
-      ErrorF ("winInitMultiWindowWM - setjmp returned: %d exiting\n",
+      ErrorF ("winInitMultiWindowWM - setjmp returned: %d.  Exiting.\n",
 	      iReturn);
       pthread_exit (NULL);
     }
   else if (iReturn == WIN_JMP_ERROR_IO)
     {
-      ErrorF ("winInitMultiWindowWM - Caught IO Error, shutting down\n");
+      ErrorF ("winInitMultiWindowWM - Caught IO Erro.  Exiting.\n");
       pthread_exit (NULL);
     }
 
@@ -1068,8 +1069,8 @@
   /* Make sure that the display opened */
   if (pWMInfo->pDisplay == NULL)
     {
-      ErrorF ("winInitMultiWindowWM - Failed opening the display, "
-	      "giving up.\n\f");
+      ErrorF ("winInitMultiWindowWM - Failed opening the display.  "
+	      "Exiting.\n");
       pthread_exit (NULL);
     }
 





More information about the xorg-commit mailing list