[Xorg-commit] xc/programs/Xserver/hw/xwin winclipboardwndproc.c,1.1.4.1.2.5,1.1.4.1.2.6 winclipboardwrappers.c,1.1.2.3,1.1.2.4 winclipboardxevents.c,1.1.4.1.2.5,1.1.4.1.2.6

Harold L Hunt II xorg-commit at pdx.freedesktop.org
Sun Jan 11 04:49:36 EET 2004


Committed by: harold

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

Modified Files:
      Tag: CYGWIN
	winclipboardwndproc.c winclipboardwrappers.c 
	winclipboardxevents.c 
Log Message:
Sync with XWin Server 4.3.0-35 release.  Minor updates for crashes in clipboard code.

Index: winclipboardwndproc.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winclipboardwndproc.c,v
retrieving revision 1.1.4.1.2.5
retrieving revision 1.1.4.1.2.6
diff -u -d -r1.1.4.1.2.5 -r1.1.4.1.2.6
--- winclipboardwndproc.c	10 Jan 2004 07:50:57 -0000	1.1.4.1.2.5
+++ winclipboardwndproc.c	11 Jan 2004 02:49:14 -0000	1.1.4.1.2.6
@@ -155,6 +155,20 @@
 	    return 0;
 	  }
 
+	/*
+	 * Do not take ownership of the X11 selections when something
+	 * other than CF_TEXT or CF_UNICODETEXT has been copied
+	 * into the Win32 clipboard.
+	 */
+	if (!IsClipboardFormatAvailable (CF_TEXT)
+	    && !IsClipboardFormatAvailable (CF_UNICODETEXT))
+	  {
+	    ErrorF ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+		    "Clipboard does not contain CF_TEXT nor CF_UNICODETEXT; "
+		    "not taking ownership of X11 selections.\n");
+	    return 0;
+	  }
+
 	/* Reassert ownership of PRIMARY */	  
 	iReturn = XSetSelectionOwner (pDisplay,
 				      XA_PRIMARY,
@@ -196,55 +210,16 @@
 
 
     case WM_DESTROYCLIPBOARD:
-#if 0
-      {
-	int	iReturn;
-	Display *pDisplay = g_pClipboardDisplay;
-
-	/* Do nothing if winProcSetSelectionOwner called EmptyClipboard */
-	if (hwnd == GetClipboardOwner ())
-	  {
-	    ErrorF ("winClipboardWindowProc - WM_DESTROYCLIPBOARD - "
-		    "winProcSetSelectionOwner called EmptyClipboard, "
-		    "doing nothing.\n");
-	    return 0;
-	  }
-
-	/* Release ownership of PRIMARY */	  
-	iReturn = XSetSelectionOwner (pDisplay,
-				      XA_PRIMARY,
-				      None,
-				      CurrentTime);
-	if (iReturn == BadAtom || iReturn == BadWindow)
-	  {
-	    ErrorF ("winClipboardWindowProc - WM_DESTROYCLIPBOARD - "
-		    "Could not release ownership of PRIMARY\n");
-	  }
-	else
-	  {
-	    ErrorF ("winClipboardWindowProc - WM_DESTROYCLIPBOARD - "
-		    "Released ownership of PRIMARY\n");
-	  }
-	
-	/* Release ownership of the CLIPBOARD */	  
-	iReturn = XSetSelectionOwner (pDisplay,
-				      XInternAtom (pDisplay,
-						   "CLIPBOARD",
-						   FALSE),
-				      None,
-				      CurrentTime);
-	if (iReturn == BadAtom || iReturn == BadWindow)
-	  {
-	    ErrorF ("winClipboardWindowProc - WM_DESTROYCLIPBOARD - "
-		    "Could not release ownership of CLIPBOARD\n");
-	  }
-	else
-	  {
-	    ErrorF ("winClipboardWindowProc - WM_DESTROYCLIPBOARD - "
-		    "Released ownership of CLIPBOARD\n");
-	  }
-      }
-#endif
+      /*
+       * NOTE: Intentionally do nothing.
+       * Changes in the Win32 clipboard are handled by WM_DRAWCLIPBOARD
+       * above.  We only process this message to conform to the specs
+       * for delayed clipboard rendering in Win32.  You might think
+       * that we need to release ownership of the X11 selections, but
+       * we do not, because a WM_DRAWCLIPBOARD message will closely
+       * follow this message and reassert ownership of the X11
+       * selections, handling the issue for us.
+       */
       return 0;
 
 

Index: winclipboardwrappers.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/Attic/winclipboardwrappers.c,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -d -r1.1.2.3 -r1.1.2.4
--- winclipboardwrappers.c	10 Jan 2004 07:50:57 -0000	1.1.2.3
+++ winclipboardwrappers.c	11 Jan 2004 02:49:14 -0000	1.1.2.4
@@ -388,6 +388,13 @@
       goto winProcSetSelectionOwner_Done;
     }
 
+  /* Abort if no window at this point */
+  if (None == stuff->window)
+    {
+      ErrorF ("winProcSetSelectionOwner - No window, returning.\n");
+      goto winProcSetSelectionOwner_Done;
+    }
+
   /* Abort if invalid selection */
   if (!ValidAtom (stuff->selection))
     {

Index: winclipboardxevents.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/hw/xwin/winclipboardxevents.c,v
retrieving revision 1.1.4.1.2.5
retrieving revision 1.1.4.1.2.6
diff -u -d -r1.1.4.1.2.5 -r1.1.4.1.2.6
--- winclipboardxevents.c	9 Jan 2004 06:24:25 -0000	1.1.4.1.2.5
+++ winclipboardxevents.c	11 Jan 2004 02:49:14 -0000	1.1.4.1.2.6
@@ -214,9 +214,31 @@
 	  
 	  /* Get a pointer to the clipboard text, in desired format */
 	  if (fUnicodeSupport)
-	    hGlobal = GetClipboardData (CF_UNICODETEXT);
+	    {
+	      /* Check that clipboard format is available */
+	      if (!IsClipboardFormatAvailable (CF_UNICODETEXT))
+		{
+		  ErrorF ("winClipboardFlushXEvents - CF_UNICODETEXT is not "
+			  "available from Win32 clipboard.  Aborting.\n");
+		  break;
+		}
+
+	      /* Retrieve clipboard data */
+	      hGlobal = GetClipboardData (CF_UNICODETEXT);
+	    }
 	  else
-	    hGlobal = GetClipboardData (CF_TEXT);
+	    {
+	      /* Check that clipboard format is available */
+	      if (!IsClipboardFormatAvailable (CF_TEXT))
+		{
+		  ErrorF ("winClipboardFlushXEvents - CF_TEXT is not "
+			  "available from Win32 clipboard.  Aborting.\n");
+		  break;
+		}
+
+	      /* Retrieve clipboard data */
+	      hGlobal = GetClipboardData (CF_TEXT);
+	    }
 	  if (!hGlobal)
 	    {
 	      ErrorF ("winClipboardFlushXEvents - SelectionRequest - "





More information about the xorg-commit mailing list