From 5698740e7329b8a34faf0c178ff44a5e21654cdc Mon Sep 17 00:00:00 2001 From: compudj Date: Sat, 22 Jul 2006 17:30:35 +0000 Subject: [PATCH] gui event supports stop git-svn-id: http://ltt.polymtl.ca/svn@2011 04897980-b3bd-0310-b5e0-8ef037075253 --- .../lttv/modules/gui/detailedevents/events.c | 21 ++++++++++++++++++- .../gui/lttvwindow/lttvwindow/callbacks.c | 3 +++ .../lttvwindow/mainwindow-private.h | 1 + .../modules/gui/tutorial/.deps/tutorial.Plo | 14 ++----------- 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c index db39fcbc..84af45a0 100644 --- a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c +++ b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c @@ -78,6 +78,9 @@ #define abs(a) (((a)<0)?(-a):(a)) #define max(a,b) ((a)>(b)?(a):(b)) +/* Number of events between checks for GDK events (stop button) */ +#define CHECK_GDK_INTERVAL 50000 + /** Array containing instanced objects. Used when module is unloaded */ static GSList *g_event_viewer_data_list = NULL ; @@ -144,6 +147,8 @@ typedef struct _EventViewerData { guint32 last_tree_update_time; /* To filter out repeat keys */ + guint num_events; /* Number of events processed */ + } EventViewerData ; /** hook functions for update time interval, current time ... */ @@ -1286,6 +1291,9 @@ static void get_events(double new_value, EventViewerData *event_viewer_data) double value = new_value - event_viewer_data->previous_value; + /* Set stop button status for foreground processing */ + event_viewer_data->tab->stop_foreground = FALSE; + /* See where we have to scroll... */ ScrollDirection direction; gint relative_position; @@ -1447,11 +1455,14 @@ static void get_events(double new_value, EventViewerData *event_viewer_data) /* Mathieu : * I make the choice not to use the mainwindow lttvwindow API here : the idle * loop might have a too low priority, and we want good update while - * scrolling. + * scrolling. However, we call the gdk loop to get events periodically so the + * processing can be stopped. */ lttv_process_traceset_begin(tsc, NULL, NULL, NULL, event_viewer_data->event_hooks, NULL); + + event_viewer_data->num_events = 0; lttv_process_traceset_middle(tsc, ltt_time_infinite, G_MAXUINT, NULL); @@ -1490,6 +1501,14 @@ int event_hook(void *hook_data, void *call_data) LttvTracefileState *tfs = (LttvTracefileState*)call_data; LttEvent *e = ltt_tracefile_get_event(tfc->tf); + event_viewer_data->num_events++; + if(event_viewer_data->num_events % CHECK_GDK_INTERVAL == 0) { + while(gtk_events_pending ()) + gtk_main_iteration(); + if(event_viewer_data->tab->stop_foreground) + return TRUE; + } + LttvFilter *filter = event_viewer_data->main_win_filter; if(filter != NULL && filter->head != NULL) if(!lttv_filter_tree_parse(filter->head,e,tfc->tf, diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index 3a1eac2c..d2c2d54f 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -2168,6 +2168,7 @@ void stop_processing(GtkWidget *widget, gpointer user_data) g_slist_remove_link(tab->events_requests, remove_iter); } tab->events_request_pending = FALSE; + tab->stop_foreground = TRUE; g_idle_remove_by_data(tab); g_assert(g_slist_length(tab->events_requests) == 0); } @@ -4771,6 +4772,8 @@ void init_tab(Tab *tab, MainWindow * mw, Tab *copy_tab, /* Start with empty events requests list */ tab->events_requests = NULL; tab->events_request_pending = FALSE; + tab->stop_foreground = FALSE; + g_signal_connect(G_OBJECT(tab->scrollbar), "value-changed", diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/mainwindow-private.h b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/mainwindow-private.h index f478aae9..5bd9705e 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/mainwindow-private.h +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/mainwindow-private.h @@ -133,6 +133,7 @@ struct _Tab{ GSList *events_requests; gboolean events_request_pending; LttvAttribute *interrupted_state; + gboolean stop_foreground; }; #endif /* _MAIN_WINDOW_PRIVATE_ */ diff --git a/ltt/branches/poly/lttv/modules/gui/tutorial/.deps/tutorial.Plo b/ltt/branches/poly/lttv/modules/gui/tutorial/.deps/tutorial.Plo index b9a4990a..6abf39c7 100644 --- a/ltt/branches/poly/lttv/modules/gui/tutorial/.deps/tutorial.Plo +++ b/ltt/branches/poly/lttv/modules/gui/tutorial/.deps/tutorial.Plo @@ -2,8 +2,7 @@ tutorial.lo tutorial.o: tutorial.c /usr/include/math.h \ /usr/include/features.h /usr/include/sys/cdefs.h \ /usr/include/gnu/stubs.h /usr/include/bits/huge_val.h \ /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h \ - /usr/include/bits/mathinline.h /usr/include/glib-2.0/glib.h \ - /usr/include/glib-2.0/glib/galloca.h \ + /usr/include/glib-2.0/glib.h /usr/include/glib-2.0/glib/galloca.h \ /usr/include/glib-2.0/glib/gtypes.h \ /usr/lib/glib-2.0/include/glibconfig.h \ /usr/include/glib-2.0/glib/gmacros.h \ @@ -101,7 +100,7 @@ tutorial.lo tutorial.o: tutorial.c /usr/include/math.h \ /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ /usr/include/bits/wchar.h /usr/include/gconv.h \ /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ - /usr/include/bits/stdio.h /usr/include/glib-2.0/gmodule.h \ + /usr/include/glib-2.0/gmodule.h \ /usr/include/gtk-2.0/gdk-pixbuf/gdk-pixbuf-loader.h \ /usr/include/gtk-2.0/gdk-pixbuf/gdk-pixbuf-enum-types.h \ /usr/include/pango-1.0/pango/pangocairo.h \ @@ -319,7 +318,6 @@ tutorial.lo tutorial.o: tutorial.c /usr/include/math.h \ /usr/include/bits/select.h /usr/include/bits/sigset.h \ /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \ /usr/include/bits/sched.h /usr/include/alloca.h /usr/include/string.h \ - /usr/include/bits/string.h /usr/include/bits/string2.h \ ../../../../ltt/ltt.h ../../../../ltt/time.h ../../../../ltt/compiler.h \ ../../../../ltt/event.h ../../../../ltt/type.h ../../../../ltt/trace.h \ ../../../../ltt/facility.h ../../../../lttv/lttv/module.h \ @@ -349,8 +347,6 @@ tutorial.lo tutorial.o: tutorial.c /usr/include/math.h \ /usr/include/bits/mathcalls.h: -/usr/include/bits/mathinline.h: - /usr/include/glib-2.0/glib.h: /usr/include/glib-2.0/glib/galloca.h: @@ -597,8 +593,6 @@ tutorial.lo tutorial.o: tutorial.c /usr/include/math.h \ /usr/include/bits/sys_errlist.h: -/usr/include/bits/stdio.h: - /usr/include/glib-2.0/gmodule.h: /usr/include/gtk-2.0/gdk-pixbuf/gdk-pixbuf-loader.h: @@ -1079,10 +1073,6 @@ tutorial.lo tutorial.o: tutorial.c /usr/include/math.h \ /usr/include/string.h: -/usr/include/bits/string.h: - -/usr/include/bits/string2.h: - ../../../../ltt/ltt.h: ../../../../ltt/time.h: -- 2.34.1