Hi,

this is the first patch that I commit to make our AWT more compatible
with the 1.0-style event handling. It moves some code from
dispatchEventImpl to dispatchEvent and fixes translateEvent() to also be
usable for MenuComponent events.

2006-01-13  Roman Kennke  <[EMAIL PROTECTED]>

        * java/awt/Component.java
        (dispatchEvent): Moved handling of old style events from
        dispatchEventImpl() to this method.
        (translateEvent): Removed unnecessary cast.
        (dispatchEventImpl): Moved handling of old style events to
        dispatchEvent().

/Roman
Index: java/awt/Component.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v
retrieving revision 1.91
diff -u -r1.91 Component.java
--- java/awt/Component.java	30 Nov 2005 19:19:23 -0000	1.91
+++ java/awt/Component.java	13 Jan 2006 21:15:18 -0000
@@ -2308,6 +2308,10 @@
    */
   public final void dispatchEvent(AWTEvent e)
   {
+    Event oldEvent = translateEvent(e);
+    if (oldEvent != null)
+      postEvent (oldEvent);
+
     // Some subclasses in the AWT package need to override this behavior,
     // hence the use of dispatchEventImpl().
     dispatchEventImpl(e);
@@ -4597,7 +4601,7 @@
    */
   static Event translateEvent (AWTEvent e)
   {
-    Component target = (Component) e.getSource ();
+    Object target = e.getSource ();
     Event translated = null;
 
     if (e instanceof InputEvent)
@@ -4790,16 +4794,12 @@
 
   void dispatchEventImpl(AWTEvent e)
   {
-    Event oldEvent = translateEvent (e);
     // This boolean tells us not to process focus events when the focus
     // opposite component is the same as the focus component.
     boolean ignoreFocus = 
       (e instanceof FocusEvent && 
        ((FocusEvent)e).getComponent() == ((FocusEvent)e).getOppositeComponent());
     
-    if (oldEvent != null)
-      postEvent (oldEvent);
-
     if (eventTypeEnabled (e.id))
       {
         // the trick we use to communicate between dispatch and redispatch
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to