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 357872 - performance and layout fixes to keyboard preview
performance and layout fixes to keyboard preview
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Keyboard
git master
Other Linux
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-09-26 19:40 UTC by Dan Winship
Modified: 2007-02-03 23:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (4.90 KB, patch)
2006-09-26 19:41 UTC, Dan Winship
reviewed Details | Review
patach against libgnomekbd, for 2.17 (4.21 KB, patch)
2007-01-07 20:56 UTC, Dan Winship
none Details | Review

Description Dan Winship 2006-09-26 19:40:42 UTC
The attached patch makes four changes to the keyboard preview widget:

    1. Instead of shrinking long keysym names to make them fit, it just
       ellipsizes them. This fixes 90% of the performance problems with
       that widget. (Pango seems to have to do a lot of work when
       fit_width() changes the font size.)

       I don't think this makes the preview any less useful: you'd have
       to make the window ridiculously huge to be able to fit a font
       large enough to read most of those long labels anyway, so truncating
       them after a few characters is no worse than shrinking them into
       microscopic squiggles. Also, see fix #3 anyway.

    2. Instead of drawing the layout from inside the expose event, it
       now draws it in an idle handler. This helps fix the problem where
       the window border lags behind the pointer when you try to resize
       it. (It still doesn't fix it 100% though, and it doesn't really do
       much at all without the previous fix.)

    3. It only draws the keysyms on levels 2, 3, and 4 if they're actually
       selected with Shift and AltGr. This means that all of the Ctrl+Alt
       keybindings on the function keys and stuff like that don't get drawn
       now, which seems to make sense to me, because before it looked like
       you ought to be able to type Shift+F1 to change virtual terminals,
       which you can't. Also, showing no label there looks better than
       either showing an ellipsized label or showing a microscopic label.

    4. It adjusts the position of multi-line keysym names like "Page\nUp"
       so that they don't color outside the lines.

Other than #2 not really working well without #1, they're all independent
and it should be pretty obvious what parts of the patch do what if you only
want some of the changes.
Comment 1 Dan Winship 2006-09-26 19:41:33 UTC
Created attachment 73453 [details] [review]
patch
Comment 2 Thomas Wood 2007-01-07 00:13:15 UTC
Sounds all good to me, and the patch is pretty trivial.

If someone else can verify and test the patch, the please commit.
Comment 3 Sergey V. Udaltsov 2007-01-07 10:01:08 UTC
This patch is not applicable to the gnome 2.17. kbdraw is moved into libgnomekbd and the code is changed. Could you please update it so I would be able to test?
Comment 4 Dan Winship 2007-01-07 20:56:33 UTC
Created attachment 79678 [details] [review]
patach against libgnomekbd, for 2.17

Here's the patch updated for 2.17.

I commented out the call to pango_layout_set_ellipsize because it seemed flaky;
as I resized the window, certain keys like "Home" kept switching between
ellipsized and unellipsized. Without that call, they just get truncated at the
edge of the key rectangle. You can try it both ways and see what you think.
Comment 5 Sergey V. Udaltsov 2007-01-07 22:00:26 UTC
Dan, thanks for the updated patch. For a moment, I cannot test it - Ubuntu (or Xorg or whoever) broken XkbGetKeyboard, so preview does not work at all (with or without your patch). But as soon as I get it all back - I'll test your patch and give some feedback.
Comment 6 Dan Winship 2007-01-08 02:16:58 UTC
that would be https://bugs.freedesktop.org/show_bug.cgi?id=7137, which
should be fixed in xorg head
Comment 7 Sergey V. Udaltsov 2007-01-08 08:44:16 UTC
I just hope Ubuntu Feisy will have it...
Comment 8 Sergey V. Udaltsov 2007-02-03 23:41:44 UTC
Seems to be ok. Committed. Thanks a bunch. And I uncommended the ellipsis thingie - I like it this way.