aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-05-29 18:22:44 +0100
committerGitHub <noreply@github.com>2018-05-29 18:22:44 +0100
commite1f56538a8862f05cc9ad1d44cd47bc6ed5e6387 (patch)
tree49d378a4cd90cde1aabc5d6d3ccbefde16126997 /rootston
parent3444f43c16e49ad64fa6f1f11be7baf16b3bf49c (diff)
parent5334ee8bfd93b2bfdc077f422b87c2509f04d5d4 (diff)
Merge pull request #999 from dcz-purism/virtual-keyboard
Support virtual keyboard protocol
Diffstat (limited to 'rootston')
-rw-r--r--rootston/desktop.c7
-rw-r--r--rootston/meson.build1
-rw-r--r--rootston/virtual_keyboard.c21
3 files changed, 29 insertions, 0 deletions
diff --git a/rootston/desktop.c b/rootston/desktop.c
index 178a975a..a6f9e9a0 100644
--- a/rootston/desktop.c
+++ b/rootston/desktop.c
@@ -26,6 +26,7 @@
#include "rootston/seat.h"
#include "rootston/server.h"
#include "rootston/view.h"
+#include "rootston/virtual_keyboard.h"
#include "rootston/xcursor.h"
#include "wlr-layer-shell-unstable-v1-protocol.h"
@@ -865,6 +866,12 @@ struct roots_desktop *desktop_create(struct roots_server *server,
desktop->linux_dmabuf = wlr_linux_dmabuf_create(server->wl_display,
server->renderer);
+
+ desktop->virtual_keyboard = wlr_virtual_keyboard_manager_v1_create(
+ server->wl_display);
+ wl_signal_add(&desktop->virtual_keyboard->events.new_virtual_keyboard,
+ &desktop->virtual_keyboard_new);
+ desktop->virtual_keyboard_new.notify = handle_virtual_keyboard;
return desktop;
}
diff --git a/rootston/meson.build b/rootston/meson.build
index 53a4635d..8ab872b5 100644
--- a/rootston/meson.build
+++ b/rootston/meson.build
@@ -9,6 +9,7 @@ sources = [
'main.c',
'output.c',
'seat.c',
+ 'virtual_keyboard.c',
'wl_shell.c',
'xdg_shell_v6.c',
'xdg_shell.c',
diff --git a/rootston/virtual_keyboard.c b/rootston/virtual_keyboard.c
new file mode 100644
index 00000000..db47efca
--- /dev/null
+++ b/rootston/virtual_keyboard.c
@@ -0,0 +1,21 @@
+#define _POSIX_C_SOURCE 199309L
+
+#include <wlr/util/log.h>
+#include <wlr/types/wlr_virtual_keyboard_v1.h>
+#include "rootston/virtual_keyboard.h"
+#include "rootston/seat.h"
+
+void handle_virtual_keyboard(struct wl_listener *listener, void *data) {
+ struct roots_desktop *desktop =
+ wl_container_of(listener, desktop, virtual_keyboard_new);
+ struct wlr_virtual_keyboard_v1 *keyboard = data;
+
+ struct roots_seat *seat = input_seat_from_wlr_seat(desktop->server->input,
+ keyboard->seat);
+ if (!seat) {
+ wlr_log(L_ERROR, "could not find roots seat");
+ return;
+ }
+
+ roots_seat_add_device(seat, &keyboard->input_device);
+}