[Gtk-sharp-list] Gtk.Application patch

Lee Mallabone gnome@fonicmonkey.net
13 Apr 2003 13:05:30 +0100


--=-eusmBmReJs9DmbQDOQ4C
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Sat, 2003-04-12 at 19:11, Gonzalo Paniagua Javier wrote:
> > 
> > There's a patch to Gtk.Application from Mathias Hasselmann attached to
> > bug #40169 (and this mail).

> I think it would be nice to return that value as a DateTime.

How does the attached patch look? It tries to deal with GDK_CURRENT_TIME too...

Lee.


--=-eusmBmReJs9DmbQDOQ4C
Content-Disposition: attachment; filename=Application.cs.diff
Content-Type: text/plain; name=Application.cs.diff; charset=ANSI_X3.4-1968
Content-Transfer-Encoding: 7bit

? Application.cs.diff
? ColorSelection.custom.diff
Index: Application.cs
===================================================================
RCS file: /cvs/public/gtk-sharp/gtk/Application.cs,v
retrieving revision 1.11
diff -u -r1.11 Application.cs
--- Application.cs	25 Mar 2003 16:57:05 -0000	1.11
+++ Application.cs	13 Apr 2003 12:13:08 -0000
@@ -173,5 +173,20 @@
 				return null;
 			}
 		}
+
+		[DllImport("libgtk-win32-2.0-0.dll")]
+		static extern uint gtk_get_current_event_time ();
+
+		public static DateTime CurrentEventTime
+		{
+			get {
+				uint eventTime = gtk_get_current_event_time ();
+				if (eventTime == 0L) // GDK_CURRENT_TIME
+				{
+					return DateTime.Now;
+				}
+				return new DateTime(eventTime);
+			}
+		}
 	}
 }

--=-eusmBmReJs9DmbQDOQ4C--