Skip to content

Fix Frame.setState(), use java.awt.printerjob, implement canDisplay() - #58

Closed
duncanmcqueen wants to merge 3 commits into
ingelabs:masterfrom
duncanmcqueen:fix-awt
Closed

duncanmcqueen wants to merge 3 commits into
ingelabs:masterfrom
duncanmcqueen:fix-awt

Conversation

@duncanmcqueen

Copy link
Copy Markdown
Contributor

Summary

This pull request has three small AWT fixes.

  • Frame.setState() sets the opposite of the requested state. setState(ICONIFIED) removes ICONIFIED, and setState(NORMAL) adds it.
  • PrinterJob.getPrinterJob() always returns JavaPrinterJob. Now the system property java.awt.printerjob can name the class, as in the JDK. A toolkit can set this property to supply its own printing. Without the property, the result is JavaPrinterJob as before.
  • OpenTypeFontPeer.canDisplay() and canDisplayUpTo() throw UnsupportedOperationException. Now they use the character map of the font.

Tests

On Haiku with Kaffe: Frame.setState(ICONIFIED) and setState(NORMAL) minimize and restore a frame. PrinterJob.getPrinterJob() returns the Haiku printer job when the property names it, and the job prints. I did not test on Linux. The changes are in Java code only.

AI assistance

An AI model (Claude Code, by Anthropic) wrote these changes and this text. The repository owner directed the work. Please review the changes as you review other contributions.

The commits do not have a Signed-off-by line. If you need one, the owner will add it.

🤖 Generated with Claude Code

duncanmcqueen and others added 3 commits October 14, 2026 08:46
setState(NORMAL) added ICONIFIED to an iconified frame and
setState(ICONIFIED) removed it, the opposite of the request. Remove
ICONIFIED for NORMAL and add it for ICONIFIED, and keep the other
state bits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: duncanmcqueen <206344294+duncanmcqueen@users.noreply.github.com>
As in the JDK, the system property java.awt.printerjob names the
PrinterJob class. A toolkit can set it to supply its own printing.
Without the property, or if the class cannot be made, use
JavaPrinterJob as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: duncanmcqueen <206344294+duncanmcqueen@users.noreply.github.com>
Both methods threw UnsupportedOperationException, so Font.canDisplay()
failed for all OpenType fonts. A character can be displayed when the
font maps it to a glyph other than the missing glyph.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: duncanmcqueen <206344294+duncanmcqueen@users.noreply.github.com>
@guillerodriguez

Copy link
Copy Markdown
Contributor

Hi @duncanmcqueen, thanks for these too!

As with #59, could you split this into separate PRs, one per fix? Steps to reproduce or a small test case for each would be very helpful as well.

Thanks!

@duncanmcqueen

Copy link
Copy Markdown
Contributor Author

Thank you for the review. I split this pull request into one pull request for each fix:

Each pull request has a small test case and the results before and after the change. I reproduced all three problems on Linux with JamVM and the master branch, so they are not specific to Haiku.

I close this pull request, because the three new pull requests replace it.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants