mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-03 11:10:29 +01:00
tools: print the libinput_dispatch() counter for debugging messages
The messages with priority DEBUG refer to the various internal state machines updating, so it's useful to know when they did so. Let's count up every time we trigger libinput_dispatch() so we know how the messages group together. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
7244e36b50
commit
4f282688ac
4 changed files with 22 additions and 2 deletions
|
|
@ -824,7 +824,7 @@ handle_and_print_events(struct libinput *li)
|
|||
int rc = -1;
|
||||
struct libinput_event *ev;
|
||||
|
||||
libinput_dispatch(li);
|
||||
tools_dispatch(li);
|
||||
while ((ev = libinput_get_event(li))) {
|
||||
print_event_header(ev);
|
||||
|
||||
|
|
|
|||
|
|
@ -1422,7 +1422,7 @@ handle_event_libinput(GIOChannel *source, GIOCondition condition, gpointer data)
|
|||
struct window *w = libinput_get_user_data(li);
|
||||
struct libinput_event *ev;
|
||||
|
||||
libinput_dispatch(li);
|
||||
tools_dispatch(li);
|
||||
|
||||
while ((ev = libinput_get_event(li))) {
|
||||
switch (libinput_event_get_type(ev)) {
|
||||
|
|
|
|||
|
|
@ -43,6 +43,15 @@
|
|||
#include "util-macros.h"
|
||||
#include "util-strings.h"
|
||||
|
||||
static uint32_t dispatch_counter = 0;
|
||||
|
||||
void
|
||||
tools_dispatch(struct libinput *libinput)
|
||||
{
|
||||
dispatch_counter++;
|
||||
libinput_dispatch(libinput);
|
||||
}
|
||||
|
||||
LIBINPUT_ATTRIBUTE_PRINTF(3, 0)
|
||||
static void
|
||||
log_handler(struct libinput *li,
|
||||
|
|
@ -51,6 +60,7 @@ log_handler(struct libinput *li,
|
|||
va_list args)
|
||||
{
|
||||
static int is_tty = -1;
|
||||
static uint32_t last_dispatch_no = 0;
|
||||
|
||||
if (is_tty == -1)
|
||||
is_tty = isatty(STDOUT_FILENO);
|
||||
|
|
@ -62,6 +72,14 @@ log_handler(struct libinput *li,
|
|||
printf(ANSI_HIGHLIGHT);
|
||||
}
|
||||
|
||||
if (priority < LIBINPUT_LOG_PRIORITY_INFO) {
|
||||
if (dispatch_counter != last_dispatch_no) {
|
||||
last_dispatch_no = dispatch_counter;
|
||||
printf("%4u: ", dispatch_counter);
|
||||
} else {
|
||||
printf(" %4s ", "...");
|
||||
}
|
||||
}
|
||||
vprintf(format, args);
|
||||
|
||||
if (is_tty && priority >= LIBINPUT_LOG_PRIORITY_INFO)
|
||||
|
|
|
|||
|
|
@ -132,4 +132,6 @@ tools_list_device_quirks(struct quirks_context *ctx,
|
|||
void (*callback)(void *userdata, const char *str),
|
||||
void *userdata);
|
||||
|
||||
void
|
||||
tools_dispatch(struct libinput *libinput);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue