trace-graph: Keep the flyover event window inside viewable
The flyover event information window currently only stays inside
the drawing area. But if the drawing area is not fully exposed,
the flyover window may be hidden outside the visible section.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
diff --git a/trace-graph.c b/trace-graph.c
index 3525d0d..13fd7c9 100644
--- a/trace-graph.c
+++ b/trace-graph.c
@@ -214,6 +214,8 @@
GdkPixmap *pix;
static GdkGC *pix_bg;
guint64 offset = 0;
+ gint view_width;
+ gint view_start;
if (!pix_bg) {
GdkColor color;
@@ -298,9 +300,11 @@
if (y > height)
y -= height;
+ view_start = gtk_adjustment_get_value(ginfo->vadj);
+ view_width = gtk_adjustment_get_page_size(ginfo->vadj);
- if (x + width > ginfo->draw->allocation.width)
- x -= ((x + width) - ginfo->draw->allocation.width);
+ if (x + width > view_start + view_width)
+ x -= (x + width) - (view_start + view_width);
ginfo->cpu_data_x = x;
ginfo->cpu_data_y = y;