fix build for latest api

This commit is contained in:
Tony Crisci 2018-02-14 15:08:10 -05:00
commit 083e11ac7c
8 changed files with 51 additions and 47 deletions

View file

@ -16,6 +16,7 @@ struct sway_input_device {
struct wlr_input_device *wlr_device;
struct input_config *config;
struct wl_list link;
struct wl_listener device_destroy;
};
struct sway_input_manager {

View file

@ -14,6 +14,7 @@ struct sway_output {
struct timespec last_frame;
struct wl_listener frame;
struct wl_listener output_destroy;
};
#endif

View file

@ -24,8 +24,7 @@ struct sway_server {
struct sway_input_manager *input;
struct wl_listener output_add;
struct wl_listener output_remove;
struct wl_listener new_output;
struct wl_listener output_frame;
struct wlr_xdg_shell_v6 *xdg_shell_v6;
@ -45,8 +44,8 @@ bool server_init(struct sway_server *server);
void server_fini(struct sway_server *server);
void server_run(struct sway_server *server);
void output_add_notify(struct wl_listener *listener, void *data);
void output_remove_notify(struct wl_listener *listener, void *data);
void handle_new_output(struct wl_listener *listener, void *data);
void handle_output_destroy(struct wl_listener *listener, void *data);
void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data);
void handle_xwayland_surface(struct wl_listener *listener, void *data);

View file

@ -216,11 +216,12 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
struct sway_output *soutput = wl_container_of(listener, soutput, frame);
struct wlr_output *wlr_output = data;
struct sway_server *server = soutput->server;
float clear_color[] = {0.25f, 0.25f, 0.25f, 1.0f};
struct wlr_renderer *renderer = wlr_backend_get_renderer(wlr_output->backend);
wlr_renderer_clear(renderer, &clear_color);
wlr_renderer_clear(renderer, &clear_color);
int buffer_age = -1;
wlr_output_make_current(wlr_output, &buffer_age);
wlr_renderer_begin(server->renderer, wlr_output);
@ -254,8 +255,8 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
soutput->last_frame = now;
}
void output_add_notify(struct wl_listener *listener, void *data) {
struct sway_server *server = wl_container_of(listener, server, output_add);
void handle_new_output(struct wl_listener *listener, void *data) {
struct sway_server *server = wl_container_of(listener, server, new_output);
struct wlr_output *wlr_output = data;
wlr_log(L_DEBUG, "New output %p: %s", wlr_output, wlr_output->name);
@ -280,12 +281,14 @@ void output_add_notify(struct wl_listener *listener, void *data) {
sway_input_manager_configure_xcursor(input_manager);
output->frame.notify = output_frame_notify;
wl_signal_add(&wlr_output->events.frame, &output->frame);
output->frame.notify = output_frame_notify;
wl_signal_add(&wlr_output->events.destroy, &output->output_destroy);
output->output_destroy.notify = handle_output_destroy;
}
void output_remove_notify(struct wl_listener *listener, void *data) {
struct sway_server *server = wl_container_of(listener, server, output_remove);
void handle_output_destroy(struct wl_listener *listener, void *data) {
struct wlr_output *wlr_output = data;
wlr_log(L_DEBUG, "Output %p %s removed", wlr_output, wlr_output->name);

View file

@ -160,7 +160,32 @@ static void sway_input_manager_libinput_config_pointer(struct sway_input_device
}
}
static void input_add_notify(struct wl_listener *listener, void *data) {
static void handle_device_destroy(struct wl_listener *listener, void *data) {
struct wlr_input_device *device = data;
struct sway_input_device *input_device =
input_sway_device_from_wlr(input_manager, device);
if (!sway_assert(input_device, "could not find sway device")) {
return;
}
wlr_log(L_DEBUG, "removing device: '%s'",
input_device->identifier);
struct sway_seat *seat = NULL;
wl_list_for_each(seat, &input_manager->seats, link) {
sway_seat_remove_device(seat, input_device);
}
wl_list_remove(&input_device->link);
wl_list_remove(&input_device->device_destroy.link);
free_input_config(input_device->config);
free(input_device->identifier);
free(input_device);
}
static void handle_new_input(struct wl_listener *listener, void *data) {
struct sway_input_manager *input =
wl_container_of(listener, input, input_add);
struct wlr_input_device *device = data;
@ -226,32 +251,9 @@ static void input_add_notify(struct wl_listener *listener, void *data) {
"device '%s' is not configured on any seats",
input_device->identifier);
}
}
static void input_remove_notify(struct wl_listener *listener, void *data) {
struct sway_input_manager *input =
wl_container_of(listener, input, input_remove);
struct wlr_input_device *device = data;
struct sway_input_device *input_device =
input_sway_device_from_wlr(input, device);
if (!sway_assert(input_device, "could not find sway device")) {
return;
}
wlr_log(L_DEBUG, "removing device: '%s'",
input_device->identifier);
struct sway_seat *seat = NULL;
wl_list_for_each(seat, &input->seats, link) {
sway_seat_remove_device(seat, input_device);
}
wl_list_remove(&input_device->link);
free_input_config(input_device->config);
free(input_device->identifier);
free(input_device);
wl_signal_add(&device->events.destroy, &input_device->device_destroy);
input_device->device_destroy.notify = handle_device_destroy;
}
struct sway_input_manager *sway_input_manager_create(
@ -269,11 +271,8 @@ struct sway_input_manager *sway_input_manager_create(
// create the default seat
input_manager_get_seat(input, default_seat);
input->input_add.notify = input_add_notify;
wl_signal_add(&server->backend->events.input_add, &input->input_add);
input->input_remove.notify = input_remove_notify;
wl_signal_add(&server->backend->events.input_remove, &input->input_remove);
input->input_add.notify = handle_new_input;
wl_signal_add(&server->backend->events.new_input, &input->input_add);
return input;
}

View file

@ -48,12 +48,8 @@ bool server_init(struct sway_server *server) {
server->data_device_manager =
wlr_data_device_manager_create(server->wl_display);
server->output_add.notify = output_add_notify;
wl_signal_add(&server->backend->events.output_add, &server->output_add);
server->output_remove.notify = output_remove_notify;
wl_signal_add(&server->backend->events.output_remove,
&server->output_remove);
server->new_output.notify = handle_new_output;
wl_signal_add(&server->backend->events.new_output, &server->new_output);
server->xdg_shell_v6 = wlr_xdg_shell_v6_create(server->wl_display);
wl_signal_add(&server->xdg_shell_v6->events.new_surface,

View file

@ -236,6 +236,8 @@ swayc_t *destroy_output(swayc_t *output) {
}
}
wl_list_remove(&output->sway_output->output_destroy.link);
wlr_log(L_DEBUG, "OUTPUT: Destroying output '%s'", output->name);
free_swayc(output);

View file

@ -461,6 +461,8 @@ static swayc_t *get_swayc_in_direction_under(swayc_t *container,
int desired;
int idx = index_child(container);
if (parent->type == C_ROOT) {
// TODO
/*
struct wlr_output_layout *layout = root_container.sway_root->output_layout;
wlr_output_layout_adjacent_output(layout, container->sway_output->wlr_output);
//swayc_t *output = swayc_adjacent_output(container, dir, &abs_pos, true);
@ -469,6 +471,7 @@ static swayc_t *get_swayc_in_direction_under(swayc_t *container,
}
wlr_log(L_DEBUG, "Moving between outputs");
return get_swayc_in_output_direction(output, dir, seat);
*/
} else {
if (dir == MOVE_LEFT || dir == MOVE_RIGHT) {
if (parent->layout == L_HORIZ || parent->layout == L_TABBED) {