-#ifndef __WXMGL__ // FIXME - temporary dirty hack!!
- if (posParent.x >= 0) // if parent is on the main display
-#endif
+ // NB: in wxMSW, negative position may not neccessary mean "out of screen",
+ // but it may mean that the window is placed on other than the main
+ // display. Therefore we only make sure centered window is on the main display
+ // if the parent is at least partially present here.
+ if (posParent.x + widthParent >= 0) // if parent is (partially) on the main display