diff options
-rw-r--r-- | kbd.c | 15 | ||||
-rw-r--r-- | kbd.h | 3 | ||||
-rw-r--r-- | vt.c | 3 |
3 files changed, 20 insertions, 1 deletions
@@ -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); +} @@ -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); @@ -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; |