Author: jackson
Date: 2006-09-22 13:30:08 -0400 (Fri, 22 Sep 2006)
New Revision: 65821

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Clipboard.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataFormats.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
Log:

        * XplatUI.cs:
        * XplatUIWin32.cs:
        * Clipboard.cs:
        * DataFormats.cs:
        * XplatUIDriver.cs: Update interface to add a primary selection
        flag, so the driver can use the primary selection buffer if
        needed.
        * XplatUIX11.cs: Allow the clipboard to retrieve from PRIMARY.

        * RichTextBox.cs: We need to supply the data object to paste now
        (so we can choose to supply CLIPBOARD or PRIMARY).
        * TextBoxBase.cs: Supply data object to paste (see above).
        - Middle click uses the primary selection data object.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-09-22 16:34:42 UTC (rev 65820)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-09-22 17:30:08 UTC (rev 65821)
@@ -1,3 +1,20 @@
+2006-09-22  Jackson Harper  <[EMAIL PROTECTED]>
+
+       * XplatUI.cs:
+       * XplatUIWin32.cs:
+       * Clipboard.cs:
+       * DataFormats.cs:
+       * XplatUIOSX.cs:
+       * XplatUIDriver.cs: Update interface to add a primary selection
+       flag, so the driver can use the primary selection buffer if
+       needed.
+       * XplatUIX11.cs: Allow the clipboard to retrieve from PRIMARY.
+
+       * RichTextBox.cs: We need to supply the data object to paste now
+       (so we can choose to supply CLIPBOARD or PRIMARY).
+       * TextBoxBase.cs: Supply data object to paste (see above).
+       - Middle click uses the primary selection data object.
+       
 2006-09-21  Chris Toshok  <[EMAIL PROTECTED]>
 
        * XplatUIX11.cs: first little cleanup of the StyleSet (...) block

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Clipboard.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Clipboard.cs     
2006-09-22 16:34:42 UTC (rev 65820)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Clipboard.cs     
2006-09-22 17:30:08 UTC (rev 65821)
@@ -57,7 +57,14 @@
                #endregion      // Private Methods
 
                #region Public Static Methods
-               public static IDataObject GetDataObject() {
+
+               public static IDataObject GetDataObject ()
+               {
+                       return GetDataObject (false);
+               }
+
+               internal static IDataObject GetDataObject (bool 
primary_selection)
+               {
                        DataObject              clipboard;
                        IntPtr                  clipboard_handle;
                        int[]                   native_formats;
@@ -67,7 +74,7 @@
 
                        converter = new 
XplatUI.ClipboardToObject(ConvertFromClipboardData);
 
-                       clipboard_handle = XplatUI.ClipboardOpen();
+                       clipboard_handle = XplatUI.ClipboardOpen 
(primary_selection);
                        native_formats = 
XplatUI.ClipboardAvailableFormats(clipboard_handle);
                        if (native_formats == null) {
                                return null;    // Clipboard empty
@@ -110,7 +117,7 @@
 
                        converter = new 
XplatUI.ObjectToClipboard(ConvertToClipboardData);
 
-                       clipboard_handle = XplatUI.ClipboardOpen();
+                       clipboard_handle = XplatUI.ClipboardOpen(false);
                        XplatUI.ClipboardStore(clipboard_handle, null, 0, 
null);        // Empty clipboard
 
                        native_format = -1;

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataFormats.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataFormats.cs   
2006-09-22 16:34:42 UTC (rev 65820)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataFormats.cs   
2006-09-22 17:30:08 UTC (rev 65821)
@@ -85,7 +85,7 @@
                                if (f == null) {
                                        IntPtr cliphandle;
 
-                                       cliphandle = XplatUI.ClipboardOpen();
+                                       cliphandle = 
XplatUI.ClipboardOpen(false);
                                        f = new Format(name, 
XplatUI.ClipboardGetID(cliphandle, name));
                                        XplatUI.ClipboardClose(cliphandle);
                                }
@@ -183,7 +183,7 @@
                {
                        if (initialized)
                                return;
-                       IntPtr cliphandle = XplatUI.ClipboardOpen();
+                       IntPtr cliphandle = XplatUI.ClipboardOpen(false);
 
                        new Format (Text, XplatUI.ClipboardGetID (cliphandle, 
Text));
                        new Format (Bitmap, XplatUI.ClipboardGetID (cliphandle, 
Bitmap));

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs   
2006-09-22 16:34:42 UTC (rev 65820)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/RichTextBox.cs   
2006-09-22 17:30:08 UTC (rev 65821)
@@ -528,7 +528,7 @@
 
                                
document.UpdateView(document.selection_start.line, 0);
                                document.AlignCaret();
-                               
+
                        }
                }
 
@@ -909,7 +909,7 @@
                }
 
                public void Paste(DataFormats.Format clipFormat) {
-                       base.Paste(clipFormat, false);
+                       base.Paste(Clipboard.GetDataObject(), clipFormat, 
false);
                }
 
                [MonoTODO()]

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs   
2006-09-22 16:34:42 UTC (rev 65820)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs   
2006-09-22 17:30:08 UTC (rev 65821)
@@ -693,7 +693,7 @@
                }
 
                public void Paste() {
-                       Paste(null, false);
+                       Paste(Clipboard.GetDataObject(), null, false);
                }
 
                public void ScrollToCaret() {
@@ -860,7 +860,7 @@
 
                                case Keys.V: {  // Paste (Ctrl-V)
                                        if (control) {
-                                               return Paste(null, true);
+                                               return 
Paste(Clipboard.GetDataObject(), null, true);
                                        }
                                        return false;
                                }
@@ -1037,7 +1037,7 @@
 
                                case Keys.Insert: {
                                        if (shift) {
-                                               Paste(null, true);
+                                               
Paste(Clipboard.GetDataObject(), null, true);
                                                return true;
                                        }
 
@@ -1449,7 +1449,7 @@
                                marker.height = marker.tag.height;
 
                                document.SetSelection(marker.line, marker.pos, 
marker.line, marker.pos);
-                               Paste();
+                               Paste (Clipboard.GetDataObject (true), null, 
true);
 
                        }
 
@@ -1761,11 +1761,9 @@
                        }
                }
 
-               internal bool Paste(DataFormats.Format format, bool 
obey_length) {
-                       IDataObject     clip;
+               internal bool Paste(IDataObject clip, DataFormats.Format 
format, bool obey_length) {
                        string          s;
 
-                       clip = Clipboard.GetDataObject();
                        if (clip == null)
                                return false;
                        

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs       
2006-09-22 16:34:42 UTC (rev 65820)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs       
2006-09-22 17:30:08 UTC (rev 65821)
@@ -367,11 +367,11 @@
                        return driver.ClipboardGetID(handle, format);
                }
 
-               internal static IntPtr ClipboardOpen() {
+               internal static IntPtr ClipboardOpen(bool primary_selection) {
                        #if DriverDebug
                                Console.WriteLine("ClipboardOpen(): Called");
                        #endif
-                       return driver.ClipboardOpen();
+                       return driver.ClipboardOpen (primary_selection);
                }
 
                internal static void ClipboardStore(IntPtr handle, object obj, 
int type, XplatUI.ObjectToClipboard converter) {

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs 
2006-09-22 16:34:42 UTC (rev 65820)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs 
2006-09-22 17:30:08 UTC (rev 65821)
@@ -259,7 +259,7 @@
                internal abstract void SetIcon(IntPtr handle, Icon icon);
 
                internal abstract void ClipboardClose(IntPtr handle);
-               internal abstract IntPtr ClipboardOpen();
+               internal abstract IntPtr ClipboardOpen (bool primary_selection);
                internal abstract int ClipboardGetID(IntPtr handle, string 
format);
                internal abstract void ClipboardStore(IntPtr handle, object 
obj, int id, XplatUI.ObjectToClipboard converter);
                internal abstract int[] ClipboardAvailableFormats(IntPtr 
handle);

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs    
2006-09-22 16:34:42 UTC (rev 65820)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs    
2006-09-22 17:30:08 UTC (rev 65821)
@@ -859,7 +859,7 @@
                        return 0;
                }
 
-               internal override IntPtr ClipboardOpen() {
+               internal override IntPtr ClipboardOpen(bool primary_selection) {
                        throw new NotImplementedException();
                }
 

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs  
2006-09-22 16:34:42 UTC (rev 65820)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs  
2006-09-22 17:30:08 UTC (rev 65821)
@@ -2068,7 +2068,8 @@
                        return (int)Win32RegisterClipboardFormat(format);
                }
 
-               internal override IntPtr ClipboardOpen() {
+               internal override IntPtr ClipboardOpen(bool primary_selection) {
+                       // Win32 does not have primary selection
                        Win32OpenClipboard(FosterParent);
                        return clip_magic;
                }

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2006-09-22 16:34:42 UTC (rev 65820)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2006-09-22 17:30:08 UTC (rev 65821)
@@ -88,7 +88,7 @@
                private static bool             ErrorExceptions;        // 
Throw exceptions on X errors
 
                // Clipboard
-               private static IntPtr           ClipMagic = new 
IntPtr(27051977);
+               private static IntPtr           ClipMagic;
                private static ClipboardStruct  Clipboard;              // Our 
clipboard
 
                // Communication
@@ -189,6 +189,7 @@
                private static IntPtr _NET_WM_WINDOW_TYPE_DIALOG;
                private static IntPtr _NET_WM_WINDOW_TYPE_NORMAL;
                private static IntPtr CLIPBOARD;
+               private static IntPtr PRIMARY;
                private static IntPtr DIB;
                private static IntPtr OEMTEXT;
                private static IntPtr UNICODETEXT;
@@ -626,6 +627,7 @@
 
                        // Clipboard support
                        CLIPBOARD = XInternAtom (DisplayHandle, "CLIPBOARD", 
false);
+                       PRIMARY = XInternAtom (DisplayHandle, "PRIMARY", false);
                        DIB = (IntPtr)Atom.XA_PIXMAP;
                        OEMTEXT = XInternAtom(DisplayHandle, "COMPOUND_TEXT", 
false);
                        UNICODETEXT = XInternAtom(DisplayHandle, "UTF8_STRING", 
false);
@@ -2164,12 +2166,16 @@
                        return XInternAtom(DisplayHandle, format, 
false).ToInt32();
                }
 
-               internal override IntPtr ClipboardOpen() {
+               internal override IntPtr ClipboardOpen(bool primary_selection) {
+                       if (!primary_selection)
+                               ClipMagic = CLIPBOARD;
+                       else
+                               ClipMagic = PRIMARY;
                        return ClipMagic;
                }
 
                internal override object ClipboardRetrieve(IntPtr handle, int 
type, XplatUI.ClipboardToObject converter) {
-                       XConvertSelection(DisplayHandle, CLIPBOARD, 
(IntPtr)type, (IntPtr)type, FosterParent, IntPtr.Zero);
+                       XConvertSelection(DisplayHandle, handle, (IntPtr)type, 
(IntPtr)type, FosterParent, IntPtr.Zero);
 
                        Clipboard.Retrieving = true;
                        while (Clipboard.Retrieving) {

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to