From c42db9746556ec5c5ebf562e57c00dfd75726b6f Mon Sep 17 00:00:00 2001 From: mdb Date: Sat, 3 May 2003 00:06:23 +0000 Subject: [PATCH] More Mac hackery. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1109 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../src/java/com/samskivert/util/RunAnywhere.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/projects/samskivert/src/java/com/samskivert/util/RunAnywhere.java b/projects/samskivert/src/java/com/samskivert/util/RunAnywhere.java index 52726669..5423d6d1 100644 --- a/projects/samskivert/src/java/com/samskivert/util/RunAnywhere.java +++ b/projects/samskivert/src/java/com/samskivert/util/RunAnywhere.java @@ -1,8 +1,10 @@ // -// $Id: RunAnywhere.java,v 1.1 2003/05/02 23:47:39 mdb Exp $ +// $Id: RunAnywhere.java,v 1.2 2003/05/03 00:06:23 mdb Exp $ package com.samskivert.util; +import java.awt.event.InputEvent; + /** * Write once, run anywhere. Well, at least that's what it * said in the brochures. For those less than fresh days, you might need @@ -28,6 +30,17 @@ public class RunAnywhere return _isMacOS; } + /** + * Returns the timestamp associated with the supplied event except on + * the Macintosh where it returns {@link System#currentTimeMillis} + * because {@link InputEvent#getWhen} returns completely incorrect + * values. Hopefully this method will become unnecessary soon. + */ + public static long getWhen (InputEvent event) + { + return isMacOS() ? System.currentTimeMillis() : event.getWhen(); + } + /** Flag indicating that we're on Windows; initialized when this class * is first loaded. */ protected static boolean _isWindows;