After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 765644 - Widget sizing problems with GtkProgressBar
Widget sizing problems with GtkProgressBar
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
3.20.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-04-26 23:53 UTC by Morten Welinder
Modified: 2016-04-27 00:45 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Morten Welinder 2016-04-26 23:53:59 UTC
With the test program below (as well as with Gnumeric), gtk+ spews
criticals for me:


(lt-testcalendar:6149): Gtk-WARNING **: (gtkcssgadget.c:681):gtk_css_gadget_get_preferred_size: runtime check failed: (*minimum <= *natural)


The problem is gtk_progress_bar_measure_text:

          *minimum = PANGO_PIXELS (char_width) * 3;

This comes out bigger than

      *natural = logical_rect.width;

One of them needs to be clamped to the other.

(Using " " for the text makes sense here; the progress bar in question
isn't actually in use at this time.  It will get a proper test at a later
time.)



#include "config.h"
#include <stdio.h>
#include <string.h>
#include <gtk/gtk.h>



static void
create_progress_bar(void)
{
  GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

  gtk_window_set_title (GTK_WINDOW (window), "GtkProgress_Bar Example");
  gtk_container_set_border_width (GTK_CONTAINER (window), 12);
  g_signal_connect (window, "destroy",
		    G_CALLBACK (gtk_main_quit),
		    NULL);
  g_signal_connect (window, "delete-event",
		    G_CALLBACK (gtk_false),
		    NULL);

  GtkWidget *pbar = gtk_progress_bar_new ();
  gtk_progress_bar_set_ellipsize (GTK_PROGRESS_BAR (pbar), PANGO_ELLIPSIZE_END);
  gtk_progress_bar_set_show_text (GTK_PROGRESS_BAR (pbar), TRUE);
  gtk_progress_bar_set_text (GTK_PROGRESS_BAR (pbar), " ");

  gtk_container_add (GTK_CONTAINER (window), pbar);

  gtk_window_set_default_size (GTK_WINDOW (window), 600, 0);
  gtk_widget_show_all (window);
}


int main(int   argc,
         char *argv[] )
{
  gtk_init (&argc, &argv);

  if (g_getenv ("GTK_RTL"))
    gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);

  create_progress_bar();

  gtk_main();

  return(0);
}
/* example-end */