Skip to content

Commit

Permalink
tools: handle sigint in debug-gui
Browse files Browse the repository at this point in the history
Exit with success on SIGINT

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
  • Loading branch information
whot committed Nov 7, 2018
1 parent 5685980 commit 22890a4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tools/libinput-debug-gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

#include <gtk/gtk.h>
#include <glib.h>
#include <glib-unix.h>

#include <libinput.h>
#include <libinput-util.h>
Expand Down Expand Up @@ -918,6 +919,14 @@ usage(void) {
printf("Usage: libinput debug-gui [options] [--udev <seat>|--device /dev/input/event0]\n");
}

static gboolean
signal_handler(void *data)
{
gtk_main_quit();

return FALSE;
}

int
main(int argc, char **argv)
{
Expand All @@ -930,6 +939,8 @@ main(int argc, char **argv)

gtk_init(&argc, &argv);

g_unix_signal_add(SIGINT, signal_handler, NULL);

tools_init_options(&options);

while (1) {
Expand Down

0 comments on commit 22890a4

Please sign in to comment.