widgets: Prevent Toolbox autoscroll bug
In Preferences > Toolbox, clicking on an item below the initial scroll window view causes it to jump to the top automatically. This patch prevents this by setting the clicked index in the GtkTreeView before grabbing focus.
This commit is contained in:
parent
57a6386a3f
commit
3e101922d8
1 changed files with 7 additions and 3 deletions
|
|
@ -1268,9 +1268,6 @@ gimp_container_tree_view_button (GtkWidget *widget,
|
|||
|
||||
tree_view->priv->dnd_renderer = NULL;
|
||||
|
||||
if (bevent->type != GDK_BUTTON_RELEASE && ! gtk_widget_has_focus (widget))
|
||||
gtk_widget_grab_focus (widget);
|
||||
|
||||
if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget),
|
||||
bevent->x, bevent->y,
|
||||
&path, &column, NULL, NULL))
|
||||
|
|
@ -1285,6 +1282,13 @@ gimp_container_tree_view_button (GtkWidget *widget,
|
|||
gboolean multisel_mode;
|
||||
GdkModifierType modifiers = (bevent->state & gimp_get_all_modifiers_mask ());
|
||||
|
||||
/* Confirm the path is set before grabbing focus, as it can cause
|
||||
* the list to auto-scroll to the top on first click otherwise
|
||||
*/
|
||||
gtk_tree_view_set_cursor (GTK_TREE_VIEW (widget), path, NULL, FALSE);
|
||||
if (bevent->type != GDK_BUTTON_RELEASE && ! gtk_widget_has_focus (widget))
|
||||
gtk_widget_grab_focus (widget);
|
||||
|
||||
multisel_mode = (gtk_tree_selection_get_mode (tree_view->priv->selection)
|
||||
== GTK_SELECTION_MULTIPLE);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue