Xlib AWT peers and Java 2D
Rolf W. Rasmussen
rolfwr@ii.uib.no
Sat Oct 7 14:07:00 GMT 2000
I've been working a bit on merging in my X based AWT toolkit. I would
like to settle some issues before creating the new directories in the
CVS tree and producing a proper CVS diff for the java-patches list. A
screenshot can be found at
<URL: http://www.ii.uib.no/~rolfwr/jcnix/xlib-awt.png >.
The patch merges in the following parts from my own code base:
The CNI based Xlib classes:
An OO Java interface to Xlib. This is where all the all the Xlib
native code is located. As with X, this package gives access to
mechanism, but does not dictate policy. This package has no
significant outward dependencies and can be used by anyone to
create X based clients.
The X based AWT peer toolkit:
An AWT toolkit for the X Window System. This is a specific
implementation of java.awt.Toolkit and the component peer
classes. This implementation uses the CNI based Xlib classes to
create an AWT toolkit that works under the X Window System. All
code in this package is pure Java. It also depends on some code
from the gnu.awt package to implement general AWT mechanisms that
are hidden behind the scenes of the AWT API.
The Java 2D graphics pipeline classes:
Contains code to help implementing the Java2D rendering model. The
code is pure Java and is not toolkit specific. It is currently
only used by the X based AWT peer toolkit, but can be used by any
toolkit implementation that wishes to implement the Java2D
rendering model. The code in this package is currently very
immature. I've made available some (incomplete) notes on the
design of the pipeline at <URL: http://www.ii.uib.no/~rolfwr/jcnix/
pipeline.html>
I've stubbed out dependencies on other parts of my codebase, which
means that operations such as image loading will currently not work,
and image operations will use the slow fall-back implementations in the
java.awt.image classes. (And I do mean SLOW!)
I'm a bit unsure whether the current package naming scheme is
satisfactory. Suggestions on moving classes between packages is
appreciated. I'm currently distributing the classes between the
package in the following manner:
gnu.gcj.xlib: The CNI based Xlib classes.
gnu.awt.xlib: The X based AWT peer toolkit.
gnu.awt.j2d: The Java 2D graphics pipeline classes.
gnu.awt: Misc. support classes I envision would be useful for any
AWT toolkit implementation.
I've made some Makefile.am and configure.in changes that seem to be
working, but are probably horribly wrong. Someone with more
experience with these things should probably take a look at it. Tom?
The current patch will build the Xlib dependent code into a separate
library named libgcjx.so. Is this a good idea? The alternative;
making libgcj.so dependent on Xlib, seems like a poor solution.
And finally, the current patch does not enable any components such as
buttons, labels or list, only basic components such as windows,
frames, canvases and panels. This is because Xlib doesn't have any
native widget set. I'm currently working on implementing portions of
the Swing API, and then implementing the AWT components by redirecting
requests to Swing components. However, I'm unsure how to proceed with
this, since Per Bothner has on multiple occasions suggested an
alternate plan for implementing Swing. It doesn't make much sense to
implement the X toolkit AWT components using the Swing components, if
the Swing components are based on the GTK components.
This raises an interesting issue concerning the plan to implement the
Swing components using GTK. The redirecting I'm doing is fully based
on the public API of Swing. Thus would be reasonable to assume that it
would work on any implementation of Swing. However, I'm having
difficulty seeing how an GTK based Swing could be implemented without
seriously altering the underlying assumptions on how the painting
mechanism works. The glue between the Swing API would both need to
translate Java API paint() requests to GTK requests, and enable the
GTK painting routines to invoke methods on Java objects to render
extendable portions of the GUI such as custom borders and cell
renderers. Another issue is how to map the open-ended data models for
JTree and JTable to the data models of their GTK equivalents.
- Rolf W.
2000-10-07 Rolf W. Rasmussen <rolfwr@ii.uib.no>
* Makefile.am: Added rules for libgcjx library.
* Makefile.in: Rebuilt.
* configure.in: Added check for X.
* configure: Rebuilt.
* gnu/awt/LightweightRedirector.java: New file.
* gnu/awt/j2d/AbstractGraphicsState.java: New file.
* gnu/awt/j2d/DirectRasterGraphics.java: New file.
* gnu/awt/j2d/Graphics2DImpl.java: New file.
* gnu/awt/j2d/IntegerGraphicsState.java: New file.
*ÃÂ gnu/awt/j2d/MappedRaster.java: New file.
* gnu/awt/xlib/XCanvasPeer.java: New file.
* gnu/awt/xlib/XEventLoop.java: New file.
* gnu/awt/xlib/XEventQueue.java: New file.
* gnu/awt/xlib/XFontMetrics.java: New file.
* gnu/awt/xlib/XFramePeer.java: New file.
* gnu/awt/xlib/XGraphics.java: New file.
* gnu/awt/xlib/XGraphicsConfiguration.java: New file.
* gnu/awt/xlib/XPanelPeer.java: New file.
* gnu/awt/xlib/XToolkit.java: New file.
* gnu/gcj/xlib/Clip.java: New file.
* gnu/gcj/xlib/Colormap.java: New file.
* gnu/gcj/xlib/Display.java: New file.
* gnu/gcj/xlib/Drawable.java: New file.
* gnu/gcj/xlib/Font.java: New file.
* gnu/gcj/xlib/GC.java: New file.
* gnu/gcj/xlib/Pixmap.java: New file.
* gnu/gcj/xlib/Screen.java: New file.
* gnu/gcj/xlib/Visual.java: New file.
* gnu/gcj/xlib/WMSizeHints.java: New file.
* gnu/gcj/xlib/Window.java: New file.
* gnu/gcj/xlib/WindowAttributes.java: New file.
* gnu/gcj/xlib/XAnyEvent.java: New file.
* gnu/gcj/xlib/XButtonEvent.java: New file.
* gnu/gcj/xlib/XColor.java: New file.
* gnu/gcj/xlib/XConfigureEvent.java: New file.
* gnu/gcj/xlib/XConnectException.java: New file.
* gnu/gcj/xlib/XEvent.java: New file.
* gnu/gcj/xlib/XException.java: New file.
* gnu/gcj/xlib/XExposeEvent.java: New file.
* gnu/gcj/xlib/XID.java: New file.
* gnu/gcj/xlib/XImage.java: New file.
* gnu/gcj/xlib/XUnmapEvent.java: New file.
* gnu/gcj/xlib/natClip.cc: New file.
* gnu/gcj/xlib/natColormap.cc: New file.
* gnu/gcj/xlib/natDisplay.cc: New file.
* gnu/gcj/xlib/natDrawable.cc: New file.
* gnu/gcj/xlib/natFont.cc: New file.
* gnu/gcj/xlib/natGC.cc: New file.
* gnu/gcj/xlib/natPixmap.cc: New file.
* gnu/gcj/xlib/natScreen.cc: New file.
* gnu/gcj/xlib/natVisual.cc: New file.
* gnu/gcj/xlib/natWMSizeHints.cc: New file.
* gnu/gcj/xlib/natWindow.cc: New file.
* gnu/gcj/xlib/natWindowAttributes.cc: New file.
* gnu/gcj/xlib/natXAnyEvent.cc: New file.
* gnu/gcj/xlib/natXButtonEvent.cc: New file.
* gnu/gcj/xlib/natXColor.cc: New file.
* gnu/gcj/xlib/natXConfigureEvent.cc: New file.
* gnu/gcj/xlib/natXException.cc: New file.
* gnu/gcj/xlib/natXExposeEvent.cc: New file.
* gnu/gcj/xlib/natXImage.cc: New file.
* gnu/gcj/xlib/natXUnmapEvent.cc: New file.
* java/awt/EventDispatchThread.java: Start thead on creation.
More information about the Java-patches
mailing list