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

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

[Dotgnu-libs-commits] CVS: xsharp/Xsharp/XWindows Application.cs,NONE,1.


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-libs-commits] CVS: xsharp/Xsharp/XWindows Application.cs,NONE,1.1 CrossingDetail.cs,NONE,1.1 CrossingMode.cs,NONE,1.1 Bitmap.cs,1.1.1.1,1.2 Display.cs,1.3,1.4 Drawable.cs,1.1.1.1,1.2 EventHandlers.cs,1.3,1.4 InputOnlyWidget.cs,1.5,1.6 Pixmap.cs,1.1.1.1,1.2 TopLevelWindow.cs,1.2,1.3
Date: Sat, 28 Sep 2002 00:47:51 -0400

Update of /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows
In directory subversions:/tmp/cvs-serv22388/Xsharp/XWindows

Modified Files:
        Bitmap.cs Display.cs Drawable.cs EventHandlers.cs 
        InputOnlyWidget.cs Pixmap.cs TopLevelWindow.cs 
Added Files:
        Application.cs CrossingDetail.cs CrossingMode.cs 
Log Message:


Implement the support code for application objects; Enter/Leave events.


--- NEW FILE ---
/*
 * Application.cs - The main application object for a display.
 *
 * This file is part of the X# library.
 * Copyright (C) 2002  Southern Storm Software, Pty Ltd.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace XWindows
{

using System;
using System.Collections;

/// <summary>
/// <para>The <see cref="T:XWindows.Application"/> class manages
/// initialization and event handling for an application.</para>
/// </summary>
public sealed class Application : IDisposable
{
        // Internal state.
        private String resourceName;
        private String resourceClass;
        private String programName;
        private String[] cmdLineArgs;
        private String displayName;
        private Display display;
        private bool startIconic;
        private String title;
        private String geometry;
        private static Application primary;

        /// <summary>
        /// <para>Construct a new application object, process command-line
        /// options, and open the display.</para>
        /// </summary>
        ///
        /// <param name="name">
        /// <para>The resource name and class for the application.</para>
        /// </param>
        ///
        /// <param name="args">
        /// <para>The arguments that came from the application's "Main"
        /// method.</para>
        /// </param>
        ///
        /// <exception cref="T:XWindows.XCannotConnectException">
        /// <para>A connection to the X display server could not
        /// be established.</para>
        /// </exception>
        public Application(String name, String[] args)
                        {
                                String[] envCmdLine;
                                int firstArg = 0;

                                // Set this as the primary application object 
if necessary.
                                lock(typeof(Application))
                                {
                                        if(primary == null)
                                        {
                                                primary = this;
                                        }
                                }

                                // Choose defaults for the parameters.
                                try
                                {
                                        envCmdLine = 
Environment.GetCommandLineArgs();
                                }
                                catch(NotSupportedException)
                                {
                                        envCmdLine = null;
                                }
                                if(envCmdLine != null && envCmdLine.Length > 0)
                                {
                                        programName = envCmdLine[0];
                                }
                                else
                                {
                                        programName = "Xsharp-application";
                                }
                                if(name == null)
                                {
                                        name = programName;
                                }
                                if(args == null)
                                {
                                        if(envCmdLine != null && 
envCmdLine.Length > 0)
                                        {
                                                args = envCmdLine;
                                                firstArg = 1;
                                        }
                                        else
                                        {
                                                args = new String [0];
                                        }
                                }

                                // Initialize the application state.
                                resourceName = name;
                                resourceClass = name;
                                displayName = null;
                                startIconic = false;
                                title = null;
                                geometry = null;

                                // Process the standard Xt command-line options.
                                ArrayList newArgs = new ArrayList();
                                while(firstArg < args.Length)
                                {
                                        switch(args[firstArg])
                                        {
                                                case "-display":
                                                {
                                                        ++firstArg;
                                                        if(firstArg < 
args.Length)
                                                        {
                                                                displayName = 
args[firstArg];
                                                        }
                                                }
                                                break;

                                                case "-iconic":
                                                {
                                                        startIconic = true;
                                                }
                                                break;

                                                case "-name":
                                                {
                                                        ++firstArg;
                                                        if(firstArg < 
args.Length)
                                                        {
                                                                resourceName = 
args[firstArg];
                                                        }
                                                }
                                                break;

                                                case "-title":
                                                {
                                                        ++firstArg;
                                                        if(firstArg < 
args.Length)
                                                        {
                                                                title = 
args[firstArg];
                                                        }
                                                }
                                                break;

                                                case "-bg":
                                                case "-background":
                                                {
                                                        ++firstArg;
                                                        if(firstArg < 
args.Length)
                                                        {
                                                                // TODO: set 
the application's background color.
                                                        }
                                                }
                                                break;

                                                case "-fg":
                                                case "-foreground":
                                                {
                                                        ++firstArg;
                                                        if(firstArg < 
args.Length)
                                                        {
                                                                // TODO: set 
the application's foreground color.
                                                        }
                                                }
                                                break;

                                                case "-fn":
                                                case "-font":
                                                {
                                                        ++firstArg;
                                                        if(firstArg < 
args.Length)
                                                        {
                                                                // TODO: set 
the application's default font.
                                                        }
                                                }
                                                break;

                                                case "-geometry":
                                                {
                                                        ++firstArg;
                                                        if(firstArg < 
args.Length)
                                                        {
                                                                title = 
args[firstArg];
                                                        }
                                                }
                                                break;

                                                // Ignore other Xt toolkit 
options that aren't
                                                // relevant to us.  We may add 
some of these later.
                                                case "-reverse":
                                                case "-rv":
                                                case "+rv":
                                                case "+synchronous":
                                                case "-synchronous":
                                                        break;
                                                case "-bw":
                                                case "-borderwidth":
                                                case "-bd":
                                                case "-bordercolor":
                                                case "-selectionTimeout":
                                                case "-xnllanguage":
                                                case "-xrm":
                                                case "-xtsessionID":
                                                        ++firstArg;
                                                        break;

                                                default:
                                                {
                                                        // Unknown option - 
copy it to "newArgs".
                                                        
newArgs.Add(args[firstArg]);
                                                }
                                                break;
                                        }
                                        ++firstArg;
                                }
                                cmdLineArgs = 
(String[])(newArgs.ToArray(typeof(String)));

                                // Connect to the display.
                                display = XWindows.Display.Open(displayName, 
this);
                        }

        /// <summary>
        /// <para>Close the application if it is currently active.</para>
        /// </summary>
        ~Application()
                        {
                                Close();
                        }

        /// <summary>
        /// <para>Close the application if it is currently active.</para>
        /// </summary>
        ///
        /// <remarks>
        /// <para>This method implements the <see cref="T:System.IDisposable"/>
        /// interface.</para>
        /// </remarks>
        public void Dispose()
                        {
                                Close();
                        }

        /// <summary>
        /// <para>Close the application if it is currently active.</para>
        /// </summary>
        public void Close()
                        {
                                lock(typeof(Application))
                                {
                                        if(display != null)
                                        {
                                                display.Close();
                                                display = null;
                                        }
                                        if(primary == this)
                                        {
                                                primary = null;
                                        }
                                }

                        }

        /// <summary>
        /// <para>Run the main event loop on this application.</para>
        /// </summary>
        ///
        /// <remarks>
        /// <para>The main event loop will run until the <c>Quit</c>
        /// method is called on the display.</para>
        /// </remarks>
        public void Run()
                        {
                                if(display != null)
                                {
                                        display.Run();
                                }
                        }

        /// <summary>
        /// <para>Get the name of this program (i.e. the argv[0] value).</para>
        /// </summary>
        ///
        /// <value>
        /// <para>The program name.</para>
        /// </value>
        public String ProgramName
                        {
                                get
                                {
                                        return programName;
                                }
                        }

        /// <summary>
        /// <para>Get the resource name of this program's primary window.</para>
        /// </summary>
        ///
        /// <value>
        /// <para>The resource name.</para>
        /// </value>
        public String ResourceName
                        {
                                get
                                {
                                        return resourceName;
                                }
                        }

        /// <summary>
        /// <para>Get the resource class of this program.</para>
        /// </summary>
        ///
        /// <value>
        /// <para>The resource class.</para>
        /// </value>
        public String ResourceClass
                        {
                                get
                                {
                                        return resourceClass;
                                }
                        }

        /// <summary>
        /// <para>Get the command-line arguments for this program that
        /// were left after standard options were removed.</para>
        /// </summary>
        ///
        /// <value>
        /// <para>The argument array.</para>
        /// </value>
        public String[] Args
                        {
                                get
                                {
                                        return cmdLineArgs;
                                }
                        }

        /// <summary>
        /// <para>Get the name of the display that we connected to,
        /// or <see langword="null"/> for the default display.</para>
        /// </summary>
        ///
        /// <value>
        /// <para>The display name.</para>
        /// </value>
        public String DisplayName
                        {
                                get
                                {
                                        return displayName;
                                }
                        }

        /// <summary>
        /// <para>Get the display that is associated with this 
application.</para>
        /// </summary>
        ///
        /// <value>
        /// <para>The display object.</para>
        /// </value>
        public Display Display
                        {
                                get
                                {
                                        return display;
                                }
                        }

        /// <summary>
        /// <para>Determine if the program's primary window should
        /// start in an iconic state.</para>
        /// </summary>
        ///
        /// <value>
        /// <para>Returns <see langword="true"/> if the window should
        /// start iconic, or <see langword="false"/> if not.</para>
        /// </value>
        public bool StartIconic
                        {
                                get
                                {
                                        return startIconic;
                                }
                        }

        /// <summary>
        /// <para>Get the value of the "-title" command-line option,
        /// or <see langword="null"/> if no title override.</para>
        /// </summary>
        ///
        /// <value>
        /// <para>The window title.</para>
        /// </value>
        public String Title
                        {
                                get
                                {
                                        return title;
                                }
                        }

        /// <summary>
        /// <para>Get the value of the "-geometry" command-line option,
        /// or <see langword="null"/> if no geometry override.</para>
        /// </summary>
        ///
        /// <value>
        /// <para>The window geometry.</para>
        /// </value>
        public String Geometry
                        {
                                get
                                {
                                        return geometry;
                                }
                        }

        /// <summary>
        /// <para>Get the primary application object.</para>
        /// </summary>
        ///
        /// <value>
        /// <para>The application object.</para>
        /// </value>
        public static Application Primary
                        {
                                get
                                {
                                        return primary;
                                }
                        }

} // class Application

} // namespace XWindows

--- NEW FILE ---
/*
 * CrossingDetail.cs - "Detail" values for Enter/Leave events.
 *
 * This file is part of the X# library.
 * Copyright (C) 2002  Southern Storm Software, Pty Ltd.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace XWindows
{

using System;

/// <summary>
/// <para>The <see cref="T:XWindows.CrossingDetail"/> enumeration specifies
/// notification details for Enter and Leave events on a widget.
/// </para>
/// </summary>
public enum CrossingDetail
{
        NotifyAncestor         = 0,
        NotifyVirtual          = 1,
        NotifyInferior         = 2,
        NotifyNonlinear        = 3,
        NotifyNonlinearVirtual = 4,
        NotifyPointer          = 5,
        NotifyPointerRoot      = 6,
        NotifyDetailNone       = 7

} // enum CrossingDetail

} // namespace XWindows

--- NEW FILE ---
/*
 * CrossingMode.cs - "Mode" values for Enter/Leave events.
 *
 * This file is part of the X# library.
 * Copyright (C) 2002  Southern Storm Software, Pty Ltd.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace XWindows
{

using System;

/// <summary>
/// <para>The <see cref="T:XWindows.CrossingMode"/> enumeration specifies
/// notification modes for Enter and Leave events on a widget.
/// </para>
/// </summary>
public enum CrossingMode
{
        NotifyNormal       = 0,
        NotifyGrab         = 1,
        NotifyUngrab       = 2,
        NotifyWhileGrabbed = 3

} // enum CrossingMode

} // namespace XWindows

Index: Bitmap.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows/Bitmap.cs,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** Bitmap.cs   26 Sep 2002 10:32:40 -0000      1.1.1.1
--- Bitmap.cs   28 Sep 2002 04:47:49 -0000      1.2
***************
*** 50,55 ****
        /// </exception>
        public Bitmap(int width, int height)
!                       : base(XWindows.Display.Primary,
!                                  
XWindows.Display.Primary.DefaultScreenOfDisplay,
                                   DrawableKind.Bitmap)
                        {
--- 50,55 ----
        /// </exception>
        public Bitmap(int width, int height)
!                       : base(XWindows.Application.Primary.Display,
!                                  
XWindows.Application.Primary.Display.DefaultScreenOfDisplay,
                                   DrawableKind.Bitmap)
                        {

Index: Display.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows/Display.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** Display.cs  28 Sep 2002 03:01:00 -0000      1.3
--- Display.cs  28 Sep 2002 04:47:49 -0000      1.4
***************
*** 33,41 ****
  ///
  /// <para>The application normally obtains a <see cref="T:XWindows.Display"/>
! /// instance by accessing the <c>Primary</c> property or calling
! /// the <c>Open</c> method.</para>
! ///
! /// <para>Connections to multiple X display servers can be open
! /// simultaneously.</para>
  /// </summary>
  public sealed class Display : IDisposable
--- 33,38 ----
  ///
  /// <para>The application normally obtains a <see cref="T:XWindows.Display"/>
! /// instance by creating an instance of <see cref="T:XWindows.Application"/>.
! /// </para>
  /// </summary>
  public sealed class Display : IDisposable
***************
*** 46,49 ****
--- 43,47 ----
        private Screen[] screens;
        private int defaultScreen;
+       private Application app;
        private bool quit;
        private bool pendingExposes;
***************
*** 53,58 ****
        internal Xlib.Time knownEventTime;
        internal Hashtable handleMap;
-       private static Display primary;
-       private static Hashtable others;
        private static bool threadsInited;
        internal Xlib.Atom wmProtocols;
--- 51,54 ----
***************
*** 63,71 ****
  
        // Constructor.
!       private Display(IntPtr dpy, String displayName)
                        {
                                // Copy parameters in from the create process.
                                this.dpy = dpy;
                                this.displayName = displayName;
  
                                // Create objects for each of the display 
screens.
--- 59,68 ----
  
        // Constructor.
!       private Display(IntPtr dpy, String displayName, Application app)
                        {
                                // Copy parameters in from the create process.
                                this.dpy = dpy;
                                this.displayName = displayName;
+                               this.app = app;
  
                                // Create objects for each of the display 
screens.
***************
*** 135,178 ****
                        }
  
-       /// <summary>
-       /// <para>Get the primary X display connection.  The connection will
-       /// be opened if it is not currently active.</para>
-       /// </summary>
-       ///
-       /// <value>
-       /// <para>The primary X display connection.</para>
-       /// </value>
-       ///
-       /// <remarks>
-       /// <para>The primary X display is normally specified using the
-       /// <c>DISPLAY</c> environment variable.</para>
-       /// </remarks>
-       ///
-       /// <exception cref="T:XWindows.XCannotConnectException">
-       /// <para>A connection to the primary X display server could not
-       /// be established.</para>
-       /// </exception>
-       public static Display Primary
-                       {
-                               get
-                               {
-                                       lock(typeof(Display))
-                                       {
-                                               if(primary != null)
-                                               {
-                                                       return primary;
-                                               }
-                                               else
-                                               {
-                                                       primary = 
OpenInternal(DefaultDisplayName());
-                                                       return primary;
-                                               }
-                                       }
-                               }
-                       }
- 
        // Internal version of "Open()" that is called once the
        // type lock has been acquired.
!       private static Display OpenInternal(String displayName)
                        {
                                try
--- 132,138 ----
                        }
  
        // Internal version of "Open()" that is called once the
        // type lock has been acquired.
!       private static Display OpenInternal(String displayName, Application app)
                        {
                                try
***************
*** 197,201 ****
                                        {
                                                // We have opened the display 
successfully.
!                                               return new Display(dpy, 
displayName);
                                        }
                                        else
--- 157,161 ----
                                        {
                                                // We have opened the display 
successfully.
!                                               return new Display(dpy, 
displayName, app);
                                        }
                                        else
***************
*** 225,315 ****
                        }
  
!       /// <summary>
!       /// <para>Open the primary connection to the primary X display
!       /// server if it is not currently active.  This method will have
!       /// no effect if a primary connection is already available.</para>
!       /// </summary>
!       ///
!       /// <remarks>
!       /// <para>The primary X display is normally specified using the
!       /// <c>DISPLAY</c> environment variable.</para>
!       /// </remarks>
!       ///
!       /// <exception cref="T:XWindows.XCannotConnectException">
!       /// <para>A connection to the primary X display server could not
!       /// be established.</para>
!       /// </exception>
!       public static void Open()
                        {
                                lock(typeof(Display))
                                {
!                                       if(primary == null)
!                                       {
!                                               primary = 
OpenInternal(DefaultDisplayName());
!                                       }
!                               }
!                       }
! 
!       /// <summary>
!       /// <para>Open a connection to a specific X display server, or retrieve
!       /// an existing connection to the specified server.</para>
!       /// </summary>
!       ///
!       /// <param name="displayName">
!       /// <para>The name of the X display server to open a connection to.
!       /// May be <see langword="null"/> to specify the primary X display
!       /// server.</para>
!       /// </param>
!       ///
!       /// <returns>
!       /// <para>Returns the <see cref="T:XWindows.Display"/> instance that
!       /// corresponds to <paramref name="displayName"/>.</para>
!       /// </returns>
!       ///
!       /// <exception cref="T:XWindows.XCannotConnectException">
!       /// <para>A connection to <paramref name="displayName"/> could not
!       /// be established.</para>
!       /// </exception>
!       public static Display Open(String displayName)
!                       {
!                               if(displayName == null || displayName == 
DefaultDisplayName())
!                               {
!                                       // Return the primary display 
connection.
!                                       return Primary;
!                               }
!                               else
!                               {
!                                       lock(typeof(Display))
!                                       {
!                                               // See if we already have a 
connection.
!                                               if(others == null)
!                                               {
!                                                       others = new 
Hashtable();
!                                               }
!                                               Display display = 
(Display)(others[displayName]);
!                                               if(display != null)
!                                               {
!                                                       return display;
!                                               }
! 
!                                               // Open a new connection to the 
specified display.
!                                               display = 
OpenInternal(displayName);
!                                               others[displayName] = display;
!                                               return display;
!                                       }
!                               }
!                       }
! 
!       // Get the default display name from the user's environment.
!       private static String DefaultDisplayName()
!                       {
!                               try
!                               {
!                                       return Xlib.XDisplayName(null);
!                               }
!                               catch(MissingMethodException)
!                               {
!                                       // The engine was unable to locate 
"XDisplayName".
!                                       return null;
                                }
                        }
--- 185,194 ----
                        }
  
!       // Open a connection to a specific X display server.
!       internal static Display Open(String displayName, Application app)
                        {
                                lock(typeof(Display))
                                {
!                                       return OpenInternal(displayName, app);
                                }
                        }
***************
*** 332,345 ****
                                                        }
  
-                                                       // Remove the object 
from the global map.
-                                                       if(primary == this)
-                                                       {
-                                                               primary = null;
-                                                       }
-                                                       else
-                                                       {
-                                                               
others.Remove(displayName);
-                                                       }
- 
                                                        // Close the connection 
to the X server.
                                                        Xlib.XCloseDisplay(dpy);
--- 211,214 ----
***************
*** 469,472 ****
--- 338,356 ----
  
        /// <summary>
+       /// <para>Get the application object that owns this display.</para>
+       /// </summary>
+       ///
+       /// <value>
+       /// <para>The application object.</para>
+       /// </value>
+       public Application Application
+                       {
+                               get
+                               {
+                                       return app;
+                               }
+                       }
+ 
+       /// <summary>
        /// <para>Get a specific screen from this display, by index.</para>
        /// </summary>
***************
*** 576,579 ****
--- 460,464 ----
                                        IntPtr dpy = Lock();
                                        XEvent xevent;
+                                       Xlib.XFlush(dpy);
                                        inMainLoop = true;
                                        while(!quit)

Index: Drawable.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows/Drawable.cs,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** Drawable.cs 26 Sep 2002 10:32:41 -0000      1.1.1.1
--- Drawable.cs 28 Sep 2002 04:47:49 -0000      1.2
***************
*** 250,253 ****
--- 250,268 ----
                        }
  
+       /// <summary>
+       /// <para>Get the application object that owns this drawable.</para>
+       /// </summary>
+       ///
+       /// <value>
+       /// <para>The application object.</para>
+       /// </value>
+       public Application Application
+                       {
+                               get
+                               {
+                                       return dpy.Application;
+                               }
+                       }
+ 
        // Convert a color into a pixel value, relative to this drawable.
        internal virtual Xlib.Pixel ToPixel(Color color)

Index: EventHandlers.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows/EventHandlers.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** EventHandlers.cs    28 Sep 2002 03:01:00 -0000      1.3
--- EventHandlers.cs    28 Sep 2002 04:47:49 -0000      1.4
***************
*** 251,253 ****
--- 251,292 ----
                                                                                
    ModifierMask modifiers);
  
+ /// <summary>
+ /// <para>The <see cref="T:XWindows.CrossingEventHandler"/> delegate is
+ /// used to process Enter and Leave events on a widget.</para>
+ /// </summary>
+ ///
+ /// <param name="widget">
+ /// <para>The widget that received the event.</para>
+ /// </param>
+ ///
+ /// <param name="child">
+ /// <para>The child widget that contained the previous or final
+ /// position, or <see langword="null"/> if no applicable child widget.</para>
+ /// </param>
+ ///
+ /// <param name="x">
+ /// <para>The X co-ordinate of the pointer position.</para>
+ /// </param>
+ ///
+ /// <param name="y">
+ /// <para>The Y co-ordinate of the pointer position.</para>
+ /// </param>
+ ///
+ /// <param name="modifiers">
+ /// <para>Button and shift flags that were active.</para>
+ /// </param>
+ ///
+ /// <param name="mode">
+ /// <para>The notification mode value from the event.</para>
+ /// </param>
+ ///
+ /// <param name="detail">
+ /// <para>The notification detail value from the event.</para>
+ /// </param>
+ public delegate void CrossingEventHandler(Widget widget, Widget child,
+                                                                               
  int x, int y,
+                                                                               
  ModifierMask modifiers,
+                                                                               
  CrossingMode mode,
+                                                                               
  CrossingDetail detail);
+ 
  } // namespace XWindows

Index: InputOnlyWidget.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows/InputOnlyWidget.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** InputOnlyWidget.cs  28 Sep 2002 03:01:00 -0000      1.5
--- InputOnlyWidget.cs  28 Sep 2002 04:47:49 -0000      1.6
***************
*** 602,605 ****
--- 602,667 ----
                        }
  
+       /// <summary>
+       /// <para>Event that is raised when the mouse pointer enters
+       /// this widget.</para>
+       /// </summary>
+       public event CrossingEventHandler Enter
+                       {
+                               add
+                               {
+                                       lock(this)
+                                       {
+                                               InputEventHandlers handlers = 
GetHandlers();
+                                               
SelectInput(EventMask.EnterWindowMask);
+                                               handlers.enter += value;
+                                       }
+                               }
+                               remove
+                               {
+                                       lock(this)
+                                       {
+                                               if(handlers != null)
+                                               {
+                                                       handlers.enter -= value;
+                                                       if(handlers.enter == 
null)
+                                                       {
+                                                               
DeselectInput(EventMask.EnterWindowMask);
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+ 
+       /// <summary>
+       /// <para>Event that is raised when the mouse pointer leaves
+       /// this widget.</para>
+       /// </summary>
+       public event CrossingEventHandler Leave
+                       {
+                               add
+                               {
+                                       lock(this)
+                                       {
+                                               InputEventHandlers handlers = 
GetHandlers();
+                                               
SelectInput(EventMask.LeaveWindowMask);
+                                               handlers.leave += value;
+                                       }
+                               }
+                               remove
+                               {
+                                       lock(this)
+                                       {
+                                               if(handlers != null)
+                                               {
+                                                       handlers.leave -= value;
+                                                       if(handlers.leave == 
null)
+                                                       {
+                                                               
DeselectInput(EventMask.LeaveWindowMask);
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+ 
        // Dispatch an event to this widget.
        internal override void DispatchEvent(ref XEvent xevent)
***************
*** 634,637 ****
--- 696,701 ----
                public KeyReleaseEventHandler keyRelease;
                public IntPtr keyBuffer;
+               public CrossingEventHandler enter;
+               public CrossingEventHandler leave;
  
                ~InputEventHandlers()
***************
*** 794,797 ****
--- 858,895 ----
                                                                                
(ref xevent.xkey, 0),
                                                                        
xevent.xkey.state);
+                                                       }
+                                               }
+                                               break;
+ 
+                                               case EventType.EnterNotify:
+                                               {
+                                                       // Dispatch a widget 
enter event.
+                                                       if(enter != null)
+                                                       {
+                                                               Widget child = 
(Widget)(widget.dpy.handleMap
+                                                                       
[(int)(xevent.xcrossing.subwindow)]);
+                                                               enter(widget, 
child,
+                                                                         
xevent.xcrossing.x,
+                                                                         
xevent.xcrossing.y,
+                                                                         
xevent.xcrossing.state,
+                                                                         
xevent.xcrossing.mode,
+                                                                         
xevent.xcrossing.detail);
+                                                       }
+                                               }
+                                               break;
+ 
+                                               case EventType.LeaveNotify:
+                                               {
+                                                       // Dispatch a widget 
leave event.
+                                                       if(leave != null)
+                                                       {
+                                                               Widget child = 
(Widget)(widget.dpy.handleMap
+                                                                       
[(int)(xevent.xcrossing.subwindow)]);
+                                                               leave(widget, 
child,
+                                                                         
xevent.xcrossing.x,
+                                                                         
xevent.xcrossing.y,
+                                                                         
xevent.xcrossing.state,
+                                                                         
xevent.xcrossing.mode,
+                                                                         
xevent.xcrossing.detail);
                                                        }
                                                }

Index: Pixmap.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows/Pixmap.cs,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** Pixmap.cs   26 Sep 2002 10:32:42 -0000      1.1.1.1
--- Pixmap.cs   28 Sep 2002 04:47:49 -0000      1.2
***************
*** 50,55 ****
        /// </exception>
        public Pixmap(int width, int height)
!                       : base(XWindows.Display.Primary,
!                                  
XWindows.Display.Primary.DefaultScreenOfDisplay,
                                   DrawableKind.Pixmap)
                        {
--- 50,55 ----
        /// </exception>
        public Pixmap(int width, int height)
!                       : base(XWindows.Application.Primary.Display,
!                                  
XWindows.Application.Primary.Display.DefaultScreenOfDisplay,
                                   DrawableKind.Pixmap)
                        {

Index: TopLevelWindow.cs
===================================================================
RCS file: /cvsroot/dotgnu-libs/xsharp/Xsharp/XWindows/TopLevelWindow.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** TopLevelWindow.cs   27 Sep 2002 07:51:11 -0000      1.2
--- TopLevelWindow.cs   28 Sep 2002 04:47:49 -0000      1.3
***************
*** 136,140 ****
                                if(screen == null)
                                {
!                                       return 
XWindows.Display.Primary.DefaultRootWindow;
                                }
                                else
--- 136,141 ----
                                if(screen == null)
                                {
!                                       return XWindows.Application.Primary
!                                                               
.Display.DefaultRootWindow;
                                }
                                else





reply via email to

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