Cosmetic bug: rectangular white outline surrounding rounded buttons

Bug #195929 reported by Conn O Griofa
50
Affects Status Importance Assigned to Milestone
Mozilla Firefox
Fix Released
Medium
clearlooks (Ubuntu)
Invalid
Low
Unassigned
Hardy
Invalid
Undecided
Unassigned
Intrepid
Invalid
Low
Unassigned
firefox (Ubuntu)
Won't Fix
Undecided
Unassigned
Hardy
Won't Fix
Undecided
Unassigned
Intrepid
Won't Fix
Undecided
Unassigned
gtk2-engines-murrine (Ubuntu)
Fix Released
Low
Unassigned
Hardy
Fix Released
Undecided
Unassigned
Intrepid
Fix Released
Low
Unassigned
ubuntulooks (Ubuntu)
Fix Released
Low
Unassigned
Hardy
Fix Released
Undecided
Unassigned
Intrepid
Won't Fix
Low
Unassigned

Bug Description

Ubuntu release: Hardy (fresh install from Alpha5 desktop cd, all updates as of February 26th)
System: Dell Inspiron 510m laptop
Graphics subsystem: VGA compatible controller: Intel Corporation 82852/855GM Integrated Graphics Device (rev 02)

Rounded GTK+ buttons are rendered with a rectangular white outline, most noticeable in the new Firefox 3.0 Beta 3 release when browsing Gmail (not not limited to this site). I am attaching two small screenshots; one of the "Archive" button while using the "Ubuntulooks" theme, and the same button while using "Clearlooks". You may need to zoom the images as I cropped them in order to avoid personal information being exposed.

Steps to reproduce:
1. Ensure Ubuntulooks theme is active
2. Open Firefox 3, navigate to http://mail.google.com and log in to your account
3. Observe the "Archive" and "Report spam" buttons against the blue background.
4. Change to any other theme installed by default in Ubuntu, and repeat steps 2-3.

Expected results: Buttons have no noticeable outline, or else a thin white outline, rounded at the edges for rounded buttons.

Actual results:
1. For Ubuntulooks theme: Buttons have a white rectangular outline, creating noticeable white marks at the edges of rounded buttons.
2. For all other themes installed by default: results are as expected (above)

Note: This is most likely not a Firefox 3 or core GTK+ bug, as all other themes besides Ubuntulooks work as expected.

Revision history for this message
In , Michael-monreal+moz (michael-monreal+moz) wrote :

Created attachment 290200
Screenshots

Various screenshots of the problem. For websites, you can take http://www.schierer.org/~luke/log/ as a testcase (see the login fields).

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

There's really nothing we can do here except turn off native themes for HTML, or better, have the GTK theme authors fix their themes.

Revision history for this message
In , Michael-monreal+moz (michael-monreal+moz) wrote :

Robert: can you explain a bit more? What is "wrong" with Clearlooks? If there is something that can be done at the GTK theme level, I am sure it will be done. After posting that bug I had a look at the current WebKit/GTK and found the exact same problem there...

Revision history for this message
In , Ventnor-bugzilla (ventnor-bugzilla) wrote :

This is indeed the doing of GTK theme engines. After all the hard work that has been done it would be a big shame to turn off native HTML themes, so I think we should push this forward anyway in the hope that theme authors will fix this. Because if we don't push this forward then theme authors will have no incentive to fix this.

Revision history for this message
In , Michael-monreal+moz (michael-monreal+moz) wrote :

I fully agree with you. Even with broken themes, the widgets look great in about 95% of all cases (luckily most webpages are black-on-white or at least dark-on-bright).

I only wonder, do theme authors actually know about this issue? If they are not fully aware, I'll make sure they get their attention to this ;)

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

I agree, I was wrong to turn off HTML themes before, we just have to ship them and wait for GTK theme authors to fall into line.

Any attention you can draw to this issue would be helpful :-).

The basic issue here is that theme authors assume that widgets are being drawn on top of the theme's designated window background color (in the case of your screenshot, white). So they often draw borders and bevels using that background color around the outside of the widget. This gives the results you see.

Basically theme authors need to stop making assumptions about the window background color and try to make their themes look good no matter what that background color is. This is hard in some cases but in other cases it's simply a matter of using transparency instead of drawing the window background color as part of the widget.

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

Just so things are clear, I am the current maintainer of gtk-engines.

This is a lot an issue that is a lot more complex than just "using transparency instead of drawing the window background color as part of the widget". We *need* to draw the background color in a lot of cases (GtkEntry, GtkProgressBar)! And I certainly would have removed all this if it was possible.

I don't want to go into too much detail here, but I would not be suprised if this is not fixable in GTK+. (I have not investigated this possibility too much.)

So this means the only way to achieve the correct behaviour would be to somehow work together and hint the engine/theme that filling the background is not necessary.

