Xming: Check clipboard selection ownership after taking it
When you take ownership of a selection you should always check you got it (X11 ICCCM gospel). Copyright (C) Colin Harrison 2005-2008 http://www.straightrunning.com/XmingNotes/ http://sourceforge.net/projects/xming/ Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
This commit is contained in:
		
							parent
							
								
									cb6315072f
								
							
						
					
					
						commit
						d7c27bfe55
					
				| 
						 | 
					@ -273,7 +273,8 @@ winClipboardProc (void *pvNotUsed)
 | 
				
			||||||
      /* PRIMARY */
 | 
					      /* PRIMARY */
 | 
				
			||||||
      iReturn = XSetSelectionOwner (pDisplay, XA_PRIMARY,
 | 
					      iReturn = XSetSelectionOwner (pDisplay, XA_PRIMARY,
 | 
				
			||||||
				    iWindow, CurrentTime);
 | 
									    iWindow, CurrentTime);
 | 
				
			||||||
      if (iReturn == BadAtom || iReturn == BadWindow)
 | 
					      if (iReturn == BadAtom || iReturn == BadWindow ||
 | 
				
			||||||
 | 
						  XGetSelectionOwner (pDisplay, XA_PRIMARY) != iWindow)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	  ErrorF ("winClipboardProc - Could not set PRIMARY owner\n");
 | 
						  ErrorF ("winClipboardProc - Could not set PRIMARY owner\n");
 | 
				
			||||||
	  pthread_exit (NULL);
 | 
						  pthread_exit (NULL);
 | 
				
			||||||
| 
						 | 
					@ -282,7 +283,8 @@ winClipboardProc (void *pvNotUsed)
 | 
				
			||||||
      /* CLIPBOARD */
 | 
					      /* CLIPBOARD */
 | 
				
			||||||
      iReturn = XSetSelectionOwner (pDisplay, atomClipboard,
 | 
					      iReturn = XSetSelectionOwner (pDisplay, atomClipboard,
 | 
				
			||||||
				    iWindow, CurrentTime);
 | 
									    iWindow, CurrentTime);
 | 
				
			||||||
      if (iReturn == BadAtom || iReturn == BadWindow)
 | 
					      if (iReturn == BadAtom || iReturn == BadWindow ||
 | 
				
			||||||
 | 
						  XGetSelectionOwner (pDisplay, atomClipboard) != iWindow)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	  ErrorF ("winClipboardProc - Could not set CLIPBOARD owner\n");
 | 
						  ErrorF ("winClipboardProc - Could not set CLIPBOARD owner\n");
 | 
				
			||||||
	  pthread_exit (NULL);
 | 
						  pthread_exit (NULL);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -385,7 +385,8 @@ winClipboardWindowProc (HWND hwnd, UINT message,
 | 
				
			||||||
				      XA_PRIMARY,
 | 
									      XA_PRIMARY,
 | 
				
			||||||
				      iWindow,
 | 
									      iWindow,
 | 
				
			||||||
				      CurrentTime);
 | 
									      CurrentTime);
 | 
				
			||||||
	if (iReturn == BadAtom || iReturn == BadWindow)
 | 
						if (iReturn == BadAtom || iReturn == BadWindow ||
 | 
				
			||||||
 | 
						    XGetSelectionOwner (pDisplay, XA_PRIMARY) != iWindow)
 | 
				
			||||||
	  {
 | 
						  {
 | 
				
			||||||
	    winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
 | 
						    winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
 | 
				
			||||||
		    "Could not reassert ownership of PRIMARY\n");
 | 
							    "Could not reassert ownership of PRIMARY\n");
 | 
				
			||||||
| 
						 | 
					@ -403,7 +404,12 @@ winClipboardWindowProc (HWND hwnd, UINT message,
 | 
				
			||||||
						   False),
 | 
											   False),
 | 
				
			||||||
				      iWindow,
 | 
									      iWindow,
 | 
				
			||||||
				      CurrentTime);
 | 
									      CurrentTime);
 | 
				
			||||||
	if (iReturn == BadAtom || iReturn == BadWindow)
 | 
					
 | 
				
			||||||
 | 
						if (iReturn == BadAtom || iReturn == BadWindow ||
 | 
				
			||||||
 | 
						    XGetSelectionOwner (pDisplay,
 | 
				
			||||||
 | 
					                                XInternAtom (pDisplay,
 | 
				
			||||||
 | 
					                                             "CLIPBOARD",
 | 
				
			||||||
 | 
					                                             False)) != iWindow)
 | 
				
			||||||
	  {
 | 
						  {
 | 
				
			||||||
	    winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
 | 
						    winErrorFVerb (1, "winClipboardWindowProc - WM_DRAWCLIPBOARD - "
 | 
				
			||||||
		    "Could not reassert ownership of CLIPBOARD\n");
 | 
							    "Could not reassert ownership of CLIPBOARD\n");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue