]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wincmn.cpp
wxLogFatalError() now always aborts the program and doesn't use the active log target...
[wxWidgets.git] / src / common / wincmn.cpp
index 6ffcaea012b9827bec575611f260bcc6d0c7315c..27bb0f0bc40d497589a3f81c269a3abaff3d27fb 100644 (file)
@@ -405,18 +405,18 @@ void wxWindowBase::Centre(int direction)
     wxRect rect = wxGetClientDisplayRect();
     wxSize size (rect.width,rect.height);
 
-#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
     {
         if (xNew < 0)
             xNew = 0;
         else if (xNew+width > size.x)
             xNew = size.x-width-1;
     }
-#ifndef __WXMGL__ // FIXME - temporary dirty hack!!
-    if (posParent.y >= 0)  // if parent is on the main display
-#endif
+    if (posParent.y + heightParent >= 0)  // if parent is (partially) on the main display
     {
         if (yNew+height > size.y)
             yNew = size.y-height-1;
@@ -1708,10 +1708,7 @@ void wxWindowBase::CaptureMouse()
     wxWindow *winOld = GetCapture();
     if ( winOld )
     {
-       // I think this is correct, but not compatible with some ports
-#if defined(__WXX11__) || defined(__WXMGL__)
-       ((wxWindowBase*) winOld)->DoReleaseMouse();
-#endif
+        ((wxWindowBase*) winOld)->DoReleaseMouse();
        
         // save it on stack
         wxWindowNext *item = new wxWindowNext;
@@ -1734,12 +1731,7 @@ void wxWindowBase::ReleaseMouse()
 
     if ( ms_winCaptureNext )
     {
-       // I think this is correct, but not compatible with some ports
-#if defined(__WXX11__) || defined(__WXMGL__)
         ((wxWindowBase*)ms_winCaptureNext->win)->DoCaptureMouse();
-#else
-        ms_winCaptureNext->win->CaptureMouse();
-#endif
        
         wxWindowNext *item = ms_winCaptureNext;
         ms_winCaptureNext = item->next;