mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-02 09:01:38 -05:00
Remove wl_list_init when using wl_signal_add
This commit is contained in:
parent
1782d5e7b7
commit
c8570d0e42
13 changed files with 17 additions and 84 deletions
|
|
@ -393,51 +393,41 @@ static void handle_request_set_cursor(struct wl_listener *listener,
|
|||
|
||||
void cursor_initialize(struct roots_input *input) {
|
||||
struct wlr_cursor *cursor = input->cursor;
|
||||
|
||||
|
||||
// TODO: Does this belong here
|
||||
wl_list_init(&input->touch_points);
|
||||
|
||||
wl_list_init(&input->cursor_motion.link);
|
||||
wl_signal_add(&cursor->events.motion, &input->cursor_motion);
|
||||
input->cursor_motion.notify = handle_cursor_motion;
|
||||
|
||||
wl_list_init(&input->cursor_motion_absolute.link);
|
||||
wl_signal_add(&cursor->events.motion_absolute,
|
||||
&input->cursor_motion_absolute);
|
||||
input->cursor_motion_absolute.notify = handle_cursor_motion_absolute;
|
||||
|
||||
wl_list_init(&input->cursor_button.link);
|
||||
wl_signal_add(&cursor->events.button, &input->cursor_button);
|
||||
input->cursor_button.notify = handle_cursor_button;
|
||||
|
||||
wl_list_init(&input->cursor_axis.link);
|
||||
wl_signal_add(&cursor->events.axis, &input->cursor_axis);
|
||||
input->cursor_axis.notify = handle_cursor_axis;
|
||||
|
||||
wl_list_init(&input->cursor_touch_down.link);
|
||||
wl_signal_add(&cursor->events.touch_down, &input->cursor_touch_down);
|
||||
input->cursor_touch_down.notify = handle_touch_down;
|
||||
|
||||
wl_list_init(&input->cursor_touch_up.link);
|
||||
wl_signal_add(&cursor->events.touch_up, &input->cursor_touch_up);
|
||||
input->cursor_touch_up.notify = handle_touch_up;
|
||||
|
||||
wl_list_init(&input->cursor_touch_motion.link);
|
||||
wl_signal_add(&cursor->events.touch_motion, &input->cursor_touch_motion);
|
||||
input->cursor_touch_motion.notify = handle_touch_motion;
|
||||
|
||||
wl_list_init(&input->cursor_tool_axis.link);
|
||||
wl_signal_add(&cursor->events.tablet_tool_axis, &input->cursor_tool_axis);
|
||||
input->cursor_tool_axis.notify = handle_tool_axis;
|
||||
|
||||
wl_list_init(&input->cursor_tool_tip.link);
|
||||
wl_signal_add(&cursor->events.tablet_tool_tip, &input->cursor_tool_tip);
|
||||
input->cursor_tool_tip.notify = handle_tool_tip;
|
||||
|
||||
wl_signal_add(&input->wl_seat->events.pointer_grab_end, &input->pointer_grab_end);
|
||||
input->pointer_grab_end.notify = handle_pointer_grab_end;
|
||||
|
||||
wl_list_init(&input->request_set_cursor.link);
|
||||
wl_signal_add(&input->wl_seat->events.request_set_cursor,
|
||||
&input->request_set_cursor);
|
||||
input->request_set_cursor.notify = handle_request_set_cursor;
|
||||
|
|
|
|||
|
|
@ -203,16 +203,15 @@ struct roots_view *view_at(struct roots_desktop *desktop, double lx, double ly,
|
|||
struct roots_desktop *desktop_create(struct roots_server *server,
|
||||
struct roots_config *config) {
|
||||
struct roots_desktop *desktop = calloc(1, sizeof(struct roots_desktop));
|
||||
assert(desktop);
|
||||
wlr_log(L_DEBUG, "Initializing roots desktop");
|
||||
|
||||
assert(desktop->views = list_create());
|
||||
wl_list_init(&desktop->outputs);
|
||||
wl_list_init(&desktop->output_add.link);
|
||||
desktop->output_add.notify = output_add_notify;
|
||||
wl_list_init(&desktop->output_remove.link);
|
||||
desktop->output_remove.notify = output_remove_notify;
|
||||
|
||||
desktop->output_add.notify = output_add_notify;
|
||||
wl_signal_add(&server->backend->events.output_add, &desktop->output_add);
|
||||
desktop->output_remove.notify = output_remove_notify;
|
||||
wl_signal_add(&server->backend->events.output_remove,
|
||||
&desktop->output_remove);
|
||||
|
||||
|
|
|
|||
|
|
@ -91,15 +91,10 @@ struct roots_input *input_create(struct roots_server *server,
|
|||
wl_list_init(&input->touch);
|
||||
wl_list_init(&input->tablet_tools);
|
||||
|
||||
wl_list_init(&input->input_add.link);
|
||||
input->input_add.notify = input_add_notify;
|
||||
wl_list_init(&input->input_remove.link);
|
||||
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_add,
|
||||
&input->input_add);
|
||||
wl_signal_add(&server->backend->events.input_remove,
|
||||
&input->input_remove);
|
||||
wl_signal_add(&server->backend->events.input_remove, &input->input_remove);
|
||||
|
||||
input->cursor = wlr_cursor_create();
|
||||
cursor_initialize(input);
|
||||
|
|
|
|||
|
|
@ -130,7 +130,6 @@ void keyboard_add(struct wlr_input_device *device, struct roots_input *input) {
|
|||
device->data = keyboard;
|
||||
keyboard->device = device;
|
||||
keyboard->input = input;
|
||||
wl_list_init(&keyboard->key.link);
|
||||
keyboard->key.notify = keyboard_key_notify;
|
||||
wl_signal_add(&device->keyboard->events.key, &keyboard->key);
|
||||
wl_list_insert(&input->keyboards, &keyboard->link);
|
||||
|
|
|
|||
|
|
@ -175,7 +175,6 @@ void output_add_notify(struct wl_listener *listener, void *data) {
|
|||
output->desktop = desktop;
|
||||
output->wlr_output = wlr_output;
|
||||
output->frame.notify = output_frame_notify;
|
||||
wl_list_init(&output->frame.link);
|
||||
wl_signal_add(&wlr_output->events.frame, &output->frame);
|
||||
wl_list_insert(&desktop->outputs, &output->link);
|
||||
|
||||
|
|
|
|||
|
|
@ -57,11 +57,8 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
|
|||
struct roots_wl_shell_surface *roots_surface =
|
||||
wl_container_of(listener, roots_surface, destroy);
|
||||
wl_list_remove(&roots_surface->destroy.link);
|
||||
wl_list_remove(&roots_surface->ping_timeout.link);
|
||||
wl_list_remove(&roots_surface->request_move.link);
|
||||
wl_list_remove(&roots_surface->request_resize.link);
|
||||
wl_list_remove(&roots_surface->request_set_fullscreen.link);
|
||||
wl_list_remove(&roots_surface->request_set_maximized.link);
|
||||
view_destroy(roots_surface->view);
|
||||
free(roots_surface);
|
||||
}
|
||||
|
|
@ -88,25 +85,22 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
|
|||
if (!roots_surface) {
|
||||
return;
|
||||
}
|
||||
wl_list_init(&roots_surface->destroy.link);
|
||||
roots_surface->destroy.notify = handle_destroy;
|
||||
wl_signal_add(&surface->events.destroy, &roots_surface->destroy);
|
||||
wl_list_init(&roots_surface->ping_timeout.link);
|
||||
wl_list_init(&roots_surface->request_move.link);
|
||||
roots_surface->request_move.notify = handle_request_move;
|
||||
wl_signal_add(&surface->events.request_move, &roots_surface->request_move);
|
||||
wl_list_init(&roots_surface->request_resize.link);
|
||||
roots_surface->request_resize.notify = handle_request_resize;
|
||||
wl_signal_add(&surface->events.request_resize,
|
||||
&roots_surface->request_resize);
|
||||
wl_list_init(&roots_surface->request_set_fullscreen.link);
|
||||
wl_list_init(&roots_surface->request_set_maximized.link);
|
||||
wl_list_init(&roots_surface->surface_commit.link);
|
||||
roots_surface->surface_commit.notify = handle_surface_commit;
|
||||
wl_signal_add(&surface->surface->events.commit,
|
||||
&roots_surface->surface_commit);
|
||||
|
||||
struct roots_view *view = calloc(1, sizeof(struct roots_view));
|
||||
if (!view) {
|
||||
free(roots_surface);
|
||||
return;
|
||||
}
|
||||
view->type = ROOTS_WL_SHELL_VIEW;
|
||||
|
||||
view->wl_shell_surface = surface;
|
||||
|
|
@ -121,9 +115,8 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
|
|||
|
||||
if (surface->state == WLR_WL_SHELL_SURFACE_STATE_TRANSIENT) {
|
||||
// we need to map it relative to the parent
|
||||
int i =
|
||||
list_seq_find(desktop->views,
|
||||
shell_surface_compare_equals, surface->parent);
|
||||
int i = list_seq_find(desktop->views, shell_surface_compare_equals,
|
||||
surface->parent);
|
||||
if (i != -1) {
|
||||
struct roots_view *parent = desktop->views->items[i];
|
||||
view_set_position(view,
|
||||
|
|
|
|||
|
|
@ -74,12 +74,10 @@ static void handle_commit(struct wl_listener *listener, void *data) {
|
|||
static void handle_destroy(struct wl_listener *listener, void *data) {
|
||||
struct roots_xdg_surface_v6 *roots_xdg_surface =
|
||||
wl_container_of(listener, roots_xdg_surface, destroy);
|
||||
wl_list_remove(&roots_xdg_surface->commit.link);
|
||||
wl_list_remove(&roots_xdg_surface->destroy.link);
|
||||
wl_list_remove(&roots_xdg_surface->ping_timeout.link);
|
||||
wl_list_remove(&roots_xdg_surface->request_move.link);
|
||||
wl_list_remove(&roots_xdg_surface->request_resize.link);
|
||||
wl_list_remove(&roots_xdg_surface->request_show_window_menu.link);
|
||||
wl_list_remove(&roots_xdg_surface->request_minimize.link);
|
||||
view_destroy(roots_xdg_surface->view);
|
||||
free(roots_xdg_surface);
|
||||
}
|
||||
|
|
@ -105,22 +103,15 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
|
|||
if (!roots_surface) {
|
||||
return;
|
||||
}
|
||||
wl_list_init(&roots_surface->commit.link);
|
||||
roots_surface->commit.notify = handle_commit;
|
||||
wl_signal_add(&surface->events.commit, &roots_surface->commit);
|
||||
wl_list_init(&roots_surface->destroy.link);
|
||||
roots_surface->destroy.notify = handle_destroy;
|
||||
wl_signal_add(&surface->events.destroy, &roots_surface->destroy);
|
||||
wl_list_init(&roots_surface->ping_timeout.link);
|
||||
wl_list_init(&roots_surface->request_minimize.link);
|
||||
wl_list_init(&roots_surface->request_move.link);
|
||||
roots_surface->request_move.notify = handle_request_move;
|
||||
wl_signal_add(&surface->events.request_move, &roots_surface->request_move);
|
||||
wl_list_init(&roots_surface->request_resize.link);
|
||||
roots_surface->request_resize.notify = handle_request_resize;
|
||||
wl_signal_add(&surface->events.request_resize,
|
||||
&roots_surface->request_resize);
|
||||
wl_list_init(&roots_surface->request_show_window_menu.link);
|
||||
|
||||
struct roots_view *view = calloc(1, sizeof(struct roots_view));
|
||||
view->type = ROOTS_XDG_SHELL_V6_VIEW;
|
||||
|
|
|
|||
|
|
@ -75,10 +75,8 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
|
|||
if (roots_surface == NULL) {
|
||||
return;
|
||||
}
|
||||
wl_list_init(&roots_surface->destroy.link);
|
||||
roots_surface->destroy.notify = handle_destroy;
|
||||
wl_signal_add(&surface->events.destroy, &roots_surface->destroy);
|
||||
wl_list_init(&roots_surface->request_configure.link);
|
||||
roots_surface->request_configure.notify = handle_request_configure;
|
||||
wl_signal_add(&surface->events.request_configure,
|
||||
&roots_surface->request_configure);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue