]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/window.cpp
A few tweaks and cleanups
[wxWidgets.git] / src / msw / window.cpp
index 5a3078a1aff3afb16116eb586384dbe7e70d47cb..77589902e52de74badfdc01b09e54c06d7afcf75 100644 (file)
@@ -2036,10 +2036,18 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg)
         }
 #endif // 1/0
 
-        if ( ::IsDialogMessage(GetHwnd(), msg) )
+        // we handle VK_ESCAPE ourselves in wxDialog::OnCharHook() and we
+        // shouldn't let IsDialogMessage() get it as it _always_ eats the
+        // message even when there is no cancel button and when the message is
+        // needed by the control itself: in particular, it prevents the tree in
+        // place edit control from being closed with Escape in a dialog
+        if ( msg->message != WM_KEYDOWN || msg->wParam != VK_ESCAPE )
         {
-            // IsDialogMessage() did something...
-            return TRUE;
+            if ( ::IsDialogMessage(GetHwnd(), msg) )
+            {
+                // IsDialogMessage() did something...
+                return TRUE;
+            }
         }
     }
 #endif // __WXUNIVERSAL__
@@ -2585,7 +2593,9 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
                 processed = TRUE;
             }
             else
+            {
                 processed = HandleChar((WORD)wParam, lParam, TRUE);
+            }
             break;
 
         case WM_HSCROLL:
@@ -2645,6 +2655,10 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
             processed = HandlePaletteChanged((WXHWND) (HWND) wParam);
             break;
 
+        case WM_CAPTURECHANGED:
+            processed = HandleCaptureChanged((WXHWND) (HWND) lParam);
+            break;
+
         case WM_QUERYNEWPALETTE:
             processed = HandleQueryNewPalette();
             break;
@@ -3509,6 +3523,14 @@ bool wxWindowMSW::HandlePaletteChanged(WXHWND hWndPalChange)
     return GetEventHandler()->ProcessEvent(event);
 }
 
+bool wxWindowMSW::HandleCaptureChanged(WXHWND hWndGainedCapture)
+{
+    wxMouseCaptureChangedEvent event(GetId(), wxFindWinFromHandle(hWndGainedCapture));
+    event.SetEventObject(this);
+
+    return GetEventHandler()->ProcessEvent(event);
+}
+
 bool wxWindowMSW::HandleQueryNewPalette()
 {