[MWF] Fix opacity of form (#19856)
authorEberhard Beilharz <eb1@sil.org>
Fri, 16 May 2014 16:11:07 +0000 (18:11 +0200)
committerEberhard Beilharz <eb1@sil.org>
Fri, 16 May 2014 16:50:37 +0000 (18:50 +0200)
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs

index c25124033921bcc71ee367c0f780916bdca36f83..a837d2ceda5e758b6127183ef35744f13c9755bc 100644 (file)
@@ -6109,12 +6109,13 @@ namespace System.Windows.Forms {
                        }
 
                        hwnd.opacity = (uint)(0xffffffff * transparency);
-                       opacity = (IntPtr)((int)hwnd.opacity);
+                       opacity = (IntPtr)hwnd.opacity;
 
-                       IntPtr w = hwnd.whole_window;
-                       if (hwnd.reparented)
-                               w = XGetParent (hwnd.whole_window);
-                       XChangeProperty(DisplayHandle, w, _NET_WM_WINDOW_OPACITY, (IntPtr)Atom.XA_CARDINAL, 32, PropertyMode.Replace, ref opacity, 1);
+                       if (transparency >= 1.0) {
+                               XDeleteProperty (DisplayHandle, hwnd.whole_window, _NET_WM_WINDOW_OPACITY);
+                       } else {
+                               XChangeProperty (DisplayHandle, hwnd.whole_window, _NET_WM_WINDOW_OPACITY, (IntPtr)Atom.XA_CARDINAL, 32, PropertyMode.Replace, ref opacity, 1);
+                       }
                }
 
                internal override bool SetZOrder(IntPtr handle, IntPtr after_handle, bool top, bool bottom)