(Hm, I shouldn't missuse this bug to complain, but I do not like mozillas GTK+ emulation stuff in some ways. For example you could at least give the GtkWindow or the GtkFixed a name with gtk_widget_set_name to make it possible to create sane special cases for mozilla.)

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

Oh, the checkbox thing can be considered a theme bug. Alpha blending is perfectly possible in this case.

Revision history for this message
In , Ventnor-bugzilla (ventnor-bugzilla) wrote :

Sorry Benjamin but I don't think there is a lot we can do. I'm trying to be a good player by following GTK's code as much as possible, but as a web browser with much more cases to consider than a typical application we don't really have a choice but to emulate GTK rather than use it. Even native browsers such as IE and Safari emulate their widgets rather than use the typical API's, so I'm told by Roc.

(In reply to comment #7)
> (Hm, I shouldn't missuse this bug to complain, but I do not like mozillas GTK+
> emulation stuff in some ways. For example you could at least give the GtkWindow
> or the GtkFixed a name with gtk_widget_set_name to make it possible to create
> sane special cases for mozilla.)
>

We might be able to do this though.

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

(In reply to comment #7)
> Just so things are clear, I am the current maintainer of gtk-engines.

Welcome to the party :-)

> This is a lot an issue that is a lot more complex than just "using
> transparency instead of drawing the window background color as part of the
> widget".

Sure.

> We *need* to draw the background color in a lot of cases (GtkEntry,
> GtkProgressBar)!

I believe you, but why is that?

> I don't want to go into too much detail here, but I would not be suprised if
> this is not fixable in GTK+. (I have not investigated this possibility too
> much.)

That depends on how much you are willing to change GTK+ or the themes, I guess, since it's possible to design themes that don't show these problems.

> So this means the only way to achieve the correct behaviour would be to
> somehow work together and hint the engine/theme that filling the background
> is not necessary.

Interesting. Can you say more about how that might work?

> (Hm, I shouldn't missuse this bug to complain, but I do not like mozillas GTK+
> emulation stuff in some ways. For example you could at least give the
> GtkWindow or the GtkFixed a name with gtk_widget_set_name to make it possible
> to create sane special cases for mozilla.)

That's a good idea, but I would call it something more like "HTML" because Webkit/GTK+ is using this code too.

What other suggestions do you have?

One thing I really want is the ability to pass a cairo_t directly down to a theme at least for those themes that draw using cairo. Right now when we have to draw a widget with rotation or scale, or to a non-X surface (printing), we have to use horrible hacks involving temporary pixmaps. When the widget is partially transparent the hacks are even more horrible.

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :
Download full text (3.5 KiB)

(In reply to comment #10)
> > This is a lot an issue that is a lot more complex than just "using
> > transparency instead of drawing the window background color as part of the
> > widget".
>
> Sure.
>
> > We *need* to draw the background color in a lot of cases (GtkEntry,
> > GtkProgressBar)!
>
> I believe you, but why is that?

The problem with the GtkEntry is that it consists of two X windows (one around everything, and one for the text area). Both of these windows are filled with base[NORMAL], ie. the background color for the text. So to get the rounded look we need to fill the background with the correct color.

The progress bar case would may be easier to fix. The problem here is that GTK+ caches the bar (without text) in a server side pixmap. I do not know what the reason for doing this is, however it means that we need to fill the background to prevent displaying uninitilized memory.

> > I don't want to go into too much detail here, but I would not be suprised if
> > this is not fixable in GTK+. (I have not investigated this possibility too
> > much.)
>
> That depends on how much you are willing to change GTK+ or the themes, I guess,
> since it's possible to design themes that don't show these problems.

As just mentioned, the core problem is in GTK+. Both the back buffer, and the second window should not always be necessary. The problem I see is that the API/ABI stability might be broken in some cases. (Or eg. themes get broken if the background is not filled with base[NORMAL] anymore in the entry.)

> > So this means the only way to achieve the correct behaviour would be to
> > somehow work together and hint the engine/theme that filling the background
> > is not necessary.
>
> Interesting. Can you say more about how that might work?

Not sure. It may work by attaching extra data to the widget. Or having a certain widget path.

> > (Hm, I shouldn't missuse this bug to complain, but I do not like mozillas GTK+
> > emulation stuff in some ways. For example you could at least give the
> > GtkWindow or the GtkFixed a name with gtk_widget_set_name to make it possible
> > to create sane special cases for mozilla.)
>
> That's a good idea, but I would call it something more like "HTML" because
> Webkit/GTK+ is using this code too.
>
> What other suggestions do you have?

Not sure right now. I'll need to think about the problem again, and look at the mozilla code.
Oh, one thing that strikes me as rather weird is that IIRC a GtkInvisible is used to get the default colors for the HTML page. This could be handled better by using this "HTML" container widget (whatever it is).

> One thing I really want is the ability to pass a cairo_t directly down to a
> theme at least for those themes that draw using cairo. Right now when we have
> to draw a widget with rotation or scale, or to a non-X surface (printing), we
> have to use horrible hacks involving temporary pixmaps. When the widget is
> partially transparent the hacks are even more horrible.

Yeah, I remember seeing the GTK+ bug.

Not sure how this may work. I do not know that much about GDK internals. This would either require changing the engine API, or special GDK code that is able t...

Read more...

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

I think the way to go would be to extend the engine API to provide additional entry points that take cairo_t parameters. I don't know how practical that is.

> The problem with the GtkEntry is that it consists of two X windows (one around
> everything, and one for the text area). Both of these windows are filled with
> base[NORMAL], ie. the background color for the text. So to get the rounded
> look we need to fill the background with the correct color.

It seems to me that in this case the outside window should be transparent instead of being prefilled with the text background color. Maybe that doesn't make sense for a GdkDrawable API but it would make sense for cairo_t API.

Another option is that using cairo, it is possible to draw with OPERATOR_SOURCE or OPERATOR_CLEAR and "knock out" some pixels, making them transparent or translucent where they're currently opaque. So it would be possible to actually make the area outside the rounded border transparent even if it started off with a solid color.

> The progress bar case would may be easier to fix. The problem here is that
> GTK+ caches the bar (without text) in a server side pixmap. I do not know
> what the reason for doing this is, however it means that we need to fill the
> background to prevent displaying uninitilized memory.

cairo would fix this again because you could cache an RGBA surface instead of a pixmap. (Actually the RGBA surface would be an XRender pixmap.)

So it seems to me that GTK+ should move towards a cairo-based API for theme engines, then these problems can be fixed on the GTK+ side and we can have a better interface for our needs too.

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

(In reply to comment #12)
> I think the way to go would be to extend the engine API to provide additional
> entry points that take cairo_t parameters. I don't know how practical that is.

There are some 20 darwing functions, but only 12 slots left to add more funtions to GtkStyle. So it is not possible to just add a second set of functions to engines.

> > The problem with the GtkEntry is that it consists of two X windows (one around
> > everything, and one for the text area). Both of these windows are filled with
> > base[NORMAL], ie. the background color for the text. So to get the rounded
> > look we need to fill the background with the correct color.
>
> It seems to me that in this case the outside window should be transparent
> instead of being prefilled with the text background color. Maybe that doesn't
> make sense for a GdkDrawable API but it would make sense for cairo_t API.
>
> Another option is that using cairo, it is possible to draw with OPERATOR_SOURCE
> or OPERATOR_CLEAR and "knock out" some pixels, making them transparent or
> translucent where they're currently opaque. So it would be possible to actually
> make the area outside the rounded border transparent even if it started off
> with a solid color.

GTK+ does not use windows with an alpha channel by default. Also wouldn't this need a working composition manager? What about older X versions and the different backends (directfb, windows, osx)?

> > The progress bar case would may be easier to fix. The problem here is that
> > GTK+ caches the bar (without text) in a server side pixmap. I do not know
> > what the reason for doing this is, however it means that we need to fill the
> > background to prevent displaying uninitilized memory.
>
> cairo would fix this again because you could cache an RGBA surface instead of a
> pixmap. (Actually the RGBA surface would be an XRender pixmap.)

Hm, using an RGBA pixmap should work, yes.

> So it seems to me that GTK+ should move towards a cairo-based API for theme
> engines, then these problems can be fixed on the GTK+ side and we can have a
> better interface for our needs too.

True, that would be nice (though it would not fix these kind of problems for free, would it?). However, while breaking the engine API is possible in general, I don't expect it to happen very soon.

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

> Also wouldn't this need a working composition manager?

Yeah, or else the window makeup of GtkEntry would need to change.

> though it would not fix these kind of problems for free, would it?

No...

I don't expect it to happen quickly either.

> There are some 20 darwing functions, but only 12 slots left to add more
> funtions to GtkStyle.

We could have a single entry point with a struct parameter packaging all the state that's needed to draw any widget. There are some advantages to doing that from our point of view; our theme drawing API also has a single entry point for drawing, with the widget type as a parameter.

Revision history for this message
In , Reed Loden (reed) wrote :

*** Bug 404643 has been marked as a duplicate of this bug. ***

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

OK, lets get on the topic of the entry and progress bar issues. The current situation is that engine needs to work around GTK+ limitations. I have now opened bugs about that, but I am not sure whether these can even be fixed in the 2.x release cycle because of API compatibility (especially the progress bar issue).

http://bugzilla.gnome.org/show_bug.cgi?id=513471
http://bugzilla.gnome.org/show_bug.cgi?id=513476

(I have not talked to the GTK+ devs about this suggestion, just those bugs ...)

My suggestion is that you attach a boolean with g_object_set_data, and then engine tries to read this boolean. If it is non-zero it can leave out the background clearing. My suggestion for the name of the data would be "gtk-engine-hint-transparent-bg" or something similar.
I would modify the (most popular) engines in gtk-engines to test for the data. Other popular engines probably would pick up such a workaround pretty fast I expect. (Oh, and I'll would put the workaround in the Sugar engine :-))
Please note that this will *not* work for pixmap themes. And even when GTK+ is fixed, every single one of those would need to be updated.

I do not have a better idea to work around this problem in the short term. This solution would not be noticed by other engines, and works without fixing GTK+. In the long term fixing GTK+ is of course the right thing to do.

The nice thing for me about such a workaround is that as soon as GTK+ is fixed I could just drop the engine code again right away.

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

That sounds like a good suggestion for the short term.

Revision history for this message
In , Frnchfrgg (frnchfrgg) wrote :

I added the painting of the base[NORMAL] or base[INSENSITIVE] color behind text entries to correct the rendering in bug 415494; if we want to have the possibility to avoid drawing this background, we want to get info from the theme that it doesn't break if the background is not filled. The main problem is that engines currenlty don't expect the widget to be filled with the default background, but with the current entry background. Apart from clearlooks which always paint the background as part of the shadow, every other gtk-engine breaks if this filling hasn't happened. On a dark background it means a bug more visible that just not rounded corners.

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

Darn, that means that my first idea does not work out. Here just some random ways of doing it:

 1. Subclass GtkEntry (and other widgets if needed) and add a style property specifically for mozilla
 2. Let the engine attach data to the style
 3. Wait for something in GTK+

Not sure what would be best right now. It seems to me that more complex workarounds are too intrusive to be feasable.

Revision history for this message
Conn O Griofa (psyke83) wrote :

Ubuntu release: Hardy (fresh install from Alpha5 desktop cd, all updates as of February 26th)
System: Dell Inspiron 510m laptop
Graphics subsystem: VGA compatible controller: Intel Corporation 82852/855GM Integrated Graphics Device (rev 02)

Rounded GTK+ buttons are rendered with a rectangular white outline, most noticeable in the new Firefox 3.0 Beta 3 release when browsing Gmail (not not limited to this site). I am attaching two small screenshots; one of the "Archive" button while using the "Ubuntulooks" theme, and the same button while using "Clearlooks". You may need to zoom the images as I cropped them in order to avoid personal information being exposed.

Steps to reproduce:
1. Ensure Ubuntulooks theme is active
2. Open Firefox 3, navigate to http://mail.google.com and log in to your account
3. Observe the "Archive" and "Report spam" buttons against the blue background.
4. Change to any other theme installed by default in Ubuntu, and repeat steps 2-3.

Expected results: Buttons have no noticeable outline, or else a thin white outline, rounded at the edges for rounded buttons.

Actual results:
1. For Ubuntulooks theme: Buttons have a white rectangular outline, creating noticeable white marks at the edges of rounded buttons.
2. For all other themes installed by default: results are as expected (above)

Note: This is most likely not a Firefox 3 or core GTK+ bug, as all other themes besides Ubuntulooks work as expected.

Revision history for this message
Conn O Griofa (psyke83) wrote :
Revision history for this message
Conn O Griofa (psyke83) wrote :
Revision history for this message
Conn O Griofa (psyke83) wrote :

Update:

Since gtk2-engines-murrine is now installed by default in Hardy, I can confirm that the bug is present with this engine too.

Revision history for this message
Andrea Cimitan (cimi) wrote :

I have no idea why sometimes works and sometimes not.
I CC myself to this bug.

Also svn release seems affected.

Revision history for this message
Andrea Cimitan (cimi) wrote :

Fixed in murrine, next release will ship that fix.
http://svn.gnome.org/viewvc/murrine?view=revision&revision=24

Changed in gtk2-engines-murrine:
assignee: nobody → cimi
status: New → Fix Committed
Murat Gunes (mgunes)
Changed in gtk2-engines-murrine:
importance: Undecided → Low
Changed in ubuntulooks:
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Murat Gunes (mgunes) wrote :

The issue is also present with Clearlooks.

Changed in clearlooks:
importance: Undecided → Low
Revision history for this message
Andrea Cimitan (cimi) wrote :

no Murat, the issue with clearlooks is different, and can be fixed in another way, but I won't fix it for many reasons.
In any case, this is another bug

Revision history for this message
Conn O Griofa (psyke83) wrote :

Since hardy is at feature freeze, I'm not sure if murrine will get updated. If it doesn't, this is the patch necessary to apply against hardy's gtk2-engines-murrine 0.53.1-1ubuntu1 source. Many thanks for this, Cimi!

Revision history for this message
Murat Gunes (mgunes) wrote :

Andrea, thanks for the feedback; I'm closing the clearlooks task, but I'll file a separate bug in the clearlooks source package, since the issue persists, regardless of whether it will be fixed at this point. Could you cite the rationale there?

Changed in clearlooks:
status: New → Invalid
Revision history for this message
Conn O Griofa (psyke83) wrote :

...And here's the patch for ubuntulooks. Can the maintainer please check this patch, and include it (as long as it's ok)? On my system rounded buttons are now displaying properly after applying this patch to the source.

Revision history for this message
Murat Gunes (mgunes) wrote :

Conn, you can follow the process listed at https://wiki.ubuntu.com/FreezeExceptionProcess to request an exception. If the decision is to ship Murrine by default, the fix should go in.

Revision history for this message
Conn O Griofa (psyke83) wrote :

Murat, thanks for the information. I'll file a request, but there's still work to be done.

These patches fix buttons, but text input boxes appear to still exhibit the problem in Firefox 3. I'm investigating.

Revision history for this message
Conn O Griofa (psyke83) wrote :

The problem now seems to be with GtkEntry widgets. Observe the following cropped image from slashdot.org's login pane, taken while using murrine compiled with the patch I posted earlier. As you can see, "Nickname" and "Password" exhibit the same problem, but the "Log in" button does not (thanks to the patch).

I'm not certain what needs to be fixed, but *all* theme engines I have tried have this problem with GtkEntry boxes - Clearlooks, Ubuntulooks, Nodoka, Aurora... so perhaps it's a problem with Firefox. Therefore, I'm adding Firefox to the list of affected packages so it can get attention by the Mozilla folks.

From the duplicate here on launchpad, here's the upstream bug: https://bugzilla.mozilla.org/show_bug.cgi?id=329846#c45

Also, in the ubuntulooks source I noticed this, can it be related? I commented this section out, and the surrounding of GtkEntry boxes got corrupt, and active tabs became black...

File: ubuntulooks-0.9.12/engine/src/ubuntulooks_style.c, line 79

 /* I want to avoid to have to do this. I need it for GtkEntry, unless I
    find out why it doesn't behave the way I expect it to. */
 if (widget)
  ubuntulooks_get_parent_bg (widget, &params->parentbg);

Revision history for this message
Andrea Cimitan (cimi) wrote :

The GtkEntry is drawn in that way due to draw_gtkentry, it fills the background...

I'm not sure if that code can be removed.

Revision history for this message
Conn O Griofa (psyke83) wrote :

We should keep an eye on this bug: https://bugzilla.mozilla.org/show_bug.cgi?id=405421

Changed in firefox:
status: Unknown → Confirmed
Revision history for this message
Bruce Cowan (bruce89-deactivatedaccount) wrote :

This is a duplicate of #180962.

Revision history for this message
Conn O Griofa (psyke83) wrote :

I'm currently creating an alternative theme for consideration in Hardy, but I want to bring your attention to a crude workaround I've included. See: http://ubuntuforums.org/showthread.php?t=715530

Basically, for GtkEntry and GtkCombo* boxes, I set the roundness to 0, in order to minimize the appearance of the ugly outline at the edges. We need a better fix.

Revision history for this message
Bruce Cowan (bruce89-deactivatedaccount) wrote :

I give in.

Revision history for this message
Murat Gunes (mgunes) wrote :

Strangely, I'm experiencing this with Murrine SVN on Hardy as well.

Revision history for this message
Murat Gunes (mgunes) wrote :

Cimi, could you explain why you won't fix it in Clearlooks? The outcome of the upstream bug report seems to suggest that this should be fixed in the theme engines.

Revision history for this message
Bruce Cowan (bruce89-deactivatedaccount) wrote :

I don't think the GNOME theme maintainers would add a hack to work around Mozilla's problems.

Revision history for this message
Conn O Griofa (psyke83) wrote :

Bruce,

If you took a look at the patches, you'd see that "hacks" already existed in the theme engines' code (in Murrine and Ubuntulooks, at least) specifically for Firefox 2. Removing said hacks fixes the problem with button borders (GtkButton) but not text boxes (GtkEntry) in Firefox 3.

Since Firefox 3 will be the default for Hardy (an LTS release), I can see the necessity to fix this cosmetic issue, even if it requires another "hack" (that can be well-commented, and removed in the future).

Revision history for this message
Bruce Cowan (bruce89-deactivatedaccount) wrote :

I wouldn't mind so much if it meant that only the browser widgets were made non-round, but doing that globally is a bad idea.

Revision history for this message
Conn O Griofa (psyke83) wrote :

Bruce,

I think you're misunderstanding the issue. The patches in this bug report do not change the button roundness in any themes; if the theme specifies squares widgets, they will remain square.

The purpose of these patches are to remove unnecessary *rectangular* white borders surrounding GtkButton and GtkCombo widgets. These white borders are always rectangular, no matter what the "roundness" or "radius" (murrine and clearlooks, respectively) value specifies in the theme's gtkrc file. It just so happens that this issue is more noticeable with rounded themes (which accounts for our default Human theme and Human-Murrine, among others).

Revision history for this message
Conn O Griofa (psyke83) wrote :

A little update.

I have been testing Fedora rawhide and noticed that their "nodoka" gtk engine (originally based on murrine, I believe) uses the same fix as I posted in this bug for Ubuntulooks and Murrine (originally found by Andrea Cimitan). The issue with GtkEntry boxes is more complicated and will require cooperation from the Mozilla and GTK folks, so it's out of our hands.

What I do recommend is that the maintainers of the gtk2-engines-murrine and gtk2-engines-ubuntulooks packages will review and include the patches.

Changed in gtk2-engines-murrine:
status: Fix Committed → Triaged
Changed in gtk2-engines-murrine:
milestone: none → ubuntu-8.04
Revision history for this message
In , Dolske (dolske) wrote :

*** Bug 427031 has been marked as a duplicate of this bug. ***

Revision history for this message
Alexander Sack (asac) wrote : Re: [Bug 195929] Re: Cosmetic bug: rectangular white outline surrounding rounded buttons
  • unnamed Edit (827 bytes, application/pgp-signature; name="signature.asc")

On Thu, Apr 17, 2008 at 04:55:05AM -0000, Brian Murray wrote:
> ** Changed in: gtk2-engines-murrine (Ubuntu)
> Target: None => ubuntu-8.04
>

firefox itself wont see a fix for this. lets go for the theme engine ...

 affects ubuntu/firefox
 status wontfix

 - Alexander

Changed in firefox:
status: New → Won't Fix
Steve Langasek (vorlon)
Changed in gtk2-engines-murrine:
milestone: ubuntu-8.04 → ubuntu-8.04.1
Revision history for this message
Andrea Cimitan (cimi) wrote :

Can't be fixed without ugly code I guess, so I won't fix it nor in Clearlooks neither in Murrine :)
If someone will come with a patch (and a sane approach) I'm sure I will take it in mind and maybe apply on both engines.

Changed in gtk2-engines-murrine:
assignee: cimi → nobody
milestone: ubuntu-8.04.1 → none
Revision history for this message
Conn O Griofa (psyke83) wrote :

Brian,

I'm sorry, but why has the target milestone been removed? Andrea is referring to GtkEntry widgets needing a hack to fix, but the patches in the report fixes GtkButton cases, and it is not a hack (in fact, the fix is to remove an obsolete hack).

Fedora have applied the same fix to GtkButton cases with their own "Nodoka" engine, by the way. We should do the same.

Revision history for this message
In , Dolske (dolske) wrote :

*** Bug 387036 has been marked as a duplicate of this bug. ***

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

I know that entries are broken, etc. But bug 387036 suggests that buttons are broken, and I don't see any reason for them to be. They can be fully transparent in normal GTK+, so either the theme or mozilla is doing something wrong there.

Revision history for this message
In , Thomas Dybdahl Ahle (lobais) wrote :

The only broken buttons are those in the top and bottom of the scrollbar.

Revision history for this message
Alexander Sack (asac) wrote : Re: [Bug 195929] Re: Cosmetic bug: rectangular white outline surrounding rounded buttons

On Fri, May 23, 2008 at 12:01:48PM -0000, Conn wrote:
> Brian,
>
> I'm sorry, but why has the target milestone been removed? Andrea is
> referring to GtkEntry widgets needing a hack to fix, but the patches in
> the report fixes GtkButton cases, and it is not a hack (in fact, the fix
> is to remove an obsolete hack).
>
> Fedora have applied the same fix to GtkButton cases with their own
> "Nodoka" engine, by the way. We should do the same.
>

Can you give a quick summary what we should actually do for hardy?
what packages would be involved in those changes and how intrusive are
those changes?

 - Alexander

Revision history for this message
Conn O Griofa (psyke83) wrote :

Alexander,

Take a look at two shots taken from Firefox 3 on http://slashdot.org. The first shows the widgets rendered by the default (unpatched) Human theme using the Ubuntulooks engine, and and second shot shows the patched engine. Note that the same problem exists for the Murrine engine, but there's no need for duplicate shots.

As you can see in the unpatched engine, there is a white rectangular border surrounding widgets, giving them an ugly appearance on a non-white or non-grey background. Even though buttons are rounded in the Human theme, this rectangular border looks ugly even if the button radius/roundness is set to 0 in a theme's gtkrc.

The patched engine fixes GtkButton widgets (see the "Log in" button in the picture), but not GtkEntry widgets, unfortunately. We need to wait for a fix in Firefox and/or GTK for GtkEntry cases. See Firefox upstream's bug here: https://bugzilla.mozilla.org/show_bug.cgi?id=405421

Andrea Cimitan found an old workaround specific for earlier Firefox versions in his Murrine engine, as evident from the comment in the code: "// Fix some firefox crap.". Andrea has fixed this upstream, but has not backported the change to Hardy's version. I posted the proper patch for Hardy's gtk2-engines-murrine in comment #8. I also checked the Ubuntulooks and found the identical hack present in the code, so I uploaded a patch in comment #10 for Hardy's gtk2-engines-ubuntulooks package.

In summary, this is the action I propose to take:
For Hardy: apply the patches to gtk2-engines-murrine (comment #8) and gtk2-engines-ubuntulooks (comment #10).

For Intrepid: Kenneth Wimer has already packaged Murrine from SVN, so no patch is necessary. Kenneth also mentioned that he plans to remove gtk2-engines-ubuntulooks and the Human theme, replacing it with his new dark theme and a newer version of Human-Murrine that I sent to him, both of which will use the Murrine engine. Therefore, no patches are necessary for Intrepid, but we should keep an eye on the upstream Firefox issue.

Revision history for this message
Conn O Griofa (psyke83) wrote :
Revision history for this message
Alexander Sack (asac) wrote :

On Thu, Jun 05, 2008 at 11:58:34PM -0000, Conn wrote:
> In summary, this is the action I propose to take:
> For Hardy: apply the patches to gtk2-engines-murrine (comment #8) and gtk2-engines-ubuntulooks (comment #10).
>
> For Intrepid: Kenneth Wimer has already packaged Murrine from SVN, so no
> patch is necessary. Kenneth also mentioned that he plans to remove gtk2
> -engines-ubuntulooks and the Human theme, replacing it with his new dark
> theme and a newer version of Human-Murrine that I sent to him, both of
> which will use the Murrine engine. Therefore, no patches are necessary
> for Intrepid, but we should keep an eye on the upstream Firefox issue.
>

Ken, could you take a look at the proposed hardy changes, sign them
off and if suitable prepare SRU updates for the engines affected?

Thanks,

 - Alexander

Revision history for this message
Alexander Sack (asac) wrote :

The other question is if this is actually suitable for a SRU. I'd say no for now.

Revision history for this message
Kenneth Wimer (kwwii) wrote :

Reading https://wiki.ubuntu.com/StableReleaseUpdates seems to indicate that this issue is not serious enough to warrant an SRU. Unless someone says otherwise, of course ;-)

Revision history for this message
Alexander Sack (asac) wrote :

On Tue, Jun 10, 2008 at 05:51:16AM -0000, Kenneth Wimer wrote:
> Reading https://wiki.ubuntu.com/StableReleaseUpdates seems to indicate
> that this issue is not serious enough to warrant an SRU. Unless someone
> says otherwise, of course ;-)
>

Yes, this might have qualified as a polishing bug for the 8.04.1
development effort, but given that we are mostly frozen for that
release, I dont consider this to qualify as a SRU.

 - Alexander

Revision history for this message
Conn O Griofa (psyke83) wrote :

Alexander & Ken,

Would it not fall under the category of MicroReleaseExceptions? https://wiki.ubuntu.com/StableReleaseUpdates/MicroReleaseExceptions

If you read Firefox's upstream bug, there is some confusion as to why GtkButton cases exhibit this bug, and the reason for that confusion is that a hack (yes, it's a hack) is present in the gtk engines. I was pushing for this to be fixed before 8.04 release as I figured that users would not appreciate being stuck with ugly widgets in Firefox for an LTS release.

It doesn't matter so much to me, as I'm already testing Intrepid, so I guess we can drop the issue. ;)

Revision history for this message
Kenneth Wimer (kwwii) wrote :

I have never heard of a micro-exception before (nor have I done an SRU previously). I am a artist/designer who is learning to do packaging (and due to my position in the company is now responsible for all this fun!). I'll ask around and see what comes out of it.

Kenneth Wimer (kwwii)
Changed in gtk2-engines-murrine:
status: Triaged → Fix Committed
Changed in ubuntulooks:
status: Triaged → Fix Committed
Revision history for this message
Martin Pitt (pitti) wrote :

Ken says that ubuntulooks is going away in intrepid, so this doesn't need to be fixed there.

Changed in clearlooks:
status: New → Invalid
Changed in firefox:
status: New → Won't Fix
Changed in ubuntulooks:
status: New → In Progress
status: Fix Committed → Won't Fix
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gtk2-engines-murrine - 0.53.1+svn20080529-0ubuntu2

---------------
gtk2-engines-murrine (0.53.1+svn20080529-0ubuntu2) intrepid; urgency=low

  * Add 02_fix-firefox-buttons.patch: Fix rectangular white outline
    surrounding rounded buttons. (LP: #195929)

 -- Kenneth Wimer <email address hidden> Fri, 13 Jun 2008 12:57:43 +0200

Changed in gtk2-engines-murrine:
status: Fix Committed → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote :

Previous intrepid upload was bogus, of course; I reverted the patch.

Revision history for this message
Martin Pitt (pitti) wrote :

gtk2-engines-murrine for hardy uploaded and in the queue. Waiting for Steve to accept (or his ack to do so), since we are in 8.04.1 freeze.

Changed in gtk2-engines-murrine:
status: New → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

ubuntulooks 0.9.12-12/hardy with the fix for this uploaded and in the queue. Waiting for Steve to accept (or his ack to do so), since we are in 8.04.1 freeze.

Revision history for this message
Steve Langasek (vorlon) wrote :

Looks acceptable to me, including for SRU, but not of a high enough priority that we should break the 8.04.1 freeze for this. I'm ok with accepting it into -proposed once we're done needing to use -proposed for 8.04.1 ISO builds; how will we go about verifying that this SRU hasn't introduced regressions in any apps other than firefox?

Revision history for this message
Kenneth Wimer (kwwii) wrote :

Not sure how to get it tested properly...I have been running this for a week or so and there is no noticeable difference (other than the positive bug fix). In addition, nobody else in-on this bug has noticed any negative effects (although I am not sure how many have tested it).

Revision history for this message
Martin Pitt (pitti) wrote :

Accepted into -proposed, please test and give feedback here. Please see https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in gtk2-engines-murrine:
status: In Progress → Fix Committed
Changed in ubuntulooks:
status: In Progress → Fix Committed
Revision history for this message
Uphaar Agrawalla (uphaar) wrote :

I can confirm with the update the outline has disappeared on Gmail.

Revision history for this message
Samuel Lidén Borell (samuellb) wrote :

I'm using the updated version now and buttons look as they're supposed to look like, and I haven't encountered any new problems so far.

Revision history for this message
Martin Pitt (pitti) wrote :

Copied hardy-proposed version to hardy-updates and intrepid.

Changed in ubuntulooks:
status: Fix Committed → Fix Released
status: Fix Committed → Fix Released
Changed in gtk2-engines-murrine:
status: Fix Committed → Fix Released
Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

Would a patch to add a style property be acceptable? This sounds like the sanest option to me right now.

The largest chunk of code would be the code required to create the subclasses (I guess that we will need one for GtkEntry, and another one for GtkProgressBar.) The style property could just be called "transparent-bg-workaround" or something similar.

Revision history for this message
In , Ventnor-bugzilla (ventnor-bugzilla) wrote :

I think a part of the code already provides an opportunity for workarounds. Every single form widget that Mozilla uses is a child of a window with the name "MozillaGtkWidget". I'm wondering if that would be enough to allow themers to provide workarounds.

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

Michael, yes this does help. However it does *not* help at least in the GtkEntry case.

However, please read comment #18 (which references bug #415494) carefully. Mozilla itself is filling the whole are with a base[NORMAL] background. Which means that there is no way of having transparency.
(It is correct that doing this is much closer to what GTK+ does.)

So basically you have two choices:
 1. Ignore bug #415494 and do not fill in the background. Then a good way to figure this out from the engine. (The MozillaGtkWidget may be enough.)
 2. Add a style property (or similar) that will cause both Mozilla *and* the engine/theme not to fill in the background.

In the end, neither Mozilla nor the theme/engine is allowed to fill the background.

A style property can easily be checked in both the engines and mozillas drawing code. (Will need a change in many themes, but it is one line, and does not harm if a hack like this is not needed anymore.)

Revision history for this message
nandhp (nandhp) wrote :

This bug appears to have been fixed for buttons, but I'm still seeing this problem on text inputs and textarea like the ones in this comment form.

I'm running Ubuntu hardy, Human theme.

Revision history for this message
Conn O Griofa (psyke83) wrote :

nandhp,

Please read the comments of the bug report before reporting, this subject has been discussed. At this time it is not possible to fix textinput/combobox widgets without patching Firefox *and* GTK - the linked upstream bug discusses this.

The patches applied by this bug only fix button cases.

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

Created attachment 331118
Add style properties to GtkEntry and GtkProgressBar

This patch adds a style property to GtkEntry and GtkProgressBar. Together with this patch and some changes in the sugar theme and engine, I have gotten entries to work correctly.

Note: This patch should not go in as is. It would be better to not add a style property to standard GTK+ widgets, but instead to subclass them. I was just not sure where to place the code to create the new class. It will also require some hacks for the comboboxentry.

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

Created attachment 331151
Add a style property, and attach data to the widgets.

OK. This uses a different approach. Instead of just using a style property, it uses a style property, and then attaches data to the widget to hint the engine that the background is transparent.

The approach means:
 1. The check inside the engine is trivial. Webkit can also easily use the same hint to the engine. (Checking the style property is a bit more complicated.)
 2. The style property toggles how well Mozilla emulates GTK+, so that the background can be transparent.
 3. The style property can be attached to the normal GtkEntry. There is no need to subclass GtkEntry. Subclassing GtkEntry would create a pain for the combobox as we would need to replace the normal GtkEntry with the custom subclass.
 4. Pixmap based themes can use special match lines to achieve the same thing, as they are not able to read out the hint from mozilla. (Though special cases for each of mozilla, webkit and whatever else may be needed in this case.)

Revision history for this message
In , Frnchfrgg (frnchfrgg) wrote :

I like this idea, but why the need to hint the engine that the background is transparent ? Why not make the style property mean "engine doesn't need background pre-filling", and then the engine would just paint whatever is needed to get correct rendering without assuming the background color is the base_gc one... I mean, the engine knows that it may encounter non filled backgrounds, since it set the style property.

OK, somebody could probably set the style property in the theme gtkrc or something, with an engine that doesn't support it, but hey, people doing stupid things shouldn't be rewarded...

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

Please note that the engine does *not* set the style property. The theme does.

First of all the patch does not subclass GtkEntry, so the engine needs to know that it is drawing an entry from mozilla, and not a normal one.
IE. depending on how the theme sets the style property, doing so will affect all GtkEntries. However, a normal GtkEntry will always need the background filled by the engine. So just getting the style properties value is not enough.

The nice thing about attaching a bit of data is that it is trivial to check in the engine. Also the same mechanism works fine for the progress bar.
(It is even easier then testing a style property as one needs to check if the style property exists first.)

(I don't care about the case where the style property is set and the engine does not support it.)

Revision history for this message
In , Frnchfrgg (frnchfrgg) wrote :

Yes, the theme sets the style property, but a theme setting this property and using an engine which gives garbled output when the bg isn't prefilled deserves to look broken in Firefox, IHMO.

And a normal GtkEntry doesn't need the background filled by the engine, it is the other way around: a normal GtkEntry fills the background (ok it's not explicitely filled, it's the inner widget default bg) before calling the engine... Some engines, like thinice, expect that and look broken if it isn't done, whereas some others (like Clearlooks) don't, since they fill with the base color the parts they need to be filled, without caring about the widget being already filled or not.

But I understand what you want to say: when there is a normal GtkEntry, themes with rounded corners need to draw the dialog color onto the base color to simulate rounded corners, and that part can be skipped if the engine knows that the bg hasn't really been filled... So then (and only then), the engine doesn't draw those pixels (or doesn't fill the widget with the dialog color), and thus can have really transparent rounded corners.

In short: an engine can hint a GtkEntry painter (Gecko/safari or vanilla GTK, I don't know of others, but why not) that it can cope with, and would prefer non-prefilled GtkEntries, but it needs to know if the hint has been obeyed to know if it needs to "pseudo-undo" the prefilling to get round corners.

Am I right ?

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

Yes, that is correct.

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

Instead of filled-bg-workaround, which I find rather vague, would it make more sense to call it honors-transparent-bg-hint?

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

Hm, I am not sure about honors-transparent-bg-hint. A pixmap theme is not able to read out the hint, but could still set the style property and get better theming by special casing on the "MozillaGtkWidget" name.

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

No, I mean it would still be a style property, but just change the name to honors-transparent-bg-hint (which would be parsed as honors-(transparent-bg-hint))

Revision history for this message
In , Frnchfrgg (frnchfrgg) wrote :

Also, I don't think it's usefull to re-set each time the info that we'll do transparent bg, if we call it "can-do-transparent-bg" or "honnors-transparent-bg-hint". Just set this data on the widget at ensure_*() time.

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

OK, I am fine with the style property name change.

FrnchFrgg, I decided to reset the name every time in case of a theme change. So if there is some mechanism that ensures that a theme change is picked up then that is probably better.

Revision history for this message
In , Ventnor-bugzilla (ventnor-bugzilla) wrote :

Created attachment 332094
Patch 2

If this approach is good, then I'll take this bug and address the name change. I also added more descriptive comments about why we need this.

Since moz_gtk_entry_paint is abstract and caters for many different entry-type widgets, I found it saves a lot of code by setting the transparent-bg-hint thing everytime the widget is drawn, and I don't think the performance saving of making this only happen during theme change is enough to justify the code it would need. Setting a boolean on a GObject should be a pretty fast op anyway.

Changed in firefox:
status: Confirmed → In Progress
Revision history for this message
In , Frnchfrgg (frnchfrgg) wrote :

>diff -r d47ed12b70fc widget/src/gtk2/gtk2drawing.c
>--- a/widget/src/gtk2/gtk2drawing.c Sun Aug 03 00:41:32 2008 +0200
>+++ b/widget/src/gtk2/gtk2drawing.c Sun Aug 03 13:17:51 2008 +1000
>@@ -533,6 +533,8 @@ ensure_progress_widget()
> if (!gProgressWidget) {
> gProgressWidget = gtk_progress_bar_new();
> setup_widget_prototype(gProgressWidget);
>+ g_object_set_data(G_OBJECT(gProgressWidget),
>+ "transparent-bg-hint", TRUE);

Why do you set this data on the progress widget ?
And I don't agree that the tradeoff is good when setting the boolean at paint time. And even at paint time, it could/should be set unconditionnally, since it means "I obey to the transparent bg style property".

I would prefer that the boolean would be set to true at ensure() time, which means there would be 3 or 4 calls instead of one, granted, but also means it would be called 3 or 4 times, not each time we draw. The ensure() functions are called again when the objects have changed under us anyway, because the pointers are set to NULL at this time (it was needed for us not crashing at theme change).

See also comment below for naming.

>+ gtk_widget_class_install_style_property(entry_class,
>+ g_param_spec_boolean("honors-transparent-bg-hint",

You got the naming wrong, the style property is a mean for the theme to ask Gecko to not draw the bg, while the data set on the widget means that we obeyed the hint (currently) or that we can obey the hint (what I propose). My understanding is consistent with the description of the property:

>+ "Transparent BG enabling flag",
>+ "If TRUE, do not fill the background of widgets, so effects like rounded corners are done correctly.",

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

_FrnchFrgg_, about the progress bar. We *need* the same hint for the engine here too, as the progress bar has a similar problem.

"honors-transparent-bg-hint" was the style property name that roc suggested.

Revision history for this message
In , Frnchfrgg (frnchfrgg) wrote :

I don't want to speak for roc, but he may have confused the "style property" and the "widget property" when typing, at least, that's how I read it.

Anyway, "honors-transparent-bg-hint" makes no sense if it's the style property, which is used by the theme to ask gecko to ommit the background painting. On the contrary, it is a good name for the widget property, used by gecko to tell the theme it honored (or it can honor) the transparent bg hint.

As for the progressbar, you cannot just set the "I honor the style property" to true, if you don't really honor it, which means it has been added also to the progress bar class, and we effectively obey it.

Which brings be to the point that we probably should create a style property for a generic widget, if that's possible, and check for it every time we fill a background ourselves before calling the engine. Then we could set the "honors-transparent-bg-hint" on every of our widgets in setup_widget_prototype (and manually when we don't use it).

roc, what do you think about that ?

One last remark, I'd like to have a review by Benjamin, and a review by me before the superreview from Robert. Alternatively, I takeover the bug since I have ideas for it, and then ask for r to Benjamin and Michael, and sr from roc.

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

(In reply to comment #41)
> I don't want to speak for roc, but he may have confused the "style property"
> and the "widget property" when typing, at least, that's how I read it.

I understood the honor as in: "I, the theme, hereby tell you that the engine 'honors' the 'transparent-bg-hint'". With this knowledge gecko does not fill the background and everyone is happy.

The hint from gecko the engine means:
"You are drawing directly on top of the canvas. There is no need to initilize the background or undo any filling done by GTK+/gecko."

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

Comment #42 is what I was thinking.

Revision history for this message
In , Ventnor-bugzilla (ventnor-bugzilla) wrote :

FrnchFrgg, if you believe you have time to take over this bug, please feel free. I still don't really understand what approach everyone wants to take, but I can still do a code review :-)

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

+ "Transparent BG enabling flag",
+ "If TRUE, do not fill the background of widgets, so effects like rounded corners are done correctly.",

This text should be updated to reflect comment #42.

+ g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", TRUE);

I think we should do this unconditionally. The style property check should only be used to control whether we call gdk_draw_rectangle to draw the background in Gecko.

Revision history for this message
In , Frnchfrgg (frnchfrgg) wrote :

So the style propery would mean "I can manage if you don't draw the background" and the widget data would mean "I won't paint the background if you can manage it". So Gecko asks for a transparent bg, and the theme tells it can handle that, for the naming I proposed it's the other way around. Either way suits me.

But I'm not really sure that the names are self-explanatory enough. Perhaps a "can-handle-transparent-background" ? The good thing is that naming doesn't affect the logic of the patch.

I'll take the bug, and write a patch along the lines of comment #41, modulo the naming which I will take from comment #42.

If that doesn't suit you, speak or be silent forever :)

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

(In reply to comment #45)
> + g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", TRUE);
>
> I think we should do this unconditionally. The style property check should only
> be used to control whether we call gdk_draw_rectangle to draw the background in
> Gecko.

I disagree here, the "transparent-bg-hint" should only be set if the engine is drawing directly on the canvas. This is not the case if Gecko fills in the background.

(In reply to comment #46)
> I'll take the bug, and write a patch along the lines of comment #41, modulo the
> naming which I will take from comment #42.

I am not sure I understood everything from comment #41 :-)

However, I do not see any advantage in registering the style property on GtkWidget (so that it exists on all widgets). AFAIK a style property is only needed for GtkEntry.

Changed in firefox:
status: In Progress → Confirmed
Revision history for this message
In , Frnchfrgg (frnchfrgg) wrote :

> I disagree here, the "transparent-bg-hint" should only be set if the engine is
> drawing directly on the canvas. This is not the case if Gecko fills in the
> background.

The engine can test if the style property is present. Whatever seems to be the most sane I will do.

> (In reply to comment #46)
> > I'll take the bug, and write a patch along the lines of comment #41, modulo the
> > naming which I will take from comment #42.
>
> I am not sure I understood everything from comment #41 :-)
>
> However, I do not see any advantage in registering the style property on
> GtkWidget (so that it exists on all widgets). AFAIK a style property is only
> needed for GtkEntry.

Apart from the naming part, comment 41 was telling that we shouldn't set the data on the widget if we aren't sure that we effectively can draw directly on the canvas. And that we shouldn't set this data only on entries or progress bars, but on every widget we can draw (while ensuring that the data isn't lying). If progressbar rendering is already "transparent-safe", good (but I hope that no theme relies on the progressbar being opaque).

As for registering the style property on GtkWidget, if it's absolutely sure that we won't need it on other widgets, and that it's not a problem if a theme tries to set the property when it's non-existent, no problem with me.

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

(In reply to comment #48)
> The engine can test if the style property is present. Whatever seems to be the
> most sane I will do.

It is a pain to test the style property in the engine. This is because I first need to check whether it does exist (or else all GTK+ applications spew thousands of warnings).

> > (In reply to comment #46)
> Apart from the naming part, comment 41 was telling that we shouldn't set the
> data on the widget if we aren't sure that we effectively can draw directly on
> the canvas. And that we shouldn't set this data only on entries or progress
> bars, but on every widget we can draw (while ensuring that the data isn't
> lying). If progressbar rendering is already "transparent-safe", good (but I
> hope that no theme relies on the progressbar being opaque).

The engine needs the hint to know that it does not need to fill in the background. It should only be read by engines for for this one purpose in my oppinion.

> As for registering the style property on GtkWidget, if it's absolutely sure
> that we won't need it on other widgets, and that it's not a problem if a theme
> tries to set the property when it's non-existent, no problem with me.

Any style property that is set but does not exist is silently ignored.

Revision history for this message
In , Frnchfrgg (frnchfrgg) wrote :

> The engine needs the hint to know that it does not need to fill in the
> background. It should only be read by engines for for this one purpose in my
> oppinion.

I was only saying that the hint to the engine that it doesn't need to cover the already painted background mustn't be lying. And that I hope that no themes rely on the progressbar being a non transparent widget, or else we would need to prepaint the base color (unless we know by the hint that it isn't needed).

Question: Should we prepaint the background with the expected bg color for all widgets, since I think that widgets in GTK aren't transparent ? This would mean probably a prepainting done for every widget, before the calls to separate painting functions, and of course subject to the style property test. Which would mean that we would create the style property on GtkWidgetClass.

The real question is probably: currently we special-cased the text entry because I found real engines which were broken by us not pre-painting the background. But it seems too narrow, and indeed we are not sure at all that it is the only widget requiring this pre-paint. Was this special casing an error, and would it be saner to just simulate the non-transparency of gtk widgets (unless the engine tells us it can cope with non-prefilled widgets) ?

roc ?

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

I'm getting confused by these extra comments. Comment #42 is completely clear to me and exactly what I want.

(In reply to comment #47)
> I disagree here, the "transparent-bg-hint" should only be set if the engine is
> drawing directly on the canvas. This is not the case if Gecko fills in the
> background.

OK, I accept that.

Let's restrict this bug to text entries for now. Extending the approach to all widgets would have a performance cost. Let's only do it if there's a clear need (or if GTK theme people tell us it's the right thing to do).

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

Hrm, sorry if I helped generating some confusion. (Though I also got confused by some comments :-))

(In reply to comment #50)
> I was only saying that the hint to the engine that it doesn't need to cover the
> already painted background mustn't be lying. And that I hope that no themes
> rely on the progressbar being a non transparent widget, or else we would need
> to prepaint the base color (unless we know by the hint that it isn't needed).

Agreed. I don't think any theme is relying on the progressbar to be filled or anything.

> The real question is probably: currently we special-cased the text entry
> because I found real engines which were broken by us not pre-painting the
> background. But it seems too narrow, and indeed we are not sure at all that it
> is the only widget requiring this pre-paint. Was this special casing an error,
> and would it be saner to just simulate the non-transparency of gtk widgets
> (unless the engine tells us it can cope with non-prefilled widgets) ?

The special case for the entry is completely correct. And most GTK+ widgets are transparent.

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

If someone modifies "Patch 2" so that the description text in the call to gtk_widget_class_install_style_property is more accurate, I'm ready to r+ the patch.

Revision history for this message
In , Ventnor-bugzilla (ventnor-bugzilla) wrote :

Should "transparent-bg-hint" be unconditionally set to true in the ensure functions? If it is ignored anyway by themes that don't honour it, it shouldn't really matter right? (This has probably been suggested before)

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

No, see comment #47.

Revision history for this message
In , Frnchfrgg (frnchfrgg) wrote :

We shouldn't settle for patch 2, IMHO.
We should set the data to true on every widget we keep, (with setup_widget_prototype and the like), because we want to advertise that all our widgets are transparent (apart from the entry which will be only if the style property is set, as it is in patch 2).

As for my other questions, I agree that it would be too much of a performance cost to prepaint every widget, especially since we don't know any real life engine bitten by this transparency. I had to raise the problem, but Benjamins answer is reassuring.

I'd go with this approach: we advertise that we paint directly on the canvas for every widget but the entry (ultra cheap, and most engines would probably ignore the info), and the entry is transparent only if we know the engine can cope with it.

I'll write the patch soon (like in less than 24 hours).

Revision history for this message
In , Frnchfrgg (frnchfrgg) wrote :

Created attachment 332569
Patch v3

Essentially this patch is the same as patch 2, but with the comments adapted to match what was decided, and the indication that we don't pre-fill for each widget we may pass to the theme engine. This indication is still dynamically updated for the entry.

What's missing is that there is another widget for which we prefill, in *_tab_paint(). We currently need to prepaint behind the "gap", because in some engines the box_gap() is transparent. We probably need to give our notebook a similar treatement than our entries.

I didn't spot any other widget for which we prepaint anything.

Benjamin, what do you think ?

Revision history for this message
In , Ventnor-bugzilla (ventnor-bugzilla) wrote :

Comment on attachment 332569
Patch v3

Code-wise this is fine by me. I'll leave the decisions on the overall approach to roc/benjamin.

Revision history for this message
In , Roc-ocallahan (roc-ocallahan) wrote :

Comment on attachment 332569
Patch v3

I'm OK with this if Benjamin is.

Revision history for this message
In , Frnchfrgg (frnchfrgg) wrote :

I just noticed that Network Managed is bitten by this very problem: they put progress bars into a menu, and when the menu is selected, the rounded corners are bright visible, since they stay at the unselected color.

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

Sorry that I did not think about this earlier. But can moz_gtk_init be called multiple times (eg. on a theme change)? If yes, then we should check for the style property before registering, or a warning will be printed by GTK+.
(All that would be needed is a call to gtk_widget_class_find_style_property.)

There is one small thing, that I want to say, but feel free to ignore me if you think differently ;-) (ie. you get r+ anyways)
You are setting the hint on all widgets. I do see some advantages, but I also see a disadvantage. And that is that it may be abused by engine writers to special case gecko, instead of using it only in the way that it is intended.

So r+ from me, but please check the moz_gtk_init thing before landing.

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

Oh, I am not able to modify the attachment status, so I cannot give review+ there :-)

Revision history for this message
In , Reed Loden (reed) wrote :

(In reply to comment #62)
> Oh, I am not able to modify the attachment status, so I cannot give review+
> there :-)

You can now. :)

Revision history for this message
In , Frnchfrgg (frnchfrgg) wrote :

moz_gtk_init isn't called again on theme change.

Engine writers can special-case gecko, sure, but they can also with the
"MozillaGtkWidget" name, so I don't really see why they would choose the bad
way over the good. And I hope that when some program decides to paint a widget
itself (for example NetworkManager may want to do that to get a good look on
hover), it can use the same hint; so this hint won't stay a good indicator that
it's gecko.

It's strange that you can't even grant a review you've been asked for...

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

Comment on attachment 332569
Patch v3

OK, so here we go.

Yeah, the same hint should also be used by other applications :-)

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

In case anyone is interested, the following gtk-engines bugs are about the whole issue:

http://bugzilla.gnome.org/show_bug.cgi?id=546839
 Implement the workaround that is part of this bug (so that I don't forget)

and:
http://bugzilla.gnome.org/show_bug.cgi?id=475293
 Is a clearlooks bug about making widgets handle a transparent background better.

Revision history for this message
In , Dao (dao) wrote :
Changed in firefox:
status: Confirmed → Fix Released
Revision history for this message
In , Alfredkayser (alfredkayser) wrote :

Could it be that this patch has caused bug 452385 ?
Bookmark This Page panel hangs Firefox when -moz-border-radius is used.

Revision history for this message
In , Frnchfrgg (frnchfrgg) wrote :

I'd say it has nothing to do with it, but I'll test when I have time. Feel free to try with a custom build with and without this patch.

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

It seems rather impossible to me that the patch here creates any problems. Also if the description of bug 452385 is correct, then the bug is on Windows XO, and I do not think anyone is using GTK+ on there :-).

Revision history for this message
In , Alfredkayser (alfredkayser) wrote :

Ah, I didn't see that this bug is for GTK.

Revision history for this message
In , Alexander Sack (asac) wrote :

Any risk taking this on the 1.9.0 branch?

Revision history for this message
In , Ventnor-bugzilla (ventnor-bugzilla) wrote :

The question is whether GNOME did their bit for the 2.24 release.

If so, taking this patch shouldn't be of any risk.
If not, there's no point since 3.1 will be out before the next GNOME release anyway.

Revision history for this message
In , BenjaminBerg (benjamin-sipsolutions) wrote :

The entry workaround is in gtk-engines 2.16.0 (which is part of GNOME 2.24).

Some widgets still have a broken shadow, but the GNOME 2.24 does use the feature that is introduced by this bug.
(ie. http://bugzilla.gnome.org/show_bug.cgi?id=475293 is still open)

Revision history for this message
In , Ventnor-bugzilla (ventnor-bugzilla) wrote :

Comment on attachment 332569
Patch v3

Very well then, let's give it a go.

Revision history for this message
In , Reed Loden (reed) wrote :

dveditz: It would be nice if you would give a reason for minusing an approval flag...

Revision history for this message
In , Dveditz (dveditz) wrote :

Sorry, don't know why I didn't. "Doesn't meet new branch approval criteria -- not a security fix, topcrash, or fix for a regression from one of those". Minor polish fixes can go into the next release, and from comment 73 it wasn't clear this would have any effect anyway.

Changed in firefox:
importance: Unknown → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.