[virt-tools-list] [PATCH virt-viewer 1/3] display: add can-auto-resize property

Jonathon Jongsma jjongsma at redhat.com
Wed Mar 12 16:50:38 UTC 2014


Can we rename this to a more generic name such as 'can-resize-guest' or 'can-resize-remote-display'?  The only thing that makes it 'auto' is the way it is used by VirtViewerWindow.  At the VirtViewerDisplay level, there's nothing 'automatic' about it.



----- Original Message -----
> From: "Marc-André Lureau" <marcandre.lureau at gmail.com>
> To: virt-tools-list at redhat.com
> Sent: Wednesday, March 12, 2014 11:42:02 AM
> Subject: [virt-tools-list] [PATCH virt-viewer 1/3] display: add	can-auto-resize property
> 
> Add a property to tell whether the guest will auto-resize. Default to FALSE
> ---
>  src/virt-viewer-display.c | 25 +++++++++++++++++++++++++
>  src/virt-viewer-display.h |  2 ++
>  2 files changed, 27 insertions(+)
> 
> diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
> index feefcca..ace124a 100644
> --- a/src/virt-viewer-display.c
> +++ b/src/virt-viewer-display.c
> @@ -90,6 +90,7 @@ enum {
>      PROP_SESSION,
>      PROP_SELECTABLE,
>      PROP_MONITOR,
> +    PROP_CAN_AUTO_RESIZE,
>  };
>  
>  static void
> @@ -205,6 +206,14 @@ virt_viewer_display_class_init(VirtViewerDisplayClass
> *class)
>                                                           FALSE,
>                                                           G_PARAM_READABLE));
>  
> +    g_object_class_install_property(object_class,
> +                                    PROP_CAN_AUTO_RESIZE,
> +                                    g_param_spec_boolean("can-auto-resize",
> +                                                         "Can auto-resize",
> +                                                         "Can resize
> automatically remote desktop",
> +                                                         FALSE,
> +                                                         G_PARAM_READABLE));
> +
>      g_signal_new("display-pointer-grab",
>                   G_OBJECT_CLASS_TYPE(object_class),
>                   G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS,
> @@ -357,6 +366,9 @@ virt_viewer_display_get_property(GObject *object,
>      case PROP_SELECTABLE:
>          g_value_set_boolean(value,
>          virt_viewer_display_get_selectable(display));
>          break;
> +    case PROP_CAN_AUTO_RESIZE:
> +        g_value_set_boolean(value,
> virt_viewer_display_can_auto_resize(display));
> +        break;
>      case PROP_MONITOR:
>          g_value_set_int(value, priv->monitor);
>          break;
> @@ -831,6 +843,19 @@ void
> virt_viewer_display_get_preferred_monitor_geometry(VirtViewerDisplay* self,
>      }
>  }
>  
> +gboolean virt_viewer_display_can_auto_resize(VirtViewerDisplay *self)
> +{
> +    VirtViewerDisplayClass *klass;
> +
> +    g_return_val_if_fail(VIRT_VIEWER_IS_DISPLAY(self), FALSE);
> +
> +    klass = VIRT_VIEWER_DISPLAY_GET_CLASS(self);
> +    if (klass->can_auto_resize)
> +        return klass->can_auto_resize(self);
> +
> +    return FALSE;
> +}
> +
>  /*
>   * Local variables:
>   *  c-indent-level: 4
> diff --git a/src/virt-viewer-display.h b/src/virt-viewer-display.h
> index 195eeee..d425841 100644
> --- a/src/virt-viewer-display.h
> +++ b/src/virt-viewer-display.h
> @@ -79,6 +79,7 @@ struct _VirtViewerDisplayClass {
>  
>      void (*close)(VirtViewerDisplay *display);
>      gboolean (*selectable)(VirtViewerDisplay *display);
> +    gboolean (*can_auto_resize)(VirtViewerDisplay *display);
>  
>      /* signals */
>      void (*display_pointer_grab)(VirtViewerDisplay *display);
> @@ -128,6 +129,7 @@ gboolean
> virt_viewer_display_get_enabled(VirtViewerDisplay *display);
>  gboolean virt_viewer_display_get_selectable(VirtViewerDisplay *display);
>  void virt_viewer_display_queue_resize(VirtViewerDisplay *display);
>  void virt_viewer_display_get_preferred_monitor_geometry(VirtViewerDisplay
>  *self, GdkRectangle* preferred);
> +gboolean virt_viewer_display_can_auto_resize(VirtViewerDisplay *display);
>  
>  G_END_DECLS
>  
> --
> 1.8.5.3
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
> 




More information about the virt-tools-list mailing list