I spent the weekend hacking to death the source code for the TightVNC Java client, with a couple of goals:
- Make it usable as a library for anyone who wants to embed a VNC client in a Java app
- Create a NetBeans VNC client plugin
So, I have a bunch of patches to the sources (some cleanup still needed), and a fairly slick integration with NetBeans in progress.
Is anyone interested in such patches? I'd be happy to contribute them back to the project. Here are the main things I did:
- Untangle the UI from the protocol-handling stuff. I.e. I wanted something where I could call
someComponent.add (new VncViewer (host, port, ...).getComponent()). So, basically I carved VncCanvas into separate UI and protocol pieces.
- Create an API for settings and so forth so I can supply my own with their own UI
- Use Swing instead of AWT (i.e. no heavyweight component problems)
- Moved everything into the com.tightvnc package - module systems such as NetBeans or Eclipse do not tolerate use of the default package
- Build with Ant instead of Make
- Removed the "scale" feature that has no UI, and added a "scale to fit" option that scales the remote desktop to whichever dimension is optimal in the client component (scaling is done in the client paint loop; the framebuffer size is the size of the remote desktop)
I'd also like to ask if anybody minds if I publish the resulting NetBeans plugins on http://plugins.netbeans.org so other users can try them. That means publishing a patched version of TightVNC - I'm happy to make sure credit goes where it is due (or not mention it by name if you think it would make TightVNC look bad or be less appealing to people). Let me know what you'd be comfortable with.
I'll note that these patches (certainly those that use generics) will render the result incompatible with JDK 1.1, which the code appears to be trying to keep compatibility with. In all my years of AWT/Swing programming, finally an app that actually has a legitimate use for the browser-style ImageObserver pattern :-)