Fold the event-gui into the libinput tool

It's common enough for users to want to debug libinput behavior without
interference by the compositor or the X server. Being able to run a GUI
without having to compile from git is helpful.

Note that this changes --enable-event-gui autotools option to
--enable-debug-gui and the event-gui mesonconf option to debug-gui.

This also drops the standalone event-gui binary in both autotools and meson.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2017-05-24 10:36:44 +10:00
parent e9fc59efc8
commit a69294251d
8 changed files with 87 additions and 48 deletions

View file

@ -134,19 +134,21 @@ if test "x$build_documentation" = "xyes"; then
fi
fi
###########################################
# enable/disable event gui debugging tool #
###########################################
AC_ARG_ENABLE(event-gui,
AS_HELP_STRING([--enable-event-gui], [Build the GUI event viewer (default=yes)]),
[build_eventgui="$enableval"],
[build_eventgui="yes"])
########################################
# enable/disable the debug-gui feature #
########################################
AC_ARG_ENABLE(debug-gui,
AS_HELP_STRING([--enable-debug-gui], [Enable the 'debug-gui' feature in the libinput tool (default=yes)]),
[build_debug_gui="$enableval"],
[build_debug_gui="yes"])
if test "x$build_eventgui" = "xyes"; then
if test "x$build_debug_gui" = "xyes"; then
PKG_CHECK_MODULES(CAIRO, [cairo])
PKG_CHECK_MODULES(GTK, [glib-2.0 gtk+-3.0])
AC_DEFINE(BUILD_DEBUG_GUI, 1, [Build debug-gui support])
fi
########################
# enable/disable tests #
########################
@ -247,7 +249,7 @@ AM_CONDITIONAL(BUILD_TESTS, [test "x$build_tests" = "xyes"])
AM_CONDITIONAL(RUN_TESTS, [test "x$run_tests" = "xyes"])
AM_CONDITIONAL(BUILD_DOCS, [test "x$build_documentation" = "xyes"])
AM_CONDITIONAL(HAVE_LIBUNWIND, [test "x$HAVE_LIBUNWIND" = "xyes"])
AM_CONDITIONAL(BUILD_EVENTGUI, [test "x$build_eventgui" = "xyes"])
AM_CONDITIONAL(BUILD_DEBUG_GUI, [test "x$build_debug_gui" = "xyes"])
AC_CONFIG_FILES([Makefile
doc/Makefile
@ -274,6 +276,6 @@ AC_MSG_RESULT([
Build tests ${build_tests}
Tests use valgrind ${VALGRIND}
Tests use libunwind ${HAVE_LIBUNWIND}
Build GUI event tool ${build_eventgui}
Build GUI event tool ${build_debug_gui}
Enable gcov profiling ${enable_gcov}
])

View file

@ -362,6 +362,32 @@ executable('libinput-list-devices',
install : true,
)
if get_option('debug-gui')
dep_gtk = dependency('gtk+-3.0')
dep_cairo = dependency('cairo')
dep_glib = dependency('glib-2.0')
debug_gui_sources = [ 'tools/libinput-debug-gui.c' ] + tools_shared_sources
deps_debug_gui = [
dep_gtk,
dep_cairo,
dep_glib,
dep_libevdev,
dep_libinput
]
executable('libinput-debug-gui',
debug_gui_sources,
dependencies : deps_debug_gui,
include_directories : include_directories('src'),
install_dir : libinput_tool_path,
install : false
)
install_man('tools/libinput-debug-gui.1')
endif
install_man('tools/libinput-list-devices.1',
'tools/libinput-debug-events.1')
libinput_sources = [ 'tools/libinput-tool.c' ]
executable('libinput',
@ -372,6 +398,8 @@ executable('libinput',
)
install_man('tools/libinput.1')
meson.add_install_script('tools/install-compat-scripts.sh')
ptraccel_debug_sources = [ 'tools/ptraccel-debug.c' ]
executable('ptraccel-debug',
ptraccel_debug_sources,
@ -380,32 +408,6 @@ executable('ptraccel-debug',
install : false
)
if get_option('event-gui')
dep_gtk = dependency('gtk+-3.0')
dep_cairo = dependency('cairo')
dep_glib = dependency('glib-2.0')
event_gui_sources = [ 'tools/event-gui.c' ] + tools_shared_sources
deps_event_gui = [
dep_gtk,
dep_cairo,
dep_glib,
dep_libevdev,
dep_libinput
]
executable('event-gui',
event_gui_sources,
dependencies : deps_event_gui,
include_directories : include_directories('src'),
install : false
)
endif
install_man('tools/libinput-list-devices.1',
'tools/libinput-debug-events.1')
meson.add_install_script('tools/install-compat-scripts.sh')
############ tests ############
if get_option('enable-tests')

View file

@ -6,10 +6,10 @@ option('libwacom',
type: 'boolean',
default: true,
description: 'Use libwacom for tablet identification (default=true)')
option('event-gui',
option('debug-gui',
type: 'boolean',
default: true,
description: 'Build the GUI event viewer [default=true]')
description: 'Enable the "debug-gui" feature in the libinput tool [default=true]')
option('enable-tests',
type: 'boolean',
default: true,

View file

@ -39,15 +39,12 @@ libinput_debug_events_LDADD = ../src/libinput.la $(LIBUDEV_LIBS) $(LIBEVDEV_LIBS
libinput_debug_events_CFLAGS = $(AM_CFLAGS) $(LIBUDEV_CFLAGS) $(LIBEVDEV_CFLAGS)
dist_man1_MANS += libinput-debug-events.1
if BUILD_EVENTGUI
noinst_PROGRAMS += event-gui
event_gui_SOURCES = event-gui.c $(shared_sources)
event_gui_LDADD = ../src/libinput.la $(CAIRO_LIBS) $(GTK_LIBS) \
$(LIBUDEV_LIBS) $(LIBEVDEV_LIBS)
event_gui_CFLAGS = $(CAIRO_CFLAGS) $(GTK_CFLAGS) \
$(LIBUDEV_CFLAGS) $(LIBEVDEV_CFLAGS) $(AM_CFLAGS)
event_gui_LDFLAGS = -no-install
if BUILD_DEBUG_GUI
tools_PROGRAMS += libinput-debug-gui
libinput_debug_gui_SOURCES = libinput-debug-gui.c $(shared_sources)
libinput_debug_gui_LDADD = ../src/libinput.la $(CAIRO_LIBS) $(GTK_LIBS) $(LIBEVDEV_LIBS)
libinput_debug_gui_CFLAGS = $(AM_CFLAGS) $(CAIRO_CFLAGS) $(GTK_CFLAGS) $(LIBEVDEV_CFLAGS)
dist_man1_MANS += libinput-debug-gui.1
endif
EXTRA_DIST = make-ptraccel-graphs.sh $(bin_SCRIPTS)

View file

@ -0,0 +1,32 @@
.TH LIBINPUT-DEBUG-GUI "1"
.SH NAME
libinput-debug-gui \- visual debug helper for libinput
.SH SYNOPSIS
.B libinput debug-gui [--help]
.SH DESCRIPTION
.PP
The
.B "libinput debug-gui"
tool creates a libinput context and a full-screen GTK window to visualize
events processed by libinput.
.PP
This is a debugging tool only, its output or behavior may change at any
time. Do not rely on the output or the behavior.
.PP
This tool usually needs to be run as root to have access to the
/dev/input/eventX nodes.
.SH OPTIONS
.TP 8
.B --help
Print help
.PP
For all other options, see the output from --help. Options may be added or
removed at any time.
.SH NOTES
.PP
Events shown by this tool may not correspond to the events seen by a
different user of libinput. This tool initializes a separate context.
.SH LIBINPUT
Part of the
.B libinput(1)
suite

View file

@ -867,7 +867,7 @@ sockets_init(struct libinput *li)
}
int
main(int argc, char *argv[])
main(int argc, char **argv)
{
struct window w;
struct libinput *li;

View file

@ -60,6 +60,9 @@ libinput_tool_usage(void)
"\n"
" debug-events\n"
" Print events to stdout\n"
"\n"
" debug-gui\n"
" Display a simple GUI to visualize libinput's events.\n"
"\n");
}

View file

@ -39,6 +39,9 @@ information, e.g.
.B libinput-debug-events(1)
Print all events as seen by libinput.
.TP 8
.B libinput-debug-gui(1)
Show a GUI to visualize libinput's events.
.TP 8
.B libinput-list-devices(1)
List all devices recognized by libinput.
.SH LIBINPUT