[gtk-vnc-devel] [patch] - control over shared_flag



Hi, folks.

Currently gtk-vnc sends shared_flag always as Off, thus disconnecting
other connected clients.

In this patch I created a new function, to let the app decide when share
the connection or not. By default it's Off, just like nowadays.

Ok to commit?

Thanks,
-- 
Jonh Wendell
www.bani.com.br

diff -r e1b964facd65 src/libgtk-vnc_sym.version
--- a/src/libgtk-vnc_sym.version	Sun Apr 27 11:57:42 2008 -0300
+++ b/src/libgtk-vnc_sym.version	Tue Apr 29 13:53:18 2008 -0300
@@ -42,6 +42,9 @@
     vnc_display_set_scaling;
     vnc_display_get_scaling;
 
+    vnc_display_set_shared_flag;
+    vnc_display_get_shared_flag;
+
     vnc_display_force_grab;
     vnc_display_is_pointer_absolute;
 
diff -r e1b964facd65 src/vncdisplay.c
--- a/src/vncdisplay.c	Sun Apr 27 11:57:42 2008 -0300
+++ b/src/vncdisplay.c	Tue Apr 29 13:53:18 2008 -0300
@@ -81,6 +81,7 @@ struct _VncDisplayPrivate
 	gboolean read_only;
 	gboolean allow_lossy;
 	gboolean allow_scaling;
+	gboolean shared_flag;
 
 	GSList *preferable_auths;
 };
@@ -121,7 +122,8 @@ enum
   PROP_HEIGHT,
   PROP_NAME,
   PROP_LOSSY_ENCODING,
-  PROP_SCALING
+  PROP_SCALING,
+  PROP_SHARED_FLAG
 };
 
 /* Signals */
@@ -198,6 +200,9 @@ vnc_display_get_property (GObject    *ob
       case PROP_SCALING:
         g_value_set_boolean (value, vnc->priv->allow_scaling);
 	break;
+      case PROP_SHARED_FLAG:
+        g_value_set_boolean (value, vnc->priv->shared_flag);
+	break;
       default:
 	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 	break;			
@@ -231,6 +236,9 @@ vnc_display_set_property (GObject      *
         break;
       case PROP_SCALING:
         vnc_display_set_scaling (vnc, g_value_get_boolean (value));
+        break;
+      case PROP_SHARED_FLAG:
+        vnc_display_set_shared_flag (vnc, g_value_get_boolean (value));
         break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -1517,7 +1525,7 @@ static void *vnc_coroutine(void *opaque)
 	emit_signal_delayed(obj, VNC_CONNECTED, &s);
 
 	GVNC_DEBUG("Protocol initialization\n");
-	if (!gvnc_initialize(priv->gvnc, FALSE))
+	if (!gvnc_initialize(priv->gvnc, priv->shared_flag))
 		goto cleanup;
 
 	emit_signal_delayed(obj, VNC_INITIALIZED, &s);
@@ -1880,6 +1888,17 @@ static void vnc_display_class_init(VncDi
 								G_PARAM_STATIC_NAME |
 								G_PARAM_STATIC_NICK |
 								G_PARAM_STATIC_BLURB));
+	g_object_class_install_property (object_class,
+					 PROP_SHARED_FLAG,
+					 g_param_spec_boolean ( "shared-flag",
+								"Shared Flag",
+								"Whether we should leave other clients connected to the server",
+								FALSE,
+								G_PARAM_READWRITE |
+								G_PARAM_CONSTRUCT |
+								G_PARAM_STATIC_NAME |
+								G_PARAM_STATIC_NICK |
+								G_PARAM_STATIC_BLURB));
 
 	signalCredParam = g_param_spec_enum("credential",
 					    "credential",
@@ -2095,6 +2114,7 @@ static void vnc_display_init(VncDisplay 
 	priv->grab_pointer = FALSE;
 	priv->grab_keyboard = FALSE;
 	priv->local_pointer = FALSE;
+	priv->shared_flag = FALSE;
 
 	priv->preferable_auths = g_slist_append (priv->preferable_auths, GUINT_TO_POINTER (GVNC_AUTH_VENCRYPT));
 	priv->preferable_auths = g_slist_append (priv->preferable_auths, GUINT_TO_POINTER (GVNC_AUTH_TLS));
@@ -2319,6 +2339,12 @@ void vnc_display_set_lossy_encoding(VncD
 	obj->priv->allow_lossy = enable;
 }
 
+void vnc_display_set_shared_flag(VncDisplay *obj, gboolean shared)
+{
+	g_return_if_fail (VNC_IS_DISPLAY (obj));
+	obj->priv->shared_flag = shared;
+}
+
 #if WITH_GTKGLEXT
 gboolean vnc_display_set_scaling(VncDisplay *obj, gboolean enable)
 {
@@ -2358,6 +2384,13 @@ gboolean vnc_display_get_lossy_encoding(
 	g_return_val_if_fail (VNC_IS_DISPLAY (obj), FALSE);
 
 	return obj->priv->allow_lossy;
+}
+
+gboolean vnc_display_get_shared_flag(VncDisplay *obj)
+{
+	g_return_val_if_fail (VNC_IS_DISPLAY (obj), FALSE);
+
+	return obj->priv->shared_flag;
 }
 
 gboolean vnc_display_get_pointer_local(VncDisplay *obj)
diff -r e1b964facd65 src/vncdisplay.h
--- a/src/vncdisplay.h	Sun Apr 27 11:57:42 2008 -0300
+++ b/src/vncdisplay.h	Tue Apr 29 13:53:18 2008 -0300
@@ -116,6 +116,9 @@ gboolean	vnc_display_set_scaling(VncDisp
 gboolean	vnc_display_set_scaling(VncDisplay *obj, gboolean enable);
 gboolean	vnc_display_get_scaling(VncDisplay *obj);
 
+void		vnc_display_set_shared_flag(VncDisplay *obj, gboolean shared);
+gboolean	vnc_display_get_shared_flag(VncDisplay *obj);
+
 void		vnc_display_force_grab(VncDisplay *obj, gboolean enable);
 
 gboolean	vnc_display_is_pointer_absolute(VncDisplay *obj);


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