compositor: Use paced logger for unknown scroll source

Mimic the existing behaviour of logging 5 times, with no reset, but
change it so it's per device instead of using a static variable.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2022-11-03 14:33:10 -05:00
parent a82cb25108
commit 805c7c4814
2 changed files with 3 additions and 5 deletions

View File

@ -248,7 +248,6 @@ static bool
handle_pointer_axis(struct libinput_device *libinput_device,
struct libinput_event_pointer *pointer_event)
{
static int warned;
struct evdev_device *device =
libinput_device_get_user_data(libinput_device);
double vert, horiz;
@ -282,10 +281,8 @@ handle_pointer_axis(struct libinput_device *libinput_device,
wl_axis_source = WL_POINTER_AXIS_SOURCE_CONTINUOUS;
break;
default:
if (warned < 5) {
weston_log("Unknown scroll source %d.\n", source);
warned++;
}
weston_log_paced(&device->unknown_scroll_pacer, 5, 0,
"Unknown scroll source %d.\n", source);
return false;
}

View File

@ -52,6 +52,7 @@ struct evdev_device {
char *output_name;
int fd;
bool override_wl_calibration;
struct weston_log_pacer unknown_scroll_pacer;
};
void