de4f43d bug fixes: refresh on insets change, do not layout empty GridLayout, correct BevelBorder size, apply EDGE_SPACING to TitleBorder
~phlash pushed to ~phlash/swingland git
Yes, I'm completely mad.
Yes, I know about Wakefield, and Caciocavallo, both have been in progress(ish) for years... nothing has arrived in mainline JDK to fix the internal JDK bugs that prevent a proper Wayland AWT Toolkit. There is a horrid fix in Caciocavallo which uses reflection to monkey about inside the JDK, and needs many command line switches to circumvent security controls...
Yes, I know about XWayland - it's horribly broken for Swing applications (try one!) and is intended as a stop gap, not a long term solution.
By re-using the interfaces of Swing, and providing completely new implementations that lean on Wayland and maybe a component toolkit..
Presently, we build a new module / package com.ashbysoft.swingland
, so client code will have to adjust imports to use us - this is by design
and also avoids horrible pain in replacing a system module (java.desktop
) which is apparantly impossible without rebuilding the whole JDK.. (but see the loading wrapper below!)
I've chosen to use Ant as it provides just enough build tooling, is self contained, plus I know how to drive it. NB: I use my own logger library as a git submodule - if your build fails, you probably skipped step 0 below :)
Build/clean:
% git submodule update --init --recursive
% ant [clean|compile|package (default)] [...]
.....
Test:
% ant [test-wayland|test-swingland|test-fed|test]
.....
where the test-wayland
target directly creates a Wayland window on screen, fills it with random dots for a few seconds and terminates.
The test-swingland
target runs a Swing GUI application that extends a JComponent
and draws stuff in the paintComponent()
method.
It has a working menu bar that demonstrates the popup windows and menuing logic, you can exit via it! test-swingland
also demonstrates
a couple of pop up JDialog
s (Swing flavour), one with some JLabel
s and JButton
s in a JSplitPane
, one with a JTabbedPane
.
test-fed
runs my font editor program with the default cursor font loaded... more to come as I write it!
The test
target runs all tests. All tests save an INFO
level log to the bin
folder.
If you set (export) the environment variable SWINGLAND_FAIL_ON_UNKNOWN_EVENTS
(any value will do), then the event pump will terminate
with an error should an unknown Wayland event arrive. Without this set (default) the error is reported but does not terminate the event loop.
This was a fun thing to create, initially as a means to load applets, then re-worked as a generic
wrapper for existing binary Swing applications. It is now possible to run an unmodified Java Swing application from it's JAR file using the
Swingland wrapper (it's also the default Main-Class in swingland.jar
):
% java -jar <path to/>swingland.jar <target application jar> <target application arguments>
I have now reverted my own applications (see below) to compile against standard Swing, thus they work as before on X11/Windows/MacOS, then under Wayland I simply wrap them as above. Neat!
test.jar
)I have started importing some of the standard Swing demos as additional test applications, they should work largely unaltered apart from import statements..
Run one:
% java -cp bin/test.jar com.ashbysoft.test.[TopLevelDemo|ButtonDemo]
fed.jar
)Font EDitor is a dogfooding application written with swingland
to edit bitmap font files (res/fonts
and res/cursors
) used by swingland
..
Run it:
% java -jar bin/fed.jar -f <font file> [--help]
test.jar
)FontTest was written to test both the PCF font support and font transformations (ie: rotation), run it:
% java -cp bin/test.jar [--help] [-r] <font name> [...]
where -r
rotates the specified fonts instead of simply printing a line of each, font name
can be one of: a logical name eg: MONOSPACED
;
a resource path in the swingland.jar
file for built-in bitmap fonts eg: /cursors/CURLY
; a file path for PCF fonts, either absolute or
relative to paths in XDG_DATA_DIRS
(by default: /usr/local/share:/usr/share
), eg: /path/to/font.pcf
, X11/fonts/misc/10x20.pcf.gz
.
I originally ported my own applications to Swingland, however I have now reverted to standard Swing as I have a loader (see above):
See LICENCE.md