ComboBox: Don’t popdown if releasing on scrollbar

On button release, we were popping down if the event widget was anything
but priv->button. This broke scrolling by clicking a mouse button, i.e.
when releasing a click in the trough or finishing a drag of either bar.
That’s unexpected, inconvenient, and pointless. So, let’s stop doing it.

https://bugzilla.gnome.org/show_bug.cgi?id=738893
This commit is contained in:
Daniel Boles 2017-09-04 23:41:53 +01:00
parent 2e866ca293
commit 99e27ab145

View File

@ -3160,16 +3160,21 @@ gtk_combo_box_list_button_released (GtkWidget *widget,
if (ewidget != priv->tree_view) if (ewidget != priv->tree_view)
{ {
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (priv->scrolled_window);
if (ewidget == priv->button && if (ewidget == priv->button &&
!popup_in_progress && !popup_in_progress &&
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->button))) gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->button)))
{ {
gtk_combo_box_popdown (combo_box); gtk_combo_box_popdown (combo_box);
return TRUE; return TRUE;
} }
/* released outside treeview */ /* If released outside treeview, pop down, unless finishing a scroll */
if (ewidget != priv->button) if (ewidget != priv->button &&
ewidget != gtk_scrolled_window_get_hscrollbar (scrolled_window) &&
ewidget != gtk_scrolled_window_get_vscrollbar (scrolled_window))
{ {
gtk_combo_box_popdown (combo_box); gtk_combo_box_popdown (combo_box);