Hacking the Java TightVNC client

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Hacking the Java TightVNC client

Tim Boudreau
Hi,

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 :-)

Best regards,

Tim Boudreau
Senior Staff Engineer
Sun Microsystems
http://weblogs.java.net/blog/timboudreau/
Reply | Threaded
Open this post in threaded view
|

Re: Hacking the Java TightVNC client

Bob Friesenhahn
On Tue, 11 Nov 2008, Tim Boudreau wrote:

>
> 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:

Not seeing any response posts since your own, I must say that this
work sounds really cool and quite useful.  By all means, post your
patches so that they can be re-used by the various VNC incantations.

Bob
======================================
Bob Friesenhahn
[hidden email], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
VNC-Tight-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vnc-tight-devel
Reply | Threaded
Open this post in threaded view
|

Re: Hacking the Java TightVNC client

ttw+vnc
In reply to this post by Tim Boudreau
tim,

On 11.11-22:21, Tim Boudreau wrote:
[ ... ]
> 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.

sounds like good stuff.  i started a similar project to get SSL
support integrated but as there was a requirement for 1.2 support or
something crazy i dropped it.  i'd certainaly be interested in the
patches and i may look at putting the SSL stuff back into your code,
although i'm not conversant in netbeans so may be too much to tangle
with right now.

>        [ ... ]  In all my years of AWT/Swing programming, finally
> an app that actually has a legitimate use for the browser-style
> ImageObserver pattern :-)

one of the main problems with java, of course, is that that's true
for about 50% of the stuff in there.
        :-(

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
VNC-Tight-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vnc-tight-devel
Reply | Threaded
Open this post in threaded view
|

Re: Hacking the Java TightVNC client

peppeska
In reply to this post by Tim Boudreau
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tim Boudreau ha scritto:
> Hi,
>
> I spent the weekend hacking to death the source code for the TightVNC Java
> client, with a couple of goals:

[CUT]

I take this opportunity to recall that there is an interface, not
official, written in python and GTK for Linux!

The web url is: http://py-tightvnc.sourceforge.net/


P.S.
The gui and 'created by myself and my friend!


- --
<<<<---------------------------------------------------------->>>>
|Giuseppe Moscato aka peppeska - Linux User - no html messages---|
|[hidden email] --------- http://peppeska.altervista.org------|
|Fingerprint = 90DC 05A8 2D65 BC04 BD1B  4C07 C389 434B 3201 319D|
<<<<---------------------------------------------------------->>>>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJHD/ukA6hcnFZI/YRAojzAKCgKoggxqU8VKFUGmISs6fDcBEaQACcDAFS
1oc0gJ2mgEMhafcSU7+Gs14=
=bOKE
-----END PGP SIGNATURE-----

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
VNC-Tight-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vnc-tight-devel
Reply | Threaded
Open this post in threaded view
|

Re: Hacking the Java TightVNC client

Tim Boudreau
In reply to this post by Bob Friesenhahn
On Wed, 2008-11-12 at 11:12 -0600, Bob Friesenhahn wrote:

> On Tue, 11 Nov 2008, Tim Boudreau wrote:
> >
> > 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:
>
> Not seeing any response posts since your own, I must say that this
> work sounds really cool and quite useful.  By all means, post your
> patches so that they can be re-used by the various VNC incantations.

Okay, I've attached both a zip of the repackaged sources and a diff to
https://sourceforge.net/tracker/index.php?func=detail&aid=2307956&group_id=14067&atid=314067

At the most basic level, you can now implement a couple of interfaces
and create a factory for a VNC canvas with settings, host, port, etc.
that you provide.  The sources are also fully internationalized, and a
bunch of other stuff.

It would be great if the project is interested in incorporating this
stuff, as I'd much rather build the netbeans modules from the official
version than a fork of it.  I'll have those up on
http://plugins.netbeans.org shortly.

Best regards,

Tim


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
VNC-Tight-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vnc-tight-devel
Reply | Threaded
Open this post in threaded view
|

Re: Hacking the Java TightVNC client

Constantin Kaplinsky
In reply to this post by Tim Boudreau
Hello Tim,

>>>>> Tim Boudreau wrote:

> 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.

Yes, the changes look good, and I'll be happy to apply them to the
TightVNC code base. I believe this is the right direction of the Java
viewer development. However, there is a number of things we should care
about.

  1. There was some development on the Java viewer since the latest
     released version, but the patches seem to be based on the release.
     The latest source can be found in svn, at this URL:

https://vnc-tight.svn.sourceforge.net/svnroot/vnc-tight/trunk/java/src/com/tightvnc/vncviewer

     In the latest version, everything is grouped in packages already.
     However, the package name is com.tightvnc.vncviewer, not
     com.tightvnc.

  2. Everything that works in current version should continue to work.
     Notably, the "Scaling Factor" parameter should be preserved. The
     same applies to every other parameter. If something really should
     be dropped, such decision should be well-grounded and the fact
     should be documented.

  3. The README file should be kept up-to-date. Most importantly, each
     applet/app parameter should be well-documented.

  4. I believe we should make our best to apply changes to svn
     incrementally, committing many small logically consistent changes,
     with no revolutions.

If you agree to the above, we'll make a new svn branch and I'll
configure svn write access for you.

> 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.

No problem, TightVNC distribution is always appreciated. The primary
requirement is that if changes were made, that fact should be clearly
indicated.

By the way, how TightVNC Viewer can be a plugin for NetBeans? Would it
just start the viewer from NetBeans and show the remote desktop in a
window?

> 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.

Well, probably it's time to forget Java 1.1.

> In all my years of AWT/Swing programming, finally an app that
> actually has a legitimate use for the browser-style ImageObserver
> pattern :-)

