chjj / compton

A compositor for X11.
Other
2.25k stars 499 forks source link

Incorrect handling of _NET_WM_CM_Sn selection #301

Open psychon opened 9 years ago

psychon commented 9 years ago

Originally reported at https://github.com/awesomeWM/awesome/issues/419

The awesome window manager switches between fake transparency (drawing the wallpaper as the background of windows) and real transparency (translucent pixels with an alpha component != 1) based on the _NET_WM_CM_Sn selection (= "Is a compositing manager running?").

When running compton and then starting a second compton in a termal, this second compton will error out with Another composite manager is already running and the _NET_WM_CM_Sn selection becomes unowned.

This happens because during startup, compton acquires this selection before it tries to XCompositeRedirectSubwindows. When the error about this request comes in, compton just exits ( https://github.com/chjj/compton/blob/master/src/compton.c#L3324-L3328 ). The X11 server will destroy all of compton's window and the selection becomes unowned.

To fix this properly, EWMH and ICCCM should be followed. EWMH specifies that Compositing managers MUST comply with the conventions for "Manager Selections" described in section 2.8 of the [ICCCM]. For handling selections, ICCCM specifies:

I think that compton doesn't do any of this. Note that I only wrote this from memory and I surely missed something. Better check ICCCM §2.8.

richardgv commented 9 years ago

Thanks for the report and extensive explanation! I could reproduce the issue, and the logic of registration, inherited from xcompmgr at 2007. is indeed not following the standard. Since the issue appears only in very specific cases (not many people start compton twice then launch a program that uses X selection to determine if a compositor is running, isn't it?), I will start working on it after I take care of other, more severe bugs.