Author: pbartok
Date: 2006-06-12 14:03:36 -0400 (Mon, 12 Jun 2006)
New Revision: 61633

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
Log:
2006-06-12  Peter Dennis Bartok  <[EMAIL PROTECTED]> 

        * XplatUIX11.cs (WorkingArea): Read the actual workarea for the 
          current desktop, instead of just assuming a 0, 0 origin. This
          is needed for our internal window manager, to know the top
          margin of the desktop



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-06-12 17:00:53 UTC (rev 61632)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-06-12 18:03:36 UTC (rev 61633)
@@ -1,3 +1,10 @@
+2006-06-12  Peter Dennis Bartok  <[EMAIL PROTECTED]> 
+
+       * XplatUIX11.cs (WorkingArea): Read the actual workarea for the 
+         current desktop, instead of just assuming a 0, 0 origin. This
+         is needed for our internal window manager, to know the top
+         margin of the desktop
+
 2006-06-12  Chris Toshok  <[EMAIL PROTECTED]>
 
        * DataGrid.cs (set_CurrentCell): concede focus as we move around.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2006-06-12 17:00:53 UTC (rev 61632)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2006-06-12 18:03:36 UTC (rev 61633)
@@ -1828,23 +1828,39 @@
                                IntPtr                  prop = IntPtr.Zero;
                                int                     width;
                                int                     height;
+                               int                     current_desktop;
+                               int                     x;
+                               int                     y;
 
-                               XGetWindowProperty(DisplayHandle, RootWindow, 
NetAtoms[(int)NA._NET_DESKTOP_GEOMETRY], IntPtr.Zero, new IntPtr (256), false, 
(IntPtr)Atom.XA_CARDINAL, out actual_atom, out actual_format, out nitems, out 
bytes_after, ref prop);
-                               if (((long)nitems == 2) && (prop != 
IntPtr.Zero) && IntPtr.Size == 4) {
-                                       width = Marshal.ReadIntPtr(prop, 
0).ToInt32();
-                                       height = Marshal.ReadIntPtr(prop, 
IntPtr.Size).ToInt32();
+                               XGetWindowProperty(DisplayHandle, RootWindow, 
NetAtoms[(int)NA._NET_CURRENT_DESKTOP], IntPtr.Zero, new IntPtr(1), false, 
(IntPtr)Atom.XA_CARDINAL, out actual_atom, out actual_format, out nitems, out 
bytes_after, ref prop);
+                               if ((long)nitems < 1) {
+                                       goto failsafe;
+                               }
 
-                                       XFree(prop);
-                                       return new Rectangle(0, 0, width, 
height);
-                               } else {
-                                       XWindowAttributes       attributes=new 
XWindowAttributes();
+                               current_desktop = Marshal.ReadIntPtr(prop, 
0).ToInt32();
+                               XFree(prop);
 
-                                       lock (XlibLock) {
-                                               
XGetWindowAttributes(DisplayHandle, XRootWindow(DisplayHandle, 0), ref 
attributes);
-                                       }
+                               XGetWindowProperty(DisplayHandle, RootWindow, 
NetAtoms[(int)NA._NET_WORKAREA], IntPtr.Zero, new IntPtr (256), false, 
(IntPtr)Atom.XA_CARDINAL, out actual_atom, out actual_format, out nitems, out 
bytes_after, ref prop);
+                               if ((long)nitems < 4 * current_desktop) {
+                                       goto failsafe;
+                               }
 
-                                       return new Rectangle(0, 0, 
attributes.width, attributes.height);
+                               x = Marshal.ReadIntPtr(prop, IntPtr.Size * 4 * 
current_desktop).ToInt32();
+                               y = Marshal.ReadIntPtr(prop, IntPtr.Size * 4 * 
current_desktop + IntPtr.Size).ToInt32();
+                               width = Marshal.ReadIntPtr(prop, IntPtr.Size * 
4 * current_desktop + IntPtr.Size * 2).ToInt32();
+                               height = Marshal.ReadIntPtr(prop, IntPtr.Size * 
4 * current_desktop + IntPtr.Size * 3).ToInt32();
+                               XFree(prop);
+
+                               return new Rectangle(x, y, width, height);
+
+                       failsafe:
+                               XWindowAttributes       attributes=new 
XWindowAttributes();
+
+                               lock (XlibLock) {
+                                       XGetWindowAttributes(DisplayHandle, 
XRootWindow(DisplayHandle, 0), ref attributes);
                                }
+
+                               return new Rectangle(0, 0, attributes.width, 
attributes.height);
                        }
                } 
                #endregion      // Public properties

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

Reply via email to