+ if (g_blockEventsOnDrag) return;
+
+ int curSelection = combo->GetSelection();
+
+ 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 (-2)
+ // 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 == -2)
+ {
+ wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, combo->GetId() );
+ event.SetInt( curSelection );
+ event.SetString( combo->GetStringSelection() );
+ event.SetEventObject( combo );
+ combo->GetEventHandler()->ProcessEvent( event );
+ }
+
+ // Now send the event ourselves
+ wxCommandEvent event2( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
+ event2.SetString( combo->GetValue() );
+ event2.SetEventObject( combo );
+ combo->GetEventHandler()->ProcessEvent( event2 );
+}