Don't generate wxEVT_CHAR_HOOK events while the mouse is captured.

This prevents the parent TLW from interfering with the keyboard handling of
the window that captured the mouse which very often needs Escape for itself to
cancel the capture.

In particular, this fixes the problems with Escape closing the entire dialog
containing the controls instead of closing just the combobox drop down or a
popup menu in wxMSW.

Also modify wxGTK for consistency and update the documentation.

Closes #12952.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67191 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-03-14 11:55:01 +00:00
parent ff45048665
commit 5c16a69952
4 changed files with 30 additions and 13 deletions

View File

@@ -6521,7 +6521,13 @@ wxKeyboardHook(int nCode, WORD wParam, DWORD lParam)
// Don't intercept keyboard entry (notably Escape) if a modal window
// (not managed by wx, e.g. IME one) is currently opened as more often
// than not it needs all the keys for itself.
if ( !gs_modalEntryWindowCount )
//
// Also don't catch it if a window currently captures the mouse as
// Escape is normally used to release the mouse capture and if you
// really need to catch all the keys in the window that has mouse
// capture it can be easily done in its own EVT_CHAR handler as it is
// certain to have focus while it has the capture.
if ( !gs_modalEntryWindowCount && !::GetCapture() )
{
if ( id != WXK_NONE
#if wxUSE_UNICODE