aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2015-09-09 10:12:20 +0200
committerGerd Hoffmann <kraxel@redhat.com>2015-09-15 12:27:39 +0200
commitd531deef119666d4b3605e186a43010782efd899 (patch)
tree57aedbb22c82cfebfa0009fec0b721eb880daf88
parent695cc59d42f2e285abd5cf278bdc07360a995eaa (diff)
gtk: trace input grab reason
Add a reason to grab calls and trace points, so it is easier to debug grab related ui issues. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-rw-r--r--trace-events3
-rw-r--r--ui/gtk.c26
2 files changed, 15 insertions, 14 deletions
diff --git a/trace-events b/trace-events
index 1927c764a9..3d1857b270 100644
--- a/trace-events
+++ b/trace-events
@@ -1150,7 +1150,8 @@ ppm_save(const char *filename, void *display_surface) "%s surface=%p"
gd_switch(const char *tab, int width, int height) "tab=%s, width=%d, height=%d"
gd_update(const char *tab, int x, int y, int w, int h) "tab=%s, x=%d, y=%d, w=%d, h=%d"
gd_key_event(const char *tab, int gdk_keycode, int qemu_keycode, const char *action) "tab=%s, translated GDK keycode %d to QEMU keycode %d (%s)"
-gd_grab(const char *tab, const char *device, bool on) "tab=%s, %s %d"
+gd_grab(const char *tab, const char *device, const char *reason) "tab=%s, dev=%s, reason=%s"
+gd_ungrab(const char *tab, const char *device) "tab=%s, dev=%s"
# ui/vnc.c
vnc_key_guest_leds(bool caps, bool num, bool scroll) "caps %d, num %d, scroll %d"
diff --git a/ui/gtk.c b/ui/gtk.c
index 5f87475f2e..322d112410 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -165,9 +165,9 @@ struct GtkDisplayState {
bool ignore_keys;
};
-static void gd_grab_pointer(VirtualConsole *vc);
+static void gd_grab_pointer(VirtualConsole *vc, const char *reason);
static void gd_ungrab_pointer(GtkDisplayState *s);
-static void gd_grab_keyboard(VirtualConsole *vc);
+static void gd_grab_keyboard(VirtualConsole *vc, const char *reason);
static void gd_ungrab_keyboard(GtkDisplayState *s);
/** Utility Functions **/
@@ -855,7 +855,7 @@ static gboolean gd_button_event(GtkWidget *widget, GdkEventButton *button,
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(s->grab_item),
TRUE);
} else {
- gd_grab_pointer(vc);
+ gd_grab_pointer(vc, "relative-mode-click");
}
return TRUE;
}
@@ -1092,7 +1092,7 @@ static gboolean gd_win_grab(void *opaque)
if (vc->s->ptr_owner) {
gd_ungrab_pointer(vc->s);
} else {
- gd_grab_pointer(vc);
+ gd_grab_pointer(vc, "user-request-detached-tab");
}
return TRUE;
}
@@ -1256,7 +1256,7 @@ static void gd_grab_devices(VirtualConsole *vc, bool grab,
}
#endif
-static void gd_grab_keyboard(VirtualConsole *vc)
+static void gd_grab_keyboard(VirtualConsole *vc, const char *reason)
{
if (vc->s->kbd_owner) {
if (vc->s->kbd_owner == vc) {
@@ -1277,7 +1277,7 @@ static void gd_grab_keyboard(VirtualConsole *vc)
#endif
vc->s->kbd_owner = vc;
gd_update_caption(vc->s);
- trace_gd_grab(vc->label, "kbd", true);
+ trace_gd_grab(vc->label, "kbd", reason);
}
static void gd_ungrab_keyboard(GtkDisplayState *s)
@@ -1295,10 +1295,10 @@ static void gd_ungrab_keyboard(GtkDisplayState *s)
gdk_keyboard_ungrab(GDK_CURRENT_TIME);
#endif
gd_update_caption(s);
- trace_gd_grab(vc->label, "kbd", false);
+ trace_gd_ungrab(vc->label, "kbd");
}
-static void gd_grab_pointer(VirtualConsole *vc)
+static void gd_grab_pointer(VirtualConsole *vc, const char *reason)
{
GdkDisplay *display = gtk_widget_get_display(vc->gfx.drawing_area);
@@ -1337,7 +1337,7 @@ static void gd_grab_pointer(VirtualConsole *vc)
#endif
vc->s->ptr_owner = vc;
gd_update_caption(vc->s);
- trace_gd_grab(vc->label, "ptr", true);
+ trace_gd_grab(vc->label, "ptr", reason);
}
static void gd_ungrab_pointer(GtkDisplayState *s)
@@ -1363,7 +1363,7 @@ static void gd_ungrab_pointer(GtkDisplayState *s)
vc->s->grab_x_root, vc->s->grab_y_root);
#endif
gd_update_caption(s);
- trace_gd_grab(vc->label, "ptr", false);
+ trace_gd_ungrab(vc->label, "ptr");
}
static void gd_menu_grab_input(GtkMenuItem *item, void *opaque)
@@ -1372,8 +1372,8 @@ static void gd_menu_grab_input(GtkMenuItem *item, void *opaque)
VirtualConsole *vc = gd_vc_find_current(s);
if (gd_is_grab_active(s)) {
- gd_grab_keyboard(vc);
- gd_grab_pointer(vc);
+ gd_grab_keyboard(vc, "user-request-main-window");
+ gd_grab_pointer(vc, "user-request-main-window");
} else {
gd_ungrab_keyboard(s);
gd_ungrab_pointer(s);
@@ -1432,7 +1432,7 @@ static gboolean gd_enter_event(GtkWidget *widget, GdkEventCrossing *crossing,
GtkDisplayState *s = vc->s;
if (gd_grab_on_hover(s)) {
- gd_grab_keyboard(vc);
+ gd_grab_keyboard(vc, "grab-on-hover");
}
return TRUE;
}