GNOME Bugzilla – Bug 119647
window menu should trail the name of the windows
Last modified: 2004-12-22 21:47:04 UTC
Description of Problem: Steps to reproduce the problem: 1. create a window with a long title. e.g. with a simple html page and a really long <title>-tag 2. open that page and look at the length of the entry in the window menu 3. oops its really long Actual Results: string can cover the whole screen, thus the whole menu covers the screen Expected Results: string should be trailed like "Foo ..." at 32 chars or more. dunno how much is functional. if string is trailed let it scroll when mouse is over the entry How often does this happen? allways Additional Information: gnome2.2 debian unstable thanks ppl
*** Bug 113347 has been marked as a duplicate of this bug. ***
Created attachment 20562 [details] [review] Proposed patch.
Here's a patch that trims the window names if they're longer than 32 characters. I'm not sure if it should be done here or if we should add something for that in libwnck. There's a (minor) problem : if the font is not monospaced, then the characters don't have the same length and thus, the trimmed strings don't all have the same length (some are longer than others). Maybe there's a way to know the size a string will occupy once displayed and it'd be better to use it.
First off, I'm not sure this is such a huge issue that its worth fixing .... I don't see the big problem with really long menu items ... If we are going to fix I'd like use to use EelEllipsizingLabel (which should really be in gtk+) to do it. i.e. each menu item would hold the GtkImage and the ellipsizing label and you'd fix the requisition of the menuitem at something like 1/6 of the screen width. See gnome-terminal/src/eel for how to copy and paste the code for linking into the panel. (Thanks for the patch though Vincent)
Mark: does that mean that you're ok if I copy this eel stuff in applets/wncklet/ ? Or do you prefer to WONTFIX the bug ?
Yeah, I'm okay with copying the eel stuff - in theory it should only by temporary ... i.e. until gtk+ gets an ellipsizing label
Created attachment 20592 [details] [review] Updated patch using eel_ellipsizing_label
This patch should be a better one :-)
Patch looks really good vincent ... Some comments: * Put all the eel stuff in applets/wncklet/eel the way gnome-terminal does it. * window_menu_image_menu_item_new_with_eel_label could be called window_menu_item_new or something simple like that :-) * the set_size_request line should be split up for clarity. I'd do something like { int screen_width; screen_width = gdk_screen_get_width ( gtk_widget_get_screen (window_menu->applet)); gtk_widget_set_size_request (item, screen_width / 6, -1); } Once you've fixed up those minor nits, please go ahead and commit to HEAD. And thanks :-)
Committed with above comments.
Just a thought... Text in the window list applet is truncated but not ellipsized, and file names in the Actions->Open Recent menu can be quite long. To be consistent, shouldn't we truncate and ellipsize the text in the window list applet and the open recent menu items too?
Yeah, it'd be nice. I suppose you should open bugs against libegg/recent-files and libwnck for this and refer to this bug. Please cc me in these bugs. Thanks
I think the screen_size/6 is way too small. Almost all my window titles are clipped so that I can't read them. I am attaching a patch that makes the clamp size screen_width/2 instead of screen_width/6, and only sets the size request to that if the item's own request would be larger. The effect is to clamp to make the width MAX (screen_width/2, natural size) instead of unconditionally screen_width/6.
Created attachment 20842 [details] [review] patch
That should be MIN (screen_size/2, natural_size) of course
IMHO screen_size/2 is really too large. I'd prefer if it were screen_size/4 (or maybe screen_size/3, but it starts to look too large again). Mark: what do you think?
How about this patch then, that goes back to using 32 characters as the maximum (only done with pango_font_metrics_get_approximate_char_width())?
Created attachment 20844 [details] [review] new patch
Sounds reasonable. But, hrm, stupid question: does your patch work for you? Here it doesn't work: it seems the labels don't tell the size they need, so I just see the icons.
No, it doesn't work. I forgot three things, (a) how broken EelEllipsizingLabel is, (b) that a widget needs a screen before its style->font_desc will be correct, and (c) to use PANGO_PIXELS. Here is a new patch. I used 56 characters instead of 32, because otherwise there is simply too many window titles that get unrecognizable.
Created attachment 20847 [details] [review] new patch
Created attachment 20849 [details] [review] New patch
This final patch also clamps the size of the menu to 3/4 times the screen size.
Man, your titles must be really long. 56 characters looks like a lot. I tried with 44 characters and it looks nicer for me. Anyway, this is personal taste, I assume. I'd feel better with a value like 50, though. Sounds ok to commit, but as I'm not a maintainer... Mark: is it ok for you?
> Man, your titles must be really long. 56 characters looks like a lot. Well, I use them to distinguis xterms, eg. xterm: /home/ssp/vertigo/gnome-panel/applets/wncklet/ Using 50 would be fine by me.
I haven't reviewed the patch too closely but I trust both of you so ... please go ahead and commit to HEAD :-)
Thu Oct 23 13:19:01 2003 Soeren Sandmann <sandmann@daimi.au.dk> * window-menu.c: Make the width of the window menu the minimum of 3/4 * screen width, approx. 50 characters and the menu's natural width.