2.25.2 released

This release is broken.  Use 2.25.3 instead.

What is it ?
Metacity is a simple compositing window manager that integrates nicely with GNOME 2.

What’s changed ?
Thanks to Joe Marcus Clarke, Murray Cumming, Tomas Frydrych, William Lachance, Matthew Martin, Christian Persch, Thomas Thurman, and Vincent Untz for improvements in this version.

  • Add handler for SIGTERM (Joe) (GNOME bug 553980)
  • Minimised windows are necessarily obscured (Matthew) (GNOME bug 528927)
  • Build fixes with the above (Christian, Tomas, Thomas) (GNOME bug 557335) (GNOME bug 557201) (GNOME bug 469361)
  • Changed keybindings to be in a single place (Thomas) (GNOME bug 469361)
  • Add new document about themes (Murray)
  • Remove obsolete support for fallback icons (Thomas)
  • Pass modified mouse events to panels (William) (GNOME bug 554428)
  • Change where desktop files should go (Vincent) (GNOME bug 549479)

Translations
Yavor Doganov (bg), David Planella (ca), Kenneth Nielsen (da), Hendrik Richter (de), Ivar Smolin (et), Claude Paroz (fr), Seán de Búrca (ga), Launchpad Translations Administrators (hr), Gabor Kelemen (hu), Thomas Thurman (la), Žygimantas Beručka (lt), Kjartan Maraas (nb), Duarte Loreto (pt), Djavan Fagundes (pt_BR), Mugurel Tudor (ro), Pavol Šimo (sk), Laurent Dhima (sq), Горан Ракић (sr), Theppitak Karoonboonyanan (th), Funda Wang (zh_CN)

Where can I get it?
Don’t.  Use 2.25.3.

98f5039beebdb3bca5d3be7f0fd93d95  metacity-2.25.2.tar.bz2
f1fa487eea2213a2ac3e6c7c4d6fe3d0  metacity-2.25.2.tar.gz

Know all men by these presents…

sheep  &  her lambI tried to discuss the gtk_window_present() problem earlier, but I only managed to confuse myself. So here’s an extra rundown; perhaps we can move towards solving it.

The problem is that there’s a call, gtk_window_present(), which is very vaguely specified:

Presents a window to the user. This may mean raising the window in the stacking order, deiconifying it, moving it to the current desktop, and/or giving it the keyboard focus, possibly dependent on the user’s platform, window manager, and preferences.

There are at least four ways of dealing with this request.  I hope I can establish a consistent terminology for them here.  Suppose we are looking at workspace 1, and an application attempts to gtk_window_present() an existing window on workspace 2.  We can:

  • Summon: the window is moved to workspace 1, so now we’re looking at it.
  • Visit: the window stays still, but we move to workspace 2, so we’re looking at it.
  • Pulse: the window stays still, we stay on workspace 1, but we set “needs attention” so it pulses on the taskbar.
  • Nothing: we do nothing.  This is allowable, but I think we can discount it.

gtk_window_present() is implemented using _NET_ACTIVE_WINDOW, which according to its specification allows the WM to make the requested window active (which could mean either Summon or Visit), or Pulse, or Nothing.

Many applications use gtk_window_present(), and because of the vagueness of the spec, there’s no agreement on what they mean by it.  Three instances which have been identified are:

  • Firefox. If you click a link in your email program, it will summon your current browser.  If this is Firefox, and it’s appearing in a new tab, it will gtk_window_present().
  • Pidgin. If someone talks to you, it will gtk_window_present() the chat window.
  • Nautilus. If you use one window per directory, and you request a directory that is already open in another workspace, it will gtk_window_present() the window for that directory.

The disagreement extends even to what Metacity should do when asked to present windows in each of the cases above.  Here are some opinions; feel free to add your own in comments, or tell me where other people have asked for something, and I’ll update this:

  • Firefox: Kevin Downey says we want Pulse.
  • Pidgin: technicull says we want Summon. The devs themselves say they don’t care as long as it’s not Nothing.
  • Nautilus: I think we want Summon here.  David agrees.

Some things which Metacity should not do:

  • Decide which to do based on the application.  This is window matching, and thus a recipe for pain.
  • Add a switch somewhere.  As Havoc said, this boils down to asking “Do you want to break Firefox, or Pidgin?”  And many people (including me) run both.

When people complain about Metacity’s behaviour in this matter, it’s hard to tell whether they’re complaining about upstream or downstream Metacity.  Upstream Metacity does Summon in all cases.  Ubuntu has patched to do Pulse (except for dialogues, which do Summon), as has Fedora, and I believe SuSE has too.  As policy, we usually reconsider policy when several major distributions make the same change, and this means we should probably stop to consider what to do here.

It might be possible for the app itself to hint in the EWMH message which behaviour it wants, if it doesn’t want the default.  Patryk Zawadzki says that the behaviour should depend on the user’s action; if the user carried out some positive action to cause the gtk_window_present() (as in the Firefox case), it should result in Visit, but if it happened through some external event (as in the Pidgin case), it should always result in Pulse. Mathias Hasselmann concurs.  I think this seems a reasonable plan, but the distinction between events generated by the user and not is one which the app is best placed to make, and so we probably also need a hint here.  I’m happy to add hinting as a test; however, the default option will necessarily be “don’t care”, and therefore we will still have to choose a best option as default.

I think most applications may be happy with a default of Summon, and that a default of Pulse is at least better than Visit in most cases, but I’m entirely willing to be convinced otherwise.

What do you think?

Photo © jan glas, cc-by-nc-nd.

Annotations

Perfection in the MarginsMany people, from various programming communities, have come to the conclusion that if functions are first-class objects they should be allowed properties. For example, if a function in a test suite is checking for regression of the fix to a particular ticket, it could have a property for the ticket number. Then other parts of the code can deal with it in a consistent way through introspection, without keeping related information all over the place.

In Java, these are known as annotations and look like this:

