[kaffe] CVS kaffe (riccardo): implemented a compliant setSource() in AWTEvent

Kaffe CVS cvs-commits at kaffe.org
Tue Apr 25 15:25:27 PDT 2006


PatchSet 7275 
Date: 2006/04/25 22:13:59
Author: riccardo
Branch: HEAD
Tag: (none) 
Log:
implemented a compliant setSource() in AWTEvent

Members: 
	ChangeLog:1.4779->1.4780 
	libraries/javalib/awt-implementations/kaffe/java/awt/AWTEvent.java:1.5->1.6 
	libraries/javalib/awt-implementations/kaffe/java/awt/Defaults.java:1.1->1.2 
	libraries/javalib/awt-implementations/kaffe/java/awt/RowCanvas.java:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4779 kaffe/ChangeLog:1.4780
--- kaffe/ChangeLog:1.4779	Mon Apr 24 23:06:02 2006
+++ kaffe/ChangeLog	Tue Apr 25 22:13:59 2006
@@ -1,3 +1,9 @@
+2006-04-26  Riccardo Mottola <riccardo at kaffe.org>
+
+	* javalib/awt-implementations/kaffe/java/awt/AWTEvent.java,
+	javalib/awt-implementations/kaffe/java/awt/Defaults.java:
+	implemented a compliant setSource() in AWTEvent.
+
 2006-04-25  Riccardo Mottola <riccardo at kaffe.org>
 
 	* awt-implementations/kaffe/java/awt/event/HierarchyBoundsAdapter.java,
Index: kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/AWTEvent.java
diff -u kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/AWTEvent.java:1.5 kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/AWTEvent.java:1.6
--- kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/AWTEvent.java:1.5	Thu Mar 30 22:14:11 2006
+++ kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/AWTEvent.java	Tue Apr 25 22:14:05 2006
@@ -34,24 +34,83 @@
 public class AWTEvent
   extends EventObject
 {
-	protected int id;
-	protected boolean consumed;
-	protected AWTEvent next;
-	final private static long serialVersionUID = -1825314779160409405L;
-	public static final long COMPONENT_EVENT_MASK = 0x01;
-	public static final long CONTAINER_EVENT_MASK = 0x02;
-	public static final long FOCUS_EVENT_MASK = 0x04;
-	public static final long KEY_EVENT_MASK = 0x08;
-	public static final long MOUSE_EVENT_MASK = 0x10;
-	public static final long MOUSE_MOTION_EVENT_MASK = 0x20;
-	public static final long WINDOW_EVENT_MASK = 0x40;
-	public static final long ACTION_EVENT_MASK = 0x80;
-	public static final long ADJUSTMENT_EVENT_MASK = 0x100;
-	public static final long ITEM_EVENT_MASK = 0x200;
-	public static final long TEXT_EVENT_MASK = 0x400;
-        public static final long INPUT_METHOD_EVENT_MASK = 0x800;
-	public static final int RESERVED_ID_MAX = 1999;
-	  /**
+  /**
+   * Compatible with JDK 1.1+.
+   */
+  private static final long serialVersionUID = -1825314779160409405L;
+  
+    /**
+   * The ID of the event.
+   *
+   * @see #getID()
+   * @see #AWTEvent(Object, int)
+   * @serial the identifier number of this event
+   */
+  protected int id;
+
+  /**
+   * Indicates if the event has been consumed. False mean it is passed to
+   * the peer, true means it has already been processed. Semantic events
+   * generated by low-level events always have the value true.
+   *
+   * @see #consume()
+   * @see #isConsumed()
+   * @serial whether the event has been consumed
+   */
+  protected boolean consumed;
+
+  /**
+   * Who knows? It's in the serial version.
+   *
+   * @serial No idea what this is for.
+   */
+  byte[] bdata;
+  
+    /** Mask for selecting component events. */
+  public static final long COMPONENT_EVENT_MASK = 0x00001;
+
+  /** Mask for selecting container events. */
+  public static final long CONTAINER_EVENT_MASK = 0x00002;
+
+  /** Mask for selecting component focus events. */
+  public static final long FOCUS_EVENT_MASK = 0x00004;
+
+  /** Mask for selecting keyboard events. */
+  public static final long KEY_EVENT_MASK = 0x00008;
+
+  /** Mask for mouse button events. */
+  public static final long MOUSE_EVENT_MASK = 0x00010;
+
+  /** Mask for mouse motion events. */
+  public static final long MOUSE_MOTION_EVENT_MASK = 0x00020;
+
+  /** Mask for window events. */
+  public static final long WINDOW_EVENT_MASK = 0x00040;
+
+  /** Mask for action events. */
+  public static final long ACTION_EVENT_MASK = 0x00080;
+
+  /** Mask for adjustment events. */
+  public static final long ADJUSTMENT_EVENT_MASK = 0x00100;
+
+  /** Mask for item events. */
+  public static final long ITEM_EVENT_MASK = 0x00200;
+
+  /** Mask for text events. */
+  public static final long TEXT_EVENT_MASK = 0x00400;
+
+  /**
+   * Mask for input method events.
+   * @since 1.3
+   */
+  public static final long INPUT_METHOD_EVENT_MASK = 0x00800;
+
+  /**
+   * Mask if input methods are enabled. Package visible only.
+   */
+  static final long INPUT_ENABLED_EVENT_MASK = 0x01000;
+
+  /**
    * Mask for paint events.
    * @since 1.3
    */
@@ -62,8 +121,20 @@
    * @since 1.3
    */
   public static final long INVOCATION_EVENT_MASK = 0x04000;
-  
-    /**
+
+  /**
+   * Mask for hierarchy events.
+   * @since 1.3
+   */
+  public static final long HIERARCHY_EVENT_MASK = 0x08000;
+
+  /**
+   * Mask for hierarchy bounds events.
+   * @since 1.3
+   */
+  public static final long HIERARCHY_BOUNDS_EVENT_MASK = 0x10000;
+
+  /**
    * Mask for mouse wheel events.
    * @since 1.4
    */
@@ -74,15 +145,28 @@
    * @since 1.4
    */
   public static final long WINDOW_STATE_EVENT_MASK = 0x40000;
-  
-    /**
+
+  /**
    * Mask for window focus events.
    * @since 1.4
    */
   public static final long WINDOW_FOCUS_EVENT_MASK = 0x80000;
-  
+
+  /**
+  * This is the highest number for event ids that are reserved for use by
+  * the AWT system itself. Subclasses outside of java.awt should use higher
+  * ids.
+  */
+  public static final int RESERVED_ID_MAX = 1999;
+
+
+    
+  protected AWTEvent next;
+
+// TODO check if these can be eliminated  
 	final static long DISABLED_MASK = 0x80000000;
 	final static long TEMP_DISABLED_MASK = 0x40000000;
+	
 	static Component keyTgt;
 	static Window activeWindow;
 	static Component mouseTgt;
@@ -180,9 +264,19 @@
       Toolkit.eventQueue.postEvent( e);
 }
 