I remember how I hated that ImageObserver. In TightVNC Viewer, it only
complicated JPEG decoding.

--
With Best Wishes,
Constantin

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
VNC-Tight-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/vnc-tight-devel
Reply | Threaded
Open this post in threaded view
|

Re: Hacking the Java TightVNC client

Tim Boudreau
Constantin Kaplinsky wrote
Hello Tim,
> Is anyone interested in such patches?  I'd be happy to contribute
> them back to the project.
Sorry for the long delay on getting back to this.

The main issue I'm having is too much work in my day job to spend time integrating this stuff, but I'll try to make some time.

Constantin Kaplinsky wrote
Yes, the changes look good, and I'll be happy to apply them to the
TightVNC code base. I believe this is the right direction of the Java
viewer development. However, there is a number of things we should care
about.

  1. There was some development on the Java viewer since the latest
     released version, but the patches seem to be based on the release.
     The latest source can be found in svn, at this URL:

https://vnc-tight.svn.sourceforge.net/svnroot/vnc-tight/trunk/java/src/com/tightvnc/vncviewer
Definitely worth integrating any changes.

Constantin Kaplinsky wrote
     In the latest version, everything is grouped in packages already.
     However, the package name is com.tightvnc.vncviewer, not
     com.tightvnc.

  2. Everything that works in current version should continue to work.
     Notably, the "Scaling Factor" parameter should be preserved. The
     same applies to every other parameter. If something really should
     be dropped, such decision should be well-grounded and the fact
     should be documented.
I'm curious about the thinking behind scaling factor - i.e., since this can be done probably more efficiently at the level of the Graphic2D, why would the code responsible for communicating with the server want to know about how a user interface is representing the data?  Is there any server protocol for actually specifying the user interface size, such that less data could be sent back and forth?

Constantin Kaplinsky wrote
  3. The README file should be kept up-to-date. Most importantly, each
     applet/app parameter should be well-documented.

  4. I believe we should make our best to apply changes to svn
     incrementally, committing many small logically consistent changes,
     with no revolutions.
I agree in spirit, but I'm not sure how you'd tease apart the protocol handling code from the UI without a pretty large changeset.

Constantin Kaplinsky wrote
If you agree to the above, we'll make a new svn branch and I'll
configure svn write access for you.

> 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.

No problem, TightVNC distribution is always appreciated. The primary
requirement is that if changes were made, that fact should be clearly
indicated.
http://plugins.netbeans.org/PluginPortal/faces/PluginListPage.jsp?search=vnc - it clearly indicates that the library wrapper is a patched version of TightVNC - let me know if you want any changes.

Constantin Kaplinsky wrote
By the way, how TightVNC Viewer can be a plugin for NetBeans? Would it
just start the viewer from NetBeans and show the remote desktop in a
window?
Sort of.  That is, it's considered fairly bad behavior for a NetBeans plug-in to open its own top-level window - or at least a sign that someone didn't really go very far in their integration.  It embeds the VNC viewer in an editor tab, just like those you use to edit files, and scales it appropriately.  It adds a New VNC Connection menu item, and a node to the Services tab, which shows persisted data about previous connections and allows you to reconnect.

Constantin Kaplinsky wrote
> 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.

Well, probably it's time to forget Java 1.1.

> In all my years of AWT/Swing programming, finally an app that
> actually has a legitimate use for the browser-style ImageObserver
> pattern :-)

I remember how I hated that ImageObserver. In TightVNC Viewer, it only
complicated JPEG decoding.
Some interesting notes on image optimization and the negative impact ImageObserver on performance - I wonder if this affects TightVNC:

http://javagraphics.blogspot.com/2007/04/managed-images.html

Anyway, I'll try to find some time to get this stuff integrated, if you want to set me up with commit access and a branch in SVN.  No promises about when, but I don't want to just dump a bunch of patches on you and not help.

-Tim