@ticket(177177)
public static void testFrobulation () { ...

Python also calls them annotations (replacing the older system of decorators, which looked similar to the Java syntax but achieved its effect in a way more like Lisp macros). Annotations in Python look like this:

def testFrobulation(ticket: 177177): ...

In the past few months, two infelicities of the Metacity codebase presented themselves. Firstly, some translators complained, rather reasonably, in GNOME bug 469361 that the same information was repeated over and over again in the long descriptions of the keybindings.  Secondly, the same information about keybindings was repeated over and over in several places in the code, and in many of those places it was required to stay in the same order as the other places and would cause subtle breakage if it didn’t.  And of course, when anyone provided a patch to add a new keybinding it needed to modify several more files than would seem really necessary.  What would have been best is to be able to write something like

static void @keybinding ("Activate the window menu", "<Alt>Space")
handle_activate_window_menu (MetaDisplay    *display, ...

But you can’t really do annotations in C (despite a half-arsed attempt by Microsoft). Or can you?

In Dr Dobb’s Journal of May 2001, Randy Meyers introduced an idea called x-macros. This idea is the mildest of preprocessor abuse: you create a file containing lines of grouped data, like these:

item (switch_windows, "Move between windows, using a popup window", "<Alt>Tab")
item (switch_to_workspace_1, "Switch to workspace 1", NULL)
...

Then you #include the file anywhere you want to work with this data, but you #define item() as appropriate each time.  This way, the data only needs to be modified in one place, and it’s guaranteed to stay in order.  It occurs to me that what we have here is pretty close to annotation.  True, it’s in another file, but C also requires that the prototypes of public functions be in a separate file, and nobody minds about that.

So Metacity in trunk is now working fine using this system.  There are a few places it could be neater;  screen and window bindings have always been kept separate, but it would possibly make sense to keep them together and distinguish them (as they already are distinguished) by the cunning use of flags.  Also, the handler functions should probably be given by name and not calculated from root and suffix, because it’s just confusing.

This whole idea also means that the GConf schemas which concern keybindings can be generated during the build process, which solves GNOME bug 469361 rather neatly.  In conversation with Rodney Dawes it also came up that most of the short and long versions of the keybinding descriptions say the same thing in twice in different words, which is an unfair burden on the translators.  I have merged them as appropriate: the number of strings has gone down by about thirty, and the .pot file is now 70% of its former size.

Photo: Perfection in the Margin, © Adam Shaylor, cc-by-nd.

Metacity Journal: 2008-10-16

SalmiakkiWelcome back to the Metacity journal, your (more or less) daily roundup of all things Metacity. Okay, so it hasn’t happened for six months and I did this one by hand instead of with the script. Anyway, feel free to poke your nose into any of these conversations.

GNOME bug 556464: Michael Terry wanted to remove the dialogue box which says that an application doesn’t play nicely with the session manager.  The reason is that it stays up indefinitely and most users don’t care.  Michael provided a patch which added a GConf key to disable it.  Thomas said that a new key for something as trivial as this would be a bad idea, and it would be better just to disable it.  Havoc said that it had already been considered somewhere, but nobody’s yet found that bug.

GNOME bug 401028: Quite an old bug; unshading a shaded window doesn’t focus it as it should.  There was a patch which rotted; Thomas rewrote it to apply to trunk.  Shaun McCance tested it and reports that it fixes the bug but causes intermittent crashes, so it’s not going in quite yet

GNOME bug 96743: Okay, this is a REALLY old bug.  Should you be able to drag a window to an adjacent workspace by pushing it off the edge?  Calum has recently added that he believes you should, and since IIRC he’s on the HIG team, that carries quite some weight.

GNOME bug 555489: Luke Hutchison wants a generalised way to fullscreen any application, similar to the maximise button.  Havoc says this is really an app problem because there’s so much app-specific information the window manager would need to know in each case.

There was a GNOME doc list discussion about this theming tutorial from 2002. Murray Cumming asked whether it was current. Thomas said it was not particularly current and that this blog post was a better source, though there were some lacunae. Murray suggested that it could be changed into docbook and kept in the Metacity tarball, which Thomas thought was a good idea; Thomas further suggested that some of the other tarball information be changed to docbook at the same time.

And Metacity became the first GNOME program to have a (very partial) Latin translation.

What people are saying about Metacity:

That’s it for today, folks.  More next time.  Also to come: fun with annotations, rethinking the responsibility of themes, and being nice to translators.

Image: salmiakki, © Laurence Livermore, cc-by-nc.

Double-click to close

doble clickWindow decorations on Windows 3.1 had no close button, so they used to let you double-click the menu button to close a window. When Windows 95 came along, they added a close button, but they kept the double-clicking behaviour. The ability to close a window by double-clicking the menu button has lasted right up until Vista; apparently Microsoft tried to take it out in the beta, but so many users complained that they left it in in the end.

Many *nix window managers support double-click to close for the benefit of people moving from Windows who learned how to close a window before 1995 and haven’t broken the habit yet.  Metacity doesn’t, and in GNOME bug 83892 people have been saying it should.  Often, they add that there’d be no harm in adding the behaviour because people who wouldn’t know about it wouldn’t trigger it.  However, other people say that the effect of accidentally double-clicking the close button, and losing anything which happens to be in the window, is too disastrous to add a feature for such a marginal audience.

The HIG also (apparently) says that the top entry in a context menu should be the one triggered by a double click.  “Close” is not currently the top entry in Metacity’s window menu.

A good while ago, Thomas Thurman provided a patch to add this behaviour, which has rotted, and today provided a current one.  The current consensus among the maintainers is that this will not be added.  However, you might be able to change our minds if at least one distro includes the patch.  For example, Debian bug 381509 discusses the matter; if you know corresponding bugs in other distros, please let me know and I’ll add them here.

Photo © saba♫dija, cc-by.

2.24.0 released!

Nothing particularly exciting, except that this is the culmination of the 2.23 branch and the version which will be released in tonight’s 2.24 GNOME stable release.  I’m in a hurry at the moment or I’d add a nice picture.

Here’s the release notes:

Metacity is a lightweight compositing window manager for the GNOME desktop.

What’s new for 2.24.0:

Thanks to Thomas Thurman for improvements in this version.

– Small memory leak fixed (Thomas) (#549952)

Translations
Ankitkumar Patel (gu), Kenneth Nielsen (da), Mişu Moldovan (ro),
Anas Afif Emad (ar), Theppitak Karoonboonyanan (th),
Gintautas Miliauskas (lt),  Gil Forcada (ca),  Gabor Kelemen (hu),
Duarte Loreto (pt),  Leonardo Ferreira Fontenelle (pt_BR),
Baris Cicek (tr),  Changwoo Ryu (ko),  Hendrik Richter (de),
Goran Rakić (sr), Goran Rakić (sr@latin), Sandeep Shedmake (mr)

Sources at:
http://download.gnome.org/sources/metacity/2.24/

MD5 sums:
d4aa782d5f71b6c42514b239684a4aa3  metacity-2.24.0.tar.bz2
cadfcd438e9116692bf7b8a6411256f8  metacity-2.24.0.tar.gz

Keep up to date with Metacity at http://blogs.gnome.org/metacity/ (but you’re already here)

Thomas

2.25.1 released

St Albans AbbeyThanks to Thomas Thurman for improvements in this version.

  • Fix small memory leak, found by Matthias Clasen (Thomas) (GNOME bug 549952)
  • Added move_to_center keybinding suggested by Khanh-Dang Nguyen Thu Lam (Thomas) (GNOME bug 549979)
  • Compositor can be turned on and off from the command line (GNOME bug 545323) (Thomas)

Translations: Khaled Hosny (ar), Petr Kovar (cs), Iñaki Larrañaga Murgoitio (eu), Ilkka Tuohela (fi), Žygimantas Beručka (lt), Duarte Loreto (pt), Djavan Fagundes (pt_BR), Laurent Dhima (sq)

(Recall that 2.25.x is currently trunk.)

Where to get it:

Photo: © 2006 Matthew Hunt, cc-by.

Doxygen

Blowtorch on full powerHere’s a really easy way of getting involved with Metacity which doesn’t even involve being able to compile it, can be carried out even if you only have a basic knowledge of C, and will teach you something about the way the system works and get you credit in the release notes.

A goal of mine for 2.26 is to see all the functions documented. I’d like to see every function begin with a comment saying what it does, what its parameters are, and what its return value is. And you can figure this out by reading the code– or if you can’t, you can read more of the code to find out, or come here and ask. And really, if you can’t figure it out, that’s nothing to be ashamed of– it shows we really needed the comment.

In my opinion, the system used by Doxygen, which is similar to that used by Javadoc, does everything we need in a reasonable way, and for a few months I have been adding documentation comments to functions all over the place– I think bell.c is a good example of the style, though I’ve learned a few new things about the Doxygen system since then that I’d like to modify. You can see some of the results here. However, there’s a lot left to do, and I could probably be spending my Metacity time better by fixing bugs, since I know the system pretty well by now, and this is something that can largely be done by people who are learning it (given that they’re supplying patches which will be checked for quality by someone who knows what they’re doing).

If you want to help work on this, sort out here which module you’d like to help work on, so we don’t have two people working on the same place. If you don’t know, I can suggest something. I’ll make a bug sometime so patches can be attached. It’s far more important that nonstatic functions are documented than static ones. Oh, and don’t forget to start block comments with a slash followed by two stars.

Photo credit: Terence T.S. Tam, cc-by-nc-sa.

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported.