Statuses

The (too large) minimum width of a GtkEntry in Gtk+-3.2

In Bluefish, Gnome, open source, Programming on December 14, 2011 by oli4444

Bluefish has a side-pane in it’s main interface, which is implemented using a GtkHPaned widget. Users may drag the handle to increase or decrease the side pane. Now lets see what happens if the user makes the sidebar smaller than the widgets in there. I created a mini example application that works with both Gtk+-2 and Gtk+-3. There is a GtkEntry in the left sidebar, and a GtkTextView on the right. This is a screenshot with Gtk+-2:

Initial view of the example application

Now see what happens if you drag the handle to the left in Gtk+-2:

Gtk+-2 making the widget smallerThe widget now becomes smaller, and it is cropped on the right side, which looks natural.

Now see what happens if you drag the handle to the left in Gtk+-3.2:

What it looks like inb Gtk+-3.2The widget is cropped from the left side, which has the content, which looks awful. Also there is a huge empty space after the “Hello World” because the GtkEntry minimum width is very large.

My suggestions for improvement:

  • decrease the minimum width of the GtkEntry to 30 pixels or so
  • when cropping widgets, crop from the right if the widget is on the left side of the handle, crop from the left if the widget is on the right side of the handle. That suggests that the user drags the handle as a layer on top over the widget which feels much more natural.

b.t.w. GtkEntry is not the only widget that has a too-large minimum width. In Bluefish we also use libgucharmap, and the gucharmap widget forces an even wider sidebar in Gtk+-3.2.

Advertisements

2 Responses to “The (too large) minimum width of a GtkEntry in Gtk+-3.2”

  1. Second screenshot isn’t natural 🙂 What *would* be natural if the caption got ellipsized. But what happens is that the caption is cropped instead 🙂

    So, IMO, 2nd option is not much better than the 3rd one 🙂 And it looks like a holistic approach to the issue would solve both cases.

  2. Interestingly this minimum size was introduced in commit 9508b76bd2401b6b9e289b5c8ec9fc0e08909283 – the bane of my existence, because the commit message sucks.

    I pondered having GtkEntry have a minimum size of 0 and a natural size of the current 150px, but didn’t dare changing it so close to the then-imminent 3.2 release. I should do that now.

    Also, we argued the way GtkPaned should behave when you shrink too far and decided to do it the way it is to show that you are pushing the widget out of the way. So it was a concious decision, btu we weren’t terribly sure which one is better. And your explanation of “feels much more natural” is also gut feeling so not better than our gut feeling. It’s easy to change though.

    PS: Discussions about GTK belong into GTK discussion places (for me preferrably IRC), not into random blog posts.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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: