Repository navigation
Add an AWT toolkit and a sound mixer for Haiku - #61
duncanmcqueen wants to merge 3 commits into
Conversation
d72cc6c to
683fa42
Compare
|
I added a commit: Haiku peer: draw shapes and images with native code. On Kaffe's interpreter, per-pixel Java code is very slow. The new file Measured on Haiku with Kaffe (microseconds per operation, before / after):
The full build passes 🤖 Generated with Claude Code |
9dcd155 to
f85bf0c
Compare
f85bf0c to
45d8ef8
Compare
On Haiku, gethostbyname_r() is in libnetwork but no header declares it, so configure finds the function but not the number of arguments, and cpnet.c stops with #error. Use gethostbyname() in that case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: duncanmcqueen <dwmcqueen@gmail.com>
45d8ef8 to
5ec6e0a
Compare
gnu.java.awt.peer.haiku is an AWT toolkit for Haiku. Windows, menus, file panels, cursors, the clipboard, drag and drop, printing (through the print server) and input methods are native Haiku parts. The other widgets use the Swing peers. Haiku's font engine measures and draws the text. gnu.javax.sound.sampled.haiku is a javax.sound.sampled mixer with Clip and SourceDataLine lines that play through the Haiku media server. Both use libhaikupeer (native/jni/haiku-peer, -lbe -ltracker -lmedia -ltranslation). configure --enable-haiku-peer builds them; it is on by default when the host is Haiku, and it then makes HaikuToolkit the default toolkit and registers the mixer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: duncanmcqueen <dwmcqueen@gmail.com>
On Kaffe's interpreter, per-pixel Java code is very slow. Draw the common cases natively, directly in the int[] pixels of the image: rectangles, 1-pixel lines, any path (curves flattened, both winding rules, with or without anti-aliasing), thin outlines as 1-pixel lines, solid colours and linear gradients, images through any affine transform (nearest neighbour or bilinear), and copyArea. Other cases (clips that are not rectangles, texture paints, other composite rules) use the Java code of AbstractGraphics2D as before. Measured on Kaffe (microseconds per operation, before / after): fillRect 100x100 1065 / 30, fillOval 7350 / 650, line of width 4 42100 / 310, gradient fill 160600 / 250, translucent image 16730 / 170, scaled image 327720 / 580, rotated image 2965950 / 200, copyArea 207620 / 60. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: duncanmcqueen <dwmcqueen@gmail.com>
5ec6e0a to
8e0ffa5
Compare
Summary
This pull request adds an AWT toolkit and a sound mixer for Haiku. It needs the Haiku host fix #74 (#73 and #75 are merged). This branch is on the current
masterand contains the commit of #74 first, so that it builds on Haiku. When #74 is merged, I will rebase it, and only the two Haiku peer commits will stay.gnu.java.awt.peer.swing). Haiku's font engine measures and draws the text, so the text looks like the text of other Haiku applications.javax.sound.sampledmixer. It hasClipandSourceDataLinelines that play through the Haiku media server.libhaikupeer(C++, links with-lbe -ltracker -lmedia -ltranslation).include/Makefile.ammakes its JNI headers.--enable-haiku-peer. It is on by default when the host is Haiku. ThenHaikuToolkitis the default toolkit and the Haiku mixer is in theMixerProviderlist. On other hosts nothing changes.Some parts work fully only with the fixes in the related pull requests: drag and drop (#69, #70, #71, #72; with #72, the peer limits the drop action to the target actions),
Frame.setState()(#66),PrinterJob(#67; for Haiku printing, give-Djava.awt.printerjob=gnu.java.awt.peer.haiku.HaikuPrinterJob),canDisplay()(#68), and the build fixes (#62, #63, #64). With Kaffe, a Kaffe fix is necessary for any program to start: Kaffe must make the mainThreadobject with theThread(VMThread, String, int, boolean)constructor (see #65; the fix is in duncanmcqueen/kaffe and in BeKaffepatches/kaffe/0004).Tests
On Haiku R1/beta6 x86_64 with Kaffe 1.1.10 (interpreter): AWT widget tests, Swing, the JDK 1.0/1.1 demo applets, the clipboard in both directions with other applications, drag and drop with the file manager and a text editor, printing to the Haiku "Preview" printer, simulated input method sessions, sound clips and streams (timing checked), and modal dialogs. I built this branch alone on Haiku; it builds. I tested the programs above with all five pull requests together.
The project page has screenshots: https://duncanmcqueen.github.io/bekaffe/
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 have a
Signed-off-byline from the owner.🤖 Generated with Claude Code