]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/window.cpp
Replaced 'erase' with $(RM) so that the default file deletion program can be overriden
[wxWidgets.git] / src / gtk1 / window.cpp
index 15b54ffc16f9773d70d4959560877edfd85c1fa0..8a1f5c0cb9ea0ff3410ed7b92ca48054ff6b1264 100644 (file)
     #include "wx/caret.h"
 #endif // wxUSE_CARET
 
+#if wxUSE_TEXTCTRL
+#include "wx/textctrl.h"
+#endif
+
 #include "wx/menu.h"
 #include "wx/statusbr.h"
 #include "wx/intl.h"
@@ -1688,11 +1692,10 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget,
     printf( ".\n" );
 */
 
-    wxPanel *panel = wxDynamicCast(win->GetParent(), wxPanel);
-    if (panel)
-    {
-        panel->SetLastFocus(win);
-    }
+    // notify the parent keeping track of focus for the kbd navigation
+    // purposes that we got it
+    wxChildFocusEvent eventFocus(win);
+    (void)win->GetEventHandler()->ProcessEvent(eventFocus);
 
 #ifdef HAVE_XIM
     if (win->m_ic)
@@ -1708,6 +1711,16 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget,
     }
 #endif // wxUSE_CARET
 
+#if wxUSE_TEXTCTRL
+    // If it's a wxTextCtrl don't send the event as it will be done
+    // after the control gets to process it.
+    wxTextCtrl *ctrl = wxDynamicCast(win, wxTextCtrl);
+    if ( ctrl )
+    {
+        return FALSE;
+    }
+#endif
+
     if (win->IsTopLevel())
     {
         wxActivateEvent event( wxEVT_ACTIVATE, TRUE, win->GetId() );
@@ -1776,6 +1789,16 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
     }
 #endif // wxUSE_CARET
 
+#if wxUSE_TEXTCTRL
+    // If it's a wxTextCtrl don't send the event as it will be done
+    // after the control gets to process it.
+    wxTextCtrl *ctrl = wxDynamicCast(win, wxTextCtrl);
+    if ( ctrl )
+    {
+        return FALSE;
+    }
+#endif
+
     if (win->IsTopLevel())
     {
         wxActivateEvent event( wxEVT_ACTIVATE, FALSE, win->GetId() );
@@ -3743,15 +3766,13 @@ void wxWindowGTK::CaptureMouse()
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
 
-    wxCHECK_RET( g_captureWindow == NULL, wxT("CaptureMouse called twice") );
-
     GdkWindow *window = (GdkWindow*) NULL;
     if (m_wxwindow)
         window = GTK_PIZZA(m_wxwindow)->bin_window;
     else
         window = GetConnectWidget()->window;
 
-    if (!window) return;
+    wxCHECK_RET( window, _T("CaptureMouse() failed") );
 
     wxCursor* cursor = & m_cursor;
     if (!cursor->Ok())
@@ -3774,7 +3795,7 @@ void wxWindowGTK::ReleaseMouse()
 {
     wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
 
-    wxCHECK_RET( g_captureWindow, wxT("ReleaseMouse called twice") );
+    wxCHECK_RET( g_captureWindow, wxT("can't release mouse - not captured") );
 
     GdkWindow *window = (GdkWindow*) NULL;
     if (m_wxwindow)