X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d1fe917ba097fd8039a4340d1d82115f72cbbd91..763f55468e441e94e65a72b127c8fc2a48c91e91:/src/msw/window.cpp?ds=sidebyside diff --git a/src/msw/window.cpp b/src/msw/window.cpp index b3e1b3f174..7e0faddaea 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -297,6 +297,7 @@ void wxWindowMSW::Init() m_oldWndProc = 0; m_useCtl3D = FALSE; m_mouseInWindow = FALSE; + m_lastKeydownProcessed = FALSE; // wxWnd m_hMenu = 0; @@ -1084,7 +1085,8 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const if ( flags & wxCLIP_SIBLINGS ) style |= WS_CLIPSIBLINGS; - if ( (flags & wxBORDER_MASK) != wxBORDER_NONE ) + wxBorder border = (wxBorder)(flags & wxBORDER_MASK); + if ( border != wxBORDER_NONE && border != wxBORDER_DEFAULT ) style |= WS_BORDER; // now deal with ext style if the caller wants it @@ -1103,6 +1105,7 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const case wxBORDER_NONE: case wxBORDER_SIMPLE: + case wxBORDER_DEFAULT: break; case wxBORDER_STATIC: @@ -1113,7 +1116,6 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const *exstyle |= WS_EX_WINDOWEDGE; break; - case wxBORDER_DEFAULT: case wxBORDER_SUNKEN: *exstyle |= WS_EX_CLIENTEDGE; break; @@ -1273,7 +1275,9 @@ void wxWindowMSW::OnIdle(wxIdleEvent& WXUNUSED(event)) // Check if we need to send a LEAVE event if ( m_mouseInWindow ) { - if ( !IsMouseInWindow() && !HasCapture()) + // note that we should generate the leave event whether the window has + // or doesn't have mouse capture + if ( !IsMouseInWindow() ) { // Generate a LEAVE event m_mouseInWindow = FALSE; @@ -1642,15 +1646,6 @@ void wxWindowMSW::DoSetClientSize(int width, int height) break; } - if ( i == 3 ) - { - // how did it happen? maybe OnSize() handler does something really - // strange in this class? - wxFAIL_MSG( _T("logic error in DoSetClientSize") ); - - break; - } - int widthClient = width, heightClient = height; @@ -2469,12 +2464,13 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam case WM_SYSKEYDOWN: case WM_KEYDOWN: + m_lastKeydownProcessed = FALSE; // If this has been processed by an event handler, // return 0 now (we've handled it). if ( HandleKeyDown((WORD) wParam, lParam) ) { processed = TRUE; - + m_lastKeydownProcessed = TRUE; break; } @@ -2482,7 +2478,6 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam if ( wParam == VK_SHIFT || wParam == VK_CONTROL ) { processed = TRUE; - break; } @@ -2709,21 +2704,6 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam } break; #endif // __WIN32__ - - // unfortunately this doesn't really work as then window which - // doesn't accept focus doesn't get any mouse events neither which - // means it can't get any input at all -#if 0 //def __WXUNIVERSAL__ - case WM_NCHITTEST: - // we shouldn't allow the windows which don't want to get focus to - // get it - if ( !AcceptsFocus() ) - { - rc.result = HTTRANSPARENT; - processed = TRUE; - } - break; -#endif // __WXUNIVERSAL__ } if ( !processed ) @@ -4056,6 +4036,14 @@ wxKeyEvent wxWindowMSW::CreateKeyEvent(wxEventType evType, // WM_KEYDOWN one bool wxWindowMSW::HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII) { + if (m_lastKeydownProcessed) { + // The key was handled in the EVT_KEY_DOWN. Handling a key in an + // EVT_KEY_DOWN handler is meant, by design, to prevent EVT_CHARs + // from happening, so just bail out at this point. + m_lastKeydownProcessed = FALSE; + return TRUE; + } + bool ctrlDown = FALSE; int id; @@ -5170,6 +5158,7 @@ wxPoint wxGetMousePosition() { POINT pt; GetCursorPos( & pt ); + return wxPoint(pt.x, pt.y); }