diff options
author | marha <marha@users.sourceforge.net> | 2011-03-07 10:51:45 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-03-07 10:51:45 +0000 |
commit | faed2dca735b7aa26a146c5e309cafa8134425b9 (patch) | |
tree | 497aab7a57588f4c697a764b97e6b12fbbc823ec /xorg-server | |
parent | 4f15fcdc65f989800d91278a4040d14f9ebd76ca (diff) | |
download | vcxsrv-faed2dca735b7aa26a146c5e309cafa8134425b9.tar.gz vcxsrv-faed2dca735b7aa26a146c5e309cafa8134425b9.tar.bz2 vcxsrv-faed2dca735b7aa26a146c5e309cafa8134425b9.zip |
Added clipboardprimary option to be able to only map THE CLIPBOARD selection to the windows clipboard. Default the CLIPBOARD and the PRIMARY selection are mapped.
Diffstat (limited to 'xorg-server')
-rw-r--r-- | xorg-server/hw/xwin/InitOutput.c | 4 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winclipboardthread.c | 15 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winclipboardwndproc.c | 70 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winclipboardwrappers.c | 43 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winclipboardxevents.c | 2 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winglobals.c | 1 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winprocarg.c | 24 |
7 files changed, 99 insertions, 60 deletions
diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c index 8bdb18622..725011ea5 100644 --- a/xorg-server/hw/xwin/InitOutput.c +++ b/xorg-server/hw/xwin/InitOutput.c @@ -721,6 +721,10 @@ winUseMsg (void) #ifdef XWIN_CLIPBOARD ErrorF ("-[no]clipboard\n" "\tEnable [disable] the clipboard integration. Default is enabled.\n"); + ErrorF ("-[no]clipboardprimary\n" + "\t[Do not] map the PRIMARY selection to the windows clipboard.\n" + "\tThe CLIPBOARD selection is always mapped if -clipboard is enabled.\n" + "\tDefault is mapped.\n"); #endif ErrorF ("-clipupdates num_boxes\n" diff --git a/xorg-server/hw/xwin/winclipboardthread.c b/xorg-server/hw/xwin/winclipboardthread.c index 760ba5eb3..24b04c147 100644 --- a/xorg-server/hw/xwin/winclipboardthread.c +++ b/xorg-server/hw/xwin/winclipboardthread.c @@ -261,16 +261,19 @@ winClipboardProc (void *pvNotUsed) /* Assert ownership of selections if Win32 clipboard is owned */
if (NULL != GetClipboardOwner ())
{
- /* PRIMARY */
- winDebug("winClipboardProc - asserted ownership.\n");
- iReturn = XSetSelectionOwner (pDisplay, XA_PRIMARY,
- iWindow, CurrentTime);
- if (iReturn == BadAtom || iReturn == BadWindow /*||
- XGetSelectionOwner (pDisplay, XA_PRIMARY) != iWindow*/)
+ if (g_fClipboardPrimary)
+ {
+ /* PRIMARY */
+ winDebug("winClipboardProc - asserted ownership.\n");
+ iReturn = XSetSelectionOwner (pDisplay, XA_PRIMARY,
+ iWindow, CurrentTime);
+ if (iReturn == BadAtom || iReturn == BadWindow /*||
+ XGetSelectionOwner (pDisplay, XA_PRIMARY) != iWindow*/)
{
ErrorF ("winClipboardProc - Could not set PRIMARY owner\n");
goto thread_errorexit;
}
+ }
/* CLIPBOARD */
iReturn = XSetSelectionOwner (pDisplay, atomClipboard,
diff --git a/xorg-server/hw/xwin/winclipboardwndproc.c b/xorg-server/hw/xwin/winclipboardwndproc.c index 1f2bf756a..540b2136a 100644 --- a/xorg-server/hw/xwin/winclipboardwndproc.c +++ b/xorg-server/hw/xwin/winclipboardwndproc.c @@ -326,21 +326,23 @@ winClipboardWindowProc (HWND hwnd, UINT message, */
XSync (pDisplay, FALSE);
- /* Release PRIMARY selection if owned */
- iReturn = XGetSelectionOwner (pDisplay, XA_PRIMARY);
- if (iReturn == g_iClipboardWindow)
- {
- winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
- "PRIMARY selection is owned by us.\n");
- XSetSelectionOwner (pDisplay,
- XA_PRIMARY,
- None,
- CurrentTime);
- }
- else if (BadWindow == iReturn || BadAtom == iReturn)
- ErrorF ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
- "XGetSelection failed for PRIMARY: %d\n", iReturn);
-
+ if (g_fClipboardPrimary)
+ {
+ /* Release PRIMARY selection if owned */
+ iReturn = XGetSelectionOwner (pDisplay, XA_PRIMARY);
+ if (iReturn == g_iClipboardWindow)
+ {
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "PRIMARY selection is owned by us.\n");
+ 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,
atomClipboard);
@@ -366,23 +368,25 @@ winClipboardWindowProc (HWND hwnd, UINT message, /* Only reassert ownership when we did not change the clipboard ourselves */
if (hwnd!=(HWND)wParam)
{
- /* Reassert ownership of PRIMARY */
- iReturn = XSetSelectionOwner (pDisplay,
- XA_PRIMARY,
- iWindow,
- CurrentTime);
- if (iReturn == BadAtom || iReturn == BadWindow ||
- XGetSelectionOwner (pDisplay, XA_PRIMARY) != iWindow)
- {
- ErrorF ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
- "Could not reassert ownership of PRIMARY\n");
- }
- else
- {
- winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
- "Reasserted ownership of PRIMARY\n");
- }
-
+ if (g_fClipboardPrimary)
+ {
+ /* Reassert ownership of PRIMARY */
+ iReturn = XSetSelectionOwner (pDisplay,
+ XA_PRIMARY,
+ iWindow,
+ CurrentTime);
+ if (iReturn == BadAtom || iReturn == BadWindow ||
+ XGetSelectionOwner (pDisplay, XA_PRIMARY) != iWindow)
+ {
+ ErrorF ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "Could not reassert ownership of PRIMARY\n");
+ }
+ else
+ {
+ winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD - "
+ "Reasserted ownership of PRIMARY\n");
+ }
+ }
/* Reassert ownership of the CLIPBOARD */
iReturn = XSetSelectionOwner (pDisplay,
atomClipboard,
@@ -403,7 +407,7 @@ winClipboardWindowProc (HWND hwnd, UINT message, /* Flush the pending SetSelectionOwner event now */
XFlush (pDisplay);
- }
+ }
s_fProcessingDrawClipboard = FALSE;
winDebug ("winClipboardWindowProc - WM_DRAWCLIPBOARD: Exit\n");
diff --git a/xorg-server/hw/xwin/winclipboardwrappers.c b/xorg-server/hw/xwin/winclipboardwrappers.c index e7325178d..f1817f29b 100644 --- a/xorg-server/hw/xwin/winclipboardwrappers.c +++ b/xorg-server/hw/xwin/winclipboardwrappers.c @@ -241,25 +241,28 @@ winProcSetSelectionOwner (ClientPtr client) /* Save selection owners for monitored selections, ignore other selections */
if (XA_PRIMARY == stuff->selection)
{
+ if (g_fClipboardPrimary)
+ {
/* Look for owned -> not owned transition */
- if (None == stuff->window
- && None != s_iOwners[CLIP_OWN_PRIMARY])
- {
- winDebug ("winProcSetSelectionOwner - PRIMARY - Going from "
- "owned to not owned.\n");
-
- /* Adjust last owned selection */
- if (None != s_iOwners[CLIP_OWN_CLIPBOARD])
- g_atomLastOwnedSelection = MakeAtom ("CLIPBOARD", 9, TRUE);
- else
- g_atomLastOwnedSelection = None;
- }
-
- /* Save new selection owner or None */
- s_iOwners[CLIP_OWN_PRIMARY] = stuff->window;
-
- winDebug ("winProcSetSelectionOwner - PRIMARY - Now owned by: 0x%x (clipboard is 0x%x)\n",
- stuff->window,g_iClipboardWindow);
+ if (None == stuff->window
+ && None != s_iOwners[CLIP_OWN_PRIMARY])
+ {
+ winDebug ("winProcSetSelectionOwner - PRIMARY - Going from "
+ "owned to not owned.\n");
+
+ /* Adjust last owned selection */
+ if (None != s_iOwners[CLIP_OWN_CLIPBOARD])
+ g_atomLastOwnedSelection = MakeAtom ("CLIPBOARD", 9, TRUE);
+ else
+ g_atomLastOwnedSelection = None;
+ }
+
+ /* Save new selection owner or None */
+ s_iOwners[CLIP_OWN_PRIMARY] = stuff->window;
+
+ winDebug ("winProcSetSelectionOwner - PRIMARY - Now owned by: 0x%x (clipboard is 0x%x)\n",
+ stuff->window,g_iClipboardWindow);
+ }
}
else if (MakeAtom ("CLIPBOARD", 9, TRUE) == stuff->selection)
{
@@ -271,7 +274,7 @@ winProcSetSelectionOwner (ClientPtr client) "owned to not owned.\n");
/* Adjust last owned selection */
- if (None != s_iOwners[CLIP_OWN_PRIMARY])
+ if (None != s_iOwners[CLIP_OWN_PRIMARY] && g_fClipboardPrimary)
g_atomLastOwnedSelection = XA_PRIMARY;
else
g_atomLastOwnedSelection = None;
@@ -291,7 +294,7 @@ winProcSetSelectionOwner (ClientPtr client) * clipboard manager then it should be marked as unowned since
* we will be taking ownership of the Win32 clipboard.
*/
- if (g_iClipboardWindow == s_iOwners[CLIP_OWN_PRIMARY])
+ if (g_iClipboardWindow == s_iOwners[CLIP_OWN_PRIMARY] && g_fClipboardPrimary)
s_iOwners[CLIP_OWN_PRIMARY] = None;
if (g_iClipboardWindow == s_iOwners[CLIP_OWN_CLIPBOARD])
s_iOwners[CLIP_OWN_CLIPBOARD] = None;
diff --git a/xorg-server/hw/xwin/winclipboardxevents.c b/xorg-server/hw/xwin/winclipboardxevents.c index 3efda4de0..dc7db352a 100644 --- a/xorg-server/hw/xwin/winclipboardxevents.c +++ b/xorg-server/hw/xwin/winclipboardxevents.c @@ -271,7 +271,7 @@ winClipboardFlushXEvents (HWND hwnd, "The owner is the clipboard, but in reality it was"
"an X window\n");
/* Set the owner to None */
- XSetSelectionOwner (pDisplay, XA_PRIMARY, None, CurrentTime);
+ if (g_fClipboardPrimary) XSetSelectionOwner (pDisplay, XA_PRIMARY, None, CurrentTime);
XSetSelectionOwner (pDisplay, XInternAtom (pDisplay, "CLIPBOARD", False), None, CurrentTime);
}
ErrorF ("winClipboardFlushXEvents - SelectionRequest - "
diff --git a/xorg-server/hw/xwin/winglobals.c b/xorg-server/hw/xwin/winglobals.c index 49b111564..0f52b651c 100644 --- a/xorg-server/hw/xwin/winglobals.c +++ b/xorg-server/hw/xwin/winglobals.c @@ -100,6 +100,7 @@ winDispatchProcPtr winProcSetSelectionOwnerOrig = NULL; Bool g_fUnicodeClipboard = TRUE;
Bool g_fClipboard = TRUE;
+Bool g_fClipboardPrimary = TRUE;
Bool g_fClipboardLaunched = FALSE;
Bool g_fClipboardStarted = FALSE;
pthread_t g_ptClipboardProc;
diff --git a/xorg-server/hw/xwin/winprocarg.c b/xorg-server/hw/xwin/winprocarg.c index fef3edd4f..9566a4f0a 100644 --- a/xorg-server/hw/xwin/winprocarg.c +++ b/xorg-server/hw/xwin/winprocarg.c @@ -729,6 +729,30 @@ ddxProcessArgument (int argc, char *argv[], int i) /* Indicate that we have processed this argument */ return 1; } + + /* + * Look for the '-clipboard' argument + */ + if (IS_OPTION ("-clipboardprimary")) + { + /* Now the default, we still accept the arg for backwards compatibility */ + g_fClipboardPrimary = TRUE; + + /* Indicate that we have processed this argument */ + return 1; + } + + /* + * Look for the '-noclipboard' argument + */ + if (IS_OPTION ("-noclipboardprimary")) + { + g_fClipboardPrimary = FALSE; + + /* Indicate that we have processed this argument */ + return 1; + } + #endif |