+/* Function responsible for updating the exposed area.
+ * It must call processTrace() to ask for this update.
+ * Note : this function cannot clear the background, because it may
+ * erase drawing already present (SAFETY).
+ */
+void drawing_data_request(Drawing_t *Drawing,
+ GdkPixmap **Pixmap,
+ gint x, gint y,
+ gint width,
+ gint height)
+{
+ if(width < 0) return ;
+ if(height < 0) return ;
+ ControlFlowData *control_flow_data =
+ (ControlFlowData*)g_object_get_data(
+ G_OBJECT(
+ Drawing->Drawing_Area_V),
+ "Control_Flow_Data");
+
+ LttTime start, end;
+ LttTime window_end = ltt_time_add(control_flow_data->Time_Window.time_width,
+ control_flow_data->Time_Window.start_time);
+
+ g_critical("req : window_end : %u, %u", window_end.tv_sec,
+ window_end.tv_nsec);
+
+ g_critical("req : time width : %u, %u", control_flow_data->Time_Window.time_width.tv_sec,
+ control_flow_data->Time_Window.time_width.tv_nsec);
+
+ g_critical("x is : %i, x+width is : %i", x, x+width);
+
+ convert_pixels_to_time(Drawing->Drawing_Area_V->allocation.width, x,
+ &control_flow_data->Time_Window.start_time,
+ &window_end,
+ &start);
+
+ convert_pixels_to_time(Drawing->Drawing_Area_V->allocation.width, x + width,
+ &control_flow_data->Time_Window.start_time,
+ &window_end,
+ &end);
+
+ LttvTracesetContext * tsc =
+ get_traceset_context(control_flow_data->Parent_Window);
+
+ //send_test_process(
+ //guicontrolflow_get_process_list(Drawing->Control_Flow_Data),
+ //Drawing);
+ //send_test_drawing(
+ //guicontrolflow_get_process_list(Drawing->Control_Flow_Data),
+ //Drawing, *Pixmap, x, y, width, height);
+
+ // Let's call processTrace() !!
+ EventRequest event_request; // Variable freed at the end of the function.
+ event_request.Control_Flow_Data = control_flow_data;
+ event_request.time_begin = start;
+ event_request.time_end = end;
+ event_request.x_begin = x;
+ event_request.x_end = x+width;
+
+ g_critical("req : start : %u, %u", event_request.time_begin.tv_sec,
+ event_request.time_begin.tv_nsec);
+
+ g_critical("req : end : %u, %u", event_request.time_end.tv_sec,
+ event_request.time_end.tv_nsec);
+
+ LttvHooks *event = lttv_hooks_new();
+ LttvHooks *after_event = lttv_hooks_new();
+ LttvHooks *after_traceset = lttv_hooks_new();
+ lttv_hooks_add(after_traceset, after_data_request, &event_request);
+ lttv_hooks_add(event, draw_event_hook, &event_request);
+ //Modified by xiangxiu: state update hooks are added by the main window
+ //state_add_event_hooks_api(control_flow_data->Parent_Window);
+ lttv_hooks_add(after_event, draw_after_hook, &event_request);
+
+ lttv_process_traceset_seek_time(tsc, start);
+ // FIXME : would like to place the after_traceset hook after the traceset,
+ // but the traceset context state is not valid anymore.
+ lttv_traceset_context_add_hooks(tsc,
+ // NULL, after_traceset, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, after_traceset, NULL, event, after_event);
+ lttv_process_traceset(tsc, end, G_MAXULONG);
+ //after_data_request((void*)&event_request,(void*)tsc);
+ lttv_traceset_context_remove_hooks(tsc,
+ //NULL, after_traceset, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, after_traceset, NULL, event, after_event);
+ //Modified by xiangxiu: state update hooks are removed by the main window
+ //state_remove_event_hooks_api(control_flow_data->Parent_Window);
+
+ lttv_hooks_destroy(after_traceset);
+ lttv_hooks_destroy(event);
+ lttv_hooks_destroy(after_event);
+
+
+}
+
+/* Callbacks */
+
+
+/* Create a new backing pixmap of the appropriate size */
+/* As the scaling will always change, it's of no use to copy old
+ * pixmap.
+ */
+static gboolean
+configure_event( GtkWidget *widget, GdkEventConfigure *event,
+ gpointer user_data)
+{
+ Drawing_t *Drawing = (Drawing_t*)user_data;
+
+
+ /* First, get the new time interval of the main window */
+ /* we assume (see documentation) that the main window
+ * has updated the time interval before this configure gets
+ * executed.
+ */
+ get_time_window(Drawing->Control_Flow_Data->Parent_Window,
+ &Drawing->Control_Flow_Data->Time_Window);
+
+ /* New Pixmap, size of the configure event */
+ //GdkPixmap *Pixmap = gdk_pixmap_new(widget->window,
+ // widget->allocation.width + SAFETY,
+ // widget->allocation.height + SAFETY,
+ // -1);
+
+ g_critical("drawing configure event");
+ g_critical("New draw size : %i by %i",widget->allocation.width, widget->allocation.height);
+
+
+ if (Drawing->Pixmap)
+ gdk_pixmap_unref(Drawing->Pixmap);
+
+ /* If no old Pixmap present */
+ //if(Drawing->Pixmap == NULL)
+ {
+ Drawing->Pixmap = gdk_pixmap_new(
+ widget->window,
+ widget->allocation.width + SAFETY,
+ widget->allocation.height + SAFETY,
+ //ProcessList_get_height
+ // (GuiControlFlow_get_Process_List(Drawing->Control_Flow_Data)),
+ -1);
+ Drawing->width = widget->allocation.width;
+ Drawing->height = widget->allocation.height;
+
+
+ // Clear the image
+ gdk_draw_rectangle (Drawing->Pixmap,
+ widget->style->white_gc,
+ TRUE,
+ 0, 0,
+ widget->allocation.width+SAFETY,
+ widget->allocation.height+SAFETY);
+
+ //g_info("init data request");
+
+
+ /* Initial data request */
+ // Do not need to ask for data of 1 pixel : not synchronized with
+ // main window time at this moment.
+ drawing_data_request(Drawing, &Drawing->Pixmap, 0, 0,
+ widget->allocation.width,
+ widget->allocation.height);
+
+ Drawing->width = widget->allocation.width;
+ Drawing->height = widget->allocation.height;