classpath-patches
[Top][All Lists]
Advanced

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

[cp-patches] Fix for Component.postEvent for top-level components


From: Dalibor Topic
Subject: [cp-patches] Fix for Component.postEvent for top-level components
Date: Thu, 16 Sep 2004 19:04:50 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5

Hi all,

the attched patch fixes postEvent for top-level components, by only delegating unhandled events to the parent component in case that a parent component exist. It's been reported after Stephane tried out Odonata on Kaffe [1].

Also attached is a small test case. And the obligatory ChangeLog entry is

2004-09-16  Dalibor Topic  <address@hidden>

        * java/awt/Component.java (postEvent):
        Only delegate to parent if a parent exists.

        Reported by: Stephane Meslin-Weber <address@hidden>


cheers,
dalibor topic

[1] http://www.kaffe.org/pipermail/kaffe/2004-September/099721.html
Index: java/awt/Component.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v
retrieving revision 1.41
diff -u -r1.41 Component.java
--- java/awt/Component.java     11 Sep 2004 12:18:06 -0000      1.41
+++ java/awt/Component.java     16 Sep 2004 17:00:46 -0000
@@ -2270,7 +2270,7 @@
   {
     boolean handled = handleEvent (e);
 
-    if (!handled)
+    if (!handled && getParent() != null)
       // FIXME: need to translate event coordinates to parent's
       // coordinate space.
       handled = getParent ().postEvent (e);
import java.awt.*;

public class PostEventTopLevel {

        public static void main (String [] args) {

                Component c = new Button();
                boolean handled = c.postEvent(new Event(null,0,null));
                System.out.println(handled);

        }
}

reply via email to

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