diff options
-rw-r--r-- | fbi.c | 7 | ||||
-rw-r--r-- | fbpdf.c | 7 | ||||
-rw-r--r-- | kbd.c | 4 | ||||
-rw-r--r-- | kbd.h | 3 | ||||
-rw-r--r-- | kbdtest.c | 2 |
5 files changed, 18 insertions, 5 deletions
@@ -1326,6 +1326,7 @@ int main(int argc, char *argv[]) int once; int i, arg, key; bool framebuffer = false; + bool use_grab = false; bool use_libinput; char *info, *desc, *device, *output, *mode; char linebuffer[128]; @@ -1444,11 +1445,15 @@ int main(int argc, char *argv[]) fprintf(stderr, "WARNING: Other processes (fbcon too) can write to display.\n"); fprintf(stderr, "WARNING: Also can't properly cleanup on exit.\n"); } + if (use_libinput) { + fprintf(stderr, "NOTICE: Using input device grab.\n"); + use_grab = true; + } } shadow_init(gfx); /* svga main loop */ - kbd_init(use_libinput, gfx->devnum); + kbd_init(use_libinput, use_grab, gfx->devnum); desc = NULL; info = NULL; for (;;) { @@ -237,6 +237,7 @@ int main(int argc, char *argv[]) { GError *err = NULL; bool framebuffer = false; + bool use_grab = false; bool use_libinput; bool quit, newpage, pageflip; char cwd[1024]; @@ -327,6 +328,10 @@ int main(int argc, char *argv[]) fprintf(stderr, "WARNING: Other processes (fbcon too) can write to display.\n"); fprintf(stderr, "WARNING: Also can't properly cleanup on exit.\n"); } + if (use_libinput) { + fprintf(stderr, "NOTICE: Using input device grab.\n"); + use_grab = true; + } } surface1 = cairo_image_surface_create_for_data(gfx->mem, @@ -342,7 +347,7 @@ int main(int argc, char *argv[]) gfx->stride); } - kbd_init(use_libinput, gfx->devnum); + kbd_init(use_libinput, use_grab, gfx->devnum); index = 0; newpage = true; @@ -195,6 +195,7 @@ static int file_wait(int fd, int timeout) /* ---------------------------------------------------------------------- */ +static bool devgrab; static int devcount; static int open_restricted(const char *path, int flags, void *user_data) @@ -226,13 +227,14 @@ static const struct libinput_interface interface = { static struct libinput *ctx; -void kbd_init(int use_libinput, dev_t gfx) +void kbd_init(bool use_libinput, bool use_grab, dev_t gfx) { struct udev *udev; struct udev_device *ugfx; const char *seat = NULL; if (use_libinput) { + devgrab = use_grab; udev = udev_new(); ugfx = udev_device_new_from_devnum(udev, 'c', gfx); if (ugfx) @@ -1,9 +1,10 @@ +#include <stdbool.h> #include <linux/input.h> #define KEY_MOD_SHIFT (1 << 0) #define KEY_MOD_CTRL (1 << 1) -void kbd_init(int use_libinput, dev_t gfx); +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); @@ -23,7 +23,7 @@ int main(int argc, char *argv[]) char key[32]; int rc,i; - kbd_init(0, 0); + kbd_init(0, 0, 0); for (;;) { kbd_wait(10); |