gui event supports stop
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sat, 22 Jul 2006 17:30:35 +0000 (17:30 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sat, 22 Jul 2006 17:30:35 +0000 (17:30 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@2011 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/gui/detailedevents/events.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/mainwindow-private.h
ltt/branches/poly/lttv/modules/gui/tutorial/.deps/tutorial.Plo

index db39fcbc5ec43084b2fbfd580bdf8313edc3187a..84af45a060e2b0ee98d7da31b7faf2abd73f1680 100644 (file)
@@ -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,
index 3a1eac2c7cff6f4c237fb5c923fe72902949c707..d2c2d54f1ee608ebe3c565facf77075efb7f2606 100644 (file)
@@ -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",
index f478aae9d74d7edb977f508ec6c16aeb097ec35c..5bd9705e0ebc7bee540aefb6caec34a6a60afa18 100644 (file)
@@ -133,6 +133,7 @@ struct _Tab{
   GSList *events_requests;
   gboolean events_request_pending;
   LttvAttribute *interrupted_state;
+  gboolean stop_foreground;
 };
 
 #endif /* _MAIN_WINDOW_PRIVATE_ */
index b9a4990a7043d79105bb832476c430dd567106ba..6abf39c792f2238c49b821072b54233785fbe0e2 100644 (file)
@@ -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:
This page took 0.028759 seconds and 4 git commands to generate.