]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/wincmn.cpp
separated modifier keys handling in order to distinct key/up down events
[wxWidgets.git] / src / common / wincmn.cpp
index 65fdad6ae3053458280df79c5f4a0fe835e11315..6f9473274833ee1610804d37e0a283dfe0ca4f8d 100644 (file)
@@ -364,6 +364,20 @@ void wxWindowBase::Centre(int direction)
             }
         }
 
+        // there is no wxTopLevelWindow under wxMotif yet
+#ifndef __WXMOTIF__
+        // we shouldn't center the dialog on the iconized window: under
+        // Windows, for example, this places it completely off the screen
+        if ( parent )
+        {
+            wxTopLevelWindow *winTop = wxDynamicCast(parent, wxTopLevelWindow);
+            if ( winTop && winTop->IsIconized() )
+            {
+                parent = NULL;
+            }
+        }
+#endif // __WXMOTIF__
+
         // did we find the parent?
         if ( !parent )
         {
@@ -709,6 +723,7 @@ bool wxWindowBase::Reparent(wxWindowBase *newParent)
 void wxWindowBase::PushEventHandler(wxEvtHandler *handler)
 {
     handler->SetNextHandler(GetEventHandler());
+    GetEventHandler()->SetPreviousHandler(handler);
     SetEventHandler(handler);
 }
 
@@ -719,6 +734,7 @@ wxEvtHandler *wxWindowBase::PopEventHandler(bool deleteHandler)
     {
         wxEvtHandler *handlerB = handlerA->GetNextHandler();
         handlerA->SetNextHandler((wxEvtHandler *)NULL);
+        handlerB->SetPreviousHandler((wxEvtHandler *)NULL);
         SetEventHandler(handlerB);
         if ( deleteHandler )
         {
@@ -751,6 +767,10 @@ bool wxWindowBase::RemoveEventHandler(wxEvtHandler *handler)
                 SetEventHandler(handlerNext);
             }
 
+            if ( handlerNext )
+            {
+                handlerNext->SetPreviousHandler ( handlerPrev );
+            }
             handler->SetNextHandler(NULL);
 
             return TRUE;
@@ -1938,7 +1958,7 @@ struct WXDLLEXPORT wxWindowNext
 
 void wxWindowBase::CaptureMouse()
 {
-    wxLogTrace(_T("mousecapture"), _T("CaptureMouse(0x%08x)"), this);
+    wxLogTrace(_T("mousecapture"), _T("CaptureMouse(%p)"), this);
 
     wxWindow *winOld = GetCapture();
     if ( winOld )
@@ -1958,9 +1978,9 @@ void wxWindowBase::CaptureMouse()
 
 void wxWindowBase::ReleaseMouse()
 {
-    wxLogTrace(_T("mousecapture"), _T("ReleaseMouse(0x%08x)"), this);
+    wxLogTrace(_T("mousecapture"), _T("ReleaseMouse(%p)"), this);
 
-    wxASSERT_MSG( GetCapture() == this, wxT("attempt to release mouse, but this window hasn't captured it") )
+    wxASSERT_MSG( GetCapture() == this, wxT("attempt to release mouse, but this window hasn't captured it") );
 
     DoReleaseMouse();
 
@@ -1975,7 +1995,7 @@ void wxWindowBase::ReleaseMouse()
     //else: stack is empty, no previous capture
 
     wxLogTrace(_T("mousecapture"),
-               _T("After ReleaseMouse() mouse is captured by 0x%08x"),
+               _T("After ReleaseMouse() mouse is captured by %p"),
                GetCapture());
 }
 
@@ -1991,3 +2011,4 @@ wxWindow* wxGetTopLevelParent(wxWindow *win)
     return win;
 }
 
+// vi:sts=4:sw=4:et