Updated as per Alexandre's comments. ChangeLog: Ulrich Czekalla <ulrich@xxxxxxxxxxxxxxx> Add option to use the primary selection in addition to the clipboard selection On Thu, Dec 18, 2003 at 12:00:23AM -0500, Ulrich Czekalla wrote: > Having to map both primary and clipboard selections to a single windows > clipboard is a source of confusion for many users. > > This patch adds an option (turned off by default) to restrict Wine to only > use the clipboard selection since it will never implement proper behaviour > for the primary selection (You'll never be able to select text with the > mouse). > > I think this will make things easier to understand since Wine can only copy > text with the edit menu or keyboard which is exactly what the clipboard > selection under X is for. > > ChangeLog: > > Ulrich Czekalla <ulrich@xxxxxxxxxxxxxxx> > Add option to restrict clipboard interactions to only the CLIPBOARD > selection
Index: dlls/x11drv/clipboard.c =================================================================== RCS file: /home/wine/wine/dlls/x11drv/clipboard.c,v retrieving revision 1.19 diff -u -w -r1.19 clipboard.c --- dlls/x11drv/clipboard.c 30 Dec 2003 19:14:35 -0000 1.19 +++ dlls/x11drv/clipboard.c 7 Jan 2004 04:09:53 -0000 @@ -110,6 +110,7 @@ static int selectionAcquired = 0; /* Contains the current selection masks */ static Window selectionWindow = None; /* The top level X window which owns the selection */ static BOOL clearAllSelections = FALSE; /* Always lose all selections */ +static BOOL usePrimary = FALSE; /* Use primary selection in additon to the clipboard selection */ static Atom selectionCacheSrc = XA_PRIMARY; /* The selection source from which the clipboard cache was filled */ static Window PrimarySelectionOwner = None; /* The window which owns the primary selection */ static Window ClipboardSelectionOwner = None; /* The window which owns the clipboard selection */ @@ -277,6 +278,8 @@ DWORD type, count = sizeof(buffer); if(!RegQueryValueExA(hkey, "ClearAllSelections", 0, &type, buffer, &count)) clearAllSelections = atoi(buffer); + if(!RegQueryValueExA(hkey, "usePrimary", 0, &type, buffer, &count)) + usePrimary = atoi(buffer); RegCloseKey(hkey); } @@ -1083,7 +1086,7 @@ /************************************************************************** - * X11DRV_CLIPBOARD_ExportClipboardData + X11DRV_CLIPBOARD_ExportClipboardData * * Generic export clipboard data routine. */ @@ -1397,11 +1400,11 @@ * Query the selection owner for the TARGETS property */ wine_tsx11_lock(); - if (XGetSelectionOwner(display,XA_PRIMARY) || + if ((usePrimary && XGetSelectionOwner(display,XA_PRIMARY)) || XGetSelectionOwner(display,x11drv_atom(CLIPBOARD))) { wine_tsx11_unlock(); - if (X11DRV_CLIPBOARD_QueryTargets(display, w, XA_PRIMARY, &xe)) + if (usePrimary && (X11DRV_CLIPBOARD_QueryTargets(display, w, XA_PRIMARY, &xe))) selectionCacheSrc = XA_PRIMARY; else if (X11DRV_CLIPBOARD_QueryTargets(display, w, x11drv_atom(CLIPBOARD), &xe)) selectionCacheSrc = x11drv_atom(CLIPBOARD); @@ -1974,14 +1977,14 @@ wine_tsx11_lock(); /* Grab PRIMARY selection if not owned */ - if (!(selectionAcquired & S_PRIMARY)) + if (usePrimary && !(selectionAcquired & S_PRIMARY)) XSetSelectionOwner(display, XA_PRIMARY, owner, CurrentTime); /* Grab CLIPBOARD selection if not owned */ if (!(selectionAcquired & S_CLIPBOARD)) XSetSelectionOwner(display, x11drv_atom(CLIPBOARD), owner, CurrentTime); - if (XGetSelectionOwner(display,XA_PRIMARY) == owner) + if (usePrimary && XGetSelectionOwner(display,XA_PRIMARY) == owner) selectionAcquired |= S_PRIMARY; if (XGetSelectionOwner(display,x11drv_atom(CLIPBOARD)) == owner) Index: documentation/samples/config =================================================================== RCS file: /home/wine/wine/documentation/samples/config,v retrieving revision 1.55 diff -u -w -r1.55 config --- documentation/samples/config 5 Jan 2004 21:19:22 -0000 1.55 +++ documentation/samples/config 7 Jan 2004 04:09:53 -0000 @@ -236,6 +236,7 @@ [Clipboard] "ClearAllSelections" = "0" "PersistentSelection" = "1" +"UsePrimary" = "0" ; List of all directories directly contain .AFM files [afmdirs]