Re: Reparenting cleanup



On 3/1/07, Timo Korvola <Timo Korvola iki fi> wrote:

[...]

Thanks for the explanation about X and WMs interaction.

I would tend to call this a client error.  It is just pointless to
map and unmap a window that way.  However, there may be another race
condition lurking here.  Consider a client with an iconified window
and the following sequence:
- The client decides to withdraw the window.
+ By chance, the user just now commands the wm to uniconify the window.
- The client unmaps the window.  Nothing happens: already unmapped.
- The client sends a synthetic UnmapNotify.
+ The wm maps the window.  A MapNotify event ensues.
- The wm gets the UnmapNotify and removes the window frame.
+ The client gets the MapNotify.

The end result is essentially the same, but here no one is doing
anything wrong or even obviously stupid.  Just unfortunate timing.


I can fix GPP commenting out a line in gpm-prefs.c (it's the
"gtk_widget_hide (main_window)" in hidegpm_prefs_create), but i would
like to see this solved in Sawfish. If someone can find useful, i've
attached a dumb test case that triggers the bug. I've casually found
out that if i substitute a running instance of Metacity with Sawfish,
the glitch doesn't show up reliably, both in my dumb two liners and in
GPP, i.e. a lot of time the windows are decorated.

I can think of two possible wm-side solutions.  One would be that the
wm would watch out for synthetic UnmapNotify events about windows that
it thinks are mapped.  Such windows should then be unmapped by the wm.
Another one would be for the MapRequest handler to peek for
UnmapNotify events immediately before mapping the window.  The first
solution has the advantage of not containing the words "immediately
before".  You typically need a server grab to make sure it really is
_immediately_ before.  The second solution has the advantage that it
does not map windows that have been unmapped by the client.  The
client might no longer be prepared to draw such windows.  It might be
a good idea to look at other window managers to see how they cope with
this, if they do.

Well, i'm going to look at the Metacity sources, hoping i can figure
out something... (=


--
Andrea

Attachment: test.tar.gz
Description: GNU Zip compressed data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]