From c55068cea542836c1a0898244090ad49135f7800 Mon Sep 17 00:00:00 2001 From: compudj Date: Fri, 23 May 2008 05:18:14 +0000 Subject: [PATCH] finally fixed the control flow view size git-svn-id: http://ltt.polymtl.ca/svn@2913 04897980-b3bd-0310-b5e0-8ef037075253 --- .../modules/gui/controlflow/processlist.c | 50 +++++++++++++------ .../gui/lttvwindow/lttvwindow/lttvwindow.c | 9 +++- 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c b/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c index e49b74ac..a600cfa2 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c @@ -400,22 +400,15 @@ ProcessList *processlist_construct(void) renderer = gtk_cell_renderer_text_new (); process_list->renderer = renderer; - gint vertical_separator; - gint tree_line_width; - gtk_widget_style_get (GTK_WIDGET (process_list->process_list_widget), - "vertical-separator", &vertical_separator, - "tree-line-width", &tree_line_width, - NULL); - gtk_cell_renderer_get_size(renderer, - GTK_WIDGET(process_list->process_list_widget), - NULL, - NULL, - NULL, - NULL, - &process_list->cell_height); + /* Add a temporary row to the model to get the cell size when the first + * real process is added. */ + GtkTreeIter iter; + GtkTreePath *path; + path = gtk_tree_path_new_first(); + gtk_tree_model_get_iter (gtk_tree_view_get_model(GTK_TREE_VIEW(process_list->process_list_widget)), &iter, path); + gtk_list_store_append(process_list->list_store, &iter); - process_list->cell_height += vertical_separator; - process_list->cell_height += tree_line_width; + process_list->cell_height = 0; // not ready to get size yet. column = gtk_tree_view_column_new_with_attributes ( "Process", renderer, @@ -669,6 +662,21 @@ int processlist_add( ProcessList *process_list, hashed_process_data->x.under_marked = FALSE; hashed_process_data->next_good_time = ltt_time_zero; + if (process_list->cell_height == 0) { + GtkTreePath *path; + GdkRectangle rect; + GtkTreeIter iter; + + path = gtk_tree_path_new_first(); + gtk_tree_model_get_iter (gtk_tree_view_get_model(GTK_TREE_VIEW(process_list->process_list_widget)), &iter, path); + gtk_tree_view_get_background_area( + GTK_TREE_VIEW(process_list->process_list_widget), + path, NULL, &rect); + gtk_list_store_remove(process_list->list_store, &iter); + gtk_tree_path_free (path); + process_list->cell_height = rect.height; + } + /* Add a new row to the model */ gtk_list_store_append ( process_list->list_store, &hashed_process_data->y_iter); @@ -693,9 +701,19 @@ int processlist_add( ProcessList *process_list, (gpointer)hashed_process_data); process_list->number_of_process++; +#if 0 + GtkTreePath *path; + GdkRectangle rect; + gtk_widget_queue_draw(process_list->process_list_widget); + path = gtk_tree_path_new_first(); + gtk_tree_view_get_background_area(GTK_TREE_VIEW(process_list->process_list_widget), + path, NULL, &rect); + gtk_tree_path_free (path); + process_list->cell_height = rect.height; +#endif //0 - hashed_process_data->height = process_list->cell_height; + hashed_process_data->height = process_list->cell_height; g_assert(hashed_process_data->height != 0); *height = hashed_process_data->height * process_list->number_of_process; diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c index 5ff1c55c..3dea5a92 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c @@ -938,8 +938,13 @@ __EXPORT void lttvwindow_events_request(Tab *tab, /* Redraw has +20 priority. We want to let the redraw be done while we do * our job. Mathieu : test with high prio higher than events for better * scrolling. */ - //g_idle_add_full((G_PRIORITY_HIGH_IDLE + 21), - g_idle_add_full((G_PRIORITY_DEFAULT + 2), + /* Mathieu, 2008 : ok, finally, the control flow view needs the cell updates + * to come soon enough so we can have one active cell to get the pixmap + * buffer height from. Therefore, let the gdk events run before the events + * requests. + */ + g_idle_add_full((G_PRIORITY_HIGH_IDLE + 21), + //g_idle_add_full((G_PRIORITY_DEFAULT + 2), (GSourceFunc)execute_events_requests, tab, NULL); -- 2.34.1