+extern "C" {
+static void
+gtk_combo_select_child_callback( GtkList *WXUNUSED(list), GtkWidget *WXUNUSED(widget), wxComboBox *combo )
+{
+ if (g_isIdle) wxapp_install_idle_handler();
+
+ if (!combo->m_hasVMT) return;
+
+ if (g_blockEventsOnDrag) return;
+
+ int curSelection = combo->GetCurrentSelection();
+
+ if (combo->m_prevSelection == curSelection) return;
+
+ GtkWidget *list = GTK_COMBO(combo->m_widget)->list;
+ gtk_list_unselect_item( GTK_LIST(list), combo->m_prevSelection );
+
+ combo->m_prevSelection = curSelection;
+
+ // Quickly set the value of the combo box
+ // as GTK+ does that only AFTER the event
+ // is sent.
+ gtk_signal_disconnect_by_func( GTK_OBJECT(GTK_COMBO(combo->GetHandle())->entry),
+ GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)combo );
+ combo->SetValue( combo->GetStringSelection() );
+ gtk_signal_connect_after( GTK_OBJECT(GTK_COMBO(combo->GetHandle())->entry), "changed",
+ GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)combo );
+
+ // throw a SELECTED event only if the combobox popup is hidden (wxID_NONE)
+ // because when combobox popup is shown, gtk_combo_select_child_callback is
+ // called each times the mouse is over an item with a pressed button so a lot
+ // of SELECTED event could be generated if the user keep the mouse button down
+ // and select other items ...
+ if (g_SelectionBeforePopup == wxID_NONE)
+ {
+ wxCommandEvent event( wxEVT_COMBOBOX, combo->GetId() );
+ event.SetInt( curSelection );
+ event.SetString( combo->GetStringSelection() );
+ event.SetEventObject( combo );
+ combo->HandleWindowEvent( event );
+
+ // for consistency with the other ports, don't generate text update
+ // events while the user is browsing the combobox neither
+ wxCommandEvent event2( wxEVT_TEXT, combo->GetId() );
+ event2.SetString( combo->GetValue() );
+ event2.SetEventObject( combo );
+ combo->HandleWindowEvent( event2 );
+ }
+}
+}
+
+//-----------------------------------------------------------------------------
+// wxComboBox
+//-----------------------------------------------------------------------------