]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/window.cpp
Applied BMP patch.
[wxWidgets.git] / src / gtk1 / window.cpp
index 753c10c86d05d7ffd1099d10a8afda4e9f92ca28..cf23db38e6e77004daa6cff5d620ebbeb1ca0d75 100644 (file)
@@ -1600,15 +1600,30 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(
     }
 #endif // wxUSE_CARET
 
-    wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
-    event.SetEventObject( win );
+    if (win->IsTopLevel())
+    {
+        wxActivateEvent event( wxEVT_ACTIVATE, TRUE, win->GetId() );
+        event.SetEventObject( win );
 
-    if (win->GetEventHandler()->ProcessEvent( event ))
+        if (win->GetEventHandler()->ProcessEvent( event ))
+        {
+            gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" );
+            return TRUE;
+        }
+    }
+    else
     {
-        gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" );
-        return TRUE;
+        wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
+        event.SetEventObject( win );
+
+        if (win->GetEventHandler()->ProcessEvent( event ))
+        {
+            gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" );
+            return TRUE;
+        }
     }
 
+
     return FALSE;
 }
 
@@ -1658,13 +1673,27 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
     }
 #endif // wxUSE_CARET
 
-    wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
-    event.SetEventObject( win );
+    if (win->IsTopLevel())
+    {
+        wxActivateEvent event( wxEVT_ACTIVATE, FALSE, win->GetId() );
+        event.SetEventObject( win );
 
-    if (win->GetEventHandler()->ProcessEvent( event ))
+        if (win->GetEventHandler()->ProcessEvent( event ))
+        {
+            gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_out_event" );
+            return TRUE;
+        }
+    }
+    else
     {
-        gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_out_event" );
-        return TRUE;
+        wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
+        event.SetEventObject( win );
+
+        if (win->GetEventHandler()->ProcessEvent( event ))
+        {
+            gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_out_event" );
+            return TRUE;
+        }
     }
 
     return FALSE;
@@ -2647,7 +2676,7 @@ void wxWindow::OnInternalIdle()
         // do it only once
         g_sendActivateEvent = -1;
 
-        wxActivateEvent event(wxEVT_ACTIVATE, activate, GetId());
+        wxActivateEvent event(wxEVT_ACTIVATE_APP, activate, GetId());
         event.SetEventObject(this);
 
         (void)GetEventHandler()->ProcessEvent(event);