aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-01-18 13:00:01 +0100
committerGerd Hoffmann <kraxel@redhat.com>2019-01-18 13:00:01 +0100
commitd88041d909b2118ebc67b356b2848fb8bdfc8f2c (patch)
treea5e5e41a2aad0637b1799da3555c214f346dab0d
parent2692e11168fec90673d21caf2c811cadbf63d2be (diff)
downloadfbida-d88041d909b2118ebc67b356b2848fb8bdfc8f2c.tar.gz
libinput: grab tweaks
-rw-r--r--fbi.c7
-rw-r--r--fbpdf.c7
-rw-r--r--kbd.c4
-rw-r--r--kbd.h3
-rw-r--r--kbdtest.c2
5 files changed, 18 insertions, 5 deletions
diff --git a/fbi.c b/fbi.c
index 9dab5b6..5838ea3 100644
--- a/fbi.c
+++ b/fbi.c
@@ -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 (;;) {
diff --git a/fbpdf.c b/fbpdf.c
index 91ccecd..32e1b2d 100644
--- a/fbpdf.c
+++ b/fbpdf.c
@@ -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;
diff --git a/kbd.c b/kbd.c
index ff29c6e..dbd9ef8 100644
--- a/kbd.c
+++ b/kbd.c
@@ -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)
diff --git a/kbd.h b/kbd.h
index e9ed50b..95fe824 100644
--- a/kbd.h
+++ b/kbd.h
@@ -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);
diff --git a/kbdtest.c b/kbdtest.c
index d1768c2..77a41d9 100644
--- a/kbdtest.c
+++ b/kbdtest.c
@@ -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);