diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2018-08-27 11:14:05 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2018-08-27 17:04:51 +1000 |
commit | e640bac86708e05dfbe6ea811fba7b188b04bc2b (patch) | |
tree | bcac2f24ed1a21253c5ede15cc6bc7a592a208ee /tools/libinput-debug-gui.c | |
parent | b44f6b4eefbf45754f4bd7f0297afb083c702950 (diff) | |
download | libinput-e640bac86708e05dfbe6ea811fba7b188b04bc2b.tar.gz |
tools: fix grab handling in libinput debug-gui
The libinput context's user_data was used for deciding whether to grab the
event device but also to hold the struct window data for the debug-gui. Worked
fine for the initial batch of devices, but any device coming in late would
just use the first field of the struct window to decide whether to grab or
not.
Fixes #122
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools/libinput-debug-gui.c')
-rw-r--r-- | tools/libinput-debug-gui.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/tools/libinput-debug-gui.c b/tools/libinput-debug-gui.c index 1cf81117..06ea0b81 100644 --- a/tools/libinput-debug-gui.c +++ b/tools/libinput-debug-gui.c @@ -55,6 +55,7 @@ struct point { }; struct window { + bool grab; struct tools_options options; GtkWidget *win; @@ -455,8 +456,6 @@ map_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data) static void window_init(struct window *w) { - memset(w, 0, sizeof(*w)); - w->win = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_widget_set_events(w->win, 0); gtk_window_set_title(GTK_WINDOW(w->win), "libinput debugging tool"); @@ -922,12 +921,11 @@ usage(void) { int main(int argc, char **argv) { - struct window w; + struct window w = {0}; struct tools_options options; struct libinput *li; enum tools_backend backend = BACKEND_UDEV; const char *seat_or_device = "seat0"; - bool grab = false; bool verbose = false; gtk_init(&argc, &argv); @@ -974,7 +972,7 @@ main(int argc, char **argv) seat_or_device = optarg; break; case OPT_GRAB: - grab = true; + w.grab = true; break; case OPT_VERBOSE: verbose = true; @@ -994,7 +992,7 @@ main(int argc, char **argv) return 1; } - li = tools_open_backend(backend, seat_or_device, verbose, &grab); + li = tools_open_backend(backend, seat_or_device, verbose, &w.grab); if (!li) return 1; |