diff --git a/CHANGELOG b/CHANGELOG index 8187e0c5..9184939f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ - Enable GtkTreeView fixed-height mode - Fix bug where temporary queues don't save - Fix bug where a queue is not selected on startup +- Fix bugs related to scrolling on track change 6.4.13-rc: - Rewrite GtkTreeView code diff --git a/gui/view.c b/gui/view.c index 947465e5..64364ed0 100644 --- a/gui/view.c +++ b/gui/view.c @@ -41,6 +41,7 @@ static const enum compare_t QUEUE_SORT[Q_MODEL_N_COLUMNS] = { static GtkTreeView *view_treeview = NULL; static GtkTreeModelFilter *view_filter = NULL; static unsigned int view_sort_count = 0; +static bool view_no_scroll = false; static inline GuiQueueModel *__view_filter_get_model() { @@ -147,9 +148,11 @@ static void __view_set_sort_indicators() void __view_row_activated(GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data) { + view_no_scroll = true; audio_load(__view_filter_get_track(path)); queue_selected(__view_filter_get_model()->gqm_queue, gtk_tree_path_get_indices(path)[0]); + view_no_scroll = false; } void __view_column_resized(GtkTreeViewColumn *col, GParamSpec *pspec, @@ -351,18 +354,17 @@ void gui_view_scroll() struct queue *queue = __view_filter_get_queue(); GtkTreePath *real, *path; - if (!queue || (int)queue->q_cur.it_pos < 0) + if (!queue || (int)queue->q_cur.it_pos < 0 || view_no_scroll) return; real = gtk_tree_path_new_from_indices(queue->q_cur.it_pos, -1); path = gtk_tree_model_filter_convert_child_path_to_path(view_filter, real); + if (!path) + goto out; - if (path) { - gtk_tree_view_scroll_to_cell(view_treeview, path, - NULL, TRUE, 0.5, 0.5); - gtk_tree_view_set_cursor(view_treeview, path, NULL, false); - gtk_tree_path_free(path); - } - + gtk_tree_view_set_cursor(view_treeview, path, NULL, false); + gtk_tree_view_scroll_to_cell(view_treeview, path, NULL, TRUE, 0.5, 0.5); + gtk_tree_path_free(path); +out: gtk_tree_path_free(real); }