dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] pnetlib/Xsharp TopLevelWindow.cs, 1.16, 1.17 Xlib.


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] pnetlib/Xsharp TopLevelWindow.cs, 1.16, 1.17 Xlib.cs.in, 1.21, 1.22
Date: Tue, 02 Dec 2003 13:07:00 +0000

Update of /cvsroot/dotgnu-pnet/pnetlib/Xsharp
In directory subversions:/tmp/cvs-serv13775/Xsharp

Modified Files:
        TopLevelWindow.cs Xlib.cs.in 
Log Message:


Add the window icon hint to Xsharp; set an icon on FormsTest's main window.


Index: TopLevelWindow.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/TopLevelWindow.cs,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** TopLevelWindow.cs   2 Dec 2003 11:04:18 -0000       1.16
--- TopLevelWindow.cs   2 Dec 2003 13:06:57 -0000       1.17
***************
*** 52,56 ****
        private int minWidth, minHeight;
        private int maxWidth, maxHeight;
!       private bool hasHelpButton;
  
        /// <summary>
--- 52,56 ----
        private int minWidth, minHeight;
        private int maxWidth, maxHeight;
!       private Image icon;
  
        /// <summary>
***************
*** 136,140 ****
                                this.expectedWidth = -1;
                                this.expectedHeight = -1;
-                               this.hasHelpButton = false;
  
                                // Set the initial WM properties.
--- 136,139 ----
***************
*** 151,154 ****
--- 150,156 ----
                                        SetProtocols(display, handle);
  
+                                       // Set the window hints.
+                                       SetWMHints(display, handle);
+ 
                                        // Top-level widgets receive all key 
and focus events.
                                        SelectInput(EventMask.KeyPressMask |
***************
*** 234,237 ****
--- 236,265 ----
                        }
  
+       // Set the XWMHints structure on this window.
+       private void SetWMHints(IntPtr display, Xlib.Window handle)
+                       {
+                               XWMHints hints = new XWMHints();
+                               hints.flags = WMHintsMask.InputHint;
+                               hints.input = true;
+                               if(icon != null)
+                               {
+                                       Pixmap pixmap = icon.Pixmap;
+                                       Bitmap mask = icon.Mask;
+                                       if(mask != null)
+                                       {
+                                               hints.flags |= 
WMHintsMask.IconPixmapHint |
+                                                                          
WMHintsMask.IconMaskHint;
+                                               hints.icon_pixmap = 
pixmap.GetPixmapHandle();
+                                               hints.icon_mask = 
mask.GetPixmapHandle();
+                                       }
+                                       else
+                                       {
+                                               hints.flags |= 
WMHintsMask.IconPixmapHint;
+                                               hints.icon_pixmap = 
pixmap.GetPixmapHandle();
+                                       }
+                               }
+                               Xlib.XSetWMHints(display, handle, ref hints);
+                       }
+ 
        // Construct the XSizeHints structure for this window.
        private XSizeHints BuildSizeHints(int x, int y, int width, int height)
***************
*** 1043,1046 ****
--- 1071,1107 ----
                                {
                                        dpy.Unlock();
+                               }
+                       }
+ 
+       /// <summary>
+       /// <para>Get or set the icon associated with this window.</para>
+       /// </summary>
+       ///
+       /// <value>
+       /// <para>The icon image, or <see langword="null"/> if there is
+       /// no icon to be displayed.</para>
+       /// </value>
+       public Image Icon
+                       {
+                               get
+                               {
+                                       return icon;
+                               }
+                               set
+                               {
+                                       if(icon != value)
+                                       {
+                                               icon = value;
+                                               try
+                                               {
+                                                       IntPtr display = 
dpy.Lock();
+                                                       Xlib.Window handle = 
GetWidgetHandle();
+                                                       SetWMHints(display, 
handle);
+                                               }
+                                               finally
+                                               {
+                                                       dpy.Unlock();
+                                               }
+                                       }
                                }
                        }

Index: Xlib.cs.in
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/Xlib.cs.in,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** Xlib.cs.in  1 Dec 2003 07:39:58 -0000       1.21
--- Xlib.cs.in  2 Dec 2003 13:06:57 -0000       1.22
***************
*** 478,481 ****
--- 478,485 ----
  
        [DllImport("X11")]
+       extern public static void XSetWMHints
+                       (IntPtr display, Window w, ref XWMHints hints);
+ 
+       [DllImport("X11")]
        extern public static @X_int@ XKillClient(IntPtr display, XID resource);
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]