Bug 26848 - setBounds/exposure problems with Matchbox WM interaction
Summary: setBounds/exposure problems with Matchbox WM interaction
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: awt (show other bugs)
Version: 0.90
: P3 normal
Target Milestone: 0.91
Assignee: Mark Wielaard
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-24 15:29 UTC by philippe.laporte
Modified: 2006-03-30 22:34 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-03-29 10:58:39


Attachments
reproducer (3.16 KB, application/octet-stream)
2006-03-24 15:30 UTC, philippe.laporte
Details

Note You need to log in before you can comment on or make changes to this bug.
Description philippe.laporte 2006-03-24 15:29:10 UTC
With Cacao and Classpath 0.9 running on FC4:


Bug 1?
-----
When running the attached program it locks upp when calling

    testPanel.setBounds(bounds);

in MainFrame.java setSize() method


Bug2?
-----
I had to add a call to pack() in the MainFrame constructor, even
though no layout manager is used. If you remove this call the Frame
window is not created, even though show() is called from main. Why?
Comment 1 philippe.laporte 2006-03-24 15:30:14 UTC
Created attachment 11114 [details]
reproducer
Comment 2 philippe.laporte 2006-03-24 15:35:47 UTC
this happened when not using Matchbox WM
Comment 3 Mark Wielaard 2006-03-24 20:27:27 UTC
The lockup is caused by GtkFramePeer.postConfigureEvent() which calls directly into the awtComponent.setSize() method from the gtk main thread while holding the gtk_threads lock.
Comment 4 Mark Wielaard 2006-03-29 10:58:39 UTC
This is actually 2 bugs:
- Deadlock between GtkFramePeer.postConfigureEvent() and Component.setSize()
- Without calling pack() the Frame without LayoutManager isn't shown.

Working on a patch for the first issue.
Comment 5 Mark Wielaard 2006-03-29 14:05:12 UTC
Note that the test case is a little evil. It shows the frame first (triggering  a configure event for the component) and only resizes the frame afterwards (while we might still be waiting for the first configure event to come in).
Comment 6 Mark Wielaard 2006-03-29 14:57:18 UTC
Patch for discussion posted:
http://article.gmane.org/gmane.comp.java.classpath.patches/7911
Comment 7 Mark Wielaard 2006-03-29 22:41:54 UTC
(In reply to comment #4)
> This is actually 2 bugs:
> - Deadlock between GtkFramePeer.postConfigureEvent() and Component.setSize()
> - Without calling pack() the Frame without LayoutManager isn't shown.

The second issue is caused by an optimization in GtkComponent.setVisible() which doesn't show components with height or width of zero. If pack() hasn't been called on a Window/Frame then it still has a height and width of zero when show() is called. We should always show subclasses of Window in GtkComponent.setVisible().
Comment 8 cvs-commit@developer.classpath.org 2006-03-29 22:52:51 UTC
Subject: Bug 26848

CVSROOT:	/cvsroot/classpath
Module name:	classpath
Branch: 	
Changes by:	Mark Wielaard <mark@savannah.gnu.org>	06/03/29 22:48:04

Modified files:
	.              : ChangeLog 
	gnu/java/awt/peer/gtk: GtkComponentPeer.java 

Log message:
	Partial fix for bug #26848 (pack).
	* gnu/java/awt/peer/gtk/GtkComponentPeer.java (setVisible):
	Always show instances of Window.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.6944&tr2=1.6945&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java.diff?tr1=1.111&tr2=1.112&r1=text&r2=text



Comment 9 Mark Wielaard 2006-03-30 22:34:19 UTC
Fixes for both issues have been checked in.
Comment 10 cvs-commit@developer.classpath.org 2006-03-30 23:03:14 UTC
Subject: Bug 26848

CVSROOT:	/cvsroot/classpath
Module name:	classpath
Branch: 	
Changes by:	Mark Wielaard <mark@savannah.gnu.org>	06/03/30 22:36:03

Modified files:
	.              : ChangeLog 

Log message:
	Fix PR number.
	
	PR 26848
	* java/awt/Window.java (dispatchEventImpl): On ComponentEvents
	adjust bounds. On resize invalidate and validate container.
	Always pass on ComponentEvents to Container super class.
	* gnu/java/awt/peer/gtk/GtkFramePeer.java (setBounds): Adjust for
	menuBar and pass to GtkWindowPeer super class.
	(postConfigureEvent): Adjust menu bar width. Adjust y and height
	bounds and pass to GtkWindowPeer super class.
	* gnu/java/awt/peer/gtk/GtkWindowPeer.java (x, y, width, height):
	New fields for local bounds.
	(getX, getY): New methods.
	(getWidth): Don't call into awtComponent.
	(getHeight): Likewise.
	(create): Cache local bounds.
	(setLocation): Documented, made protected and just call
	nativeSetLocation.
	(setLocationUnlocked): Removed unused method.
	(setBoundsUnlocked): Likewise.
	(setBounds): Check whether bounds actually changed and cache local
	bounds.
	(setSize): Documented and made protected.
	(setResizable): Documented and cache local bounds.
	(postConfigureEvent): Update local bounds. Don't call awtComponent
	directly but post ComponentEvents.
	(show): Cache local bounds.
	(getBounds): Override to return cached bounds.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/classpath/ChangeLog.diff?tr1=1.6954&tr2=1.6955&r1=text&r2=text