2007-12-09: at last the 1948 show

The Metacity Journal bounds back to your screens! It’s been a busy couple of days; I think we’re about due an unstable release. Here’s a quick roundup of life around these parts:

Actual fixes:

  • GNOME bug 474889 LONG KEY IS LONG: There is a particular GConf key which contained a small novel in the long description, and some of the translators asked for it to be shorter. We agreed on this in principle months ago, and then never actually did it. Sorry. Nostra culpa (or indeed mea culpa: Thomas was down to actually make the change).
  • GNOME bug 112560: Sometimes Metacity grabs the keyboard, for example when you’re using alt-Tab, and then you might decide to stop doing that and do something else without actually finishing the alt-Tab. What if you let go of Tab without letting go of alt and then pressed f1? This is a basic fix for that case and, again, it should have gone in months ago but got lost. (Yesterday I did a sort of garbage collection pass over the bug list. I think I should do that more often.)
  • GNOME bug 496054: a reported crash in obscure circumstances in the menu code, when you only have a single workspace; we couldn’t replicate it but it’s no bad thing to check you’re not passing nulls around, which was the obvious fix.
  • GNOME bug 501362: Kjartan Maraas reported a typo where the “y” coordinate was checked twice in themes instead of the “x” and the “y” both once; Martin Meyer provided a patch(!).

Things people are actively talking about (as ever, feel free to jump into the conversation):

  • GNOME bug 480954: random crash, probably not reproducible, dup finder finds nothing; I doubt this is going to lead anywhere
  • GNOME bug 502644: someone wants a way to turn off wireframe as such, rather than minimise and drag wireframes separately.
  • GNOME bug 500279 (the theme parser refactor): Andrea Cimitan says it interacts in bad ways with Iain’s compositor, so we are putting 500279 on hold until the compositor is sorted.
  • GNOME bug 502635: Should it be the responsibility of the window manager to tell your IM client to set you “away” when you make another window fullscreen, since you can’t use the IM client?

Translation: Spanish, Czech, Belarusian, Brazilian Portuguese, and Galician have been worked on recently. Thank you all for contributing and reading and using.

Gossip:

Till next time…

Photo: The Peacock, St Albans. Photo: Gary Houston, public domain.

Thoughts about a standard new feature policy

Havoc linked today in a discussion on bugzilla to a document he wrote three years ago about what features maintainers should consider adding to mature software. The central thesis is “ask ‘why’, rather than ‘why not'”. If we’re to have stability we can’t add features for the hell of it.

I wonder whether we could make a sort of checklist out of the list given there, and use it to measure rationales in feature requests (even those in patches!) as a sort of triage; if a request didn’t measure up, we could always send it back and ask them to address those points as well. I would seriously like to have a common policy across all requests so I knew my review was balanced.

2007-12-05: still not a journal

Iain’s compositor patch had some glitches and therefore didn’t make it into trunk this weekend, but I’m still hopeful it’ll be in within the week. Digg has picked up the story. And some people used Coverity’s source checking system to find some bugs, which they raised.

Also, a live point of discussion: Some people like to use alt and a mouse button for menu, resize and move. But some people only have two mouse buttons. What should we do about that?

Trip the light fantastic

Useful uses for a compositor #1

Some videos this time, they’re not particularly good quality but that doesn’t matter. First – http://folks.o-hand.com/iain/watch-updates.ogg

Its like acid, but cheaper!

So what exactly are we seeing?

Well, everytime a section of the screen needs to be redrawn, the compositor draws it correctly, and then picks a random colour and overlays that colour on the region that was redrawn. So you can watch screen updates as they happen. Just by watching the colours change.

Besides being a cheap night in, what use is it?

Well, here is video #2 – http://folks.o-hand.com/iain/totem-button.ogg

Again, crap quality, but down in the bottom left corner of the screen, we can see that something is constantly redrawing itself. That something is the totem-mozilla play button. It seems to be constantly redrawing itself for no apparent reason. Bastien got a bug for you.

2007-11-28: All our journal entries are busy; please hold

This still isn’t a complete roundup of yesterday, but:

GNOME bug 500279: theme inefficiency: Iain continued to rock on by finding and fixing quite a major inefficiency in the theme code: values which could have been cached weren’t. Thomas began to review the patch last night, but it was a little too much to take in in one go. It’s all rather wonderful: thanks, Iain!

Compositor rewrite: Still on the verge of being able to start making the call about putting it into trunk. If anyone wants to come around and make real life less complicated so there’s more time for patch review during the week…

GNOME bug 150897 has had some dupes recently. The Windows key or whatever you want to call it is a thornier issue than you might suppose. We generally make it a modifier key, perhaps the one which X calls Super— a hangover from the Space Cadet Keyboard— so that you can use it in combination with other keystrokes in the same way you can Ctrl and Shift and Alt. (There’s Super-R for run, and so on.) Some people think that this is a bad idea and that the Windows keys shouldn’t be modifiers (these people never want to do Super-R). Some people want to keep Windows=Super, but also have the key pressed on its own being able to cause an effect (namely to put up the main menu, as it does in Windows). But there is no current case, as far as I know, in which you can make a modifier perform an action without actually modifying something else. (I don’t think, for example, that you can configure Metacity to minimise the window when you press and release Ctrl.) Apparently IceWM does this to some people’s satisfaction, so I expect we should look at how they manage.

GNOME bug 114384 has also had a few dupes. As mentioned yesterday, we need to support startup-notification. Elijah points out that we already link to the relevant library, so this may not be very hard.

Shoot speed kill light

Some recent changes to the compositor made it feel kinda slow and laggy. Not in a noticable way but more in a subconscious something feels wrong way. I tested xfwm and it seemed fine running as a compositor, and given that Metacity’s compositor has the same heritage as xfwm’s and I’ve been checking the xfwm code to see how they do things, I thought that was suggesting that there was something wrong with the Metacity one. I couldn’t see anything abnormal or strange looking at/comparing the codebase, so I turned to valgrind and oprofile. Running callgrind didn’t really show anything about the compositor code though, but as always with callgrind stuff gets lost in amongst the small functions like g_type_check_instance_is_a and the wonderfully mysterious <cycle 8>

My expectations were that some of the compositor functions would be topping the profile, given that the redrawing functions need to run anytime something changes on the desktop (modulo that they’re called from an idle handler so some redraw events are merged together) but what Oprofile said was

samples % symbol name

13908 21.8501 pos_eval_helper
10471 16.4504 pos_tokenize
7621 11.9729 meta_color_spec_render
5408 8.4962 compositor_idle_cb
3785 5.9464 fix_region
1559 2.4493 meta_draw_op_draw_with_env
1511 2.3738 free_tokens
1480 2.3251 meta_parse_position_expression

Eh? What are pos_eval_helper, pos_tokenize and meta_color_spec_render and why are they so high up the profile? Well, it turns out they’re part of the theme parsing code (Metacity has a very powerful, but complex theme format dontcha know?), but some more debugging showed that the theme expressions were being reparsed and re-evaluated every time Metacity had to draw a window frame. The impressive screenshot for this is:

Just look how many times pos_tokenize and pos_eval_helper are called when a draw op is drawn. That is one complicated function call chart.

Looking through the code I saw that draw operations were stored as their string format, like “2 * width + Bmin / height % 7”. These expressions were first tokenised (in pos_tokenize) into constituent parts (‘2’ ‘*’ ‘width’ etc) and they were then evaluated. Thing is that these strings cannot be changed at all so they can be tokenised when loading the theme rather than every time they are evaluated.

meta_color_spec_render is a similar problem. Colours can be defined as a basic colour, a GTK theme colour, a shade of a colour, or from two colours blended together. With shaded and blended colours they were generated every time Metacity had to use that colour, which is an obvious waste of time as the colour specs cannot be changed after they are created and so the colours should just be generated whenever the spec is created and then it becomes a simple function to get the correct colours.

All this is filed as bug #500279 and the patch attached to the bug fixes these two issues.

pos_eval_helper is the function that calculates the theme expressions from their tokenised state and it still gets called every time the theme needs redrawn, which sort of makes sense, as the variables may have changed since the last time, but it looks to me like the variables are all related to the width/height of the window, so it may be that we can make it so that the expressions are only re-evaluated when the width/height changes. I’ll have to look into it.

Anyway, with the patch from bug applied this is what the profile looks like now…

9355 32.4815 compositor_idle_cb
7129 24.7526 pos_eval_helper
1070 3.7151 meta_parse_size_expression
1020 3.5415 event_callback
604 2.0971 meta_compositor_process_event
597 2.0728 .plt
542 1.8819 win_extents
531 1.8437 pos_eval
519 1.8020 meta_frame_style_draw
495 1.7187 meta_draw_op_draw_with_env

