aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kbd.c15
-rw-r--r--kbd.h3
-rw-r--r--vt.c3
3 files changed, 20 insertions, 1 deletions
diff --git a/kbd.c b/kbd.c
index dbd9ef8..a358e10 100644
--- a/kbd.c
+++ b/kbd.c
@@ -209,7 +209,8 @@ static int open_restricted(const char *path, int flags, void *user_data)
}
fprintf(stderr, "using %s\n", path);
- ioctl(fd, EVIOCGRAB, 1);
+ if (devgrab)
+ ioctl(fd, EVIOCGRAB, 1);
devcount++;
return fd;
}
@@ -318,3 +319,15 @@ int kbd_read(char *buf, uint32_t len,
return rc;
}
}
+
+void kbd_suspend(void)
+{
+ if (ctx)
+ libinput_suspend(ctx);
+}
+
+void kbd_resume(void)
+{
+ if (ctx)
+ libinput_resume(ctx);
+}
diff --git a/kbd.h b/kbd.h
index 95fe824..68f06a3 100644
--- a/kbd.h
+++ b/kbd.h
@@ -1,4 +1,5 @@
#include <stdbool.h>
+#include <inttypes.h>
#include <linux/input.h>
#define KEY_MOD_SHIFT (1 << 0)
@@ -8,4 +9,6 @@ void kbd_init(bool use_libinput, bool use_grab, dev_t gfx);
int kbd_wait(int timeout);
int kbd_read(char *buf, uint32_t len,
uint32_t *keycode, uint32_t *modifier);
+void kbd_suspend(void);
+void kbd_resume(void);
void kbd_fini(void);
diff --git a/vt.c b/vt.c
index f15d51f..55ef71f 100644
--- a/vt.c
+++ b/vt.c
@@ -12,6 +12,7 @@
#include <linux/vt.h>
#include "vt.h"
+#include "kbd.h"
/* -------------------------------------------------------------------- */
@@ -130,6 +131,7 @@ int check_console_switch(void)
case CONSOLE_REL_REQ:
console_switch_release();
case CONSOLE_INACTIVE:
+ kbd_suspend();
console_visible = 0;
break;
case CONSOLE_ACQ_REQ:
@@ -137,6 +139,7 @@ int check_console_switch(void)
case CONSOLE_ACTIVE:
console_visible = 1;
console_redraw();
+ kbd_resume();
break;
default:
break;