From 7edbd87e17d9240077eed1993436365ad6c4365c Mon Sep 17 00:00:00 2001 From: David Jee Date: Mon, 26 Jan 2004 21:55:42 +0000 Subject: 2004-01-26 David Jee * gnu/java/awt/peer/gtk/GtkComponentPeer.java (handleEvent): Implemented. Handles PaintEvents. (paint): Implemented. Use GTK native methods to queue updates for this heavyweight peer. * gnu/java/awt/peer/gtk/GtkContainerPeer.java (handleEvent): Removed. * java/awt/Component.java (paint): Implemented. Explictly paint the heavyweight peer. (update): Clear the background for heavyweight components. (paintAll): No need to call peer.paint() anymore. (processEvent): Don't process PaintEvents here. It's now done in the peer's handleEvent(). (processPaintEvent): Removed. * java/awt/Container.java (paint): No need to call super.paint(). Visit heavyweight children as well. (update): Don't clear the background here. It's done in Component.update(). (visitChildren): Added check to not recurse into Containers. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c (filter_expose_event_handler): New method. Filter unwanted expose events while painting heavyweight peers. (Java_gnu_java_awt_peer_gtk_GtkComponentPeer_addExposeFilter): New method. Connect filter and block pre_event_handler. (Java_gnu_java_awt_peer_gtk_GtkComponentPeer_removeExposeFilter): New method. Disconnect filter and unblock pre_event_handler. (Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetQueueDrawArea): New method. Invalidate and update given area. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c (pre_event_handler): Add checks for unwanted expose events. From-SVN: r76668 --- libjava/java/awt/Container.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'libjava/java/awt/Container.java') diff --git a/libjava/java/awt/Container.java b/libjava/java/awt/Container.java index 5d176be..57cd833 100644 --- a/libjava/java/awt/Container.java +++ b/libjava/java/awt/Container.java @@ -663,8 +663,9 @@ public class Container extends Component { if (!isShowing()) return; - super.paint(g); - visitChildren(g, GfxPaintVisitor.INSTANCE, true); + // Visit heavyweights as well, in case they were + // erased when we cleared the background for this container. + visitChildren(g, GfxPaintVisitor.INSTANCE, false); } /** @@ -678,11 +679,6 @@ public class Container extends Component */ public void update(Graphics g) { - Rectangle clip = g.getClipBounds(); - if (clip == null) - g.clearRect(0, 0, width, height); - else - g.clearRect(clip.x, clip.y, clip.width, clip.height); super.update(g); } @@ -1204,8 +1200,12 @@ public class Container extends Component for (int i = ncomponents - 1; i >= 0; --i) { Component comp = component[i]; + // If we're visiting heavyweights as well, + // don't recurse into Containers here. This avoids + // painting the same nested child multiple times. boolean applicable = comp.isVisible() - && (comp.isLightweight() || !lightweightOnly); + && (comp.isLightweight() + || !lightweightOnly && ! (comp instanceof Container)); if (applicable) visitChild(gfx, visitor, comp); -- cgit v1.1