-static void setSource ( AWTEvent evt, Object newSource ) {
-	evt.source = newSource;
-}
+
+  /**
+   * Retarget the event, such as converting a heavyweight component to a
+   * lightweight child of the original. This is not for general use, but
+   * is for event targeting systems like KeyboardFocusManager.
+   *
+   * @param source the new source
+   * @since 1.4
+   */
+  public void setSource(Object source)
+  {
+    this.source = source;
+  }
 
 public String toString () {
 	StringBuffer result = new StringBuffer(getClass().getName());
Index: kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/Defaults.java
diff -u kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/Defaults.java:1.1 kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/Defaults.java:1.2
--- kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/Defaults.java:1.1	Thu Jul 22 19:19:30 2004
+++ kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/Defaults.java	Tue Apr 25 22:14:05 2006
@@ -20,7 +20,7 @@
  *
  * @author P.C.Mehlitz
  */
-class Defaults
+public class Defaults
 {
 /**
  * If ConsoleClass is set to the classname of a kaffe.util.log.LogClient, System.out, err
@@ -38,7 +38,7 @@
  * Upper bound (in ms) between mouse button press events which will be
  * considered as a 'click' (will increase the MouseEvent clickCount)
  */
-	static int ClickInterval = 250;
+public static int ClickInterval = 250;
 /**
  * maximum x,y coordinate distance (in pixels) between successive MOUSE_PRESSED
  * events which are still considered to be a click (required for some devices
Index: kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/RowCanvas.java
diff -u kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/RowCanvas.java:1.1 kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/RowCanvas.java:1.2
--- kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/RowCanvas.java:1.1	Thu Jul 22 19:19:33 2004
+++ kaffe/libraries/javalib/awt-implementations/kaffe/java/awt/RowCanvas.java	Tue Apr 25 22:14:05 2006
@@ -224,14 +224,14 @@
 
 void redirectFocusEvent( FocusEvent e) {
 	if ( parent.focusListener != null ){
-		AWTEvent.setSource( e, parent);
+		e.setSource(parent);
 		parent.process( e);
 	}
 }
 
 void redirectKeyEvent( KeyEvent e) {
 	if ( parent.keyListener != null ){
-		AWTEvent.setSource( e, parent);
+		e.setSource(parent);
 		parent.process( e);
 	}
 }




More information about the kaffe mailing list