I have a problem with window appearance in qt4 on Metacity. Initial problem was with the window appearing under another window, from which it was called by clicking the button. I solved that on Compiz by sending _NET_ACTIVE_WINDOW, but on metacity it still wasn't working. After hours of googling, I tried this:
if (window -> isMinimized())
{
window -> showNormal();
}
else if (window -> isHidden())
{
window -> show();
}
//the code that I added, which makes the window appear above.
window ->setWindowFlags(Qt::WindowStaysOnTopHint);
Qt::WindowFlags flags = window->windowFlags();
flags &= ~Qt::WindowStaysOnTopHint;
window->setWindowFlags(flags);
window->setGeometry(window->geometry());
window -> activateWindow();
window->show();
window -> raise();
It is just workaround, but it actually makes the window appear above. And this is where another problem occurs: If the window is shown and I change the focus to the window from where it is called and press the button, my window appears above on the same place as it should. But if I close the window and call it again, it appears in the upper left corner. Does anyone have an idea why it is happening? Thanks in advance.