From 3c456a8abcc006a6f12311228d47865921a45059 Mon Sep 17 00:00:00 2001 From: compudj Date: Mon, 24 Jul 2006 15:00:07 +0000 Subject: [PATCH] update stop for event list git-svn-id: http://ltt.polymtl.ca/svn@2013 04897980-b3bd-0310-b5e0-8ef037075253 --- .../lttv/modules/gui/detailedevents/events.c | 11 ++++--- .../gui/lttvwindow/lttvwindow/callbacks.c | 2 ++ .../gui/lttvwindow/lttvwindow/lttvwindow.c | 4 +-- .../gui/lttvwindow/lttvwindow/lttvwindow.h | 29 +++++++++++++++++++ .../lttvwindow/lttvwindow/lttvwindowtraces.c | 2 ++ 5 files changed, 40 insertions(+), 8 deletions(-) diff --git a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c index 84af45a0..351f4cd5 100644 --- a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c +++ b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c @@ -78,9 +78,6 @@ #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 ; @@ -1293,6 +1290,7 @@ static void get_events(double new_value, EventViewerData *event_viewer_data) /* Set stop button status for foreground processing */ event_viewer_data->tab->stop_foreground = FALSE; + lttvwindow_events_request_disable(); /* See where we have to scroll... */ ScrollDirection direction; @@ -1489,6 +1487,8 @@ static void get_events(double new_value, EventViewerData *event_viewer_data) gdk_x11_get_server_time( gtk_widget_get_parent_window(event_viewer_data->tree_v)); + lttvwindow_events_request_enable(); + return; } @@ -1501,13 +1501,12 @@ 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(); + gtk_main_iteration(); if(event_viewer_data->tab->stop_foreground) return TRUE; } + event_viewer_data->num_events++; LttvFilter *filter = event_viewer_data->main_win_filter; if(filter != NULL && filter->head != NULL) 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 d2c2d54f..25987f69 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -928,6 +928,8 @@ gboolean lttvwindow_process_pending_requests(Tab *tab) guint count; LttvTracesetContextPosition *end_position; + if(lttvwindow_preempt_count > 0) return TRUE; + if(tab == NULL) { g_critical("Foreground processing : tab does not exist. Processing removed."); return FALSE; 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 7dd2e0c7..7d318245 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c @@ -51,6 +51,8 @@ extern GSList * g_main_window_list; +gint lttvwindow_preempt_count = 0; + /* set_time_window * * It updates the time window of the tab, then calls the updatetimewindow @@ -1018,8 +1020,6 @@ gboolean lttvwindow_events_request_pending(Tab *tab) } - - /** * Function to get the current time interval shown on the current tab. * It will be called by a viewer's hook function to update the diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h index e690ec57..3078ed15 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h @@ -269,6 +269,9 @@ extern GQuark LTTV_VIEWER_CONSTRUCTORS; /* constructor a the viewer */ typedef GtkWidget* (*lttvwindow_viewer_constructor)(LttvPlugin *plugin); +extern gint lttvwindow_preempt_count; + +#define CHECK_GDK_INTERVAL 50000 /** * Function to register a view constructor so that main window can generate @@ -827,4 +830,30 @@ GtkWidget *main_window_get_widget(Tab *tab); void set_current_position(Tab *tab, const LttvTracesetContextPosition *pos); + +/** + * Function to disable the EventsRequests scheduler, nestable. + * + */ +static inline void lttvwindow_events_request_disable(void) +{ + lttvwindow_preempt_count++; +} + +/** + * Function to restore the EventsRequests scheduler, nestable. + * + */ +static inline void lttvwindow_events_request_enable(void) +{ + lttvwindow_preempt_count--; +} + + + + + + + + #endif //LTTVWINDOW_H diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c index badb3a34..f83c1f1e 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c @@ -975,6 +975,8 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace) if(trace == NULL) return FALSE; + + if(lttvwindow_preempt_count > 0) return TRUE; attribute = lttv_trace_attribute(trace); -- 2.34.1