From 5e58d46cc1a90810e3ee76203cee8ca2f14fb462 Mon Sep 17 00:00:00 2001 From: emersion Date: Mon, 12 Feb 2018 09:12:31 +0100 Subject: Add wlr_signal_emit_safe --- backend/multi/backend.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'backend/multi') diff --git a/backend/multi/backend.c b/backend/multi/backend.c index 78f5c63b..14f774d0 100644 --- a/backend/multi/backend.c +++ b/backend/multi/backend.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "backend/multi.h" #include "backend/drm/drm.h" @@ -51,7 +52,7 @@ static void multi_backend_destroy(struct wlr_backend *wlr_backend) { } // Destroy this backend only after removing all sub-backends - wl_signal_emit(&wlr_backend->events.destroy, backend); + wlr_signal_emit_safe(&wlr_backend->events.destroy, backend); free(backend); } @@ -120,25 +121,25 @@ bool wlr_backend_is_multi(struct wlr_backend *b) { static void input_add_reemit(struct wl_listener *listener, void *data) { struct subbackend_state *state = wl_container_of(listener, state, input_add); - wl_signal_emit(&state->container->events.input_add, data); + wlr_signal_emit_safe(&state->container->events.input_add, data); } static void input_remove_reemit(struct wl_listener *listener, void *data) { struct subbackend_state *state = wl_container_of(listener, state, input_remove); - wl_signal_emit(&state->container->events.input_remove, data); + wlr_signal_emit_safe(&state->container->events.input_remove, data); } static void output_add_reemit(struct wl_listener *listener, void *data) { struct subbackend_state *state = wl_container_of(listener, state, output_add); - wl_signal_emit(&state->container->events.output_add, data); + wlr_signal_emit_safe(&state->container->events.output_add, data); } static void output_remove_reemit(struct wl_listener *listener, void *data) { struct subbackend_state *state = wl_container_of(listener, state, output_remove); - wl_signal_emit(&state->container->events.output_remove, data); + wlr_signal_emit_safe(&state->container->events.output_remove, data); } static void handle_subbackend_destroy(struct wl_listener *listener, @@ -194,7 +195,7 @@ void wlr_multi_backend_add(struct wlr_backend *_multi, wl_signal_add(&backend->events.output_remove, &sub->output_remove); sub->output_remove.notify = output_remove_reemit; - wl_signal_emit(&multi->events.backend_add, backend); + wlr_signal_emit_safe(&multi->events.backend_add, backend); } void wlr_multi_backend_remove(struct wlr_backend *_multi, @@ -206,7 +207,7 @@ void wlr_multi_backend_remove(struct wlr_backend *_multi, multi_backend_get_subbackend(multi, backend); if (sub) { - wl_signal_emit(&multi->events.backend_remove, backend); + wlr_signal_emit_safe(&multi->events.backend_remove, backend); subbackend_state_destroy(sub); } } -- cgit v1.2.3 From 10ecf871f27ddd7170b6fb9ee7bd055b9cb3423c Mon Sep 17 00:00:00 2001 From: emersion Date: Mon, 12 Feb 2018 10:36:43 +0100 Subject: Remove wlr_backend.events.{output_remove,device_remove} --- backend/backend.c | 6 +- backend/drm/drm.c | 9 +- backend/headless/backend.c | 4 +- backend/headless/input_device.c | 3 +- backend/headless/output.c | 2 +- backend/libinput/backend.c | 1 - backend/libinput/events.c | 11 +- backend/multi/backend.c | 61 +++------ backend/wayland/output.c | 2 +- backend/wayland/wl_seat.c | 9 +- backend/x11/backend.c | 10 +- examples/support/shared.c | 274 ++++++++++++++++------------------------ examples/support/shared.h | 12 +- include/rootston/desktop.h | 3 +- include/rootston/input.h | 3 +- include/rootston/keyboard.h | 1 + include/rootston/output.h | 4 +- include/rootston/seat.h | 3 + include/wlr/backend.h | 6 +- rootston/desktop.c | 7 +- rootston/input.c | 20 +-- rootston/output.c | 47 +++---- rootston/seat.c | 145 ++++++++++----------- types/wlr_input_device.c | 1 - types/wlr_output.c | 1 - 25 files changed, 263 insertions(+), 382 deletions(-) (limited to 'backend/multi') diff --git a/backend/backend.c b/backend/backend.c index 98b94c5c..aec5781e 100644 --- a/backend/backend.c +++ b/backend/backend.c @@ -19,10 +19,8 @@ void wlr_backend_init(struct wlr_backend *backend, assert(backend); backend->impl = impl; wl_signal_init(&backend->events.destroy); - wl_signal_init(&backend->events.input_add); - wl_signal_init(&backend->events.input_remove); - wl_signal_init(&backend->events.output_add); - wl_signal_init(&backend->events.output_remove); + wl_signal_init(&backend->events.new_input); + wl_signal_init(&backend->events.new_output); } bool wlr_backend_start(struct wlr_backend *backend) { diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 516eb405..7af242bc 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -871,7 +871,8 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) { wlr_conn->state = WLR_DRM_CONN_NEEDS_MODESET; wlr_log(L_INFO, "Sending modesetting signal for '%s'", wlr_conn->output.name); - wlr_signal_emit_safe(&drm->backend.events.output_add, &wlr_conn->output); + wlr_signal_emit_safe(&drm->backend.events.new_output, + &wlr_conn->output); } else if (wlr_conn->state == WLR_DRM_CONN_CONNECTED && drm_conn->connection != DRM_MODE_CONNECTED) { wlr_log(L_INFO, "'%s' disconnected", wlr_conn->output.name); @@ -979,8 +980,6 @@ void wlr_drm_connector_cleanup(struct wlr_drm_connector *conn) { return; } - struct wlr_drm_backend *drm = (struct wlr_drm_backend *)conn->output.backend; - switch (conn->state) { case WLR_DRM_CONN_CONNECTED: case WLR_DRM_CONN_CLEANUP:; @@ -1014,8 +1013,8 @@ void wlr_drm_connector_cleanup(struct wlr_drm_connector *conn) { /* Fallthrough */ case WLR_DRM_CONN_NEEDS_MODESET: wlr_log(L_INFO, "Emitting destruction signal for '%s'", - conn->output.name); - wlr_signal_emit_safe(&drm->backend.events.output_remove, &conn->output); + conn->output.name); + wlr_signal_emit_safe(&conn->output.events.destroy, &conn->output); break; case WLR_DRM_CONN_DISCONNECTED: break; diff --git a/backend/headless/backend.c b/backend/headless/backend.c index 7832b00c..703dc8cd 100644 --- a/backend/headless/backend.c +++ b/backend/headless/backend.c @@ -17,14 +17,14 @@ static bool backend_start(struct wlr_backend *wlr_backend) { wl_list_for_each(output, &backend->outputs, link) { wl_event_source_timer_update(output->frame_timer, output->frame_delay); wlr_output_update_enabled(&output->wlr_output, true); - wlr_signal_emit_safe(&backend->backend.events.output_add, + wlr_signal_emit_safe(&backend->backend.events.new_output, &output->wlr_output); } struct wlr_headless_input_device *input_device; wl_list_for_each(input_device, &backend->input_devices, wlr_input_device.link) { - wlr_signal_emit_safe(&backend->backend.events.input_add, + wlr_signal_emit_safe(&backend->backend.events.new_input, &input_device->wlr_input_device); } diff --git a/backend/headless/input_device.c b/backend/headless/input_device.c index 68e7ce24..6b2bc4e7 100644 --- a/backend/headless/input_device.c +++ b/backend/headless/input_device.c @@ -12,7 +12,6 @@ static void input_device_destroy(struct wlr_input_device *wlr_dev) { struct wlr_headless_input_device *device = (struct wlr_headless_input_device *)wlr_dev; - wlr_signal_emit_safe(&device->backend->backend.events.input_remove, wlr_dev); free(device); } @@ -89,7 +88,7 @@ struct wlr_input_device *wlr_headless_add_input_device( wl_list_insert(&backend->input_devices, &wlr_device->link); if (backend->started) { - wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_device); + wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_device); } return wlr_device; diff --git a/backend/headless/output.c b/backend/headless/output.c index eab983cc..f31b7d37 100644 --- a/backend/headless/output.c +++ b/backend/headless/output.c @@ -137,7 +137,7 @@ struct wlr_output *wlr_headless_add_output(struct wlr_backend *wlr_backend, if (backend->started) { wl_event_source_timer_update(output->frame_timer, output->frame_delay); wlr_output_update_enabled(wlr_output, true); - wlr_signal_emit_safe(&backend->backend.events.output_add, wlr_output); + wlr_signal_emit_safe(&backend->backend.events.new_output, wlr_output); } return wlr_output; diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index dfbe1d20..5b815a0c 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -107,7 +107,6 @@ static void wlr_libinput_backend_destroy(struct wlr_backend *wlr_backend) { struct wl_list *wlr_devices = backend->wlr_device_lists.items[i]; struct wlr_input_device *wlr_dev, *next; wl_list_for_each_safe(wlr_dev, next, wlr_devices, link) { - wlr_signal_emit_safe(&backend->backend.events.input_remove, wlr_dev); wlr_input_device_destroy(wlr_dev); } free(wlr_devices); diff --git a/backend/libinput/events.c b/backend/libinput/events.c index 60088a40..4bcfa539 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -89,7 +89,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, free(wlr_dev); goto fail; } - wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_dev); + wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_dev); } if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_POINTER)) { struct wlr_input_device *wlr_dev = allocate_device(backend, @@ -102,7 +102,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, free(wlr_dev); goto fail; } - wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_dev); + wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_dev); } if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_TOUCH)) { struct wlr_input_device *wlr_dev = allocate_device(backend, @@ -115,7 +115,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, free(wlr_dev); goto fail; } - wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_dev); + wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_dev); } if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_TABLET_TOOL)) { struct wlr_input_device *wlr_dev = allocate_device(backend, @@ -128,7 +128,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, free(wlr_dev); goto fail; } - wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_dev); + wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_dev); } if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_TABLET_PAD)) { struct wlr_input_device *wlr_dev = allocate_device(backend, @@ -141,7 +141,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, free(wlr_dev); goto fail; } - wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_dev); + wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_dev); } if (libinput_device_has_capability(libinput_dev, LIBINPUT_DEVICE_CAP_GESTURE)) { // TODO @@ -179,7 +179,6 @@ static void handle_device_removed(struct wlr_libinput_backend *backend, } struct wlr_input_device *dev, *tmp_dev; wl_list_for_each_safe(dev, tmp_dev, wlr_devices, link) { - wlr_signal_emit_safe(&backend->backend.events.input_remove, dev); wlr_input_device_destroy(dev); } for (size_t i = 0; i < backend->wlr_device_lists.length; i++) { diff --git a/backend/multi/backend.c b/backend/multi/backend.c index 14f774d0..02738f59 100644 --- a/backend/multi/backend.c +++ b/backend/multi/backend.c @@ -11,11 +11,9 @@ struct subbackend_state { struct wlr_backend *backend; struct wlr_backend *container; - struct wl_listener input_add; - struct wl_listener input_remove; - struct wl_listener output_add; - struct wl_listener output_remove; - struct wl_listener backend_destroy; + struct wl_listener new_input; + struct wl_listener new_output; + struct wl_listener destroy; struct wl_list link; }; @@ -32,11 +30,9 @@ static bool multi_backend_start(struct wlr_backend *wlr_backend) { } static void subbackend_state_destroy(struct subbackend_state *sub) { - wl_list_remove(&sub->input_add.link); - wl_list_remove(&sub->input_remove.link); - wl_list_remove(&sub->output_add.link); - wl_list_remove(&sub->output_remove.link); - wl_list_remove(&sub->backend_destroy.link); + wl_list_remove(&sub->new_input.link); + wl_list_remove(&sub->new_output.link); + wl_list_remove(&sub->destroy.link); wl_list_remove(&sub->link); free(sub); } @@ -118,34 +114,21 @@ bool wlr_backend_is_multi(struct wlr_backend *b) { return b->impl == &backend_impl; } -static void input_add_reemit(struct wl_listener *listener, void *data) { +static void new_input_reemit(struct wl_listener *listener, void *data) { struct subbackend_state *state = wl_container_of(listener, - state, input_add); - wlr_signal_emit_safe(&state->container->events.input_add, data); + state, new_input); + wlr_signal_emit_safe(&state->container->events.new_input, data); } -static void input_remove_reemit(struct wl_listener *listener, void *data) { +static void new_output_reemit(struct wl_listener *listener, void *data) { struct subbackend_state *state = wl_container_of(listener, - state, input_remove); - wlr_signal_emit_safe(&state->container->events.input_remove, data); -} - -static void output_add_reemit(struct wl_listener *listener, void *data) { - struct subbackend_state *state = wl_container_of(listener, - state, output_add); - wlr_signal_emit_safe(&state->container->events.output_add, data); -} - -static void output_remove_reemit(struct wl_listener *listener, void *data) { - struct subbackend_state *state = wl_container_of(listener, - state, output_remove); - wlr_signal_emit_safe(&state->container->events.output_remove, data); + state, new_output); + wlr_signal_emit_safe(&state->container->events.new_output, data); } static void handle_subbackend_destroy(struct wl_listener *listener, void *data) { - struct subbackend_state *state = wl_container_of(listener, - state, backend_destroy); + struct subbackend_state *state = wl_container_of(listener, state, destroy); subbackend_state_destroy(state); } @@ -180,20 +163,14 @@ void wlr_multi_backend_add(struct wlr_backend *_multi, sub->backend = backend; sub->container = &multi->backend; - wl_signal_add(&backend->events.destroy, &sub->backend_destroy); - sub->backend_destroy.notify = handle_subbackend_destroy; - - wl_signal_add(&backend->events.input_add, &sub->input_add); - sub->input_add.notify = input_add_reemit; - - wl_signal_add(&backend->events.input_remove, &sub->input_remove); - sub->input_remove.notify = input_remove_reemit; + wl_signal_add(&backend->events.destroy, &sub->destroy); + sub->destroy.notify = handle_subbackend_destroy; - wl_signal_add(&backend->events.output_add, &sub->output_add); - sub->output_add.notify = output_add_reemit; + wl_signal_add(&backend->events.new_input, &sub->new_input); + sub->new_input.notify = new_input_reemit; - wl_signal_add(&backend->events.output_remove, &sub->output_remove); - sub->output_remove.notify = output_remove_reemit; + wl_signal_add(&backend->events.new_output, &sub->new_output); + sub->new_output.notify = new_output_reemit; wlr_signal_emit_safe(&multi->events.backend_add, backend); } diff --git a/backend/wayland/output.c b/backend/wayland/output.c index f2336549..b1cc6836 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -339,7 +339,7 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *_backend) { wl_list_insert(&backend->outputs, &output->link); wlr_output_update_enabled(wlr_output, true); - wlr_signal_emit_safe(&backend->backend.events.output_add, wlr_output); + wlr_signal_emit_safe(&backend->backend.events.new_output, wlr_output); return wlr_output; error: diff --git a/backend/wayland/wl_seat.c b/backend/wayland/wl_seat.c index 2018f449..18114119 100644 --- a/backend/wayland/wl_seat.c +++ b/backend/wayland/wl_seat.c @@ -193,9 +193,8 @@ static struct wl_keyboard_listener keyboard_listener = { .repeat_info = keyboard_handle_repeat_info }; -static void input_device_destroy(struct wlr_input_device *_dev) { - struct wlr_wl_input_device *dev = (struct wlr_wl_input_device *)_dev; - wlr_signal_emit_safe(&dev->backend->backend.events.input_remove, &dev->wlr_input_device); +static void input_device_destroy(struct wlr_input_device *wlr_dev) { + struct wlr_wl_input_device *dev = (struct wlr_wl_input_device *)wlr_dev; if (dev->resource) { wl_proxy_destroy(dev->resource); } @@ -257,7 +256,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat, wlr_device->pointer = &wlr_wl_pointer->wlr_pointer; wlr_pointer_init(wlr_device->pointer, NULL); wlr_wl_device->resource = wl_pointer; - wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_device); + wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_device); backend->pointer = wl_pointer; } if ((caps & WL_SEAT_CAPABILITY_KEYBOARD)) { @@ -281,7 +280,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat, struct wl_keyboard *wl_keyboard = wl_seat_get_keyboard(wl_seat); wl_keyboard_add_listener(wl_keyboard, &keyboard_listener, wlr_device); wlr_wl_device->resource = wl_keyboard; - wlr_signal_emit_safe(&backend->backend.events.input_add, wlr_device); + wlr_signal_emit_safe(&backend->backend.events.new_input, wlr_device); } } diff --git a/backend/x11/backend.c b/backend/x11/backend.c index 2417810a..5608a2ea 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -230,9 +230,9 @@ static bool wlr_x11_backend_start(struct wlr_backend *backend) { xcb_flush(x11->xcb_conn); wlr_output_update_enabled(&output->wlr_output, true); - wlr_signal_emit_safe(&x11->backend.events.output_add, output); - wlr_signal_emit_safe(&x11->backend.events.input_add, &x11->keyboard_dev); - wlr_signal_emit_safe(&x11->backend.events.input_add, &x11->pointer_dev); + wlr_signal_emit_safe(&x11->backend.events.new_output, output); + wlr_signal_emit_safe(&x11->backend.events.new_input, &x11->keyboard_dev); + wlr_signal_emit_safe(&x11->backend.events.new_input, &x11->pointer_dev); wl_event_source_timer_update(x11->frame_timer, 16); @@ -249,8 +249,8 @@ static void wlr_x11_backend_destroy(struct wlr_backend *backend) { struct wlr_x11_output *output = &x11->output; wlr_output_destroy(&output->wlr_output); - wlr_signal_emit_safe(&backend->events.input_remove, &x11->pointer_dev); - wlr_signal_emit_safe(&backend->events.input_remove, &x11->keyboard_dev); + wlr_signal_emit_safe(&x11->pointer_dev.events.destroy, &x11->pointer_dev); + wlr_signal_emit_safe(&x11->keyboard_dev.events.destroy, &x11->keyboard_dev); // TODO probably need to use wlr_keyboard_destroy, but the devices need to // be malloced for that to work if (x11->keyboard_dev.keyboard->keymap) { diff --git a/examples/support/shared.c b/examples/support/shared.c index 6cfaa6aa..c4f9288d 100644 --- a/examples/support/shared.c +++ b/examples/support/shared.c @@ -56,10 +56,24 @@ static void keyboard_key_notify(struct wl_listener *listener, void *data) { } } +static void keyboard_destroy_notify(struct wl_listener *listener, void *data) { + struct keyboard_state *kbstate = wl_container_of(listener, kbstate, destroy); + struct compositor_state *state = kbstate->compositor; + if (state->input_remove_cb) { + state->input_remove_cb(state, kbstate->device); + } + wl_list_remove(&kbstate->link); + wl_list_remove(&kbstate->destroy.link); + wl_list_remove(&kbstate->key.link); + free(kbstate); +} + static void keyboard_add(struct wlr_input_device *device, struct compositor_state *state) { struct keyboard_state *kbstate = calloc(sizeof(struct keyboard_state), 1); kbstate->device = device; kbstate->compositor = state; + kbstate->destroy.notify = keyboard_destroy_notify; + wl_signal_add(&device->events.destroy, &kbstate->destroy); kbstate->key.notify = keyboard_key_notify; wl_signal_add(&device->keyboard->events.key, &kbstate->key); wl_list_insert(&state->keyboards, &kbstate->link); @@ -117,17 +131,34 @@ static void pointer_axis_notify(struct wl_listener *listener, void *data) { } } +static void pointer_destroy_notify(struct wl_listener *listener, void *data) { + struct pointer_state *pstate = wl_container_of(listener, pstate, destroy); + struct compositor_state *state = pstate->compositor; + if (state->input_remove_cb) { + state->input_remove_cb(state, pstate->device); + } + wl_list_remove(&pstate->link); + wl_list_remove(&pstate->destroy.link); + wl_list_remove(&pstate->motion.link); + wl_list_remove(&pstate->motion_absolute.link); + wl_list_remove(&pstate->button.link); + wl_list_remove(&pstate->axis.link); + free(pstate); +} + static void pointer_add(struct wlr_input_device *device, struct compositor_state *state) { struct pointer_state *pstate = calloc(sizeof(struct pointer_state), 1); pstate->device = device; pstate->compositor = state; + pstate->destroy.notify = pointer_destroy_notify; + wl_signal_add(&device->events.destroy, &pstate->destroy); pstate->motion.notify = pointer_motion_notify; - pstate->motion_absolute.notify = pointer_motion_absolute_notify; - pstate->button.notify = pointer_button_notify; - pstate->axis.notify = pointer_axis_notify; wl_signal_add(&device->pointer->events.motion, &pstate->motion); + pstate->motion_absolute.notify = pointer_motion_absolute_notify; wl_signal_add(&device->pointer->events.motion_absolute, &pstate->motion_absolute); + pstate->button.notify = pointer_button_notify; wl_signal_add(&device->pointer->events.button, &pstate->button); + pstate->axis.notify = pointer_axis_notify; wl_signal_add(&device->pointer->events.axis, &pstate->axis); wl_list_insert(&state->pointers, &pstate->link); } @@ -166,17 +197,34 @@ static void touch_cancel_notify(struct wl_listener *listener, void *data) { } } +static void touch_destroy_notify(struct wl_listener *listener, void *data) { + struct touch_state *tstate = wl_container_of(listener, tstate, destroy); + struct compositor_state *state = tstate->compositor; + if (state->input_remove_cb) { + state->input_remove_cb(state, tstate->device); + } + wl_list_remove(&tstate->link); + wl_list_remove(&tstate->destroy.link); + wl_list_remove(&tstate->down.link); + wl_list_remove(&tstate->motion.link); + wl_list_remove(&tstate->up.link); + wl_list_remove(&tstate->cancel.link); + free(tstate); +} + static void touch_add(struct wlr_input_device *device, struct compositor_state *state) { struct touch_state *tstate = calloc(sizeof(struct touch_state), 1); tstate->device = device; tstate->compositor = state; + tstate->destroy.notify = touch_destroy_notify; + wl_signal_add(&device->events.destroy, &tstate->destroy); tstate->down.notify = touch_down_notify; - tstate->motion.notify = touch_motion_notify; - tstate->up.notify = touch_up_notify; - tstate->cancel.notify = touch_cancel_notify; wl_signal_add(&device->touch->events.down, &tstate->down); + tstate->motion.notify = touch_motion_notify; wl_signal_add(&device->touch->events.motion, &tstate->motion); + tstate->up.notify = touch_up_notify; wl_signal_add(&device->touch->events.up, &tstate->up); + tstate->cancel.notify = touch_cancel_notify; wl_signal_add(&device->touch->events.cancel, &tstate->cancel); wl_list_insert(&state->touch, &tstate->link); } @@ -205,18 +253,35 @@ static void tablet_tool_button_notify(struct wl_listener *listener, void *data) } } +static void tablet_tool_destroy_notify(struct wl_listener *listener, void *data) { + struct tablet_tool_state *tstate = wl_container_of(listener, tstate, destroy); + struct compositor_state *state = tstate->compositor; + if (state->input_remove_cb) { + state->input_remove_cb(state, tstate->device); + } + wl_list_remove(&tstate->link); + wl_list_remove(&tstate->destroy.link); + wl_list_remove(&tstate->axis.link); + wl_list_remove(&tstate->proximity.link); + //wl_list_remove(&tstate->tip.link); + wl_list_remove(&tstate->button.link); + free(tstate); +} + static void tablet_tool_add(struct wlr_input_device *device, struct compositor_state *state) { struct tablet_tool_state *tstate = calloc(sizeof(struct tablet_tool_state), 1); tstate->device = device; tstate->compositor = state; + tstate->destroy.notify = tablet_tool_destroy_notify; + wl_signal_add(&device->events.destroy, &tstate->destroy); tstate->axis.notify = tablet_tool_axis_notify; - tstate->proximity.notify = tablet_tool_proximity_notify; - //tstate->tip.notify = tablet_tool_tip_notify; - tstate->button.notify = tablet_tool_button_notify; wl_signal_add(&device->tablet_tool->events.axis, &tstate->axis); + tstate->proximity.notify = tablet_tool_proximity_notify; wl_signal_add(&device->tablet_tool->events.proximity, &tstate->proximity); + //tstate->tip.notify = tablet_tool_tip_notify; //wl_signal_add(&device->tablet_tool->events.tip, &tstate->tip); + tstate->button.notify = tablet_tool_button_notify; wl_signal_add(&device->tablet_tool->events.button, &tstate->button); wl_list_insert(&state->tablet_tools, &tstate->link); } @@ -229,19 +294,33 @@ static void tablet_pad_button_notify(struct wl_listener *listener, void *data) { } } +static void tablet_pad_destroy_notify(struct wl_listener *listener, void *data) { + struct tablet_pad_state *pstate = wl_container_of(listener, pstate, destroy); + struct compositor_state *state = pstate->compositor; + if (state->input_remove_cb) { + state->input_remove_cb(state, pstate->device); + } + wl_list_remove(&pstate->link); + wl_list_remove(&pstate->destroy.link); + wl_list_remove(&pstate->button.link); + free(pstate); +} + static void tablet_pad_add(struct wlr_input_device *device, struct compositor_state *state) { struct tablet_pad_state *pstate = calloc(sizeof(struct tablet_pad_state), 1); pstate->device = device; pstate->compositor = state; + pstate->destroy.notify = tablet_pad_destroy_notify; + wl_signal_add(&device->events.destroy, &pstate->destroy); pstate->button.notify = tablet_pad_button_notify; wl_signal_add(&device->tablet_pad->events.button, &pstate->button); wl_list_insert(&state->tablet_pads, &pstate->link); } -static void input_add_notify(struct wl_listener *listener, void *data) { +static void new_input_notify(struct wl_listener *listener, void *data) { struct wlr_input_device *device = data; - struct compositor_state *state = wl_container_of(listener, state, input_add); + struct compositor_state *state = wl_container_of(listener, state, new_input); switch (device->type) { case WLR_INPUT_DEVICE_KEYBOARD: keyboard_add(device, state); @@ -267,123 +346,6 @@ static void input_add_notify(struct wl_listener *listener, void *data) { } } -static void keyboard_remove(struct wlr_input_device *device, struct compositor_state *state) { - struct keyboard_state *kbstate = NULL, *_kbstate; - wl_list_for_each(_kbstate, &state->keyboards, link) { - if (_kbstate->device == device) { - kbstate = _kbstate; - break; - } - } - if (!kbstate) { - return; - } - wl_list_remove(&kbstate->link); - wl_list_remove(&kbstate->key.link); - free(kbstate); -} - -static void pointer_remove(struct wlr_input_device *device, struct compositor_state *state) { - struct pointer_state *pstate = NULL, *_pstate; - wl_list_for_each(_pstate, &state->pointers, link) { - if (_pstate->device == device) { - pstate = _pstate; - break; - } - } - if (!pstate) { - return; - } - wl_list_remove(&pstate->link); - wl_list_remove(&pstate->motion.link); - wl_list_remove(&pstate->motion_absolute.link); - wl_list_remove(&pstate->button.link); - wl_list_remove(&pstate->axis.link); - free(pstate); -} - -static void touch_remove(struct wlr_input_device *device, struct compositor_state *state) { - struct touch_state *tstate = NULL, *_tstate; - wl_list_for_each(_tstate, &state->touch, link) { - if (_tstate->device == device) { - tstate = _tstate; - break; - } - } - if (!tstate) { - return; - } - wl_list_remove(&tstate->link); - wl_list_remove(&tstate->down.link); - wl_list_remove(&tstate->motion.link); - wl_list_remove(&tstate->up.link); - wl_list_remove(&tstate->cancel.link); - free(tstate); -} - -static void tablet_tool_remove(struct wlr_input_device *device, struct compositor_state *state) { - struct tablet_tool_state *tstate = NULL, *_tstate; - wl_list_for_each(_tstate, &state->tablet_tools, link) { - if (_tstate->device == device) { - tstate = _tstate; - break; - } - } - if (!tstate) { - return; - } - wl_list_remove(&tstate->link); - wl_list_remove(&tstate->axis.link); - wl_list_remove(&tstate->proximity.link); - //wl_list_remove(&tstate->tip.link); - wl_list_remove(&tstate->button.link); - free(tstate); -} - -static void tablet_pad_remove(struct wlr_input_device *device, struct compositor_state *state) { - struct tablet_pad_state *pstate = NULL, *_pstate; - wl_list_for_each(_pstate, &state->tablet_pads, link) { - if (_pstate->device ==device) { - pstate = _pstate; - break; - } - } - if (!pstate) { - return; - } - wl_list_remove(&pstate->button.link); - free(pstate); -} - -static void input_remove_notify(struct wl_listener *listener, void *data) { - struct wlr_input_device *device = data; - struct compositor_state *state = wl_container_of(listener, state, input_remove); - - if (state->input_remove_cb) { - state->input_remove_cb(state, device); - } - - switch (device->type) { - case WLR_INPUT_DEVICE_KEYBOARD: - keyboard_remove(device, state); - break; - case WLR_INPUT_DEVICE_POINTER: - pointer_remove(device, state); - break; - case WLR_INPUT_DEVICE_TOUCH: - touch_remove(device, state); - break; - case WLR_INPUT_DEVICE_TABLET_TOOL: - tablet_tool_remove(device, state); - break; - case WLR_INPUT_DEVICE_TABLET_PAD: - tablet_pad_remove(device, state); - break; - default: - break; - } -} - static void output_frame_notify(struct wl_listener *listener, void *data) { struct output_state *output = wl_container_of(listener, output, frame); struct compositor_state *compositor = output->compositor; @@ -407,9 +369,21 @@ static void output_resolution_notify(struct wl_listener *listener, void *data) { } } -static void output_add_notify(struct wl_listener *listener, void *data) { +static void output_destroy_notify(struct wl_listener *listener, void *data) { + struct output_state *ostate = wl_container_of(listener, ostate, destroy); + struct compositor_state *state = ostate->compositor; + if (state->output_remove_cb) { + state->output_remove_cb(ostate); + } + wl_list_remove(&ostate->link); + wl_list_remove(&ostate->frame.link); + wl_list_remove(&ostate->resolution.link); + free(ostate); +} + +static void new_output_notify(struct wl_listener *listener, void *data) { struct wlr_output *output = data; - struct compositor_state *state = wl_container_of(listener, state, output_add); + struct compositor_state *state = wl_container_of(listener, state, new_output); wlr_log(L_DEBUG, "Output '%s' added", output->name); wlr_log(L_DEBUG, "%s %s %"PRId32"mm x %"PRId32"mm", output->make, output->model, output->phys_width, output->phys_height); @@ -422,9 +396,11 @@ static void output_add_notify(struct wl_listener *listener, void *data) { clock_gettime(CLOCK_MONOTONIC, &ostate->last_frame); ostate->output = output; ostate->compositor = state; + ostate->destroy.notify = output_destroy_notify; + wl_signal_add(&output->events.destroy, &ostate->destroy); ostate->frame.notify = output_frame_notify; - ostate->resolution.notify = output_resolution_notify; wl_signal_add(&output->events.frame, &ostate->frame); + ostate->resolution.notify = output_resolution_notify; wl_signal_add(&output->events.mode, &ostate->resolution); wl_list_insert(&state->outputs, &ostate->link); if (state->output_add_cb) { @@ -432,28 +408,6 @@ static void output_add_notify(struct wl_listener *listener, void *data) { } } -static void output_remove_notify(struct wl_listener *listener, void *data) { - struct wlr_output *output = data; - struct compositor_state *state = wl_container_of(listener, state, output_remove); - struct output_state *ostate = NULL, *_ostate; - wl_list_for_each(_ostate, &state->outputs, link) { - if (_ostate->output == output) { - ostate = _ostate; - break; - } - } - if (!ostate) { - return; // We are unfamiliar with this output - } - if (state->output_remove_cb) { - state->output_remove_cb(ostate); - } - wl_list_remove(&ostate->link); - wl_list_remove(&ostate->frame.link); - wl_list_remove(&ostate->resolution.link); - free(ostate); -} - void compositor_init(struct compositor_state *state) { state->display = wl_display_create(); state->event_loop = wl_display_get_event_loop(state->display); @@ -463,23 +417,19 @@ void compositor_init(struct compositor_state *state) { wl_list_init(&state->touch); wl_list_init(&state->tablet_tools); wl_list_init(&state->tablet_pads); - state->input_add.notify = input_add_notify; - state->input_remove.notify = input_remove_notify; - wl_list_init(&state->outputs); - state->output_add.notify = output_add_notify; - state->output_remove.notify = output_remove_notify; struct wlr_backend *wlr = wlr_backend_autocreate(state->display); if (!wlr) { exit(1); } - wl_signal_add(&wlr->events.input_add, &state->input_add); - wl_signal_add(&wlr->events.input_remove, &state->input_remove); - wl_signal_add(&wlr->events.output_add, &state->output_add); - wl_signal_add(&wlr->events.output_remove, &state->output_remove); state->backend = wlr; + wl_signal_add(&wlr->events.new_input, &state->new_input); + state->new_input.notify = new_input_notify; + wl_signal_add(&wlr->events.new_output, &state->new_output); + state->new_output.notify = new_output_notify; + clock_gettime(CLOCK_MONOTONIC, &state->last_frame); const char *socket = wl_display_add_socket_auto(state->display); diff --git a/examples/support/shared.h b/examples/support/shared.h index 014b709e..8cdea301 100644 --- a/examples/support/shared.h +++ b/examples/support/shared.h @@ -15,6 +15,7 @@ struct output_state { struct compositor_state *compositor; struct wlr_output *output; + struct wl_listener destroy; struct wl_listener frame; struct wl_listener resolution; struct timespec last_frame; @@ -25,6 +26,7 @@ struct output_state { struct keyboard_state { struct compositor_state *compositor; struct wlr_input_device *device; + struct wl_listener destroy; struct wl_listener key; struct wl_list link; void *data; @@ -33,6 +35,7 @@ struct keyboard_state { struct pointer_state { struct compositor_state *compositor; struct wlr_input_device *device; + struct wl_listener destroy; struct wl_listener motion; struct wl_listener motion_absolute; struct wl_listener button; @@ -44,6 +47,7 @@ struct pointer_state { struct touch_state { struct compositor_state *compositor; struct wlr_input_device *device; + struct wl_listener destroy; struct wl_listener down; struct wl_listener up; struct wl_listener motion; @@ -55,6 +59,7 @@ struct touch_state { struct tablet_tool_state { struct compositor_state *compositor; struct wlr_input_device *device; + struct wl_listener destroy; struct wl_listener axis; struct wl_listener proximity; struct wl_listener tip; @@ -66,6 +71,7 @@ struct tablet_tool_state { struct tablet_pad_state { struct compositor_state *compositor; struct wlr_input_device *device; + struct wl_listener destroy; struct wl_listener button; struct wl_list link; void *data; @@ -122,12 +128,10 @@ struct compositor_state { struct wl_list touch; struct wl_list tablet_tools; struct wl_list tablet_pads; - struct wl_listener input_add; - struct wl_listener input_remove; + struct wl_listener new_input; struct timespec last_frame; - struct wl_listener output_add; - struct wl_listener output_remove; + struct wl_listener new_output; struct wl_list outputs; void *data; diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h index 1232121a..a2121701 100644 --- a/include/rootston/desktop.h +++ b/include/rootston/desktop.h @@ -39,8 +39,7 @@ struct roots_desktop { struct wlr_primary_selection_device_manager *primary_selection_device_manager; struct wlr_idle *idle; - struct wl_listener output_add; - struct wl_listener output_remove; + struct wl_listener new_output; struct wl_listener layout_change; struct wl_listener xdg_shell_v6_surface; struct wl_listener wl_shell_surface; diff --git a/include/rootston/input.h b/include/rootston/input.h index 726dda24..d05cbb0a 100644 --- a/include/rootston/input.h +++ b/include/rootston/input.h @@ -13,8 +13,7 @@ struct roots_input { struct roots_config *config; struct roots_server *server; - struct wl_listener input_add; - struct wl_listener input_remove; + struct wl_listener new_input; struct wl_list seats; }; diff --git a/include/rootston/keyboard.h b/include/rootston/keyboard.h index 39650d7c..4548f4a7 100644 --- a/include/rootston/keyboard.h +++ b/include/rootston/keyboard.h @@ -13,6 +13,7 @@ struct roots_keyboard { struct roots_keyboard_config *config; struct wl_list link; + struct wl_listener device_destroy; struct wl_listener keyboard_key; struct wl_listener keyboard_modifiers; diff --git a/include/rootston/output.h b/include/rootston/output.h index 7f42904f..8396e7c5 100644 --- a/include/rootston/output.h +++ b/include/rootston/output.h @@ -18,11 +18,11 @@ struct roots_output { struct timespec last_frame; struct wlr_output_damage *damage; + struct wl_listener destroy; struct wl_listener frame; }; -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); struct roots_view; struct roots_drag_icon; diff --git a/include/rootston/seat.h b/include/rootston/seat.h index 0047522c..cd819076 100644 --- a/include/rootston/seat.h +++ b/include/rootston/seat.h @@ -56,18 +56,21 @@ struct roots_drag_icon { struct roots_pointer { struct roots_seat *seat; struct wlr_input_device *device; + struct wl_listener device_destroy; struct wl_list link; }; struct roots_touch { struct roots_seat *seat; struct wlr_input_device *device; + struct wl_listener device_destroy; struct wl_list link; }; struct roots_tablet_tool { struct roots_seat *seat; struct wlr_input_device *device; + struct wl_listener device_destroy; struct wl_listener axis; struct wl_listener proximity; struct wl_listener tip; diff --git a/include/wlr/backend.h b/include/wlr/backend.h index d4b1f773..00dc9fdc 100644 --- a/include/wlr/backend.h +++ b/include/wlr/backend.h @@ -12,10 +12,8 @@ struct wlr_backend { struct { struct wl_signal destroy; - struct wl_signal input_add; - struct wl_signal input_remove; - struct wl_signal output_add; - struct wl_signal output_remove; + struct wl_signal new_input; + struct wl_signal new_output; } events; }; diff --git a/rootston/desktop.c b/rootston/desktop.c index e9d66d5c..753a85e5 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -622,11 +622,8 @@ struct roots_desktop *desktop_create(struct roots_server *server, wl_list_init(&desktop->views); wl_list_init(&desktop->outputs); - 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); + desktop->new_output.notify = handle_new_output; + wl_signal_add(&server->backend->events.new_output, &desktop->new_output); desktop->server = server; desktop->config = config; diff --git a/rootston/input.c b/rootston/input.c index 74ce59d0..a0da2531 100644 --- a/rootston/input.c +++ b/rootston/input.c @@ -40,9 +40,9 @@ struct roots_seat *input_get_seat(struct roots_input *input, char *name) { return seat; } -static void input_add_notify(struct wl_listener *listener, void *data) { +static void handle_new_input(struct wl_listener *listener, void *data) { struct wlr_input_device *device = data; - struct roots_input *input = wl_container_of(listener, input, input_add); + struct roots_input *input = wl_container_of(listener, input, new_input); char *seat_name = ROOTS_CONFIG_DEFAULT_SEAT_NAME; struct roots_device_config *dc = @@ -74,16 +74,6 @@ static void input_add_notify(struct wl_listener *listener, void *data) { } } -static void input_remove_notify(struct wl_listener *listener, void *data) { - struct wlr_input_device *device = data; - struct roots_input *input = wl_container_of(listener, input, input_remove); - - struct roots_seat *seat; - wl_list_for_each(seat, &input->seats, link) { - roots_seat_remove_device(seat, device); - } -} - struct roots_input *input_create(struct roots_server *server, struct roots_config *config) { wlr_log(L_DEBUG, "Initializing roots input"); @@ -99,10 +89,8 @@ struct roots_input *input_create(struct roots_server *server, wl_list_init(&input->seats); - 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->new_input.notify = handle_new_input; + wl_signal_add(&server->backend->events.new_input, &input->new_input); return input; } diff --git a/rootston/output.c b/rootston/output.c index fce875da..bd2ec18d 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -644,9 +644,22 @@ static void set_mode(struct wlr_output *output, } } -void output_add_notify(struct wl_listener *listener, void *data) { +static void output_handle_destroy(struct wl_listener *listener, void *data) { + struct roots_output *output = wl_container_of(listener, output, destroy); + + // TODO: cursor + //example_config_configure_cursor(sample->config, sample->cursor, + // sample->compositor); + + wl_list_remove(&output->link); + wl_list_remove(&output->destroy.link); + wl_list_remove(&output->frame.link); + free(output); +} + +void handle_new_output(struct wl_listener *listener, void *data) { struct roots_desktop *desktop = wl_container_of(listener, desktop, - output_add); + new_output); struct wlr_output *wlr_output = data; struct roots_input *input = desktop->server->input; struct roots_config *config = desktop->config; @@ -670,6 +683,8 @@ void output_add_notify(struct wl_listener *listener, void *data) { output->damage = wlr_output_damage_create(wlr_output); + output->destroy.notify = output_handle_destroy; + wl_signal_add(&wlr_output->events.destroy, &output->destroy); output->frame.notify = output_damage_handle_frame; wl_signal_add(&output->damage->events.frame, &output->frame); @@ -699,31 +714,3 @@ void output_add_notify(struct wl_listener *listener, void *data) { output_damage_whole(output); } - -void output_remove_notify(struct wl_listener *listener, void *data) { - struct wlr_output *wlr_output = data; - struct roots_desktop *desktop = - wl_container_of(listener, desktop, output_remove); - - struct roots_output *output = NULL, *_output; - wl_list_for_each(_output, &desktop->outputs, link) { - if (_output->wlr_output == wlr_output) { - output = _output; - break; - } - } - if (!output) { - return; // We are unfamiliar with this output - } - - wlr_output_layout_remove(desktop->layout, output->wlr_output); - - // TODO: cursor - //example_config_configure_cursor(sample->config, sample->cursor, - // sample->compositor); - - wl_list_remove(&output->link); - wl_list_remove(&output->frame.link); - wlr_output_damage_destroy(output->damage); - free(output); -} diff --git a/rootston/seat.c b/rootston/seat.c index 45e42d7d..0c9867ec 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -404,6 +404,17 @@ static void seat_update_capabilities(struct roots_seat *seat) { } } +static void handle_keyboard_destroy(struct wl_listener *listener, void *data) { + struct roots_keyboard *keyboard = + wl_container_of(listener, keyboard, device_destroy); + struct roots_seat *seat = keyboard->seat; + roots_keyboard_destroy(keyboard); + wl_list_remove(&keyboard->device_destroy.link); + wl_list_remove(&keyboard->keyboard_key.link); + wl_list_remove(&keyboard->keyboard_modifiers.link); + seat_update_capabilities(seat); +} + static void seat_add_keyboard(struct roots_seat *seat, struct wlr_input_device *device) { assert(device->type == WLR_INPUT_DEVICE_KEYBOARD); @@ -418,10 +429,11 @@ static void seat_add_keyboard(struct roots_seat *seat, wl_list_insert(&seat->keyboards, &keyboard->link); + keyboard->device_destroy.notify = handle_keyboard_destroy; + wl_signal_add(&keyboard->device->events.destroy, &keyboard->device_destroy); keyboard->keyboard_key.notify = handle_keyboard_key; wl_signal_add(&keyboard->device->keyboard->events.key, &keyboard->keyboard_key); - keyboard->keyboard_modifiers.notify = handle_keyboard_modifiers; wl_signal_add(&keyboard->device->keyboard->events.modifiers, &keyboard->keyboard_modifiers); @@ -429,6 +441,19 @@ static void seat_add_keyboard(struct roots_seat *seat, wlr_seat_set_keyboard(seat->seat, device); } +static void handle_pointer_destroy(struct wl_listener *listener, void *data) { + struct roots_pointer *pointer = + wl_container_of(listener, pointer, device_destroy); + struct roots_seat *seat = pointer->seat; + + wl_list_remove(&pointer->link); + wlr_cursor_detach_input_device(seat->cursor->cursor, pointer->device); + wl_list_remove(&pointer->device_destroy.link); + free(pointer); + + seat_update_capabilities(seat); +} + static void seat_add_pointer(struct roots_seat *seat, struct wlr_input_device *device) { struct roots_pointer *pointer = calloc(sizeof(struct roots_pointer), 1); @@ -441,10 +466,27 @@ static void seat_add_pointer(struct roots_seat *seat, pointer->device = device; pointer->seat = seat; wl_list_insert(&seat->pointers, &pointer->link); + + pointer->device_destroy.notify = handle_pointer_destroy; + wl_signal_add(&pointer->device->events.destroy, &pointer->device_destroy); + wlr_cursor_attach_input_device(seat->cursor->cursor, device); roots_seat_configure_cursor(seat); } +static void handle_touch_destroy(struct wl_listener *listener, void *data) { + struct roots_pointer *touch = + wl_container_of(listener, touch, device_destroy); + struct roots_seat *seat = touch->seat; + + wl_list_remove(&touch->link); + wlr_cursor_detach_input_device(seat->cursor->cursor, touch->device); + wl_list_remove(&touch->device_destroy.link); + free(touch); + + seat_update_capabilities(seat); +} + static void seat_add_touch(struct roots_seat *seat, struct wlr_input_device *device) { struct roots_touch *touch = calloc(sizeof(struct roots_touch), 1); @@ -457,6 +499,10 @@ static void seat_add_touch(struct roots_seat *seat, touch->device = device; touch->seat = seat; wl_list_insert(&seat->touch, &touch->link); + + touch->device_destroy.notify = handle_touch_destroy; + wl_signal_add(&touch->device->events.destroy, &touch->device_destroy); + wlr_cursor_attach_input_device(seat->cursor->cursor, device); roots_seat_configure_cursor(seat); } @@ -466,6 +512,20 @@ static void seat_add_tablet_pad(struct roots_seat *seat, // TODO } +static void handle_tablet_tool_destroy(struct wl_listener *listener, + void *data) { + struct roots_pointer *tablet_tool = + wl_container_of(listener, tablet_tool, device_destroy); + struct roots_seat *seat = tablet_tool->seat; + + wl_list_remove(&tablet_tool->link); + wlr_cursor_detach_input_device(seat->cursor->cursor, tablet_tool->device); + wl_list_remove(&tablet_tool->device_destroy.link); + free(tablet_tool); + + seat_update_capabilities(seat); +} + static void seat_add_tablet_tool(struct roots_seat *seat, struct wlr_input_device *device) { struct roots_tablet_tool *tablet_tool = @@ -479,6 +539,11 @@ static void seat_add_tablet_tool(struct roots_seat *seat, tablet_tool->device = device; tablet_tool->seat = seat; wl_list_insert(&seat->tablet_tools, &tablet_tool->link); + + tablet_tool->device_destroy.notify = handle_tablet_tool_destroy; + wl_signal_add(&tablet_tool->device->events.destroy, + &tablet_tool->device_destroy); + wlr_cursor_attach_input_device(seat->cursor->cursor, device); roots_seat_configure_cursor(seat); } @@ -506,84 +571,6 @@ void roots_seat_add_device(struct roots_seat *seat, seat_update_capabilities(seat); } -static void seat_remove_keyboard(struct roots_seat *seat, - struct wlr_input_device *device) { - struct roots_keyboard *keyboard; - wl_list_for_each(keyboard, &seat->keyboards, link) { - if (keyboard->device == device) { - roots_keyboard_destroy(keyboard); - return; - } - } -} - -static void seat_remove_pointer(struct roots_seat *seat, - struct wlr_input_device *device) { - struct roots_pointer *pointer; - wl_list_for_each(pointer, &seat->pointers, link) { - if (pointer->device == device) { - wl_list_remove(&pointer->link); - wlr_cursor_detach_input_device(seat->cursor->cursor, device); - free(pointer); - return; - } - } -} - -static void seat_remove_touch(struct roots_seat *seat, - struct wlr_input_device *device) { - struct roots_touch *touch; - wl_list_for_each(touch, &seat->touch, link) { - if (touch->device == device) { - wl_list_remove(&touch->link); - wlr_cursor_detach_input_device(seat->cursor->cursor, device); - free(touch); - return; - } - } -} - -static void seat_remove_tablet_pad(struct roots_seat *seat, - struct wlr_input_device *device) { - // TODO -} - -static void seat_remove_tablet_tool(struct roots_seat *seat, - struct wlr_input_device *device) { - struct roots_tablet_tool *tablet_tool; - wl_list_for_each(tablet_tool, &seat->tablet_tools, link) { - if (tablet_tool->device == device) { - wl_list_remove(&tablet_tool->link); - wlr_cursor_detach_input_device(seat->cursor->cursor, device); - free(tablet_tool); - return; - } - } -} - -void roots_seat_remove_device(struct roots_seat *seat, - struct wlr_input_device *device) { - switch (device->type) { - case WLR_INPUT_DEVICE_KEYBOARD: - seat_remove_keyboard(seat, device); - break; - case WLR_INPUT_DEVICE_POINTER: - seat_remove_pointer(seat, device); - break; - case WLR_INPUT_DEVICE_TOUCH: - seat_remove_touch(seat, device); - break; - case WLR_INPUT_DEVICE_TABLET_PAD: - seat_remove_tablet_pad(seat, device); - break; - case WLR_INPUT_DEVICE_TABLET_TOOL: - seat_remove_tablet_tool(seat, device); - break; - } - - seat_update_capabilities(seat); -} - void roots_seat_configure_xcursor(struct roots_seat *seat) { const char *cursor_theme = NULL; struct roots_cursor_config *cc = diff --git a/types/wlr_input_device.c b/types/wlr_input_device.c index 468b93f9..f88b7197 100644 --- a/types/wlr_input_device.c +++ b/types/wlr_input_device.c @@ -59,7 +59,6 @@ void wlr_input_device_destroy(struct wlr_input_device *dev) { if (dev->impl && dev->impl->destroy) { dev->impl->destroy(dev); } else { - wl_list_remove(&dev->events.destroy.listener_list); free(dev); } } diff --git a/types/wlr_output.c b/types/wlr_output.c index bf3ed6ae..bac8b7ce 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -285,7 +285,6 @@ void wlr_output_destroy(struct wlr_output *output) { wlr_output_destroy_global(output); wlr_output_set_fullscreen_surface(output, NULL); - wlr_signal_emit_safe(&output->backend->events.output_remove, output); wlr_signal_emit_safe(&output->events.destroy, output); struct wlr_output_mode *mode, *tmp_mode; -- cgit v1.2.3 From 36ead80cd19b4c1773b894750ecf7fcec63f9b9b Mon Sep 17 00:00:00 2001 From: emersion Date: Mon, 12 Feb 2018 19:45:58 +0100 Subject: Make wlr_signal_emit_safe private --- backend/drm/backend.c | 2 +- backend/drm/drm.c | 2 +- backend/headless/backend.c | 2 +- backend/headless/input_device.c | 2 +- backend/headless/output.c | 2 +- backend/libinput/backend.c | 2 +- backend/libinput/events.c | 2 +- backend/libinput/pointer.c | 2 +- backend/libinput/tablet_pad.c | 2 +- backend/libinput/tablet_tool.c | 2 +- backend/libinput/touch.c | 2 +- backend/multi/backend.c | 2 +- backend/session/direct-freebsd.c | 2 +- backend/session/direct.c | 2 +- backend/session/logind.c | 2 +- backend/session/session.c | 2 +- backend/wayland/backend.c | 2 +- backend/wayland/output.c | 2 +- backend/wayland/wl_seat.c | 2 +- backend/x11/backend.c | 2 +- include/util/signal.h | 8 ++++++++ include/wlr/util/signal.h | 8 -------- render/gles2/texture.c | 2 +- rootston/desktop.c | 3 +-- types/wlr_compositor.c | 2 +- types/wlr_cursor.c | 2 +- types/wlr_data_device.c | 2 +- types/wlr_gamma_control.c | 2 +- types/wlr_idle.c | 2 +- types/wlr_input_device.c | 2 +- types/wlr_keyboard.c | 2 +- types/wlr_output.c | 2 +- types/wlr_output_damage.c | 2 +- types/wlr_output_layout.c | 2 +- types/wlr_primary_selection.c | 2 +- types/wlr_seat.c | 2 +- types/wlr_server_decoration.c | 2 +- types/wlr_surface.c | 2 +- types/wlr_wl_shell.c | 2 +- types/wlr_xdg_shell_v6.c | 2 +- util/signal.c | 2 +- xwayland/xwayland.c | 2 +- xwayland/xwm.c | 2 +- 43 files changed, 49 insertions(+), 50 deletions(-) create mode 100644 include/util/signal.h delete mode 100644 include/wlr/util/signal.h (limited to 'backend/multi') diff --git a/backend/drm/backend.c b/backend/drm/backend.c index 4d09e078..682e8c85 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include "util/signal.h" #include #include "backend/drm/drm.h" diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 7af242bc..5189ec90 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include "util/signal.h" #include #include #include diff --git a/backend/headless/backend.c b/backend/headless/backend.c index 703dc8cd..a79e4af8 100644 --- a/backend/headless/backend.c +++ b/backend/headless/backend.c @@ -2,7 +2,7 @@ #include #include #include -#include +#include "util/signal.h" #include #include #include "backend/headless.h" diff --git a/backend/headless/input_device.c b/backend/headless/input_device.c index 6b2bc4e7..5d7ca34b 100644 --- a/backend/headless/input_device.c +++ b/backend/headless/input_device.c @@ -6,7 +6,7 @@ #include #include #include -#include +#include "util/signal.h" #include "backend/headless.h" static void input_device_destroy(struct wlr_input_device *wlr_dev) { diff --git a/backend/headless/output.c b/backend/headless/output.c index f31b7d37..63f0b6b4 100644 --- a/backend/headless/output.c +++ b/backend/headless/output.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include "util/signal.h" #include "backend/headless.h" static EGLSurface egl_create_surface(struct wlr_egl *egl, unsigned int width, diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index 5b815a0c..1ec73009 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include "util/signal.h" #include "backend/libinput.h" static int wlr_libinput_open_restricted(const char *path, diff --git a/backend/libinput/events.c b/backend/libinput/events.c index 4bcfa539..248b8213 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -5,7 +5,7 @@ #include #include #include -#include +#include "util/signal.h" #include "backend/libinput.h" struct wlr_input_device *get_appropriate_device( diff --git a/backend/libinput/pointer.c b/backend/libinput/pointer.c index f80f4f84..560e95b5 100644 --- a/backend/libinput/pointer.c +++ b/backend/libinput/pointer.c @@ -5,7 +5,7 @@ #include #include #include -#include +#include "util/signal.h" #include "backend/libinput.h" struct wlr_pointer *wlr_libinput_pointer_create( diff --git a/backend/libinput/tablet_pad.c b/backend/libinput/tablet_pad.c index 54315581..e8ffc6dd 100644 --- a/backend/libinput/tablet_pad.c +++ b/backend/libinput/tablet_pad.c @@ -5,7 +5,7 @@ #include #include #include -#include +#include "util/signal.h" #include "backend/libinput.h" struct wlr_tablet_pad *wlr_libinput_tablet_pad_create( diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c index 2f28540b..0f2ea70a 100644 --- a/backend/libinput/tablet_tool.c +++ b/backend/libinput/tablet_tool.c @@ -5,7 +5,7 @@ #include #include #include -#include +#include "util/signal.h" #include "backend/libinput.h" struct wlr_tablet_tool *wlr_libinput_tablet_tool_create( diff --git a/backend/libinput/touch.c b/backend/libinput/touch.c index d496d792..fb2b8e3f 100644 --- a/backend/libinput/touch.c +++ b/backend/libinput/touch.c @@ -5,7 +5,7 @@ #include #include #include -#include +#include "util/signal.h" #include "backend/libinput.h" struct wlr_touch *wlr_libinput_touch_create( diff --git a/backend/multi/backend.c b/backend/multi/backend.c index 02738f59..1005e6b7 100644 --- a/backend/multi/backend.c +++ b/backend/multi/backend.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include "util/signal.h" #include "backend/multi.h" #include "backend/drm/drm.h" diff --git a/backend/session/direct-freebsd.c b/backend/session/direct-freebsd.c index fe4ff653..ceaae2be 100644 --- a/backend/session/direct-freebsd.c +++ b/backend/session/direct-freebsd.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include "util/signal.h" #include "backend/session/direct-ipc.h" const struct session_impl session_direct; diff --git a/backend/session/direct.c b/backend/session/direct.c index 245683ea..1f60ed23 100644 --- a/backend/session/direct.c +++ b/backend/session/direct.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include "util/signal.h" #include "backend/session/direct-ipc.h" enum { DRM_MAJOR = 226 }; diff --git a/backend/session/logind.c b/backend/session/logind.c index f6150817..b2206e15 100644 --- a/backend/session/logind.c +++ b/backend/session/logind.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include "util/signal.h" #ifdef WLR_HAS_SYSTEMD #include diff --git a/backend/session/session.c b/backend/session/session.c index 4b81e230..ac55a191 100644 --- a/backend/session/session.c +++ b/backend/session/session.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include "util/signal.h" extern const struct session_impl session_logind; extern const struct session_impl session_direct; diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c index 2907057c..60c8ede9 100644 --- a/backend/wayland/backend.c +++ b/backend/wayland/backend.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include "util/signal.h" #include "backend/wayland.h" #include "xdg-shell-unstable-v6-client-protocol.h" diff --git a/backend/wayland/output.c b/backend/wayland/output.c index b1cc6836..fed4c63a 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include "util/signal.h" #include "backend/wayland.h" #include "xdg-shell-unstable-v6-client-protocol.h" diff --git a/backend/wayland/wl_seat.c b/backend/wayland/wl_seat.c index 18114119..f6328106 100644 --- a/backend/wayland/wl_seat.c +++ b/backend/wayland/wl_seat.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include "util/signal.h" #include "backend/wayland.h" static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer, diff --git a/backend/x11/backend.c b/backend/x11/backend.c index 5608a2ea..2715b366 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include "util/signal.h" #include "backend/x11.h" static struct wlr_backend_impl backend_impl; diff --git a/include/util/signal.h b/include/util/signal.h new file mode 100644 index 00000000..e13141d8 --- /dev/null +++ b/include/util/signal.h @@ -0,0 +1,8 @@ +#ifndef WLR_UTIL_SIGNAL_H +#define WLR_UTIL_SIGNAL_H + +#include + +void wlr_signal_emit_safe(struct wl_signal *signal, void *data); + +#endif diff --git a/include/wlr/util/signal.h b/include/wlr/util/signal.h deleted file mode 100644 index e13141d8..00000000 --- a/include/wlr/util/signal.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef WLR_UTIL_SIGNAL_H -#define WLR_UTIL_SIGNAL_H - -#include - -void wlr_signal_emit_safe(struct wl_signal *signal, void *data); - -#endif diff --git a/render/gles2/texture.c b/render/gles2/texture.c index 54cee627..a594f23e 100644 --- a/render/gles2/texture.c +++ b/render/gles2/texture.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include "util/signal.h" #include "render/gles2.h" static struct pixel_format external_pixel_format = { diff --git a/rootston/desktop.c b/rootston/desktop.c index 753a85e5..68da45e0 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -16,7 +16,6 @@ #include #include #include -#include #include "rootston/server.h" #include "rootston/seat.h" #include "rootston/xcursor.h" @@ -384,7 +383,7 @@ struct roots_subsurface *subsurface_create(struct roots_view *view, void view_finish(struct roots_view *view) { view_damage_whole(view); - wlr_signal_emit_safe(&view->events.destroy, view); + wl_signal_emit(&view->events.destroy, view); wl_list_remove(&view->new_subsurface.link); diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c index bab41b85..bd56b0fb 100644 --- a/types/wlr_compositor.c +++ b/types/wlr_compositor.c @@ -2,7 +2,7 @@ #include #include #include -#include +#include "util/signal.h" #include #include #include diff --git a/types/wlr_cursor.c b/types/wlr_cursor.c index 564ead46..4f3d8727 100644 --- a/types/wlr_cursor.c +++ b/types/wlr_cursor.c @@ -3,7 +3,7 @@ #include #include #include -#include +#include "util/signal.h" #include #include #include diff --git a/types/wlr_data_device.c b/types/wlr_data_device.c index ae3219f1..7153dd53 100644 --- a/types/wlr_data_device.c +++ b/types/wlr_data_device.c @@ -6,7 +6,7 @@ #include #include #include -#include +#include "util/signal.h" #include #include diff --git a/types/wlr_gamma_control.c b/types/wlr_gamma_control.c index f7644230..214dfd21 100644 --- a/types/wlr_gamma_control.c +++ b/types/wlr_gamma_control.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include "util/signal.h" #include "gamma-control-protocol.h" static void resource_destroy(struct wl_client *client, diff --git a/types/wlr_idle.c b/types/wlr_idle.c index b30bb9d7..1976004f 100644 --- a/types/wlr_idle.c +++ b/types/wlr_idle.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include "util/signal.h" #include "idle-protocol.h" static void idle_timeout_destroy(struct wlr_idle_timeout *timer) { diff --git a/types/wlr_input_device.c b/types/wlr_input_device.c index f88b7197..372b3a7b 100644 --- a/types/wlr_input_device.c +++ b/types/wlr_input_device.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include "util/signal.h" void wlr_input_device_init(struct wlr_input_device *dev, enum wlr_input_device_type type, diff --git a/types/wlr_keyboard.c b/types/wlr_keyboard.c index 9fac1843..6f09d599 100644 --- a/types/wlr_keyboard.c +++ b/types/wlr_keyboard.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include "util/signal.h" int os_create_anonymous_file(off_t size); diff --git a/types/wlr_output.c b/types/wlr_output.c index bac8b7ce..7dcf4c78 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include "util/signal.h" static void wl_output_send_to_resource(struct wl_resource *resource) { assert(resource); diff --git a/types/wlr_output_damage.c b/types/wlr_output_damage.c index 2c6e24f0..c231a900 100644 --- a/types/wlr_output_damage.c +++ b/types/wlr_output_damage.c @@ -2,7 +2,7 @@ #include #include #include -#include +#include "util/signal.h" #include #include #include diff --git a/types/wlr_output_layout.c b/types/wlr_output_layout.c index ea8581b3..ea7b81c5 100644 --- a/types/wlr_output_layout.c +++ b/types/wlr_output_layout.c @@ -3,7 +3,7 @@ #include #include #include -#include +#include "util/signal.h" #include #include #include diff --git a/types/wlr_primary_selection.c b/types/wlr_primary_selection.c index 7eb5d97a..45d71f19 100644 --- a/types/wlr_primary_selection.c +++ b/types/wlr_primary_selection.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include "util/signal.h" static void offer_handle_receive(struct wl_client *client, struct wl_resource *resource, const char *mime_type, int32_t fd) { diff --git a/types/wlr_seat.c b/types/wlr_seat.c index b9d8b1b8..3ad4d81d 100644 --- a/types/wlr_seat.c +++ b/types/wlr_seat.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include "util/signal.h" #include #include diff --git a/types/wlr_server_decoration.c b/types/wlr_server_decoration.c index f648cce7..ffa0477c 100644 --- a/types/wlr_server_decoration.c +++ b/types/wlr_server_decoration.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include "util/signal.h" static void server_decoration_handle_release(struct wl_client *client, struct wl_resource *resource) { diff --git a/types/wlr_surface.c b/types/wlr_surface.c index e430339b..b761bab5 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -3,7 +3,7 @@ #include #include #include -#include +#include "util/signal.h" #include #include #include diff --git a/types/wlr_wl_shell.c b/types/wlr_wl_shell.c index 0c4e01fd..e9d52cc9 100644 --- a/types/wlr_wl_shell.c +++ b/types/wlr_wl_shell.c @@ -5,7 +5,7 @@ #include #include #include -#include +#include "util/signal.h" #include #include #include diff --git a/types/wlr_xdg_shell_v6.c b/types/wlr_xdg_shell_v6.c index b6eee875..30870d3b 100644 --- a/types/wlr_xdg_shell_v6.c +++ b/types/wlr_xdg_shell_v6.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include "util/signal.h" #include "xdg-shell-unstable-v6-protocol.h" static const char *wlr_desktop_xdg_toplevel_role = "xdg_toplevel"; diff --git a/util/signal.c b/util/signal.c index 91c4f571..39618465 100644 --- a/util/signal.c +++ b/util/signal.c @@ -1,4 +1,4 @@ -#include +#include "util/signal.h" static void handle_noop(struct wl_listener *listener, void *data) { // Do nothing diff --git a/xwayland/xwayland.c b/xwayland/xwayland.c index 7c57b6c0..74555edb 100644 --- a/xwayland/xwayland.c +++ b/xwayland/xwayland.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include "util/signal.h" #include "sockets.h" #include "wlr/xwm.h" diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 86d8bde7..425188c7 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include "util/signal.h" #include #include #include -- cgit v1.2.3 From c2e147401048aa53aebd52f1851b1da8c91043a3 Mon Sep 17 00:00:00 2001 From: emersion Date: Mon, 12 Feb 2018 21:29:23 +0100 Subject: Reformat all #include directives --- backend/backend.c | 16 +++++++------- backend/drm/atomic.c | 4 ++-- backend/drm/backend.c | 16 +++++++------- backend/drm/drm.c | 24 ++++++++++----------- backend/drm/legacy.c | 2 +- backend/drm/properties.c | 2 +- backend/drm/renderer.c | 16 ++++++-------- backend/drm/util.c | 8 +++---- backend/headless/backend.c | 6 +++--- backend/headless/input_device.c | 8 +++---- backend/headless/output.c | 4 ++-- backend/libinput/backend.c | 6 +++--- backend/libinput/events.c | 6 +++--- backend/libinput/keyboard.c | 6 +++--- backend/libinput/pointer.c | 6 +++--- backend/libinput/tablet_pad.c | 6 +++--- backend/libinput/tablet_tool.c | 6 +++--- backend/libinput/touch.c | 6 +++--- backend/meson.build | 6 +++--- backend/multi/backend.c | 4 ++-- backend/session/direct-freebsd.c | 20 ++++++++--------- backend/session/direct-ipc.c | 10 ++++----- backend/session/direct.c | 18 ++++++++-------- backend/session/logind.c | 12 +++++------ backend/session/session.c | 8 +++---- backend/wayland/backend.c | 14 ++++++------ backend/wayland/output.c | 10 ++++----- backend/wayland/registry.c | 1 - backend/wayland/wl_seat.c | 8 +++---- backend/x11/backend.c | 26 +++++++++++----------- include/backend/drm/drm.h | 10 ++++----- include/backend/drm/iface.h | 3 +-- include/backend/drm/renderer.h | 6 ++---- include/backend/drm/util.h | 2 +- include/backend/headless.h | 2 +- include/backend/libinput.h | 3 ++- include/backend/multi.h | 2 +- include/backend/wayland.h | 8 +++---- include/backend/x11.h | 8 +++---- include/render/gles2.h | 10 ++++----- include/rootston/config.h | 7 +++--- include/rootston/cursor.h | 4 ++-- include/rootston/desktop.h | 21 +++++++++--------- include/rootston/input.h | 11 +++++----- include/rootston/keyboard.h | 4 ++-- include/rootston/output.h | 6 +++--- include/rootston/seat.h | 5 +++-- include/rootston/server.h | 5 +++-- include/rootston/view.h | 4 ++-- include/rootston/xcursor.h | 4 ++-- include/util/os-compatibility.h | 7 ++---- include/util/signal.h | 4 ++-- include/wlr/backend/drm.h | 2 +- include/wlr/backend/libinput.h | 2 +- include/wlr/backend/multi.h | 5 ----- include/wlr/backend/session.h | 4 ++-- include/wlr/backend/wayland.h | 2 +- include/wlr/interfaces/wlr_keyboard.h | 2 +- include/wlr/interfaces/wlr_output.h | 2 +- include/wlr/render.h | 2 +- include/wlr/render/egl.h | 6 +++--- include/wlr/render/gles2.h | 2 +- include/wlr/render/interface.h | 2 +- include/wlr/types/wlr_cursor.h | 6 +++--- include/wlr/types/wlr_keyboard.h | 4 ++-- include/wlr/types/wlr_list.h | 6 +++--- include/wlr/types/wlr_output.h | 4 ++-- include/wlr/types/wlr_output_damage.h | 2 +- include/wlr/types/wlr_output_layout.h | 4 ++-- include/wlr/types/wlr_pointer.h | 4 ++-- include/wlr/types/wlr_primary_selection.h | 2 +- include/wlr/types/wlr_screenshooter.h | 5 +++-- include/wlr/types/wlr_seat.h | 5 +++-- include/wlr/types/wlr_surface.h | 5 +++-- include/wlr/types/wlr_tablet_pad.h | 4 ++-- include/wlr/types/wlr_tablet_tool.h | 4 ++-- include/wlr/types/wlr_touch.h | 2 +- include/wlr/types/wlr_xdg_shell_v6.h | 2 +- include/wlr/xwayland.h | 2 +- include/wlr/xwm.h | 6 +++--- meson.build | 36 +++++++++++++++---------------- protocol/meson.build | 4 ++-- render/egl.c | 4 ++-- render/gles2/renderer.c | 6 +++--- render/gles2/shaders.c | 2 +- render/gles2/texture.c | 8 +++---- render/gles2/util.c | 4 ++-- render/matrix.c | 4 ++-- render/meson.build | 2 +- render/wlr_renderer.c | 2 +- render/wlr_texture.c | 2 +- rootston/config.c | 10 ++++----- rootston/cursor.c | 10 ++++----- rootston/desktop.c | 10 ++++----- rootston/input.c | 4 ++-- rootston/keyboard.c | 8 +++---- rootston/main.c | 2 +- rootston/meson.build | 2 +- rootston/output.c | 14 ++++++------ rootston/seat.c | 8 +++---- rootston/wl_shell.c | 4 ++-- rootston/xdg_shell_v6.c | 4 ++-- rootston/xwayland.c | 4 ++-- types/meson.build | 4 ++-- types/wlr_box.c | 2 +- types/wlr_compositor.c | 6 +++--- types/wlr_cursor.c | 12 +++++------ types/wlr_data_device.c | 6 +++--- types/wlr_gamma_control.c | 2 +- types/wlr_idle.c | 2 +- types/wlr_input_device.c | 6 +++--- types/wlr_keyboard.c | 4 ++-- types/wlr_list.c | 4 ++-- types/wlr_output.c | 6 +++--- types/wlr_output_damage.c | 6 +++--- types/wlr_output_layout.c | 10 ++++----- types/wlr_pointer.c | 2 +- types/wlr_primary_selection.c | 6 +++--- types/wlr_region.c | 6 +++--- types/wlr_screenshooter.c | 4 ++-- types/wlr_seat.c | 6 +++--- types/wlr_server_decoration.c | 4 ++-- types/wlr_surface.c | 8 +++---- types/wlr_tablet_pad.c | 2 +- types/wlr_tablet_tool.c | 2 +- types/wlr_touch.c | 2 +- types/wlr_wl_shell.c | 8 +++---- types/wlr_xdg_shell_v6.c | 4 ++-- util/log.c | 2 +- util/os-compatibility.c | 10 ++++----- util/region.c | 2 +- xcursor/meson.build | 2 +- xcursor/wlr_xcursor.c | 6 +++--- xcursor/xcursor.c | 4 ++-- xwayland/selection.c | 14 ++++++------ xwayland/sockets.c | 16 +++++++------- xwayland/xwayland.c | 16 +++++++------- xwayland/xwm.c | 16 +++++++------- 138 files changed, 439 insertions(+), 446 deletions(-) (limited to 'backend/multi') diff --git a/backend/backend.c b/backend/backend.c index aec5781e..c67be617 100644 --- a/backend/backend.c +++ b/backend/backend.c @@ -1,17 +1,17 @@ -#include -#include -#include -#include -#include #include +#include #include -#include -#include +#include +#include +#include +#include #include +#include #include +#include +#include #include #include -#include #include void wlr_backend_init(struct wlr_backend *backend, diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c index 526b2731..29b5ccb1 100644 --- a/backend/drm/atomic.c +++ b/backend/drm/atomic.c @@ -1,8 +1,8 @@ -#include #include +#include +#include #include #include -#include #include "backend/drm/drm.h" #include "backend/drm/iface.h" #include "backend/drm/util.h" diff --git a/backend/drm/backend.c b/backend/drm/backend.c index 682e8c85..47dff227 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -1,19 +1,19 @@ -#include -#include +#include +#include #include +#include #include -#include -#include +#include #include -#include -#include #include +#include #include +#include #include #include -#include "util/signal.h" -#include +#include #include "backend/drm/drm.h" +#include "util/signal.h" static bool wlr_drm_backend_start(struct wlr_backend *backend) { struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend; diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 5189ec90..e60b7e1c 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -1,30 +1,30 @@ #include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include +#include #include #include #include +#include +#include +#include +#include +#include #include #include #include #include -#include -#include "util/signal.h" -#include -#include #include +#include +#include +#include +#include +#include #include "backend/drm/drm.h" #include "backend/drm/iface.h" #include "backend/drm/util.h" +#include "util/signal.h" bool wlr_drm_check_features(struct wlr_drm_backend *drm) { if (drmSetClientCap(drm->fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1)) { diff --git a/backend/drm/legacy.c b/backend/drm/legacy.c index eec8c642..88a01b89 100644 --- a/backend/drm/legacy.c +++ b/backend/drm/legacy.c @@ -1,7 +1,7 @@ #include +#include #include #include -#include #include "backend/drm/drm.h" #include "backend/drm/iface.h" #include "backend/drm/util.h" diff --git a/backend/drm/properties.c b/backend/drm/properties.c index 153e845e..3d35beb5 100644 --- a/backend/drm/properties.c +++ b/backend/drm/properties.c @@ -2,9 +2,9 @@ #include #include #include +#include #include #include -#include #include "backend/drm/properties.h" /* diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c index 80d3bd9a..f3e570f7 100644 --- a/backend/drm/renderer.c +++ b/backend/drm/renderer.c @@ -1,18 +1,16 @@ +#include +#include +#include +#include #include #include #include - -#include -#include -#include -#include #include - -#include +#include #include -#include #include -#include +#include +#include #include "backend/drm/drm.h" #include "glapi.h" diff --git a/backend/drm/util.c b/backend/drm/util.c index 37d99aa8..41ba47d1 100644 --- a/backend/drm/util.c +++ b/backend/drm/util.c @@ -1,10 +1,10 @@ -#include -#include -#include #include +#include #include -#include "backend/drm/util.h" +#include +#include #include +#include "backend/drm/util.h" int32_t calculate_refresh_rate(drmModeModeInfo *mode) { int32_t refresh = (mode->clock * 1000000LL / mode->htotal + diff --git a/backend/headless/backend.c b/backend/headless/backend.c index a79e4af8..663bc13b 100644 --- a/backend/headless/backend.c +++ b/backend/headless/backend.c @@ -1,10 +1,10 @@ +#include "util/signal.h" #include +#include +#include #include #include #include -#include "util/signal.h" -#include -#include #include "backend/headless.h" #include "glapi.h" diff --git a/backend/headless/input_device.c b/backend/headless/input_device.c index 5d7ca34b..ea335aff 100644 --- a/backend/headless/input_device.c +++ b/backend/headless/input_device.c @@ -1,13 +1,13 @@ #include #include -#include #include -#include -#include +#include #include +#include +#include #include -#include "util/signal.h" #include "backend/headless.h" +#include "util/signal.h" static void input_device_destroy(struct wlr_input_device *wlr_dev) { struct wlr_headless_input_device *device = diff --git a/backend/headless/output.c b/backend/headless/output.c index 63f0b6b4..ba4a094e 100644 --- a/backend/headless/output.c +++ b/backend/headless/output.c @@ -1,11 +1,11 @@ -#include #include #include #include +#include #include #include -#include "util/signal.h" #include "backend/headless.h" +#include "util/signal.h" static EGLSurface egl_create_surface(struct wlr_egl *egl, unsigned int width, unsigned int height) { diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index 1ec73009..71fe0d93 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -1,11 +1,11 @@ -#include #include #include -#include +#include #include +#include #include -#include "util/signal.h" #include "backend/libinput.h" +#include "util/signal.h" static int wlr_libinput_open_restricted(const char *path, int flags, void *_backend) { diff --git a/backend/libinput/events.c b/backend/libinput/events.c index 248b8213..603eed07 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -1,12 +1,12 @@ -#include #include #include +#include +#include #include #include #include -#include -#include "util/signal.h" #include "backend/libinput.h" +#include "util/signal.h" struct wlr_input_device *get_appropriate_device( enum wlr_input_device_type desired_type, diff --git a/backend/libinput/keyboard.c b/backend/libinput/keyboard.c index 065d8ead..b44bc892 100644 --- a/backend/libinput/keyboard.c +++ b/backend/libinput/keyboard.c @@ -1,9 +1,9 @@ -#include #include #include +#include #include -#include #include +#include #include #include "backend/libinput.h" @@ -57,7 +57,7 @@ void handle_keyboard_key(struct libinput_event *event, wlr_event.time_msec = usec_to_msec(libinput_event_keyboard_get_time_usec(kbevent)); wlr_event.keycode = libinput_event_keyboard_get_key(kbevent); - enum libinput_key_state state = + enum libinput_key_state state = libinput_event_keyboard_get_key_state(kbevent); switch (state) { case LIBINPUT_KEY_STATE_RELEASED: diff --git a/backend/libinput/pointer.c b/backend/libinput/pointer.c index 560e95b5..8a31d312 100644 --- a/backend/libinput/pointer.c +++ b/backend/libinput/pointer.c @@ -1,12 +1,12 @@ -#include #include #include +#include #include -#include #include +#include #include -#include "util/signal.h" #include "backend/libinput.h" +#include "util/signal.h" struct wlr_pointer *wlr_libinput_pointer_create( struct libinput_device *libinput_dev) { diff --git a/backend/libinput/tablet_pad.c b/backend/libinput/tablet_pad.c index e8ffc6dd..70e4c677 100644 --- a/backend/libinput/tablet_pad.c +++ b/backend/libinput/tablet_pad.c @@ -1,12 +1,12 @@ -#include #include #include +#include #include -#include #include +#include #include -#include "util/signal.h" #include "backend/libinput.h" +#include "util/signal.h" struct wlr_tablet_pad *wlr_libinput_tablet_pad_create( struct libinput_device *libinput_dev) { diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c index 0f2ea70a..4e60367f 100644 --- a/backend/libinput/tablet_tool.c +++ b/backend/libinput/tablet_tool.c @@ -1,12 +1,12 @@ -#include #include #include +#include #include -#include #include +#include #include -#include "util/signal.h" #include "backend/libinput.h" +#include "util/signal.h" struct wlr_tablet_tool *wlr_libinput_tablet_tool_create( struct libinput_device *libinput_dev) { diff --git a/backend/libinput/touch.c b/backend/libinput/touch.c index fb2b8e3f..2b87f9cd 100644 --- a/backend/libinput/touch.c +++ b/backend/libinput/touch.c @@ -1,12 +1,12 @@ -#include #include #include +#include #include -#include #include +#include #include -#include "util/signal.h" #include "backend/libinput.h" +#include "util/signal.h" struct wlr_touch *wlr_libinput_touch_create( struct libinput_device *libinput_dev) { diff --git a/backend/meson.build b/backend/meson.build index beb3841c..bac43063 100644 --- a/backend/meson.build +++ b/backend/meson.build @@ -1,7 +1,5 @@ backend_files = files( 'backend.c', - 'session/direct-ipc.c', - 'session/session.c', 'drm/atomic.c', 'drm/backend.c', 'drm/drm.c', @@ -10,8 +8,8 @@ backend_files = files( 'drm/renderer.c', 'drm/util.c', 'headless/backend.c', - 'headless/output.c', 'headless/input_device.c', + 'headless/output.c', 'libinput/backend.c', 'libinput/events.c', 'libinput/keyboard.c', @@ -20,6 +18,8 @@ backend_files = files( 'libinput/tablet_tool.c', 'libinput/touch.c', 'multi/backend.c', + 'session/direct-ipc.c', + 'session/session.c', 'wayland/backend.c', 'wayland/output.c', 'wayland/registry.c', diff --git a/backend/multi/backend.c b/backend/multi/backend.c index 1005e6b7..5cb3fbc5 100644 --- a/backend/multi/backend.c +++ b/backend/multi/backend.c @@ -4,9 +4,9 @@ #include #include #include -#include "util/signal.h" -#include "backend/multi.h" #include "backend/drm/drm.h" +#include "backend/multi.h" +#include "util/signal.h" struct subbackend_state { struct wlr_backend *backend; diff --git a/backend/session/direct-freebsd.c b/backend/session/direct-freebsd.c index ceaae2be..6e23bf1b 100644 --- a/backend/session/direct-freebsd.c +++ b/backend/session/direct-freebsd.c @@ -1,22 +1,22 @@ +#include #include -#include -#include -#include -#include +#include #include +#include +#include +#include +#include #include +#include #include -#include -#include #include -#include -#include -#include +#include +#include #include #include #include -#include "util/signal.h" #include "backend/session/direct-ipc.h" +#include "util/signal.h" const struct session_impl session_direct; diff --git a/backend/session/direct-ipc.c b/backend/session/direct-ipc.c index e7a169fa..6c69b70a 100644 --- a/backend/session/direct-ipc.c +++ b/backend/session/direct-ipc.c @@ -4,22 +4,22 @@ #define INPUT_MAJOR 0 #endif #include +#include #include #include #include -#include -#include #include #include #include #include +#include +#include +#include +#include #ifdef __linux__ #include #include #endif -#include -#include -#include #include "backend/session/direct-ipc.h" enum { DRM_MAJOR = 226 }; diff --git a/backend/session/direct.c b/backend/session/direct.c index 1f60ed23..13a26d99 100644 --- a/backend/session/direct.c +++ b/backend/session/direct.c @@ -1,22 +1,22 @@ #define _POSIX_C_SOURCE 200809L #include -#include -#include -#include -#include +#include +#include +#include +#include #include +#include +#include +#include #include #include #include -#include -#include -#include -#include +#include #include #include #include -#include "util/signal.h" #include "backend/session/direct-ipc.h" +#include "util/signal.h" enum { DRM_MAJOR = 226 }; diff --git a/backend/session/logind.c b/backend/session/logind.c index b2206e15..f0ac1e93 100644 --- a/backend/session/logind.c +++ b/backend/session/logind.c @@ -1,17 +1,17 @@ #define _POSIX_C_SOURCE 200809L #include -#include +#include +#include #include +#include #include #include -#include -#include -#include #include -#include +#include +#include #include -#include #include +#include #include #include "util/signal.h" diff --git a/backend/session/session.c b/backend/session/session.c index ac55a191..2d5d9776 100644 --- a/backend/session/session.c +++ b/backend/session/session.c @@ -1,18 +1,18 @@ #define _POSIX_C_SOURCE 200809L #include +#include #include #include #include #include #include -#include #include -#include -#include -#include #include #include +#include #include +#include +#include #include "util/signal.h" extern const struct session_impl session_logind; diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c index 60c8ede9..abb25df5 100644 --- a/backend/wayland/backend.c +++ b/backend/wayland/backend.c @@ -1,18 +1,18 @@ -#include -#include #include -#include #include #include +#include +#include +#include #include -#include -#include #include -#include #include +#include +#include +#include #include -#include "util/signal.h" #include "backend/wayland.h" +#include "util/signal.h" #include "xdg-shell-unstable-v6-client-protocol.h" static int dispatch_events(int fd, uint32_t mask, void *data) { diff --git a/backend/wayland/output.c b/backend/wayland/output.c index fed4c63a..fc40dea0 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -1,17 +1,17 @@ -#include #include +#include #include +#include #include #include -#include -#include #include +#include +#include #include -#include #include #include -#include "util/signal.h" #include "backend/wayland.h" +#include "util/signal.h" #include "xdg-shell-unstable-v6-client-protocol.h" int os_create_anonymous_file(off_t size); diff --git a/backend/wayland/registry.c b/backend/wayland/registry.c index 0dec0ec5..4aa39f09 100644 --- a/backend/wayland/registry.c +++ b/backend/wayland/registry.c @@ -6,7 +6,6 @@ #include "backend/wayland.h" #include "xdg-shell-unstable-v6-client-protocol.h" - static void xdg_shell_handle_ping(void *data, struct zxdg_shell_v6 *shell, uint32_t serial) { zxdg_shell_v6_pong(shell, serial); diff --git a/backend/wayland/wl_seat.c b/backend/wayland/wl_seat.c index f6328106..b1f7cff6 100644 --- a/backend/wayland/wl_seat.c +++ b/backend/wayland/wl_seat.c @@ -1,17 +1,17 @@ #define _XOPEN_SOURCE 500 #include -#include #include +#include #include #include -#include #include -#include #include +#include +#include #include #include -#include "util/signal.h" #include "backend/wayland.h" +#include "util/signal.h" static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface, wl_fixed_t surface_x, diff --git a/backend/x11/backend.c b/backend/x11/backend.c index 2715b366..28a4fcac 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -1,29 +1,29 @@ #define _POSIX_C_SOURCE 200112L +#include #include #include #include #include -#include #include -#include -#include -#include -#ifdef __linux__ -#include -#elif __FreeBSD__ -#include -#endif #include #include -#include -#include -#include #include #include +#include #include +#include +#include #include -#include "util/signal.h" +#include +#include +#include +#ifdef __linux__ +#include +#elif __FreeBSD__ +#include +#endif #include "backend/x11.h" +#include "util/signal.h" static struct wlr_backend_impl backend_impl; static struct wlr_output_impl output_impl; diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h index 12530da6..65db04ef 100644 --- a/include/backend/drm/drm.h +++ b/include/backend/drm/drm.h @@ -1,19 +1,17 @@ #ifndef BACKEND_DRM_DRM_H #define BACKEND_DRM_DRM_H +#include +#include #include #include #include #include -#include -#include -#include #include - -#include #include +#include #include - +#include #include "iface.h" #include "properties.h" #include "renderer.h" diff --git a/include/backend/drm/iface.h b/include/backend/drm/iface.h index 15cdf1ab..ef0e7bf8 100644 --- a/include/backend/drm/iface.h +++ b/include/backend/drm/iface.h @@ -1,10 +1,9 @@ #ifndef BACKEND_DRM_IFACE_H #define BACKEND_DRM_IFACE_H +#include #include #include - -#include #include #include diff --git a/include/backend/drm/renderer.h b/include/backend/drm/renderer.h index bf0165bc..a56a8673 100644 --- a/include/backend/drm/renderer.h +++ b/include/backend/drm/renderer.h @@ -1,12 +1,10 @@ #ifndef BACKEND_DRM_RENDERER_H #define BACKEND_DRM_RENDERER_H -#include -#include - #include #include - +#include +#include #include struct wlr_drm_backend; diff --git a/include/backend/drm/util.h b/include/backend/drm/util.h index 6818b4db..25da858f 100644 --- a/include/backend/drm/util.h +++ b/include/backend/drm/util.h @@ -2,9 +2,9 @@ #define BACKEND_DRM_UTIL_H #include +#include #include #include -#include // Calculates a more accurate refresh rate (mHz) than what mode itself provides int32_t calculate_refresh_rate(drmModeModeInfo *mode); diff --git a/include/backend/headless.h b/include/backend/headless.h index f9805bcc..e130bae1 100644 --- a/include/backend/headless.h +++ b/include/backend/headless.h @@ -1,8 +1,8 @@ #ifndef BACKEND_HEADLESS_H #define BACKEND_HEADLESS_H -#include #include +#include struct wlr_headless_backend { struct wlr_backend backend; diff --git a/include/backend/libinput.h b/include/backend/libinput.h index 6ec718c6..f828c310 100644 --- a/include/backend/libinput.h +++ b/include/backend/libinput.h @@ -1,10 +1,11 @@ #ifndef BACKEND_LIBINPUT_H #define BACKEND_LIBINPUT_H + #include #include -#include #include #include +#include #include struct wlr_libinput_backend { diff --git a/include/backend/multi.h b/include/backend/multi.h index 3363c608..c57c48f3 100644 --- a/include/backend/multi.h +++ b/include/backend/multi.h @@ -1,10 +1,10 @@ #ifndef BACKEND_MULTI_H #define BACKEND_MULTI_H +#include #include #include #include -#include struct wlr_multi_backend { struct wlr_backend backend; diff --git a/include/backend/wayland.h b/include/backend/wayland.h index 78a88f29..16c8e13b 100644 --- a/include/backend/wayland.h +++ b/include/backend/wayland.h @@ -3,13 +3,13 @@ #include #include -#include #include -#include -#include +#include +#include #include +#include +#include #include -#include struct wlr_wl_backend { struct wlr_backend backend; diff --git a/include/backend/x11.h b/include/backend/x11.h index fee39eac..c5f258c0 100644 --- a/include/backend/x11.h +++ b/include/backend/x11.h @@ -1,11 +1,11 @@ -#ifndef WLR_X11_H -#define WLR_X11_H +#ifndef BACKEND_X11_H +#define BACKEND_X11_H #include -#include -#include #include #include +#include +#include struct wlr_x11_backend; diff --git a/include/render/gles2.h b/include/render/gles2.h index 0b7032cc..797c5293 100644 --- a/include/render/gles2.h +++ b/include/render/gles2.h @@ -1,13 +1,13 @@ #ifndef RENDER_GLES2_H #define RENDER_GLES2_H -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include #include #include #include diff --git a/include/rootston/config.h b/include/rootston/config.h index 05f23b75..9926d9c2 100644 --- a/include/rootston/config.h +++ b/include/rootston/config.h @@ -1,7 +1,8 @@ -#ifndef _ROOTSTON_CONFIG_H -#define _ROOTSTON_CONFIG_H -#include +#ifndef ROOTSTON_CONFIG_H +#define ROOTSTON_CONFIG_H + #include +#include #define ROOTS_CONFIG_DEFAULT_SEAT_NAME "seat0" diff --git a/include/rootston/cursor.h b/include/rootston/cursor.h index 90d54c12..a1a466c2 100644 --- a/include/rootston/cursor.h +++ b/include/rootston/cursor.h @@ -1,5 +1,5 @@ -#ifndef _ROOTSTON_CURSOR_H -#define _ROOTSTON_CURSOR_H +#ifndef ROOTSTON_CURSOR_H +#define ROOTSTON_CURSOR_H #include "rootston/seat.h" diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h index a2121701..6572b242 100644 --- a/include/rootston/desktop.h +++ b/include/rootston/desktop.h @@ -1,22 +1,23 @@ -#ifndef _ROOTSTON_DESKTOP_H -#define _ROOTSTON_DESKTOP_H +#ifndef ROOTSTON_DESKTOP_H +#define ROOTSTON_DESKTOP_H + #include #include #include -#include -#include #include -#include -#include -#include #include +#include +#include +#include +#include #include #include -#include -#include -#include "rootston/view.h" +#include +#include +#include #include "rootston/config.h" #include "rootston/output.h" +#include "rootston/view.h" struct roots_desktop { struct wl_list views; // roots_view::link diff --git a/include/rootston/input.h b/include/rootston/input.h index d05cbb0a..4395a0f7 100644 --- a/include/rootston/input.h +++ b/include/rootston/input.h @@ -1,13 +1,14 @@ -#ifndef _ROOTSTON_INPUT_H -#define _ROOTSTON_INPUT_H +#ifndef ROOTSTON_INPUT_H +#define ROOTSTON_INPUT_H + #include -#include #include +#include #include -#include "rootston/cursor.h" #include "rootston/config.h" -#include "rootston/view.h" +#include "rootston/cursor.h" #include "rootston/server.h" +#include "rootston/view.h" struct roots_input { struct roots_config *config; diff --git a/include/rootston/keyboard.h b/include/rootston/keyboard.h index 4548f4a7..0140389a 100644 --- a/include/rootston/keyboard.h +++ b/include/rootston/keyboard.h @@ -1,5 +1,5 @@ -#ifndef _ROOTSTON_KEYBOARD_H -#define _ROOTSTON_KEYBOARD_H +#ifndef ROOTSTON_KEYBOARD_H +#define ROOTSTON_KEYBOARD_H #include #include "rootston/input.h" diff --git a/include/rootston/output.h b/include/rootston/output.h index 8396e7c5..9682e4f5 100644 --- a/include/rootston/output.h +++ b/include/rootston/output.h @@ -1,8 +1,8 @@ -#ifndef _ROOTSTON_OUTPUT_H -#define _ROOTSTON_OUTPUT_H +#ifndef ROOTSTON_OUTPUT_H +#define ROOTSTON_OUTPUT_H -#include #include +#include #include #include diff --git a/include/rootston/seat.h b/include/rootston/seat.h index cd819076..cc0293b5 100644 --- a/include/rootston/seat.h +++ b/include/rootston/seat.h @@ -1,5 +1,6 @@ -#ifndef _ROOTSTON_SEAT_H -#define _ROOTSTON_SEAT_H +#ifndef ROOTSTON_SEAT_H +#define ROOTSTON_SEAT_H + #include #include "rootston/input.h" #include "rootston/keyboard.h" diff --git a/include/rootston/server.h b/include/rootston/server.h index 0c26ea92..5f35dd90 100644 --- a/include/rootston/server.h +++ b/include/rootston/server.h @@ -1,11 +1,12 @@ #ifndef _ROOTSTON_SERVER_H #define _ROOTSTON_SERVER_H + #include -#include #include #include -#include +#include #include +#include #ifdef WLR_HAS_XWAYLAND #include #endif diff --git a/include/rootston/view.h b/include/rootston/view.h index f6968c7a..b61ac330 100644 --- a/include/rootston/view.h +++ b/include/rootston/view.h @@ -1,5 +1,5 @@ -#ifndef _ROOTSTON_VIEW_H -#define _ROOTSTON_VIEW_H +#ifndef ROOTSTON_VIEW_H +#define ROOTSTON_VIEW_H #include #include diff --git a/include/rootston/xcursor.h b/include/rootston/xcursor.h index a7d2b960..f78489a4 100644 --- a/include/rootston/xcursor.h +++ b/include/rootston/xcursor.h @@ -1,5 +1,5 @@ -#ifndef _ROOTSTON_XCURSOR_H -#define _ROOTSTON_XCURSOR_H +#ifndef ROOTSTON_XCURSOR_H +#define ROOTSTON_XCURSOR_H #include diff --git a/include/util/os-compatibility.h b/include/util/os-compatibility.h index b2ec2db9..2038025e 100644 --- a/include/util/os-compatibility.h +++ b/include/util/os-compatibility.h @@ -1,12 +1,9 @@ -#ifndef _WLR_UTIL_OS_COMPATIBILITY_H -#define _WLR_UTIL_OS_COMPATIBILITY_H +#ifndef UTIL_OS_COMPATIBILITY_H +#define UTIL_OS_COMPATIBILITY_H int os_fd_set_cloexec(int fd); - int set_cloexec_or_close(int fd); - int create_tmpfile_cloexec(char *tmpname); - int os_create_anonymous_file(off_t size); #endif diff --git a/include/util/signal.h b/include/util/signal.h index e13141d8..cc6cb525 100644 --- a/include/util/signal.h +++ b/include/util/signal.h @@ -1,5 +1,5 @@ -#ifndef WLR_UTIL_SIGNAL_H -#define WLR_UTIL_SIGNAL_H +#ifndef UTIL_SIGNAL_H +#define UTIL_SIGNAL_H #include diff --git a/include/wlr/backend/drm.h b/include/wlr/backend/drm.h index 133e4f69..90460647 100644 --- a/include/wlr/backend/drm.h +++ b/include/wlr/backend/drm.h @@ -2,8 +2,8 @@ #define WLR_BACKEND_DRM_H #include -#include #include +#include #include struct wlr_backend *wlr_drm_backend_create(struct wl_display *display, diff --git a/include/wlr/backend/libinput.h b/include/wlr/backend/libinput.h index af873628..c7cfe894 100644 --- a/include/wlr/backend/libinput.h +++ b/include/wlr/backend/libinput.h @@ -3,8 +3,8 @@ #include #include -#include #include +#include #include struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display, diff --git a/include/wlr/backend/multi.h b/include/wlr/backend/multi.h index d9914efc..2dee7403 100644 --- a/include/wlr/backend/multi.h +++ b/include/wlr/backend/multi.h @@ -5,17 +5,12 @@ #include struct wlr_backend *wlr_multi_backend_create(struct wl_display *display); - void wlr_multi_backend_add(struct wlr_backend *multi, struct wlr_backend *backend); - void wlr_multi_backend_remove(struct wlr_backend *multi, struct wlr_backend *backend); - bool wlr_backend_is_multi(struct wlr_backend *backend); - struct wlr_session *wlr_multi_get_session(struct wlr_backend *base); - bool wlr_multi_is_empty(struct wlr_backend *backend); #endif diff --git a/include/wlr/backend/session.h b/include/wlr/backend/session.h index 3242a13f..7ff9691f 100644 --- a/include/wlr/backend/session.h +++ b/include/wlr/backend/session.h @@ -1,10 +1,10 @@ #ifndef WLR_BACKEND_SESSION_H #define WLR_BACKEND_SESSION_H -#include -#include #include +#include #include +#include struct session_impl; diff --git a/include/wlr/backend/wayland.h b/include/wlr/backend/wayland.h index f89a6383..e28ffff5 100644 --- a/include/wlr/backend/wayland.h +++ b/include/wlr/backend/wayland.h @@ -1,12 +1,12 @@ #ifndef WLR_BACKEND_WAYLAND_H #define WLR_BACKEND_WAYLAND_H +#include #include #include #include #include #include -#include /** * Creates a new wlr_wl_backend. This backend will be created with no outputs; diff --git a/include/wlr/interfaces/wlr_keyboard.h b/include/wlr/interfaces/wlr_keyboard.h index 570f5721..6960ea87 100644 --- a/include/wlr/interfaces/wlr_keyboard.h +++ b/include/wlr/interfaces/wlr_keyboard.h @@ -1,8 +1,8 @@ #ifndef WLR_INTERFACES_WLR_KEYBOARD_H #define WLR_INTERFACES_WLR_KEYBOARD_H -#include #include +#include struct wlr_keyboard_impl { void (*destroy)(struct wlr_keyboard *keyboard); diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h index a01f8901..5edd1ae1 100644 --- a/include/wlr/interfaces/wlr_output.h +++ b/include/wlr/interfaces/wlr_output.h @@ -2,9 +2,9 @@ #define WLR_INTERFACES_WLR_OUTPUT_H #include +#include #include #include -#include struct wlr_output_impl { void (*enable)(struct wlr_output *output, bool enable); diff --git a/include/wlr/render.h b/include/wlr/render.h index ccc66d36..3743482b 100644 --- a/include/wlr/render.h +++ b/include/wlr/render.h @@ -1,9 +1,9 @@ #ifndef WLR_RENDER_H #define WLR_RENDER_H -#include #include #include +#include #include #include #include diff --git a/include/wlr/render/egl.h b/include/wlr/render/egl.h index 1facc6b8..97a28016 100644 --- a/include/wlr/render/egl.h +++ b/include/wlr/render/egl.h @@ -1,10 +1,10 @@ -#ifndef WLR_EGL_H -#define WLR_EGL_H +#ifndef WLR_RENDER_EGL_H +#define WLR_RENDER_EGL_H -#include #include #include #include +#include #include struct wlr_egl { diff --git a/include/wlr/render/gles2.h b/include/wlr/render/gles2.h index 25e760d5..a924a065 100644 --- a/include/wlr/render/gles2.h +++ b/include/wlr/render/gles2.h @@ -1,8 +1,8 @@ #ifndef WLR_RENDER_GLES2_H #define WLR_RENDER_GLES2_H -#include #include +#include struct wlr_egl; struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_backend *backend); diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h index b8e99898..b989e399 100644 --- a/include/wlr/render/interface.h +++ b/include/wlr/render/interface.h @@ -1,10 +1,10 @@ #ifndef WLR_RENDER_INTERFACE_H #define WLR_RENDER_INTERFACE_H -#include #include #include #include +#include #include #include #include diff --git a/include/wlr/types/wlr_cursor.h b/include/wlr/types/wlr_cursor.h index e072ca05..da010972 100644 --- a/include/wlr/types/wlr_cursor.h +++ b/include/wlr/types/wlr_cursor.h @@ -2,10 +2,10 @@ #define WLR_TYPES_WLR_CURSOR_H #include -#include -#include -#include #include +#include +#include +#include struct wlr_cursor_state; diff --git a/include/wlr/types/wlr_keyboard.h b/include/wlr/types/wlr_keyboard.h index c67cc4c2..ed0427e8 100644 --- a/include/wlr/types/wlr_keyboard.h +++ b/include/wlr/types/wlr_keyboard.h @@ -1,9 +1,9 @@ #ifndef WLR_TYPES_WLR_KEYBOARD_H #define WLR_TYPES_WLR_KEYBOARD_H -#include -#include #include +#include +#include #include #include diff --git a/include/wlr/types/wlr_list.h b/include/wlr/types/wlr_list.h index 78a30995..23bf53b7 100644 --- a/include/wlr/types/wlr_list.h +++ b/include/wlr/types/wlr_list.h @@ -1,8 +1,8 @@ -#ifndef WLR_UTIL_LIST_H -#define WLR_UTIL_LIST_H +#ifndef WLR_TYPES_WLR_LIST_H +#define WLR_TYPES_WLR_LIST_H -#include #include +#include struct wlr_list { size_t capacity; diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 8eed06fe..5c2ffee0 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -1,11 +1,11 @@ #ifndef WLR_TYPES_WLR_OUTPUT_H #define WLR_TYPES_WLR_OUTPUT_H +#include #include #include -#include -#include #include +#include struct wlr_output_mode { uint32_t flags; // enum wl_output_mode diff --git a/include/wlr/types/wlr_output_damage.h b/include/wlr/types/wlr_output_damage.h index 52cbce78..6682f942 100644 --- a/include/wlr/types/wlr_output_damage.h +++ b/include/wlr/types/wlr_output_damage.h @@ -1,8 +1,8 @@ #ifndef WLR_TYPES_WLR_OUTPUT_DAMAGE_H #define WLR_TYPES_WLR_OUTPUT_DAMAGE_H -#include #include +#include #include /** diff --git a/include/wlr/types/wlr_output_layout.h b/include/wlr/types/wlr_output_layout.h index 9187b377..7dd2b16a 100644 --- a/include/wlr/types/wlr_output_layout.h +++ b/include/wlr/types/wlr_output_layout.h @@ -1,10 +1,10 @@ #ifndef WLR_TYPES_WLR_OUTPUT_LAYOUT_H #define WLR_TYPES_WLR_OUTPUT_LAYOUT_H +#include +#include #include #include -#include -#include struct wlr_output_layout_state; diff --git a/include/wlr/types/wlr_pointer.h b/include/wlr/types/wlr_pointer.h index 3a6d2175..e7ac9b46 100644 --- a/include/wlr/types/wlr_pointer.h +++ b/include/wlr/types/wlr_pointer.h @@ -1,9 +1,9 @@ #ifndef WLR_TYPES_WLR_POINTER_H #define WLR_TYPES_WLR_POINTER_H -#include -#include #include +#include +#include struct wlr_pointer_impl; diff --git a/include/wlr/types/wlr_primary_selection.h b/include/wlr/types/wlr_primary_selection.h index da3c096a..78f23ad6 100644 --- a/include/wlr/types/wlr_primary_selection.h +++ b/include/wlr/types/wlr_primary_selection.h @@ -1,8 +1,8 @@ #ifndef WLR_TYPES_WLR_PRIMARY_SELECTION_H #define WLR_TYPES_WLR_PRIMARY_SELECTION_H -#include #include +#include struct wlr_primary_selection_device_manager { struct wl_global *global; diff --git a/include/wlr/types/wlr_screenshooter.h b/include/wlr/types/wlr_screenshooter.h index cfe7742d..680d86f0 100644 --- a/include/wlr/types/wlr_screenshooter.h +++ b/include/wlr/types/wlr_screenshooter.h @@ -1,5 +1,6 @@ -#ifndef _WLR_SCREENSHOOTER_H -#define _WLR_SCREENSHOOTER_H +#ifndef WLR_TYPES_WLR_SCREENSHOOTER_H +#define WLR_TYPES_WLR_SCREENSHOOTER_H + #include struct wlr_screenshooter { diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index ffdabd98..b03cab6e 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -1,10 +1,11 @@ #ifndef WLR_TYPES_WLR_SEAT_H #define WLR_TYPES_WLR_SEAT_H + #include -#include +#include #include #include -#include +#include /** * Contains state for a single client's bound wl_seat resource and can be used diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h index 50316abc..998b5ae5 100644 --- a/include/wlr/types/wlr_surface.h +++ b/include/wlr/types/wlr_surface.h @@ -1,9 +1,10 @@ #ifndef WLR_TYPES_WLR_SURFACE_H #define WLR_TYPES_WLR_SURFACE_H -#include + +#include #include +#include #include -#include #include #include diff --git a/include/wlr/types/wlr_tablet_pad.h b/include/wlr/types/wlr_tablet_pad.h index 51a65dd1..e70db516 100644 --- a/include/wlr/types/wlr_tablet_pad.h +++ b/include/wlr/types/wlr_tablet_pad.h @@ -1,9 +1,9 @@ #ifndef WLR_TYPES_WLR_TABLET_PAD_H #define WLR_TYPES_WLR_TABLET_PAD_H -#include -#include #include +#include +#include /* * NOTE: the wlr tablet pad implementation does not currently support tablets diff --git a/include/wlr/types/wlr_tablet_tool.h b/include/wlr/types/wlr_tablet_tool.h index c6984d4d..59e49ef8 100644 --- a/include/wlr/types/wlr_tablet_tool.h +++ b/include/wlr/types/wlr_tablet_tool.h @@ -1,9 +1,9 @@ #ifndef WLR_TYPES_TABLET_TOOL_H #define WLR_TYPES_TABLET_TOOL_H -#include -#include #include +#include +#include struct wlr_tablet_tool_impl; diff --git a/include/wlr/types/wlr_touch.h b/include/wlr/types/wlr_touch.h index 2925fd01..8ea293eb 100644 --- a/include/wlr/types/wlr_touch.h +++ b/include/wlr/types/wlr_touch.h @@ -1,8 +1,8 @@ #ifndef WLR_TYPES_WLR_TOUCH_H #define WLR_TYPES_WLR_TOUCH_H -#include #include +#include struct wlr_touch_impl; diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h index c7b1a24b..7dc746ce 100644 --- a/include/wlr/types/wlr_xdg_shell_v6.h +++ b/include/wlr/types/wlr_xdg_shell_v6.h @@ -1,9 +1,9 @@ #ifndef WLR_TYPES_WLR_XDG_SHELL_V6_H #define WLR_TYPES_WLR_XDG_SHELL_V6_H +#include #include #include -#include struct wlr_xdg_shell_v6 { struct wl_global *wl_global; diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h index c0135943..ad7ceb83 100644 --- a/include/wlr/xwayland.h +++ b/include/wlr/xwayland.h @@ -1,8 +1,8 @@ #ifndef WLR_XWAYLAND_H #define WLR_XWAYLAND_H -#include #include +#include #include #include #include diff --git a/include/wlr/xwm.h b/include/wlr/xwm.h index 35c43b18..242ff9cc 100644 --- a/include/wlr/xwm.h +++ b/include/wlr/xwm.h @@ -1,9 +1,9 @@ -#ifndef XWAYLAND_INTERNALS_H -#define XWAYLAND_INTERNALS_H +#ifndef WLR_XWM_H +#define WLR_XWM_H -#include #include #include +#include enum atom_name { WL_SURFACE_ID, diff --git a/meson.build b/meson.build index 6c8a3a8b..1cf7781a 100644 --- a/meson.build +++ b/meson.build @@ -157,16 +157,16 @@ wlroots = declare_dependency( summary = [ - '', - '----------------', - 'wlroots @0@'.format(meson.project_version()), - '', - ' libcap: @0@'.format(conf_data.get('WLR_HAS_LIBCAP', false)), - ' systemd: @0@'.format(conf_data.get('WLR_HAS_SYSTEMD', false)), - ' elogind: @0@'.format(conf_data.get('WLR_HAS_ELOGIND', false)), - ' xwayland: @0@'.format(conf_data.get('WLR_HAS_XWAYLAND', false)), - '----------------', - '' + '', + '----------------', + 'wlroots @0@'.format(meson.project_version()), + '', + ' libcap: @0@'.format(conf_data.get('WLR_HAS_LIBCAP', false)), + ' systemd: @0@'.format(conf_data.get('WLR_HAS_SYSTEMD', false)), + ' elogind: @0@'.format(conf_data.get('WLR_HAS_ELOGIND', false)), + ' xwayland: @0@'.format(conf_data.get('WLR_HAS_XWAYLAND', false)), + '----------------', + '' ] message('\n'.join(summary)) @@ -195,18 +195,18 @@ if git.found() etags = find_program('etags', required: false) if etags.found() and all_files.length() > 0 custom_target('etags', - build_by_default: true, - input: all_files, - output: 'TAGS', - command: [etags.path(), '-o', 'TAGS'] + all_files) + build_by_default: true, + input: all_files, + output: 'TAGS', + command: [etags.path(), '-o', 'TAGS'] + all_files) endif ctags = find_program('ctags', required: false) if ctags.found() and all_files.length() > 0 custom_target('ctags', - build_by_default: true, - input: all_files, - output: 'tags', - command: [ctags.path(), '-o', 'tags'] + all_files) + build_by_default: true, + input: all_files, + output: 'tags', + command: [ctags.path(), '-o', 'tags'] + all_files) endif endif diff --git a/protocol/meson.build b/protocol/meson.build index 6e9f4125..0db7c03c 100644 --- a/protocol/meson.build +++ b/protocol/meson.build @@ -24,18 +24,18 @@ protocols = [ [wl_protocol_dir, 'unstable/xdg-shell/xdg-shell-unstable-v6.xml'], 'gamma-control.xml', 'gtk-primary-selection.xml', + 'idle.xml', 'screenshooter.xml', 'server-decoration.xml', - 'idle.xml', ] client_protocols = [ [wl_protocol_dir, 'unstable/xdg-shell/xdg-shell-unstable-v6.xml'], 'gamma-control.xml', 'gtk-primary-selection.xml', + 'idle.xml', 'screenshooter.xml', 'server-decoration.xml', - 'idle.xml', ] wl_protos_src = [] diff --git a/render/egl.c b/render/egl.c index 328726ba..f1208a72 100644 --- a/render/egl.c +++ b/render/egl.c @@ -1,10 +1,10 @@ #include -#include #include #include #include -#include +#include #include +#include #include "glapi.h" // Extension documentation diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c index f57e9dae..81a932e6 100644 --- a/render/gles2/renderer.c +++ b/render/gles2/renderer.c @@ -1,10 +1,10 @@ -#include -#include #include #include #include -#include +#include +#include #include +#include #include #include #include diff --git a/render/gles2/shaders.c b/render/gles2/shaders.c index ff6fba9c..46a10248 100644 --- a/render/gles2/shaders.c +++ b/render/gles2/shaders.c @@ -1,5 +1,5 @@ -#include "render/gles2.h" #include +#include "render/gles2.h" // Colored quads const GLchar quad_vertex_src[] = diff --git a/render/gles2/texture.c b/render/gles2/texture.c index a594f23e..688a51d8 100644 --- a/render/gles2/texture.c +++ b/render/gles2/texture.c @@ -1,17 +1,17 @@ -#include -#include #include #include #include -#include +#include +#include #include +#include #include #include #include #include #include -#include "util/signal.h" #include "render/gles2.h" +#include "util/signal.h" static struct pixel_format external_pixel_format = { .wl_format = 0, diff --git a/render/gles2/util.c b/render/gles2/util.c index 9498a1cd..c291f533 100644 --- a/render/gles2/util.c +++ b/render/gles2/util.c @@ -1,6 +1,6 @@ -#include -#include #include +#include +#include #include #include "render/gles2.h" diff --git a/render/matrix.c b/render/matrix.c index fa45dd04..d5d7f49d 100644 --- a/render/matrix.c +++ b/render/matrix.c @@ -1,9 +1,9 @@ -#include #include +#include #include +#include #include #include -#include /* Obtains the index for the given row/column */ static inline int mind(int row, int col) { diff --git a/render/meson.build b/render/meson.build index 309e83cd..1a5a85b8 100644 --- a/render/meson.build +++ b/render/meson.build @@ -10,12 +10,12 @@ lib_wlr_render = static_library( 'wlr_render', files( 'egl.c', - 'matrix.c', 'gles2/pixel_format.c', 'gles2/renderer.c', 'gles2/shaders.c', 'gles2/texture.c', 'gles2/util.c', + 'matrix.c', 'wlr_renderer.c', 'wlr_texture.c', ), diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c index c8f06a64..fa6c6fc3 100644 --- a/render/wlr_renderer.c +++ b/render/wlr_renderer.c @@ -1,5 +1,5 @@ -#include #include +#include #include void wlr_renderer_init(struct wlr_renderer *renderer, diff --git a/render/wlr_texture.c b/render/wlr_texture.c index 4ce86bdd..a82a16b2 100644 --- a/render/wlr_texture.c +++ b/render/wlr_texture.c @@ -1,5 +1,5 @@ -#include #include +#include #include void wlr_texture_init(struct wlr_texture *texture, diff --git a/rootston/config.c b/rootston/config.c index 26cbd12d..e63efc0b 100644 --- a/rootston/config.c +++ b/rootston/config.c @@ -2,20 +2,20 @@ #define _POSIX_C_SOURCE 200809L #endif #include -#include -#include #include +#include +#include #include #include -#include #include +#include #include -#include #include +#include #include "rootston/config.h" +#include "rootston/ini.h" #include "rootston/input.h" #include "rootston/keyboard.h" -#include "rootston/ini.h" static void usage(const char *name, int ret) { fprintf(stderr, diff --git a/rootston/cursor.c b/rootston/cursor.c index ab32a5de..aa94daeb 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -1,16 +1,16 @@ #define _XOPEN_SOURCE 700 -#include #include +#include +#include +#include +#include #ifdef __linux__ #include #elif __FreeBSD__ #include #endif -#include -#include -#include -#include "rootston/xcursor.h" #include "rootston/cursor.h" +#include "rootston/xcursor.h" struct roots_cursor *roots_cursor_create(struct roots_seat *seat) { struct roots_cursor *cursor = calloc(1, sizeof(struct roots_cursor)); diff --git a/rootston/desktop.c b/rootston/desktop.c index 68da45e0..80ccbc25 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -1,25 +1,25 @@ #define _POSIX_C_SOURCE 199309L #include -#include -#include #include +#include +#include #include #include #include #include #include #include +#include #include #include -#include #include #include #include #include -#include "rootston/server.h" #include "rootston/seat.h" -#include "rootston/xcursor.h" +#include "rootston/server.h" #include "rootston/view.h" +#include "rootston/xcursor.h" void view_get_box(const struct roots_view *view, struct wlr_box *box) { box->x = view->x; diff --git a/rootston/input.c b/rootston/input.c index a0da2531..657b0946 100644 --- a/rootston/input.c +++ b/rootston/input.c @@ -1,16 +1,16 @@ #include #include #include +#include #include #include #include #include -#include -#include "rootston/server.h" #include "rootston/config.h" #include "rootston/input.h" #include "rootston/keyboard.h" #include "rootston/seat.h" +#include "rootston/server.h" static const char *device_type(enum wlr_input_device_type type) { switch (type) { diff --git a/rootston/keyboard.c b/rootston/keyboard.c index ddf541b4..6ec90c31 100644 --- a/rootston/keyboard.c +++ b/rootston/keyboard.c @@ -1,18 +1,18 @@ #include +#include #include #include #include -#include #include -#include -#include #include #include +#include +#include #include #include #include "rootston/input.h" -#include "rootston/seat.h" #include "rootston/keyboard.h" +#include "rootston/seat.h" static ssize_t pressed_keysyms_index(xkb_keysym_t *pressed_keysyms, xkb_keysym_t keysym) { diff --git a/rootston/main.c b/rootston/main.c index 3273c53f..5450ade2 100644 --- a/rootston/main.c +++ b/rootston/main.c @@ -3,10 +3,10 @@ #include #include #include -#include #include #include #include +#include #include #include #include "rootston/config.h" diff --git a/rootston/meson.build b/rootston/meson.build index 973f93a4..a53812e3 100644 --- a/rootston/meson.build +++ b/rootston/meson.build @@ -8,8 +8,8 @@ sources = [ 'main.c', 'output.c', 'seat.c', - 'xdg_shell_v6.c', 'wl_shell.c', + 'xdg_shell_v6.c', ] if get_option('enable_xwayland') sources += ['xwayland.c'] diff --git a/rootston/output.c b/rootston/output.c index bd2ec18d..1ea4412e 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -1,18 +1,18 @@ #define _POSIX_C_SOURCE 200809L -#include -#include -#include #include -#include +#include +#include +#include +#include #include +#include #include #include -#include #include #include -#include "rootston/server.h" -#include "rootston/output.h" #include "rootston/config.h" +#include "rootston/output.h" +#include "rootston/server.h" typedef void (*surface_iterator_func_t)(struct wlr_surface *surface, double lx, double ly, float rotation, void *data); diff --git a/rootston/seat.c b/rootston/seat.c index 0c9867ec..38c26628 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -3,14 +3,14 @@ #include #include #include +#include #include #include -#include -#include "rootston/xcursor.h" +#include "rootston/cursor.h" #include "rootston/input.h" -#include "rootston/seat.h" #include "rootston/keyboard.h" -#include "rootston/cursor.h" +#include "rootston/seat.h" +#include "rootston/xcursor.h" static void handle_keyboard_key(struct wl_listener *listener, void *data) { struct roots_keyboard *keyboard = diff --git a/rootston/wl_shell.c b/rootston/wl_shell.c index 267e2cf5..44a65cf5 100644 --- a/rootston/wl_shell.c +++ b/rootston/wl_shell.c @@ -1,14 +1,14 @@ #include -#include #include +#include #include #include #include #include #include #include "rootston/desktop.h" -#include "rootston/server.h" #include "rootston/input.h" +#include "rootston/server.h" static void popup_destroy(struct roots_view_child *child) { assert(child->destroy == popup_destroy); diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c index 9bd6f76a..8e6674ab 100644 --- a/rootston/xdg_shell_v6.c +++ b/rootston/xdg_shell_v6.c @@ -1,14 +1,14 @@ #include -#include #include +#include #include #include #include #include #include #include "rootston/desktop.h" -#include "rootston/server.h" #include "rootston/input.h" +#include "rootston/server.h" static void popup_destroy(struct roots_view_child *child) { assert(child->destroy == popup_destroy); diff --git a/rootston/xwayland.c b/rootston/xwayland.c index 36be9793..e9e0d5e0 100644 --- a/rootston/xwayland.c +++ b/rootston/xwayland.c @@ -1,12 +1,12 @@ #include -#include #include +#include #include #include #include #include -#include #include +#include #include "rootston/server.h" #include "rootston/server.h" diff --git a/types/meson.build b/types/meson.build index 9f37cc86..2731f9bc 100644 --- a/types/meson.build +++ b/types/meson.build @@ -1,18 +1,18 @@ lib_wlr_types = static_library( 'wlr_types', files( - 'wlr_data_device.c', 'wlr_box.c', 'wlr_compositor.c', 'wlr_cursor.c', + 'wlr_data_device.c', 'wlr_gamma_control.c', 'wlr_idle.c', 'wlr_input_device.c', 'wlr_keyboard.c', 'wlr_list.c', - 'wlr_output.c', 'wlr_output_damage.c', 'wlr_output_layout.c', + 'wlr_output.c', 'wlr_pointer.c', 'wlr_primary_selection.c', 'wlr_region.c', diff --git a/types/wlr_box.c b/types/wlr_box.c index 33031858..2ea743d0 100644 --- a/types/wlr_box.c +++ b/types/wlr_box.c @@ -1,7 +1,7 @@ #include -#include #include #include +#include #include #include #include diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c index bd56b0fb..925e0019 100644 --- a/types/wlr_compositor.c +++ b/types/wlr_compositor.c @@ -1,11 +1,11 @@ #include #include #include +#include +#include +#include #include #include "util/signal.h" -#include -#include -#include static void destroy_surface_listener(struct wl_listener *listener, void *data) { wl_list_remove(wl_resource_get_link(data)); diff --git a/types/wlr_cursor.c b/types/wlr_cursor.c index 4f3d8727..20acebf1 100644 --- a/types/wlr_cursor.c +++ b/types/wlr_cursor.c @@ -1,13 +1,13 @@ -#include -#include #include #include -#include -#include "util/signal.h" +#include #include -#include -#include +#include #include +#include +#include +#include +#include "util/signal.h" struct wlr_cursor_device { struct wlr_cursor *cursor; diff --git a/types/wlr_data_device.c b/types/wlr_data_device.c index 7153dd53..b8ef820b 100644 --- a/types/wlr_data_device.c +++ b/types/wlr_data_device.c @@ -1,14 +1,14 @@ #define _XOPEN_SOURCE 700 +#include #include #include #include -#include #include #include +#include +#include #include #include "util/signal.h" -#include -#include #define ALL_ACTIONS (WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY | \ WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE | \ diff --git a/types/wlr_gamma_control.c b/types/wlr_gamma_control.c index 214dfd21..861427bd 100644 --- a/types/wlr_gamma_control.c +++ b/types/wlr_gamma_control.c @@ -4,8 +4,8 @@ #include #include #include -#include "util/signal.h" #include "gamma-control-protocol.h" +#include "util/signal.h" static void resource_destroy(struct wl_client *client, struct wl_resource *resource) { diff --git a/types/wlr_idle.c b/types/wlr_idle.c index 1976004f..9eddc42b 100644 --- a/types/wlr_idle.c +++ b/types/wlr_idle.c @@ -4,8 +4,8 @@ #include #include #include -#include "util/signal.h" #include "idle-protocol.h" +#include "util/signal.h" static void idle_timeout_destroy(struct wlr_idle_timeout *timer) { wl_list_remove(&timer->input_listener.link); diff --git a/types/wlr_input_device.c b/types/wlr_input_device.c index 372b3a7b..65d4b1d6 100644 --- a/types/wlr_input_device.c +++ b/types/wlr_input_device.c @@ -2,13 +2,13 @@ #include #include #include -#include #include #include #include -#include -#include #include +#include +#include +#include #include #include "util/signal.h" diff --git a/types/wlr_keyboard.c b/types/wlr_keyboard.c index 6f09d599..5c0699ff 100644 --- a/types/wlr_keyboard.c +++ b/types/wlr_keyboard.c @@ -1,11 +1,11 @@ +#include #include #include #include #include -#include #include -#include #include +#include #include #include "util/signal.h" diff --git a/types/wlr_list.c b/types/wlr_list.c index 565a155b..2be0912a 100644 --- a/types/wlr_list.c +++ b/types/wlr_list.c @@ -1,8 +1,8 @@ +#include +#include #include #include -#include #include -#include #include #include diff --git a/types/wlr_output.c b/types/wlr_output.c index 7dcf4c78..504d0209 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -5,13 +5,13 @@ #include #include #include +#include +#include +#include #include #include #include -#include #include -#include -#include #include #include "util/signal.h" diff --git a/types/wlr_output_damage.c b/types/wlr_output_damage.c index c231a900..b3636c37 100644 --- a/types/wlr_output_damage.c +++ b/types/wlr_output_damage.c @@ -1,11 +1,11 @@ -#include #include +#include #include #include -#include "util/signal.h" #include -#include #include +#include +#include "util/signal.h" static void output_handle_destroy(struct wl_listener *listener, void *data) { struct wlr_output_damage *output_damage = diff --git a/types/wlr_output_layout.c b/types/wlr_output_layout.c index ea7b81c5..db0389bd 100644 --- a/types/wlr_output_layout.c +++ b/types/wlr_output_layout.c @@ -1,12 +1,12 @@ -#include +#include #include +#include #include -#include +#include +#include +#include #include #include "util/signal.h" -#include -#include -#include struct wlr_output_layout_state { struct wlr_box _box; // should never be read directly, use the getter diff --git a/types/wlr_pointer.c b/types/wlr_pointer.c index 04100e56..bc9efd8c 100644 --- a/types/wlr_pointer.c +++ b/types/wlr_pointer.c @@ -1,8 +1,8 @@ #include #include #include -#include #include +#include void wlr_pointer_init(struct wlr_pointer *pointer, struct wlr_pointer_impl *impl) { diff --git a/types/wlr_primary_selection.c b/types/wlr_primary_selection.c index 45d71f19..28fe63c1 100644 --- a/types/wlr_primary_selection.c +++ b/types/wlr_primary_selection.c @@ -1,9 +1,9 @@ #define _XOPEN_SOURCE 700 -#include -#include -#include #include #include +#include +#include +#include #include #include #include diff --git a/types/wlr_region.c b/types/wlr_region.c index fdf23ad2..322088b5 100644 --- a/types/wlr_region.c +++ b/types/wlr_region.c @@ -1,8 +1,8 @@ -#include -#include #include -#include #include +#include +#include +#include static void region_add(struct wl_client *client, struct wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) { diff --git a/types/wlr_screenshooter.c b/types/wlr_screenshooter.c index 74f9f602..04757fb6 100644 --- a/types/wlr_screenshooter.c +++ b/types/wlr_screenshooter.c @@ -2,10 +2,10 @@ #include #include #include -#include #include -#include +#include #include +#include #include #include "screenshooter-protocol.h" diff --git a/types/wlr_seat.c b/types/wlr_seat.c index 3ad4d81d..d60e0e0d 100644 --- a/types/wlr_seat.c +++ b/types/wlr_seat.c @@ -4,12 +4,12 @@ #include #include #include -#include +#include #include +#include +#include #include #include "util/signal.h" -#include -#include static void resource_destroy(struct wl_client *client, struct wl_resource *resource) { diff --git a/types/wlr_server_decoration.c b/types/wlr_server_decoration.c index ffa0477c..556193e2 100644 --- a/types/wlr_server_decoration.c +++ b/types/wlr_server_decoration.c @@ -1,8 +1,8 @@ #include -#include #include -#include +#include #include +#include #include #include "util/signal.h" diff --git a/types/wlr_surface.c b/types/wlr_surface.c index b761bab5..c47565c4 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -1,13 +1,13 @@ #include #include #include +#include +#include +#include +#include #include #include #include "util/signal.h" -#include -#include -#include -#include static void wlr_surface_state_reset_buffer(struct wlr_surface_state *state) { if (state->buffer) { diff --git a/types/wlr_tablet_pad.c b/types/wlr_tablet_pad.c index 07f9da10..3d25d685 100644 --- a/types/wlr_tablet_pad.c +++ b/types/wlr_tablet_pad.c @@ -1,8 +1,8 @@ #include #include #include -#include #include +#include void wlr_tablet_pad_init(struct wlr_tablet_pad *pad, struct wlr_tablet_pad_impl *impl) { diff --git a/types/wlr_tablet_tool.c b/types/wlr_tablet_tool.c index a396bb02..f46a5434 100644 --- a/types/wlr_tablet_tool.c +++ b/types/wlr_tablet_tool.c @@ -1,8 +1,8 @@ #include #include #include -#include #include +#include void wlr_tablet_tool_init(struct wlr_tablet_tool *tool, struct wlr_tablet_tool_impl *impl) { diff --git a/types/wlr_touch.c b/types/wlr_touch.c index 5db653e7..ba7ffac7 100644 --- a/types/wlr_touch.c +++ b/types/wlr_touch.c @@ -1,8 +1,8 @@ #include #include #include -#include #include +#include void wlr_touch_init(struct wlr_touch *touch, struct wlr_touch_impl *impl) { diff --git a/types/wlr_wl_shell.c b/types/wlr_wl_shell.c index e9d52cc9..85749ddd 100644 --- a/types/wlr_wl_shell.c +++ b/types/wlr_wl_shell.c @@ -1,14 +1,14 @@ #ifndef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200809L #endif -#include #include +#include +#include #include -#include -#include "util/signal.h" #include #include -#include +#include +#include "util/signal.h" static const char *wlr_wl_shell_surface_role = "wl-shell-surface"; diff --git a/types/wlr_xdg_shell_v6.c b/types/wlr_xdg_shell_v6.c index 30870d3b..eb18f022 100644 --- a/types/wlr_xdg_shell_v6.c +++ b/types/wlr_xdg_shell_v6.c @@ -6,9 +6,9 @@ #include #include #include -#include -#include #include +#include +#include #include #include "util/signal.h" #include "xdg-shell-unstable-v6-protocol.h" diff --git a/util/log.c b/util/log.c index e0b6a132..327402e6 100644 --- a/util/log.c +++ b/util/log.c @@ -3,9 +3,9 @@ #include #include #include -#include #include #include +#include #include static bool colored = true; diff --git a/util/os-compatibility.c b/util/os-compatibility.c index 98aeab3d..bd3067d2 100644 --- a/util/os-compatibility.c +++ b/util/os-compatibility.c @@ -24,13 +24,13 @@ */ #define _XOPEN_SOURCE 700 -#include -#include -#include -#include #include -#include +#include #include +#include +#include +#include +#include #include "util/os-compatibility.h" int os_fd_set_cloexec(int fd) { diff --git a/util/region.c b/util/region.c index 1bde0cb8..88e38fd2 100644 --- a/util/region.c +++ b/util/region.c @@ -1,5 +1,5 @@ -#include #include +#include #include void wlr_region_scale(pixman_region32_t *dst, pixman_region32_t *src, diff --git a/xcursor/meson.build b/xcursor/meson.build index afaab915..31040a92 100644 --- a/xcursor/meson.build +++ b/xcursor/meson.build @@ -1,8 +1,8 @@ lib_wlr_xcursor = static_library( 'wlr_xcursor', files( - 'xcursor.c', 'wlr_xcursor.c', + 'xcursor.c', ), include_directories: wlr_inc, dependencies: [egl] # header required via include/wlr/render.h diff --git a/xcursor/wlr_xcursor.c b/xcursor/wlr_xcursor.c index 2d1a38b5..7fcdbb6f 100644 --- a/xcursor/wlr_xcursor.c +++ b/xcursor/wlr_xcursor.c @@ -24,12 +24,12 @@ */ #define _XOPEN_SOURCE 500 -#include -#include +#include #include #include -#include #include +#include +#include #include "xcursor/xcursor.h" static void wlr_xcursor_destroy(struct wlr_xcursor *cursor) { diff --git a/xcursor/xcursor.c b/xcursor/xcursor.c index 8dc35a7c..32711105 100644 --- a/xcursor/xcursor.c +++ b/xcursor/xcursor.c @@ -24,11 +24,11 @@ */ #define _DEFAULT_SOURCE -#include "xcursor/xcursor.h" +#include #include #include #include -#include +#include "xcursor/xcursor.h" /* * From libXcursor/include/X11/extensions/Xcursor.h diff --git a/xwayland/selection.c b/xwayland/selection.c index 060c0baf..ffcde4d0 100644 --- a/xwayland/selection.c +++ b/xwayland/selection.c @@ -1,14 +1,14 @@ #define _XOPEN_SOURCE 700 +#include +#include #include -#include #include -#include +#include +#include +#include +#include +#include #include -#include -#include "wlr/util/log.h" -#include "wlr/types/wlr_data_device.h" -#include "wlr/types/wlr_primary_selection.h" -#include "wlr/xwm.h" static const size_t incr_chunk_size = 64 * 1024; diff --git a/xwayland/sockets.c b/xwayland/sockets.c index 2119056d..1e943b1d 100644 --- a/xwayland/sockets.c +++ b/xwayland/sockets.c @@ -3,19 +3,19 @@ // for SOCK_CLOEXEC #define __BSD_VISIBLE 1 #endif -#include +#include +#include +#include #include #include #include -#include -#include -#include -#include -#include +#include #include +#include +#include #include -#include -#include "wlr/util/log.h" +#include +#include #include "sockets.h" static const char *lock_fmt = "/tmp/.X%d-lock"; diff --git a/xwayland/xwayland.c b/xwayland/xwayland.c index 74555edb..1d935180 100644 --- a/xwayland/xwayland.c +++ b/xwayland/xwayland.c @@ -4,23 +4,23 @@ // for SOCK_CLOEXEC #define __BSD_VISIBLE 1 #endif -#include -#include -#include +#include #include #include +#include +#include +#include #include #include #include #include -#include -#include +#include #include -#include #include -#include "util/signal.h" +#include +#include #include "sockets.h" -#include "wlr/xwm.h" +#include "util/signal.h" #ifdef __FreeBSD__ static inline int clearenv(void) { diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 425188c7..10bc2e30 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -3,18 +3,18 @@ #endif #include #include -#include -#include -#include -#include #include -#include -#include -#include "util/signal.h" #include -#include +#include +#include #include +#include #include +#include +#include +#include +#include +#include "util/signal.h" #ifdef WLR_HAS_XCB_ICCCM #include -- cgit v1.2.3