[PATCH libinput 03/11] Fold the event-gui into the libinput tool
Peter Hutterer
peter.hutterer at who-t.net
Sun May 28 22:47:56 UTC 2017
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 at who-t.net>
---
configure.ac | 22 +++++++------
meson.build | 50 +++++++++++++++--------------
meson_options.txt | 4 +--
tools/Makefile.am | 15 ++++-----
tools/libinput-debug-gui.1 | 32 ++++++++++++++++++
tools/{event-gui.c => libinput-debug-gui.c} | 2 +-
tools/libinput-tool.c | 3 ++
tools/libinput.1 | 3 ++
8 files changed, 85 insertions(+), 46 deletions(-)
create mode 100644 tools/libinput-debug-gui.1
rename tools/{event-gui.c => libinput-debug-gui.c} (99%)
diff --git a/configure.ac b/configure.ac
index 338d385c..3d60337c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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}
])
diff --git a/meson.build b/meson.build
index e536bbf9..fd9838f6 100644
--- a/meson.build
+++ b/meson.build
@@ -362,50 +362,52 @@ executable('libinput-list-devices',
install : true,
)
-libinput_sources = [ 'tools/libinput-tool.c' ]
-
-executable('libinput',
- libinput_sources,
- dependencies : dep_libinput,
- include_directories : include_directories ('src'),
- install : true
- )
-install_man('tools/libinput.1')
-
-ptraccel_debug_sources = [ 'tools/ptraccel-debug.c' ]
-executable('ptraccel-debug',
- ptraccel_debug_sources,
- dependencies : [ dep_libfilter, dep_libinput ],
- include_directories : include_directories('src'),
- install : false
- )
-
-if get_option('event-gui')
+if get_option('debug-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 = [
+ 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('event-gui',
- event_gui_sources,
- dependencies : deps_event_gui,
+ 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',
+ libinput_sources,
+ dependencies : dep_libinput,
+ include_directories : include_directories ('src'),
+ install : true
+ )
+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,
+ dependencies : [ dep_libfilter, dep_libinput ],
+ include_directories : include_directories('src'),
+ install : false
+ )
+
############ tests ############
if get_option('enable-tests')
diff --git a/meson_options.txt b/meson_options.txt
index 5cd6d70e..f432e7ea 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -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,
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 0702dc6b..85fe700d 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -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)
diff --git a/tools/libinput-debug-gui.1 b/tools/libinput-debug-gui.1
new file mode 100644
index 00000000..0f22a115
--- /dev/null
+++ b/tools/libinput-debug-gui.1
@@ -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
diff --git a/tools/event-gui.c b/tools/libinput-debug-gui.c
similarity index 99%
rename from tools/event-gui.c
rename to tools/libinput-debug-gui.c
index 07afe0b4..fa685275 100644
--- a/tools/event-gui.c
+++ b/tools/libinput-debug-gui.c
@@ -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;
diff --git a/tools/libinput-tool.c b/tools/libinput-tool.c
index 32bb0e5c..3b7c87b6 100644
--- a/tools/libinput-tool.c
+++ b/tools/libinput-tool.c
@@ -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");
}
diff --git a/tools/libinput.1 b/tools/libinput.1
index c50d1b60..f6047490 100644
--- a/tools/libinput.1
+++ b/tools/libinput.1
@@ -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
--
2.13.0
More information about the wayland-devel
mailing list