option to ignore primary selection

Ulrich Czekalla ulrich.czekalla at utoronto.ca
Wed Dec 17 23:00:23 CST 2003


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 at codeweavers.com>
Add option to restrict clipboard interactions to only the CLIPBOARD
selection
-------------- next part --------------
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 03:13:07 -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 = FALSE;             /* 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 03:13:08 -0000
@@ -238,6 +238,7 @@
 [Clipboard]
 "ClearAllSelections" = "0"
 "PersistentSelection" = "1"
+"IgnorePrimary" = "0"
 
 ; List of all directories directly contain .AFM files
 [afmdirs]


More information about the wine-patches mailing list