Commit f9a71fb6 authored by Ell's avatar Ell

app: work around GTK bug causing UI freeze during tree-view operations

In GimpContainerTreeView, work around a GTK bug which can cause the
window containing the tree view to stop processing updates,
resulting in an apprarent freeze, until update-processing is
explicitly requested.  This can be triggered by adding layers to a
layer group until the layers-dialog tree view is almost full, but
still doesn't have a scrollbar, and then duplicating the group.

This doesn't seem to affect GTK3, so not applying to master.
parent 7b8d8a29
......@@ -107,6 +107,8 @@ static void gimp_container_tree_view_name_started (GtkCellRenderer
static void gimp_container_tree_view_name_canceled (GtkCellRendererText *cell,
GimpContainerTreeView *tree_view);
static void gimp_container_tree_view_cursor_changed (GtkTreeView *view,
GimpContainerTreeView *tree_view);
static void gimp_container_tree_view_selection_changed (GtkTreeSelection *sel,
GimpContainerTreeView *tree_view);
static gboolean gimp_container_tree_view_button_press (GtkWidget *widget,
......@@ -138,6 +140,8 @@ static void gimp_container_tree_view_expand_rows (GtkTreeModel
static void gimp_container_tree_view_monitor_changed (GimpContainerTreeView *view);
static void gimp_container_tree_view_process_updates (GimpContainerTreeView *tree_view);
G_DEFINE_TYPE_WITH_CODE (GimpContainerTreeView, gimp_container_tree_view,
......@@ -265,6 +269,10 @@ gimp_container_tree_view_constructed (GObject *object)
gimp_container_view_set_dnd_widget (view, GTK_WIDGET (tree_view->view));
g_signal_connect (tree_view->view, "cursor-changed",
G_CALLBACK (gimp_container_tree_view_cursor_changed),
tree_view->main_column = gtk_tree_view_column_new ();
gtk_tree_view_insert_column (tree_view->view, tree_view->main_column, 0);
......@@ -1092,6 +1100,13 @@ gimp_container_tree_view_name_canceled (GtkCellRendererText *cell,
static void
gimp_container_tree_view_cursor_changed (GtkTreeView *view,
GimpContainerTreeView *tree_view)
gimp_container_tree_view_process_updates (tree_view);
static void
gimp_container_tree_view_selection_changed (GtkTreeSelection *selection,
GimpContainerTreeView *tree_view)
......@@ -1102,6 +1117,8 @@ gimp_container_tree_view_selection_changed (GtkTreeSelection *selection,
gimp_container_tree_view_get_selected (view, &items);
gimp_container_view_multi_selected (view, items);
g_list_free (items);
gimp_container_tree_view_process_updates (tree_view);
static GtkCellRenderer *
......@@ -1662,3 +1679,16 @@ gimp_container_tree_view_monitor_changed (GimpContainerTreeView *view)
static void
gimp_container_tree_view_process_updates (GimpContainerTreeView *tree_view)
GdkWindow *window = gtk_tree_view_get_bin_window (tree_view->view);
/* this is a hack, necessary to work around a gtk bug which can cause the
* window containing the tree view to stop processing updates until
* explicitly requested.
if (window)
gdk_window_process_updates (window, TRUE);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment