Author: pbartok
Date: 2005-03-12 01:03:07 -0500 (Sat, 12 Mar 2005)
New Revision: 41731

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
Log:
- Added sanity check to GetWindowPos
- Fixed get_WorkingArea to use X call to get desktop size


Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2005-03-11 22:29:00 UTC (rev 41730)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2005-03-12 06:03:07 UTC (rev 41731)
@@ -1,3 +1,10 @@
+2005-03-11  Peter Bartok  <[EMAIL PROTECTED]>
+
+       * XplatUIX11.cs:
+         - get_WorkingArea: Need to call X directly, GetWindowPos only
+           returns cached data now
+         - Added sanity check to GetWindowPos hwnd usage
+
 2005-03-11  Jackson Harper  <[EMAIL PROTECTED]>
 
        * BindingManagerBase.cs: This method isn't used anymore as

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2005-03-11 22:29:00 UTC (rev 41730)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2005-03-12 06:03:07 UTC (rev 41731)
@@ -1195,13 +1195,13 @@
                                        XFree(prop);
                                        return new Rectangle(0, 0, width, 
height);
                                } else {
-                                       int     x;
-                                       int     y;
-                                       int     client_width;
-                                       int     client_height;
+                                       XWindowAttributes       attributes=new 
XWindowAttributes();
 
-                                       GetWindowPos(RootWindow, true, out x, 
out y, out width, out height, out client_width, out client_height);
-                                       return new Rectangle(x, y, width, 
height);
+                                       lock (XlibLock) {
+                                               
XGetWindowAttributes(DisplayHandle, XRootWindow(DisplayHandle, 0), ref 
attributes);
+                                       }
+
+                                       return new Rectangle(0, 0, 
attributes.width, attributes.height);
                                }
                        }
                } 
@@ -2317,15 +2317,30 @@
                        Rectangle       rect;
 
                        hwnd = Hwnd.ObjectFromHandle(handle);
-                       rect = hwnd.ClientRect;
 
-                       x = hwnd.x;
-                       y = hwnd.y;
-                       width = hwnd.width;
-                       height = hwnd.height;
+                       if (hwnd != null) {
+                               rect = hwnd.ClientRect;
 
-                       client_width = rect.Width;
-                       client_height = rect.Height;
+                               x = hwnd.x;
+                               y = hwnd.y;
+                               width = hwnd.width;
+                               height = hwnd.height;
+
+                               client_width = rect.Width;
+                               client_height = rect.Height;
+
+                               return;
+                       }
+
+                       // Should we throw an exception or fail silently?
+                       // throw new ArgumentException("Called with an invalid 
window handle", "handle");
+
+                       x = 0;
+                       y = 0;
+                       width = 0;
+                       height = 0;
+                       client_width = 0;
+                       client_height = 0;
                }
 
                internal override FormWindowState GetWindowState(IntPtr handle) 
{

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

Reply via email to