This fixes the bug where WindowEvents were not being translated into the
old style events, and therefore not being dispatched.
2006-05-30 Lillian Angel <[EMAIL PROTECTED]>
PR 27785
* java/awt/Component.java:
(translateEvent): Added handling to translate WindowEvents
* java/awt/Window.java:
Removed unneeded imports.
Index: java/awt/Component.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v
retrieving revision 1.118
diff -u -r1.118 Component.java
--- java/awt/Component.java 11 May 2006 08:34:19 -0000 1.118
+++ java/awt/Component.java 30 May 2006 16:36:32 -0000
@@ -4810,8 +4810,38 @@
{
Object target = e.getSource ();
Event translated = null;
+
+ if (e instanceof WindowEvent)
+ {
+ WindowEvent we = (WindowEvent) e;
+ int id = we.id;
+ int newId = 0;
+
+ switch (id)
+ {
+ case WindowEvent.WINDOW_DEICONIFIED:
+ newId = Event.WINDOW_DEICONIFY;
+ break;
+ case WindowEvent.WINDOW_CLOSED:
+ case WindowEvent.WINDOW_CLOSING:
+ newId = Event.WINDOW_DESTROY;
+ break;
+ case WindowEvent.WINDOW_ICONIFIED:
+ newId = Event.WINDOW_ICONIFY;
+ break;
+ case WindowEvent.WINDOW_GAINED_FOCUS:
+ newId = Event.GOT_FOCUS;
+ break;
+ case WindowEvent.WINDOW_LOST_FOCUS:
+ newId = Event.LOST_FOCUS;
+ break;
+ default:
+ return null;
+ }
- if (e instanceof InputEvent)
+ translated = new Event(target, 0, newId, 0, 0, 0, 0);
+ }
+ else if (e instanceof InputEvent)
{
InputEvent ie = (InputEvent) e;
long when = ie.getWhen ();
Index: java/awt/Window.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Window.java,v
retrieving revision 1.71
diff -u -r1.71 Window.java
--- java/awt/Window.java 26 May 2006 15:36:04 -0000 1.71
+++ java/awt/Window.java 30 May 2006 16:36:32 -0000
@@ -38,11 +38,8 @@
package java.awt;
-import gnu.classpath.NotImplementedException;
-
import java.awt.event.ComponentEvent;
import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowFocusListener;