Re: [gtk-vnc-devel] patch to allow use with OS X Screen Sharing



Em Ter, 2008-04-01 às 20:24 +0100, Daniel P. Berrange escreveu:
> On Tue, Apr 01, 2008 at 03:58:25PM -0300, Jonh Wendell wrote:
> > Em Ter, 2008-04-01 às 09:24 -0300, Jonh Wendell escreveu:
> > 
> > > > It seems AppleVNCServer advertises RFB 003.889, which would indicate 
> > > > that it speaks RFB 3.8, but really only speaks some variant of RFB 3.3.
> > 
> > Hi, folks. There's a bug around[1] complaining that vinagre doesn't
> > support RFB "004.000". Can I also workaround this to make it work as
> > 003.003?
> > 
> > [1]-https://bugs.launchpad.net/ubuntu/+source/vinagre/+bug/206227
> 
> That bug claims xvnc4viewer supports the AdderLink server, so I looked at
> their client code. They don't have an explicit workaround for this server.
> Their logic is simply:
> 
>    if version < 3.3
>         close the connection
>    else if  version >= 3.3 and < 3.8
>         use version 3.3
>    else if version >= 3.8
>         use version 3.8
> 
> So the last branch handles the 4.0 version number by pretending it is
> version 3.8
> 
> Dan

With this patch gtk-vnc works just like xvncviewer, as Dan has commented
above.

The side effect of this (which I agree here) is that for the
weird AppleVNCServer, we are going to do a 3.8 negotiation.

Comments?
-- 
Jonh Wendell
www.bani.com.br

diff -r e40d5019d77e src/gvnc.c
--- a/src/gvnc.c	Tue Apr 01 09:13:56 2008 -0300
+++ b/src/gvnc.c	Tue Apr 01 19:25:16 2008 -0300
@@ -2706,6 +2706,13 @@ gboolean gvnc_is_initialized(struct gvnc
 	return FALSE;
 }
 
+static gboolean gvnc_before_version (struct gvnc *gvnc, int major, int minor) {
+	return (gvnc->major < major) || (gvnc->major == major && gvnc->minor < minor);
+}
+static gboolean gvnc_after_version (struct gvnc *gvnc, int major, int minor) {
+	return !gvnc_before_version (gvnc, major, minor+1);
+}
+
 gboolean gvnc_initialize(struct gvnc *gvnc, gboolean shared_flag)
 {
 	int ret, i;
@@ -2725,21 +2732,14 @@ gboolean gvnc_initialize(struct gvnc *gv
 
 	GVNC_DEBUG("Server version: %d.%d\n", gvnc->major, gvnc->minor);
 
-	/* For UltraVNC */
-	if  (gvnc->minor > 3 && gvnc->minor < 7)
+	if (gvnc_before_version(gvnc, 3, 3)) {
+		GVNC_DEBUG("Server version is not supported (%d.%d)\n", gvnc->major, gvnc->minor);
+		goto fail;
+	} else if (gvnc_before_version(gvnc, 3, 7)) {
 		gvnc->minor = 3;
-
-	/* For AppleVNCServer */
-	if (gvnc->minor == 889)
-		gvnc->minor = 3;
-
-	if (gvnc->major != 3) {
-		GVNC_DEBUG("Major server version not supported (%d)\n", gvnc->major);
-		goto fail;
-	}
-	if (gvnc->minor < 3 || gvnc->minor > 8) {
-		GVNC_DEBUG("Server version not supported (%d.%d)\n", gvnc->major, gvnc->minor);
-		goto fail;
+	} else if (gvnc_after_version(gvnc, 3, 8)) {
+		gvnc->major = 3;
+		gvnc->minor = 8;
 	}
 
 	snprintf(version, 12, "RFB %03d.%03d\n", gvnc->major, gvnc->minor);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]