aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2017-10-31 17:58:28 -0400
committerGitHub <noreply@github.com>2017-10-31 17:58:28 -0400
commitc7c0d34e920dea27cab3b88c50b1202343a54435 (patch)
tree6966addb32a19e5c9606d0cbded7f922fb372461 /rootston
parent7200d643363e988edf6777c38e7f8fcd451a2c50 (diff)
parentec22fe713445977c1a122572107495b584117b16 (diff)
Merge pull request #352 from emersion/output-cursor
Add wlr_output_cursor
Diffstat (limited to 'rootston')
-rw-r--r--rootston/cursor.c23
-rw-r--r--rootston/input.c5
-rw-r--r--rootston/output.c28
3 files changed, 19 insertions, 37 deletions
diff --git a/rootston/cursor.c b/rootston/cursor.c
index 3fa8afb6..7307b6b2 100644
--- a/rootston/cursor.c
+++ b/rootston/cursor.c
@@ -33,24 +33,8 @@ const struct roots_input_event *get_input_event(struct roots_input *input,
static void cursor_set_xcursor_image(struct roots_input *input,
struct wlr_xcursor_image *image) {
- struct roots_output *output;
- wl_list_for_each(output, &input->server->desktop->outputs, link) {
- if (!wlr_output_set_cursor(output->wlr_output, image->buffer,
- image->width, image->width, image->height,
- image->hotspot_x, image->hotspot_y)) {
- wlr_log(L_DEBUG, "Failed to set hardware cursor");
- return;
- }
- }
-}
-
-static void cursor_set_surface(struct roots_input *input,
- struct wlr_surface *surface, int32_t hotspot_x, int32_t hotspot_y) {
- struct roots_output *output;
- wl_list_for_each(output, &input->server->desktop->outputs, link) {
- wlr_output_set_cursor_surface(output->wlr_output, surface,
- hotspot_x, hotspot_y);
- }
+ wlr_cursor_set_image(input->cursor, image->buffer, image->width,
+ image->width, image->height, image->hotspot_x, image->hotspot_y);
}
void view_begin_move(struct roots_input *input, struct wlr_cursor *cursor,
@@ -487,7 +471,8 @@ static void handle_request_set_cursor(struct wl_listener *listener,
}
wlr_log(L_DEBUG, "Setting client cursor");
- cursor_set_surface(input, event->surface, event->hotspot_x, event->hotspot_y);
+ wlr_cursor_set_surface(input->cursor, event->surface, event->hotspot_x,
+ event->hotspot_y);
input->cursor_client = event->seat_client->client;
}
diff --git a/rootston/input.c b/rootston/input.c
index a6792bdb..8109d2b6 100644
--- a/rootston/input.c
+++ b/rootston/input.c
@@ -118,7 +118,10 @@ struct roots_input *input_create(struct roots_server *server,
input->cursor = wlr_cursor_create();
cursor_initialize(input);
- wlr_cursor_set_xcursor(input->cursor, xcursor);
+
+ struct wlr_xcursor_image *image = xcursor->images[0];
+ wlr_cursor_set_image(input->cursor, image->buffer, image->width,
+ image->width, image->height, image->hotspot_x, image->hotspot_y);
wlr_cursor_attach_output_layout(input->cursor, server->desktop->layout);
wlr_cursor_map_to_region(input->cursor, config->cursor.mapped_box);
diff --git a/rootston/output.c b/rootston/output.c
index 6bc28996..9e1cd4d5 100644
--- a/rootston/output.c
+++ b/rootston/output.c
@@ -186,20 +186,20 @@ static void set_mode(struct wlr_output *output, struct output_config *oc) {
}
void output_add_notify(struct wl_listener *listener, void *data) {
+ struct roots_desktop *desktop = wl_container_of(listener, desktop,
+ output_add);
struct wlr_output *wlr_output = data;
- struct roots_desktop *desktop = wl_container_of(listener, desktop, output_add);
struct roots_input *input = desktop->server->input;
struct roots_config *config = desktop->config;
wlr_log(L_DEBUG, "Output '%s' added", wlr_output->name);
- wlr_log(L_DEBUG, "%s %s %"PRId32"mm x %"PRId32"mm",
- wlr_output->make, wlr_output->model,
- wlr_output->phys_width, wlr_output->phys_height);
- if (wl_list_length(&wlr_output->modes) > 0) {
- struct wlr_output_mode *mode = NULL;
- mode = wl_container_of((&wlr_output->modes)->prev, mode, link);
- wlr_output_set_mode(wlr_output, mode);
- }
+ wlr_log(L_DEBUG, "%s %s %"PRId32"mm x %"PRId32"mm", wlr_output->make,
+ wlr_output->model, wlr_output->phys_width, wlr_output->phys_height);
+ if (wl_list_length(&wlr_output->modes) > 0) {
+ struct wlr_output_mode *mode = NULL;
+ mode = wl_container_of((&wlr_output->modes)->prev, mode, link);
+ wlr_output_set_mode(wlr_output, mode);
+ }
struct roots_output *output = calloc(1, sizeof(struct roots_output));
clock_gettime(CLOCK_MONOTONIC, &output->last_frame);
@@ -225,14 +225,8 @@ void output_add_notify(struct wl_listener *listener, void *data) {
struct wlr_xcursor *xcursor = get_default_xcursor(input->xcursor_theme);
struct wlr_xcursor_image *image = xcursor->images[0];
- // TODO the cursor must be set depending on which surface it is displayed
- // over which should happen in the compositor.
- if (!wlr_output_set_cursor(wlr_output, image->buffer,
- image->width, image->width, image->height,
- image->hotspot_x, image->hotspot_y)) {
- wlr_log(L_DEBUG, "Failed to set hardware cursor");
- return;
- }
+ wlr_cursor_set_image(input->cursor, image->buffer, image->width,
+ image->width, image->height, image->hotspot_x, image->hotspot_y);
wlr_cursor_warp(input->cursor, NULL, input->cursor->x, input->cursor->y);
}