aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/winclipboard/xevents.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xwin/winclipboard/xevents.c')
-rwxr-xr-x[-rw-r--r--]xorg-server/hw/xwin/winclipboard/xevents.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/xorg-server/hw/xwin/winclipboard/xevents.c b/xorg-server/hw/xwin/winclipboard/xevents.c
index 835195b52..5f426322d 100644..100755
--- a/xorg-server/hw/xwin/winclipboard/xevents.c
+++ b/xorg-server/hw/xwin/winclipboard/xevents.c
@@ -33,7 +33,10 @@
#ifdef HAVE_XWIN_CONFIG_H
#include <xwin-config.h>
#endif
-
+#include "winclipboard.h"
+#include "winglobals.h"
+#include "misc.h"
+#include "winmsg.h"
/*
* Including any server header might define the macro _XSERVER64 on 64 bit machines.
* That macro must _NOT_ be defined for Xlib client code, otherwise bad things happen.
@@ -44,6 +47,7 @@
#endif
#include <limits.h>
+#include <unistd.h>
#include <wchar.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
@@ -228,6 +232,7 @@ winClipboardFlushXEvents(HWND hwnd,
*/
case SelectionRequest:
+#ifdef _DEBUG
{
char *pszAtomName = NULL;
@@ -240,6 +245,7 @@ winClipboardFlushXEvents(HWND hwnd,
XFree(pszAtomName);
pszAtomName = NULL;
}
+#endif
/* Abort if invalid target type */
if (event.xselectionrequest.target != XA_STRING
@@ -368,8 +374,17 @@ winClipboardFlushXEvents(HWND hwnd,
hGlobal = GetClipboardData(CF_TEXT);
}
if (!hGlobal) {
- ErrorF("winClipboardFlushXEvents - SelectionRequest - "
- "GetClipboardData () failed: %08lx\n", GetLastError());
+ if (GetLastError()==ERROR_CLIPBOARD_NOT_OPEN && g_fClipboardStarted)
+ {
+ ErrorF("We should not have received a SelectionRequest????\n"
+ "The owner is the clipboard, but in reality it was"
+ "an X window\n");
+ /* Set the owner to None */
+ if (fPrimarySelection) XSetSelectionOwner (pDisplay, XA_PRIMARY, None, CurrentTime);
+ XSetSelectionOwner (pDisplay, XInternAtom (pDisplay, "CLIPBOARD", False), None, CurrentTime);
+ }
+ ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
+ "GetClipboardData () failed: %08lx\n", GetLastError());
/* Abort */
fAbort = TRUE;
@@ -538,6 +553,7 @@ winClipboardFlushXEvents(HWND hwnd,
*/
case SelectionNotify:
+#ifdef _DEBUG
winDebug("winClipboardFlushXEvents - SelectionNotify\n");
{
char *pszAtomName;
@@ -550,6 +566,8 @@ winClipboardFlushXEvents(HWND hwnd,
pszAtomName);
XFree(pszAtomName);
}
+#endif
+
/*
SelectionNotify with property of None indicates either:
@@ -588,6 +606,7 @@ winClipboardFlushXEvents(HWND hwnd,
goto winClipboardFlushXEvents_SelectionNotify_Done;
}
+#ifdef WINDBG
{
char *pszAtomName = NULL;
@@ -598,6 +617,7 @@ winClipboardFlushXEvents(HWND hwnd,
XFree(pszAtomName);
pszAtomName = NULL;
}
+#endif
if (data->fUseUnicode) {
#ifdef X_HAVE_UTF8_STRING
@@ -620,7 +640,7 @@ winClipboardFlushXEvents(HWND hwnd,
for (i = 0; i < iCount; i++) {
iReturnDataLen += strlen(ppszTextList[i]);
}
- pszReturnData = malloc(iReturnDataLen + 1);
+ pszReturnData = (char *) malloc(iReturnDataLen + 1);
pszReturnData[0] = '\0';
for (i = 0; i < iCount; i++) {
strcat(pszReturnData, ppszTextList[i]);
@@ -629,7 +649,7 @@ winClipboardFlushXEvents(HWND hwnd,
else {
ErrorF("winClipboardFlushXEvents - SelectionNotify - "
"X*TextPropertyToTextList list_return is NULL.\n");
- pszReturnData = malloc(1);
+ pszReturnData = (char *) malloc(1);
pszReturnData[0] = '\0';
}
}
@@ -650,7 +670,7 @@ winClipboardFlushXEvents(HWND hwnd,
ErrorF("%d\n", iReturn);
break;
}
- pszReturnData = malloc(1);
+ pszReturnData = (char *) malloc(1);
pszReturnData[0] = '\0';
}
@@ -663,7 +683,7 @@ winClipboardFlushXEvents(HWND hwnd,
xtpText.nitems = 0;
/* Convert the X clipboard string to DOS format */
- winClipboardUNIXtoDOS(&pszReturnData, strlen(pszReturnData));
+ winClipboardUNIXtoDOS((unsigned char **)&pszReturnData, strlen(pszReturnData));
if (data->fUseUnicode) {
/* Find out how much space needed to convert MBCS to Unicode */
@@ -781,6 +801,7 @@ winClipboardFlushXEvents(HWND hwnd,
break;
case MappingNotify:
+ XRefreshKeyboardMapping((XMappingEvent *)&event);
break;
default: