]> git.saurik.com Git - wxWidgets.git/commitdiff
Next try on pop up menus. (#ifdef x11).
authorRobert Roebling <robert@roebling.de>
Sun, 10 Mar 2002 20:35:55 +0000 (20:35 +0000)
committerRobert Roebling <robert@roebling.de>
Sun, 10 Mar 2002 20:35:55 +0000 (20:35 +0000)
  More SetFocus() work.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14545 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/popupcmn.cpp
src/univ/themes/win32.cpp
src/x11/app.cpp
src/x11/window.cpp

index c911738e8390221171bdc230bfe23235a67049ca..931316b4410feeaecb6eadf19a1f35524c144229 100644 (file)
@@ -216,12 +216,13 @@ void wxPopupTransientWindow::PopHandlers()
 
     if ( m_focus )
     {
 
     if ( m_focus )
     {
+#ifndef __WXX11__
         if ( !m_focus->RemoveEventHandler(m_handlerFocus) )
         {
             // see above
             m_handlerFocus = NULL;
         }
         if ( !m_focus->RemoveEventHandler(m_handlerFocus) )
         {
             // see above
             m_handlerFocus = NULL;
         }
-
+#endif
         m_focus = NULL;
     }
 }
         m_focus = NULL;
     }
 }
@@ -251,6 +252,8 @@ void wxPopupTransientWindow::Popup(wxWindow *winFocus)
     m_focus = winFocus ? winFocus : this;
     m_focus->SetFocus();
 
     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
 #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);
     }
 
         m_focus->PushEventHandler(m_handlerFocus);
     }
+    
+#endif
 }
 
 void wxPopupTransientWindow::Dismiss()
 }
 
 void wxPopupTransientWindow::Dismiss()
index 8352e502e8c0974d57bb51a6280a4e0a56e52b34..936c895687439ba86c59db35605d1e03909c3eac 100644 (file)
@@ -3979,7 +3979,8 @@ bool wxWin32InputHandler::HandleMouse(wxInputConsumer *control,
     {
         wxWindow *win = control->GetInputWindow();
 
     {
         wxWindow *win = control->GetInputWindow();
 
-        if ( wxWindow::FindFocus() != control->GetInputWindow() )
+        if (( wxWindow::FindFocus() != control->GetInputWindow() ) &&
+            ( win->AcceptsFocus() ) )
         {
             win->SetFocus();
 
         {
             win->SetFocus();
 
index 34416b4f9b6f1861d9ab7339a3c3288af5da3774..1b219236a6ea3eabbdab0372341f7451f3f82c8b 100644 (file)
@@ -661,7 +661,6 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
                     g_nextFocus = win;
                     
                     win->SetFocus();
                     g_nextFocus = win;
                     
                     win->SetFocus();
-                    // return TRUE;
                 }
             }
             
                 }
             }
             
index a83a67877cfed6d59a209b3a5cd59d3ef6307401..270bb56364edd3b9b512ff163ecc49db3f5d25d5 100644 (file)
@@ -251,7 +251,17 @@ void wxWindowX11::SetFocus()
     Window xwindow = (Window) GetMainWindow();
     
     wxCHECK_RET( xwindow, wxT("invalid window") );
     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 );
     if (wxWindowIsVisible(xwindow))
     {
         XSetInputFocus( wxGlobalDisplay(), xwindow, RevertToParent, CurrentTime );