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

2012-03-20 Thread Michael Meeks
Hi David,

On Mon, 2012-03-19 at 17:48 -0400, David Bolen wrote:
> Even if the implementation stinks using it was easy enough :-)

:-)

> (a) Direct use of gtk_widget_class_find_style_property in lieu of the
> version check.

This looks really nice.

> (a) is a more conservative change, but (b) feels a little nicer in
> terms of less overhead and redundant queries in actual operation.

Heh - so, gtk+ spends it's life doing string lookups all over the
place, and the overhead is negligible compared to what the client side
rendering is going to do with your CPU ;-)

> 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.

Yep - looks nice.

> 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.

Thanks for unwinding all that and the nice fix, I think Petr picked it
and it should be in 3.5.2.

Any other gtk+ theming nasties annoying you ? :-)

All the best !

Michael.

-- 
michael.me...@suse.com  <><, Pseudo Engineer, itinerant idiot

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2012-03-19 Thread David Bolen
On Mon, Mar 19, 2012 at 5:59 AM, Michael Meeks  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


gtk-submenu-a.patch
Description: Binary data


gtk-submenu-b.patch
Description: Binary data
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2012-03-19 Thread Michael Meeks
Hi David,

On Sun, 2012-03-18 at 22:08 -0400, David Bolen wrote:
> Using LO 3.5.x on a system with GTK < 2.15.0 loses all the sub-menu
> icons, because there is no menu item arrow-scaling property until
> then, so the code introduced in commit 948c14ee appears to scale the
> arrows to 0%.  

Ah - good catch; thanks for that ! :-)

> I realize that's a pretty old GTK version, but I ran into this on my
> Ubuntu 8.04 LTS system (GTK 2.12.9) and assume there are some others
> (like RHEL) that will have older versions for a while.  Plus, the
> requirements page on the LO web site still lists GTK 2.10 as the
> requirement.

Right - lots of other people will hit this no doubt.

> Attached is a small patch that restores the arrow icons when running
> against GTK < 2.15.0, essentially by picking an arbitrary (but
> reasonable in my tests) default scaling.  I also check before
> attempting to retrieve the arrow-scaling style to avoid a bunch of GTK
> runtime warning messages, but it works fine too if only the default
> scaling line is changed since GTK doesn't change the variable contents
> for an unknown style.

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)

To see if that property is there by name ? which would make that
perhaps more readable in future ? We'd need to use GTK_WIDGET_GET_CLASS
to get the class. Hopefully with that we can get it into
libreoffice-3-5-2 :-)

Many thanks !

Michael.

-- 
michael.me...@suse.com  <><, Pseudo Engineer, itinerant idiot

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2012-03-18 Thread David Bolen
Using LO 3.5.x on a system with GTK < 2.15.0 loses all the sub-menu icons,
because there is no menu item arrow-scaling property until then, so the
code introduced in commit 948c14ee appears to scale the arrows to 0%.

I realize that's a pretty old GTK version, but I ran into this on my Ubuntu
8.04 LTS system (GTK 2.12.9) and assume there are some others (like RHEL)
that will have older versions for a while.  Plus, the requirements page on
the LO web site still lists GTK 2.10 as the requirement.

Attached is a small patch that restores the arrow icons when running
against GTK < 2.15.0, essentially by picking an arbitrary (but reasonable
in my tests) default scaling.  I also check before attempting to retrieve
the arrow-scaling style to avoid a bunch of GTK runtime warning messages,
but it works fine too if only the default scaling line is changed since GTK
doesn't change the variable contents for an unknown style.

-- David


gtk-submenu-icon.patch
Description: Binary data
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice