From 9b8270da40a00836c356b36a02905f2b80a51aa1 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sun, 10 Mar 2002 20:35:55 +0000 Subject: [PATCH] Next try on pop up menus. (#ifdef x11). More SetFocus() work. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14545 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/popupcmn.cpp | 7 ++++++- src/univ/themes/win32.cpp | 3 ++- src/x11/app.cpp | 1 - src/x11/window.cpp | 12 +++++++++++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/common/popupcmn.cpp b/src/common/popupcmn.cpp index c911738e83..931316b441 100644 --- a/src/common/popupcmn.cpp +++ b/src/common/popupcmn.cpp @@ -216,12 +216,13 @@ void wxPopupTransientWindow::PopHandlers() if ( m_focus ) { +#ifndef __WXX11__ if ( !m_focus->RemoveEventHandler(m_handlerFocus) ) { // see above m_handlerFocus = NULL; } - +#endif m_focus = NULL; } } @@ -251,6 +252,8 @@ void wxPopupTransientWindow::Popup(wxWindow *winFocus) m_focus = winFocus ? winFocus : this; m_focus->SetFocus(); +#ifndef __WXX11__ + #ifdef __WXMSW__ // MSW doesn't allow to set focus to the popup window, but we need to // subclass the window which has the focus, and not winFocus passed in or @@ -264,6 +267,8 @@ void wxPopupTransientWindow::Popup(wxWindow *winFocus) m_focus->PushEventHandler(m_handlerFocus); } + +#endif } void wxPopupTransientWindow::Dismiss() diff --git a/src/univ/themes/win32.cpp b/src/univ/themes/win32.cpp index 8352e502e8..936c895687 100644 --- a/src/univ/themes/win32.cpp +++ b/src/univ/themes/win32.cpp @@ -3979,7 +3979,8 @@ bool wxWin32InputHandler::HandleMouse(wxInputConsumer *control, { wxWindow *win = control->GetInputWindow(); - if ( wxWindow::FindFocus() != control->GetInputWindow() ) + if (( wxWindow::FindFocus() != control->GetInputWindow() ) && + ( win->AcceptsFocus() ) ) { win->SetFocus(); diff --git a/src/x11/app.cpp b/src/x11/app.cpp index 34416b4f9b..1b219236a6 100644 --- a/src/x11/app.cpp +++ b/src/x11/app.cpp @@ -661,7 +661,6 @@ bool wxApp::ProcessXEvent(WXEvent* _event) g_nextFocus = win; win->SetFocus(); - // return TRUE; } } diff --git a/src/x11/window.cpp b/src/x11/window.cpp index a83a67877c..270bb56364 100644 --- a/src/x11/window.cpp +++ b/src/x11/window.cpp @@ -251,7 +251,17 @@ void wxWindowX11::SetFocus() Window xwindow = (Window) GetMainWindow(); wxCHECK_RET( xwindow, wxT("invalid window") ); - + + wxCHECK_RET( AcceptsFocus(), wxT("set focus on window that doesn't accept the focus") ); + +#if 0 + if (GetName() == "scrollBar") + { + char *crash = NULL; + *crash = 0; + } +#endif + if (wxWindowIsVisible(xwindow)) { XSetInputFocus( wxGlobalDisplay(), xwindow, RevertToParent, CurrentTime ); -- 2.45.2