1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 XangXiu Yang
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation;
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
19 /*! \file lttvwindow.c
20 * \brief API used by the graphical viewers to interact with their tab.
22 * Main window (gui module) is the place to contain and display viewers.
23 * Viewers (lttv plugins) interact with tab and main window through this API
24 * and events sent by gtk.
25 * This header file should be included in each graphic module.
26 * This library is used by graphical modules to interact with their tab and
32 #include <lttv/lttv.h>
33 #include <lttv/state.h>
34 #include <lttv/stats.h>
35 #include <lttv/tracecontext.h>
36 #include <lttvwindow/mainwindow.h>
37 #include <lttvwindow/mainwindow-private.h>
38 #include <lttvwindow/lttvwindow.h>
39 #include <lttvwindow/toolbar.h>
40 #include <lttvwindow/menu.h>
41 #include <lttvwindow/callbacks.h> // for execute_events_requests
42 #include <lttvwindow/support.h>
46 * Internal function parts
49 extern GSList
* g_main_window_list
;
52 * Function to set/update traceset for the viewers
53 * @param tab viewer's tab
54 * @param traceset traceset of the main window.
57 * 0 : traceset updated
58 * 1 : no traceset hooks to update; not an error.
61 int SetTraceset(Tab
* tab
, LttvTraceset
*traceset
)
64 LttvAttributeValue value
;
66 if( lttv_iattribute_find_by_path(tab
->attributes
,
67 "hooks/updatetraceset", LTTV_POINTER
, &value
) != 0)
70 tmp
= (LttvHooks
*)*(value
.v_pointer
);
71 if(tmp
== NULL
) return 1;
74 lttv_hooks_call(tmp
,traceset
);
81 * Function to set/update filter for the viewers
82 * @param tab viewer's tab
83 * @param filter filter of the main window.
87 * 1 : no filter hooks to update; not an error.
90 int SetFilter(Tab
* tab
, gpointer filter
)
93 LttvAttributeValue value
;
95 if(lttv_iattribute_find_by_path(tab
->attributes
,
96 "hooks/updatefilter", LTTV_POINTER
, &value
) != 0)
99 tmp
= (LttvHooks
*)*(value
.v_pointer
);
101 if(tmp
== NULL
) return 1;
102 lttv_hooks_call(tmp
,filter
);
108 * Function to redraw each viewer belonging to the current tab
109 * @param tab viewer's tab
112 void update_traceset(Tab
*tab
)
114 LttvAttributeValue value
;
116 g_assert(lttv_iattribute_find_by_path(tab
->attributes
,
117 "hooks/updatetraceset", LTTV_POINTER
, &value
));
118 tmp
= (LttvHooks
*)*(value
.v_pointer
);
119 if(tmp
== NULL
) return;
120 lttv_hooks_call(tmp
, NULL
);
123 void set_time_window_adjustment(Tab
*tab
, const TimeWindow
* new_time_window
)
125 gtk_multi_vpaned_set_adjust(tab
->multi_vpaned
, new_time_window
, FALSE
);
129 void set_time_window(Tab
*tab
, const TimeWindow
*time_window
)
131 LttvAttributeValue value
;
134 TimeWindowNotifyData time_window_notify_data
;
135 TimeWindow old_time_window
= tab
->time_window
;
136 time_window_notify_data
.old_time_window
= &old_time_window
;
137 tab
->time_window
= *time_window
;
138 time_window_notify_data
.new_time_window
=
141 g_assert(lttv_iattribute_find_by_path(tab
->attributes
,
142 "hooks/updatetimewindow", LTTV_POINTER
, &value
));
143 tmp
= (LttvHooks
*)*(value
.v_pointer
);
144 if(tmp
== NULL
) return;
145 lttv_hooks_call(tmp
, &time_window_notify_data
);
150 void add_toolbar_constructor(MainWindow
*mw
, LttvToolbarClosure
*toolbar_c
)
152 LttvIAttribute
*attributes
= mw
->attributes
;
153 LttvAttributeValue value
;
154 LttvToolbars
* instance_toolbar
;
155 lttvwindow_viewer_constructor constructor
;
156 GtkWidget
* tool_menu_title_menu
, *new_widget
, *pixmap
;
159 g_assert(lttv_iattribute_find_by_path(attributes
,
160 "viewers/toolbar", LTTV_POINTER
, &value
));
161 if(*(value
.v_pointer
) == NULL
)
162 *(value
.v_pointer
) = lttv_toolbars_new();
163 instance_toolbar
= (LttvToolbars
*)*(value
.v_pointer
);
165 constructor
= toolbar_c
->con
;
166 tool_menu_title_menu
= lookup_widget(mw
->mwindow
,"MToolbar1");
167 pixbuf
= gdk_pixbuf_new_from_xpm_data((const char**)toolbar_c
->pixmap
);
168 pixmap
= gtk_image_new_from_pixbuf(pixbuf
);
170 gtk_toolbar_append_element (GTK_TOOLBAR (tool_menu_title_menu
),
171 GTK_TOOLBAR_CHILD_BUTTON
,
174 toolbar_c
->tooltip
, NULL
,
176 gtk_label_set_use_underline(
177 GTK_LABEL (((GtkToolbarChild
*) (
178 g_list_last (GTK_TOOLBAR
179 (tool_menu_title_menu
)->children
)->data
))->label
),
181 gtk_container_set_border_width (GTK_CONTAINER (new_widget
), 1);
182 g_signal_connect ((gpointer
) new_widget
,
184 G_CALLBACK (insert_viewer_wrap
),
186 gtk_widget_show (new_widget
);
188 lttv_toolbars_add(instance_toolbar
, toolbar_c
->con
,
195 void add_menu_constructor(MainWindow
*mw
, LttvMenuClosure
*menu_c
)
197 LttvIAttribute
*attributes
= mw
->attributes
;
198 LttvAttributeValue value
;
199 LttvToolbars
* instance_menu
;
200 lttvwindow_viewer_constructor constructor
;
201 GtkWidget
* tool_menu_title_menu
, *new_widget
;
203 g_assert(lttv_iattribute_find_by_path(attributes
,
204 "viewers/menu", LTTV_POINTER
, &value
));
205 if(*(value
.v_pointer
) == NULL
)
206 *(value
.v_pointer
) = lttv_menus_new();
207 instance_menu
= (LttvMenus
*)*(value
.v_pointer
);
210 constructor
= menu_c
->con
;
211 tool_menu_title_menu
= lookup_widget(mw
->mwindow
,"ToolMenuTitle_menu");
213 gtk_menu_item_new_with_mnemonic (menu_c
->menu_text
);
214 gtk_container_add (GTK_CONTAINER (tool_menu_title_menu
),
216 g_signal_connect ((gpointer
) new_widget
, "activate",
217 G_CALLBACK (insert_viewer_wrap
),
219 gtk_widget_show (new_widget
);
220 lttv_menus_add(instance_menu
, menu_c
->con
,
226 void remove_toolbar_constructor(MainWindow
*mw
, lttvwindow_viewer_constructor viewer_constructor
)
228 LttvIAttribute
*attributes
= mw
->attributes
;
229 LttvAttributeValue value
;
230 LttvToolbars
* instance_toolbar
;
231 lttvwindow_viewer_constructor constructor
;
232 GtkWidget
* tool_menu_title_menu
, *widget
;
234 g_assert(lttv_iattribute_find_by_path(attributes
,
235 "viewers/toolbar", LTTV_POINTER
, &value
));
236 if(*(value
.v_pointer
) == NULL
)
237 *(value
.v_pointer
) = lttv_toolbars_new();
238 instance_toolbar
= (LttvToolbars
*)*(value
.v_pointer
);
240 tool_menu_title_menu
= lookup_widget(mw
->mwindow
,"MToolbar1");
241 widget
= lttv_menus_remove(instance_toolbar
, viewer_constructor
);
242 gtk_container_remove (GTK_CONTAINER (tool_menu_title_menu
),
247 void remove_menu_constructor(MainWindow
*mw
, lttvwindow_viewer_constructor viewer_constructor
)
249 LttvIAttribute
*attributes
= mw
->attributes
;
250 LttvAttributeValue value
;
251 LttvMenus
* instance_menu
;
252 lttvwindow_viewer_constructor constructor
;
253 GtkWidget
* tool_menu_title_menu
, *widget
;
254 LttvMenuClosure
*menu_item_i
;
256 g_assert(lttv_iattribute_find_by_path(attributes
,
257 "viewers/menu", LTTV_POINTER
, &value
));
258 if(*(value
.v_pointer
) == NULL
)
259 *(value
.v_pointer
) = lttv_menus_new();
260 instance_menu
= (LttvMenus
*)*(value
.v_pointer
);
262 widget
= lttv_menus_remove(instance_menu
, viewer_constructor
);
263 tool_menu_title_menu
= lookup_widget(mw
->mwindow
,"ToolMenuTitle_menu");
264 gtk_container_remove (GTK_CONTAINER (tool_menu_title_menu
), widget
);
274 * Function to register a view constructor so that main window can generate
275 * a menu item and a toolbar item for the viewer in order to generate a new
276 * instance easily. A menu entry and toolbar item will be added to each main
279 * It should be called by init function of the module.
281 * @param menu_path path of the menu item.
282 * @param menu_text text of the menu item.
283 * @param pixmap Image shown on the toolbar item.
284 * @param tooltip tooltip of the toolbar item.
285 * @param view_constructor constructor of the viewer.
288 void lttvwindow_register_constructor
293 lttvwindow_viewer_constructor view_constructor
)
295 LttvIAttribute
*attributes_global
= LTTV_IATTRIBUTE(lttv_global_attributes());
296 LttvToolbars
* toolbar
;
298 LttvToolbarClosure toolbar_c
;
299 LttvMenuClosure menu_c
;
300 LttvAttributeValue value
;
303 g_assert(lttv_iattribute_find_by_path(attributes_global
,
304 "viewers/toolbar", LTTV_POINTER
, &value
));
305 toolbar
= (LttvToolbars
*)*(value
.v_pointer
);
307 if(toolbar
== NULL
) {
308 toolbar
= lttv_toolbars_new();
309 *(value
.v_pointer
) = toolbar
;
311 toolbar_c
= lttv_toolbars_add(toolbar
, view_constructor
, tooltip
, pixmap
,
314 g_slist_foreach(g_main_window_list
,
315 (gpointer
)add_toolbar_constructor
,
319 if(menu_path
!= NULL
) {
320 g_assert(lttv_iattribute_find_by_path(attributes_global
,
321 "viewers/menu", LTTV_POINTER
, &value
));
322 menu
= (LttvMenus
*)*(value
.v_pointer
);
325 menu
= lttv_menus_new();
326 *(value
.v_pointer
) = menu
;
328 menu_c
= lttv_menus_add(menu
, view_constructor
, menu_path
, menu_text
,NULL
);
330 g_slist_foreach(g_main_window_list
,
331 (gpointer
)add_menu_constructor
,
338 * Function to unregister the viewer's constructor, release the space
339 * occupied by menu_path, menu_text, pixmap, tooltip and constructor of the
342 * It will be called when a module is unloaded.
344 * @param view_constructor constructor of the viewer.
348 void lttvwindow_unregister_constructor
349 (lttvwindow_viewer_constructor view_constructor
)
351 LttvIAttribute
*attributes_global
= LTTV_IATTRIBUTE(lttv_global_attributes());
352 LttvToolbars
* toolbar
;
354 LttvAttributeValue value
;
356 g_assert(lttv_iattribute_find_by_path(attributes_global
,
357 "viewers/toolbar", LTTV_POINTER
, &value
));
358 toolbar
= (LttvToolbars
*)*(value
.v_pointer
);
360 if(toolbar
!= NULL
) {
361 g_slist_foreach(g_main_window_list
,
362 (gpointer
)remove_toolbar_constructor
,
364 lttv_toolbars_remove(toolbar
, view_constructor
);
367 g_assert(lttv_iattribute_find_by_path(attributes_global
,
368 "viewers/menu", LTTV_POINTER
, &value
));
369 menu
= (LttvMenus
*)*(value
.v_pointer
);
372 g_slist_foreach(g_main_window_list
,
373 (gpointer
)remove_menu_constructor
,
375 lttv_menus_remove(menu
, view_constructor
);
381 * Function to register a hook function for a viewer to set/update its
383 * @param tab viewer's tab
384 * @param hook hook function of the viewer.
385 * @param hook_data hook data associated with the hook function.
387 void lttvwindow_register_time_window_notify(Tab
*tab
,
388 LttvHook hook
, gpointer hook_data
)
390 LttvAttributeValue value
;
392 g_assert(lttv_iattribute_find_by_path(tab
->attributes
,
393 "hooks/updatetimewindow", LTTV_POINTER
, &value
));
394 tmp
= (LttvHooks
*)*(value
.v_pointer
);
396 tmp
= lttv_hooks_new();
397 *(value
.v_pointer
) = tmp
;
399 lttv_hooks_add(tmp
, hook
,hook_data
, LTTV_PRIO_DEFAULT
);
404 * Function to unregister a viewer's hook function which is used to
405 * set/update the time interval of the viewer.
406 * @param tab viewer's tab
407 * @param hook hook function of the viewer.
408 * @param hook_data hook data associated with the hook function.
411 void lttvwindow_unregister_time_window_notify(Tab
*tab
,
412 LttvHook hook
, gpointer hook_data
)
414 LttvAttributeValue value
;
416 g_assert(lttv_iattribute_find_by_path(tab
->attributes
,
417 "hooks/updatetimewindow", LTTV_POINTER
, &value
));
418 tmp
= (LttvHooks
*)*(value
.v_pointer
);
419 if(tmp
== NULL
) return;
420 lttv_hooks_remove_data(tmp
, hook
, hook_data
);
424 * Function to register a hook function for a viewer to set/update its
426 * @param tab viewer's tab
427 * @param hook hook function of the viewer.
428 * @param hook_data hook data associated with the hook function.
431 void lttvwindow_register_traceset_notify(Tab
*tab
,
432 LttvHook hook
, gpointer hook_data
)
434 LttvAttributeValue value
;
436 g_assert(lttv_iattribute_find_by_path(tab
->attributes
,
437 "hooks/updatetraceset", LTTV_POINTER
, &value
));
438 tmp
= (LttvHooks
*)*(value
.v_pointer
);
440 tmp
= lttv_hooks_new();
441 *(value
.v_pointer
) = tmp
;
443 lttv_hooks_add(tmp
, hook
, hook_data
, LTTV_PRIO_DEFAULT
);
448 * Function to unregister a viewer's hook function which is used to
449 * set/update the traceset of the viewer.
450 * @param tab viewer's tab
451 * @param hook hook function of the viewer.
452 * @param hook_data hook data associated with the hook function.
455 void lttvwindow_unregister_traceset_notify(Tab
*tab
,
456 LttvHook hook
, gpointer hook_data
)
458 LttvAttributeValue value
;
460 g_assert(lttv_iattribute_find_by_path(tab
->attributes
,
461 "hooks/updatetraceset", LTTV_POINTER
, &value
));
462 tmp
= (LttvHooks
*)*(value
.v_pointer
);
463 if(tmp
== NULL
) return;
464 lttv_hooks_remove_data(tmp
, hook
, hook_data
);
468 * Function to register a hook function for a viewer to set/update its
470 * @param tab viewer's tab
471 * @param hook hook function of the viewer.
472 * @param hook_data hook data associated with the hook function.
475 void lttvwindow_register_filter_notify(Tab
*tab
,
476 LttvHook hook
, gpointer hook_data
)
478 LttvAttributeValue value
;
480 g_assert(lttv_iattribute_find_by_path(tab
->attributes
,
481 "hooks/updatefilter", LTTV_POINTER
, &value
));
482 tmp
= (LttvHooks
*)*(value
.v_pointer
);
484 tmp
= lttv_hooks_new();
485 *(value
.v_pointer
) = tmp
;
487 lttv_hooks_add(tmp
, hook
, hook_data
, LTTV_PRIO_DEFAULT
);
492 * Function to unregister a viewer's hook function which is used to
493 * set/update the filter of the viewer.
494 * @param tab viewer's tab
495 * @param hook hook function of the viewer.
496 * @param hook_data hook data associated with the hook function.
499 void lttvwindow_unregister_filter_notify(Tab
*tab
,
503 LttvAttributeValue value
;
505 g_assert(lttv_iattribute_find_by_path(tab
->attributes
,
506 "hooks/updatefilter", LTTV_POINTER
, &value
));
507 tmp
= (LttvHooks
*)*(value
.v_pointer
);
508 if(tmp
== NULL
) return;
509 lttv_hooks_remove_data(tmp
, hook
, hook_data
);
513 * Function to register a hook function for a viewer to set/update its
515 * @param tab viewer's tab
516 * @param hook hook function of the viewer.
517 * @param hook_data hook data associated with the hook function.
520 void lttvwindow_register_current_time_notify(Tab
*tab
,
521 LttvHook hook
, gpointer hook_data
)
523 LttvAttributeValue value
;
525 g_assert(lttv_iattribute_find_by_path(tab
->attributes
,
526 "hooks/updatecurrenttime", LTTV_POINTER
, &value
));
527 tmp
= (LttvHooks
*)*(value
.v_pointer
);
529 tmp
= lttv_hooks_new();
530 *(value
.v_pointer
) = tmp
;
532 lttv_hooks_add(tmp
, hook
, hook_data
, LTTV_PRIO_DEFAULT
);
537 * Function to unregister a viewer's hook function which is used to
538 * set/update the current time of the viewer.
539 * @param tab viewer's tab
540 * @param hook hook function of the viewer.
541 * @param hook_data hook data associated with the hook function.
544 void lttvwindow_unregister_current_time_notify(Tab
*tab
,
545 LttvHook hook
, gpointer hook_data
)
547 LttvAttributeValue value
;
549 g_assert(lttv_iattribute_find_by_path(tab
->attributes
,
550 "hooks/updatecurrenttime", LTTV_POINTER
, &value
));
551 tmp
= (LttvHooks
*)*(value
.v_pointer
);
552 if(tmp
== NULL
) return;
553 lttv_hooks_remove_data(tmp
, hook
, hook_data
);
558 * Function to register a hook function for a viewer to show
559 * the content of the viewer.
560 * @param tab viewer's tab
561 * @param hook hook function of the viewer.
562 * @param hook_data hook data associated with the hook function.
565 void lttvwindow_register_show_notify(Tab
*tab
,
566 LttvHook hook
, gpointer hook_data
)
568 LttvAttributeValue value
;
570 g_assert(lttv_iattribute_find_by_path(tab
->attributes
,
571 "hooks/showviewer", LTTV_POINTER
, &value
));
572 tmp
= (LttvHooks
*)*(value
.v_pointer
);
574 tmp
= lttv_hooks_new();
575 *(value
.v_pointer
) = tmp
;
577 lttv_hooks_add(tmp
, hook
, hook_data
, LTTV_PRIO_DEFAULT
);
582 * Function to unregister a viewer's hook function which is used to
583 * show the content of the viewer..
584 * @param tab viewer's tab
585 * @param hook hook function of the viewer.
586 * @param hook_data hook data associated with the hook function.
589 void lttvwindow_unregister_show_notify(Tab
*tab
,
590 LttvHook hook
, gpointer hook_data
)
592 LttvAttributeValue value
;
594 g_assert(lttv_iattribute_find_by_path(tab
->attributes
,
595 "hooks/showviewer", LTTV_POINTER
, &value
));
596 tmp
= (LttvHooks
*)*(value
.v_pointer
);
597 if(tmp
== NULL
) return;
598 lttv_hooks_remove_data(tmp
, hook
, hook_data
);
602 * Function to register a hook function for a viewer to set/update the
603 * dividor of the hpane.
604 * @param tab viewer's tab
605 * @param hook hook function of the viewer.
606 * @param hook_data hook data associated with the hook function.
609 void lttvwindow_register_dividor(Tab
*tab
,
610 LttvHook hook
, gpointer hook_data
)
612 LttvAttributeValue value
;
614 g_assert(lttv_iattribute_find_by_path(tab
->attributes
,
615 "hooks/hpanedividor", LTTV_POINTER
, &value
));
616 tmp
= (LttvHooks
*)*(value
.v_pointer
);
618 tmp
= lttv_hooks_new();
619 *(value
.v_pointer
) = tmp
;
621 lttv_hooks_add(tmp
, hook
, hook_data
, LTTV_PRIO_DEFAULT
);
626 * Function to unregister a viewer's hook function which is used to
627 * set/update hpane's dividor of the viewer.
628 * It will be called by the destructor of the viewer.
629 * @param tab viewer's tab
630 * @param hook hook function of the viewer.
631 * @param hook_data hook data associated with the hook function.
634 void lttvwindow_unregister_dividor(Tab
*tab
,
635 LttvHook hook
, gpointer hook_data
)
637 LttvAttributeValue value
;
639 g_assert(lttv_iattribute_find_by_path(tab
->attributes
,
640 "hooks/hpanedividor", LTTV_POINTER
, &value
));
641 tmp
= (LttvHooks
*)*(value
.v_pointer
);
642 if(tmp
== NULL
) return;
643 lttv_hooks_remove_data(tmp
, hook
, hook_data
);
648 * Update the status bar whenever something changed in the viewer.
649 * @param tab viewer's tab
650 * @param info the message which will be shown in the status bar.
653 void lttvwindow_report_status(Tab
*tab
, const char *info
)
656 g_warning("update_status not implemented in viewer.c");
657 // Use tab->mw for status
661 * Function to set the time interval of the current tab.
662 * It will be called by a viewer's signal handle associated with
663 * the move_slider signal
664 * @param tab viewer's tab
665 * @param time_interval a pointer where time interval is stored.
668 void lttvwindow_report_time_window(Tab
*tab
,
669 const TimeWindow
*time_window
)
671 set_time_window(tab
, time_window
);
672 set_time_window_adjustment(tab
, time_window
);
677 * Function to set the current time/event of the current tab.
678 * It will be called by a viewer's signal handle associated with
679 * the button-release-event signal
680 * @param tab viewer's tab
681 * @param time a pointer where time is stored.
684 void lttvwindow_report_current_time(Tab
*tab
,
687 LttvAttributeValue value
;
689 tab
->current_time
= *time
;
690 g_assert(lttv_iattribute_find_by_path(tab
->attributes
,
691 "hooks/updatecurrenttime", LTTV_POINTER
, &value
));
692 tmp
= (LttvHooks
*)*(value
.v_pointer
);
694 if(tmp
== NULL
)return;
695 lttv_hooks_call(tmp
, &tab
->current_time
);
699 * Function to set the position of the hpane's dividor (viewer).
700 * It will be called by a viewer's signal handle associated with
701 * the motion_notify_event event/signal
702 * @param tab viewer's tab
703 * @param position position of the hpane's dividor.
706 void lttvwindow_report_dividor(Tab
*tab
, gint position
)
708 LttvAttributeValue value
;
710 g_assert(lttv_iattribute_find_by_path(tab
->attributes
,
711 "hooks/hpanedividor", LTTV_POINTER
, &value
));
712 tmp
= (LttvHooks
*)*(value
.v_pointer
);
713 if(tmp
== NULL
) return;
714 lttv_hooks_call(tmp
, &position
);
718 * Function to set the focused pane (viewer).
719 * It will be called by a viewer's signal handle associated with
720 * the grab_focus signal
721 * @param tab viewer's tab
722 * @param top_widget the top widget containing all the other widgets of the
726 void lttvwindow_report_focus(Tab
*tab
, GtkWidget
*top_widget
)
728 gtk_multi_vpaned_set_focus((GtkWidget
*)tab
->multi_vpaned
,
729 GTK_PANED(gtk_widget_get_parent(top_widget
)));
734 * Function to request data in a specific time interval to the main window. The
735 * event request servicing is differed until the glib idle functions are
738 * The viewer has to provide hooks that should be associated with the event
741 * Either start time or start position must be defined in a EventRequest
742 * structure for it to be valid.
744 * end_time, end_position and num_events can all be defined. The first one
745 * to occur will be used as end criterion.
747 * @param tab viewer's tab
748 * @param events_requested the structure of request from.
751 void lttvwindow_events_request(Tab
*tab
,
752 EventsRequest
*events_request
)
754 tab
->events_requests
= g_slist_append(tab
->events_requests
, events_request
);
756 if(!tab
->events_request_pending
)
758 /* Redraw has +20 priority. We want a prio higher than that, so +19 */
759 g_idle_add_full((G_PRIORITY_HIGH_IDLE
+ 19),
760 (GSourceFunc
)execute_events_requests
,
763 tab
->events_request_pending
= TRUE
;
769 * Function to remove data requests related to a viewer.
771 * The existing requests's viewer gpointer is compared to the pointer
772 * given in argument to establish which data request should be removed.
774 * @param tab the tab the viewer belongs to.
775 * @param viewer a pointer to the viewer data structure
778 gint
find_viewer (const EventsRequest
*a
, gconstpointer b
)
780 return (a
->owner
!= b
);
784 void lttvwindow_events_request_remove_all(Tab
*tab
,
785 gconstpointer viewer
)
790 g_slist_find_custom(tab
->events_requests
, viewer
,
791 (GCompareFunc
)find_viewer
))
793 EventsRequest
*events_request
= (EventsRequest
*)element
->data
;
794 if(events_request
->servicing
== TRUE
) {
795 lttv_hooks_call(events_request
->after_request
, NULL
);
797 g_free(events_request
);
798 tab
->events_requests
= g_slist_remove_link(tab
->events_requests
, element
);
806 * Function to get the current time interval shown on the current tab.
807 * It will be called by a viewer's hook function to update the
808 * shown time interval of the viewer and also be called by the constructor
810 * @param tab viewer's tab
811 * @param time_interval a pointer where time interval will be stored.
814 const TimeWindow
*lttvwindow_get_time_window(Tab
*tab
)
816 return &(tab
->time_window
);
822 * Function to get the current time/event of the current tab.
823 * It will be called by a viewer's hook function to update the
824 * current time/event of the viewer.
825 * @param tab viewer's tab
826 * @param time a pointer where time will be stored.
829 const LttTime
*lttvwindow_get_current_time(Tab
*tab
)
831 return &(tab
->current_time
);
836 * Function to get the filter of the current tab.
837 * It will be called by the constructor of the viewer and also be
838 * called by a hook funtion of the viewer to update its filter.
839 * @param tab viewer's tab
840 * @param filter, a pointer to a filter.
842 const lttv_filter
*lttvwindow_get_filter(Tab
*tab
)
845 g_warning("lttvwindow_get_filter not implemented in viewer.c");
850 * Function to get the stats of the traceset
851 * @param tab viewer's tab
854 LttvTracesetStats
* lttvwindow_get_traceset_stats(Tab
*tab
)
856 return tab
->traceset_info
->traceset_context
;
860 LttvTracesetContext
* lttvwindow_get_traceset_context(Tab
*tab
)
862 return (LttvTracesetContext
*)tab
->traceset_info
->traceset_context
;