In GtkWindowPeer we really should call update() on the Window when an
UPDATE PaintEvent arrives. The testcase in
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29502
demonstrates that. (I'll try to add that to Mauve).
That testcase shows another problem with Window event handling (window
not closing), which is also fixed by this patch.
2006-10-18 Roman Kennke <[EMAIL PROTECTED]>
PR 29502
* gnu/java/awt/peer/gtk/GtkWindowPeer.java
(updateComponent): Don't override this here.
* java/awt/Window.java
(addWindowListener): Ignore null listener. Set newEventsOnly
flag.
(addWindowFocusListener): Ignore null listener. Set
newEventsOnly
flag.
(addWindowStateListener): Ignore null listener. Set
newEventsOnly
flag.
/Roman
Index: gnu/java/awt/peer/gtk/GtkWindowPeer.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java,v
retrieving revision 1.54
diff -u -1 -5 -r1.54 GtkWindowPeer.java
--- gnu/java/awt/peer/gtk/GtkWindowPeer.java 13 Oct 2006 15:15:12 -0000 1.54
+++ gnu/java/awt/peer/gtk/GtkWindowPeer.java 18 Oct 2006 16:18:45 -0000
@@ -366,37 +366,30 @@
return retval;
}
public Graphics getGraphics ()
{
Graphics g = super.getGraphics ();
// Translate AWT co-ordinates, which include a window frame's
// insets, to GTK co-ordinates, which do not include a window
// frame's insets. GtkWindowPeer should always have all-zero
// insets but GtkFramePeer and GtkDialogPeer insets will be
// non-zero.
g.translate (-insets.left, -insets.top);
return g;
}
- protected void updateComponent (PaintEvent event)
- {
- // Do not clear anything before painting. Sun never calls
- // Window.update, only Window.paint.
- paintComponent(event);
- }
-
protected void postMouseEvent(int id, long when, int mods, int x, int y,
int clickCount, boolean popupTrigger)
{
// Translate AWT co-ordinates, which include a window frame's
// insets, to GTK co-ordinates, which do not include a window
// frame's insets. GtkWindowPeer should always have all-zero
// insets but GtkFramePeer and GtkDialogPeer insets will be
// non-zero.
super.postMouseEvent (id, when, mods,
x + insets.left, y + insets.top,
clickCount, popupTrigger);
}
// We override this to keep it in sync with our internal
// representation.
Index: java/awt/Window.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Window.java,v
retrieving revision 1.76
diff -u -1 -5 -r1.76 Window.java
--- java/awt/Window.java 18 Oct 2006 09:18:55 -0000 1.76
+++ java/awt/Window.java 18 Oct 2006 16:18:45 -0000
@@ -480,31 +480,35 @@
}
else
trimmedList = validList;
}
return trimmedList;
}
/**
* Adds the specified listener to the list of <code>WindowListeners</code>
* that will receive events for this window.
*
* @param listener The <code>WindowListener</code> to add.
*/
public synchronized void addWindowListener(WindowListener listener)
{
- windowListener = AWTEventMulticaster.add(windowListener, listener);
+ if (listener != null)
+ {
+ newEventsOnly = true;
+ windowListener = AWTEventMulticaster.add(windowListener, listener);
+ }
}
/**
* Removes the specified listener from the list of
* <code>WindowListeners</code> that will receive events for this window.
*
* @param listener The <code>WindowListener</code> to remove.
*/
public synchronized void removeWindowListener(WindowListener listener)
{
windowListener = AWTEventMulticaster.remove(windowListener, listener);
}
/**
* Returns an array of all the window listeners registered on this window.
@@ -537,41 +541,51 @@
*
* @since 1.4
*/
public synchronized WindowStateListener[] getWindowStateListeners()
{
return (WindowStateListener[])
AWTEventMulticaster.getListeners(windowStateListener,
WindowStateListener.class);
}
/**
* Adds the specified listener to this window.
*/
public void addWindowFocusListener (WindowFocusListener wfl)
{
- windowFocusListener = AWTEventMulticaster.add (windowFocusListener, wfl);
+ if (wfl != null)
+ {
+ newEventsOnly = true;
+ windowFocusListener = AWTEventMulticaster.add (windowFocusListener,
+ wfl);
+ }
}
/**
* Adds the specified listener to this window.
*
* @since 1.4
*/
public void addWindowStateListener (WindowStateListener wsl)
{
- windowStateListener = AWTEventMulticaster.add (windowStateListener, wsl);
+ if (wsl != null)
+ {
+ newEventsOnly = true;
+ windowStateListener = AWTEventMulticaster.add (windowStateListener,
+ wsl);
+ }
}
/**
* Removes the specified listener from this window.
*/
public void removeWindowFocusListener (WindowFocusListener wfl)
{
windowFocusListener = AWTEventMulticaster.remove (windowFocusListener, wfl);
}
/**
* Removes the specified listener from this window.
*
* @since 1.4
*/