The compositor functions are up where they should be…getting rid of that pos_eval_helper would be nice though, as evinced by this screenshot of the same function as above, but with the patch applied. The function is a lot less busy, which is a good thing, but the three sets of calls to pos_eval_helper could possibly be reduced somehow.

Anyway, the compositor seems faster, and I didn’t even touch that code this time :)

2007-11-27’s not-quite-a-journal

Life is still hectic for the maintainers this week, so this will be a short post.

On that theme, GNOME bug 468075, about a problem with vertical maximisation (which has been said to be a simple, reproducible bug, although it’s about a feature that most users don’t know exists) is not yet fixed. Someone complained that it raises the question of whether Metacity is still maintained. We are here, though; we’re just doing the best we can with the resources we have. Help is always welcome.

GNOME bug 500047 was a request to add the “busy cursor” when Metacity starts an application in response to a keystroke. This requires using startup-notification, which makes it a dupe of GNOME bug 114384 (that one’s been around a while; we should bump up the urgency).

Apparently we reached GNOME bug 500000 the other night, though it was actually a dupe of GNOME bug 500002.

Continued absence of dolphins

Sorry for the lack of daily “journal” posts over the past few days: I’ve been rather busy with real life, and it takes rather a while to gather up the crumbs to make a post. I’ve been writing a script off and on which will do the donkey work and let me or anyone else simply write the human part, but it’s not quite finished yet.

To be going on with, here’s the fascinating saga of negative numbers in theme files (well, more of a bug, really: Njáll Þorgeirsson does not have a starring role.) Someone complained that they couldn’t put negative numbers into theme files; Thomas closed the bug because the source comments (but not the documentation) say explicitly that negatives aren’t allowed. Besides, what good would they be? The reporter said that there was actually no reason to need negative literals because expressions which yield negative numbers can always be written instead. Certainly this does need documenting explicitly.

Havoc then pointed out that it makes little sense to prohibit “-1” but allow “0-1”. A long discussion of the semantics of the original comment followed. Nobody could remember ever writing it or quite what its subtleties were. Did it mean that unary negation wasn’t implemented because negatives weren’t allowed for some unstated reason, or did it mean that negative literals weren’t allowed because unary negation would over-complicate the parser? Perhaps it does make sense to prohibit “-1” if it means the code will be more maintainable? Maybe code could be shared with some existing expression parser? The issue has not been resolved.

In other news: congratulations to contributor Alex Turner (plexq on irc, aturner in svn) who got svn access yesterday after two very useful patches.

Thomas is aware that patch review is a little behind again (see above under “rather busy with real life”) and will try to get it back on track by the end of the week.

By popular request

Some people have expressed concern about the panel drop shadows. At least three people didn’t like that they drew the shadows over the windows close to them. So in response I’ve just committed a change that makes the panel drop shadows only draw on the desktop. I think it looks quite neat and tidy actually. One person said “Oh cute”

Here’s a now obligatory screenshot

Underground Cave Dwellers Society

A quick update on the compositor.  I updated the branch to match the trunk, so all the bug fixes have been up into the branch.

Some more compositing bugs have been squashed:

  • Changing screen resolution should work
  • The transparency property on windows is now respected (meaning that gdk_window_set_opacity works, as does transset)
  • Jonathan Matthew fixed a signed bug that was causing the shadows of 50-99% opaque windows to be corrupted

Because the transparency property is listened to, it means that screens that fade to black now work (like at log out and entering admin password).

And I also made some more work on the alt-tab dialog: scaling is better and the program icons are overlaid. Some people said it was slow to appear. I think I know the problem, it’ll be fixed soon.


Finally, I’ve been doing silly experiments with what we can do with a compositor. I had alt-tabbing dimming the screen so that the selected window was highlighted, but it started getting too hacky too quickly, so I want to think of a better, cleaner approach to things like this before I commit them. (And I’ve been working on some other little hacks, but they’re not related to Metacity, so I probably shouldn’t mention them here)

People have been reporting that the compositor is stable for them, so if you were too scared to try it out, please don’t be. I’d especially like to know if there’s any problems on people with weird screen setups, multiple monitors, xinerama that sort of thing, cos I only have one monitor and can’t test that stuff. Oh, and SuSE users too, I’ve had a weird report of shadow corruption on SuSE and I’d like to know if its a common problem to SuSE or just this person’s setup.

Thanks iainxoxox

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