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 478886 - Window borders tinted pink
Window borders tinted pink
Status: RESOLVED NOTGNOME
Product: metacity
Classification: Other
Component: themes
2.20.x
Other All
: Normal trivial
: ---
Assigned To: Metacity maintainers list
Metacity maintainers list
: 460023 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-09-21 09:29 UTC by Thomas Zajic
Modified: 2008-12-04 04:26 UTC
See Also:
GNOME target: ---
GNOME version: 2.19/2.20


Attachments
Pink preview (Clearlooks) (49.16 KB, image/png)
2007-09-21 09:33 UTC, Thomas Zajic
  Details
Pink preview (Glider, Glossy) (44.43 KB, image/png)
2007-09-21 09:33 UTC, Thomas Zajic
  Details
Pink preview (SmoothGNOME) (37.56 KB, image/png)
2007-09-21 09:34 UTC, Thomas Zajic
  Details
Pink theme variants (Clearlooks) (50.30 KB, image/png)
2007-09-21 09:34 UTC, Thomas Zajic
  Details
Pink theme variants (Glider, Glossy) (43.57 KB, image/png)
2007-09-21 09:35 UTC, Thomas Zajic
  Details
Pink theme variants (SmoothGNOME) (48.79 KB, image/png)
2007-09-21 09:35 UTC, Thomas Zajic
  Details
Scrollbars, button and selection highlights are okay (60.29 KB, image/png)
2007-09-21 09:37 UTC, Thomas Zajic
  Details
selected_bg_color #0000ff (32.71 KB, image/png)
2007-09-30 20:44 UTC, Thomas Zajic
  Details
selected_bg_color #0000fc (32.87 KB, image/png)
2007-09-30 20:44 UTC, Thomas Zajic
  Details
selected_bg_color #00ff00 (33.06 KB, image/png)
2007-09-30 20:45 UTC, Thomas Zajic
  Details
selected_bg_color #00fc00 (33.37 KB, image/png)
2007-09-30 20:45 UTC, Thomas Zajic
  Details
selected_bg_color #9dc9ff (34.21 KB, image/png)
2007-09-30 20:46 UTC, Thomas Zajic
  Details
selected_bg_color #9bc7fc (34.10 KB, image/png)
2007-09-30 20:47 UTC, Thomas Zajic
  Details
Possible fix (647 bytes, patch)
2007-10-19 20:43 UTC, Thomas Zajic
none Details | Review
Darklooks colored window borders (190.26 KB, image/png)
2008-04-01 16:40 UTC, Martin Ejdestig
  Details

Description Thomas Zajic 2007-09-21 09:29:11 UTC
Please describe the problem:
In several themes, the (Metacity) window borders have a pinkish tint (like a vertical gradient) going from bottom to top, both in the theme preview and in the actual windows. All the rest of the theme components is ok (for example, all tabs, scrollbars, button highlights, selection highlights etc. are blue in Clearlooks).

I'll attach a view screenshots to illustrate the problem, it's pretty obvious when you see it. You'll notice that, for example, the Glider and SmoothGNOME windows have their proper colors on the bottom window border, and end up with an ugly pink tint on the top window border.

Version info: gtk-2.12.0, engines-2.12.0, gnome-themes-2.20.0, metacity-2.20.0, gnome-control-center-2.12.0, all self-compiled on Slackware 12.0. Please let me know if you need anything else.

Feel free to reassign the bug to the proper GNOME component, as I have no idea who/what is actually causing this.

Steps to reproduce:
1. Start gnome-appearance-properties.
2. Select any of the Clearlooks, Glider, or Glossy themes.
3. Shock! Horror! Pink window borders!


Actual results:
Pink ugliness.

Expected results:
Blue beauty.

Does this happen every time?
Yes, unfortunately.

