This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: [PATCH] Fixes to AWT PaintEvent handling
- From: Thomas Fitzsimmons <fitzsim at redhat dot com>
- To: David Jee <djee at redhat dot com>
- Cc: libgcj patches <java-patches at gcc dot gnu dot org>
- Date: Mon, 26 Jan 2004 16:22:55 -0500
- Subject: Re: [PATCH] Fixes to AWT PaintEvent handling
- References: <1074894442.5040.19.camel@tomboy.toronto.redhat.com>
On Fri, 2004-01-23 at 16:47, David Jee wrote:
> Hello all,
>
> Here is a patch that reworks and fixes PaintEvent handling in Component
> and Container classes. This patch eliminates redundant calls to
> paint()/update(), and will make sure that heavyweight components are
> repainted properly along with the lightweight peers.
>
> Firstly, it consolidates the PaintEvent handling between the two classes
> so that only one paint()/update() method call results from a single
> PaintEvent. This is done by relocating PaintEvent processing for both
> Component and Container objects to GtkComponentPeer's handleEvent().
>
> Secondly, it adds a mechanism to explicitly repaint a heavyweight
> component by calling native GTK methods to invalidate and update the
> corresponding widget.
>
> I originally had problems with repainting heavyweight peers, where
> invalidating a widget caused an expose event from GTK, which caused a
> PaintEvent in AWT, which then caused AWT to invalidate the same widget
> again, resulting in an infinite loop. So I added mechanisms to filter
> out these unwanted expose events from GTK to break the loop.
>
> Any comments and are welcome.
>
This looks good to me with one change: GtkContainerPeer.handleEvent can
be removed completely since it just calls its parent's handleEvent
method. We can address the FIXMEs later, if need be.
Thanks,
Tom
> -David Jee
>
>
> 2004-01-23 David Jee <djee@redhat.com>
>
> * 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): Moved the code to GtkComponentPeer.handleEvent().
> Just call super.handleEvent()
> * 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.
>
>