Re: [gtk-vnc-devel] Scaling down



Em Sex, 2008-06-27 às 11:57 -0300, Jonh Wendell escreveu:

Second try...

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

diff -r 6a869ca98aeb src/libgtk-vnc_sym.version
--- a/src/libgtk-vnc_sym.version	Thu Jun 05 14:11:20 2008 -0300
+++ b/src/libgtk-vnc_sym.version	Fri Jun 27 15:51:28 2008 -0300
@@ -50,6 +50,9 @@
 
     vnc_display_get_option_group;
 
+    vnc_display_set_force_size;
+    vnc_display_get_force_size;
+
   local:
       *;
 };
diff -r 6a869ca98aeb src/vncdisplay.c
--- a/src/vncdisplay.c	Thu Jun 05 14:11:20 2008 -0300
+++ b/src/vncdisplay.c	Fri Jun 27 15:51:29 2008 -0300
@@ -82,6 +82,7 @@ struct _VncDisplayPrivate
 	gboolean allow_lossy;
 	gboolean allow_scaling;
 	gboolean shared_flag;
+	gboolean force_size;
 
 	GSList *preferable_auths;
 };
@@ -123,7 +124,8 @@ enum
   PROP_NAME,
   PROP_LOSSY_ENCODING,
   PROP_SCALING,
-  PROP_SHARED_FLAG
+  PROP_SHARED_FLAG,
+  PROP_FORCE_SIZE
 };
 
 /* Signals */
@@ -203,6 +205,9 @@ vnc_display_get_property (GObject    *ob
       case PROP_SHARED_FLAG:
         g_value_set_boolean (value, vnc->priv->shared_flag);
 	break;
+      case PROP_FORCE_SIZE:
+        g_value_set_boolean (value, vnc->priv->force_size);
+	break;
       default:
 	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 	break;			
@@ -239,6 +244,9 @@ vnc_display_set_property (GObject      *
         break;
       case PROP_SHARED_FLAG:
         vnc_display_set_shared_flag (vnc, g_value_get_boolean (value));
+        break;
+      case PROP_FORCE_SIZE:
+        vnc_display_set_force_size (vnc, g_value_get_boolean (value));
         break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -892,7 +900,10 @@ static void setup_gdk_image(VncDisplay *
 	priv->fb.data = (uint8_t *)priv->image->mem;
 	priv->fb.byte_order = priv->image->byte_order == GDK_LSB_FIRST ? G_LITTLE_ENDIAN : G_BIG_ENDIAN;
 
-	gtk_widget_set_size_request(GTK_WIDGET(obj), width, height);
+	if (priv->force_size)
+		gtk_widget_set_size_request(GTK_WIDGET(obj), width, height);
+	else
+		gtk_widget_set_size_request(GTK_WIDGET(obj), 0, 0);
 }
 
 #if WITH_GTKGLEXT
@@ -1926,6 +1937,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_FORCE_SIZE,
+					 g_param_spec_boolean ( "force-size",
+								"Force widget size",
+								"Whether we should define the widget size",
+								TRUE,
+								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",
@@ -2142,6 +2164,7 @@ static void vnc_display_init(VncDisplay 
 	priv->grab_keyboard = FALSE;
 	priv->local_pointer = FALSE;
 	priv->shared_flag = FALSE;
+	priv->force_size = TRUE;
 
 	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));
@@ -2399,6 +2422,19 @@ gboolean vnc_display_set_scaling(VncDisp
 }
 #endif
 
+void vnc_display_set_force_size(VncDisplay *obj, gboolean enabled)
+{
+	g_return_if_fail (VNC_IS_DISPLAY (obj));
+	obj->priv->force_size = enabled;
+}
+
+gboolean vnc_display_get_force_size(VncDisplay *obj)
+{
+	g_return_val_if_fail (VNC_IS_DISPLAY (obj), FALSE);
+
+	return obj->priv->force_size;
+}
+
 gboolean vnc_display_get_scaling(VncDisplay *obj)
 {
 	g_return_val_if_fail (VNC_IS_DISPLAY (obj), FALSE);
diff -r 6a869ca98aeb src/vncdisplay.h
--- a/src/vncdisplay.h	Thu Jun 05 14:11:20 2008 -0300
+++ b/src/vncdisplay.h	Fri Jun 27 15:51:29 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_force_size(VncDisplay *obj, gboolean enable);
+gboolean	vnc_display_get_force_size(VncDisplay *obj);
+
 void		vnc_display_set_shared_flag(VncDisplay *obj, gboolean shared);
 gboolean	vnc_display_get_shared_flag(VncDisplay *obj);
 


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