static void DeleteIconPixmaps(IntPtr display, IntPtr window) { IntPtr wmHints_ptr = API.XGetWMHints(display, window); if (wmHints_ptr != IntPtr.Zero) { XWMHints wmHints = (XWMHints)Marshal.PtrToStructure(wmHints_ptr, typeof(XWMHints)); XWMHintsFlags flags = (XWMHintsFlags)wmHints.flags.ToInt32(); if ((flags & XWMHintsFlags.IconPixmapHint) != 0) { wmHints.flags = new IntPtr((int)(flags & ~XWMHintsFlags.IconPixmapHint)); API.XFreePixmap(display, wmHints.icon_pixmap); } if ((flags & XWMHintsFlags.IconMaskHint) != 0) { wmHints.flags = new IntPtr((int)(flags & ~XWMHintsFlags.IconMaskHint)); API.XFreePixmap(display, wmHints.icon_mask); } API.XSetWMHints(display, window, ref wmHints); API.XFree(wmHints_ptr); } }
private static void DeleteIconPixmaps(IntPtr display, IntPtr window) { using (new XLock(display)) { IntPtr num = Functions.XGetWMHints(display, window); if (!(num != IntPtr.Zero)) { return; } XWMHints wmhints = (XWMHints)Marshal.PtrToStructure(num, typeof(XWMHints)); XWMHintsFlags xwmHintsFlags = (XWMHintsFlags)wmhints.flags.ToInt32(); if ((xwmHintsFlags & XWMHintsFlags.IconPixmapHint) != (XWMHintsFlags)0) { wmhints.flags = new IntPtr((int)(xwmHintsFlags & ~XWMHintsFlags.IconPixmapHint)); Functions.XFreePixmap(display, wmhints.icon_pixmap); } if ((xwmHintsFlags & XWMHintsFlags.IconMaskHint) != (XWMHintsFlags)0) { wmhints.flags = new IntPtr((int)(xwmHintsFlags & ~XWMHintsFlags.IconMaskHint)); Functions.XFreePixmap(display, wmhints.icon_mask); } Functions.XSetWMHints(display, window, ref wmhints); Functions.XFree(num); } }