Codebase list virt-viewer / c2046a2
display: Set useful values for MIN_DISPLAY_{WIDTH, HEIGHT} Nowadays the value for MIN_DISPLAY_{WIDTH,HEIGHT} is 50. This arbitrary value doesn't bring any benefit, doesn't provide a useful size for a desktop to be usable and can actually trigger some undefined behavior when reaching resolutions that are lower than the ones provided by the video drivers (as in rhbz#1296878). In order to avoid these issues and provide a minimum resolution that can still be useful for our users, let's use the same values for minimum width and height used by the linux QXL drivers (320x200). This also requires us to adjust the minimum requested widget size when zoom is enabled so that we don't accidentally request a size smaller than the driver can support. Related: rhbz#1296878 Signed-off-by: Fabiano FidĂȘncio <fidencio@redhat.com> Jonathon Jongsma 8 years ago
2 changed file(s) with 22 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
115115 "Desktop width",
116116 MIN_DISPLAY_WIDTH,
117117 G_MAXINT32,
118 100,
118 MIN_DISPLAY_WIDTH,
119119 G_PARAM_READWRITE));
120120
121121 g_object_class_install_property(object_class,
125125 "Desktop height",
126126 MIN_DISPLAY_HEIGHT,
127127 G_MAXINT32,
128 100,
128 MIN_DISPLAY_HEIGHT,
129129 G_PARAM_READWRITE));
130130
131131 g_object_class_install_property(object_class,
273273
274274 display->priv = VIRT_VIEWER_DISPLAY_GET_PRIVATE(display);
275275
276 display->priv->desktopWidth = 100;
277 display->priv->desktopHeight = 100;
276 display->priv->desktopWidth = MIN_DISPLAY_WIDTH;
277 display->priv->desktopHeight = MIN_DISPLAY_HEIGHT;
278278 display->priv->zoom_level = NORMAL_ZOOM_LEVEL;
279279 display->priv->zoom = TRUE;
280280 #if !GTK_CHECK_VERSION(3, 0, 0)
424424 if (priv->dirty || !priv->size_request_once) {
425425 virt_viewer_display_get_preferred_size(display, requisition);
426426 } else {
427 requisition->width = MIN_DISPLAY_WIDTH;
428 requisition->height = MIN_DISPLAY_HEIGHT;
427 requisition->width = MIN_DISPLAY_WIDTH * priv->zoom_level / (double) NORMAL_ZOOM_LEVEL;
428 requisition->height = MIN_DISPLAY_HEIGHT * priv->zoom_level / (double) NORMAL_ZOOM_LEVEL;
429429 }
430430
431431 priv->size_request_once = TRUE;
459459 VirtViewerDisplayPrivate *priv = display->priv;
460460 int border_width = gtk_container_get_border_width(GTK_CONTAINER(widget));
461461
462 *minwidth = MIN_DISPLAY_WIDTH + 2 * border_width;
463462
464463 if (priv->zoom) {
465 *defwidth = round(priv->desktopWidth * priv->zoom_level / (double) NORMAL_ZOOM_LEVEL) +
466 2 * border_width;
464 *defwidth = round(priv->desktopWidth * priv->zoom_level / (double) NORMAL_ZOOM_LEVEL);
465 *minwidth = round(MIN_DISPLAY_WIDTH * priv->zoom_level / (double) NORMAL_ZOOM_LEVEL);
467466 } else {
468 *defwidth = priv->desktopWidth + 2 * border_width;
469 }
467 *defwidth = priv->desktopWidth;
468 *minwidth = MIN_DISPLAY_WIDTH;
469 }
470 *defwidth += 2 * border_width;
471 *minwidth += 2 * border_width;
470472 }
471473
472474
478480 VirtViewerDisplayPrivate *priv = display->priv;
479481 int border_height = gtk_container_get_border_width(GTK_CONTAINER(widget));
480482
481 *minheight = MIN_DISPLAY_HEIGHT + 2 * border_height;
482
483483 if (priv->zoom) {
484 *defheight = round(priv->desktopHeight * priv->zoom_level / (double) NORMAL_ZOOM_LEVEL) +
485 2 * border_height;
484 *defheight = round(priv->desktopHeight * priv->zoom_level / (double) NORMAL_ZOOM_LEVEL);
485 *minheight = round(MIN_DISPLAY_HEIGHT * priv->zoom_level / (double) NORMAL_ZOOM_LEVEL);
486486 } else {
487 *defheight = priv->desktopHeight + 2 * border_height;
488 }
487 *defheight = priv->desktopHeight;
488 *minheight = MIN_DISPLAY_HEIGHT;
489 }
490 *defheight += 2 * border_height;
491 *minheight += 2 * border_height;
489492 }
490493 #endif
491494
2828
2929 G_BEGIN_DECLS
3030
31 #define MIN_DISPLAY_WIDTH 50
32 #define MIN_DISPLAY_HEIGHT 50
31 #define MIN_DISPLAY_WIDTH 320
32 #define MIN_DISPLAY_HEIGHT 200
3333
3434 #define VIRT_VIEWER_TYPE_DISPLAY virt_viewer_display_get_type()
3535