From 74c04932a02d2f2e50f023074c8d1d849d184bd3 Mon Sep 17 00:00:00 2001 From: buffet Date: Sun, 17 Mar 2019 21:03:59 +0100 Subject: [PATCH] Moved cursor into input --- include/kiwmi/desktop/desktop.h | 3 --- include/kiwmi/input/input.h | 3 +++ kiwmi/desktop/desktop.c | 7 ------- kiwmi/desktop/output.c | 2 +- kiwmi/input.c | 4 +--- kiwmi/input/input.c | 9 +++++++++ kiwmi/output.c | 1 + 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/kiwmi/desktop/desktop.h b/include/kiwmi/desktop/desktop.h index 5f55e74..6f0b267 100644 --- a/include/kiwmi/desktop/desktop.h +++ b/include/kiwmi/desktop/desktop.h @@ -13,13 +13,10 @@ #include #include -#include "kiwmi/input/cursor.h" - struct kiwmi_desktop { struct wlr_compositor *compositor; struct wlr_data_device_manager *data_device_manager; struct wlr_output_layout *output_layout; - struct kiwmi_cursor *cursor; struct wl_list outputs; // struct kiwmi_output::link struct wl_listener new_output; diff --git a/include/kiwmi/input/input.h b/include/kiwmi/input/input.h index 82c979e..99eb78a 100644 --- a/include/kiwmi/input/input.h +++ b/include/kiwmi/input/input.h @@ -10,9 +10,12 @@ #include +#include "kiwmi/input/cursor.h" + struct kiwmi_input { struct wl_list keyboards; // struct kiwmi_keyboard::link struct wl_listener new_input; + struct kiwmi_cursor *cursor; }; bool input_init(struct kiwmi_input *input); diff --git a/kiwmi/desktop/desktop.c b/kiwmi/desktop/desktop.c index 7d0057d..554762b 100644 --- a/kiwmi/desktop/desktop.c +++ b/kiwmi/desktop/desktop.c @@ -14,7 +14,6 @@ #include #include #include -#include #include "kiwmi/server.h" #include "kiwmi/desktop/output.h" @@ -29,12 +28,6 @@ desktop_init(struct kiwmi_desktop *desktop, struct wlr_renderer *renderer) wlr_data_device_manager_create(server->wl_display); desktop->output_layout = wlr_output_layout_create(); - desktop->cursor = cursor_create(desktop->output_layout); - if (!desktop->cursor) { - wlr_log(WLR_ERROR, "Failed to create cursor"); - return false; - } - wl_list_init(&desktop->outputs); desktop->new_output.notify = new_output_notify; diff --git a/kiwmi/desktop/output.c b/kiwmi/desktop/output.c index 44b8931..93fb17b 100644 --- a/kiwmi/desktop/output.c +++ b/kiwmi/desktop/output.c @@ -38,7 +38,7 @@ new_output_notify(struct wl_listener *listener, void *data) return; } - struct kiwmi_cursor *cursor = desktop->cursor; + struct kiwmi_cursor *cursor = server->input.cursor; wlr_xcursor_manager_load(cursor->xcursor_manager, wlr_output->scale); diff --git a/kiwmi/input.c b/kiwmi/input.c index 39a186b..d04d225 100644 --- a/kiwmi/input.c +++ b/kiwmi/input.c @@ -18,9 +18,7 @@ static void new_pointer(struct kiwmi_input *input, struct wlr_input_device *device) { - struct kiwmi_server *server = wl_container_of(input, server, input); - - wlr_cursor_attach_input_device(server->desktop.cursor->cursor, device); + wlr_cursor_attach_input_device(input->cursor->cursor, device); } static void diff --git a/kiwmi/input/input.c b/kiwmi/input/input.c index 450b27e..e255c4a 100644 --- a/kiwmi/input/input.c +++ b/kiwmi/input/input.c @@ -8,6 +8,7 @@ #include "kiwmi/input/input.h" #include +#include #include "kiwmi/input.h" #include "kiwmi/server.h" @@ -17,8 +18,16 @@ input_init(struct kiwmi_input *input) { struct kiwmi_server *server = wl_container_of(input, server, input); + input->cursor = cursor_create(server->desktop.output_layout); + if (!input->cursor) { + wlr_log(WLR_ERROR, "Failed to create cursor"); + return false; + } + wl_list_init(&input->keyboards); input->new_input.notify = new_input_notify; wl_signal_add(&server->backend->events.new_input, &input->new_input); + + return true; } diff --git a/kiwmi/output.c b/kiwmi/output.c index d25fa11..2b90321 100644 --- a/kiwmi/output.c +++ b/kiwmi/output.c @@ -10,6 +10,7 @@ #include #include +#include #include #include