#223 workaround from 2811156 makes popup windows unclosable

cvs(HEAD)
open
None
5
2013-01-03
2012-08-04
No

Hi,

a user of http://www.i3wm.org/ brought to my attention that popup windows opened by MusE (tested with 2.0~rc2) are unclosable in i3.

After investigating the issue, I came accross lines like these:

// work around for probable QT/WM interaction bug.
// for certain window managers, e.g xfce, this window is
// is displayed although not specifically set to show();
// bug: 2811156 Softsynth GUI unclosable with XFCE4 (and a few others)
show();
hide();

With xtrace, I can see that this code translates to the following X11 requests:

000:<:0a6f: 8: Request(8): MapWindow window=0x0120008e
000:<:0a70: 8: Request(10): UnmapWindow window=0x0120008e
000:>:0a70: Event PropertyNotify(28) window=0x0120008e atom=0x170("_NET_WM_SYNC_REQUEST_COUNTER") time=0x3f0717c1 state=NewValue(0x00)
000:<:0a71: 44: Request(25): SendEvent propagate=false(0x00) destination=0x000000be event-mask=SubstructureNotify,SubstructureRedirect UnmapNotify(18) event=0x000000be window=0x0120008e from-configure=false(0x00)

That is, the window is mapped and directly unmapped again. This poses a race condition with reparenting window managers (such as i3, but also the WMs of GNOME or KDE): X11 will translate the MapWindow to a MapRequest, which the WM then executes. However, at the time the WM gets to executing the MapWindow, MusE has already sent the UnmapWindow. Therefore, what actually happened is not in sync with what MusE thinks: the window is still visible on the screen, but it shouldn’t be.

This race condition is also well-documented in this paper: http://www.std.org/~msm/common/WhyX.pdf (page 13 and 14). It says: "UnmapWindow requires that the window already be mapped; if a client calls UnmapWindow before receiving MapNotify, the window may remain mapped."

I therefore suggest that you change the code in such a way that it waits until the window is mapped (X11 MapNotify event) before unmapping it again, or removing the workaround entirely (as did the user who reported it, and that makes MusE usable in i3) and find a different way to solve the original problem.

In case you have any questions, feel free to contact me.

Best regards,
Michael

Discussion

  • Robert Jonsson
    Robert Jonsson
    2013-01-03

    Sorry for the long delay but I believe this is fixed? Please let us know

     
  • Robert Jonsson
    Robert Jonsson
    2013-01-03

    • assigned_to: nobody --> spamatica