Other information:
Comment 1 Thomas Zajic 2007-09-21 09:33:05 UTC
Created attachment 95938 [details]
Pink preview (Clearlooks)
Comment 2 Thomas Zajic 2007-09-21 09:33:42 UTC
Created attachment 95939 [details]
Pink preview (Glider, Glossy)
Comment 3 Thomas Zajic 2007-09-21 09:34:04 UTC
Created attachment 95940 [details]
Pink preview (SmoothGNOME)
Comment 4 Thomas Zajic 2007-09-21 09:34:47 UTC
Created attachment 95941 [details]
Pink theme variants (Clearlooks)
Comment 5 Thomas Zajic 2007-09-21 09:35:14 UTC
Created attachment 95943 [details]
Pink theme variants (Glider, Glossy)
Comment 6 Thomas Zajic 2007-09-21 09:35:36 UTC
Created attachment 95944 [details]
Pink theme variants (SmoothGNOME)
Comment 7 Thomas Zajic 2007-09-21 09:37:17 UTC
Created attachment 95945 [details]
Scrollbars, button and selection highlights are okay
Comment 8 Thomas Zajic 2007-09-21 09:41:35 UTC
Oops - gnome-control-center is 2.20.0, of course, not 2.12.0.
Comment 9 Andrea Cimitan 2007-09-22 12:45:46 UTC
Just for you?
Probably you've something wrong in ~/.gtkrc-2.0
Comment 10 Thomas Zajic 2007-09-22 13:19:57 UTC
I'm the only user on my PC. I do however have a "gnome" test user account on the same PC, which is affected just the same way, even after I completely wipe out its home directory before logging in. Here's my ~/.gtkrc-2.0:

[zlatko@disclosure]:~$ cat .gtkrc-2.0
# -- THEME AUTO-WRITTEN DO NOT EDIT

include "/home/zlatko/.gtkrc-2.0.mine"
# -- Appended by GNOME Configurator
include ".gtkrc-2.0-scrollbar_cog"

[zlatko@disclosure]:~$ cat .gtkrc-2.0.mine
gtk-can-change-accels = 1
gtk-entry-select-on-focus = 1
gtk-theme-name = "Clearlooks"
gtk-icon-theme-name = "Tango"

# GAIM
binding "pidgin-bindings"
{
# enter inserts a newline
bind "Return" { "insert-at-cursor" ("\n") }
# ctrl-enter sends message
 bind "<ctrl>Return" { "message_send" () }
}
widget "*pidgin_conv_entry" binding "pidgin-bindings"

[zlatko@disclosure]:~$ cat .gtkrc-2.0-scrollbar_cog 
[zlatko@disclosure]:~$ 

Do you have any idea where else I could/should start looking? I'm pretty much at a loss here.
Comment 11 Aleksander Kamil Modzelewski 2007-09-30 15:36:14 UTC
Appearance properties -> Customize -> Colors?
Comment 12 Thomas Zajic 2007-09-30 20:14:42 UTC
The colors are all at their default values, ie. the "reset to default" button is greyed out. If it was something low-level like this (ie. a bug in either GTK itself or gtk-engines, or some "leftovers" in a stray gtkrc somewhere), I'd guess that all other GTK controls (scrollbars, button highlights, shaded tabs, etc.) would be pink as well - but they aren't. It's *only* Metacity's window borders that are affected, as you can see in the screenshots.

