summaryrefslogtreecommitdiff
path: root/src/virt-viewer-display.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/virt-viewer-display.c')
-rw-r--r--src/virt-viewer-display.c720
1 files changed, 360 insertions, 360 deletions
diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
index 7f821e5..22a4602 100644
--- a/src/virt-viewer-display.c
+++ b/src/virt-viewer-display.c
@@ -33,503 +33,503 @@
struct _VirtViewerDisplayPrivate
{
- gboolean dirty;
- guint desktopWidth;
- guint desktopHeight;
- guint zoom_level;
- gboolean zoom;
- gint nth_display;
- gint show_hint;
- gboolean maintain_aspect_ratio;
+ gboolean dirty;
+ guint desktopWidth;
+ guint desktopHeight;
+ guint zoom_level;
+ gboolean zoom;
+ gint nth_display;
+ gint show_hint;
+ gboolean maintain_aspect_ratio;
};
static void virt_viewer_display_size_request(GtkWidget *widget,
- GtkRequisition *requisition);
+ GtkRequisition *requisition);
#if GTK_CHECK_VERSION(3, 0, 0)
static void virt_viewer_display_get_preferred_width(GtkWidget *widget,
- int *minwidth,
- int *defwidth);
+ int *minwidth,
+ int *defwidth);
static void virt_viewer_display_get_preferred_height(GtkWidget *widget,
- int *minheight,
- int *defheight);
+ int *minheight,
+ int *defheight);
#endif
static void virt_viewer_display_size_allocate(GtkWidget *widget,
- GtkAllocation *allocation);
+ GtkAllocation *allocation);
static void virt_viewer_display_set_property(GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
static void virt_viewer_display_get_property(GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
static void virt_viewer_display_grab_focus(GtkWidget *widget);
G_DEFINE_ABSTRACT_TYPE(VirtViewerDisplay, virt_viewer_display, GTK_TYPE_BIN)
enum {
- PROP_0,
-
- PROP_DESKTOP_WIDTH,
- PROP_DESKTOP_HEIGHT,
- PROP_NTH_DISPLAY,
- PROP_ZOOM,
- PROP_ZOOM_LEVEL,
- PROP_SHOW_HINT,
+ PROP_0,
+
+ PROP_DESKTOP_WIDTH,
+ PROP_DESKTOP_HEIGHT,
+ PROP_NTH_DISPLAY,
+ PROP_ZOOM,
+ PROP_ZOOM_LEVEL,
+ PROP_SHOW_HINT,
};
static void
virt_viewer_display_class_init(VirtViewerDisplayClass *class)
{
- GObjectClass *object_class = G_OBJECT_CLASS(class);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(class);
+ GObjectClass *object_class = G_OBJECT_CLASS(class);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(class);
- object_class->set_property = virt_viewer_display_set_property;
- object_class->get_property = virt_viewer_display_get_property;
+ object_class->set_property = virt_viewer_display_set_property;
+ object_class->get_property = virt_viewer_display_get_property;
#if GTK_CHECK_VERSION(3, 0, 0)
- widget_class->get_preferred_width = virt_viewer_display_get_preferred_width;
- widget_class->get_preferred_height = virt_viewer_display_get_preferred_height;
+ widget_class->get_preferred_width = virt_viewer_display_get_preferred_width;
+ widget_class->get_preferred_height = virt_viewer_display_get_preferred_height;
#else
- widget_class->size_request = virt_viewer_display_size_request;
+ widget_class->size_request = virt_viewer_display_size_request;
#endif
- widget_class->size_allocate = virt_viewer_display_size_allocate;
- widget_class->grab_focus = virt_viewer_display_grab_focus;
-
- g_object_class_install_property(object_class,
- PROP_DESKTOP_WIDTH,
- g_param_spec_int("desktop-width",
- "Width",
- "Desktop width",
- 100,
- G_MAXINT32,
- 100,
- G_PARAM_READWRITE));
-
- g_object_class_install_property(object_class,
- PROP_DESKTOP_HEIGHT,
- g_param_spec_int("desktop-height",
- "Height",
- "Desktop height",
- 100,
- G_MAXINT32,
- 100,
- G_PARAM_READWRITE));
-
- g_object_class_install_property(object_class,
- PROP_ZOOM,
- g_param_spec_boolean("zoom",
- "Zoom",
- "Zoom",
- TRUE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property(object_class,
- PROP_ZOOM_LEVEL,
- g_param_spec_int("zoom-level",
- "Zoom",
- "Zoom level",
- 10,
- 400,
- 100,
- G_PARAM_READWRITE));
-
- g_object_class_install_property(object_class,
- PROP_NTH_DISPLAY,
- g_param_spec_int("nth-display",
- "Nth display",
- "Nth display",
- 0,
- G_MAXINT32,
- 0,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY));
-
- g_object_class_install_property(object_class,
- PROP_SHOW_HINT,
- g_param_spec_int("show-hint",
- "Show hint",
- "Show state hint",
- 0,
- G_MAXINT32,
- 0,
- G_PARAM_READABLE));
-
-
- g_signal_new("display-pointer-grab",
- G_OBJECT_CLASS_TYPE(object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS,
- G_STRUCT_OFFSET(VirtViewerDisplayClass, display_pointer_grab),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
-
- g_signal_new("display-pointer-ungrab",
- G_OBJECT_CLASS_TYPE(object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS,
- G_STRUCT_OFFSET(VirtViewerDisplayClass, display_pointer_ungrab),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
-
- g_signal_new("display-keyboard-grab",
- G_OBJECT_CLASS_TYPE(object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS,
- G_STRUCT_OFFSET(VirtViewerDisplayClass, display_keyboard_grab),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
-
- g_signal_new("display-keyboard-ungrab",
- G_OBJECT_CLASS_TYPE(object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS,
- G_STRUCT_OFFSET(VirtViewerDisplayClass, display_keyboard_ungrab),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
-
- g_signal_new("display-desktop-resize",
- G_OBJECT_CLASS_TYPE(object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS,
- G_STRUCT_OFFSET(VirtViewerDisplayClass, display_desktop_resize),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE,
- 0);
-
- g_type_class_add_private(class, sizeof(VirtViewerDisplayPrivate));
+ widget_class->size_allocate = virt_viewer_display_size_allocate;
+ widget_class->grab_focus = virt_viewer_display_grab_focus;
+
+ g_object_class_install_property(object_class,
+ PROP_DESKTOP_WIDTH,
+ g_param_spec_int("desktop-width",
+ "Width",
+ "Desktop width",
+ 100,
+ G_MAXINT32,
+ 100,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property(object_class,
+ PROP_DESKTOP_HEIGHT,
+ g_param_spec_int("desktop-height",
+ "Height",
+ "Desktop height",
+ 100,
+ G_MAXINT32,
+ 100,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property(object_class,
+ PROP_ZOOM,
+ g_param_spec_boolean("zoom",
+ "Zoom",
+ "Zoom",
+ TRUE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property(object_class,
+ PROP_ZOOM_LEVEL,
+ g_param_spec_int("zoom-level",
+ "Zoom",
+ "Zoom level",
+ 10,
+ 400,
+ 100,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property(object_class,
+ PROP_NTH_DISPLAY,
+ g_param_spec_int("nth-display",
+ "Nth display",
+ "Nth display",
+ 0,
+ G_MAXINT32,
+ 0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property(object_class,
+ PROP_SHOW_HINT,
+ g_param_spec_int("show-hint",
+ "Show hint",
+ "Show state hint",
+ 0,
+ G_MAXINT32,
+ 0,
+ G_PARAM_READABLE));
+
+
+ g_signal_new("display-pointer-grab",
+ G_OBJECT_CLASS_TYPE(object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS,
+ G_STRUCT_OFFSET(VirtViewerDisplayClass, display_pointer_grab),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
+ g_signal_new("display-pointer-ungrab",
+ G_OBJECT_CLASS_TYPE(object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS,
+ G_STRUCT_OFFSET(VirtViewerDisplayClass, display_pointer_ungrab),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
+ g_signal_new("display-keyboard-grab",
+ G_OBJECT_CLASS_TYPE(object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS,
+ G_STRUCT_OFFSET(VirtViewerDisplayClass, display_keyboard_grab),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
+ g_signal_new("display-keyboard-ungrab",
+ G_OBJECT_CLASS_TYPE(object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS,
+ G_STRUCT_OFFSET(VirtViewerDisplayClass, display_keyboard_ungrab),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
+ g_signal_new("display-desktop-resize",
+ G_OBJECT_CLASS_TYPE(object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS,
+ G_STRUCT_OFFSET(VirtViewerDisplayClass, display_desktop_resize),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+
+ g_type_class_add_private(class, sizeof(VirtViewerDisplayPrivate));
}
static void
virt_viewer_display_init(VirtViewerDisplay *display)
{
- gtk_widget_set_has_window(GTK_WIDGET(display), FALSE);
- gtk_widget_set_redraw_on_allocate(GTK_WIDGET(display), FALSE);
+ gtk_widget_set_has_window(GTK_WIDGET(display), FALSE);
+ gtk_widget_set_redraw_on_allocate(GTK_WIDGET(display), FALSE);
- display->priv = VIRT_VIEWER_DISPLAY_GET_PRIVATE(display);
+ display->priv = VIRT_VIEWER_DISPLAY_GET_PRIVATE(display);
- display->priv->desktopWidth = 100;
- display->priv->desktopHeight = 100;
- display->priv->zoom_level = 100;
- display->priv->zoom = TRUE;
- display->priv->dirty = TRUE;
- display->priv->maintain_aspect_ratio = TRUE;
+ display->priv->desktopWidth = 100;
+ display->priv->desktopHeight = 100;
+ display->priv->zoom_level = 100;
+ display->priv->zoom = TRUE;
+ display->priv->dirty = TRUE;
+ display->priv->maintain_aspect_ratio = TRUE;
}
GtkWidget*
virt_viewer_display_new(void)
{
- return g_object_new(VIRT_VIEWER_TYPE_DISPLAY, NULL);
+ return g_object_new(VIRT_VIEWER_TYPE_DISPLAY, NULL);
}
static void
virt_viewer_display_set_property(GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- VirtViewerDisplay *display = VIRT_VIEWER_DISPLAY(object);
- VirtViewerDisplayPrivate *priv = display->priv;
-
- switch (prop_id) {
- case PROP_DESKTOP_WIDTH:
- virt_viewer_display_set_desktop_size(display,
- g_value_get_int(value),
- priv->desktopHeight);
- break;
- case PROP_DESKTOP_HEIGHT:
- virt_viewer_display_set_desktop_size(display,
- priv->desktopWidth,
- g_value_get_int(value));
- break;
- case PROP_NTH_DISPLAY:
- priv->nth_display = g_value_get_int(value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
+ VirtViewerDisplay *display = VIRT_VIEWER_DISPLAY(object);
+ VirtViewerDisplayPrivate *priv = display->priv;
+
+ switch (prop_id) {
+ case PROP_DESKTOP_WIDTH:
+ virt_viewer_display_set_desktop_size(display,
+ g_value_get_int(value),
+ priv->desktopHeight);
+ break;
+ case PROP_DESKTOP_HEIGHT:
+ virt_viewer_display_set_desktop_size(display,
+ priv->desktopWidth,
+ g_value_get_int(value));
+ break;
+ case PROP_NTH_DISPLAY:
+ priv->nth_display = g_value_get_int(value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
}
static void
virt_viewer_display_get_property(GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- VirtViewerDisplay *display = VIRT_VIEWER_DISPLAY(object);
- VirtViewerDisplayPrivate *priv = display->priv;
-
- switch (prop_id) {
- case PROP_DESKTOP_WIDTH:
- g_value_set_int(value, priv->desktopWidth);
- break;
- case PROP_DESKTOP_HEIGHT:
- g_value_set_int(value, priv->desktopHeight);
- break;
- case PROP_NTH_DISPLAY:
- g_value_set_int(value, priv->nth_display);
- break;
- case PROP_SHOW_HINT:
- g_value_set_int(value, priv->show_hint);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
+ VirtViewerDisplay *display = VIRT_VIEWER_DISPLAY(object);
+ VirtViewerDisplayPrivate *priv = display->priv;
+
+ switch (prop_id) {
+ case PROP_DESKTOP_WIDTH:
+ g_value_set_int(value, priv->desktopWidth);
+ break;
+ case PROP_DESKTOP_HEIGHT:
+ g_value_set_int(value, priv->desktopHeight);
+ break;
+ case PROP_NTH_DISPLAY:
+ g_value_set_int(value, priv->nth_display);
+ break;
+ case PROP_SHOW_HINT:
+ g_value_set_int(value, priv->show_hint);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
}
static void
virt_viewer_display_grab_focus(GtkWidget *widget)
{
- GtkBin *bin = GTK_BIN(widget);
+ GtkBin *bin = GTK_BIN(widget);
- gtk_widget_grab_focus(gtk_bin_get_child(bin));
+ gtk_widget_grab_focus(gtk_bin_get_child(bin));
}
static gboolean
virt_viewer_display_idle(gpointer opaque)
{
- VirtViewerDisplay *display = opaque;
- VirtViewerDisplayPrivate *priv = display->priv;
- if (!priv->dirty)
- gtk_widget_queue_resize_no_redraw(GTK_WIDGET(display));
- return FALSE;
+ VirtViewerDisplay *display = opaque;
+ VirtViewerDisplayPrivate *priv = display->priv;
+ if (!priv->dirty)
+ gtk_widget_queue_resize_no_redraw(GTK_WIDGET(display));
+ return FALSE;
}
static void
virt_viewer_display_size_request(GtkWidget *widget,
- GtkRequisition *requisition)
+ GtkRequisition *requisition)
{
- VirtViewerDisplay *display = VIRT_VIEWER_DISPLAY(widget);
- VirtViewerDisplayPrivate *priv = display->priv;
- int border_width = gtk_container_get_border_width(GTK_CONTAINER(widget));
-
- requisition->width = border_width * 2;
- requisition->height = border_width * 2;
-
- if (priv->dirty) {
- if (priv->zoom)
- requisition->width += priv->desktopWidth * priv->zoom_level / 100;
- else
- requisition->width += priv->desktopWidth;
- } else {
- requisition->width += 50;
- }
- if (priv->dirty) {
- if (priv->zoom)
- requisition->height += priv->desktopHeight * priv->zoom_level / 100;
- else
- requisition->height += priv->desktopHeight;
- } else {
- requisition->height += 50;
- }
-
- DEBUG_LOG("Display size request %dx%d (desktop %dx%d)",
- requisition->width, requisition->height,
- priv->desktopWidth, priv->desktopHeight);
+ VirtViewerDisplay *display = VIRT_VIEWER_DISPLAY(widget);
+ VirtViewerDisplayPrivate *priv = display->priv;
+ int border_width = gtk_container_get_border_width(GTK_CONTAINER(widget));
+
+ requisition->width = border_width * 2;
+ requisition->height = border_width * 2;
+
+ if (priv->dirty) {
+ if (priv->zoom)
+ requisition->width += priv->desktopWidth * priv->zoom_level / 100;
+ else
+ requisition->width += priv->desktopWidth;
+ } else {
+ requisition->width += 50;
+ }
+ if (priv->dirty) {
+ if (priv->zoom)
+ requisition->height += priv->desktopHeight * priv->zoom_level / 100;
+ else
+ requisition->height += priv->desktopHeight;
+ } else {
+ requisition->height += 50;
+ }
+
+ DEBUG_LOG("Display size request %dx%d (desktop %dx%d)",
+ requisition->width, requisition->height,
+ priv->desktopWidth, priv->desktopHeight);
}
#if GTK_CHECK_VERSION(3, 0, 0)
static void virt_viewer_display_get_preferred_width(GtkWidget *widget,
- int *minwidth,
- int *defwidth)
+ int *minwidth,
+ int *defwidth)
{
- GtkRequisition req;
+ GtkRequisition req;
- virt_viewer_display_size_request(widget, &req);
+ virt_viewer_display_size_request(widget, &req);
- *minwidth = *defwidth = req.width;
+ *minwidth = *defwidth = req.width;
}
static void virt_viewer_display_get_preferred_height(GtkWidget *widget,
- int *minheight,
- int *defheight)
+ int *minheight,
+ int *defheight)
{
- GtkRequisition req;
+ GtkRequisition req;
- virt_viewer_display_size_request(widget, &req);
+ virt_viewer_display_size_request(widget, &req);
- *minheight = *defheight = req.height;
+ *minheight = *defheight = req.height;
}
#endif
static void
virt_viewer_display_size_allocate(GtkWidget *widget,
- GtkAllocation *allocation)
+ GtkAllocation *allocation)
{
- GtkBin *bin = GTK_BIN(widget);
- VirtViewerDisplay *display = VIRT_VIEWER_DISPLAY(widget);
- VirtViewerDisplayPrivate *priv = display->priv;
- GtkAllocation child_allocation;
- gint width, height;
- gint border_width;
- double desktopAspect;
- double actualAspect;
- GtkWidget *child = gtk_bin_get_child(bin);
-
- DEBUG_LOG("Allocated %dx%d", allocation->width, allocation->height);
- gtk_widget_set_allocation(widget, allocation);
-
- desktopAspect = (double)priv->desktopWidth / (double)priv->desktopHeight;
-
- if (child &&
- gtk_widget_get_visible(child)) {
- if (!priv->maintain_aspect_ratio) {
- gtk_widget_size_allocate(child, allocation);
- goto end;
- }
-
- border_width = gtk_container_get_border_width(GTK_CONTAINER(display));
-
- width = MAX(1, allocation->width - 2 * border_width);
- height = MAX(1, allocation->height - 2 * border_width);
- actualAspect = (double)width / (double)height;
-
- if (actualAspect > desktopAspect) {
- child_allocation.width = height * desktopAspect;
- child_allocation.height = height;
- } else {
- child_allocation.width = width;
- child_allocation.height = width / desktopAspect;
- }
-
- child_allocation.x = 0.5 * (width - child_allocation.width) + allocation->x + border_width;
- child_allocation.y = 0.5 * (height - child_allocation.height) + allocation->y + border_width;
-
- DEBUG_LOG("Child allocate %dx%d", child_allocation.width, child_allocation.height);
- gtk_widget_size_allocate(child, &child_allocation);
- }
-
-end:
- /* This unsets the size request, so that the user can
- * manually resize the window smaller again
- */
- if (priv->dirty) {
- g_idle_add(virt_viewer_display_idle, widget);
- priv->dirty = FALSE;
- }
+ GtkBin *bin = GTK_BIN(widget);
+ VirtViewerDisplay *display = VIRT_VIEWER_DISPLAY(widget);
+ VirtViewerDisplayPrivate *priv = display->priv;
+ GtkAllocation child_allocation;
+ gint width, height;
+ gint border_width;
+ double desktopAspect;
+ double actualAspect;
+ GtkWidget *child = gtk_bin_get_child(bin);
+
+ DEBUG_LOG("Allocated %dx%d", allocation->width, allocation->height);
+ gtk_widget_set_allocation(widget, allocation);
+
+ desktopAspect = (double)priv->desktopWidth / (double)priv->desktopHeight;
+
+ if (child &&
+ gtk_widget_get_visible(child)) {
+ if (!priv->maintain_aspect_ratio) {
+ gtk_widget_size_allocate(child, allocation);
+ goto end;
+ }
+
+ border_width = gtk_container_get_border_width(GTK_CONTAINER(display));
+
+ width = MAX(1, allocation->width - 2 * border_width);
+ height = MAX(1, allocation->height - 2 * border_width);
+ actualAspect = (double)width / (double)height;
+
+ if (actualAspect > desktopAspect) {
+ child_allocation.width = height * desktopAspect;
+ child_allocation.height = height;
+ } else {
+ child_allocation.width = width;
+ child_allocation.height = width / desktopAspect;
+ }
+
+ child_allocation.x = 0.5 * (width - child_allocation.width) + allocation->x + border_width;
+ child_allocation.y = 0.5 * (height - child_allocation.height) + allocation->y + border_width;
+
+ DEBUG_LOG("Child allocate %dx%d", child_allocation.width, child_allocation.height);
+ gtk_widget_size_allocate(child, &child_allocation);
+ }
+
+ end:
+ /* This unsets the size request, so that the user can
+ * manually resize the window smaller again
+ */
+ if (priv->dirty) {
+ g_idle_add(virt_viewer_display_idle, widget);
+ priv->dirty = FALSE;
+ }
}
void virt_viewer_display_set_maintain_aspect_ratio(VirtViewerDisplay *display,
- gboolean maintain)
+ gboolean maintain)
{
- g_return_if_fail(VIRT_VIEWER_IS_DISPLAY(display));
+ g_return_if_fail(VIRT_VIEWER_IS_DISPLAY(display));
- display->priv->maintain_aspect_ratio = maintain;
+ display->priv->maintain_aspect_ratio = maintain;
}
void virt_viewer_display_set_desktop_size(VirtViewerDisplay *display,
- guint width,
- guint height)
+ guint width,
+ guint height)
{
- VirtViewerDisplayPrivate *priv = display->priv;
+ VirtViewerDisplayPrivate *priv = display->priv;
- if (width == priv->desktopWidth && height == priv->desktopHeight)
- return;
+ if (width == priv->desktopWidth && height == priv->desktopHeight)
+ return;
- priv->desktopWidth = width;
- priv->desktopHeight = height;
- priv->dirty = TRUE;
+ priv->desktopWidth = width;
+ priv->desktopHeight = height;
+ priv->dirty = TRUE;
- gtk_widget_queue_resize(GTK_WIDGET(display));
- g_signal_emit_by_name(display, "display-desktop-resize");
+ gtk_widget_queue_resize(GTK_WIDGET(display));
+ g_signal_emit_by_name(display, "display-desktop-resize");
}
void virt_viewer_display_get_desktop_size(VirtViewerDisplay *display,
- guint *width,
- guint *height)
+ guint *width,
+ guint *height)
{
- VirtViewerDisplayPrivate *priv = display->priv;
+ VirtViewerDisplayPrivate *priv = display->priv;
- *width = priv->desktopWidth;
- *height = priv->desktopHeight;
+ *width = priv->desktopWidth;
+ *height = priv->desktopHeight;
}
void virt_viewer_display_set_zoom_level(VirtViewerDisplay *display,
- guint zoom)
+ guint zoom)
{
- VirtViewerDisplayPrivate *priv = display->priv;
- GtkWidget *child = gtk_bin_get_child(GTK_BIN(display));
-
- if (zoom < 10)
- zoom = 10;
- if (zoom > 400)
- zoom = 400;
- priv->zoom_level = zoom;
-
- if (child && gtk_widget_get_visible(child)) {
- priv->dirty = TRUE;
- gtk_widget_queue_resize(GTK_WIDGET(display));
- }
+ VirtViewerDisplayPrivate *priv = display->priv;
+ GtkWidget *child = gtk_bin_get_child(GTK_BIN(display));
+
+ if (zoom < 10)
+ zoom = 10;
+ if (zoom > 400)
+ zoom = 400;
+ priv->zoom_level = zoom;
+
+ if (child && gtk_widget_get_visible(child)) {
+ priv->dirty = TRUE;
+ gtk_widget_queue_resize(GTK_WIDGET(display));
+ }
}
void virt_viewer_display_set_zoom(VirtViewerDisplay *display,
- gboolean zoom)
+ gboolean zoom)
{
- VirtViewerDisplayPrivate *priv = display->priv;
- GtkWidget *child = gtk_bin_get_child(GTK_BIN(display));
-
- priv->zoom = zoom;
- if (child && gtk_widget_get_visible(child)) {
- priv->dirty = TRUE;
- gtk_widget_queue_resize(GTK_WIDGET(display));
- }
+ VirtViewerDisplayPrivate *priv = display->priv;
+ GtkWidget *child = gtk_bin_get_child(GTK_BIN(display));
+
+ priv->zoom = zoom;
+ if (child && gtk_widget_get_visible(child)) {
+ priv->dirty = TRUE;
+ gtk_widget_queue_resize(GTK_WIDGET(display));
+ }
}
void virt_viewer_display_send_keys(VirtViewerDisplay *display,
- const guint *keyvals, int nkeyvals)
+ const guint *keyvals, int nkeyvals)
{
- g_return_if_fail(VIRT_VIEWER_IS_DISPLAY(display));
+ g_return_if_fail(VIRT_VIEWER_IS_DISPLAY(display));
- VIRT_VIEWER_DISPLAY_GET_CLASS(display)->send_keys(display, keyvals, nkeyvals);
+ VIRT_VIEWER_DISPLAY_GET_CLASS(display)->send_keys(display, keyvals, nkeyvals);
}
GdkPixbuf* virt_viewer_display_get_pixbuf(VirtViewerDisplay *display)
{
- g_return_val_if_fail(VIRT_VIEWER_IS_DISPLAY(display), NULL);
+ g_return_val_if_fail(VIRT_VIEWER_IS_DISPLAY(display), NULL);
- return VIRT_VIEWER_DISPLAY_GET_CLASS(display)->get_pixbuf(display);
+ return VIRT_VIEWER_DISPLAY_GET_CLASS(display)->get_pixbuf(display);
}
void virt_viewer_display_set_show_hint(VirtViewerDisplay *self, gint hint)
{
- VirtViewerDisplayPrivate *priv;
- g_return_if_fail(VIRT_VIEWER_IS_DISPLAY(self));
+ VirtViewerDisplayPrivate *priv;
+ g_return_if_fail(VIRT_VIEWER_IS_DISPLAY(self));
- priv = self->priv;
- if (priv->show_hint == hint)
- return;
+ priv = self->priv;
+ if (priv->show_hint == hint)
+ return;
- priv->show_hint = hint;
- g_object_notify(G_OBJECT(self), "show-hint");
+ priv->show_hint = hint;
+ g_object_notify(G_OBJECT(self), "show-hint");
}
/*
* Local variables:
- * c-indent-level: 8
- * c-basic-offset: 8
- * tab-width: 8
+ * c-indent-level: 4
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
* End:
*/