Updating branch refs/heads/nick/gtk3 to 98ad51efc4bb77fa4df5e3dcb2ee6a3914675b98 (commit) from 5aebe0780ff3af783f45baf91fcadbfc315d8c69 (commit)
commit 98ad51efc4bb77fa4df5e3dcb2ee6a3914675b98 Author: Andrzej <ndrwr...@gmail.com> Date: Wed Apr 17 02:24:58 2013 +0100 PanelImage: allow scaling the image down (below allocation) Some containers (GtkBox(?)) refuse to allocate their child items below minimum requested size, even if that results in violating their own allocation. Reducing the minimum size allows these containers to iteratively reduce the size of the embedded PanelImage. When priv->size > 0 minimum size must be equal to the natural size. Otherwise icons displayed in menus will be too small (menus use a minimum size). libxfce4panel/xfce-panel-image.c | 38 ++++++++++++++++++++++++++++---------- 1 files changed, 28 insertions(+), 10 deletions(-) diff --git a/libxfce4panel/xfce-panel-image.c b/libxfce4panel/xfce-panel-image.c index 5d17419..1783f39 100644 --- a/libxfce4panel/xfce-panel-image.c +++ b/libxfce4panel/xfce-panel-image.c @@ -358,24 +358,33 @@ xfce_panel_image_get_preferred_width (GtkWidget *widget, { XfcePanelImagePrivate *priv = XFCE_PANEL_IMAGE (widget)->priv; GtkAllocation alloc; - gint width; + gint width, width_min; +#ifdef GTK_BUTTON_SIZING_FIX + gint correction; +#endif if (priv->size > 0) - width = priv->size; + width = width_min = priv->size; else if (priv->pixbuf != NULL) - width = gdk_pixbuf_get_width (priv->pixbuf); + { + width = gdk_pixbuf_get_width (priv->pixbuf); + width_min = width / 2; + } else { gtk_widget_get_allocation (widget, &alloc); width = alloc.width; + width_min = width / 2; } #ifdef GTK_BUTTON_SIZING_FIX - width -= xfce_panel_image_padding_correction (widget); + correction = xfce_panel_image_padding_correction (widget); + width -= correction; + width_min -= correction; #endif if (minimum_width != NULL) - *minimum_width = width; + *minimum_width = width_min; if (natural_width != NULL) *natural_width = width; @@ -390,24 +399,33 @@ xfce_panel_image_get_preferred_height (GtkWidget *widget, { XfcePanelImagePrivate *priv = XFCE_PANEL_IMAGE (widget)->priv; GtkAllocation alloc; - gint height; + gint height, height_min; +#ifdef GTK_BUTTON_SIZING_FIX + gint correction; +#endif if (priv->size > 0) - height = priv->size; + height = height_min = priv->size; else if (priv->pixbuf != NULL) - height = gdk_pixbuf_get_height (priv->pixbuf); + { + height = gdk_pixbuf_get_height (priv->pixbuf); + height_min = height / 2; + } else { gtk_widget_get_allocation (widget, &alloc); height = alloc.height; + height_min = height / 2; } #ifdef GTK_BUTTON_SIZING_FIX - height -= xfce_panel_image_padding_correction (widget); + correction = xfce_panel_image_padding_correction (widget); + height -= correction; + height_min -= correction; #endif if (minimum_height != NULL) - *minimum_height = height; + *minimum_height = height_min; if (natural_height != NULL) *natural_height = height; _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits