From 9d7e0c255f8df252a67f60bbb3ddd8c6b4dde0d9 Mon Sep 17 00:00:00 2001 From: compudj Date: Mon, 6 Mar 2006 03:56:09 +0000 Subject: [PATCH] 0.5.26 git-svn-id: http://ltt.polymtl.ca/svn@1574 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/ChangeLog | 3 + ltt/branches/poly/configure.in | 2 +- ltt/branches/poly/facilities/Makefile.am | 6 +- ltt/branches/poly/facilities/user_generic.xml | 15 + ltt/branches/poly/ltt/tracefile.c | 11 +- .../poly/lttv/modules/gui/controlflow/cfv.c | 41 +++ .../lttv/modules/gui/controlflow/drawing.c | 1 + .../modules/gui/controlflow/processlist.c | 24 ++ .../lttv/modules/gui/detailedevents/events.c | 269 +++++++++++++----- 9 files changed, 292 insertions(+), 80 deletions(-) create mode 100644 ltt/branches/poly/facilities/user_generic.xml diff --git a/ltt/branches/poly/ChangeLog b/ltt/branches/poly/ChangeLog index cb342b11..0175fcaf 100644 --- a/ltt/branches/poly/ChangeLog +++ b/ltt/branches/poly/ChangeLog @@ -1,5 +1,8 @@ LinuxTraceToolkit ChangeLog +05/03/2006 LTTV 0.8.26 + Add mouse scroll support. + Add user_generic.xml facility. 01/03/2006 LTTV 0.8.25 Fix process end of life in state.c 28/02/2006 LTTV 0.8.24 diff --git a/ltt/branches/poly/configure.in b/ltt/branches/poly/configure.in index 2285bf68..61ca6f79 100644 --- a/ltt/branches/poly/configure.in +++ b/ltt/branches/poly/configure.in @@ -23,7 +23,7 @@ AC_PREREQ(2.57) AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS) #AC_WITH_LTDL # not needed ? -AM_INIT_AUTOMAKE(LinuxTraceToolkitViewer,0.8.25-01032006) +AM_INIT_AUTOMAKE(LinuxTraceToolkitViewer,0.8.26-05032006) AM_CONFIG_HEADER(config.h) AM_PROG_LIBTOOL diff --git a/ltt/branches/poly/facilities/Makefile.am b/ltt/branches/poly/facilities/Makefile.am index 510a89ea..c5e6f0db 100644 --- a/ltt/branches/poly/facilities/Makefile.am +++ b/ltt/branches/poly/facilities/Makefile.am @@ -14,7 +14,8 @@ network.xml \ process.xml \ socket.xml \ statedump.xml \ -timer.xml +timer.xml \ +user_generic.xml facilities_DATA = \ core.xml \ @@ -31,7 +32,8 @@ network.xml \ process.xml \ socket.xml \ statedump.xml \ -timer.xml +timer.xml \ +user_generic.xml facilitiesdir = $(pkgdatadir)/facilities diff --git a/ltt/branches/poly/facilities/user_generic.xml b/ltt/branches/poly/facilities/user_generic.xml new file mode 100644 index 00000000..d4631947 --- /dev/null +++ b/ltt/branches/poly/facilities/user_generic.xml @@ -0,0 +1,15 @@ + + Generic user space facility + + + Takes a string from user space + + + + + Takes a string and pointer from user space + + + + + diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index 79063373..a1e19a7f 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -1932,7 +1932,7 @@ void ltt_update_event_size(LttTracefile *tf) } } else { if(!f->exists) { - g_error("Unknown facility %hhu (0x%hhx) in tracefile %s", + g_warning("Unknown facility %hhu (0x%hhx) in tracefile %s", tf->event.facility_id, tf->event.facility_id, g_quark_to_string(tf->name)); @@ -1943,7 +1943,7 @@ void ltt_update_event_size(LttTracefile *tf) ltt_facility_eventtype_get(f, tf->event.event_id); if(!event_type) { - g_error("Unknown event id %hhu in facility %s in tracefile %s", + g_warning("Unknown event id %hhu in facility %s in tracefile %s", tf->event.event_id, g_quark_to_string(f->name), g_quark_to_string(tf->name)); @@ -1972,7 +1972,12 @@ void ltt_update_event_size(LttTracefile *tf) facility_error: event_type_error: event_id_error: - tf->event.data_size = 0; + if(tf->event.event_size == 0xFFFF) { + g_error("Cannot jump over an unknown event bigger than 0xFFFE bytes"); + } + /* The facility is unknown : use the kernel information about this event + * to jump over it. */ + tf->event.data_size = tf->event.event_size; } diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c b/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c index 47ad080b..ad1e5fb7 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c @@ -47,6 +47,38 @@ header_size_allocate(GtkWidget *widget, return 0; } +gboolean cfv_scroll_event(GtkWidget *widget, GdkEventScroll *event, + gpointer data) +{ + ControlFlowData *control_flow_data = (ControlFlowData*)data; + unsigned int cell_height = + get_cell_height( + GTK_TREE_VIEW(control_flow_data->process_list->process_list_widget)); + gdouble new; + + switch(event->direction) { + case GDK_SCROLL_UP: + { + new = gtk_adjustment_get_value(control_flow_data->v_adjust) + - cell_height; + } + break; + case GDK_SCROLL_DOWN: + { + new = gtk_adjustment_get_value(control_flow_data->v_adjust) + + cell_height; + } + break; + default: + return FALSE; + } + if(new >= control_flow_data->v_adjust->lower && + new <= control_flow_data->v_adjust->upper + - control_flow_data->v_adjust->page_size) + gtk_adjustment_set_value(control_flow_data->v_adjust, new); + return TRUE; +} + /***************************************************************************** * Control Flow Viewer class implementation * @@ -98,6 +130,15 @@ guicontrolflow(Tab *tab) GTK_ADJUSTMENT( control_flow_data->v_adjust)); + g_signal_connect (G_OBJECT(process_list_widget), + "scroll-event", + G_CALLBACK (cfv_scroll_event), + (gpointer)control_flow_data); + g_signal_connect (G_OBJECT(drawing_area), + "scroll-event", + G_CALLBACK (cfv_scroll_event), + (gpointer)control_flow_data); + g_signal_connect (G_OBJECT(control_flow_data->process_list->button), "size-allocate", G_CALLBACK(header_size_allocate), diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c index 84671ebc..08f6cc54 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c @@ -1030,6 +1030,7 @@ Drawing_t *drawing_construct(ControlFlowData *control_flow_data) G_CALLBACK (button_press_event), (gpointer)drawing); + gtk_widget_show(drawing->ruler); gtk_widget_show(drawing->padding); gtk_widget_show(drawing->ruler_hbox); diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c b/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c index c1c9ad47..6edb0c2c 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/processlist.c @@ -141,6 +141,30 @@ void destroy_hash_key(gpointer key); void destroy_hash_data(gpointer data); +gboolean scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer data) +{ + ControlFlowData *control_flow_data = + (ControlFlowData*)g_object_get_data( + G_OBJECT(widget), + "control_flow_data"); + Drawing_t *drawing = control_flow_data->drawing; + unsigned int cell_height = + get_cell_height(GTK_TREE_VIEW(control_flow_data->process_list->process_list_widget)); + + switch(event->direction) { + case GDK_SCROLL_UP: + gtk_adjustment_set_value(control_flow_data->v_adjust, + gtk_adjustment_get_value(control_flow_data->v_adjust) - cell_height); + break; + case GDK_SCROLL_DOWN: + gtk_adjustment_set_value(control_flow_data->v_adjust, + gtk_adjustment_get_value(control_flow_data->v_adjust) + cell_height); + break; + } + return TRUE; +} + + static void update_index_to_pixmap_each(ProcessInfo *key, HashedProcessData *value, ProcessList *process_list) diff --git a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c index 8a05d9c4..985044eb 100644 --- a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c +++ b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c @@ -74,7 +74,7 @@ #endif #define abs(a) (((a)<0)?(-a):(a)) - +#define max(a,b) ((a)>(b)?(a):(b)) /** Array containing instanced objects. Used when module is unloaded */ static GSList *g_event_viewer_data_list = NULL ; @@ -179,6 +179,7 @@ static void tree_v_size_request_cb (GtkWidget *widget, static void tree_v_cursor_changed_cb (GtkWidget *widget, gpointer data); static void tree_v_move_cursor_cb (GtkWidget *widget, GtkMovementStep arg1, gint arg2, gpointer data); +static void tree_v_scroll_handler (GtkWidget *widget, GdkEventScroll *event, gpointer data); static gboolean key_handler(GtkWidget *widget, GdkEventKey *event, gpointer user_data); @@ -319,6 +320,10 @@ gui_events(Tab *tab) G_CALLBACK(key_handler), event_viewer_data); + g_signal_connect (G_OBJECT(event_viewer_data->tree_v), "scroll-event", + G_CALLBACK(tree_v_scroll_handler), + event_viewer_data); + // Use on each column! //gtk_tree_view_column_set_sizing(event_viewer_data->tree_v, //GTK_TREE_VIEW_COLUMN_FIXED); @@ -692,6 +697,7 @@ void tree_v_move_cursor_cb (GtkWidget *widget, if(lttvwindow_events_request_pending(event_viewer_data->tab)) return; /* If no prior position... */ +#if 0 if(ltt_time_compare( lttv_traceset_context_position_get_time( event_viewer_data->currently_selected_position), @@ -705,7 +711,7 @@ void tree_v_move_cursor_cb (GtkWidget *widget, return; } - +#endif //0 g_debug("tree view move cursor : arg1 is %u and arg2 is %d", (guint)arg1, arg2); @@ -724,17 +730,38 @@ void tree_v_move_cursor_cb (GtkWidget *widget, /* Must get down one event and select the last one */ gtk_tree_selection_unselect_all(gtk_tree_view_get_selection( GTK_TREE_VIEW(event_viewer_data->tree_v))); - event_viewer_data->update_cursor = FALSE; - gtk_adjustment_set_value(event_viewer_data->vadjust_c, - gtk_adjustment_get_value(event_viewer_data->vadjust_c) + 1); - event_viewer_data->update_cursor = TRUE; - path = gtk_tree_path_new_from_indices( - event_viewer_data->pos->len - 1, -1); - gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), - path, NULL, FALSE); - gtk_tree_path_free(path); - } - } + event_viewer_data->update_cursor = FALSE; + gtk_adjustment_set_value(event_viewer_data->vadjust_c, + gtk_adjustment_get_value(event_viewer_data->vadjust_c) + 1); + event_viewer_data->update_cursor = TRUE; + if(event_viewer_data->pos->len > 0) { + path = gtk_tree_path_new_from_indices( + max(0, event_viewer_data->pos->len - 1), -1); + if(path) { + gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), + path, NULL, FALSE); + gtk_tree_path_free(path); + } + } + } + } else { + /* Must get down one event and select the last one */ + gtk_tree_selection_unselect_all(gtk_tree_view_get_selection( + GTK_TREE_VIEW(event_viewer_data->tree_v))); + event_viewer_data->update_cursor = FALSE; + gtk_adjustment_set_value(event_viewer_data->vadjust_c, + gtk_adjustment_get_value(event_viewer_data->vadjust_c) + 1); + event_viewer_data->update_cursor = TRUE; + if(event_viewer_data->pos->len > 0) { + path = gtk_tree_path_new_from_indices( + max(0, event_viewer_data->pos->len - 1), -1); + if(path) { + gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), + path, NULL, FALSE); + gtk_tree_path_free(path); + } + } + } } else { if(event_viewer_data->pos->len > 0) { @@ -748,17 +775,45 @@ void tree_v_move_cursor_cb (GtkWidget *widget, /* Must get up one event and select the first one */ gtk_tree_selection_unselect_all(gtk_tree_view_get_selection( GTK_TREE_VIEW(event_viewer_data->tree_v))); - event_viewer_data->update_cursor = FALSE; - gtk_adjustment_set_value(event_viewer_data->vadjust_c, - gtk_adjustment_get_value(event_viewer_data->vadjust_c) - 1); - event_viewer_data->update_cursor = TRUE; - path = gtk_tree_path_new_from_indices( - 0, -1); - gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), - path, NULL, FALSE); - gtk_tree_path_free(path); - } - } + event_viewer_data->update_cursor = FALSE; + gtk_adjustment_set_value(event_viewer_data->vadjust_c, + gtk_adjustment_get_value(event_viewer_data->vadjust_c) - 1); + event_viewer_data->update_cursor = TRUE; + if(event_viewer_data->pos->len > 0) { + path = gtk_tree_path_new_from_indices( + 0, -1); + if(path) { + gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), + path, NULL, FALSE); + gtk_tree_path_free(path); + } + } + } + } else { + /* Must get up one event and select the first one */ + g_printf("a\n"); + gtk_tree_selection_unselect_all(gtk_tree_view_get_selection( + GTK_TREE_VIEW(event_viewer_data->tree_v))); + g_printf("b\n"); + event_viewer_data->update_cursor = FALSE; + g_printf("c\n"); + gtk_adjustment_set_value(event_viewer_data->vadjust_c, + gtk_adjustment_get_value(event_viewer_data->vadjust_c) - 1); + g_printf("d\n"); + event_viewer_data->update_cursor = TRUE; + if(event_viewer_data->pos->len > 0) { + path = gtk_tree_path_new_from_indices( + 0, -1); + g_printf("e\n"); + if(path) { + gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), + path, NULL, FALSE); + g_printf("f\n"); + gtk_tree_path_free(path); + g_printf("g\n"); + } + } + } } break; case GTK_MOVEMENT_PAGES: @@ -774,21 +829,38 @@ void tree_v_move_cursor_cb (GtkWidget *widget, /* Must get down one page and select the last one */ gtk_tree_selection_unselect_all(gtk_tree_view_get_selection( GTK_TREE_VIEW(event_viewer_data->tree_v))); - - event_viewer_data->update_cursor = FALSE; - gtk_adjustment_set_value(event_viewer_data->vadjust_c, - gtk_adjustment_get_value(event_viewer_data->vadjust_c) + 2); - event_viewer_data->update_cursor = TRUE; - - path = gtk_tree_path_new_from_indices( - event_viewer_data->pos->len - 1, -1); - gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), - path, NULL, FALSE); - gtk_tree_path_free(path); - - } - } - + event_viewer_data->update_cursor = FALSE; + gtk_adjustment_set_value(event_viewer_data->vadjust_c, + gtk_adjustment_get_value(event_viewer_data->vadjust_c) + 2); + event_viewer_data->update_cursor = TRUE; + if(event_viewer_data->pos->len > 0) { + path = gtk_tree_path_new_from_indices( + event_viewer_data->pos->len - 1, -1); + if(path) { + gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), + path, NULL, FALSE); + gtk_tree_path_free(path); + } + } + } + } else { + /* Must get down one page and select the last one */ + gtk_tree_selection_unselect_all(gtk_tree_view_get_selection( + GTK_TREE_VIEW(event_viewer_data->tree_v))); + event_viewer_data->update_cursor = FALSE; + gtk_adjustment_set_value(event_viewer_data->vadjust_c, + gtk_adjustment_get_value(event_viewer_data->vadjust_c) + 2); + event_viewer_data->update_cursor = TRUE; + if(event_viewer_data->pos->len > 0) { + path = gtk_tree_path_new_from_indices( + event_viewer_data->pos->len - 1, -1); + if(path) { + gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), + path, NULL, FALSE); + gtk_tree_path_free(path); + } + } + } } else { /* Move one page up */ if(event_viewer_data->pos->len > 0) { @@ -801,20 +873,44 @@ void tree_v_move_cursor_cb (GtkWidget *widget, /* Must get up one page and select the first one */ gtk_tree_selection_unselect_all(gtk_tree_view_get_selection( GTK_TREE_VIEW(event_viewer_data->tree_v))); - - event_viewer_data->update_cursor = FALSE; - gtk_adjustment_set_value(event_viewer_data->vadjust_c, - gtk_adjustment_get_value(event_viewer_data->vadjust_c) - 2); - event_viewer_data->update_cursor = TRUE; - - path = gtk_tree_path_new_from_indices( - 0, -1); - gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), - path, NULL, FALSE); - gtk_tree_path_free(path); - } - } - + event_viewer_data->update_cursor = FALSE; + gtk_adjustment_set_value(event_viewer_data->vadjust_c, + gtk_adjustment_get_value(event_viewer_data->vadjust_c) - 2); + event_viewer_data->update_cursor = TRUE; + if(event_viewer_data->pos->len > 0) { + path = gtk_tree_path_new_from_indices( + 0, -1); + if(path) { + gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), + path, NULL, FALSE); + gtk_tree_path_free(path); + } + } + } + } else { + /* Must get up one page and select the first one */ + printf("A\n"); + gtk_tree_selection_unselect_all(gtk_tree_view_get_selection( + GTK_TREE_VIEW(event_viewer_data->tree_v))); + printf("B\n"); + event_viewer_data->update_cursor = FALSE; + gtk_adjustment_set_value(event_viewer_data->vadjust_c, + gtk_adjustment_get_value(event_viewer_data->vadjust_c) - 2); + printf("C\n"); + event_viewer_data->update_cursor = TRUE; + if(event_viewer_data->pos->len > 0) { + path = gtk_tree_path_new_from_indices( + 0, -1); + printf("D\n"); + if(path) { + gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), + path, NULL, FALSE); + printf("E\n"); + gtk_tree_path_free(path); + printf("F\n"); + } + } + } } break; default: @@ -942,6 +1038,25 @@ void tree_v_move_cursor_cb (GtkWidget *widget, #endif //0 } + +gboolean tree_v_scroll_handler (GtkWidget *widget, GdkEventScroll *event, gpointer data) +{ + EventViewerData *event_viewer_data = (EventViewerData*) data; + Tab *tab = event_viewer_data->tab; + + switch(event->direction) { + case GDK_SCROLL_UP: + gtk_adjustment_set_value(event_viewer_data->vadjust_c, + gtk_adjustment_get_value(event_viewer_data->vadjust_c) - 1); + break; + case GDK_SCROLL_DOWN: + gtk_adjustment_set_value(event_viewer_data->vadjust_c, + gtk_adjustment_get_value(event_viewer_data->vadjust_c) + 1); + break; + } + return TRUE; +} + void tree_v_cursor_changed_cb (GtkWidget *widget, gpointer data) { EventViewerData *event_viewer_data = (EventViewerData*) data; @@ -955,22 +1070,24 @@ void tree_v_cursor_changed_cb (GtkWidget *widget, gpointer data) /* On cursor change, modify the currently selected event by calling * the right API function */ - - if(event_viewer_data->report_position) { - gtk_tree_view_get_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), - &path, NULL); - if(gtk_tree_model_get_iter(model,&iter,path)){ - gtk_tree_model_get(model, &iter, POSITION_COLUMN, &pos, -1); - - if(lttv_traceset_context_pos_pos_compare(pos, - event_viewer_data->currently_selected_position) != 0) - lttvwindow_report_current_position(tab, pos); - }else{ - g_warning("Can not get iter\n"); - } - gtk_tree_path_free(path); - } + if(event_viewer_data->pos->len > 0) { + gtk_tree_view_get_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), + &path, NULL); + if(path) { + if(gtk_tree_model_get_iter(model,&iter,path)){ + gtk_tree_model_get(model, &iter, POSITION_COLUMN, &pos, -1); + + if(lttv_traceset_context_pos_pos_compare(pos, + event_viewer_data->currently_selected_position) != 0) + lttvwindow_report_current_position(tab, pos); + }else{ + g_warning("Can not get iter\n"); + } + gtk_tree_path_free(path); + } + } + } } @@ -1429,9 +1546,11 @@ int event_hook(void *hook_data, void *call_data) event_viewer_data->currently_selected_position) == 0) { GtkTreePath *path = gtk_tree_path_new_from_indices( event_viewer_data->pos->len - 1, -1); - gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), - path, NULL, FALSE); - gtk_tree_path_free(path); + if(path) { + gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), + path, NULL, FALSE); + gtk_tree_path_free(path); + } } } @@ -1455,9 +1574,11 @@ static void event_update_selection(EventViewerData *event_viewer_data) if(lttv_traceset_context_pos_pos_compare(cur_pos, event_viewer_data->currently_selected_position) == 0) { GtkTreePath *path = gtk_tree_path_new_from_indices(i, -1); - gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), - path, NULL, FALSE); - gtk_tree_path_free(path); + if(path) { + gtk_tree_view_set_cursor(GTK_TREE_VIEW(event_viewer_data->tree_v), + path, NULL, FALSE); + gtk_tree_path_free(path); + } } } } -- 2.34.1