Author: toshok
Date: 2006-11-15 13:15:53 -0500 (Wed, 15 Nov 2006)
New Revision: 67945

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
Log:
        * XplatUIX11.cs: add (untested) a _NET_WM_NAME implementation of
        GetText().  untested because it's unused in our implementation.
        Control.Text always caches the text, even if
        ControlStyles.CacheText is not set.

        fixes bug #79939.

2006-11-15  Chris Toshok  <[EMAIL PROTECTED]>



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-11-15 17:44:19 UTC (rev 67944)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-11-15 18:15:53 UTC (rev 67945)
@@ -1,5 +1,14 @@
 2006-11-15  Chris Toshok  <[EMAIL PROTECTED]>
 
+       * XplatUIX11.cs: add (untested) a _NET_WM_NAME implementation of
+       GetText().  untested because it's unused in our implementation.
+       Control.Text always caches the text, even if
+       ControlStyles.CacheText is not set.
+
+       fixes bug #79939.
+
+2006-11-15  Chris Toshok  <[EMAIL PROTECTED]>
+
        [ fixes #79933 ]
        
        * Form.cs: in Close() don't do anything after we send the WM_CLOSE

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2006-11-15 17:44:19 UTC (rev 67944)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2006-11-15 18:15:53 UTC (rev 67945)
@@ -1585,7 +1585,7 @@
                                                IntPtr  nitems;
                                                IntPtr  bytes_after;
                                                IntPtr  prop = IntPtr.Zero;
-                                               IntPtr  prev_active;;
+                                               IntPtr  prev_active;
 
                                                prev_active = ActiveWindow;
                                                
XGetWindowProperty(DisplayHandle, RootWindow, _NET_ACTIVE_WINDOW, IntPtr.Zero, 
new IntPtr (1), false, (IntPtr)Atom.XA_WINDOW, out actual_atom, out 
actual_format, out nitems, out bytes_after, ref prop);
@@ -3775,22 +3775,39 @@
                }
 
                internal override bool GetText(IntPtr handle, out string text) {
-                       IntPtr  textptr;
 
-                       textptr = IntPtr.Zero;
+                       lock (XlibLock) {
+                               IntPtr actual_atom;
+                               int actual_format;
+                               IntPtr nitems;
+                               IntPtr bytes_after;
+                               IntPtr prop = IntPtr.Zero;
 
-                       lock (XlibLock) {
-                               // FIXME - use _NET properties
-                               XFetchName(DisplayHandle, 
Hwnd.ObjectFromHandle(handle).whole_window, ref textptr);
+                               XGetWindowProperty(DisplayHandle, handle,
+                                                  _NET_WM_NAME, IntPtr.Zero, 
new IntPtr (1), false,
+                                                  UNICODETEXT, out 
actual_atom, out actual_format, out nitems, out bytes_after, ref prop);
+
+                               if ((long)nitems > 0 && prop != IntPtr.Zero) {
+                                       text = Marshal.PtrToStringUni (prop, 
(int)nitems);
+                                       return true;
+                               }
+                               else {
+                                       // fallback on the non-_NET property
+                                       IntPtr  textptr;
+
+                                       textptr = IntPtr.Zero;
+
+                                       XFetchName(DisplayHandle, 
Hwnd.ObjectFromHandle(handle).whole_window, ref textptr);
+                                       if (textptr != IntPtr.Zero) {
+                                               text = 
Marshal.PtrToStringAnsi(textptr);
+                                               XFree(textptr);
+                                               return true;
+                                       } else {
+                                               text = "";
+                                               return false;
+                                       }
+                               }
                        }
-                       if (textptr != IntPtr.Zero) {
-                               text = Marshal.PtrToStringAnsi(textptr);
-                               XFree(textptr);
-                               return true;
-                       } else {
-                               text = "";
-                               return false;
-                       }
                }
 
                internal override void GetWindowPos(IntPtr handle, bool 
is_toplevel, out int x, out int y, out int width, out int height, out int 
client_width, out int client_height) {

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

Reply via email to