aboutsummaryrefslogtreecommitdiffstats
path: root/kbdtest.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-04-16 12:30:24 +0200
committerGerd Hoffmann <kraxel@redhat.com>2019-04-16 12:30:24 +0200
commit2d62ce153a386d8c67dfd0d965d746a754ef4129 (patch)
treec7ce4c59eceb3b6eb179ae8075597ac49143dde7 /kbdtest.c
parent5737cf1d24c868a55eafc59a51c000dc7f4f63f6 (diff)
downloadfbida-2d62ce153a386d8c67dfd0d965d746a754ef4129.tar.gz
logind tweaks
Diffstat (limited to 'kbdtest.c')
-rw-r--r--kbdtest.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/kbdtest.c b/kbdtest.c
index 215a216..2483ae2 100644
--- a/kbdtest.c
+++ b/kbdtest.c
@@ -10,6 +10,7 @@
#include <termios.h>
#include "kbd.h"
+#include "logind.h"
/* ---------------------------------------------------------------------- */
@@ -45,9 +46,11 @@ static void usage(FILE *fp)
int main(int argc, char *argv[])
{
+ const char *xdg_seat, *xdg_session_id;
uint32_t code, mod;
char key[32];
bool use_libinput = false;
+ bool use_logind = false;
int rc, i, c;
for (;;) {
@@ -67,7 +70,15 @@ int main(int argc, char *argv[])
}
}
- kbd_init(use_libinput, 0);
+ xdg_seat = getenv("XDG_SEAT");
+ xdg_session_id = getenv("XDG_SESSION_ID");
+ if (use_libinput && xdg_seat && xdg_session_id) {
+ if (logind_init(true, NULL, NULL) == 0) {
+ use_logind = true;
+ }
+ }
+
+ kbd_init(use_libinput, use_logind, 0);
for (;;) {
kbd_wait(10);