diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2014-06-12 11:44:31 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2014-06-23 15:39:08 +1000 |
commit | 6250397ac8a7a23fb41c726b9555d93ead0f1dc8 (patch) | |
tree | be028c08adbcd424b3a9fad8d8bea5b072ba4522 /tools | |
parent | 3f500b657f5e9f90ade90a6f2678d8596cd6b799 (diff) | |
download | libinput-6250397ac8a7a23fb41c726b9555d93ead0f1dc8.tar.gz |
udev: split libinput_udev context init into two functions
This is preparation work for context-specific log handlers.
Callers are now encouraged to first initialize the context with
libinput_udev_create_context() and then set the seat for this context with
libinput_udev_assign_seat().
In the upcoming patch to support context-specific log handlers this enables a
caller to set the log handler for a context before any devices are
initialized. Otherwise, a log message generated by a new device may pass a
libinput context that the caller is not yet aware of.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/event-debug.c | 8 | ||||
-rw-r--r-- | tools/event-gui.c | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/tools/event-debug.c b/tools/event-debug.c index eb43e056..2547da53 100644 --- a/tools/event-debug.c +++ b/tools/event-debug.c @@ -140,12 +140,18 @@ open_udev(struct libinput **li) return 1; } - *li = libinput_udev_create_for_seat(&interface, NULL, udev, seat); + *li = libinput_udev_create_context(&interface, NULL, udev); if (!*li) { fprintf(stderr, "Failed to initialize context from udev\n"); return 1; } + if (libinput_udev_assign_seat(*li, seat)) { + fprintf(stderr, "Failed to set seat\n"); + libinput_destroy(*li); + return 1; + } + return 0; } diff --git a/tools/event-gui.c b/tools/event-gui.c index 95540936..df86a520 100644 --- a/tools/event-gui.c +++ b/tools/event-gui.c @@ -458,8 +458,8 @@ main(int argc, char *argv[]) if (!udev) error("Failed to initialize udev\n"); - li = libinput_udev_create_for_seat(&interface, &w, udev, "seat0"); - if (!li) + li = libinput_udev_create_context(&interface, &w, udev); + if (!li || libinput_udev_assign_seat(li, "seat0") != 0) error("Failed to initialize context from udev\n"); window_init(&w); |