_NET_WM_STATE client message to remove _NET_WM_STATE_ABOVE causes window raising even if _NET_WM_STATE_ABOVE wasn't set
Affected version
Ubuntu 20.04, Mutter 3.36.2, XOrg
Bug summary
Trying to disable _NET_WM_STATE_ABOVE state on a mapped window by sending a client message (as per https://specifications.freedesktop.org/wm-spec), when the state is already disabled, causes the window to be raised.
This was found when investigating the interaction of Java applications with the window manager. The problem can be fixed in JDK by checking the current state of _NET_WM_STATE window property before sending the message, but it still looks like a bug in Mutter.
Steps to reproduce
test.c Run the sample program (source code is attached).
What happened
Two windows are opened, 'window 1' is shown above.
What did you expect to happen
Two windows are opened, 'window 2' is shown above.