Re: option to ignore primary selection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Makes sense to me. I modified the patch to turn it on by default.

/Ulrich

On Thu, Dec 18, 2003 at 02:06:29PM +0000, Mike Hearn wrote:
> On Thu, 2003-12-18 at 05:00, Ulrich Czekalla wrote:
> > 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).
> 
> The kind of people who get confused by this will probably not alter the
> defaults in this way, or even understand what the option does. Perhaps
> it should be on by default, with power users who are willing to accept
> its half completeness willing to switch on support for PRIMARY
> themselves?
> 
> thanks -mike
> 
> 
Index: dlls/x11drv/clipboard.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/clipboard.c,v
retrieving revision 1.18
diff -u -w -r1.18 clipboard.c
--- dlls/x11drv/clipboard.c	5 Dec 2003 04:45:50 -0000	1.18
+++ dlls/x11drv/clipboard.c	18 Dec 2003 19:06:26 -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 ignorePrimary = TRUE;              /* Only use the CLIPBOARD buffer (ignore PRIMARY)*/
 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, "IgnorePrimary", 0, &type, buffer, &count))
+	    ignorePrimary = atoi(buffer);
         RegCloseKey(hkey);
     }
 
@@ -1397,11 +1400,11 @@
      * Query the selection owner for the TARGETS property
      */
     wine_tsx11_lock();
-    if (XGetSelectionOwner(display,XA_PRIMARY) ||
+    if ((!ignorePrimary && XGetSelectionOwner(display,XA_PRIMARY)) ||
         XGetSelectionOwner(display,x11drv_atom(CLIPBOARD)))
     {
         wine_tsx11_unlock();
-        if (X11DRV_CLIPBOARD_QueryTargets(display, w, XA_PRIMARY, &xe))
+        if (!ignorePrimary && (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 (!ignorePrimary && !(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 (!ignorePrimary && 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.53
diff -u -w -r1.53 config
--- documentation/samples/config	5 Dec 2003 00:11:48 -0000	1.53
+++ documentation/samples/config	18 Dec 2003 19:06:26 -0000
@@ -238,6 +238,7 @@
 [Clipboard]
 "ClearAllSelections" = "0"
 "PersistentSelection" = "1"
+"IgnorePrimary" = "1"
 
 ; List of all directories directly contain .AFM files
 [afmdirs]

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux