Metacity bug when using background for buttons

Bug #535088 reported by NooP on 2010-03-09
This bug affects 15 people
Affects Status Importance Assigned to Milestone
Fix Released
metacity (Ubuntu)

Bug Description

When using functions :

left_left_background, left_middle_background, left_right_background
right_left_background, right_middle_background, right_left_background

in metacity themes, the last button is always set with [left|right]_middle_background instead of [left|right]_right_background.

Related branches

NooP (noop) wrote :

In : Ubuntu 10.04

NooP (noop) wrote :

I think i've found where is the bug. But my C++ skill is to bad to rely only on my patch. Need a review from someone who knows better than me C++.

Package : metacity-2.28.1-0ubuntu5-src

Here's the patch :

Index: src/ui/theme.c
--- src/ui/theme.c (revision 1)
+++ src/ui/theme.c (revision 14)
@@ -4526,5 +4526,5 @@
                    j == META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND) &&
- middle_bg_offset < MAX_MIDDLE_BACKGROUNDS)
+ (middle_bg_offset < (MAX_MIDDLE_BACKGROUNDS - 1)))

NooP (noop) wrote :

Here are :

1) Packages compiled for Lucid - amd64
2) Ambiance theme modified to use backgrounds

Install theme first, and look how buttons display backgrounds. Then install thoses metacity packages, close and reopen session and look at the difference.

tags: added: kernel-series-unknown
tags: removed: kernel-series-unknown
NooP (noop) wrote :

I was wrong. This patch doesn't work at all. It only works when buttons are on the left.

affects: ubuntu → metacity (Ubuntu)
Changed in metacity (Ubuntu):
importance: Undecided → Low
NooP (noop) wrote :

Here is new patch for Metacity 2.28.1. All bugs corrected except for 'spacer' who has no background.
You can now use transparent backgrounds for buttons.

Please find here :

- The new version of the patch to apply on 2.28.1 sources
- The Ambiance theme modified to work with transparent buttons backgrounds

NooP (noop) wrote :
NooP (noop) wrote :

Here is a screen shot of metacity-theme-viewer

tags: added: patch
NooP (noop) wrote :
NooP (noop) wrote :

Done some cosmetics on the code to make it comply with metacity coding style.

James Schriver (dashua) wrote :


Not running compiz are you?

NooP (noop) wrote :

Effectively, not running compiz. I even don't try if compiz has the same problem.
Just trying to make the standard installation theme looks good.
For that, we need backgrounds with transparency, and metacity didn't handle them well.
It, too, didn't handle by default when there is only one button (assigning it left or right background) etc...
Very hard to debug (Coz my poor C++ skill) and because there is nearly no comments in the code.
But all that is done with the few modifications of my patch.

Now, just missing background behind spacers.

NooP (noop) wrote :

Corrected another bug.
When window is maximized, you can click on the first left button by clicking on the top left of the window (Out of the button).
This patch (Metacity-2.28.1-20100316.patch) includes the previous ones I submitted.

NooP (noop) wrote :

Corrected another bug.
When window is maximized, you can click on the first left button by clicking on the top left of the window (Out of the button).
This patch (Metacity-2.28.1-20100316.patch) includes the previous ones I submitted.

Umang Varma (umang) wrote :

What's the status of the patch? Is it being reviewed?

Does the status of this bug need to change to something like "In Progress"?

Pedro Villavicencio (pedro) wrote :

The patch needs to be reviewed by the upstream developer, I've added the upstream report you filed at: ; feel free to subscribe and comment your patch there, thanks.

Changed in metacity (Ubuntu):
status: New → Triaged
NooP (noop) wrote :

New update of the patch

Added some comments in the code where I made modifications.
Revert back some modifications which didn't seems to do anyfing, so I prefer leaving code unmodified in this case.
Added the same patches for the buttons when placed on the right (As I was first working for the left side).

If you need more comments, feel free to ask for.

NooP (noop) wrote :
NooP (noop) wrote :

Updated Bugzilla Gnome report too.

James Schriver (dashua) wrote :


Work great with Metacity, but the buttons disappear when using gtk-window-decorator. You think you could patch that as well?

NooP (noop) wrote :


Can you explain more how do you see this problem.
If I do 'gtk-window-decorator --replace', this changes nothing here.
If I try with 'compiz --replace', there is the same problem than I found in metacity.
So I thing you want to talk about Compiz, right ?

The problem with compiz is that I can't even compile it ! Fails with an error
"compiz-0.8.4/gtk/window-decorator/gtk-window-decorator.c:4236: undefined reference to `GTK_WIDGET_VISIBLE`"

James Schriver (dashua) wrote :

It works fine until you log out. After logging back in, all of the window borders are improperly rendered. The close, minimize, and mazimize button are not even present. Here is a screenshot.

James Schriver (dashua) wrote :


NooP (noop) wrote :


For the problem you find, here is the solution I had found : You'll have to save the gnome session (System->Preferences->Startup Applications) in the 'options' tab.
I don't know why this didn't work without this hack.

For the compiz problem, no chances I be able to debug it, as I can't compile.
Looking everywhere to find a tutorial on how to compile Compiz for Ubuntu. All I find didn't work.

James Schriver (dashua) wrote :

Patch definitely works good especially with the new theme updates separating the trough bg. Gtk-window-decorator is still not working right as this will be a bug with some heat due to compiz being installed by default. Maybe the Compiz guys will get the decorator patched as well. I'm messing with some different options.

See attached video.

NooP (noop) wrote :

I think this bug is not a duplicate of bug #532224, as if you use backgrounds with transparency, the bug I show up in my first post always exists. This bug is due to a problem in metacity and the #532224 bug is due to a problem in the theme.
As you can see, corrected theme in #532224 again has problems when there is only one button.
This said, I think this bug is not a duplicate, and the #532224 bug can't be marked as 'Fix released' as all problems are not fixed !

James Schriver (dashua) wrote :


This is resolved with NooP's patch and rebuilding against Compiz from git. As evidenced by the video, Compiz is running in full and gnome-appearance-properties corruption is also resolved without any transparent hacks. All the trough bg's are working on various configurations, even with the menu icon if so desired.

A rebuild of Compiz with the patch again libmetacity-dev should rectify the issue. This will make many user quite happy.

Didier Roche (didrocks) wrote :

The patch looks good to me.
I'll update it with the latest version of metacity which is due in 2 days and give it further look.

Thanks a lot for your contribution.

Didier Roche (didrocks) wrote :

Commited as well as compiz rebuild to get new parameters.

As we are in freeze for beta2, this can be accepted after though…

Changed in metacity (Ubuntu):
status: Triaged → Fix Committed
Benjamin Drung (bdrung) wrote :

Didier, please don't forget to unsubscribe ubuntu-sponsors.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package metacity - 1:2.30.0-0ubuntu1

metacity (1:2.30.0-0ubuntu1) lucid; urgency=low

  [ Nicolas Desfontaine ]
  * debian/patches/13_better_support_for_button_layout.patch: (LP: #535088)
    - Fixed support for buttons backgrounds with transparency
      + Added 'no background' if there is only one button
      + Backgrounds no more overlap if transparency used
    - Fixed bug with left button clickable region when window is
    - Fixed first left button was activable by clicking on it's left
      (Out of the button) when window is maximized

  [ Didier Roche ]
  * New upstream release:
    - Fix typo when checking the result of getpwuid (Owen)
    - Revert new default cycle_group keybinding to Alt-grave (Didier)
    - Fix build with gcc 4.5 (Dominique)
    - Updated translations
  * debian/patches/12_dont-show-as-user.patch: refreshed
  * debian/patches/90_autotools.patch: refreshed
  * debian/control: add breaks to compiz-gnome if < new rebuild
 -- Didier Roche <email address hidden> Thu, 01 Apr 2010 11:48:10 +0200

Changed in metacity (Ubuntu):
status: Fix Committed → Fix Released
Changed in metacity:
importance: Unknown → Medium
status: Unknown → New
Anshul Jain (anshulajain) wrote :

Hi, Need some help in selecting the right patches to get the light-themes working on openSUSE :) I've built murrine from source and installed the latest light-themes package in my openSUSE install. However, I'm stuck with the metacity button issue. I've applied the 13_better_support_for_button_layout.patch and it seems to fix the problem when not using Compiz. With Compiz it doesn't work. I'm trying to figure out the right patch (Compiz?) to get it all working.

Can someone guide me to the right patch...seems like I'm just a patch away from fixing it.


Changed in metacity:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

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