Moved cursor into input

This commit is contained in:
buffet 2019-03-17 21:03:59 +01:00
parent b3eed39a82
commit b394a50db6
7 changed files with 15 additions and 14 deletions

View file

@ -13,13 +13,10 @@
#include <wlr/types/wlr_data_device.h> #include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_output_layout.h> #include <wlr/types/wlr_output_layout.h>
#include "kiwmi/input/cursor.h"
struct kiwmi_desktop { struct kiwmi_desktop {
struct wlr_compositor *compositor; struct wlr_compositor *compositor;
struct wlr_data_device_manager *data_device_manager; struct wlr_data_device_manager *data_device_manager;
struct wlr_output_layout *output_layout; struct wlr_output_layout *output_layout;
struct kiwmi_cursor *cursor;
struct wl_list outputs; // struct kiwmi_output::link struct wl_list outputs; // struct kiwmi_output::link
struct wl_listener new_output; struct wl_listener new_output;

View file

@ -10,9 +10,12 @@
#include <wayland-server.h> #include <wayland-server.h>
#include "kiwmi/input/cursor.h"
struct kiwmi_input { struct kiwmi_input {
struct wl_list keyboards; // struct kiwmi_keyboard::link struct wl_list keyboards; // struct kiwmi_keyboard::link
struct wl_listener new_input; struct wl_listener new_input;
struct kiwmi_cursor *cursor;
}; };
bool input_init(struct kiwmi_input *input); bool input_init(struct kiwmi_input *input);

View file

@ -14,7 +14,6 @@
#include <wlr/types/wlr_compositor.h> #include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_data_device.h> #include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_output_layout.h> #include <wlr/types/wlr_output_layout.h>
#include <wlr/util/log.h>
#include "kiwmi/server.h" #include "kiwmi/server.h"
#include "kiwmi/desktop/output.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); wlr_data_device_manager_create(server->wl_display);
desktop->output_layout = wlr_output_layout_create(); 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); wl_list_init(&desktop->outputs);
desktop->new_output.notify = new_output_notify; desktop->new_output.notify = new_output_notify;

View file

@ -38,7 +38,7 @@ new_output_notify(struct wl_listener *listener, void *data)
return; return;
} }
struct kiwmi_cursor *cursor = desktop->cursor; struct kiwmi_cursor *cursor = server->input.cursor;
wlr_xcursor_manager_load(cursor->xcursor_manager, wlr_output->scale); wlr_xcursor_manager_load(cursor->xcursor_manager, wlr_output->scale);

View file

@ -18,9 +18,7 @@
static void static void
new_pointer(struct kiwmi_input *input, struct wlr_input_device *device) 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(input->cursor->cursor, device);
wlr_cursor_attach_input_device(server->desktop.cursor->cursor, device);
} }
static void static void

View file

@ -8,6 +8,7 @@
#include "kiwmi/input/input.h" #include "kiwmi/input/input.h"
#include <wayland-server.h> #include <wayland-server.h>
#include <wlr/util/log.h>
#include "kiwmi/input.h" #include "kiwmi/input.h"
#include "kiwmi/server.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); 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); wl_list_init(&input->keyboards);
input->new_input.notify = new_input_notify; input->new_input.notify = new_input_notify;
wl_signal_add(&server->backend->events.new_input, &input->new_input); wl_signal_add(&server->backend->events.new_input, &input->new_input);
return true;
} }

View file

@ -10,6 +10,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <wayland-server.h> #include <wayland-server.h>
#include <wlr/backend.h>
#include <wlr/render/wlr_renderer.h> #include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>