[PATCH] Missing sub-menu arrows with 3.5.x and GTK < 2.15

David Bolen db3l.net at gmail.com
Mon Mar 19 14:48:14 PDT 2012


On Mon, Mar 19, 2012 at 5:59 AM, Michael Meeks <michael.meeks at suse.com> wrote:
>
>        Sounds very sensible. Just one minor complaint: - I loathe the
> implementation of gtk_check_version - its impl. is as clear as mud, it
> returns an non-translated string not a boolean etc. etc. ;-)
>
>        Any chance of a tweak to use:
>
> GParamSpec*
> gtk_widget_class_find_style_property (GtkWidgetClass *klass,
>                                      const gchar    *property_name)

Well, I know next to nothing about GTK so can't speak to
implementation.  Using a version check was just the first thing I
thought of, and I saw other instances n the same module.  Even if the
implementation stinks using it was easy enough :-)

But sure, here's two alternative patches (both avoiding gtk_check_version):

(a) Direct use of gtk_widget_class_find_style_property in lieu of the
version check.
(b) Installation of the property if missing during initialization , so
the original code can remain unchanged.

(a) is a more conservative change, but (b) feels a little nicer in
terms of less overhead and redundant queries in actual operation.  But
I suppose adding a property could have more side-effects than I've
imagined.  Both patches work for me, tested under GTK 2.12.9 and
2.24.4.

it actually feels like more of this code should be able to be hoisted
to a less frequent spot (initialization or something), since I can't
imagine how often the properties change value during run-time?  But I
doubt it's a performance bottleneck.

One other curiosity - GTK 2.24.4 actually uses a value of 0.80 for
arrow-scaling, but I can absolutely say that the arrows are nowhere
near 0.80 of the menu font, and using 0.80 under GTK 2.12 looks
ridiculously large.  I've actually dropped my default of 0.5 to 0.4 as
it more accurately matches 2.24 (plus the prior LO 3.4 on my 2.12
system).  I think I actually liked 0.5 a little better myself, but
figure trying to match existing behavior should win.  I'm guessing
being 1/2 of the 0.8 property value isn't a coincidence, so there must
be some other scaling going on under the covers somewhere under 2.24
since obviously this code uses the scaling factor the same way in both
cases.

-- David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gtk-submenu-a.patch
Type: application/octet-stream
Size: 1322 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120319/570af88a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gtk-submenu-b.patch
Type: application/octet-stream
Size: 1140 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120319/570af88a/attachment-0001.obj>


More information about the LibreOffice mailing list