aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-01-08 09:36:19 -0500
committerSteven Rostedt <rostedt@goodmis.org>2010-01-08 09:36:19 -0500
commit03ca5aa7293eed10bd85d910a47d9d71e19d50de (patch)
tree583173aec37bba9cb8c55fbb35fdf2e2f69db248
parent2f8004337f24888e6f14f5f58fab30333f36bd45 (diff)
trace-graph: Keep event info in view
If the scrolled window is vertically adjusted so that the top CPU bar is close to the top of the viewable area, the event info box can be hidden. Change the location of the event info box to go beneath the pointer when near the top. The location of the box is also changed to be to the left of the pointer instead of the right. This is because when we make the flip the box may be hidden by the cursor itself. Although this does not protect against that happening when the pointer is near the top left corner, since the box will be to the right of the cursor then anyway. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--trace-graph.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/trace-graph.c b/trace-graph.c
index 1f7668d..fe2ecb4 100644
--- a/trace-graph.c
+++ b/trace-graph.c
@@ -747,6 +747,7 @@ static int check_sched_switch(struct graph_info *ginfo,
747static void draw_cpu_info(struct graph_info *ginfo, gint cpu, gint x, gint y) 747static void draw_cpu_info(struct graph_info *ginfo, gint cpu, gint x, gint y)
748{ 748{
749 PangoLayout *layout; 749 PangoLayout *layout;
750 GtkAdjustment *vadj;
750 struct record *record = NULL; 751 struct record *record = NULL;
751 struct pevent *pevent; 752 struct pevent *pevent;
752 struct event_format *event; 753 struct event_format *event;
@@ -841,14 +842,15 @@ static void draw_cpu_info(struct graph_info *ginfo, gint cpu, gint x, gint y)
841 width += CPU_BOARDER * 2; 842 width += CPU_BOARDER * 2;
842 height += CPU_BOARDER * 2; 843 height += CPU_BOARDER * 2;
843 844
844 if (y > height)
845 y -= height;
846
847 view_start = gtk_adjustment_get_value(ginfo->hadj); 845 view_start = gtk_adjustment_get_value(ginfo->hadj);
848 view_width = gtk_adjustment_get_page_size(ginfo->hadj); 846 view_width = gtk_adjustment_get_page_size(ginfo->hadj);
849 847 if (x > view_start + width)
850 if (x + width > view_start + view_width) 848 x -= width;
851 x -= (x + width) - (view_start + view_width); 849
850 vadj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(ginfo->scrollwin));
851 view_start = gtk_adjustment_get_value(vadj);
852 if (y > view_start + height)
853 y -= height;
852 854
853 ginfo->cpu_data_x = x; 855 ginfo->cpu_data_x = x;
854 ginfo->cpu_data_y = y; 856 ginfo->cpu_data_y = y;