mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-01-07 12:30:17 +01:00
XWin Server - Sync with 4.3.0-38 release. Minor fixes to clipboard code.
This commit is contained in:
parent
a52db25a21
commit
b85853ee86
4 changed files with 60 additions and 10 deletions
|
|
@ -1,3 +1,5 @@
|
|||
#ifndef _WINCLIPBOARD_H_
|
||||
#define _WINCLIPBOARD_H_
|
||||
/*
|
||||
*Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
|
||||
*
|
||||
|
|
@ -29,10 +31,6 @@
|
|||
*/
|
||||
/* $XFree86: xc/programs/Xserver/hw/xwin/winclipboard.h,v 1.3 2003/10/02 13:30:10 eich Exp $ */
|
||||
|
||||
|
||||
#ifndef _WINCLIPBOARD_H_
|
||||
#define _WINCLIPBOARD_H_
|
||||
|
||||
/* Standard library headers */
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
|||
|
|
@ -256,6 +256,10 @@ winClipboardProc ()
|
|||
pthread_exit (NULL);
|
||||
}
|
||||
|
||||
#if 0
|
||||
ErrorF ("winClipboardProc - iWindow: %d\n", iWindow);
|
||||
#endif
|
||||
|
||||
/* Save the window in the screen privates */
|
||||
g_iClipboardWindow = iWindow;
|
||||
|
||||
|
|
|
|||
|
|
@ -164,8 +164,54 @@ winClipboardWindowProc (HWND hwnd, UINT message,
|
|||
&& !IsClipboardFormatAvailable (CF_UNICODETEXT))
|
||||
{
|
||||
ErrorF ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
|
||||
"Clipboard does not contain CF_TEXT nor CF_UNICODETEXT; "
|
||||
"not taking ownership of X11 selections.\n");
|
||||
"Clipboard does not contain CF_TEXT nor "
|
||||
"CF_UNICODETEXT.\n");
|
||||
|
||||
/*
|
||||
* We need to make sure that the X Server has processed
|
||||
* previous XSetSelectionOwner messages.
|
||||
*/
|
||||
XSync (pDisplay, FALSE);
|
||||
|
||||
/* Release PRIMARY selection if owned */
|
||||
iReturn = XGetSelectionOwner (pDisplay, XA_PRIMARY);
|
||||
if (iReturn == g_iClipboardWindow)
|
||||
{
|
||||
#if 0
|
||||
ErrorF ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
|
||||
"PRIMARY selection is owned by us.\n");
|
||||
#endif
|
||||
XSetSelectionOwner (pDisplay,
|
||||
XA_PRIMARY,
|
||||
None,
|
||||
CurrentTime);
|
||||
}
|
||||
else if (BadWindow == iReturn || BadAtom == iReturn)
|
||||
ErrorF ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
|
||||
"XGetSelection failed for PRIMARY: %d\n", iReturn);
|
||||
|
||||
/* Release CLIPBOARD selection if owned */
|
||||
iReturn = XGetSelectionOwner (pDisplay,
|
||||
XInternAtom (pDisplay,
|
||||
"CLIPBOARD",
|
||||
FALSE));
|
||||
if (iReturn == g_iClipboardWindow)
|
||||
{
|
||||
#if 0
|
||||
ErrorF ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
|
||||
"CLIPBOARD selection is owned by us.\n");
|
||||
#endif
|
||||
XSetSelectionOwner (pDisplay,
|
||||
XInternAtom (pDisplay,
|
||||
"CLIPBOARD",
|
||||
FALSE),
|
||||
None,
|
||||
CurrentTime);
|
||||
}
|
||||
else if (BadWindow == iReturn || BadAtom == iReturn)
|
||||
ErrorF ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
|
||||
"XGetSelection failed for CLIPBOARD: %d\n", iReturn);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@
|
|||
#include "dixstruct.h"
|
||||
#include "Xatom.h"
|
||||
|
||||
|
||||
/*
|
||||
* Constants
|
||||
*/
|
||||
|
|
@ -46,7 +45,7 @@
|
|||
* Globals
|
||||
*/
|
||||
|
||||
static Window g_iOwners[CLIP_NUM_SELECTIONS];
|
||||
static Window g_iOwners[CLIP_NUM_SELECTIONS] = {None};
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -332,7 +331,7 @@ winProcSetSelectionOwner (ClientPtr client)
|
|||
|
||||
/* Adjust last owned selection */
|
||||
if (None != g_iOwners[CLIP_OWN_CLIPBOARD])
|
||||
g_atomLastOwnedSelection = MakeAtom ("CLIPBOARD", 10, FALSE);
|
||||
g_atomLastOwnedSelection = MakeAtom ("CLIPBOARD", 9, FALSE);
|
||||
else
|
||||
g_atomLastOwnedSelection = None;
|
||||
}
|
||||
|
|
@ -340,7 +339,7 @@ winProcSetSelectionOwner (ClientPtr client)
|
|||
/* Save new selection owner or None */
|
||||
g_iOwners[CLIP_OWN_PRIMARY] = stuff->window;
|
||||
}
|
||||
else if (MakeAtom ("CLIPBOARD", 10, FALSE) == stuff->selection)
|
||||
else if (MakeAtom ("CLIPBOARD", 9, FALSE) == stuff->selection)
|
||||
{
|
||||
/* Look for owned -> not owned transition */
|
||||
if (None == stuff->window
|
||||
|
|
@ -355,6 +354,7 @@ winProcSetSelectionOwner (ClientPtr client)
|
|||
g_atomLastOwnedSelection = None;
|
||||
}
|
||||
|
||||
/* Save new selection owner or None */
|
||||
g_iOwners[CLIP_OWN_CLIPBOARD] = stuff->window;
|
||||
}
|
||||
else
|
||||
|
|
@ -391,7 +391,9 @@ winProcSetSelectionOwner (ClientPtr client)
|
|||
/* Abort if no window at this point */
|
||||
if (None == stuff->window)
|
||||
{
|
||||
#if 0
|
||||
ErrorF ("winProcSetSelectionOwner - No window, returning.\n");
|
||||
#endif
|
||||
goto winProcSetSelectionOwner_Done;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue