0

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.

MT13
  • 1
  • 2
  • My guess is that your desktop evironment saved the last position of your window, that or by default they put it on that position. Is that feature of your project or you wish to put it on center of the screen? – Joel Jun 19 '15 at 23:44
  • Thanks for response. The last position should be actually the one it had just before closing ant it wasn't the corner. I caught one extra move event, which is not sent from my application and, as I guess, wm sends it. So it should have been in the center, but this move event messes everything up. – MT13 Jun 24 '15 at 09:46

0 Answers0