Bluefish, Ubuntu or Gtk bug?

In Bluefish, Gnome, open source, Programming, Ubuntu on October 25, 2011 by oli4444

There is a weird widget scaling issue happening with Bluefish compiled on Ubuntu 11.10 with gtk-3.2.0 that I don’t see on the same Ubuntu 11.10 with Bluefish compiled with gtk-2.24.6 nor on Fedora 15 compiled with Bluefish compiled with either gtk-3.0.12 or gtk-2.24.4.

Bluefish has a GtkHPaned widget to show a sidebar (by default on the left). Inside that sidebar is a GtkNotebook, and inside that notebook is a GtkComboBox. The text string in the GtkComboBox sometimes becomes quite long. Normally this string is just shortened by gtk as can be seen below (the string is file:///home/olivier etc. etc.):

On Ubuntu 11.10 with gtk-3.2, however, this string defines the GtkComboBox minimum width, and if you try to move the GtkHPaned handle to the left it makes all of the contents inside the GtkHPaned move to the left, outside the window border (watch the left side of the GtkNoteBook, see that one of the tabs is moved outside the window? See that the contents of the GtkTreeView are moved outside the window?):

In this example there is a long string in the active entry of the GtkComboBox, but if there is a short string active and a long string only in the popup menu, the issue still appears. So the minimum width is defined by the longest string in the GtkListModel.

In the documentation I cannot find if a GtkComboBox should shrink smaller than the text that is possibly in the popup menu. But I do know that this has never been a problem before on any gtk version up to gtk-3.0 (but Fedora 16 is not yet released, so my only Gtk-3.2 box has Ubuntu 11.10), so I’m wondering if the bug is in Bluefish, Ubuntu or Gtk?

Update 1: I can reproduce this on Fedora 16 beta, so this is not an Ubuntu issue, it is either Gtk-3.2 or Bluefish

Update 2: thanks to the comment from Benjamin Otte I fixed part of the issue by setting the ellipsize property to the GtkComboBox text renderer. However it is still not really back to normal nice behavior. The GtkComboBox furthermore has weird/buggy behavior if ellipsize is disabled. If there used to be a long string in the model, but that string is gone, it still wants a very big width. I think at least this bit is buggy.


5 Responses to “Bluefish, Ubuntu or Gtk bug?”

  1. This sounds like an overlay scrollbar (Ubuntu) bug

  2. Seems related to natural and width-for-height geometry. I have similar problems with some GtkLabels, probably this bug is the same case:

    In short: some widgets have change the methods to calculate his minimun and natural width and applications need to be updated.

  3. Hmm, could also be a side-effect of “natural size” and stuff like this in gtk+-3.0.

  4. I suppose this is related to the way we handle underallocations in GTK 3. An “underallocation” happens when gtk_widget_size_allocate() is called with a width or height that is too small for the values that the gtk_widget_get_preferred_whatever() functions return as the required minimum.
    In GTK 2, this was allowed and caused a lot of unexpected behaviors (from clippings or misrenderings to application termination (usually division by zero, if you managed to hit the perfect width). Because that was unacceptable, we decided to forbid underallocations in GTK 3.
    Now, in GTK 3.0 we did not strictly enforce this. In GTK 3.2 I did a bunch of work to fix this. So now, if you have a string, that string will always be completely visible and no clipping will happen.

    So how do you get your old behavior back? I don’t think you can get an identical behavor – but that’s not what you want anyway, you don’t wanna display “/home/oliv” for “/home/oliver”, but something like “/home/o…”. So I guess what you want is to make the text in the combobox and in the treeview ellipsized.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: