#include <lttv/state.h>
#include <lttv/stats.h>
#include <lttv/tracecontext.h>
-#include <lttvwindow/common.h>
#include <lttvwindow/mainwindow.h>
+#include <lttvwindow/mainwindow-private.h>
#include <lttvwindow/lttvwindow.h>
#include <lttvwindow/toolbar.h>
#include <lttvwindow/menu.h>
* 1 : no traceset hooks to update; not an error.
*/
-int SetTraceset(Tab * tab, gpointer traceset)
+int SetTraceset(Tab * tab, LttvTraceset *traceset)
{
LttvHooks * tmp;
LttvAttributeValue value;
lttv_hooks_remove_data(tmp, hook, hook_data);
}
+/**
+ * Function to register a hook function for a viewer be completely redrawn.
+ *
+ * @param tab viewer's tab
+ * @param hook hook function of the viewer.
+ * @param hook_data hook data associated with the hook function.
+ */
+
+void lttvwindow_register_redraw_notify(Tab *tab,
+ LttvHook hook, gpointer hook_data)
+{
+ LttvAttributeValue value;
+ LttvHooks * tmp;
+ g_assert(lttv_iattribute_find_by_path(tab->attributes,
+ "hooks/redraw", LTTV_POINTER, &value));
+ tmp = (LttvHooks*)*(value.v_pointer);
+ if(tmp == NULL){
+ tmp = lttv_hooks_new();
+ *(value.v_pointer) = tmp;
+ }
+ lttv_hooks_add(tmp, hook, hook_data, LTTV_PRIO_DEFAULT);
+}
+
+
+/**
+ * Function to unregister a hook function for a viewer be completely redrawn.
+ *
+ * @param tab viewer's tab
+ * @param hook hook function of the viewer.
+ * @param hook_data hook data associated with the hook function.
+ */
+
+void lttvwindow_unregister_redraw_notify(Tab *tab,
+ LttvHook hook, gpointer hook_data)
+{
+ LttvAttributeValue value;
+ LttvHooks * tmp;
+ g_assert(lttv_iattribute_find_by_path(tab->attributes,
+ "hooks/redraw", LTTV_POINTER, &value));
+ tmp = (LttvHooks*)*(value.v_pointer);
+ if(tmp == NULL) return;
+ lttv_hooks_remove_data(tmp, hook, hook_data);
+}
+
+/**
+ * Function to register a hook function for a viewer to re-do the events
+ * requests for the needed interval.
+ *
+ * This action is typically done after a "stop".
+ *
+ * The typical hook will remove all current requests for the viewer
+ * and make requests for missing information.
+ *
+ * @param tab viewer's tab
+ * @param hook hook function of the viewer.
+ * @param hook_data hook data associated with the hook function.
+ */
+
+void lttvwindow_register_continue_notify(Tab *tab,
+ LttvHook hook, gpointer hook_data)
+{
+ LttvAttributeValue value;
+ LttvHooks * tmp;
+ g_assert(lttv_iattribute_find_by_path(tab->attributes,
+ "hooks/continue", LTTV_POINTER, &value));
+ tmp = (LttvHooks*)*(value.v_pointer);
+ if(tmp == NULL){
+ tmp = lttv_hooks_new();
+ *(value.v_pointer) = tmp;
+ }
+ lttv_hooks_add(tmp, hook, hook_data, LTTV_PRIO_DEFAULT);
+}
+
+
+/**
+ * Function to unregister a hook function for a viewer to re-do the events
+ * requests for the needed interval.
+ *
+ * @param tab viewer's tab
+ * @param hook hook function of the viewer.
+ * @param hook_data hook data associated with the hook function.
+ */
+
+void lttvwindow_unregister_continue_notify(Tab *tab,
+ LttvHook hook, gpointer hook_data)
+{
+ LttvAttributeValue value;
+ LttvHooks * tmp;
+ g_assert(lttv_iattribute_find_by_path(tab->attributes,
+ "hooks/continue", LTTV_POINTER, &value));
+ tmp = (LttvHooks*)*(value.v_pointer);
+ if(tmp == NULL) return;
+ lttv_hooks_remove_data(tmp, hook, hook_data);
+}
+
+
/**
* Function to register a hook function for a viewer to set/update its
* filter.
*/
void lttvwindow_events_request(Tab *tab,
- const EventsRequest *events_request)
+ EventsRequest *events_request)
{
- EventsRequest *alloc = g_new(sizeof(EventsRequest,1));
- *alloc = *events_request;
-
- tab->events_requests = g_slist_append(tab->events_requests, alloc);
+ tab->events_requests = g_slist_append(tab->events_requests, events_request);
if(!tab->events_request_pending)
{
gint find_viewer (const EventsRequest *a, gconstpointer b)
{
- return (a->viewer != b);
+ return (a->owner != b);
}
g_slist_find_custom(tab->events_requests, viewer,
(GCompareFunc)find_viewer))
!= NULL) {
- EventRequest *events_request = (EventsRequest *)element->data;
+ EventsRequest *events_request = (EventsRequest *)element->data;
if(events_request->servicing == TRUE) {
lttv_hooks_call(events_request->after_request, NULL);
}