What I found out meanwhile is that unless the HSV "V" value of the theme's selected_bg_color is 100, whatever color I pick gets a red tint. This happens even if I select a primary color, ie. blue (#0000ff) or green (#00ff00). These values are fine, and the window border colors are shown properly - but as soon as I change V to 99 instead of 100 (ie. #0000fc or #00fc00), the window borders turn plain red. The same happens if I mix two primary colors, ie. yellow (#ffff00 is fine, #fcfc00 is not) or cyan (#00ffff is fine, #00fcfc is not). It does *not* happen with magenta, though (both #ff00ff and #fc00fc are fine). OTOH, if I take Clearlook's default selected_bg_color (#86abd9) and crank up the HSV "V" value to 100 (#9dc9ff), then the window borders are actually blue instead of pink - but if I drop the "V" value only one notch to 99 (#9bc7fc), the window borders are all pink again.

I'll attach another set of screenshots to illustrate my findings.
Comment 13 Thomas Zajic 2007-09-30 20:44:34 UTC
Created attachment 96431 [details]
selected_bg_color #0000ff
Comment 14 Thomas Zajic 2007-09-30 20:44:58 UTC
Created attachment 96432 [details]
selected_bg_color #0000fc
Comment 15 Thomas Zajic 2007-09-30 20:45:19 UTC
Created attachment 96433 [details]
selected_bg_color #00ff00
Comment 16 Thomas Zajic 2007-09-30 20:45:44 UTC
Created attachment 96434 [details]
selected_bg_color #00fc00
Comment 17 Thomas Zajic 2007-09-30 20:46:31 UTC
Created attachment 96435 [details]
selected_bg_color #9dc9ff
Comment 18 Thomas Zajic 2007-09-30 20:47:01 UTC
Created attachment 96436 [details]
selected_bg_color #9bc7fc
Comment 19 Benjamin Berg 2007-09-30 21:23:19 UTC
So the hue information is getting lost somewhere and replaced with 0 in a lot of cases, that is weird ... maybe some shading bug inside metacity?
Comment 20 Thomas Zajic 2007-09-30 23:06:33 UTC
Just found another quite strange thing, which hints to a bug in gnome-appearance-properties, or more specifically in its way of interpreting and/or saving of the /desktop/gnome/interface/gtk_color_scheme gconf key. It somehow seems to duplicate (?) every byte of the color's RGB value - after setting Clearlooks' selected_bg_color to #9DC9FF (that's the default value with "V" cranked up to 100), here's what it looks like:

[zlatko@disclosure]:~$ gconftool-2 -g /desktop/gnome/interface/gtk_color_scheme
fg_color:#000000000000
bg_color:#ededececebeb
text_color:#1a1a1a1a1a1a
base_color:#ffffffffffff
selected_fg_color:#ffffffffffff
selected_bg_color:#9e15c9bbffff
tooltip_fg_color:#000000000000
tooltip_bg_color:#f5f5f5f5b5b5

Note that the actual color values according to Clearlooks' gtkrc which comes with gtk-engines should be #000 (#000000?), #edeceb, #1a1a1a, #fff (#ffffff? #0f0f0f? #fff000? #000fff? How does GTK actually interpret these 3-digit color definitions? The color selection dialog only allows "#" plus exactly 6 hex digits, so I can't actually tell ...), #fff, #9dc9ff (that's the one I modified), #000 and #f5f5b5. With selected_bg_color set to #9BC7FC ("V" = 99), it looks like this:

[zlatko@disclosure]:~$ gconftool-2 -g /desktop/gnome/interface/gtk_color_scheme
fg_color:#000000000000
bg_color:#ededececebeb
text_color:#1a1a1a1a1a1a
base_color:#ffffffffffff
selected_fg_color:#ffffffffffff
selected_bg_color:#9b9bc7c7fcfc
tooltip_fg_color:#000000000000
tooltip_bg_color:#f5f5f5f5b5b5

Still, I have no idea how this leads to the ugly pink I'm seeing (which lies somewhere between #d1xxxx and #e2xxxx according to GTK's own color picker), but something's definitely fishy here. Unfortunately gnome-appearance-properties deletes the gtk_color_scheme key if I hit the "reset to defaults" button, so I can't tell which values it sees with the unmodified default Clearlooks color scheme.

If any of this contains some dead giveaway (that I as a non-developer fail to properly recognize) as to where exactly the problem lies, feel free to reassign this bug to the proper GNOME component. Right now I suspect either gnome-appearance-properties for saving an invalid color definition value in the gtk_color_scheme key, or, if these 12-hex-digit color values are actually valid, metacity for not interpreting them properly.


PS: there's definitely something wrong with the color value saving. If I change the "V" value back to 100 again (ie. default -> "V"=100 -> "V"=99 -> "V"=100", the gconf key is different than before (selected_bg_color:#9e15c9bbffff -> #9e14c9bbffff), although gnome-appearance-properties shows the same color value (#9dc9ff) in the color selection dialog:

[zlatko@disclosure]:~$ gconftool-2 -g /desktop/gnome/interface/gtk_color_scheme
fg_color:#000000000000
bg_color:#ededececebeb
text_color:#1a1a1a1a1a1a
base_color:#ffffffffffff
selected_fg_color:#ffffffffffff
selected_bg_color:#9e14c9bbffff
tooltip_fg_color:#000000000000
tooltip_bg_color:#f5f5f5f5b5b5
Comment 21 Jens Granseuer 2007-10-11 17:27:27 UTC
*** Bug 460023 has been marked as a duplicate of this bug. ***
Comment 22 Benjamin Berg 2007-10-11 18:59:22 UTC
The longer 16bit per sample format is completely fine and I don't think this is related to the issue. Metacity never sees the colors set in the gtkrc, or the color scheme setting as it uses the colors from the GtkStyle struct.

I'll reassign the bug to metacity. I do not know whether this is a metacity bug or not, but I don't have any better idea.
Comment 23 Thomas Thurman 2007-10-12 15:24:55 UTC
Gosh, what an interesting-looking bug. I'll have a look over the weekend.
Comment 24 Thomas Zajic 2007-10-12 18:01:14 UTC
Thanks - I'm glad you like my pink bug. :-)

Some random points that may or may not be of importance:

1. I compiled metacity with --enable-compositor, but I'm currently running my X server with compositing turned off (ie. I don't have a line 'Option "Composite" "Enable"' in xorg.conf, and 'xdpyinfo | grep -i comp' is empty).

2. [zlatko@disclosure]:~$ locale | grep NUM
LC_NUMERIC=de_AT.UTF-8
That is, one-point-five is "1,5" in my locale, not "1.5" (GTK+ itself obviously handles it properly, but I thought I'd mention it anyway).

If you need to know anything else, just let me know.
Comment 25 Richard Fuller 2007-10-19 15:44:04 UTC
"What I found out meanwhile is that unless the HSV "V" value of the theme's
selected_bg_color is 100, whatever color I pick gets a red tint."

We're experiencing what sounds like the exact same bug here, using Slackware 12.0. For the title bars to not be shaded pink one of red, green or blue has to be 255, or the red value has to be greater than (not equal to) the green value. If they are shaded pink the brightness of the pink depends on the brightness of the colour selected.

Happens if I compile metacity 2.14.3, 2.18.3, 2.18.5, or 2.2.20.0 on Slackware 12.0. Does not happen if I copy the compiled metacity 2.14.3 package from the Slackware 11.0 system we used last year.
Comment 26 Thomas Zajic 2007-10-19 18:37:07 UTC
Woo-hoo, *finally* - I'm not the only one experiencing this bug! :-)

Your comment about the relation between the red value and the green and blue values reminded me of a code snippet I recently saw in src/theme.c's gtk_style_shade(), rgb_to_hls() and hls_to_rgb(). For starters, I added a few debug statements to print the RGB values in these functions and calculations. And here's the kicker: as soon as I did this, the bug was gone - GONE! My window borders are blue again, exactly like they should be! WTF?

All I did was adding four lines in gtk_style_shade(), I didn't change any of the actual values:

g_debug("ZlatkO-[1234]: GdkColor = %d/%d/%d; red = %f, green = %f, blue = %f; k = %f", a->red, a->green, a->blue, red, green, blue, k);

"ZlatkO-1" is right before the rgb_to_hls() call in gtk_style_shade(), "ZlatkO-2" is right after the call. "ZlatkO-3" is right before the hls_to_rgb() call, "ZlatkO-4" is right after. Here's some snippets of the massive output this produces (not to mention the extreme slowdown when drawing the window borders) in the hopes that the metacity developers get some hint out of it as to where the problem lies - do the color conversions look right (they probably do, or else my window borders would still be pink, I guess)?


(metacity-theme-viewer:2568): metacity-DEBUG: ZlatkO-1: GdkColor = 34438/43947/55769; red = 0,525490, green = 0,670588, blue = 0,850980; k = 0,980000
(metacity-theme-viewer:2568): metacity-DEBUG: ZlatkO-2: GdkColor = 34438/43947/55769; red = 213,253012, green = 0,688235, blue = 0,522013; k = 0,980000
(metacity-theme-viewer:2568): metacity-DEBUG: ZlatkO-3: GdkColor = 34438/43947/55769; red = 213,253012, green = 0,674471, blue = 0,511572; k = 0,980000
(metacity-theme-viewer:2568): metacity-DEBUG: ZlatkO-4: GdkColor = 34438/43947/55769; red = 0,507939, green = 0,656413, blue = 0,841002; k = 0,980000


(metacity-theme-viewer:2568): metacity-DEBUG: ZlatkO-1: GdkColor = 34438/43947/55769; red = 0,525490, green = 0,670588, blue = 0,850980; k = 1,160000
(metacity-theme-viewer:2568): metacity-DEBUG: ZlatkO-2: GdkColor = 34438/43947/55769; red = 213,253012, green = 0,688235, blue = 0,522013; k = 1,160000
(metacity-theme-viewer:2568): metacity-DEBUG: ZlatkO-3: GdkColor = 34438/43947/55769; red = 213,253012, green = 0,798353, blue = 0,605535; k = 1,160000
(metacity-theme-viewer:2568): metacity-DEBUG: ZlatkO-4: GdkColor = 34438/43947/55769; red = 0,676249, green = 0,785113, blue = 0,920457; k = 1,160000


(metacity-theme-viewer:2568): metacity-DEBUG: ZlatkO-1: GdkColor = 60909/60652/60395; red = 0,929412, green = 0,925490, blue = 0,921569; k = 0,450000
(metacity-theme-viewer:2568): metacity-DEBUG: ZlatkO-2: GdkColor = 60909/60652/60395; red = 30,000000, green = 0,925490, blue = 0,052632; k = 0,450000
(metacity-theme-viewer:2568): metacity-DEBUG: ZlatkO-3: GdkColor = 60909/60652/60395; red = 30,000000, green = 0,416471, blue = 0,023684; k = 0,450000
(metacity-theme-viewer:2568): metacity-DEBUG: ZlatkO-4: GdkColor = 60909/60652/60395; red = 0,426334, green = 0,416471, blue = 0,406607; k = 0,450000


(metacity-theme-viewer:2568): metacity-DEBUG: ZlatkO-1: GdkColor = 34438/43947/55769; red = 0,525490, green = 0,670588, blue = 0,850980; k = 0,700000
(metacity-theme-viewer:2568): metacity-DEBUG: ZlatkO-2: GdkColor = 34438/43947/55769; red = 213,253012, green = 0,688235, blue = 0,522013; k = 0,700000
(metacity-theme-viewer:2568): metacity-DEBUG: ZlatkO-3: GdkColor = 34438/43947/55769; red = 213,253012, green = 0,481765, blue = 0,365409; k = 0,700000
(metacity-theme-viewer:2568): metacity-DEBUG: ZlatkO-4: GdkColor = 34438/43947/55769; red = 0,305724, green = 0,462676, blue = 0,657806; k = 0,700000


Too bad I can't use this as a temporary fix - the slowdown is just too massive ... :-/
Comment 27 Thomas Thurman 2007-10-19 18:40:31 UTC
Silly question, perhaps, but did you then try removing those debug lines, recompiling, and trying again?
Comment 28 Benjamin Berg 2007-10-19 18:46:58 UTC
Hmm, maybe a broken optimization in (some versions of) the GCC compiler?
Comment 29 Havoc Pennington 2007-10-19 18:58:16 UTC
Two clues:
 - two same-versioned metacity on Slackware seem to differ (one has bug, one does not)
 - adding print statements fixes it

So, it seems likely to relate to how the compiler is generating code. While I'm not an expert, one possibility is that the floating point registers on x86 are not the same size as a double in memory, so whether a register is used can affect the exact values you get.

Maybe the first step is to track down exactly which lines of code are involved, maybe floats aren't even the problem.
Comment 30 Andrea Cimitan 2007-10-19 19:01:31 UTC
some double/gdouble errors?
Comment 31 Thomas Zajic 2007-10-19 19:24:47 UTC
Thomas: I just did that, and the bug is back - pink window borders all over again.

What I did find out, though, is that having only one of the four debug lines (doesn't matter which one) is enough to "fix" the problem. The slowdown is also greatly reduced this way (duh!), but still quite noticeable.

To put it in very non-technical terms, it almost seems like something has to "touch" or "look at" these values to "make them stick", or else they "somehow get lost", and pink window borders appear.


Benjamin, Havoc: gcc-4.1.2, Intel P4/3.2GHz (single core, hyperthreading), 2.6.22.9 SMP kernel

[zlatko@disclosure]:~$ gcc --version
gcc (GCC) 4.1.2
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[zlatko@disclosure]:~$ cat /proc/cpuinfo 
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 3
model name      : Intel(R) Pentium(R) 4 CPU 3.20GHz
stepping        : 4
cpu MHz         : 3207.494
cache size      : 1024 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe constant_tsc pni monitor ds_cpl cid xtpr
bogomips        : 6416.95
clflush size    : 64

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 15
model           : 3
model name      : Intel(R) Pentium(R) 4 CPU 3.20GHz
stepping        : 4
cpu MHz         : 3207.494
cache size      : 1024 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 5
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe constant_tsc pni monitor ds_cpl cid xtpr
bogomips        : 30913.47
clflush size    : 64


[zlatko@disclosure]:~$ uname -a
Linux disclosure 2.6.22.9 #1 SMP Thu Sep 27 08:11:47 CEST 2007 i686 Intel(R) Pentium(R) 4 CPU 3.20GHz GenuineIntel GNU/Linux


Current GNOME related version info: gtk+-2.12.1, gtk-engines-2.12.2, gnome-themes-2.20.1, metacity-2.20.0.
Comment 32 Havoc Pennington 2007-10-19 19:37:00 UTC
Incidentally, the same code seems to be cut-and-pasted in colors.c, not sure if it's still used. I looked at the gtkstyle.c copy in gtk and it looks the same, so any bugfix should go in all three copies (and/or kill off at least one of the copies...)

One thing to try is adding "volatile," 
  volatile gdouble red;
  volatile gdouble green;
though, I don't think that's really the right fix, it would be interesting if it also makes the problem go away.
Comment 33 Thomas Zajic 2007-10-19 19:50:17 UTC
Seems to be the a->red, a->green and a->blue values that cause the problem - printing only these also works, while printing only the (local) red, green and blue values does not.

Havoc: Add "volatile" where, exactly? In gtk_style_shade(), in rgb_to_hls(), or in both? Why only red and green, but not blue?
Comment 34 Havoc Pennington 2007-10-19 20:02:07 UTC
red and green were just examples. I meant in whatever function you added the print statements to. If the problem seems to be the integers (a->red, etc.) and not the floats though, then I doubt the volatile on the floats will do anything.
Comment 35 Thomas Zajic 2007-10-19 20:41:03 UTC
Ha, gotcha! :-)

I'll attach a patch that fixes the problem for me. It's probably a really bad and evil hack, but hey, my window borders are blue again!

This patch fixes all themes that had the pink tint before (see my screenshots), including *all* the previews in gnome-appearance-properties' Theme -> Customize -> Window Border tab, and *almost* all preview thumbnails in gnome-appearance-properties' Theme tab. Almost? Why, yes, for some strange reason, the preview thumbnails of Industrial-Squared (which is actually an older OpenBox theme, but it comes with a Metacity version as well) and SmoothGNOME still have the pink tint. It's only the preview thumbnail, though, if I actually select the theme, the window border colors are okay. Oh well ...
Comment 36 Thomas Zajic 2007-10-19 20:43:20 UTC
Created attachment 97492 [details] [review]
Possible fix
Comment 37 Havoc Pennington 2007-10-19 20:49:18 UTC
Any theory why that patch works ;-) ??? I'd be pretty reluctant to put it in without an explanation.
Comment 38 Thomas Zajic 2007-10-19 21:05:32 UTC
Nope, I don't have the slightest idea, sorry. It was just something that I tried more or less intuitively ("Well, if gtk_style_shade() screws up a->r/g/b, then I'll only give it a copy of a, that'll teach him!"), and it happened to work.

Given that I own one of exactly two (so far) systems world-wide that happen to be bitten by this strange bug, I simply accept the fact that the fix is just about as strange as the bug itself. :-)
Comment 39 Benjamin Berg 2007-10-19 22:16:22 UTC
Thomas, could you try recompiling with the "-O0" option to disable compiler optimization and see if that fixes it?
Comment 40 Thomas Zajic 2007-10-20 07:43:44 UTC
Done that (export CFLAGS="-O0"), works fine as well. I guess that's a better workaround than my obscure patch - thanks! :-)
Comment 41 Benjamin Berg 2007-10-20 10:09:32 UTC
OK, I assume this is a compiler optimization bug then. Marking as not gnome.
Comment 42 Richard Fuller 2007-10-22 07:51:19 UTC
Just to confirm the same on my system.

Compiling with gcc-4.1.2 with -O1 or -O2 gives the bug. Compiling with gcc-4.1.2 with -O0, or with gcc-3.4.6 and any optimisation level, does not give the bug.
Comment 43 Havoc Pennington 2007-10-22 14:00:55 UTC
fwiw I don't think "it goes away without -O2" means it's a compiler bug. If our code is wrong in certain ways, it can certainly break with optimization and not break without.

However, I certainly don't have a guess why our code is wrong here, so without a compiler expert to help closing the bug is probably fine, at least until/unless this bug starts to turn up for more people.
Comment 44 Thomas Thurman 2007-10-30 11:56:32 UTC
Richard, Thomas: Can you confirm whether this happens with the latest GCC (4.2.2 -- http://gcc.gnu.org/gcc-4.2/ )? If so, I would recommend telling the GCC folks about it (or, if you'd rather, I will), since it's probably a bug that will bite other people in subtle ways. If you don't have time to compile 4.2.2 and test it but you'll give me shell access on a machine that's misbehaving with 4.1.2, I'll give it a go. If you do raise a bug against 4.2.2, please post a link to it here so that people finding this problem can find out what was done about it.
Comment 45 Havoc Pennington 2007-10-30 15:00:06 UTC
gcc devs aren't going to be able to do anything without a simple test case they can compile...
Comment 46 Thomas Zajic 2007-10-31 08:18:46 UTC
Thomas: Yup, same problem with gcc-4.2.2 (self-compiled on Slackware 12.0).

I'd rather not file a GCC bug myself, though, as I simply don't know Metacity's internals enough to be of any help, let alone GCC's. All I actually know about this problem is that "Metacity has pink window borders if I compile it on Slackware 12.0 with either gcc-4.1.2 or gcc-4.2.2, unless I compile it without optimization using '-O0' and/or use an obscure patch I stumbled across by pure accident". I seriously doubt that this would be any motivation for the GCC devs to dig deeper into the problem, especially as there is no actual proof yet that this is in fact a GCC bug. ;-)
Comment 47 Martin Ejdestig 2008-04-01 16:40:24 UTC
Created attachment 108422 [details]
Darklooks colored window borders

It wasn't until I installed gnome-themes-extras with the Darklooks theme (lower left in the Theme tab) that all window borders in the Window Border tab started to be tinted dark.

I don't know if this effects the resolution of this bug, but I find it strange. (I.e. less likely to be a compiler bug... but who knows...)
Comment 48 Neil Jagdish Patel 2008-08-07 09:58:43 UTC
This problem still occurs with:

Metacity 2.22.0
gcc 4.2.3
Ubuntu Hardy 8.04
Intel Diamondville (lpia arch)

Compiling without optimisations or with the gdk_color_copy hack restores the colours.
Comment 49 Thomas Thurman 2008-08-07 12:30:53 UTC
I wonder whether this is actually a gdk bug.
Comment 50 Matt Zimmerman 2008-12-04 04:26:22 UTC
I am able to reproduce this on Ubuntu 8.04 (same setup as Neil Patel).  As a test, I built ui/theme.c using gcc 4.3.2-1ubuntu11 (everything else unchanged) and the problem vanished.  I think this makes it reasonably likely that this was a gcc optimization bug which was fixed between 4.2.3 and 4.3.2.