+ EventsRequest *events_request = (EventsRequest*)hook_data;
+ ControlFlowData *control_flow_data = events_request->viewer_data;
+
+ LttvTracefileContext *tfc = (LttvTracefileContext *)call_data;
+
+ LttvTracefileState *tfs = (LttvTracefileState *)call_data;
+ LttvTraceState *ts =(LttvTraceState *)LTTV_TRACEFILE_CONTEXT(tfs)->t_context;
+
+ LttEvent *e;
+ e = tfc->e;
+
+ LttTime evtime = ltt_event_time(e);
+ TimeWindow time_window =
+ lttvwindow_get_time_window(control_flow_data->tab);
+
+ LttTime end_time = ltt_time_add(time_window.start_time,
+ time_window.time_width);
+
+ if(ltt_time_compare(evtime, time_window.start_time) == -1
+ || ltt_time_compare(evtime, end_time) == 1)
+ return;
+
+ guint width = control_flow_data->drawing->width;
+
+ if(strcmp(ltt_eventtype_name(ltt_event_eventtype(e)),"schedchange") == 0) {
+
+ /* we are in a schedchange, before the state update. We must draw the
+ * items corresponding to the state before it changes : now is the right
+ * time to do it.
+ */
+
+ guint pid_out;
+ {
+ guint pid_in;
+ LttField *f = ltt_event_field(e);
+ LttField *element;
+ element = ltt_field_member(f,0);
+ pid_out = ltt_event_get_long_unsigned(e,element);
+ element = ltt_field_member(f,1);
+ pid_in = ltt_event_get_long_unsigned(e,element);
+ g_debug("out : %u in : %u", pid_out, pid_in);
+ }
+
+ /* First, check if the current process is in the state computation process
+ * list. If it is there, that means we must add it right now and draw items
+ * from the beginning of the read for it. If it is not present, it's a new
+ * process and it was not present : it will be added after the state update.
+ */
+ LttvProcessState *process;
+ process = lttv_state_find_process(tfs, pid_out);
+
+ if(process != NULL) {
+ /* Well, the process_out existed : we must get it in the process hash
+ * or add it, and draw its items.
+ */
+ /* Add process to process list (if not present) */
+ guint y_out = 0, height = 0, pl_height = 0;
+ HashedProcessData *hashed_process_data = NULL;
+ ProcessList *process_list =
+ guicontrolflow_get_process_list(control_flow_data);
+ LttTime birth = process->creation_time;
+ const gchar *name = g_quark_to_string(process->name);
+
+ if(processlist_get_process_pixels(process_list,
+ pid_out,
+ &birth,
+ tfc->t_context->index,
+ &y_out,
+ &height,
+ &hashed_process_data) == 1)
+ {
+ /* Process not present */
+ processlist_add(process_list,
+ pid_out,
+ &birth,
+ tfc->t_context->index,
+ name,
+ &pl_height,
+ &hashed_process_data);
+ processlist_get_process_pixels(process_list,
+ pid_out,
+ &birth,
+ tfc->t_context->index,
+ &y_out,
+ &height,
+ &hashed_process_data);
+ drawing_insert_square( control_flow_data->drawing, y_out, height);
+ }
+
+ /* Now, the process is in the state hash and our own process hash.
+ * We definitely can draw the items related to the ending state.
+ */
+
+ /* Check if the x position is unset. In can have been left unset by
+ * a draw closure from a after chunk hook. This should never happen,
+ * because it must be set by before chunk hook to the damage_begin
+ * value.
+ */
+ g_assert(hashed_process_data->x != -1);
+
+
+ }
+ }
+
+
+ return 0;
+
+
+
+#if 0