Fix rootston

This commit is contained in:
emersion 2017-10-29 10:39:47 +01:00
parent 1b6c729360
commit c45f2eef0e
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
3 changed files with 22 additions and 51 deletions

View File

@ -93,8 +93,6 @@ static void handle_output_frame(struct output_state *output,
static void handle_output_add(struct output_state *ostate) { static void handle_output_add(struct output_state *ostate) {
struct sample_state *sample = ostate->compositor->data; struct sample_state *sample = ostate->compositor->data;
struct wlr_output *wlr_output = ostate->output;
struct wlr_xcursor_image *image = sample->xcursor->images[0];
struct output_config *o_config = struct output_config *o_config =
example_config_get_output(sample->config, ostate->output); example_config_get_output(sample->config, ostate->output);
@ -112,12 +110,9 @@ static void handle_output_add(struct output_state *ostate) {
// TODO the cursor must be set depending on which surface it is displayed // TODO the cursor must be set depending on which surface it is displayed
// over which should happen in the compositor. // over which should happen in the compositor.
if (!wlr_output_set_cursor(wlr_output, image->buffer, struct wlr_xcursor_image *image = sample->xcursor->images[0];
image->width, image->width, image->height, wlr_cursor_set_image(sample->cursor, image->buffer, image->width,
image->hotspot_x, image->hotspot_y)) { image->width, image->height, image->hotspot_x, image->hotspot_y);
wlr_log(L_DEBUG, "Failed to set hardware cursor");
return;
}
wlr_cursor_warp(sample->cursor, NULL, sample->cursor->x, sample->cursor->y); wlr_cursor_warp(sample->cursor, NULL, sample->cursor->x, sample->cursor->y);
} }
@ -162,13 +157,8 @@ static void handle_cursor_motion_absolute(struct wl_listener *listener,
sample->cur_y = event->y_mm; sample->cur_y = event->y_mm;
struct wlr_xcursor_image *image = sample->xcursor->images[0]; struct wlr_xcursor_image *image = sample->xcursor->images[0];
wlr_cursor_warp_absolute(sample->cursor, event->device,
struct output_state *output; sample->cur_x - image->hotspot_x, sample->cur_y - image->hotspot_y);
wl_list_for_each(output, &sample->compositor->outputs, link) {
wlr_output_move_cursor(output->output,
sample->cur_x - image->hotspot_x,
sample->cur_y - image->hotspot_y);
}
} }
static void handle_cursor_button(struct wl_listener *listener, void *data) { static void handle_cursor_button(struct wl_listener *listener, void *data) {

View File

@ -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, static void cursor_set_xcursor_image(struct roots_input *input,
struct wlr_xcursor_image *image) { struct wlr_xcursor_image *image) {
struct roots_output *output; wlr_cursor_set_image(input->cursor, image->buffer, image->width,
wl_list_for_each(output, &input->server->desktop->outputs, link) { image->width, image->height, image->hotspot_x, image->hotspot_y);
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);
}
} }
void view_begin_move(struct roots_input *input, struct wlr_cursor *cursor, 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"); 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; input->cursor_client = event->seat_client->client;
} }

View File

@ -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) { 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 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_input *input = desktop->server->input;
struct roots_config *config = desktop->config; struct roots_config *config = desktop->config;
wlr_log(L_DEBUG, "Output '%s' added", wlr_output->name); wlr_log(L_DEBUG, "Output '%s' added", wlr_output->name);
wlr_log(L_DEBUG, "%s %s %"PRId32"mm x %"PRId32"mm", wlr_log(L_DEBUG, "%s %s %"PRId32"mm x %"PRId32"mm", wlr_output->make,
wlr_output->make, wlr_output->model, wlr_output->model, wlr_output->phys_width, wlr_output->phys_height);
wlr_output->phys_width, wlr_output->phys_height); if (wl_list_length(&wlr_output->modes) > 0) {
if (wl_list_length(&wlr_output->modes) > 0) { struct wlr_output_mode *mode = NULL;
struct wlr_output_mode *mode = NULL; mode = wl_container_of((&wlr_output->modes)->prev, mode, link);
mode = wl_container_of((&wlr_output->modes)->prev, mode, link); wlr_output_set_mode(wlr_output, mode);
wlr_output_set_mode(wlr_output, mode); }
}
struct roots_output *output = calloc(1, sizeof(struct roots_output)); struct roots_output *output = calloc(1, sizeof(struct roots_output));
clock_gettime(CLOCK_MONOTONIC, &output->last_frame); clock_gettime(CLOCK_MONOTONIC, &output->last_frame);
@ -223,16 +223,12 @@ void output_add_notify(struct wl_listener *listener, void *data) {
cursor_load_config(config, input->cursor, input, desktop); cursor_load_config(config, input->cursor, input, desktop);
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 // TODO the cursor must be set depending on which surface it is displayed
// over which should happen in the compositor. // over which should happen in the compositor.
if (!wlr_output_set_cursor(wlr_output, image->buffer, struct wlr_xcursor *xcursor = get_default_xcursor(input->xcursor_theme);
image->width, image->width, image->height, struct wlr_xcursor_image *image = xcursor->images[0];
image->hotspot_x, image->hotspot_y)) { wlr_cursor_set_image(input->cursor, image->buffer, image->width,
wlr_log(L_DEBUG, "Failed to set hardware cursor"); image->width, image->height, image->hotspot_x, image->hotspot_y);
return;
}
wlr_cursor_warp(input->cursor, NULL, input->cursor->x, input->cursor->y); wlr_cursor_warp(input->cursor, NULL, input->cursor->x, input->cursor->y);
} }