aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/winclipboardwrappers.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-09-13 20:22:38 +0000
committermarha <marha@users.sourceforge.net>2009-09-13 20:22:38 +0000
commit48bfb28bba3c19eeeb667581b9d9686eba070e98 (patch)
tree9de3ab3b1ef67d672ceb77dc9576505fb82f92ad /xorg-server/hw/xwin/winclipboardwrappers.c
parentde33a8e7273592eefd303a94e87a8b38592099a1 (diff)
downloadvcxsrv-48bfb28bba3c19eeeb667581b9d9686eba070e98.tar.gz
vcxsrv-48bfb28bba3c19eeeb667581b9d9686eba070e98.tar.bz2
vcxsrv-48bfb28bba3c19eeeb667581b9d9686eba070e98.zip
Some clipboard rewrite. Clipboard seems to work now accept
for some socket shutdowns at startup (still under investigation)
Diffstat (limited to 'xorg-server/hw/xwin/winclipboardwrappers.c')
-rw-r--r--xorg-server/hw/xwin/winclipboardwrappers.c48
1 files changed, 14 insertions, 34 deletions
diff --git a/xorg-server/hw/xwin/winclipboardwrappers.c b/xorg-server/hw/xwin/winclipboardwrappers.c
index 3d5323cc7..8470ca6c9 100644
--- a/xorg-server/hw/xwin/winclipboardwrappers.c
+++ b/xorg-server/hw/xwin/winclipboardwrappers.c
@@ -310,7 +310,6 @@ winProcEstablishConnection (ClientPtr client)
* Wrapper for internal SetSelectionOwner function.
* Grabs ownership of Windows clipboard when X11 clipboard owner changes.
*/
-
int
winProcSetSelectionOwner (ClientPtr client)
{
@@ -324,16 +323,14 @@ winProcSetSelectionOwner (ClientPtr client)
REQUEST_SIZE_MATCH(xSetSelectionOwnerReq);
-#if 0
- ErrorF ("winProcSetSelectionOwner - Hello.\n");
-#endif
+ winDebug ("winProcSetSelectionOwner - Hello.\n");
/* Watch for server reset */
if (s_ulServerGeneration != serverGeneration)
{
/* Save new generation number */
s_ulServerGeneration = serverGeneration;
-
+
/* Initialize static variables */
for (i = 0; i < CLIP_NUM_SELECTIONS; ++i)
s_iOwners[i] = None;
@@ -369,10 +366,8 @@ winProcSetSelectionOwner (ClientPtr client)
{
fOwnedToNotOwned = TRUE;
-#if 0
- ErrorF ("winProcSetSelectionOwner - PRIMARY - Going from "
+ winDebug ("winProcSetSelectionOwner - PRIMARY - Going from "
"owned to not owned.\n");
-#endif
/* Adjust last owned selection */
if (None != s_iOwners[CLIP_OWN_CLIPBOARD])
@@ -384,10 +379,8 @@ winProcSetSelectionOwner (ClientPtr client)
/* Save new selection owner or None */
s_iOwners[CLIP_OWN_PRIMARY] = stuff->window;
-#if 0
- ErrorF ("winProcSetSelectionOwner - PRIMARY - Now owned by: %d\n",
- stuff->window);
-#endif
+ winDebug ("winProcSetSelectionOwner - PRIMARY - Now owned by: %d (clipboard is %d)\n",
+ stuff->window,g_iClipboardWindow);
}
else if (MakeAtom ("CLIPBOARD", 9, TRUE) == stuff->selection)
{
@@ -397,10 +390,8 @@ winProcSetSelectionOwner (ClientPtr client)
{
fOwnedToNotOwned = TRUE;
-#if 0
- ErrorF ("winProcSetSelectionOwner - CLIPBOARD - Going from "
+ winDebug ("winProcSetSelectionOwner - CLIPBOARD - Going from "
"owned to not owned.\n");
-#endif
/* Adjust last owned selection */
if (None != s_iOwners[CLIP_OWN_PRIMARY])
@@ -412,10 +403,8 @@ winProcSetSelectionOwner (ClientPtr client)
/* Save new selection owner or None */
s_iOwners[CLIP_OWN_CLIPBOARD] = stuff->window;
-#if 0
- ErrorF ("winProcSetSelectionOwner - CLIPBOARD - Now owned by: %d\n",
- stuff->window);
-#endif
+ winDebug ("winProcSetSelectionOwner - CLIPBOARD - Now owned by: %d, clipboard is %d\n",
+ stuff->window,g_iClipboardWindow);
}
else
goto winProcSetSelectionOwner_Done;
@@ -444,12 +433,10 @@ winProcSetSelectionOwner (ClientPtr client)
&& g_hwndClipboard != NULL
&& g_hwndClipboard == GetClipboardOwner ())
{
-#if 0
- ErrorF ("winProcSetSelectionOwner - We currently own the "
+ winDebug ("winProcSetSelectionOwner - We currently own the "
"clipboard and neither the PRIMARY nor the CLIPBOARD "
"selections are owned, releasing ownership of Win32 "
"clipboard.\n");
-#endif
/* Release ownership of the Windows clipboard */
OpenClipboard (NULL);
@@ -462,9 +449,7 @@ winProcSetSelectionOwner (ClientPtr client)
/* Abort if no window at this point */
if (None == stuff->window)
{
-#if 0
- ErrorF ("winProcSetSelectionOwner - No window, returning.\n");
-#endif
+ winDebug ("winProcSetSelectionOwner - No window, returning.\n");
goto winProcSetSelectionOwner_Done;
}
@@ -481,10 +466,8 @@ winProcSetSelectionOwner (ClientPtr client)
/* Abort if clipboard manager is owning the selection */
if (pDrawable->id == g_iClipboardWindow)
{
-#if 0
ErrorF ("winProcSetSelectionOwner - We changed ownership, "
"aborting.\n");
-#endif
goto winProcSetSelectionOwner_Done;
}
@@ -496,12 +479,6 @@ winProcSetSelectionOwner (ClientPtr client)
goto winProcSetSelectionOwner_Done;
}
- /* Close clipboard if we have it open already */
- if (GetOpenClipboardWindow () == g_hwndClipboard)
- {
- CloseClipboard ();
- }
-
/* Access the Windows clipboard */
if (!OpenClipboard (g_hwndClipboard))
{
@@ -515,9 +492,12 @@ winProcSetSelectionOwner (ClientPtr client)
{
ErrorF ("winProcSetSelectionOwner - EmptyClipboard () failed: %08x\n",
(int) GetLastError ());
+ CloseClipboard ();
goto winProcSetSelectionOwner_Done;
}
+ winDebug("winProcSetSelectionOwner - SetClipboardData NULL\n");
+
/* Advertise Unicode if we support it */
if (g_fUnicodeSupport)
SetClipboardData (CF_UNICODETEXT, NULL);
@@ -537,6 +517,6 @@ winProcSetSelectionOwner (ClientPtr client)
goto winProcSetSelectionOwner_Done;
}
- winProcSetSelectionOwner_Done:
+winProcSetSelectionOwner_Done:
return (*winProcSetSelectionOwnerOrig) (client);
}