I decided to investigate this problem and checked out the source code. After a lot of debugging I found out that the call to focus the wrong window is coming from compiz CompScreenImpl::focusDefaultWindow which comes from this code on compiz event.cpp :
else if (event->xfocus.window == privateScreen.rootWindow())
{
/* Don't ever let the focus go to the root
* window except in grab cases
*
* FIXME: There might be a case where we have to
* handle root windows of other screens here, but
* the other window managers should handle that
*/
I decided to investigate this problem and checked out the source code. After a lot of debugging I found out that the call to focus the wrong window is coming from compiz CompScreenImpl: :focusDefaultWi ndow which comes from this code on compiz event.cpp :
else if (event- >xfocus. window == privateScreen. rootWindow( ))
{
/* Don't ever let the focus go to the root
* window except in grab cases
*
* FIXME: There might be a case where we have to
* handle root windows of other screens here, but
* the other window managers should handle that
*/
if (event- >xfocus. detail == NotifyDetailNone || >xfocus. mode == NotifyNormal && >xfocus. detail == NotifyInferior)) n.orphanData. activeWindow = None;
(event-
event-
{
privateScree
if (event- >xfocus. detail == NotifyDetailNone ||
(event- >xfocus. mode == NotifyNormal &&
event- >xfocus. detail == NotifyInferior))
screen- >focusDefaultWi ndow ();
{
}
}
}
The FIXME comment is very suspicious but I have no idea what would be the solution.
I'm adding an attachment file with the stacktrace.