Use wl_signal_emit_mutable

This commit is contained in:
Alexander Orzechowski 2022-08-18 07:16:16 -04:00
parent 013f121f45
commit ef4baea0e2
91 changed files with 365 additions and 456 deletions

View File

@ -17,7 +17,6 @@
#include "backend/backend.h" #include "backend/backend.h"
#include "backend/multi.h" #include "backend/multi.h"
#include "render/allocator/allocator.h" #include "render/allocator/allocator.h"
#include "util/signal.h"
#if WLR_HAS_DRM_BACKEND #if WLR_HAS_DRM_BACKEND
#include <wlr/backend/drm.h> #include <wlr/backend/drm.h>
@ -44,7 +43,7 @@ void wlr_backend_init(struct wlr_backend *backend,
} }
void wlr_backend_finish(struct wlr_backend *backend) { void wlr_backend_finish(struct wlr_backend *backend) {
wlr_signal_emit_safe(&backend->events.destroy, backend); wl_signal_emit_mutable(&backend->events.destroy, backend);
} }
bool wlr_backend_start(struct wlr_backend *backend) { bool wlr_backend_start(struct wlr_backend *backend) {

View File

@ -13,7 +13,6 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include <xf86drm.h> #include <xf86drm.h>
#include "backend/drm/drm.h" #include "backend/drm/drm.h"
#include "util/signal.h"
struct wlr_drm_backend *get_drm_backend_from_backend( struct wlr_drm_backend *get_drm_backend_from_backend(
struct wlr_backend *wlr_backend) { struct wlr_backend *wlr_backend) {

View File

@ -29,7 +29,6 @@
#include "render/drm_format_set.h" #include "render/drm_format_set.h"
#include "render/swapchain.h" #include "render/swapchain.h"
#include "render/wlr_renderer.h" #include "render/wlr_renderer.h"
#include "util/signal.h"
// Output state which needs a KMS commit to be applied // Output state which needs a KMS commit to be applied
static const uint32_t COMMIT_OUTPUT_STATE = static const uint32_t COMMIT_OUTPUT_STATE =
@ -1411,7 +1410,7 @@ void scan_drm_connectors(struct wlr_drm_backend *drm,
struct wlr_drm_connector *conn = new_outputs[i]; struct wlr_drm_connector *conn = new_outputs[i];
wlr_drm_conn_log(conn, WLR_INFO, "Requesting modeset"); wlr_drm_conn_log(conn, WLR_INFO, "Requesting modeset");
wlr_signal_emit_safe(&drm->backend.events.new_output, wl_signal_emit_mutable(&drm->backend.events.new_output,
&conn->output); &conn->output);
} }
} }
@ -1664,7 +1663,7 @@ void wlr_drm_lease_terminate(struct wlr_drm_lease *lease) {
void drm_lease_destroy(struct wlr_drm_lease *lease) { void drm_lease_destroy(struct wlr_drm_lease *lease) {
struct wlr_drm_backend *drm = lease->backend; struct wlr_drm_backend *drm = lease->backend;
wlr_signal_emit_safe(&lease->events.destroy, NULL); wl_signal_emit_mutable(&lease->events.destroy, NULL);
struct wlr_drm_connector *conn; struct wlr_drm_connector *conn;
wl_list_for_each(conn, &drm->outputs, link) { wl_list_for_each(conn, &drm->outputs, link) {

View File

@ -3,7 +3,6 @@
#include <wlr/interfaces/wlr_output.h> #include <wlr/interfaces/wlr_output.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "backend/headless.h" #include "backend/headless.h"
#include "util/signal.h"
struct wlr_headless_backend *headless_backend_from_backend( struct wlr_headless_backend *headless_backend_from_backend(
struct wlr_backend *wlr_backend) { struct wlr_backend *wlr_backend) {
@ -20,7 +19,7 @@ static bool backend_start(struct wlr_backend *wlr_backend) {
wl_list_for_each(output, &backend->outputs, link) { wl_list_for_each(output, &backend->outputs, link) {
wl_event_source_timer_update(output->frame_timer, output->frame_delay); wl_event_source_timer_update(output->frame_timer, output->frame_delay);
wlr_output_update_enabled(&output->wlr_output, true); wlr_output_update_enabled(&output->wlr_output, true);
wlr_signal_emit_safe(&backend->backend.events.new_output, wl_signal_emit_mutable(&backend->backend.events.new_output,
&output->wlr_output); &output->wlr_output);
} }

View File

@ -4,7 +4,6 @@
#include <wlr/interfaces/wlr_output.h> #include <wlr/interfaces/wlr_output.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "backend/headless.h" #include "backend/headless.h"
#include "util/signal.h"
static const uint32_t SUPPORTED_OUTPUT_STATE = static const uint32_t SUPPORTED_OUTPUT_STATE =
WLR_OUTPUT_STATE_BACKEND_OPTIONAL | WLR_OUTPUT_STATE_BACKEND_OPTIONAL |
@ -134,7 +133,7 @@ struct wlr_output *wlr_headless_add_output(struct wlr_backend *wlr_backend,
if (backend->started) { if (backend->started) {
wl_event_source_timer_update(output->frame_timer, output->frame_delay); wl_event_source_timer_update(output->frame_timer, output->frame_delay);
wlr_output_update_enabled(wlr_output, true); wlr_output_update_enabled(wlr_output, true);
wlr_signal_emit_safe(&backend->backend.events.new_output, wlr_output); wl_signal_emit_mutable(&backend->backend.events.new_output, wlr_output);
} }
return wlr_output; return wlr_output;

View File

@ -6,7 +6,6 @@
#include <wlr/backend/session.h> #include <wlr/backend/session.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "backend/libinput.h" #include "backend/libinput.h"
#include "util/signal.h"
static struct wlr_libinput_backend *get_libinput_backend_from_backend( static struct wlr_libinput_backend *get_libinput_backend_from_backend(
struct wlr_backend *wlr_backend) { struct wlr_backend *wlr_backend) {

View File

@ -11,7 +11,6 @@
#include <wlr/interfaces/wlr_switch.h> #include <wlr/interfaces/wlr_switch.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "backend/libinput.h" #include "backend/libinput.h"
#include "util/signal.h"
void destroy_libinput_input_device(struct wlr_libinput_input_device *dev) { void destroy_libinput_input_device(struct wlr_libinput_input_device *dev) {
if (dev->keyboard.impl) { if (dev->keyboard.impl) {
@ -87,7 +86,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
libinput_dev, LIBINPUT_DEVICE_CAP_KEYBOARD)) { libinput_dev, LIBINPUT_DEVICE_CAP_KEYBOARD)) {
init_device_keyboard(dev); init_device_keyboard(dev);
wlr_signal_emit_safe(&backend->backend.events.new_input, wl_signal_emit_mutable(&backend->backend.events.new_input,
&dev->keyboard.base); &dev->keyboard.base);
} }
@ -95,35 +94,35 @@ static void handle_device_added(struct wlr_libinput_backend *backend,
libinput_dev, LIBINPUT_DEVICE_CAP_POINTER)) { libinput_dev, LIBINPUT_DEVICE_CAP_POINTER)) {
init_device_pointer(dev); init_device_pointer(dev);
wlr_signal_emit_safe(&backend->backend.events.new_input, wl_signal_emit_mutable(&backend->backend.events.new_input,
&dev->pointer.base); &dev->pointer.base);
} }
if (libinput_device_has_capability( if (libinput_device_has_capability(
libinput_dev, LIBINPUT_DEVICE_CAP_SWITCH)) { libinput_dev, LIBINPUT_DEVICE_CAP_SWITCH)) {
init_device_switch(dev); init_device_switch(dev);
wlr_signal_emit_safe(&backend->backend.events.new_input, wl_signal_emit_mutable(&backend->backend.events.new_input,
&dev->switch_device.base); &dev->switch_device.base);
} }
if (libinput_device_has_capability( if (libinput_device_has_capability(
libinput_dev, LIBINPUT_DEVICE_CAP_TOUCH)) { libinput_dev, LIBINPUT_DEVICE_CAP_TOUCH)) {
init_device_touch(dev); init_device_touch(dev);
wlr_signal_emit_safe(&backend->backend.events.new_input, wl_signal_emit_mutable(&backend->backend.events.new_input,
&dev->touch.base); &dev->touch.base);
} }
if (libinput_device_has_capability(libinput_dev, if (libinput_device_has_capability(libinput_dev,
LIBINPUT_DEVICE_CAP_TABLET_TOOL)) { LIBINPUT_DEVICE_CAP_TABLET_TOOL)) {
init_device_tablet(dev); init_device_tablet(dev);
wlr_signal_emit_safe(&backend->backend.events.new_input, wl_signal_emit_mutable(&backend->backend.events.new_input,
&dev->tablet.base); &dev->tablet.base);
} }
if (libinput_device_has_capability( if (libinput_device_has_capability(
libinput_dev, LIBINPUT_DEVICE_CAP_TABLET_PAD)) { libinput_dev, LIBINPUT_DEVICE_CAP_TABLET_PAD)) {
init_device_tablet_pad(dev); init_device_tablet_pad(dev);
wlr_signal_emit_safe(&backend->backend.events.new_input, wl_signal_emit_mutable(&backend->backend.events.new_input,
&dev->tablet_pad.base); &dev->tablet_pad.base);
} }

View File

@ -2,7 +2,6 @@
#include <libinput.h> #include <libinput.h>
#include <wlr/interfaces/wlr_pointer.h> #include <wlr/interfaces/wlr_pointer.h>
#include "backend/libinput.h" #include "backend/libinput.h"
#include "util/signal.h"
const struct wlr_pointer_impl libinput_pointer_impl = { const struct wlr_pointer_impl libinput_pointer_impl = {
.name = "libinput-pointer", .name = "libinput-pointer",
@ -37,8 +36,8 @@ void handle_pointer_motion(struct libinput_event *event,
wlr_event.delta_y = libinput_event_pointer_get_dy(pevent); wlr_event.delta_y = libinput_event_pointer_get_dy(pevent);
wlr_event.unaccel_dx = libinput_event_pointer_get_dx_unaccelerated(pevent); wlr_event.unaccel_dx = libinput_event_pointer_get_dx_unaccelerated(pevent);
wlr_event.unaccel_dy = libinput_event_pointer_get_dy_unaccelerated(pevent); wlr_event.unaccel_dy = libinput_event_pointer_get_dy_unaccelerated(pevent);
wlr_signal_emit_safe(&pointer->events.motion, &wlr_event); wl_signal_emit_mutable(&pointer->events.motion, &wlr_event);
wlr_signal_emit_safe(&pointer->events.frame, pointer); wl_signal_emit_mutable(&pointer->events.frame, pointer);
} }
void handle_pointer_motion_abs(struct libinput_event *event, void handle_pointer_motion_abs(struct libinput_event *event,
@ -51,8 +50,8 @@ void handle_pointer_motion_abs(struct libinput_event *event,
usec_to_msec(libinput_event_pointer_get_time_usec(pevent)); usec_to_msec(libinput_event_pointer_get_time_usec(pevent));
wlr_event.x = libinput_event_pointer_get_absolute_x_transformed(pevent, 1); wlr_event.x = libinput_event_pointer_get_absolute_x_transformed(pevent, 1);
wlr_event.y = libinput_event_pointer_get_absolute_y_transformed(pevent, 1); wlr_event.y = libinput_event_pointer_get_absolute_y_transformed(pevent, 1);
wlr_signal_emit_safe(&pointer->events.motion_absolute, &wlr_event); wl_signal_emit_mutable(&pointer->events.motion_absolute, &wlr_event);
wlr_signal_emit_safe(&pointer->events.frame, pointer); wl_signal_emit_mutable(&pointer->events.frame, pointer);
} }
void handle_pointer_button(struct libinput_event *event, void handle_pointer_button(struct libinput_event *event,
@ -72,8 +71,8 @@ void handle_pointer_button(struct libinput_event *event,
wlr_event.state = WLR_BUTTON_RELEASED; wlr_event.state = WLR_BUTTON_RELEASED;
break; break;
} }
wlr_signal_emit_safe(&pointer->events.button, &wlr_event); wl_signal_emit_mutable(&pointer->events.button, &wlr_event);
wlr_signal_emit_safe(&pointer->events.frame, pointer); wl_signal_emit_mutable(&pointer->events.frame, pointer);
} }
void handle_pointer_axis(struct libinput_event *event, void handle_pointer_axis(struct libinput_event *event,
@ -120,9 +119,9 @@ void handle_pointer_axis(struct libinput_event *event,
wlr_event.delta_discrete = wlr_event.delta_discrete =
libinput_event_pointer_get_axis_value_discrete(pevent, axes[i]); libinput_event_pointer_get_axis_value_discrete(pevent, axes[i]);
wlr_event.delta_discrete *= WLR_POINTER_AXIS_DISCRETE_STEP; wlr_event.delta_discrete *= WLR_POINTER_AXIS_DISCRETE_STEP;
wlr_signal_emit_safe(&pointer->events.axis, &wlr_event); wl_signal_emit_mutable(&pointer->events.axis, &wlr_event);
} }
wlr_signal_emit_safe(&pointer->events.frame, pointer); wl_signal_emit_mutable(&pointer->events.frame, pointer);
} }
#if LIBINPUT_HAS_SCROLL_VALUE120 #if LIBINPUT_HAS_SCROLL_VALUE120
@ -158,9 +157,9 @@ void handle_pointer_axis_value120(struct libinput_event *event,
wlr_event.delta_discrete = wlr_event.delta_discrete =
libinput_event_pointer_get_scroll_value_v120(pevent, axes[i]); libinput_event_pointer_get_scroll_value_v120(pevent, axes[i]);
} }
wlr_signal_emit_safe(&pointer->events.axis, &wlr_event); wl_signal_emit_mutable(&pointer->events.axis, &wlr_event);
} }
wlr_signal_emit_safe(&pointer->events.frame, pointer); wl_signal_emit_mutable(&pointer->events.frame, pointer);
} }
#endif #endif
@ -174,7 +173,7 @@ void handle_pointer_swipe_begin(struct libinput_event *event,
usec_to_msec(libinput_event_gesture_get_time_usec(gevent)), usec_to_msec(libinput_event_gesture_get_time_usec(gevent)),
.fingers = libinput_event_gesture_get_finger_count(gevent), .fingers = libinput_event_gesture_get_finger_count(gevent),
}; };
wlr_signal_emit_safe(&pointer->events.swipe_begin, &wlr_event); wl_signal_emit_mutable(&pointer->events.swipe_begin, &wlr_event);
} }
void handle_pointer_swipe_update(struct libinput_event *event, void handle_pointer_swipe_update(struct libinput_event *event,
@ -189,7 +188,7 @@ void handle_pointer_swipe_update(struct libinput_event *event,
.dx = libinput_event_gesture_get_dx(gevent), .dx = libinput_event_gesture_get_dx(gevent),
.dy = libinput_event_gesture_get_dy(gevent), .dy = libinput_event_gesture_get_dy(gevent),
}; };
wlr_signal_emit_safe(&pointer->events.swipe_update, &wlr_event); wl_signal_emit_mutable(&pointer->events.swipe_update, &wlr_event);
} }
void handle_pointer_swipe_end(struct libinput_event *event, void handle_pointer_swipe_end(struct libinput_event *event,
@ -202,7 +201,7 @@ void handle_pointer_swipe_end(struct libinput_event *event,
usec_to_msec(libinput_event_gesture_get_time_usec(gevent)), usec_to_msec(libinput_event_gesture_get_time_usec(gevent)),
.cancelled = libinput_event_gesture_get_cancelled(gevent), .cancelled = libinput_event_gesture_get_cancelled(gevent),
}; };
wlr_signal_emit_safe(&pointer->events.swipe_end, &wlr_event); wl_signal_emit_mutable(&pointer->events.swipe_end, &wlr_event);
} }
void handle_pointer_pinch_begin(struct libinput_event *event, void handle_pointer_pinch_begin(struct libinput_event *event,
@ -215,7 +214,7 @@ void handle_pointer_pinch_begin(struct libinput_event *event,
usec_to_msec(libinput_event_gesture_get_time_usec(gevent)), usec_to_msec(libinput_event_gesture_get_time_usec(gevent)),
.fingers = libinput_event_gesture_get_finger_count(gevent), .fingers = libinput_event_gesture_get_finger_count(gevent),
}; };
wlr_signal_emit_safe(&pointer->events.pinch_begin, &wlr_event); wl_signal_emit_mutable(&pointer->events.pinch_begin, &wlr_event);
} }
void handle_pointer_pinch_update(struct libinput_event *event, void handle_pointer_pinch_update(struct libinput_event *event,
@ -232,7 +231,7 @@ void handle_pointer_pinch_update(struct libinput_event *event,
.scale = libinput_event_gesture_get_scale(gevent), .scale = libinput_event_gesture_get_scale(gevent),
.rotation = libinput_event_gesture_get_angle_delta(gevent), .rotation = libinput_event_gesture_get_angle_delta(gevent),
}; };
wlr_signal_emit_safe(&pointer->events.pinch_update, &wlr_event); wl_signal_emit_mutable(&pointer->events.pinch_update, &wlr_event);
} }
void handle_pointer_pinch_end(struct libinput_event *event, void handle_pointer_pinch_end(struct libinput_event *event,
@ -245,7 +244,7 @@ void handle_pointer_pinch_end(struct libinput_event *event,
usec_to_msec(libinput_event_gesture_get_time_usec(gevent)), usec_to_msec(libinput_event_gesture_get_time_usec(gevent)),
.cancelled = libinput_event_gesture_get_cancelled(gevent), .cancelled = libinput_event_gesture_get_cancelled(gevent),
}; };
wlr_signal_emit_safe(&pointer->events.pinch_end, &wlr_event); wl_signal_emit_mutable(&pointer->events.pinch_end, &wlr_event);
} }
void handle_pointer_hold_begin(struct libinput_event *event, void handle_pointer_hold_begin(struct libinput_event *event,
@ -258,7 +257,7 @@ void handle_pointer_hold_begin(struct libinput_event *event,
usec_to_msec(libinput_event_gesture_get_time_usec(gevent)), usec_to_msec(libinput_event_gesture_get_time_usec(gevent)),
.fingers = libinput_event_gesture_get_finger_count(gevent), .fingers = libinput_event_gesture_get_finger_count(gevent),
}; };
wlr_signal_emit_safe(&pointer->events.hold_begin, &wlr_event); wl_signal_emit_mutable(&pointer->events.hold_begin, &wlr_event);
} }
void handle_pointer_hold_end(struct libinput_event *event, void handle_pointer_hold_end(struct libinput_event *event,
@ -271,5 +270,5 @@ void handle_pointer_hold_end(struct libinput_event *event,
usec_to_msec(libinput_event_gesture_get_time_usec(gevent)), usec_to_msec(libinput_event_gesture_get_time_usec(gevent)),
.cancelled = libinput_event_gesture_get_cancelled(gevent), .cancelled = libinput_event_gesture_get_cancelled(gevent),
}; };
wlr_signal_emit_safe(&pointer->events.hold_end, &wlr_event); wl_signal_emit_mutable(&pointer->events.hold_end, &wlr_event);
} }

View File

@ -2,7 +2,6 @@
#include <libinput.h> #include <libinput.h>
#include <wlr/interfaces/wlr_switch.h> #include <wlr/interfaces/wlr_switch.h>
#include "backend/libinput.h" #include "backend/libinput.h"
#include "util/signal.h"
const struct wlr_switch_impl libinput_switch_impl = { const struct wlr_switch_impl libinput_switch_impl = {
.name = "libinput-switch", .name = "libinput-switch",
@ -48,5 +47,5 @@ void handle_switch_toggle(struct libinput_event *event,
} }
wlr_event.time_msec = wlr_event.time_msec =
usec_to_msec(libinput_event_switch_get_time_usec(sevent)); usec_to_msec(libinput_event_switch_get_time_usec(sevent));
wlr_signal_emit_safe(&wlr_switch->events.toggle, &wlr_event); wl_signal_emit_mutable(&wlr_switch->events.toggle, &wlr_event);
} }

View File

@ -6,7 +6,6 @@
#include <wlr/interfaces/wlr_tablet_pad.h> #include <wlr/interfaces/wlr_tablet_pad.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "backend/libinput.h" #include "backend/libinput.h"
#include "util/signal.h"
const struct wlr_tablet_pad_impl libinput_tablet_pad_impl = { const struct wlr_tablet_pad_impl libinput_tablet_pad_impl = {
.name = "libinput-tablet-pad", .name = "libinput-tablet-pad",
@ -160,7 +159,7 @@ void handle_tablet_pad_button(struct libinput_event *event,
wlr_event.state = WLR_BUTTON_RELEASED; wlr_event.state = WLR_BUTTON_RELEASED;
break; break;
} }
wlr_signal_emit_safe(&tablet_pad->events.button, &wlr_event); wl_signal_emit_mutable(&tablet_pad->events.button, &wlr_event);
} }
void handle_tablet_pad_ring(struct libinput_event *event, void handle_tablet_pad_ring(struct libinput_event *event,
@ -181,7 +180,7 @@ void handle_tablet_pad_ring(struct libinput_event *event,
wlr_event.source = WLR_TABLET_PAD_RING_SOURCE_FINGER; wlr_event.source = WLR_TABLET_PAD_RING_SOURCE_FINGER;
break; break;
} }
wlr_signal_emit_safe(&tablet_pad->events.ring, &wlr_event); wl_signal_emit_mutable(&tablet_pad->events.ring, &wlr_event);
} }
void handle_tablet_pad_strip(struct libinput_event *event, void handle_tablet_pad_strip(struct libinput_event *event,
@ -202,5 +201,5 @@ void handle_tablet_pad_strip(struct libinput_event *event,
wlr_event.source = WLR_TABLET_PAD_STRIP_SOURCE_FINGER; wlr_event.source = WLR_TABLET_PAD_STRIP_SOURCE_FINGER;
break; break;
} }
wlr_signal_emit_safe(&tablet_pad->events.strip, &wlr_event); wl_signal_emit_mutable(&tablet_pad->events.strip, &wlr_event);
} }

View File

@ -6,7 +6,6 @@
#include <wlr/interfaces/wlr_tablet_tool.h> #include <wlr/interfaces/wlr_tablet_tool.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "backend/libinput.h" #include "backend/libinput.h"
#include "util/signal.h"
struct tablet_tool { struct tablet_tool {
struct wlr_tablet_tool wlr_tool; struct wlr_tablet_tool wlr_tool;
@ -36,7 +35,7 @@ void init_device_tablet(struct wlr_libinput_input_device *dev) {
} }
static void tool_destroy(struct tablet_tool *tool) { static void tool_destroy(struct tablet_tool *tool) {
wlr_signal_emit_safe(&tool->wlr_tool.events.destroy, &tool->wlr_tool); wl_signal_emit_mutable(&tool->wlr_tool.events.destroy, &tool->wlr_tool);
libinput_tablet_tool_unref(tool->handle); libinput_tablet_tool_unref(tool->handle);
libinput_tablet_tool_set_user_data(tool->handle, NULL); libinput_tablet_tool_set_user_data(tool->handle, NULL);
wl_list_remove(&tool->link); wl_list_remove(&tool->link);
@ -173,7 +172,7 @@ void handle_tablet_tool_axis(struct libinput_event *event,
wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_WHEEL; wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_WHEEL;
wlr_event.wheel_delta = libinput_event_tablet_tool_get_wheel_delta(tevent); wlr_event.wheel_delta = libinput_event_tablet_tool_get_wheel_delta(tevent);
} }
wlr_signal_emit_safe(&wlr_tablet->events.axis, &wlr_event); wl_signal_emit_mutable(&wlr_tablet->events.axis, &wlr_event);
} }
void handle_tablet_tool_proximity(struct libinput_event *event, void handle_tablet_tool_proximity(struct libinput_event *event,
@ -200,7 +199,7 @@ void handle_tablet_tool_proximity(struct libinput_event *event,
wlr_event.state = WLR_TABLET_TOOL_PROXIMITY_IN; wlr_event.state = WLR_TABLET_TOOL_PROXIMITY_IN;
break; break;
} }
wlr_signal_emit_safe(&wlr_tablet->events.proximity, &wlr_event); wl_signal_emit_mutable(&wlr_tablet->events.proximity, &wlr_event);
if (libinput_event_tablet_tool_get_proximity_state(tevent) == if (libinput_event_tablet_tool_get_proximity_state(tevent) ==
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN) { LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN) {
@ -242,7 +241,7 @@ void handle_tablet_tool_tip(struct libinput_event *event,
wlr_event.state = WLR_TABLET_TOOL_TIP_DOWN; wlr_event.state = WLR_TABLET_TOOL_TIP_DOWN;
break; break;
} }
wlr_signal_emit_safe(&wlr_tablet->events.tip, &wlr_event); wl_signal_emit_mutable(&wlr_tablet->events.tip, &wlr_event);
} }
void handle_tablet_tool_button(struct libinput_event *event, void handle_tablet_tool_button(struct libinput_event *event,
@ -268,5 +267,5 @@ void handle_tablet_tool_button(struct libinput_event *event,
wlr_event.state = WLR_BUTTON_PRESSED; wlr_event.state = WLR_BUTTON_PRESSED;
break; break;
} }
wlr_signal_emit_safe(&wlr_tablet->events.button, &wlr_event); wl_signal_emit_mutable(&wlr_tablet->events.button, &wlr_event);
} }

View File

@ -2,7 +2,6 @@
#include <libinput.h> #include <libinput.h>
#include <wlr/interfaces/wlr_touch.h> #include <wlr/interfaces/wlr_touch.h>
#include "backend/libinput.h" #include "backend/libinput.h"
#include "util/signal.h"
const struct wlr_touch_impl libinput_touch_impl = { const struct wlr_touch_impl libinput_touch_impl = {
.name = "libinput-touch", .name = "libinput-touch",
@ -39,7 +38,7 @@ void handle_touch_down(struct libinput_event *event,
wlr_event.touch_id = libinput_event_touch_get_seat_slot(tevent); wlr_event.touch_id = libinput_event_touch_get_seat_slot(tevent);
wlr_event.x = libinput_event_touch_get_x_transformed(tevent, 1); wlr_event.x = libinput_event_touch_get_x_transformed(tevent, 1);
wlr_event.y = libinput_event_touch_get_y_transformed(tevent, 1); wlr_event.y = libinput_event_touch_get_y_transformed(tevent, 1);
wlr_signal_emit_safe(&touch->events.down, &wlr_event); wl_signal_emit_mutable(&touch->events.down, &wlr_event);
} }
void handle_touch_up(struct libinput_event *event, void handle_touch_up(struct libinput_event *event,
@ -51,7 +50,7 @@ void handle_touch_up(struct libinput_event *event,
wlr_event.time_msec = wlr_event.time_msec =
usec_to_msec(libinput_event_touch_get_time_usec(tevent)); usec_to_msec(libinput_event_touch_get_time_usec(tevent));
wlr_event.touch_id = libinput_event_touch_get_seat_slot(tevent); wlr_event.touch_id = libinput_event_touch_get_seat_slot(tevent);
wlr_signal_emit_safe(&touch->events.up, &wlr_event); wl_signal_emit_mutable(&touch->events.up, &wlr_event);
} }
void handle_touch_motion(struct libinput_event *event, void handle_touch_motion(struct libinput_event *event,
@ -65,7 +64,7 @@ void handle_touch_motion(struct libinput_event *event,
wlr_event.touch_id = libinput_event_touch_get_seat_slot(tevent); wlr_event.touch_id = libinput_event_touch_get_seat_slot(tevent);
wlr_event.x = libinput_event_touch_get_x_transformed(tevent, 1); wlr_event.x = libinput_event_touch_get_x_transformed(tevent, 1);
wlr_event.y = libinput_event_touch_get_y_transformed(tevent, 1); wlr_event.y = libinput_event_touch_get_y_transformed(tevent, 1);
wlr_signal_emit_safe(&touch->events.motion, &wlr_event); wl_signal_emit_mutable(&touch->events.motion, &wlr_event);
} }
void handle_touch_cancel(struct libinput_event *event, void handle_touch_cancel(struct libinput_event *event,
@ -77,10 +76,10 @@ void handle_touch_cancel(struct libinput_event *event,
wlr_event.time_msec = wlr_event.time_msec =
usec_to_msec(libinput_event_touch_get_time_usec(tevent)); usec_to_msec(libinput_event_touch_get_time_usec(tevent));
wlr_event.touch_id = libinput_event_touch_get_seat_slot(tevent); wlr_event.touch_id = libinput_event_touch_get_seat_slot(tevent);
wlr_signal_emit_safe(&touch->events.cancel, &wlr_event); wl_signal_emit_mutable(&touch->events.cancel, &wlr_event);
} }
void handle_touch_frame(struct libinput_event *event, void handle_touch_frame(struct libinput_event *event,
struct wlr_touch *touch) { struct wlr_touch *touch) {
wlr_signal_emit_safe(&touch->events.frame, NULL); wl_signal_emit_mutable(&touch->events.frame, NULL);
} }

View File

@ -9,7 +9,6 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "backend/backend.h" #include "backend/backend.h"
#include "backend/multi.h" #include "backend/multi.h"
#include "util/signal.h"
struct subbackend_state { struct subbackend_state {
struct wlr_backend *backend; struct wlr_backend *backend;
@ -161,13 +160,13 @@ bool wlr_backend_is_multi(struct wlr_backend *b) {
static void new_input_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, struct subbackend_state *state = wl_container_of(listener,
state, new_input); state, new_input);
wlr_signal_emit_safe(&state->container->events.new_input, data); wl_signal_emit_mutable(&state->container->events.new_input, data);
} }
static void new_output_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, struct subbackend_state *state = wl_container_of(listener,
state, new_output); state, new_output);
wlr_signal_emit_safe(&state->container->events.new_output, data); wl_signal_emit_mutable(&state->container->events.new_output, data);
} }
static void handle_subbackend_destroy(struct wl_listener *listener, static void handle_subbackend_destroy(struct wl_listener *listener,
@ -218,7 +217,7 @@ bool wlr_multi_backend_add(struct wlr_backend *_multi,
wl_signal_add(&backend->events.new_output, &sub->new_output); wl_signal_add(&backend->events.new_output, &sub->new_output);
sub->new_output.notify = new_output_reemit; sub->new_output.notify = new_output_reemit;
wlr_signal_emit_safe(&multi->events.backend_add, backend); wl_signal_emit_mutable(&multi->events.backend_add, backend);
return true; return true;
} }
@ -230,7 +229,7 @@ void wlr_multi_backend_remove(struct wlr_backend *_multi,
multi_backend_get_subbackend(multi, backend); multi_backend_get_subbackend(multi, backend);
if (sub) { if (sub) {
wlr_signal_emit_safe(&multi->events.backend_remove, backend); wl_signal_emit_mutable(&multi->events.backend_remove, backend);
subbackend_state_destroy(sub); subbackend_state_destroy(sub);
} }
} }

View File

@ -17,7 +17,6 @@
#include <xf86drm.h> #include <xf86drm.h>
#include <xf86drmMode.h> #include <xf86drmMode.h>
#include "backend/session/session.h" #include "backend/session/session.h"
#include "util/signal.h"
#include <libseat.h> #include <libseat.h>
@ -26,13 +25,13 @@
static void handle_enable_seat(struct libseat *seat, void *data) { static void handle_enable_seat(struct libseat *seat, void *data) {
struct wlr_session *session = data; struct wlr_session *session = data;
session->active = true; session->active = true;
wlr_signal_emit_safe(&session->events.active, NULL); wl_signal_emit_mutable(&session->events.active, NULL);
} }
static void handle_disable_seat(struct libseat *seat, void *data) { static void handle_disable_seat(struct libseat *seat, void *data) {
struct wlr_session *session = data; struct wlr_session *session = data;
session->active = false; session->active = false;
wlr_signal_emit_safe(&session->events.active, NULL); wl_signal_emit_mutable(&session->events.active, NULL);
libseat_disable_seat(session->seat_handle); libseat_disable_seat(session->seat_handle);
} }
@ -198,7 +197,7 @@ static int handle_udev_event(int fd, uint32_t mask, void *data) {
struct wlr_session_add_event event = { struct wlr_session_add_event event = {
.path = devnode, .path = devnode,
}; };
wlr_signal_emit_safe(&session->events.add_drm_card, &event); wl_signal_emit_mutable(&session->events.add_drm_card, &event);
} else if (strcmp(action, "change") == 0 || strcmp(action, "remove") == 0) { } else if (strcmp(action, "change") == 0 || strcmp(action, "remove") == 0) {
dev_t devnum = udev_device_get_devnum(udev_dev); dev_t devnum = udev_device_get_devnum(udev_dev);
struct wlr_device *dev; struct wlr_device *dev;
@ -211,10 +210,10 @@ static int handle_udev_event(int fd, uint32_t mask, void *data) {
wlr_log(WLR_DEBUG, "DRM device %s changed", sysname); wlr_log(WLR_DEBUG, "DRM device %s changed", sysname);
struct wlr_device_change_event event = {0}; struct wlr_device_change_event event = {0};
read_udev_change_event(&event, udev_dev); read_udev_change_event(&event, udev_dev);
wlr_signal_emit_safe(&dev->events.change, &event); wl_signal_emit_mutable(&dev->events.change, &event);
} else if (strcmp(action, "remove") == 0) { } else if (strcmp(action, "remove") == 0) {
wlr_log(WLR_DEBUG, "DRM device %s removed", sysname); wlr_log(WLR_DEBUG, "DRM device %s removed", sysname);
wlr_signal_emit_safe(&dev->events.remove, NULL); wl_signal_emit_mutable(&dev->events.remove, NULL);
} else { } else {
assert(0); assert(0);
} }
@ -298,7 +297,7 @@ void wlr_session_destroy(struct wlr_session *session) {
return; return;
} }
wlr_signal_emit_safe(&session->events.destroy, session); wl_signal_emit_mutable(&session->events.destroy, session);
wl_list_remove(&session->display_destroy.link); wl_list_remove(&session->display_destroy.link);
wl_event_source_remove(session->udev_event); wl_event_source_remove(session->udev_event);

View File

@ -19,7 +19,6 @@
#include "backend/wayland.h" #include "backend/wayland.h"
#include "render/drm_format_set.h" #include "render/drm_format_set.h"
#include "render/pixel_format.h" #include "render/pixel_format.h"
#include "util/signal.h"
#include "drm-client-protocol.h" #include "drm-client-protocol.h"
#include "linux-dmabuf-unstable-v1-client-protocol.h" #include "linux-dmabuf-unstable-v1-client-protocol.h"

View File

@ -19,7 +19,6 @@
#include "render/pixel_format.h" #include "render/pixel_format.h"
#include "render/swapchain.h" #include "render/swapchain.h"
#include "render/wlr_renderer.h" #include "render/wlr_renderer.h"
#include "util/signal.h"
#include "linux-dmabuf-unstable-v1-client-protocol.h" #include "linux-dmabuf-unstable-v1-client-protocol.h"
#include "presentation-time-client-protocol.h" #include "presentation-time-client-protocol.h"
@ -579,7 +578,7 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *wlr_backend) {
wl_list_insert(&backend->outputs, &output->link); wl_list_insert(&backend->outputs, &output->link);
wlr_output_update_enabled(wlr_output, true); wlr_output_update_enabled(wlr_output, true);
wlr_signal_emit_safe(&backend->backend.events.new_output, wlr_output); wl_signal_emit_mutable(&backend->backend.events.new_output, wlr_output);
struct wlr_wl_seat *seat; struct wlr_wl_seat *seat;
wl_list_for_each(seat, &backend->seats, link) { wl_list_for_each(seat, &backend->seats, link) {

View File

@ -7,7 +7,6 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "backend/wayland.h" #include "backend/wayland.h"
#include "util/signal.h"
#include "pointer-gestures-unstable-v1-client-protocol.h" #include "pointer-gestures-unstable-v1-client-protocol.h"
#include "relative-pointer-unstable-v1-client-protocol.h" #include "relative-pointer-unstable-v1-client-protocol.h"
@ -94,7 +93,7 @@ static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer,
.x = wl_fixed_to_double(sx) / wlr_output->width, .x = wl_fixed_to_double(sx) / wlr_output->width,
.y = wl_fixed_to_double(sy) / wlr_output->height, .y = wl_fixed_to_double(sy) / wlr_output->height,
}; };
wlr_signal_emit_safe(&pointer->wlr_pointer.events.motion_absolute, &event); wl_signal_emit_mutable(&pointer->wlr_pointer.events.motion_absolute, &event);
} }
static void pointer_handle_button(void *data, struct wl_pointer *wl_pointer, static void pointer_handle_button(void *data, struct wl_pointer *wl_pointer,
@ -111,7 +110,7 @@ static void pointer_handle_button(void *data, struct wl_pointer *wl_pointer,
.state = state, .state = state,
.time_msec = time, .time_msec = time,
}; };
wlr_signal_emit_safe(&pointer->wlr_pointer.events.button, &event); wl_signal_emit_mutable(&pointer->wlr_pointer.events.button, &event);
} }
static void pointer_handle_axis(void *data, struct wl_pointer *wl_pointer, static void pointer_handle_axis(void *data, struct wl_pointer *wl_pointer,
@ -130,7 +129,7 @@ static void pointer_handle_axis(void *data, struct wl_pointer *wl_pointer,
.time_msec = time, .time_msec = time,
.source = pointer->axis_source, .source = pointer->axis_source,
}; };
wlr_signal_emit_safe(&pointer->wlr_pointer.events.axis, &event); wl_signal_emit_mutable(&pointer->wlr_pointer.events.axis, &event);
pointer->axis_discrete = 0; pointer->axis_discrete = 0;
} }
@ -142,7 +141,7 @@ static void pointer_handle_frame(void *data, struct wl_pointer *wl_pointer) {
return; return;
} }
wlr_signal_emit_safe(&pointer->wlr_pointer.events.frame, wl_signal_emit_mutable(&pointer->wlr_pointer.events.frame,
&pointer->wlr_pointer); &pointer->wlr_pointer);
} }
@ -173,7 +172,7 @@ static void pointer_handle_axis_stop(void *data, struct wl_pointer *wl_pointer,
.time_msec = time, .time_msec = time,
.source = pointer->axis_source, .source = pointer->axis_source,
}; };
wlr_signal_emit_safe(&pointer->wlr_pointer.events.axis, &event); wl_signal_emit_mutable(&pointer->wlr_pointer.events.axis, &event);
} }
static void pointer_handle_axis_discrete(void *data, static void pointer_handle_axis_discrete(void *data,
@ -228,7 +227,7 @@ static void gesture_swipe_begin(void *data,
.time_msec = time, .time_msec = time,
.fingers = fingers, .fingers = fingers,
}; };
wlr_signal_emit_safe(&pointer->wlr_pointer.events.swipe_begin, &wlr_event); wl_signal_emit_mutable(&pointer->wlr_pointer.events.swipe_begin, &wlr_event);
} }
static void gesture_swipe_update(void *data, static void gesture_swipe_update(void *data,
@ -247,7 +246,7 @@ static void gesture_swipe_update(void *data,
.dx = wl_fixed_to_double(dx), .dx = wl_fixed_to_double(dx),
.dy = wl_fixed_to_double(dy), .dy = wl_fixed_to_double(dy),
}; };
wlr_signal_emit_safe(&pointer->wlr_pointer.events.swipe_update, &wlr_event); wl_signal_emit_mutable(&pointer->wlr_pointer.events.swipe_update, &wlr_event);
} }
static void gesture_swipe_end(void *data, static void gesture_swipe_end(void *data,
@ -264,7 +263,7 @@ static void gesture_swipe_end(void *data,
.time_msec = time, .time_msec = time,
.cancelled = cancelled, .cancelled = cancelled,
}; };
wlr_signal_emit_safe(&pointer->wlr_pointer.events.swipe_end, &wlr_event); wl_signal_emit_mutable(&pointer->wlr_pointer.events.swipe_end, &wlr_event);
} }
static const struct zwp_pointer_gesture_swipe_v1_listener gesture_swipe_impl = { static const struct zwp_pointer_gesture_swipe_v1_listener gesture_swipe_impl = {
@ -291,7 +290,7 @@ static void gesture_pinch_begin(void *data,
.fingers = pointer->fingers, .fingers = pointer->fingers,
}; };
wlr_signal_emit_safe(&pointer->wlr_pointer.events.pinch_begin, &wlr_event); wl_signal_emit_mutable(&pointer->wlr_pointer.events.pinch_begin, &wlr_event);
} }
static void gesture_pinch_update(void *data, static void gesture_pinch_update(void *data,
@ -313,7 +312,7 @@ static void gesture_pinch_update(void *data,
.scale = wl_fixed_to_double(scale), .scale = wl_fixed_to_double(scale),
.rotation = wl_fixed_to_double(rotation), .rotation = wl_fixed_to_double(rotation),
}; };
wlr_signal_emit_safe(&pointer->wlr_pointer.events.pinch_update, &wlr_event); wl_signal_emit_mutable(&pointer->wlr_pointer.events.pinch_update, &wlr_event);
} }
static void gesture_pinch_end(void *data, static void gesture_pinch_end(void *data,
@ -330,7 +329,7 @@ static void gesture_pinch_end(void *data,
.time_msec = time, .time_msec = time,
.cancelled = cancelled, .cancelled = cancelled,
}; };
wlr_signal_emit_safe(&pointer->wlr_pointer.events.pinch_end, &wlr_event); wl_signal_emit_mutable(&pointer->wlr_pointer.events.pinch_end, &wlr_event);
} }
static const struct zwp_pointer_gesture_pinch_v1_listener gesture_pinch_impl = { static const struct zwp_pointer_gesture_pinch_v1_listener gesture_pinch_impl = {
@ -356,7 +355,7 @@ static void gesture_hold_begin(void *data,
.time_msec = time, .time_msec = time,
.fingers = fingers, .fingers = fingers,
}; };
wlr_signal_emit_safe(&pointer->wlr_pointer.events.hold_begin, &wlr_event); wl_signal_emit_mutable(&pointer->wlr_pointer.events.hold_begin, &wlr_event);
} }
static void gesture_hold_end(void *data, static void gesture_hold_end(void *data,
@ -373,7 +372,7 @@ static void gesture_hold_end(void *data,
.time_msec = time, .time_msec = time,
.cancelled = cancelled, .cancelled = cancelled,
}; };
wlr_signal_emit_safe(&pointer->wlr_pointer.events.hold_end, &wlr_event); wl_signal_emit_mutable(&pointer->wlr_pointer.events.hold_end, &wlr_event);
} }
static const struct zwp_pointer_gesture_hold_v1_listener gesture_hold_impl = { static const struct zwp_pointer_gesture_hold_v1_listener gesture_hold_impl = {
@ -401,7 +400,7 @@ static void relative_pointer_handle_relative_motion(void *data,
.unaccel_dx = wl_fixed_to_double(dx_unaccel), .unaccel_dx = wl_fixed_to_double(dx_unaccel),
.unaccel_dy = wl_fixed_to_double(dy_unaccel), .unaccel_dy = wl_fixed_to_double(dy_unaccel),
}; };
wlr_signal_emit_safe(&pointer->wlr_pointer.events.motion, &wlr_event); wl_signal_emit_mutable(&pointer->wlr_pointer.events.motion, &wlr_event);
} }
static const struct zwp_relative_pointer_v1_listener relative_pointer_listener = { static const struct zwp_relative_pointer_v1_listener relative_pointer_listener = {
@ -463,7 +462,7 @@ void create_pointer(struct wlr_wl_seat *seat, struct wlr_wl_output *output) {
wl_signal_add(&output->wlr_output.events.destroy, &pointer->output_destroy); wl_signal_add(&output->wlr_output.events.destroy, &pointer->output_destroy);
pointer->output_destroy.notify = pointer_output_destroy; pointer->output_destroy.notify = pointer_output_destroy;
wlr_signal_emit_safe(&seat->backend->backend.events.new_input, wl_signal_emit_mutable(&seat->backend->backend.events.new_input,
&pointer->wlr_pointer.base); &pointer->wlr_pointer.base);
wl_list_insert(&seat->pointers, &pointer->link); wl_list_insert(&seat->pointers, &pointer->link);

View File

@ -18,7 +18,6 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "backend/wayland.h" #include "backend/wayland.h"
#include "util/signal.h"
#include "util/time.h" #include "util/time.h"
static void keyboard_handle_keymap(void *data, struct wl_keyboard *wl_keyboard, static void keyboard_handle_keymap(void *data, struct wl_keyboard *wl_keyboard,
@ -113,7 +112,7 @@ void init_seat_keyboard(struct wlr_wl_seat *seat) {
wl_keyboard_add_listener(seat->wl_keyboard, &keyboard_listener, wl_keyboard_add_listener(seat->wl_keyboard, &keyboard_listener,
&seat->wlr_keyboard); &seat->wlr_keyboard);
wlr_signal_emit_safe(&seat->backend->backend.events.new_input, wl_signal_emit_mutable(&seat->backend->backend.events.new_input,
&seat->wlr_keyboard.base); &seat->wlr_keyboard.base);
} }
@ -148,7 +147,7 @@ static void touch_handle_down(void *data, struct wl_touch *wl_touch,
.touch_id = id, .touch_id = id,
}; };
touch_coordinates_to_absolute(seat, x, y, &event.x, &event.y); touch_coordinates_to_absolute(seat, x, y, &event.x, &event.y);
wlr_signal_emit_safe(&touch->events.down, &event); wl_signal_emit_mutable(&touch->events.down, &event);
} }
static void touch_handle_up(void *data, struct wl_touch *wl_touch, static void touch_handle_up(void *data, struct wl_touch *wl_touch,
@ -161,7 +160,7 @@ static void touch_handle_up(void *data, struct wl_touch *wl_touch,
.time_msec = time, .time_msec = time,
.touch_id = id, .touch_id = id,
}; };
wlr_signal_emit_safe(&touch->events.up, &event); wl_signal_emit_mutable(&touch->events.up, &event);
} }
static void touch_handle_motion(void *data, struct wl_touch *wl_touch, static void touch_handle_motion(void *data, struct wl_touch *wl_touch,
@ -176,12 +175,12 @@ static void touch_handle_motion(void *data, struct wl_touch *wl_touch,
}; };
touch_coordinates_to_absolute(seat, x, y, &event.x, &event.y); touch_coordinates_to_absolute(seat, x, y, &event.x, &event.y);
wlr_signal_emit_safe(&touch->events.motion, &event); wl_signal_emit_mutable(&touch->events.motion, &event);
} }
static void touch_handle_frame(void *data, struct wl_touch *wl_touch) { static void touch_handle_frame(void *data, struct wl_touch *wl_touch) {
struct wlr_wl_seat *seat = data; struct wlr_wl_seat *seat = data;
wlr_signal_emit_safe(&seat->wlr_touch.events.frame, NULL); wl_signal_emit_mutable(&seat->wlr_touch.events.frame, NULL);
} }
static void touch_handle_cancel(void *data, struct wl_touch *wl_touch) { static void touch_handle_cancel(void *data, struct wl_touch *wl_touch) {
@ -228,7 +227,7 @@ void init_seat_touch(struct wlr_wl_seat *seat) {
} }
wl_touch_add_listener(seat->wl_touch, &touch_listener, seat); wl_touch_add_listener(seat->wl_touch, &touch_listener, seat);
wlr_signal_emit_safe(&seat->backend->backend.events.new_input, wl_signal_emit_mutable(&seat->backend->backend.events.new_input,
&seat->wlr_touch.base); &seat->wlr_touch.base);
} }

View File

@ -9,7 +9,6 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "backend/wayland.h" #include "backend/wayland.h"
#include "util/signal.h"
#include "util/time.h" #include "util/time.h"
#include "tablet-unstable-v2-client-protocol.h" #include "tablet-unstable-v2-client-protocol.h"
@ -108,11 +107,11 @@ static void handle_tablet_pad_ring_frame(void *data,
}; };
if (ring->angle >= 0) { if (ring->angle >= 0) {
wlr_signal_emit_safe(&ring->group->pad->events.ring, &evt); wl_signal_emit_mutable(&ring->group->pad->events.ring, &evt);
} }
if (ring->stopped) { if (ring->stopped) {
evt.position = -1; evt.position = -1;
wlr_signal_emit_safe(&ring->group->pad->events.ring, &evt); wl_signal_emit_mutable(&ring->group->pad->events.ring, &evt);
} }
ring->angle = -1; ring->angle = -1;
@ -161,11 +160,11 @@ static void handle_tablet_pad_strip_frame(void *data,
}; };
if (strip->position >= 0) { if (strip->position >= 0) {
wlr_signal_emit_safe(&strip->group->pad->events.strip, &evt); wl_signal_emit_mutable(&strip->group->pad->events.strip, &evt);
} }
if (strip->stopped) { if (strip->stopped) {
evt.position = -1; evt.position = -1;
wlr_signal_emit_safe(&strip->group->pad->events.strip, &evt); wl_signal_emit_mutable(&strip->group->pad->events.strip, &evt);
} }
strip->position = -1; strip->position = -1;
@ -345,13 +344,13 @@ static void handle_tablet_pad_button(void *data,
.group = 0, .group = 0,
}; };
wlr_signal_emit_safe(&seat->wlr_tablet_pad.events.button, &evt); wl_signal_emit_mutable(&seat->wlr_tablet_pad.events.button, &evt);
} }
static void handle_tablet_pad_done(void *data, static void handle_tablet_pad_done(void *data,
struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2) { struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2) {
struct wlr_wl_seat *seat = data; struct wlr_wl_seat *seat = data;
wlr_signal_emit_safe(&seat->backend->backend.events.new_input, wl_signal_emit_mutable(&seat->backend->backend.events.new_input,
&seat->wlr_tablet_pad.base); &seat->wlr_tablet_pad.base);
} }
@ -362,7 +361,7 @@ static void handle_tablet_pad_enter(void *data,
struct wlr_wl_seat *seat = data; struct wlr_wl_seat *seat = data;
assert(seat->zwp_tablet_v2 == tablet_p); assert(seat->zwp_tablet_v2 == tablet_p);
wlr_signal_emit_safe(&seat->wlr_tablet_pad.events.attach_tablet, wl_signal_emit_mutable(&seat->wlr_tablet_pad.events.attach_tablet,
&seat->wlr_tablet_tool); &seat->wlr_tablet_tool);
} }
@ -591,7 +590,7 @@ static void handle_tablet_tool_button(void *data,
WLR_BUTTON_RELEASED : WLR_BUTTON_PRESSED, WLR_BUTTON_RELEASED : WLR_BUTTON_PRESSED,
}; };
wlr_signal_emit_safe(&tablet->events.button, &evt); wl_signal_emit_mutable(&tablet->events.button, &evt);
} }
static void clear_tablet_tool_values(struct tablet_tool *tool) { static void clear_tablet_tool_values(struct tablet_tool *tool) {
@ -629,7 +628,7 @@ static void handle_tablet_tool_frame(void *data,
.state = WLR_TABLET_TOOL_PROXIMITY_IN, .state = WLR_TABLET_TOOL_PROXIMITY_IN,
}; };
wlr_signal_emit_safe(&tablet->events.proximity, &evt); wl_signal_emit_mutable(&tablet->events.proximity, &evt);
} }
{ {
@ -686,7 +685,7 @@ static void handle_tablet_tool_frame(void *data,
} }
if (evt.updated_axes) { if (evt.updated_axes) {
wlr_signal_emit_safe(&tablet->events.axis, &evt); wl_signal_emit_mutable(&tablet->events.axis, &evt);
} }
} }
@ -705,7 +704,7 @@ static void handle_tablet_tool_frame(void *data,
.state = WLR_TABLET_TOOL_TIP_DOWN, .state = WLR_TABLET_TOOL_TIP_DOWN,
}; };
wlr_signal_emit_safe(&tablet->events.tip, &evt); wl_signal_emit_mutable(&tablet->events.tip, &evt);
} }
if (tool->is_up) { if (tool->is_up) {
@ -718,7 +717,7 @@ static void handle_tablet_tool_frame(void *data,
.state = WLR_TABLET_TOOL_TIP_UP, .state = WLR_TABLET_TOOL_TIP_UP,
}; };
wlr_signal_emit_safe(&tablet->events.tip, &evt); wl_signal_emit_mutable(&tablet->events.tip, &evt);
} }
if (tool->is_out) { if (tool->is_out) {
@ -731,7 +730,7 @@ static void handle_tablet_tool_frame(void *data,
.state = WLR_TABLET_TOOL_PROXIMITY_OUT, .state = WLR_TABLET_TOOL_PROXIMITY_OUT,
}; };
wlr_signal_emit_safe(&tablet->events.proximity, &evt); wl_signal_emit_mutable(&tablet->events.proximity, &evt);
} }
clear_values: clear_values:
@ -829,7 +828,7 @@ static void handle_tablet_path(void *data, struct zwp_tablet_v2 *zwp_tablet_v2,
static void handle_tablet_done(void *data, struct zwp_tablet_v2 *zwp_tablet_v2) { static void handle_tablet_done(void *data, struct zwp_tablet_v2 *zwp_tablet_v2) {
struct wlr_wl_seat *seat = data; struct wlr_wl_seat *seat = data;
wlr_signal_emit_safe(&seat->backend->backend.events.new_input, wl_signal_emit_mutable(&seat->backend->backend.events.new_input,
&seat->wlr_tablet.base); &seat->wlr_tablet.base);
} }

View File

@ -30,7 +30,6 @@
#include "backend/x11.h" #include "backend/x11.h"
#include "render/drm_format_set.h" #include "render/drm_format_set.h"
#include "util/signal.h"
// See dri2_format_for_depth in mesa // See dri2_format_for_depth in mesa
const struct wlr_x11_format formats[] = { const struct wlr_x11_format formats[] = {
@ -164,7 +163,7 @@ static bool backend_start(struct wlr_backend *backend) {
wlr_log(WLR_INFO, "Starting X11 backend"); wlr_log(WLR_INFO, "Starting X11 backend");
wlr_signal_emit_safe(&x11->backend.events.new_input, &x11->keyboard.base); wl_signal_emit_mutable(&x11->backend.events.new_input, &x11->keyboard.base);
for (size_t i = 0; i < x11->requested_outputs; ++i) { for (size_t i = 0; i < x11->requested_outputs; ++i) {
wlr_x11_output_create(&x11->backend); wlr_x11_output_create(&x11->backend);

View File

@ -16,7 +16,6 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "backend/x11.h" #include "backend/x11.h"
#include "util/signal.h"
static void send_key_event(struct wlr_x11_backend *x11, uint32_t key, static void send_key_event(struct wlr_x11_backend *x11, uint32_t key,
enum wl_keyboard_key_state st, xcb_timestamp_t time) { enum wl_keyboard_key_state st, xcb_timestamp_t time) {
@ -37,8 +36,8 @@ static void send_button_event(struct wlr_x11_output *output, uint32_t key,
.button = key, .button = key,
.state = st, .state = st,
}; };
wlr_signal_emit_safe(&output->pointer.events.button, &ev); wl_signal_emit_mutable(&output->pointer.events.button, &ev);
wlr_signal_emit_safe(&output->pointer.events.frame, &output->pointer); wl_signal_emit_mutable(&output->pointer.events.frame, &output->pointer);
} }
static void send_axis_event(struct wlr_x11_output *output, int32_t delta, static void send_axis_event(struct wlr_x11_output *output, int32_t delta,
@ -52,8 +51,8 @@ static void send_axis_event(struct wlr_x11_output *output, int32_t delta,
.delta = delta * 15, .delta = delta * 15,
.delta_discrete = delta, .delta_discrete = delta,
}; };
wlr_signal_emit_safe(&output->pointer.events.axis, &ev); wl_signal_emit_mutable(&output->pointer.events.axis, &ev);
wlr_signal_emit_safe(&output->pointer.events.frame, &output->pointer); wl_signal_emit_mutable(&output->pointer.events.frame, &output->pointer);
} }
static void send_pointer_position_event(struct wlr_x11_output *output, static void send_pointer_position_event(struct wlr_x11_output *output,
@ -64,8 +63,8 @@ static void send_pointer_position_event(struct wlr_x11_output *output,
.x = (double)x / output->wlr_output.width, .x = (double)x / output->wlr_output.width,
.y = (double)y / output->wlr_output.height, .y = (double)y / output->wlr_output.height,
}; };
wlr_signal_emit_safe(&output->pointer.events.motion_absolute, &ev); wl_signal_emit_mutable(&output->pointer.events.motion_absolute, &ev);
wlr_signal_emit_safe(&output->pointer.events.frame, &output->pointer); wl_signal_emit_mutable(&output->pointer.events.frame, &output->pointer);
} }
static void send_touch_down_event(struct wlr_x11_output *output, static void send_touch_down_event(struct wlr_x11_output *output,
@ -77,8 +76,8 @@ static void send_touch_down_event(struct wlr_x11_output *output,
.y = (double)y / output->wlr_output.height, .y = (double)y / output->wlr_output.height,
.touch_id = touch_id, .touch_id = touch_id,
}; };
wlr_signal_emit_safe(&output->touch.events.down, &ev); wl_signal_emit_mutable(&output->touch.events.down, &ev);
wlr_signal_emit_safe(&output->touch.events.frame, NULL); wl_signal_emit_mutable(&output->touch.events.frame, NULL);
} }
static void send_touch_motion_event(struct wlr_x11_output *output, static void send_touch_motion_event(struct wlr_x11_output *output,
@ -90,8 +89,8 @@ static void send_touch_motion_event(struct wlr_x11_output *output,
.y = (double)y / output->wlr_output.height, .y = (double)y / output->wlr_output.height,
.touch_id = touch_id, .touch_id = touch_id,
}; };
wlr_signal_emit_safe(&output->touch.events.motion, &ev); wl_signal_emit_mutable(&output->touch.events.motion, &ev);
wlr_signal_emit_safe(&output->touch.events.frame, NULL); wl_signal_emit_mutable(&output->touch.events.frame, NULL);
} }
static void send_touch_up_event(struct wlr_x11_output *output, static void send_touch_up_event(struct wlr_x11_output *output,
@ -101,8 +100,8 @@ static void send_touch_up_event(struct wlr_x11_output *output,
.time_msec = time, .time_msec = time,
.touch_id = touch_id, .touch_id = touch_id,
}; };
wlr_signal_emit_safe(&output->touch.events.up, &ev); wl_signal_emit_mutable(&output->touch.events.up, &ev);
wlr_signal_emit_safe(&output->touch.events.frame, NULL); wl_signal_emit_mutable(&output->touch.events.frame, NULL);
} }
static struct wlr_x11_touchpoint *get_touchpoint_from_x11_touch_id( static struct wlr_x11_touchpoint *get_touchpoint_from_x11_touch_id(

View File

@ -21,7 +21,6 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "backend/x11.h" #include "backend/x11.h"
#include "util/signal.h"
#include "util/time.h" #include "util/time.h"
static const uint32_t SUPPORTED_OUTPUT_STATE = static const uint32_t SUPPORTED_OUTPUT_STATE =
@ -590,9 +589,9 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) {
output->touch.output_name = strdup(wlr_output->name); output->touch.output_name = strdup(wlr_output->name);
wl_list_init(&output->touchpoints); wl_list_init(&output->touchpoints);
wlr_signal_emit_safe(&x11->backend.events.new_output, wlr_output); wl_signal_emit_mutable(&x11->backend.events.new_output, wlr_output);
wlr_signal_emit_safe(&x11->backend.events.new_input, &output->pointer.base); wl_signal_emit_mutable(&x11->backend.events.new_input, &output->pointer.base);
wlr_signal_emit_safe(&x11->backend.events.new_input, &output->touch.base); wl_signal_emit_mutable(&x11->backend.events.new_input, &output->touch.base);
// Start the rendering loop by requesting the compositor to render a frame // Start the rendering loop by requesting the compositor to render a frame
wlr_output_schedule_frame(wlr_output); wlr_output_schedule_frame(wlr_output);

View File

@ -14,7 +14,6 @@
#include "render/allocator/drm_dumb.h" #include "render/allocator/drm_dumb.h"
#include "render/allocator/shm.h" #include "render/allocator/shm.h"
#include "render/wlr_renderer.h" #include "render/wlr_renderer.h"
#include "util/signal.h"
#if WLR_HAS_GBM_ALLOCATOR #if WLR_HAS_GBM_ALLOCATOR
#include "render/allocator/gbm.h" #include "render/allocator/gbm.h"
@ -159,7 +158,7 @@ void wlr_allocator_destroy(struct wlr_allocator *alloc) {
if (alloc == NULL) { if (alloc == NULL) {
return; return;
} }
wlr_signal_emit_safe(&alloc->events.destroy, NULL); wl_signal_emit_mutable(&alloc->events.destroy, NULL);
alloc->impl->destroy(alloc); alloc->impl->destroy(alloc);
} }

View File

@ -15,7 +15,6 @@
#include "render/gles2.h" #include "render/gles2.h"
#include "render/pixel_format.h" #include "render/pixel_format.h"
#include "types/wlr_buffer.h" #include "types/wlr_buffer.h"
#include "util/signal.h"
static const struct wlr_texture_impl texture_impl; static const struct wlr_texture_impl texture_impl;

View File

@ -26,7 +26,6 @@
#endif // WLR_HAS_VULKAN_RENDERER #endif // WLR_HAS_VULKAN_RENDERER
#include "backend/backend.h" #include "backend/backend.h"
#include "util/signal.h"
#include "render/pixel_format.h" #include "render/pixel_format.h"
#include "render/wlr_renderer.h" #include "render/wlr_renderer.h"
@ -53,7 +52,7 @@ void wlr_renderer_destroy(struct wlr_renderer *r) {
assert(!r->rendering); assert(!r->rendering);
wlr_signal_emit_safe(&r->events.destroy, r); wl_signal_emit_mutable(&r->events.destroy, r);
if (r->impl && r->impl->destroy) { if (r->impl && r->impl->destroy) {
r->impl->destroy(r); r->impl->destroy(r);

View File

@ -9,7 +9,6 @@
#include <wlr/types/wlr_seat.h> #include <wlr/types/wlr_seat.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "types/wlr_data_device.h" #include "types/wlr_data_device.h"
#include "util/signal.h"
#define DATA_DEVICE_MANAGER_VERSION 3 #define DATA_DEVICE_MANAGER_VERSION 3
@ -162,7 +161,7 @@ void wlr_seat_request_set_selection(struct wlr_seat *seat,
.source = source, .source = source,
.serial = serial, .serial = serial,
}; };
wlr_signal_emit_safe(&seat->events.request_set_selection, &event); wl_signal_emit_mutable(&seat->events.request_set_selection, &event);
} }
static void seat_handle_selection_source_destroy( static void seat_handle_selection_source_destroy(
@ -179,7 +178,7 @@ static void seat_handle_selection_source_destroy(
seat_client_send_selection(focused_client); seat_client_send_selection(focused_client);
} }
wlr_signal_emit_safe(&seat->events.set_selection, seat); wl_signal_emit_mutable(&seat->events.set_selection, seat);
} }
void wlr_seat_set_selection(struct wlr_seat *seat, void wlr_seat_set_selection(struct wlr_seat *seat,
@ -211,7 +210,7 @@ void wlr_seat_set_selection(struct wlr_seat *seat,
seat_client_send_selection(focused_client); seat_client_send_selection(focused_client);
} }
wlr_signal_emit_safe(&seat->events.set_selection, seat); wl_signal_emit_mutable(&seat->events.set_selection, seat);
} }
@ -280,7 +279,7 @@ static void data_device_manager_bind(struct wl_client *client,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_data_device_manager *manager = struct wlr_data_device_manager *manager =
wl_container_of(listener, manager, display_destroy); wl_container_of(listener, manager, display_destroy);
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->global); wl_global_destroy(manager->global);
free(manager); free(manager);

View File

@ -8,7 +8,6 @@
#include <wlr/types/wlr_seat.h> #include <wlr/types/wlr_seat.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "types/wlr_data_device.h" #include "types/wlr_data_device.h"
#include "util/signal.h"
static const struct wl_data_offer_interface data_offer_impl; static const struct wl_data_offer_interface data_offer_impl;

View File

@ -9,7 +9,6 @@
#include <wlr/types/wlr_seat.h> #include <wlr/types/wlr_seat.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "types/wlr_data_device.h" #include "types/wlr_data_device.h"
#include "util/signal.h"
void wlr_data_source_init(struct wlr_data_source *source, void wlr_data_source_init(struct wlr_data_source *source,
const struct wlr_data_source_impl *impl) { const struct wlr_data_source_impl *impl) {
@ -40,7 +39,7 @@ void wlr_data_source_destroy(struct wlr_data_source *source) {
return; return;
} }
wlr_signal_emit_safe(&source->events.destroy, source); wl_signal_emit_mutable(&source->events.destroy, source);
char **p; char **p;
wl_array_for_each(p, &source->mime_types) { wl_array_for_each(p, &source->mime_types) {

View File

@ -9,7 +9,6 @@
#include <wlr/types/wlr_seat.h> #include <wlr/types/wlr_seat.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "types/wlr_data_device.h" #include "types/wlr_data_device.h"
#include "util/signal.h"
static void drag_handle_seat_client_destroy(struct wl_listener *listener, static void drag_handle_seat_client_destroy(struct wl_listener *listener,
void *data) { void *data) {
@ -104,16 +103,16 @@ static void drag_set_focus(struct wlr_drag *drag,
wl_signal_add(&focus_client->events.destroy, &drag->seat_client_destroy); wl_signal_add(&focus_client->events.destroy, &drag->seat_client_destroy);
out: out:
wlr_signal_emit_safe(&drag->events.focus, drag); wl_signal_emit_mutable(&drag->events.focus, drag);
} }
static void drag_icon_set_mapped(struct wlr_drag_icon *icon, bool mapped) { static void drag_icon_set_mapped(struct wlr_drag_icon *icon, bool mapped) {
if (mapped && !icon->mapped) { if (mapped && !icon->mapped) {
icon->mapped = true; icon->mapped = true;
wlr_signal_emit_safe(&icon->events.map, icon); wl_signal_emit_mutable(&icon->events.map, icon);
} else if (!mapped && icon->mapped) { } else if (!mapped && icon->mapped) {
icon->mapped = false; icon->mapped = false;
wlr_signal_emit_safe(&icon->events.unmap, icon); wl_signal_emit_mutable(&icon->events.unmap, icon);
} }
} }
@ -151,7 +150,7 @@ static void drag_destroy(struct wlr_drag *drag) {
// to ensure that the wl_data_device.leave is sent before emitting the // to ensure that the wl_data_device.leave is sent before emitting the
// signal. This allows e.g. wl_pointer.enter to be sent in the destroy // signal. This allows e.g. wl_pointer.enter to be sent in the destroy
// signal handler. // signal handler.
wlr_signal_emit_safe(&drag->events.destroy, drag); wl_signal_emit_mutable(&drag->events.destroy, drag);
if (drag->source) { if (drag->source) {
wl_list_remove(&drag->source_destroy.link); wl_list_remove(&drag->source_destroy.link);
@ -188,7 +187,7 @@ static void drag_handle_pointer_motion(struct wlr_seat_pointer_grab *grab,
.sx = sx, .sx = sx,
.sy = sy, .sy = sy,
}; };
wlr_signal_emit_safe(&drag->events.motion, &event); wl_signal_emit_mutable(&drag->events.motion, &event);
} }
} }
@ -209,7 +208,7 @@ static void drag_drop(struct wlr_drag *drag, uint32_t time) {
.drag = drag, .drag = drag,
.time = time, .time = time,
}; };
wlr_signal_emit_safe(&drag->events.drop, &event); wl_signal_emit_mutable(&drag->events.drop, &event);
} }
static uint32_t drag_handle_pointer_button(struct wlr_seat_pointer_grab *grab, static uint32_t drag_handle_pointer_button(struct wlr_seat_pointer_grab *grab,
@ -364,7 +363,7 @@ static void drag_icon_destroy(struct wlr_drag_icon *icon) {
return; return;
} }
drag_icon_set_mapped(icon, false); drag_icon_set_mapped(icon, false);
wlr_signal_emit_safe(&icon->events.destroy, icon); wl_signal_emit_mutable(&icon->events.destroy, icon);
icon->surface->role_data = NULL; icon->surface->role_data = NULL;
wl_list_remove(&icon->surface_destroy.link); wl_list_remove(&icon->surface_destroy.link);
free(icon); free(icon);
@ -480,7 +479,7 @@ void wlr_seat_request_start_drag(struct wlr_seat *seat, struct wlr_drag *drag,
.origin = origin, .origin = origin,
.serial = serial, .serial = serial,
}; };
wlr_signal_emit_safe(&seat->events.request_start_drag, &event); wl_signal_emit_mutable(&seat->events.request_start_drag, &event);
} }
static void seat_handle_drag_source_destroy(struct wl_listener *listener, static void seat_handle_drag_source_destroy(struct wl_listener *listener,
@ -511,7 +510,7 @@ void wlr_seat_start_drag(struct wlr_seat *seat, struct wlr_drag *drag,
wl_signal_add(&drag->source->events.destroy, &seat->drag_source_destroy); wl_signal_add(&drag->source->events.destroy, &seat->drag_source_destroy);
} }
wlr_signal_emit_safe(&seat->events.start_drag, drag); wl_signal_emit_mutable(&seat->events.start_drag, drag);
} }
void wlr_seat_start_pointer_drag(struct wlr_seat *seat, struct wlr_drag *drag, void wlr_seat_start_pointer_drag(struct wlr_seat *seat, struct wlr_drag *drag,

View File

@ -10,7 +10,6 @@
#include "render/swapchain.h" #include "render/swapchain.h"
#include "types/wlr_buffer.h" #include "types/wlr_buffer.h"
#include "types/wlr_output.h" #include "types/wlr_output.h"
#include "util/signal.h"
static bool output_set_hardware_cursor(struct wlr_output *output, static bool output_set_hardware_cursor(struct wlr_output *output,
struct wlr_buffer *buffer, int hotspot_x, int hotspot_y) { struct wlr_buffer *buffer, int hotspot_x, int hotspot_y) {
@ -168,7 +167,7 @@ static void output_cursor_damage_whole(struct wlr_output_cursor *cursor) {
.output = cursor->output, .output = cursor->output,
.damage = &damage, .damage = &damage,
}; };
wlr_signal_emit_safe(&cursor->output->events.damage, &event); wl_signal_emit_mutable(&cursor->output->events.damage, &event);
pixman_region32_fini(&damage); pixman_region32_fini(&damage);
} }

View File

@ -11,7 +11,6 @@
#include "render/swapchain.h" #include "render/swapchain.h"
#include "types/wlr_output.h" #include "types/wlr_output.h"
#include "util/global.h" #include "util/global.h"
#include "util/signal.h"
#define OUTPUT_VERSION 4 #define OUTPUT_VERSION 4
@ -124,7 +123,7 @@ static void output_bind(struct wl_client *wl_client, void *data,
.resource = resource, .resource = resource,
}; };
wlr_signal_emit_safe(&output->events.bind, &evt); wl_signal_emit_mutable(&output->events.bind, &evt);
} }
void wlr_output_create_global(struct wlr_output *output) { void wlr_output_create_global(struct wlr_output *output) {
@ -187,7 +186,7 @@ void wlr_output_update_enabled(struct wlr_output *output, bool enabled) {
} }
output->enabled = enabled; output->enabled = enabled;
wlr_signal_emit_safe(&output->events.enable, output); wl_signal_emit_mutable(&output->events.enable, output);
} }
static void output_update_matrix(struct wlr_output *output) { static void output_update_matrix(struct wlr_output *output) {
@ -255,7 +254,7 @@ void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width,
} }
wlr_output_schedule_done(output); wlr_output_schedule_done(output);
wlr_signal_emit_safe(&output->events.mode, output); wl_signal_emit_mutable(&output->events.mode, output);
} }
void wlr_output_set_transform(struct wlr_output *output, void wlr_output_set_transform(struct wlr_output *output,
@ -306,7 +305,7 @@ void wlr_output_set_description(struct wlr_output *output, const char *desc) {
} }
wlr_output_schedule_done(output); wlr_output_schedule_done(output);
wlr_signal_emit_safe(&output->events.description, output); wl_signal_emit_mutable(&output->events.description, output);
} }
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
@ -389,7 +388,7 @@ void wlr_output_destroy(struct wlr_output *output) {
wlr_output_destroy_global(output); wlr_output_destroy_global(output);
output_clear_back_buffer(output); output_clear_back_buffer(output);
wlr_signal_emit_safe(&output->events.destroy, output); wl_signal_emit_mutable(&output->events.destroy, output);
wlr_addon_set_finish(&output->addons); wlr_addon_set_finish(&output->addons);
// The backend is responsible for free-ing the list of modes // The backend is responsible for free-ing the list of modes
@ -747,7 +746,7 @@ bool wlr_output_commit_state(struct wlr_output *output,
.when = &now, .when = &now,
.state = &pending, .state = &pending,
}; };
wlr_signal_emit_safe(&output->events.precommit, &pre_event); wl_signal_emit_mutable(&output->events.precommit, &pre_event);
// output_clear_back_buffer detaches the buffer from the renderer. This is // output_clear_back_buffer detaches the buffer from the renderer. This is
// important to do before calling impl->commit(), because this marks an // important to do before calling impl->commit(), because this marks an
@ -837,7 +836,7 @@ bool wlr_output_commit_state(struct wlr_output *output,
.when = &now, .when = &now,
.buffer = (pending.committed & WLR_OUTPUT_STATE_BUFFER) ? pending.buffer : NULL, .buffer = (pending.committed & WLR_OUTPUT_STATE_BUFFER) ? pending.buffer : NULL,
}; };
wlr_signal_emit_safe(&output->events.commit, &event); wl_signal_emit_mutable(&output->events.commit, &event);
wlr_buffer_unlock(back_buffer); wlr_buffer_unlock(back_buffer);
if (new_back_buffer) { if (new_back_buffer) {
@ -876,7 +875,7 @@ void wlr_output_attach_buffer(struct wlr_output *output,
void wlr_output_send_frame(struct wlr_output *output) { void wlr_output_send_frame(struct wlr_output *output) {
output->frame_pending = false; output->frame_pending = false;
if (output->enabled) { if (output->enabled) {
wlr_signal_emit_safe(&output->events.frame, output); wl_signal_emit_mutable(&output->events.frame, output);
} }
} }
@ -922,7 +921,7 @@ void wlr_output_send_present(struct wlr_output *output,
event->when = &now; event->when = &now;
} }
wlr_signal_emit_safe(&output->events.present, event); wl_signal_emit_mutable(&output->events.present, event);
} }
void wlr_output_set_gamma(struct wlr_output *output, size_t size, void wlr_output_set_gamma(struct wlr_output *output, size_t size,
@ -954,7 +953,7 @@ void wlr_output_update_needs_frame(struct wlr_output *output) {
return; return;
} }
output->needs_frame = true; output->needs_frame = true;
wlr_signal_emit_safe(&output->events.needs_frame, output); wl_signal_emit_mutable(&output->events.needs_frame, output);
} }
void wlr_output_damage_whole(struct wlr_output *output) { void wlr_output_damage_whole(struct wlr_output *output) {
@ -968,7 +967,7 @@ void wlr_output_damage_whole(struct wlr_output *output) {
.output = output, .output = output,
.damage = &damage, .damage = &damage,
}; };
wlr_signal_emit_safe(&output->events.damage, &event); wl_signal_emit_mutable(&output->events.damage, &event);
pixman_region32_fini(&damage); pixman_region32_fini(&damage);
} }

View File

@ -13,7 +13,6 @@
#include <wlr/util/region.h> #include <wlr/util/region.h>
#include "types/wlr_buffer.h" #include "types/wlr_buffer.h"
#include "types/wlr_scene.h" #include "types/wlr_scene.h"
#include "util/signal.h"
#include "util/time.h" #include "util/time.h"
#define HIGHLIGHT_DAMAGE_FADEOUT_TIME 250 #define HIGHLIGHT_DAMAGE_FADEOUT_TIME 250
@ -83,7 +82,7 @@ void wlr_scene_node_destroy(struct wlr_scene_node *node) {
// We want to call the destroy listeners before we do anything else // We want to call the destroy listeners before we do anything else
// in case the destroy signal would like to remove children before they // in case the destroy signal would like to remove children before they
// are recursively destroyed. // are recursively destroyed.
wlr_signal_emit_safe(&node->events.destroy, NULL); wl_signal_emit_mutable(&node->events.destroy, NULL);
wlr_scene_node_set_enabled(node, false); wlr_scene_node_set_enabled(node, false);
@ -96,7 +95,7 @@ void wlr_scene_node_destroy(struct wlr_scene_node *node) {
struct wlr_scene_output *scene_output; struct wlr_scene_output *scene_output;
wl_list_for_each(scene_output, &scene->outputs, link) { wl_list_for_each(scene_output, &scene->outputs, link) {
if (active & (1ull << scene_output->index)) { if (active & (1ull << scene_output->index)) {
wlr_signal_emit_safe(&scene_buffer->events.output_leave, wl_signal_emit_mutable(&scene_buffer->events.output_leave,
scene_output); scene_output);
} }
} }
@ -385,9 +384,9 @@ static void update_node_update_outputs(struct wlr_scene_node *node,
bool intersects_before = old_active & mask; bool intersects_before = old_active & mask;
if (intersects && !intersects_before) { if (intersects && !intersects_before) {
wlr_signal_emit_safe(&scene_buffer->events.output_enter, scene_output); wl_signal_emit_mutable(&scene_buffer->events.output_enter, scene_output);
} else if (!intersects && intersects_before) { } else if (!intersects && intersects_before) {
wlr_signal_emit_safe(&scene_buffer->events.output_leave, scene_output); wl_signal_emit_mutable(&scene_buffer->events.output_leave, scene_output);
} }
} }
} }
@ -723,7 +722,7 @@ void wlr_scene_buffer_set_transform(struct wlr_scene_buffer *scene_buffer,
void wlr_scene_buffer_send_frame_done(struct wlr_scene_buffer *scene_buffer, void wlr_scene_buffer_send_frame_done(struct wlr_scene_buffer *scene_buffer,
struct timespec *now) { struct timespec *now) {
if (pixman_region32_not_empty(&scene_buffer->node.visible)) { if (pixman_region32_not_empty(&scene_buffer->node.visible)) {
wlr_signal_emit_safe(&scene_buffer->events.frame_done, now); wl_signal_emit_mutable(&scene_buffer->events.frame_done, now);
} }
} }
@ -1106,7 +1105,7 @@ static void scene_node_render(struct wlr_scene_node *node,
render_texture(output, &render_region, texture, &scene_buffer->src_box, render_texture(output, &render_region, texture, &scene_buffer->src_box,
&dst_box, matrix); &dst_box, matrix);
wlr_signal_emit_safe(&scene_buffer->events.output_present, scene_output); wl_signal_emit_mutable(&scene_buffer->events.output_present, scene_output);
break; break;
} }
@ -1259,7 +1258,7 @@ void wlr_scene_output_destroy(struct wlr_scene_output *scene_output) {
return; return;
} }
wlr_signal_emit_safe(&scene_output->events.destroy, NULL); wl_signal_emit_mutable(&scene_output->events.destroy, NULL);
scene_node_output_update(&scene_output->scene->tree.node, scene_node_output_update(&scene_output->scene->tree.node,
&scene_output->scene->outputs, scene_output); &scene_output->scene->outputs, scene_output);
@ -1498,7 +1497,7 @@ bool wlr_scene_output_commit(struct wlr_scene_output *scene_output) {
assert(node->type == WLR_SCENE_NODE_BUFFER); assert(node->type == WLR_SCENE_NODE_BUFFER);
struct wlr_scene_buffer *buffer = wlr_scene_buffer_from_node(node); struct wlr_scene_buffer *buffer = wlr_scene_buffer_from_node(node);
wlr_signal_emit_safe(&buffer->events.output_present, scene_output); wl_signal_emit_mutable(&buffer->events.output_present, scene_output);
return true; return true;
} }

View File

@ -11,7 +11,6 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "types/wlr_seat.h" #include "types/wlr_seat.h"
#include "util/global.h" #include "util/global.h"
#include "util/signal.h"
#define SEAT_VERSION 8 #define SEAT_VERSION 8
@ -67,7 +66,7 @@ static void seat_client_handle_resource_destroy(
return; return;
} }
wlr_signal_emit_safe(&client->events.destroy, client); wl_signal_emit_mutable(&client->events.destroy, client);
if (client == client->seat->pointer_state.focused_client) { if (client == client->seat->pointer_state.focused_client) {
client->seat->pointer_state.focused_client = NULL; client->seat->pointer_state.focused_client = NULL;
@ -181,7 +180,7 @@ void wlr_seat_destroy(struct wlr_seat *seat) {
wlr_seat_touch_point_clear_focus(seat, 0, point->touch_id); wlr_seat_touch_point_clear_focus(seat, 0, point->touch_id);
} }
wlr_signal_emit_safe(&seat->events.destroy, seat); wl_signal_emit_mutable(&seat->events.destroy, seat);
wl_list_remove(&seat->display_destroy.link); wl_list_remove(&seat->display_destroy.link);

View File

@ -8,7 +8,6 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "types/wlr_data_device.h" #include "types/wlr_data_device.h"
#include "types/wlr_seat.h" #include "types/wlr_seat.h"
#include "util/signal.h"
static void default_keyboard_enter(struct wlr_seat_keyboard_grab *grab, static void default_keyboard_enter(struct wlr_seat_keyboard_grab *grab,
struct wlr_surface *surface, uint32_t keycodes[], size_t num_keycodes, struct wlr_surface *surface, uint32_t keycodes[], size_t num_keycodes,
@ -168,7 +167,7 @@ void wlr_seat_keyboard_start_grab(struct wlr_seat *wlr_seat,
grab->seat = wlr_seat; grab->seat = wlr_seat;
wlr_seat->keyboard_state.grab = grab; wlr_seat->keyboard_state.grab = grab;
wlr_signal_emit_safe(&wlr_seat->events.keyboard_grab_begin, grab); wl_signal_emit_mutable(&wlr_seat->events.keyboard_grab_begin, grab);
} }
void wlr_seat_keyboard_end_grab(struct wlr_seat *wlr_seat) { void wlr_seat_keyboard_end_grab(struct wlr_seat *wlr_seat) {
@ -176,7 +175,7 @@ void wlr_seat_keyboard_end_grab(struct wlr_seat *wlr_seat) {
if (grab != wlr_seat->keyboard_state.default_grab) { if (grab != wlr_seat->keyboard_state.default_grab) {
wlr_seat->keyboard_state.grab = wlr_seat->keyboard_state.default_grab; wlr_seat->keyboard_state.grab = wlr_seat->keyboard_state.default_grab;
wlr_signal_emit_safe(&wlr_seat->events.keyboard_grab_end, grab); wl_signal_emit_mutable(&wlr_seat->events.keyboard_grab_end, grab);
if (grab->interface->cancel) { if (grab->interface->cancel) {
grab->interface->cancel(grab); grab->interface->cancel(grab);
} }
@ -303,7 +302,7 @@ void wlr_seat_keyboard_enter(struct wlr_seat *seat,
.old_surface = focused_surface, .old_surface = focused_surface,
.new_surface = surface, .new_surface = surface,
}; };
wlr_signal_emit_safe(&seat->keyboard_state.events.focus_change, &event); wl_signal_emit_mutable(&seat->keyboard_state.events.focus_change, &event);
} }
void wlr_seat_keyboard_notify_enter(struct wlr_seat *seat, void wlr_seat_keyboard_notify_enter(struct wlr_seat *seat,

View File

@ -7,7 +7,6 @@
#include <wlr/types/wlr_compositor.h> #include <wlr/types/wlr_compositor.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "types/wlr_seat.h" #include "types/wlr_seat.h"
#include "util/signal.h"
#include "util/array.h" #include "util/array.h"
static void default_pointer_enter(struct wlr_seat_pointer_grab *grab, static void default_pointer_enter(struct wlr_seat_pointer_grab *grab,
@ -101,7 +100,7 @@ static void pointer_set_cursor(struct wl_client *client,
.hotspot_x = hotspot_x, .hotspot_x = hotspot_x,
.hotspot_y = hotspot_y, .hotspot_y = hotspot_y,
}; };
wlr_signal_emit_safe(&seat_client->seat->events.request_set_cursor, &event); wl_signal_emit_mutable(&seat_client->seat->events.request_set_cursor, &event);
} }
static void pointer_release(struct wl_client *client, static void pointer_release(struct wl_client *client,
@ -211,7 +210,7 @@ void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat,
.sx = sx, .sx = sx,
.sy = sy, .sy = sy,
}; };
wlr_signal_emit_safe(&wlr_seat->pointer_state.events.focus_change, &event); wl_signal_emit_mutable(&wlr_seat->pointer_state.events.focus_change, &event);
} }
void wlr_seat_pointer_clear_focus(struct wlr_seat *wlr_seat) { void wlr_seat_pointer_clear_focus(struct wlr_seat *wlr_seat) {
@ -403,14 +402,14 @@ void wlr_seat_pointer_start_grab(struct wlr_seat *wlr_seat,
grab->seat = wlr_seat; grab->seat = wlr_seat;
wlr_seat->pointer_state.grab = grab; wlr_seat->pointer_state.grab = grab;
wlr_signal_emit_safe(&wlr_seat->events.pointer_grab_begin, grab); wl_signal_emit_mutable(&wlr_seat->events.pointer_grab_begin, grab);
} }
void wlr_seat_pointer_end_grab(struct wlr_seat *wlr_seat) { void wlr_seat_pointer_end_grab(struct wlr_seat *wlr_seat) {
struct wlr_seat_pointer_grab *grab = wlr_seat->pointer_state.grab; struct wlr_seat_pointer_grab *grab = wlr_seat->pointer_state.grab;
if (grab != wlr_seat->pointer_state.default_grab) { if (grab != wlr_seat->pointer_state.default_grab) {
wlr_seat->pointer_state.grab = wlr_seat->pointer_state.default_grab; wlr_seat->pointer_state.grab = wlr_seat->pointer_state.default_grab;
wlr_signal_emit_safe(&wlr_seat->events.pointer_grab_end, grab); wl_signal_emit_mutable(&wlr_seat->events.pointer_grab_end, grab);
if (grab->interface->cancel) { if (grab->interface->cancel) {
grab->interface->cancel(grab); grab->interface->cancel(grab);
} }

View File

@ -7,7 +7,6 @@
#include <wlr/types/wlr_compositor.h> #include <wlr/types/wlr_compositor.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "types/wlr_seat.h" #include "types/wlr_seat.h"
#include "util/signal.h"
static uint32_t default_touch_down(struct wlr_seat_touch_grab *grab, static uint32_t default_touch_down(struct wlr_seat_touch_grab *grab,
uint32_t time, struct wlr_touch_point *point) { uint32_t time, struct wlr_touch_point *point) {
@ -84,7 +83,7 @@ void wlr_seat_touch_start_grab(struct wlr_seat *wlr_seat,
grab->seat = wlr_seat; grab->seat = wlr_seat;
wlr_seat->touch_state.grab = grab; wlr_seat->touch_state.grab = grab;
wlr_signal_emit_safe(&wlr_seat->events.touch_grab_begin, grab); wl_signal_emit_mutable(&wlr_seat->events.touch_grab_begin, grab);
} }
void wlr_seat_touch_end_grab(struct wlr_seat *wlr_seat) { void wlr_seat_touch_end_grab(struct wlr_seat *wlr_seat) {
@ -92,7 +91,7 @@ void wlr_seat_touch_end_grab(struct wlr_seat *wlr_seat) {
if (grab != wlr_seat->touch_state.default_grab) { if (grab != wlr_seat->touch_state.default_grab) {
wlr_seat->touch_state.grab = wlr_seat->touch_state.default_grab; wlr_seat->touch_state.grab = wlr_seat->touch_state.default_grab;
wlr_signal_emit_safe(&wlr_seat->events.touch_grab_end, grab); wl_signal_emit_mutable(&wlr_seat->events.touch_grab_end, grab);
if (grab->interface->cancel) { if (grab->interface->cancel) {
grab->interface->cancel(grab); grab->interface->cancel(grab);
} }
@ -108,7 +107,7 @@ static void touch_point_clear_focus(struct wlr_touch_point *point) {
} }
static void touch_point_destroy(struct wlr_touch_point *point) { static void touch_point_destroy(struct wlr_touch_point *point) {
wlr_signal_emit_safe(&point->events.destroy, point); wl_signal_emit_mutable(&point->events.destroy, point);
touch_point_clear_focus(point); touch_point_clear_focus(point);
wl_list_remove(&point->surface_destroy.link); wl_list_remove(&point->surface_destroy.link);

View File

@ -13,7 +13,6 @@
#include <wlr/types/wlr_tablet_v2.h> #include <wlr/types/wlr_tablet_v2.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "tablet-unstable-v2-protocol.h" #include "tablet-unstable-v2-protocol.h"
#include "util/signal.h"
#define TABLET_MANAGER_VERSION 1 #define TABLET_MANAGER_VERSION 1
@ -275,7 +274,7 @@ static void tablet_v2_bind(struct wl_client *wl_client, void *data,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_tablet_manager_v2 *manager = struct wlr_tablet_manager_v2 *manager =
wl_container_of(listener, manager, display_destroy); wl_container_of(listener, manager, display_destroy);
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->wl_global); wl_global_destroy(manager->wl_global);
free(manager); free(manager);

View File

@ -11,7 +11,6 @@
#include <wlr/types/wlr_tablet_pad.h> #include <wlr/types/wlr_tablet_pad.h>
#include <wlr/types/wlr_tablet_v2.h> #include <wlr/types/wlr_tablet_v2.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
#include "tablet-unstable-v2-protocol.h" #include "tablet-unstable-v2-protocol.h"
static const struct wlr_tablet_pad_v2_grab_interface default_pad_grab_interface; static const struct wlr_tablet_pad_v2_grab_interface default_pad_grab_interface;
@ -52,7 +51,7 @@ static void handle_tablet_pad_ring_v2_set_feedback(struct wl_client *client,
.index = aux->index .index = aux->index
}; };
wlr_signal_emit_safe(&aux->pad->pad->events.ring_feedback, &evt); wl_signal_emit_mutable(&aux->pad->pad->events.ring_feedback, &evt);
} }
static void handle_tablet_pad_ring_v2_destroy(struct wl_client *client, static void handle_tablet_pad_ring_v2_destroy(struct wl_client *client,
@ -90,7 +89,7 @@ static void handle_tablet_pad_strip_v2_set_feedback(struct wl_client *client,
.index = aux->index .index = aux->index
}; };
wlr_signal_emit_safe(&aux->pad->pad->events.strip_feedback, &evt); wl_signal_emit_mutable(&aux->pad->pad->events.strip_feedback, &evt);
} }
static void handle_tablet_pad_strip_v2_destroy(struct wl_client *client, static void handle_tablet_pad_strip_v2_destroy(struct wl_client *client,
@ -117,7 +116,7 @@ static void handle_tablet_pad_v2_set_feedback( struct wl_client *client,
.description = description, .description = description,
}; };
wlr_signal_emit_safe(&pad->pad->events.button_feedback, &evt); wl_signal_emit_mutable(&pad->pad->events.button_feedback, &evt);
} }
static const struct zwp_tablet_pad_v2_interface tablet_pad_impl = { static const struct zwp_tablet_pad_v2_interface tablet_pad_impl = {

View File

@ -11,7 +11,6 @@
#include <wlr/types/wlr_tablet_v2.h> #include <wlr/types/wlr_tablet_v2.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/array.h" #include "util/array.h"
#include "util/signal.h"
#include "util/time.h" #include "util/time.h"
#include "tablet-unstable-v2-protocol.h" #include "tablet-unstable-v2-protocol.h"
@ -47,7 +46,7 @@ static void handle_tablet_tool_v2_set_cursor(struct wl_client *client,
.seat_client = tool->seat->seat_client, .seat_client = tool->seat->seat_client,
}; };
wlr_signal_emit_safe(&tool->tool->events.set_cursor, &evt); wl_signal_emit_mutable(&tool->tool->events.set_cursor, &evt);
} }
static void handle_tablet_tool_v2_destroy(struct wl_client *client, static void handle_tablet_tool_v2_destroy(struct wl_client *client,

View File

@ -9,7 +9,6 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "render/pixel_format.h" #include "render/pixel_format.h"
#include "types/wlr_buffer.h" #include "types/wlr_buffer.h"
#include "util/signal.h"
void wlr_buffer_init(struct wlr_buffer *buffer, void wlr_buffer_init(struct wlr_buffer *buffer,
const struct wlr_buffer_impl *impl, int width, int height) { const struct wlr_buffer_impl *impl, int width, int height) {
@ -34,7 +33,7 @@ static void buffer_consider_destroy(struct wlr_buffer *buffer) {
assert(!buffer->accessing_data_ptr); assert(!buffer->accessing_data_ptr);
wlr_signal_emit_safe(&buffer->events.destroy, NULL); wl_signal_emit_mutable(&buffer->events.destroy, NULL);
wlr_addon_set_finish(&buffer->addons); wlr_addon_set_finish(&buffer->addons);
buffer->impl->destroy(buffer); buffer->impl->destroy(buffer);
@ -64,7 +63,7 @@ void wlr_buffer_unlock(struct wlr_buffer *buffer) {
buffer->n_locks--; buffer->n_locks--;
if (buffer->n_locks == 0) { if (buffer->n_locks == 0) {
wlr_signal_emit_safe(&buffer->events.release, NULL); wl_signal_emit_mutable(&buffer->events.release, NULL);
} }
buffer_consider_destroy(buffer); buffer_consider_destroy(buffer);

View File

@ -12,7 +12,6 @@
#include <wlr/util/region.h> #include <wlr/util/region.h>
#include "types/wlr_buffer.h" #include "types/wlr_buffer.h"
#include "types/wlr_region.h" #include "types/wlr_region.h"
#include "util/signal.h"
#include "util/time.h" #include "util/time.h"
#define COMPOSITOR_VERSION 5 #define COMPOSITOR_VERSION 5
@ -492,7 +491,7 @@ static void surface_commit_state(struct wlr_surface *surface,
surface->role->commit(surface); surface->role->commit(surface);
} }
wlr_signal_emit_safe(&surface->events.commit, surface); wl_signal_emit_mutable(&surface->events.commit, surface);
} }
static void collect_subsurface_damage_iter(struct wlr_surface *surface, static void collect_subsurface_damage_iter(struct wlr_surface *surface,
@ -531,7 +530,7 @@ static void subsurface_parent_commit(struct wlr_subsurface *subsurface) {
if (!subsurface->added) { if (!subsurface->added) {
subsurface->added = true; subsurface->added = true;
wlr_signal_emit_safe(&subsurface->parent->events.new_subsurface, wl_signal_emit_mutable(&subsurface->parent->events.new_subsurface,
subsurface); subsurface);
} }
} }
@ -541,7 +540,7 @@ static void surface_handle_commit(struct wl_client *client,
struct wlr_surface *surface = wlr_surface_from_resource(resource); struct wlr_surface *surface = wlr_surface_from_resource(resource);
surface_finalize_pending(surface); surface_finalize_pending(surface);
wlr_signal_emit_safe(&surface->events.client_commit, NULL); wl_signal_emit_mutable(&surface->events.client_commit, NULL);
if (surface->pending.cached_state_locks > 0 || !wl_list_empty(&surface->cached)) { if (surface->pending.cached_state_locks > 0 || !wl_list_empty(&surface->cached)) {
surface_cache_pending(surface); surface_cache_pending(surface);
@ -667,7 +666,7 @@ static void surface_handle_resource_destroy(struct wl_resource *resource) {
surface_output_destroy(surface_output); surface_output_destroy(surface_output);
} }
wlr_signal_emit_safe(&surface->events.destroy, surface); wl_signal_emit_mutable(&surface->events.destroy, surface);
wlr_addon_set_finish(&surface->addons); wlr_addon_set_finish(&surface->addons);
@ -1126,7 +1125,7 @@ static void compositor_create_surface(struct wl_client *client,
return; return;
} }
wlr_signal_emit_safe(&compositor->events.new_surface, surface); wl_signal_emit_mutable(&compositor->events.new_surface, surface);
} }
static void compositor_create_region(struct wl_client *client, static void compositor_create_region(struct wl_client *client,
@ -1156,7 +1155,7 @@ static void compositor_handle_display_destroy(
struct wl_listener *listener, void *data) { struct wl_listener *listener, void *data) {
struct wlr_compositor *compositor = struct wlr_compositor *compositor =
wl_container_of(listener, compositor, display_destroy); wl_container_of(listener, compositor, display_destroy);
wlr_signal_emit_safe(&compositor->events.destroy, NULL); wl_signal_emit_mutable(&compositor->events.destroy, NULL);
wl_list_remove(&compositor->display_destroy.link); wl_list_remove(&compositor->display_destroy.link);
wl_global_destroy(compositor->global); wl_global_destroy(compositor->global);
free(compositor); free(compositor);

View File

@ -12,7 +12,6 @@
#include <wlr/types/wlr_touch.h> #include <wlr/types/wlr_touch.h>
#include <wlr/util/box.h> #include <wlr/util/box.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
struct wlr_cursor_device { struct wlr_cursor_device {
struct wlr_cursor *cursor; struct wlr_cursor *cursor;
@ -368,7 +367,7 @@ static void handle_pointer_motion(struct wl_listener *listener, void *data) {
struct wlr_pointer_motion_event *event = data; struct wlr_pointer_motion_event *event = data;
struct wlr_cursor_device *device = struct wlr_cursor_device *device =
wl_container_of(listener, device, motion); wl_container_of(listener, device, motion);
wlr_signal_emit_safe(&device->cursor->events.motion, event); wl_signal_emit_mutable(&device->cursor->events.motion, event);
} }
static void apply_output_transform(double *x, double *y, static void apply_output_transform(double *x, double *y,
@ -440,80 +439,80 @@ static void handle_pointer_motion_absolute(struct wl_listener *listener,
if (output) { if (output) {
apply_output_transform(&event->x, &event->y, output->transform); apply_output_transform(&event->x, &event->y, output->transform);
} }
wlr_signal_emit_safe(&device->cursor->events.motion_absolute, event); wl_signal_emit_mutable(&device->cursor->events.motion_absolute, event);
} }
static void handle_pointer_button(struct wl_listener *listener, void *data) { static void handle_pointer_button(struct wl_listener *listener, void *data) {
struct wlr_pointer_button_event *event = data; struct wlr_pointer_button_event *event = data;
struct wlr_cursor_device *device = struct wlr_cursor_device *device =
wl_container_of(listener, device, button); wl_container_of(listener, device, button);
wlr_signal_emit_safe(&device->cursor->events.button, event); wl_signal_emit_mutable(&device->cursor->events.button, event);
} }
static void handle_pointer_axis(struct wl_listener *listener, void *data) { static void handle_pointer_axis(struct wl_listener *listener, void *data) {
struct wlr_pointer_axis_event *event = data; struct wlr_pointer_axis_event *event = data;
struct wlr_cursor_device *device = wl_container_of(listener, device, axis); struct wlr_cursor_device *device = wl_container_of(listener, device, axis);
wlr_signal_emit_safe(&device->cursor->events.axis, event); wl_signal_emit_mutable(&device->cursor->events.axis, event);
} }
static void handle_pointer_frame(struct wl_listener *listener, void *data) { static void handle_pointer_frame(struct wl_listener *listener, void *data) {
struct wlr_cursor_device *device = wl_container_of(listener, device, frame); struct wlr_cursor_device *device = wl_container_of(listener, device, frame);
wlr_signal_emit_safe(&device->cursor->events.frame, device->cursor); wl_signal_emit_mutable(&device->cursor->events.frame, device->cursor);
} }
static void handle_pointer_swipe_begin(struct wl_listener *listener, void *data) { static void handle_pointer_swipe_begin(struct wl_listener *listener, void *data) {
struct wlr_pointer_swipe_begin_event *event = data; struct wlr_pointer_swipe_begin_event *event = data;
struct wlr_cursor_device *device = wl_container_of(listener, device, swipe_begin); struct wlr_cursor_device *device = wl_container_of(listener, device, swipe_begin);
wlr_signal_emit_safe(&device->cursor->events.swipe_begin, event); wl_signal_emit_mutable(&device->cursor->events.swipe_begin, event);
} }
static void handle_pointer_swipe_update(struct wl_listener *listener, void *data) { static void handle_pointer_swipe_update(struct wl_listener *listener, void *data) {
struct wlr_pointer_swipe_update_event *event = data; struct wlr_pointer_swipe_update_event *event = data;
struct wlr_cursor_device *device = wl_container_of(listener, device, swipe_update); struct wlr_cursor_device *device = wl_container_of(listener, device, swipe_update);
wlr_signal_emit_safe(&device->cursor->events.swipe_update, event); wl_signal_emit_mutable(&device->cursor->events.swipe_update, event);
} }
static void handle_pointer_swipe_end(struct wl_listener *listener, void *data) { static void handle_pointer_swipe_end(struct wl_listener *listener, void *data) {
struct wlr_pointer_swipe_end_event *event = data; struct wlr_pointer_swipe_end_event *event = data;
struct wlr_cursor_device *device = wl_container_of(listener, device, swipe_end); struct wlr_cursor_device *device = wl_container_of(listener, device, swipe_end);
wlr_signal_emit_safe(&device->cursor->events.swipe_end, event); wl_signal_emit_mutable(&device->cursor->events.swipe_end, event);
} }
static void handle_pointer_pinch_begin(struct wl_listener *listener, void *data) { static void handle_pointer_pinch_begin(struct wl_listener *listener, void *data) {
struct wlr_pointer_pinch_begin_event *event = data; struct wlr_pointer_pinch_begin_event *event = data;
struct wlr_cursor_device *device = wl_container_of(listener, device, pinch_begin); struct wlr_cursor_device *device = wl_container_of(listener, device, pinch_begin);
wlr_signal_emit_safe(&device->cursor->events.pinch_begin, event); wl_signal_emit_mutable(&device->cursor->events.pinch_begin, event);
} }
static void handle_pointer_pinch_update(struct wl_listener *listener, void *data) { static void handle_pointer_pinch_update(struct wl_listener *listener, void *data) {
struct wlr_pointer_pinch_update_event *event = data; struct wlr_pointer_pinch_update_event *event = data;
struct wlr_cursor_device *device = wl_container_of(listener, device, pinch_update); struct wlr_cursor_device *device = wl_container_of(listener, device, pinch_update);
wlr_signal_emit_safe(&device->cursor->events.pinch_update, event); wl_signal_emit_mutable(&device->cursor->events.pinch_update, event);
} }
static void handle_pointer_pinch_end(struct wl_listener *listener, void *data) { static void handle_pointer_pinch_end(struct wl_listener *listener, void *data) {
struct wlr_pointer_pinch_end_event *event = data; struct wlr_pointer_pinch_end_event *event = data;
struct wlr_cursor_device *device = wl_container_of(listener, device, pinch_end); struct wlr_cursor_device *device = wl_container_of(listener, device, pinch_end);
wlr_signal_emit_safe(&device->cursor->events.pinch_end, event); wl_signal_emit_mutable(&device->cursor->events.pinch_end, event);
} }
static void handle_pointer_hold_begin(struct wl_listener *listener, void *data) { static void handle_pointer_hold_begin(struct wl_listener *listener, void *data) {
struct wlr_pointer_hold_begin_event *event = data; struct wlr_pointer_hold_begin_event *event = data;
struct wlr_cursor_device *device = wl_container_of(listener, device, hold_begin); struct wlr_cursor_device *device = wl_container_of(listener, device, hold_begin);
wlr_signal_emit_safe(&device->cursor->events.hold_begin, event); wl_signal_emit_mutable(&device->cursor->events.hold_begin, event);
} }
static void handle_pointer_hold_end(struct wl_listener *listener, void *data) { static void handle_pointer_hold_end(struct wl_listener *listener, void *data) {
struct wlr_pointer_hold_end_event *event = data; struct wlr_pointer_hold_end_event *event = data;
struct wlr_cursor_device *device = wl_container_of(listener, device, hold_end); struct wlr_cursor_device *device = wl_container_of(listener, device, hold_end);
wlr_signal_emit_safe(&device->cursor->events.hold_end, event); wl_signal_emit_mutable(&device->cursor->events.hold_end, event);
} }
static void handle_touch_up(struct wl_listener *listener, void *data) { static void handle_touch_up(struct wl_listener *listener, void *data) {
struct wlr_touch_up_event *event = data; struct wlr_touch_up_event *event = data;
struct wlr_cursor_device *device; struct wlr_cursor_device *device;
device = wl_container_of(listener, device, touch_up); device = wl_container_of(listener, device, touch_up);
wlr_signal_emit_safe(&device->cursor->events.touch_up, event); wl_signal_emit_mutable(&device->cursor->events.touch_up, event);
} }
static void handle_touch_down(struct wl_listener *listener, void *data) { static void handle_touch_down(struct wl_listener *listener, void *data) {
@ -526,7 +525,7 @@ static void handle_touch_down(struct wl_listener *listener, void *data) {
if (output) { if (output) {
apply_output_transform(&event->x, &event->y, output->transform); apply_output_transform(&event->x, &event->y, output->transform);
} }
wlr_signal_emit_safe(&device->cursor->events.touch_down, event); wl_signal_emit_mutable(&device->cursor->events.touch_down, event);
} }
static void handle_touch_motion(struct wl_listener *listener, void *data) { static void handle_touch_motion(struct wl_listener *listener, void *data) {
@ -539,20 +538,20 @@ static void handle_touch_motion(struct wl_listener *listener, void *data) {
if (output) { if (output) {
apply_output_transform(&event->x, &event->y, output->transform); apply_output_transform(&event->x, &event->y, output->transform);
} }
wlr_signal_emit_safe(&device->cursor->events.touch_motion, event); wl_signal_emit_mutable(&device->cursor->events.touch_motion, event);
} }
static void handle_touch_cancel(struct wl_listener *listener, void *data) { static void handle_touch_cancel(struct wl_listener *listener, void *data) {
struct wlr_touch_cancel_event *event = data; struct wlr_touch_cancel_event *event = data;
struct wlr_cursor_device *device; struct wlr_cursor_device *device;
device = wl_container_of(listener, device, touch_cancel); device = wl_container_of(listener, device, touch_cancel);
wlr_signal_emit_safe(&device->cursor->events.touch_cancel, event); wl_signal_emit_mutable(&device->cursor->events.touch_cancel, event);
} }
static void handle_touch_frame(struct wl_listener *listener, void *data) { static void handle_touch_frame(struct wl_listener *listener, void *data) {
struct wlr_cursor_device *device = struct wlr_cursor_device *device =
wl_container_of(listener, device, touch_frame); wl_container_of(listener, device, touch_frame);
wlr_signal_emit_safe(&device->cursor->events.touch_frame, NULL); wl_signal_emit_mutable(&device->cursor->events.touch_frame, NULL);
} }
static void handle_tablet_tool_tip(struct wl_listener *listener, void *data) { static void handle_tablet_tool_tip(struct wl_listener *listener, void *data) {
@ -565,7 +564,7 @@ static void handle_tablet_tool_tip(struct wl_listener *listener, void *data) {
if (output) { if (output) {
apply_output_transform(&event->x, &event->y, output->transform); apply_output_transform(&event->x, &event->y, output->transform);
} }
wlr_signal_emit_safe(&device->cursor->events.tablet_tool_tip, event); wl_signal_emit_mutable(&device->cursor->events.tablet_tool_tip, event);
} }
static void handle_tablet_tool_axis(struct wl_listener *listener, void *data) { static void handle_tablet_tool_axis(struct wl_listener *listener, void *data) {
@ -600,7 +599,7 @@ static void handle_tablet_tool_axis(struct wl_listener *listener, void *data) {
} }
} }
wlr_signal_emit_safe(&device->cursor->events.tablet_tool_axis, event); wl_signal_emit_mutable(&device->cursor->events.tablet_tool_axis, event);
} }
static void handle_tablet_tool_button(struct wl_listener *listener, static void handle_tablet_tool_button(struct wl_listener *listener,
@ -608,7 +607,7 @@ static void handle_tablet_tool_button(struct wl_listener *listener,
struct wlr_tablet_tool_button *event = data; struct wlr_tablet_tool_button *event = data;
struct wlr_cursor_device *device; struct wlr_cursor_device *device;
device = wl_container_of(listener, device, tablet_tool_button); device = wl_container_of(listener, device, tablet_tool_button);
wlr_signal_emit_safe(&device->cursor->events.tablet_tool_button, event); wl_signal_emit_mutable(&device->cursor->events.tablet_tool_button, event);
} }
static void handle_tablet_tool_proximity(struct wl_listener *listener, static void handle_tablet_tool_proximity(struct wl_listener *listener,
@ -622,7 +621,7 @@ static void handle_tablet_tool_proximity(struct wl_listener *listener,
if (output) { if (output) {
apply_output_transform(&event->x, &event->y, output->transform); apply_output_transform(&event->x, &event->y, output->transform);
} }
wlr_signal_emit_safe(&device->cursor->events.tablet_tool_proximity, event); wl_signal_emit_mutable(&device->cursor->events.tablet_tool_proximity, event);
} }
static void handle_device_destroy(struct wl_listener *listener, void *data) { static void handle_device_destroy(struct wl_listener *listener, void *data) {

View File

@ -4,7 +4,6 @@
#include <pixman.h> #include <pixman.h>
#include <wlr/types/wlr_damage_ring.h> #include <wlr/types/wlr_damage_ring.h>
#include <wlr/util/box.h> #include <wlr/util/box.h>
#include "util/signal.h"
#define WLR_DAMAGE_RING_MAX_RECTS 20 #define WLR_DAMAGE_RING_MAX_RECTS 20

View File

@ -7,7 +7,6 @@
#include <wlr/types/wlr_data_device.h> #include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_primary_selection.h> #include <wlr/types/wlr_primary_selection.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
#include "wlr-data-control-unstable-v1-protocol.h" #include "wlr-data-control-unstable-v1-protocol.h"
#define DATA_CONTROL_MANAGER_VERSION 2 #define DATA_CONTROL_MANAGER_VERSION 2
@ -628,7 +627,7 @@ static void manager_handle_get_data_device(struct wl_client *client,
&device->seat_set_primary_selection); &device->seat_set_primary_selection);
wl_list_insert(&manager->devices, &device->link); wl_list_insert(&manager->devices, &device->link);
wlr_signal_emit_safe(&manager->events.new_device, device); wl_signal_emit_mutable(&manager->events.new_device, device);
// At this point maybe the compositor decided to destroy the device. If // At this point maybe the compositor decided to destroy the device. If
// it's the case then the resource will be inert. // it's the case then the resource will be inert.
@ -666,7 +665,7 @@ static void manager_bind(struct wl_client *client, void *data, uint32_t version,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_data_control_manager_v1 *manager = struct wlr_data_control_manager_v1 *manager =
wl_container_of(listener, manager, display_destroy); wl_container_of(listener, manager, display_destroy);
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->global); wl_global_destroy(manager->global);
free(manager); free(manager);

View File

@ -11,7 +11,6 @@
#include <wlr/types/wlr_drm.h> #include <wlr/types/wlr_drm.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "drm-protocol.h" #include "drm-protocol.h"
#include "util/signal.h"
#define WLR_DRM_VERSION 2 #define WLR_DRM_VERSION 2
@ -172,7 +171,7 @@ static void drm_bind(struct wl_client *client, void *data,
} }
static void drm_destroy(struct wlr_drm *drm) { static void drm_destroy(struct wlr_drm *drm) {
wlr_signal_emit_safe(&drm->events.destroy, NULL); wl_signal_emit_mutable(&drm->events.destroy, NULL);
wl_list_remove(&drm->display_destroy.link); wl_list_remove(&drm->display_destroy.link);
wl_list_remove(&drm->renderer_destroy.link); wl_list_remove(&drm->renderer_destroy.link);

View File

@ -9,7 +9,6 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "backend/drm/drm.h" #include "backend/drm/drm.h"
#include "drm-lease-v1-protocol.h" #include "drm-lease-v1-protocol.h"
#include "util/signal.h"
#include "util/global.h" #include "util/global.h"
#define DRM_LEASE_DEVICE_V1_VERSION 1 #define DRM_LEASE_DEVICE_V1_VERSION 1
@ -353,7 +352,7 @@ static void drm_lease_request_v1_handle_submit(
request->lease = lease; request->lease = lease;
/* TODO: reject the request if the user does not grant it */ /* TODO: reject the request if the user does not grant it */
wlr_signal_emit_safe(&request->device->manager->events.request, wl_signal_emit_mutable(&request->device->manager->events.request,
request); request);
/* Request is done */ /* Request is done */

View File

@ -6,7 +6,6 @@
#include <wlr/types/wlr_export_dmabuf_v1.h> #include <wlr/types/wlr_export_dmabuf_v1.h>
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
#include "wlr-export-dmabuf-unstable-v1-protocol.h" #include "wlr-export-dmabuf-unstable-v1-protocol.h"
#define EXPORT_DMABUF_MANAGER_VERSION 1 #define EXPORT_DMABUF_MANAGER_VERSION 1
@ -182,7 +181,7 @@ static void manager_bind(struct wl_client *client, void *data, uint32_t version,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_export_dmabuf_manager_v1 *manager = struct wlr_export_dmabuf_manager_v1 *manager =
wl_container_of(listener, manager, display_destroy); wl_container_of(listener, manager, display_destroy);
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->global); wl_global_destroy(manager->global);
free(manager); free(manager);

View File

@ -7,7 +7,6 @@
#include <wlr/types/wlr_foreign_toplevel_management_v1.h> #include <wlr/types/wlr_foreign_toplevel_management_v1.h>
#include <wlr/types/wlr_seat.h> #include <wlr/types/wlr_seat.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
#include "wlr-foreign-toplevel-management-unstable-v1-protocol.h" #include "wlr-foreign-toplevel-management-unstable-v1-protocol.h"
#define FOREIGN_TOPLEVEL_MANAGEMENT_V1_VERSION 3 #define FOREIGN_TOPLEVEL_MANAGEMENT_V1_VERSION 3
@ -33,7 +32,7 @@ static void toplevel_handle_send_maximized_event(struct wl_resource *resource,
.toplevel = toplevel, .toplevel = toplevel,
.maximized = state, .maximized = state,
}; };
wlr_signal_emit_safe(&toplevel->events.request_maximize, &event); wl_signal_emit_mutable(&toplevel->events.request_maximize, &event);
} }
static void foreign_toplevel_handle_set_maximized(struct wl_client *client, static void foreign_toplevel_handle_set_maximized(struct wl_client *client,
@ -58,7 +57,7 @@ static void toplevel_send_minimized_event(struct wl_resource *resource,
.toplevel = toplevel, .toplevel = toplevel,
.minimized = state, .minimized = state,
}; };
wlr_signal_emit_safe(&toplevel->events.request_minimize, &event); wl_signal_emit_mutable(&toplevel->events.request_minimize, &event);
} }
static void foreign_toplevel_handle_set_minimized(struct wl_client *client, static void foreign_toplevel_handle_set_minimized(struct wl_client *client,
@ -88,7 +87,7 @@ static void toplevel_send_fullscreen_event(struct wl_resource *resource,
.fullscreen = state, .fullscreen = state,
.output = output, .output = output,
}; };
wlr_signal_emit_safe(&toplevel->events.request_fullscreen, &event); wl_signal_emit_mutable(&toplevel->events.request_fullscreen, &event);
} }
static void foreign_toplevel_handle_set_fullscreen(struct wl_client *client, static void foreign_toplevel_handle_set_fullscreen(struct wl_client *client,
@ -117,7 +116,7 @@ static void foreign_toplevel_handle_activate(struct wl_client *client,
.toplevel = toplevel, .toplevel = toplevel,
.seat = seat_client->seat, .seat = seat_client->seat,
}; };
wlr_signal_emit_safe(&toplevel->events.request_activate, &event); wl_signal_emit_mutable(&toplevel->events.request_activate, &event);
} }
static void foreign_toplevel_handle_close(struct wl_client *client, static void foreign_toplevel_handle_close(struct wl_client *client,
@ -127,7 +126,7 @@ static void foreign_toplevel_handle_close(struct wl_client *client,
if (!toplevel) { if (!toplevel) {
return; return;
} }
wlr_signal_emit_safe(&toplevel->events.request_close, toplevel); wl_signal_emit_mutable(&toplevel->events.request_close, toplevel);
} }
static void foreign_toplevel_handle_set_rectangle(struct wl_client *client, static void foreign_toplevel_handle_set_rectangle(struct wl_client *client,
@ -154,7 +153,7 @@ static void foreign_toplevel_handle_set_rectangle(struct wl_client *client,
.width = width, .width = width,
.height = height, .height = height,
}; };
wlr_signal_emit_safe(&toplevel->events.set_rectangle, &event); wl_signal_emit_mutable(&toplevel->events.set_rectangle, &event);
} }
static void foreign_toplevel_handle_destroy(struct wl_client *client, static void foreign_toplevel_handle_destroy(struct wl_client *client,
@ -495,7 +494,7 @@ void wlr_foreign_toplevel_handle_v1_destroy(
return; return;
} }
wlr_signal_emit_safe(&toplevel->events.destroy, toplevel); wl_signal_emit_mutable(&toplevel->events.destroy, toplevel);
struct wl_resource *resource, *tmp; struct wl_resource *resource, *tmp;
wl_resource_for_each_safe(resource, tmp, &toplevel->resources) { wl_resource_for_each_safe(resource, tmp, &toplevel->resources) {
@ -678,7 +677,7 @@ static void foreign_toplevel_manager_bind(struct wl_client *client, void *data,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_foreign_toplevel_manager_v1 *manager = struct wlr_foreign_toplevel_manager_v1 *manager =
wl_container_of(listener, manager, display_destroy); wl_container_of(listener, manager, display_destroy);
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->global); wl_global_destroy(manager->global);
free(manager); free(manager);

View File

@ -4,7 +4,6 @@
#include <wlr/types/wlr_fullscreen_shell_v1.h> #include <wlr/types/wlr_fullscreen_shell_v1.h>
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
#define FULLSCREEN_SHELL_VERSION 1 #define FULLSCREEN_SHELL_VERSION 1
@ -37,7 +36,7 @@ static void shell_handle_present_surface(struct wl_client *client,
.method = method, .method = method,
.output = output, .output = output,
}; };
wlr_signal_emit_safe(&shell->events.present_surface, &event); wl_signal_emit_mutable(&shell->events.present_surface, &event);
} }
static void shell_handle_present_surface_for_mode(struct wl_client *client, static void shell_handle_present_surface_for_mode(struct wl_client *client,
@ -79,7 +78,7 @@ static void shell_bind(struct wl_client *client, void *data, uint32_t version,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_fullscreen_shell_v1 *shell = struct wlr_fullscreen_shell_v1 *shell =
wl_container_of(listener, shell, display_destroy); wl_container_of(listener, shell, display_destroy);
wlr_signal_emit_safe(&shell->events.destroy, shell); wl_signal_emit_mutable(&shell->events.destroy, shell);
wl_list_remove(&shell->display_destroy.link); wl_list_remove(&shell->display_destroy.link);
wl_global_destroy(shell->global); wl_global_destroy(shell->global);
free(shell); free(shell);

View File

@ -7,7 +7,6 @@
#include <wlr/types/wlr_gamma_control_v1.h> #include <wlr/types/wlr_gamma_control_v1.h>
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
#include "wlr-gamma-control-unstable-v1-protocol.h" #include "wlr-gamma-control-unstable-v1-protocol.h"
#define GAMMA_CONTROL_MANAGER_V1_VERSION 1 #define GAMMA_CONTROL_MANAGER_V1_VERSION 1
@ -259,7 +258,7 @@ static void gamma_control_manager_bind(struct wl_client *client, void *data,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_gamma_control_manager_v1 *manager = struct wlr_gamma_control_manager_v1 *manager =
wl_container_of(listener, manager, display_destroy); wl_container_of(listener, manager, display_destroy);
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->global); wl_global_destroy(manager->global);
free(manager); free(manager);

View File

@ -5,7 +5,6 @@
#include <wlr/types/wlr_idle.h> #include <wlr/types/wlr_idle.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "idle-protocol.h" #include "idle-protocol.h"
#include "util/signal.h"
static const struct org_kde_kwin_idle_timeout_interface idle_timeout_impl; static const struct org_kde_kwin_idle_timeout_interface idle_timeout_impl;
@ -22,7 +21,7 @@ static int idle_notify(void *data) {
return 0; return 0;
} }
timer->idle_state = true; timer->idle_state = true;
wlr_signal_emit_safe(&timer->events.idle, timer); wl_signal_emit_mutable(&timer->events.idle, timer);
if (timer->resource) { if (timer->resource) {
org_kde_kwin_idle_timeout_send_idle(timer->resource); org_kde_kwin_idle_timeout_send_idle(timer->resource);
@ -38,7 +37,7 @@ static void handle_activity(struct wlr_idle_timeout *timer) {
// in case the previous state was sleeping send a resume event and switch state // in case the previous state was sleeping send a resume event and switch state
if (timer->idle_state) { if (timer->idle_state) {
timer->idle_state = false; timer->idle_state = false;
wlr_signal_emit_safe(&timer->events.resume, timer); wl_signal_emit_mutable(&timer->events.resume, timer);
if (timer->resource) { if (timer->resource) {
org_kde_kwin_idle_timeout_send_resumed(timer->resource); org_kde_kwin_idle_timeout_send_resumed(timer->resource);
@ -212,7 +211,7 @@ static void idle_bind(struct wl_client *wl_client, void *data,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_idle *idle = wl_container_of(listener, idle, display_destroy); struct wlr_idle *idle = wl_container_of(listener, idle, display_destroy);
wlr_signal_emit_safe(&idle->events.destroy, idle); wl_signal_emit_mutable(&idle->events.destroy, idle);
wl_list_remove(&idle->display_destroy.link); wl_list_remove(&idle->display_destroy.link);
wl_global_destroy(idle->global); wl_global_destroy(idle->global);
free(idle); free(idle);
@ -249,7 +248,7 @@ struct wlr_idle *wlr_idle_create(struct wl_display *display) {
} }
void wlr_idle_notify_activity(struct wlr_idle *idle, struct wlr_seat *seat) { void wlr_idle_notify_activity(struct wlr_idle *idle, struct wlr_seat *seat) {
wlr_signal_emit_safe(&idle->events.activity_notify, seat); wl_signal_emit_mutable(&idle->events.activity_notify, seat);
} }
struct wlr_idle_timeout *wlr_idle_timeout_create(struct wlr_idle *idle, struct wlr_idle_timeout *wlr_idle_timeout_create(struct wlr_idle *idle,
@ -258,7 +257,7 @@ struct wlr_idle_timeout *wlr_idle_timeout_create(struct wlr_idle *idle,
} }
void wlr_idle_timeout_destroy(struct wlr_idle_timeout *timer) { void wlr_idle_timeout_destroy(struct wlr_idle_timeout *timer) {
wlr_signal_emit_safe(&timer->events.destroy, NULL); wl_signal_emit_mutable(&timer->events.destroy, NULL);
wl_list_remove(&timer->input_listener.link); wl_list_remove(&timer->input_listener.link);
wl_list_remove(&timer->seat_destroy.link); wl_list_remove(&timer->seat_destroy.link);

View File

@ -1,6 +1,5 @@
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <util/signal.h>
#include <wayland-server-core.h> #include <wayland-server-core.h>
#include <wayland-util.h> #include <wayland-util.h>
#include <wlr/types/wlr_compositor.h> #include <wlr/types/wlr_compositor.h>
@ -33,7 +32,7 @@ static void idle_inhibitor_v1_destroy(struct wlr_idle_inhibitor_v1 *inhibitor) {
return; return;
} }
wlr_signal_emit_safe(&inhibitor->events.destroy, inhibitor->surface); wl_signal_emit_mutable(&inhibitor->events.destroy, inhibitor->surface);
wl_resource_set_user_data(inhibitor->resource, NULL); wl_resource_set_user_data(inhibitor->resource, NULL);
wl_list_remove(&inhibitor->link); wl_list_remove(&inhibitor->link);
@ -98,7 +97,7 @@ static void manager_handle_create_inhibitor(struct wl_client *client,
inhibitor, idle_inhibitor_v1_handle_resource_destroy); inhibitor, idle_inhibitor_v1_handle_resource_destroy);
wl_list_insert(&manager->inhibitors, &inhibitor->link); wl_list_insert(&manager->inhibitors, &inhibitor->link);
wlr_signal_emit_safe(&manager->events.new_inhibitor, inhibitor); wl_signal_emit_mutable(&manager->events.new_inhibitor, inhibitor);
} }
static void manager_handle_destroy(struct wl_client *client, static void manager_handle_destroy(struct wl_client *client,
@ -114,7 +113,7 @@ static const struct zwp_idle_inhibit_manager_v1_interface idle_inhibit_impl = {
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_idle_inhibit_manager_v1 *manager = struct wlr_idle_inhibit_manager_v1 *manager =
wl_container_of(listener, manager, display_destroy); wl_container_of(listener, manager, display_destroy);
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->global); wl_global_destroy(manager->global);
free(manager); free(manager);

View File

@ -3,7 +3,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "interfaces/wlr_input_device.h" #include "interfaces/wlr_input_device.h"
#include "util/signal.h"
void wlr_input_device_init(struct wlr_input_device *dev, void wlr_input_device_init(struct wlr_input_device *dev,
enum wlr_input_device_type type, const char *name) { enum wlr_input_device_type type, const char *name) {
@ -21,7 +20,7 @@ void wlr_input_device_finish(struct wlr_input_device *wlr_device) {
return; return;
} }
wlr_signal_emit_safe(&wlr_device->events.destroy, wlr_device); wl_signal_emit_mutable(&wlr_device->events.destroy, wlr_device);
wl_list_remove(&wlr_device->events.destroy.listener_list); wl_list_remove(&wlr_device->events.destroy.listener_list);

View File

@ -4,7 +4,6 @@
#include <wayland-server-core.h> #include <wayland-server-core.h>
#include "wlr/types/wlr_input_inhibitor.h" #include "wlr/types/wlr_input_inhibitor.h"
#include "wlr-input-inhibitor-unstable-v1-protocol.h" #include "wlr-input-inhibitor-unstable-v1-protocol.h"
#include "util/signal.h"
static const struct zwlr_input_inhibit_manager_v1_interface inhibit_manager_implementation; static const struct zwlr_input_inhibit_manager_v1_interface inhibit_manager_implementation;
static const struct zwlr_input_inhibitor_v1_interface input_inhibitor_implementation; static const struct zwlr_input_inhibitor_v1_interface input_inhibitor_implementation;
@ -27,7 +26,7 @@ static void input_inhibit_manager_deactivate(
} }
manager->active_client = NULL; manager->active_client = NULL;
manager->active_inhibitor = NULL; manager->active_inhibitor = NULL;
wlr_signal_emit_safe(&manager->events.deactivate, manager); wl_signal_emit_mutable(&manager->events.deactivate, manager);
} }
static void input_inhibitor_destroy(struct wl_client *client, static void input_inhibitor_destroy(struct wl_client *client,
@ -71,7 +70,7 @@ static void inhibit_manager_get_inhibitor(struct wl_client *client,
manager->active_client = client; manager->active_client = client;
manager->active_inhibitor = wl_resource; manager->active_inhibitor = wl_resource;
wlr_signal_emit_safe(&manager->events.activate, manager); wl_signal_emit_mutable(&manager->events.activate, manager);
} }
static const struct zwlr_input_inhibit_manager_v1_interface inhibit_manager_implementation = { static const struct zwlr_input_inhibit_manager_v1_interface inhibit_manager_implementation = {
@ -106,7 +105,7 @@ static void inhibit_manager_bind(struct wl_client *wl_client, void *data,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_input_inhibit_manager *manager = struct wlr_input_inhibit_manager *manager =
wl_container_of(listener, manager, display_destroy); wl_container_of(listener, manager, display_destroy);
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->global); wl_global_destroy(manager->global);
free(manager); free(manager);

View File

@ -12,7 +12,6 @@
#include <xkbcommon/xkbcommon.h> #include <xkbcommon/xkbcommon.h>
#include "input-method-unstable-v2-protocol.h" #include "input-method-unstable-v2-protocol.h"
#include "util/shm.h" #include "util/shm.h"
#include "util/signal.h"
static const struct zwp_input_method_v2_interface input_method_impl; static const struct zwp_input_method_v2_interface input_method_impl;
static const struct zwp_input_method_keyboard_grab_v2_interface keyboard_grab_impl; static const struct zwp_input_method_keyboard_grab_v2_interface keyboard_grab_impl;
@ -41,7 +40,7 @@ static void input_method_destroy(struct wlr_input_method_v2 *input_method) {
popup_surface, tmp, &input_method->popup_surfaces, link) { popup_surface, tmp, &input_method->popup_surfaces, link) {
popup_surface_destroy(popup_surface); popup_surface_destroy(popup_surface);
} }
wlr_signal_emit_safe(&input_method->events.destroy, input_method); wl_signal_emit_mutable(&input_method->events.destroy, input_method);
wl_list_remove(wl_resource_get_link(input_method->resource)); wl_list_remove(wl_resource_get_link(input_method->resource));
wl_list_remove(&input_method->seat_client_destroy.link); wl_list_remove(&input_method->seat_client_destroy.link);
wlr_input_method_keyboard_grab_v2_destroy(input_method->keyboard_grab); wlr_input_method_keyboard_grab_v2_destroy(input_method->keyboard_grab);
@ -76,7 +75,7 @@ static void im_commit(struct wl_client *client, struct wl_resource *resource,
input_method->current_serial = serial; input_method->current_serial = serial;
struct wlr_input_method_v2_state default_state = {0}; struct wlr_input_method_v2_state default_state = {0};
input_method->pending = default_state; input_method->pending = default_state;
wlr_signal_emit_safe(&input_method->events.commit, (void*)input_method); wl_signal_emit_mutable(&input_method->events.commit, (void*)input_method);
} }
static void im_commit_string(struct wl_client *client, static void im_commit_string(struct wl_client *client,
@ -141,10 +140,10 @@ static void popup_surface_set_mapped(
struct wlr_input_popup_surface_v2 *popup_surface, bool mapped) { struct wlr_input_popup_surface_v2 *popup_surface, bool mapped) {
if (mapped && !popup_surface->mapped) { if (mapped && !popup_surface->mapped) {
popup_surface->mapped = true; popup_surface->mapped = true;
wlr_signal_emit_safe(&popup_surface->events.map, popup_surface); wl_signal_emit_mutable(&popup_surface->events.map, popup_surface);
} else if (!mapped && popup_surface->mapped) { } else if (!mapped && popup_surface->mapped) {
popup_surface->mapped = false; popup_surface->mapped = false;
wlr_signal_emit_safe(&popup_surface->events.unmap, popup_surface); wl_signal_emit_mutable(&popup_surface->events.unmap, popup_surface);
} }
} }
@ -182,7 +181,7 @@ bool wlr_surface_is_input_popup_surface_v2(struct wlr_surface *surface) {
static void popup_surface_destroy( static void popup_surface_destroy(
struct wlr_input_popup_surface_v2 *popup_surface) { struct wlr_input_popup_surface_v2 *popup_surface) {
popup_surface_set_mapped(popup_surface, false); popup_surface_set_mapped(popup_surface, false);
wlr_signal_emit_safe(&popup_surface->events.destroy, NULL); wl_signal_emit_mutable(&popup_surface->events.destroy, NULL);
wl_list_remove(&popup_surface->surface_destroy.link); wl_list_remove(&popup_surface->surface_destroy.link);
wl_list_remove(&popup_surface->link); wl_list_remove(&popup_surface->link);
wl_resource_set_user_data(popup_surface->resource, NULL); wl_resource_set_user_data(popup_surface->resource, NULL);
@ -264,7 +263,7 @@ static void im_get_input_popup_surface(struct wl_client *client,
&& popup_surface->input_method->client_active); && popup_surface->input_method->client_active);
wl_list_insert(&input_method->popup_surfaces, &popup_surface->link); wl_list_insert(&input_method->popup_surfaces, &popup_surface->link);
wlr_signal_emit_safe(&input_method->events.new_popup_surface, popup_surface); wl_signal_emit_mutable(&input_method->events.new_popup_surface, popup_surface);
} }
void wlr_input_method_keyboard_grab_v2_destroy( void wlr_input_method_keyboard_grab_v2_destroy(
@ -272,7 +271,7 @@ void wlr_input_method_keyboard_grab_v2_destroy(
if (!keyboard_grab) { if (!keyboard_grab) {
return; return;
} }
wlr_signal_emit_safe(&keyboard_grab->events.destroy, keyboard_grab); wl_signal_emit_mutable(&keyboard_grab->events.destroy, keyboard_grab);
keyboard_grab->input_method->keyboard_grab = NULL; keyboard_grab->input_method->keyboard_grab = NULL;
if (keyboard_grab->keyboard) { if (keyboard_grab->keyboard) {
wl_list_remove(&keyboard_grab->keyboard_keymap.link); wl_list_remove(&keyboard_grab->keyboard_keymap.link);
@ -452,7 +451,7 @@ static void im_grab_keyboard(struct wl_client *client,
keyboard_grab->input_method = input_method; keyboard_grab->input_method = input_method;
input_method->keyboard_grab = keyboard_grab; input_method->keyboard_grab = keyboard_grab;
wl_signal_init(&keyboard_grab->events.destroy); wl_signal_init(&keyboard_grab->events.destroy);
wlr_signal_emit_safe(&input_method->events.grab_keyboard, keyboard_grab); wl_signal_emit_mutable(&input_method->events.grab_keyboard, keyboard_grab);
} }
static const struct zwp_input_method_v2_interface input_method_impl = { static const struct zwp_input_method_v2_interface input_method_impl = {
@ -575,7 +574,7 @@ static void manager_get_input_method(struct wl_client *client,
input_method->resource = im_resource; input_method->resource = im_resource;
wl_list_insert(&im_manager->input_methods, wl_list_insert(&im_manager->input_methods,
wl_resource_get_link(input_method->resource)); wl_resource_get_link(input_method->resource));
wlr_signal_emit_safe(&im_manager->events.input_method, input_method); wl_signal_emit_mutable(&im_manager->events.input_method, input_method);
} }
static void manager_destroy(struct wl_client *client, static void manager_destroy(struct wl_client *client,
@ -607,7 +606,7 @@ static void input_method_manager_bind(struct wl_client *wl_client, void *data,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_input_method_manager_v2 *manager = struct wlr_input_method_manager_v2 *manager =
wl_container_of(listener, manager, display_destroy); wl_container_of(listener, manager, display_destroy);
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->global); wl_global_destroy(manager->global);
free(manager); free(manager);

View File

@ -10,7 +10,6 @@
#include "types/wlr_keyboard.h" #include "types/wlr_keyboard.h"
#include "util/array.h" #include "util/array.h"
#include "util/shm.h" #include "util/shm.h"
#include "util/signal.h"
#include "util/time.h" #include "util/time.h"
struct wlr_keyboard *wlr_keyboard_from_input_device( struct wlr_keyboard *wlr_keyboard_from_input_device(
@ -91,7 +90,7 @@ void wlr_keyboard_notify_modifiers(struct wlr_keyboard *keyboard,
bool updated = keyboard_modifier_update(keyboard); bool updated = keyboard_modifier_update(keyboard);
if (updated) { if (updated) {
wlr_signal_emit_safe(&keyboard->events.modifiers, keyboard); wl_signal_emit_mutable(&keyboard->events.modifiers, keyboard);
} }
keyboard_led_update(keyboard); keyboard_led_update(keyboard);
@ -100,7 +99,7 @@ void wlr_keyboard_notify_modifiers(struct wlr_keyboard *keyboard,
void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard, void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard,
struct wlr_keyboard_key_event *event) { struct wlr_keyboard_key_event *event) {
keyboard_key_update(keyboard, event); keyboard_key_update(keyboard, event);
wlr_signal_emit_safe(&keyboard->events.key, event); wl_signal_emit_mutable(&keyboard->events.key, event);
if (keyboard->xkb_state == NULL) { if (keyboard->xkb_state == NULL) {
return; return;
@ -114,7 +113,7 @@ void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard,
bool updated = keyboard_modifier_update(keyboard); bool updated = keyboard_modifier_update(keyboard);
if (updated) { if (updated) {
wlr_signal_emit_safe(&keyboard->events.modifiers, keyboard); wl_signal_emit_mutable(&keyboard->events.modifiers, keyboard);
} }
keyboard_led_update(keyboard); keyboard_led_update(keyboard);
@ -246,7 +245,7 @@ bool wlr_keyboard_set_keymap(struct wlr_keyboard *kb,
keyboard_modifier_update(kb); keyboard_modifier_update(kb);
wlr_signal_emit_safe(&kb->events.keymap, kb); wl_signal_emit_mutable(&kb->events.keymap, kb);
return true; return true;
err: err:
@ -266,7 +265,7 @@ void wlr_keyboard_set_repeat_info(struct wlr_keyboard *kb, int32_t rate,
} }
kb->repeat_info.rate = rate; kb->repeat_info.rate = rate;
kb->repeat_info.delay = delay; kb->repeat_info.delay = delay;
wlr_signal_emit_safe(&kb->events.repeat_info, kb); wl_signal_emit_mutable(&kb->events.repeat_info, kb);
} }
uint32_t wlr_keyboard_get_modifiers(struct wlr_keyboard *kb) { uint32_t wlr_keyboard_get_modifiers(struct wlr_keyboard *kb) {

View File

@ -7,7 +7,6 @@
#include <wayland-server-protocol.h> #include <wayland-server-protocol.h>
#include <xkbcommon/xkbcommon.h> #include <xkbcommon/xkbcommon.h>
#include "types/wlr_keyboard.h" #include "types/wlr_keyboard.h"
#include "util/signal.h"
#include "wlr/interfaces/wlr_keyboard.h" #include "wlr/interfaces/wlr_keyboard.h"
#include "wlr/types/wlr_keyboard.h" #include "wlr/types/wlr_keyboard.h"
#include "wlr/types/wlr_keyboard_group.h" #include "wlr/types/wlr_keyboard_group.h"
@ -212,9 +211,9 @@ static void refresh_state(struct keyboard_group_device *device,
// If there are any unique keys, emit the enter/leave event // If there are any unique keys, emit the enter/leave event
if (keys.size > 0) { if (keys.size > 0) {
if (state == WL_KEYBOARD_KEY_STATE_PRESSED) { if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
wlr_signal_emit_safe(&device->keyboard->group->events.enter, &keys); wl_signal_emit_mutable(&device->keyboard->group->events.enter, &keys);
} else { } else {
wlr_signal_emit_safe(&device->keyboard->group->events.leave, &keys); wl_signal_emit_mutable(&device->keyboard->group->events.leave, &keys);
} }
} }

View File

@ -1,6 +1,5 @@
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <util/signal.h>
#include <wlr/types/wlr_compositor.h> #include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h> #include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
#include "keyboard-shortcuts-inhibit-unstable-v1-protocol.h" #include "keyboard-shortcuts-inhibit-unstable-v1-protocol.h"
@ -35,7 +34,7 @@ static void keyboard_shortcuts_inhibitor_v1_destroy(
return; return;
} }
wlr_signal_emit_safe(&inhibitor->events.destroy, inhibitor); wl_signal_emit_mutable(&inhibitor->events.destroy, inhibitor);
wl_resource_set_user_data(inhibitor->resource, NULL); wl_resource_set_user_data(inhibitor->resource, NULL);
wl_list_remove(&inhibitor->link); wl_list_remove(&inhibitor->link);
@ -144,7 +143,7 @@ static void manager_handle_inhibit_shortcuts(struct wl_client *client,
keyboard_shortcuts_inhibitor_v1_handle_resource_destroy); keyboard_shortcuts_inhibitor_v1_handle_resource_destroy);
wl_list_insert(&manager->inhibitors, &inhibitor->link); wl_list_insert(&manager->inhibitors, &inhibitor->link);
wlr_signal_emit_safe(&manager->events.new_inhibitor, inhibitor); wl_signal_emit_mutable(&manager->events.new_inhibitor, inhibitor);
} }
static void manager_handle_destroy(struct wl_client *client, static void manager_handle_destroy(struct wl_client *client,
@ -161,7 +160,7 @@ keyboard_shortcuts_inhibit_impl = {
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_keyboard_shortcuts_inhibit_manager_v1 *manager = struct wlr_keyboard_shortcuts_inhibit_manager_v1 *manager =
wl_container_of(listener, manager, display_destroy); wl_container_of(listener, manager, display_destroy);
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->global); wl_global_destroy(manager->global);
free(manager); free(manager);

View File

@ -8,7 +8,6 @@
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_xdg_shell.h> #include <wlr/types/wlr_xdg_shell.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
#include "wlr-layer-shell-unstable-v1-protocol.h" #include "wlr-layer-shell-unstable-v1-protocol.h"
#define LAYER_SHELL_VERSION 4 #define LAYER_SHELL_VERSION 4
@ -223,7 +222,7 @@ static void layer_surface_handle_get_popup(struct wl_client *client,
} }
popup->parent = parent->surface; popup->parent = parent->surface;
wl_list_insert(&parent->popups, &popup->link); wl_list_insert(&parent->popups, &popup->link);
wlr_signal_emit_safe(&parent->events.new_popup, popup); wl_signal_emit_mutable(&parent->events.new_popup, popup);
} }
static void layer_surface_set_layer(struct wl_client *client, static void layer_surface_set_layer(struct wl_client *client,
@ -265,7 +264,7 @@ static void layer_surface_unmap(struct wlr_layer_surface_v1 *surface) {
surface->configured = surface->mapped = false; surface->configured = surface->mapped = false;
// TODO: probably need to ungrab before this event // TODO: probably need to ungrab before this event
wlr_signal_emit_safe(&surface->events.unmap, surface); wl_signal_emit_mutable(&surface->events.unmap, surface);
struct wlr_xdg_popup *popup, *popup_tmp; struct wlr_xdg_popup *popup, *popup_tmp;
wl_list_for_each_safe(popup, popup_tmp, &surface->popups, link) { wl_list_for_each_safe(popup, popup_tmp, &surface->popups, link) {
@ -283,7 +282,7 @@ static void layer_surface_destroy(struct wlr_layer_surface_v1 *surface) {
if (surface->configured && surface->mapped) { if (surface->configured && surface->mapped) {
layer_surface_unmap(surface); layer_surface_unmap(surface);
} }
wlr_signal_emit_safe(&surface->events.destroy, surface); wl_signal_emit_mutable(&surface->events.destroy, surface);
wl_resource_set_user_data(surface->resource, NULL); wl_resource_set_user_data(surface->resource, NULL);
surface->surface->role_data = NULL; surface->surface->role_data = NULL;
wl_list_remove(&surface->surface_destroy.link); wl_list_remove(&surface->surface_destroy.link);
@ -365,7 +364,7 @@ static void layer_surface_role_commit(struct wlr_surface *wlr_surface) {
surface->added = true; surface->added = true;
assert(!surface->configured); assert(!surface->configured);
assert(!surface->mapped); assert(!surface->mapped);
wlr_signal_emit_safe(&surface->shell->events.new_surface, surface); wl_signal_emit_mutable(&surface->shell->events.new_surface, surface);
// Return early here as the compositor may have closed this layer surface // Return early here as the compositor may have closed this layer surface
// in response to the new_surface event. // in response to the new_surface event.
return; return;
@ -374,7 +373,7 @@ static void layer_surface_role_commit(struct wlr_surface *wlr_surface) {
if (surface->configured && wlr_surface_has_buffer(surface->surface) && if (surface->configured && wlr_surface_has_buffer(surface->surface) &&
!surface->mapped) { !surface->mapped) {
surface->mapped = true; surface->mapped = true;
wlr_signal_emit_safe(&surface->events.map, surface); wl_signal_emit_mutable(&surface->events.map, surface);
} }
} }
@ -501,7 +500,7 @@ static void layer_shell_bind(struct wl_client *wl_client, void *data,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_layer_shell_v1 *layer_shell = struct wlr_layer_shell_v1 *layer_shell =
wl_container_of(listener, layer_shell, display_destroy); wl_container_of(listener, layer_shell, display_destroy);
wlr_signal_emit_safe(&layer_shell->events.destroy, layer_shell); wl_signal_emit_mutable(&layer_shell->events.destroy, layer_shell);
wl_list_remove(&layer_shell->display_destroy.link); wl_list_remove(&layer_shell->display_destroy.link);
wl_global_destroy(layer_shell->global); wl_global_destroy(layer_shell->global);
free(layer_shell); free(layer_shell);

View File

@ -11,7 +11,6 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "linux-dmabuf-unstable-v1-protocol.h" #include "linux-dmabuf-unstable-v1-protocol.h"
#include "render/drm_format_set.h" #include "render/drm_format_set.h"
#include "util/signal.h"
#include "util/shm.h" #include "util/shm.h"
#define LINUX_DMABUF_VERSION 4 #define LINUX_DMABUF_VERSION 4
@ -887,7 +886,7 @@ static void linux_dmabuf_bind(struct wl_client *client, void *data,
} }
static void linux_dmabuf_v1_destroy(struct wlr_linux_dmabuf_v1 *linux_dmabuf) { static void linux_dmabuf_v1_destroy(struct wlr_linux_dmabuf_v1 *linux_dmabuf) {
wlr_signal_emit_safe(&linux_dmabuf->events.destroy, linux_dmabuf); wl_signal_emit_mutable(&linux_dmabuf->events.destroy, linux_dmabuf);
struct wlr_linux_dmabuf_v1_surface *surface, *surface_tmp; struct wlr_linux_dmabuf_v1_surface *surface, *surface_tmp;
wl_list_for_each_safe(surface, surface_tmp, &linux_dmabuf->surfaces, link) { wl_list_for_each_safe(surface, surface_tmp, &linux_dmabuf->surfaces, link) {

View File

@ -5,7 +5,6 @@
#include <wlr/types/wlr_output_damage.h> #include <wlr/types/wlr_output_damage.h>
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>
#include <wlr/util/box.h> #include <wlr/util/box.h>
#include "util/signal.h"
static void output_handle_destroy(struct wl_listener *listener, void *data) { static void output_handle_destroy(struct wl_listener *listener, void *data) {
struct wlr_output_damage *output_damage = struct wlr_output_damage *output_damage =
@ -41,7 +40,7 @@ static void output_handle_frame(struct wl_listener *listener, void *data) {
return; return;
} }
wlr_signal_emit_safe(&output_damage->events.frame, output_damage); wl_signal_emit_mutable(&output_damage->events.frame, output_damage);
} }
static void output_handle_precommit(struct wl_listener *listener, void *data) { static void output_handle_precommit(struct wl_listener *listener, void *data) {
@ -128,7 +127,7 @@ void wlr_output_damage_destroy(struct wlr_output_damage *output_damage) {
if (output_damage == NULL) { if (output_damage == NULL) {
return; return;
} }
wlr_signal_emit_safe(&output_damage->events.destroy, output_damage); wl_signal_emit_mutable(&output_damage->events.destroy, output_damage);
wl_list_remove(&output_damage->output_destroy.link); wl_list_remove(&output_damage->output_destroy.link);
wl_list_remove(&output_damage->output_mode.link); wl_list_remove(&output_damage->output_mode.link);
wl_list_remove(&output_damage->output_needs_frame.link); wl_list_remove(&output_damage->output_needs_frame.link);

View File

@ -6,7 +6,6 @@
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>
#include <wlr/util/box.h> #include <wlr/util/box.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
struct wlr_output_layout_output_state { struct wlr_output_layout_output_state {
struct wlr_output_layout *layout; struct wlr_output_layout *layout;
@ -37,7 +36,7 @@ struct wlr_output_layout *wlr_output_layout_create(void) {
static void output_layout_output_destroy( static void output_layout_output_destroy(
struct wlr_output_layout_output *l_output) { struct wlr_output_layout_output *l_output) {
wlr_signal_emit_safe(&l_output->events.destroy, l_output); wl_signal_emit_mutable(&l_output->events.destroy, l_output);
wlr_output_destroy_global(l_output->output); wlr_output_destroy_global(l_output->output);
wl_list_remove(&l_output->state->mode.link); wl_list_remove(&l_output->state->mode.link);
wl_list_remove(&l_output->state->commit.link); wl_list_remove(&l_output->state->commit.link);
@ -52,7 +51,7 @@ void wlr_output_layout_destroy(struct wlr_output_layout *layout) {
return; return;
} }
wlr_signal_emit_safe(&layout->events.destroy, layout); wl_signal_emit_mutable(&layout->events.destroy, layout);
struct wlr_output_layout_output *l_output, *temp; struct wlr_output_layout_output *l_output, *temp;
wl_list_for_each_safe(l_output, temp, &layout->outputs, link) { wl_list_for_each_safe(l_output, temp, &layout->outputs, link) {
@ -115,7 +114,7 @@ static void output_layout_reconfigure(struct wlr_output_layout *layout) {
max_x += output_box.width; max_x += output_box.width;
} }
wlr_signal_emit_safe(&layout->events.change, layout); wl_signal_emit_mutable(&layout->events.change, layout);
} }
static void output_update_global(struct wlr_output *output) { static void output_update_global(struct wlr_output *output) {
@ -211,7 +210,7 @@ void wlr_output_layout_add(struct wlr_output_layout *layout,
output_update_global(output); output_update_global(output);
if (is_new) { if (is_new) {
wlr_signal_emit_safe(&layout->events.add, l_output); wl_signal_emit_mutable(&layout->events.add, l_output);
} }
} }
@ -425,7 +424,7 @@ void wlr_output_layout_add_auto(struct wlr_output_layout *layout,
output_update_global(output); output_update_global(output);
if (is_new) { if (is_new) {
wlr_signal_emit_safe(&layout->events.add, l_output); wl_signal_emit_mutable(&layout->events.add, l_output);
} }
} }

View File

@ -3,7 +3,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <wlr/types/wlr_output_management_v1.h> #include <wlr/types/wlr_output_management_v1.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
#include "wlr-output-management-unstable-v1-protocol.h" #include "wlr-output-management-unstable-v1-protocol.h"
#define OUTPUT_MANAGER_VERSION 2 #define OUTPUT_MANAGER_VERSION 2
@ -413,7 +412,7 @@ static void config_handle_apply(struct wl_client *client,
return; return;
} }
wlr_signal_emit_safe(&config->manager->events.apply, config); wl_signal_emit_mutable(&config->manager->events.apply, config);
} }
static void config_handle_test(struct wl_client *client, static void config_handle_test(struct wl_client *client,
@ -432,7 +431,7 @@ static void config_handle_test(struct wl_client *client,
return; return;
} }
wlr_signal_emit_safe(&config->manager->events.test, config); wl_signal_emit_mutable(&config->manager->events.test, config);
} }
static void config_handle_destroy(struct wl_client *client, static void config_handle_destroy(struct wl_client *client,
@ -589,7 +588,7 @@ static void manager_handle_display_destroy(struct wl_listener *listener,
void *data) { void *data) {
struct wlr_output_manager_v1 *manager = struct wlr_output_manager_v1 *manager =
wl_container_of(listener, manager, display_destroy); wl_container_of(listener, manager, display_destroy);
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
struct wlr_output_head_v1 *head, *tmp; struct wlr_output_head_v1 *head, *tmp;
wl_list_for_each_safe(head, tmp, &manager->heads, link) { wl_list_for_each_safe(head, tmp, &manager->heads, link) {

View File

@ -7,7 +7,6 @@
#include <wlr/types/wlr_output_power_management_v1.h> #include <wlr/types/wlr_output_power_management_v1.h>
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
#include "wlr-output-power-management-unstable-v1-protocol.h" #include "wlr-output-power-management-unstable-v1-protocol.h"
#define OUTPUT_POWER_MANAGER_V1_VERSION 1 #define OUTPUT_POWER_MANAGER_V1_VERSION 1
@ -93,7 +92,7 @@ static void output_power_handle_set_mode(struct wl_client *client,
.output = output_power->output, .output = output_power->output,
.mode = mode, .mode = mode,
}; };
wlr_signal_emit_safe(&output_power->manager->events.set_mode, &event); wl_signal_emit_mutable(&output_power->manager->events.set_mode, &event);
} }
static const struct zwlr_output_power_v1_interface output_power_impl = { static const struct zwlr_output_power_v1_interface output_power_impl = {
@ -196,7 +195,7 @@ static void output_power_manager_bind(struct wl_client *client, void *data,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_output_power_manager_v1 *manager = struct wlr_output_power_manager_v1 *manager =
wl_container_of(listener, manager, display_destroy); wl_container_of(listener, manager, display_destroy);
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_global_destroy(manager->global); wl_global_destroy(manager->global);
free(manager); free(manager);
} }

View File

@ -9,7 +9,6 @@
#include <wlr/types/wlr_region.h> #include <wlr/types/wlr_region.h>
#include <wlr/util/box.h> #include <wlr/util/box.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
static const struct zwp_locked_pointer_v1_interface locked_pointer_impl; static const struct zwp_locked_pointer_v1_interface locked_pointer_impl;
static const struct zwp_confined_pointer_v1_interface confined_pointer_impl; static const struct zwp_confined_pointer_v1_interface confined_pointer_impl;
@ -47,7 +46,7 @@ static void pointer_constraint_destroy(struct wlr_pointer_constraint_v1 *constra
wlr_log(WLR_DEBUG, "destroying constraint %p", constraint); wlr_log(WLR_DEBUG, "destroying constraint %p", constraint);
wlr_signal_emit_safe(&constraint->events.destroy, constraint); wl_signal_emit_mutable(&constraint->events.destroy, constraint);
wl_resource_set_user_data(constraint->resource, NULL); wl_resource_set_user_data(constraint->resource, NULL);
wl_list_remove(&constraint->link); wl_list_remove(&constraint->link);
@ -130,7 +129,7 @@ static void pointer_constraint_commit(
} }
if (updated_region) { if (updated_region) {
wlr_signal_emit_safe(&constraint->events.set_region, NULL); wl_signal_emit_mutable(&constraint->events.set_region, NULL);
} }
} }
@ -246,7 +245,7 @@ static void pointer_constraint_create(struct wl_client *client,
wl_list_insert(&pointer_constraints->constraints, &constraint->link); wl_list_insert(&pointer_constraints->constraints, &constraint->link);
wlr_signal_emit_safe(&pointer_constraints->events.new_constraint, wl_signal_emit_mutable(&pointer_constraints->events.new_constraint,
constraint); constraint);
} }

View File

@ -9,7 +9,6 @@
#include <wlr/types/wlr_pointer.h> #include <wlr/types/wlr_pointer.h>
#include <wlr/types/wlr_pointer_gestures_v1.h> #include <wlr/types/wlr_pointer_gestures_v1.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
#include "pointer-gestures-unstable-v1-protocol.h" #include "pointer-gestures-unstable-v1-protocol.h"
#define POINTER_GESTURES_VERSION 3 #define POINTER_GESTURES_VERSION 3

View File

@ -7,7 +7,6 @@
#include <wlr/types/wlr_presentation_time.h> #include <wlr/types/wlr_presentation_time.h>
#include <wlr/util/addon.h> #include <wlr/util/addon.h>
#include "presentation-time-protocol.h" #include "presentation-time-protocol.h"
#include "util/signal.h"
#define PRESENTATION_VERSION 1 #define PRESENTATION_VERSION 1
@ -173,7 +172,7 @@ static void presentation_bind(struct wl_client *client, void *data,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_presentation *presentation = struct wlr_presentation *presentation =
wl_container_of(listener, presentation, display_destroy); wl_container_of(listener, presentation, display_destroy);
wlr_signal_emit_safe(&presentation->events.destroy, presentation); wl_signal_emit_mutable(&presentation->events.destroy, presentation);
wl_list_remove(&presentation->display_destroy.link); wl_list_remove(&presentation->display_destroy.link);
wl_global_destroy(presentation->global); wl_global_destroy(presentation->global);
free(presentation); free(presentation);

View File

@ -2,7 +2,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <wlr/types/wlr_primary_selection.h> #include <wlr/types/wlr_primary_selection.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
void wlr_primary_selection_source_init( void wlr_primary_selection_source_init(
struct wlr_primary_selection_source *source, struct wlr_primary_selection_source *source,
@ -20,7 +19,7 @@ void wlr_primary_selection_source_destroy(
return; return;
} }
wlr_signal_emit_safe(&source->events.destroy, source); wl_signal_emit_mutable(&source->events.destroy, source);
char **p; char **p;
wl_array_for_each(p, &source->mime_types) { wl_array_for_each(p, &source->mime_types) {
@ -63,7 +62,7 @@ void wlr_seat_request_set_primary_selection(struct wlr_seat *seat,
.source = source, .source = source,
.serial = serial, .serial = serial,
}; };
wlr_signal_emit_safe(&seat->events.request_set_primary_selection, &event); wl_signal_emit_mutable(&seat->events.request_set_primary_selection, &event);
} }
static void seat_handle_primary_selection_source_destroy( static void seat_handle_primary_selection_source_destroy(
@ -72,7 +71,7 @@ static void seat_handle_primary_selection_source_destroy(
wl_container_of(listener, seat, primary_selection_source_destroy); wl_container_of(listener, seat, primary_selection_source_destroy);
wl_list_remove(&seat->primary_selection_source_destroy.link); wl_list_remove(&seat->primary_selection_source_destroy.link);
seat->primary_selection_source = NULL; seat->primary_selection_source = NULL;
wlr_signal_emit_safe(&seat->events.set_primary_selection, seat); wl_signal_emit_mutable(&seat->events.set_primary_selection, seat);
} }
void wlr_seat_set_primary_selection(struct wlr_seat *seat, void wlr_seat_set_primary_selection(struct wlr_seat *seat,
@ -98,5 +97,5 @@ void wlr_seat_set_primary_selection(struct wlr_seat *seat,
&seat->primary_selection_source_destroy); &seat->primary_selection_source_destroy);
} }
wlr_signal_emit_safe(&seat->events.set_primary_selection, seat); wl_signal_emit_mutable(&seat->events.set_primary_selection, seat);
} }

View File

@ -9,7 +9,6 @@
#include <wlr/types/wlr_seat.h> #include <wlr/types/wlr_seat.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "primary-selection-unstable-v1-protocol.h" #include "primary-selection-unstable-v1-protocol.h"
#include "util/signal.h"
#define DEVICE_MANAGER_VERSION 1 #define DEVICE_MANAGER_VERSION 1
@ -458,7 +457,7 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
device_destroy(device); device_destroy(device);
} }
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->global); wl_global_destroy(manager->global);
free(manager); free(manager);

View File

@ -1,7 +1,6 @@
#include <assert.h> #include <assert.h>
#include <inttypes.h> #include <inttypes.h>
#include <stdlib.h> #include <stdlib.h>
#include <util/signal.h>
#include <wayland-server-core.h> #include <wayland-server-core.h>
#include <wayland-util.h> #include <wayland-util.h>
#include <wlr/types/wlr_relative_pointer_v1.h> #include <wlr/types/wlr_relative_pointer_v1.h>
@ -27,7 +26,7 @@ static struct wlr_relative_pointer_manager_v1 *relative_pointer_manager_from_res
} }
static void relative_pointer_destroy(struct wlr_relative_pointer_v1 *relative_pointer) { static void relative_pointer_destroy(struct wlr_relative_pointer_v1 *relative_pointer) {
wlr_signal_emit_safe(&relative_pointer->events.destroy, relative_pointer); wl_signal_emit_mutable(&relative_pointer->events.destroy, relative_pointer);
wl_list_remove(&relative_pointer->link); wl_list_remove(&relative_pointer->link);
wl_list_remove(&relative_pointer->seat_destroy.link); wl_list_remove(&relative_pointer->seat_destroy.link);
@ -118,7 +117,7 @@ static void relative_pointer_manager_v1_handle_get_relative_pointer(struct wl_cl
&relative_pointer->pointer_destroy); &relative_pointer->pointer_destroy);
relative_pointer->pointer_destroy.notify = relative_pointer_handle_pointer_destroy; relative_pointer->pointer_destroy.notify = relative_pointer_handle_pointer_destroy;
wlr_signal_emit_safe(&manager->events.new_relative_pointer, wl_signal_emit_mutable(&manager->events.new_relative_pointer,
relative_pointer); relative_pointer);
} }
@ -140,7 +139,7 @@ static void relative_pointer_manager_v1_bind(struct wl_client *wl_client, void *
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_relative_pointer_manager_v1 *manager = struct wlr_relative_pointer_manager_v1 *manager =
wl_container_of(listener, manager, display_destroy_listener); wl_container_of(listener, manager, display_destroy_listener);
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy_listener.link); wl_list_remove(&manager->display_destroy_listener.link);
wl_global_destroy(manager->global); wl_global_destroy(manager->global);
free(manager); free(manager);

View File

@ -12,7 +12,6 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "wlr-screencopy-unstable-v1-protocol.h" #include "wlr-screencopy-unstable-v1-protocol.h"
#include "render/pixel_format.h" #include "render/pixel_format.h"
#include "util/signal.h"
#define SCREENCOPY_MANAGER_VERSION 3 #define SCREENCOPY_MANAGER_VERSION 3
@ -680,7 +679,7 @@ failure:
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_screencopy_manager_v1 *manager = struct wlr_screencopy_manager_v1 *manager =
wl_container_of(listener, manager, display_destroy); wl_container_of(listener, manager, display_destroy);
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->global); wl_global_destroy(manager->global);
free(manager); free(manager);

View File

@ -4,7 +4,6 @@
#include <wlr/types/wlr_server_decoration.h> #include <wlr/types/wlr_server_decoration.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "server-decoration-protocol.h" #include "server-decoration-protocol.h"
#include "util/signal.h"
static const struct org_kde_kwin_server_decoration_interface static const struct org_kde_kwin_server_decoration_interface
server_decoration_impl; server_decoration_impl;
@ -29,14 +28,14 @@ static void server_decoration_handle_request_mode(struct wl_client *client,
return; return;
} }
decoration->mode = mode; decoration->mode = mode;
wlr_signal_emit_safe(&decoration->events.mode, decoration); wl_signal_emit_mutable(&decoration->events.mode, decoration);
org_kde_kwin_server_decoration_send_mode(decoration->resource, org_kde_kwin_server_decoration_send_mode(decoration->resource,
decoration->mode); decoration->mode);
} }
static void server_decoration_destroy( static void server_decoration_destroy(
struct wlr_server_decoration *decoration) { struct wlr_server_decoration *decoration) {
wlr_signal_emit_safe(&decoration->events.destroy, decoration); wl_signal_emit_mutable(&decoration->events.destroy, decoration);
wl_list_remove(&decoration->surface_destroy_listener.link); wl_list_remove(&decoration->surface_destroy_listener.link);
wl_resource_set_user_data(decoration->resource, NULL); wl_resource_set_user_data(decoration->resource, NULL);
wl_list_remove(&decoration->link); wl_list_remove(&decoration->link);
@ -119,7 +118,7 @@ static void server_decoration_manager_handle_create(struct wl_client *client,
org_kde_kwin_server_decoration_send_mode(decoration->resource, org_kde_kwin_server_decoration_send_mode(decoration->resource,
decoration->mode); decoration->mode);
wlr_signal_emit_safe(&manager->events.new_decoration, decoration); wl_signal_emit_mutable(&manager->events.new_decoration, decoration);
} }
static const struct org_kde_kwin_server_decoration_manager_interface static const struct org_kde_kwin_server_decoration_manager_interface
@ -166,7 +165,7 @@ static void server_decoration_manager_bind(struct wl_client *client, void *data,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_server_decoration_manager *manager = struct wlr_server_decoration_manager *manager =
wl_container_of(listener, manager, display_destroy); wl_container_of(listener, manager, display_destroy);
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->global); wl_global_destroy(manager->global);
free(manager); free(manager);

View File

@ -6,7 +6,6 @@
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_compositor.h> #include <wlr/types/wlr_compositor.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
#include "ext-session-lock-v1-protocol.h" #include "ext-session-lock-v1-protocol.h"
#define SESSION_LOCK_VERSION 1 #define SESSION_LOCK_VERSION 1
@ -157,7 +156,7 @@ static void lock_surface_role_commit(struct wlr_surface *surface) {
if (!lock_surface->mapped) { if (!lock_surface->mapped) {
lock_surface->mapped = true; lock_surface->mapped = true;
wlr_signal_emit_safe(&lock_surface->events.map, NULL); wl_signal_emit_mutable(&lock_surface->events.map, NULL);
} }
} }
@ -185,7 +184,7 @@ static const struct wlr_surface_role lock_surface_role = {
static void lock_surface_destroy( static void lock_surface_destroy(
struct wlr_session_lock_surface_v1 *lock_surface) { struct wlr_session_lock_surface_v1 *lock_surface) {
wlr_signal_emit_safe(&lock_surface->events.destroy, NULL); wl_signal_emit_mutable(&lock_surface->events.destroy, NULL);
wl_list_remove(&lock_surface->link); wl_list_remove(&lock_surface->link);
@ -312,7 +311,7 @@ static void lock_handle_get_lock_surface(struct wl_client *client,
wl_signal_add(&surface->events.destroy, &lock_surface->surface_destroy); wl_signal_add(&surface->events.destroy, &lock_surface->surface_destroy);
lock_surface->surface_destroy.notify = lock_surface_handle_surface_destroy; lock_surface->surface_destroy.notify = lock_surface_handle_surface_destroy;
wlr_signal_emit_safe(&lock->events.new_surface, lock_surface); wl_signal_emit_mutable(&lock->events.new_surface, lock_surface);
} }
static void lock_handle_unlock_and_destroy(struct wl_client *client, static void lock_handle_unlock_and_destroy(struct wl_client *client,
@ -322,7 +321,7 @@ static void lock_handle_unlock_and_destroy(struct wl_client *client,
return; return;
} }
wlr_signal_emit_safe(&lock->events.unlock, NULL); wl_signal_emit_mutable(&lock->events.unlock, NULL);
wl_resource_destroy(lock_resource); wl_resource_destroy(lock_resource);
} }
@ -344,7 +343,7 @@ static void lock_destroy(struct wlr_session_lock_v1 *lock) {
} }
assert(wl_list_empty(&lock->surfaces)); assert(wl_list_empty(&lock->surfaces));
wlr_signal_emit_safe(&lock->events.destroy, NULL); wl_signal_emit_mutable(&lock->events.destroy, NULL);
assert(wl_list_empty(&lock->events.new_surface.listener_list)); assert(wl_list_empty(&lock->events.new_surface.listener_list));
assert(wl_list_empty(&lock->events.unlock.listener_list)); assert(wl_list_empty(&lock->events.unlock.listener_list));
@ -395,7 +394,7 @@ static void lock_manager_handle_lock(struct wl_client *client,
wl_resource_set_implementation(lock->resource, &lock_implementation, wl_resource_set_implementation(lock->resource, &lock_implementation,
lock, lock_resource_destroy); lock, lock_resource_destroy);
wlr_signal_emit_safe(&lock_manager->events.new_lock, lock); wl_signal_emit_mutable(&lock_manager->events.new_lock, lock);
} }
static const struct ext_session_lock_manager_v1_interface lock_manager_implementation = { static const struct ext_session_lock_manager_v1_interface lock_manager_implementation = {
@ -420,7 +419,7 @@ static void lock_manager_bind(struct wl_client *client, void *data,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_session_lock_manager_v1 *lock_manager = struct wlr_session_lock_manager_v1 *lock_manager =
wl_container_of(listener, lock_manager, display_destroy); wl_container_of(listener, lock_manager, display_destroy);
wlr_signal_emit_safe(&lock_manager->events.destroy, NULL); wl_signal_emit_mutable(&lock_manager->events.destroy, NULL);
wl_list_remove(&lock_manager->display_destroy.link); wl_list_remove(&lock_manager->display_destroy.link);
wl_global_destroy(lock_manager->global); wl_global_destroy(lock_manager->global);

View File

@ -4,7 +4,6 @@
#include <wlr/types/wlr_compositor.h> #include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_subcompositor.h> #include <wlr/types/wlr_subcompositor.h>
#include "types/wlr_region.h" #include "types/wlr_region.h"
#include "util/signal.h"
#define SUBCOMPOSITOR_VERSION 1 #define SUBCOMPOSITOR_VERSION 1
@ -37,7 +36,7 @@ static void subsurface_destroy(struct wlr_subsurface *subsurface) {
subsurface_unmap(subsurface); subsurface_unmap(subsurface);
wlr_signal_emit_safe(&subsurface->events.destroy, subsurface); wl_signal_emit_mutable(&subsurface->events.destroy, subsurface);
wl_list_remove(&subsurface->surface_destroy.link); wl_list_remove(&subsurface->surface_destroy.link);
wl_list_remove(&subsurface->surface_client_commit.link); wl_list_remove(&subsurface->surface_client_commit.link);
@ -230,7 +229,7 @@ static void subsurface_consider_map(struct wlr_subsurface *subsurface,
// Now we can map the subsurface // Now we can map the subsurface
subsurface->mapped = true; subsurface->mapped = true;
wlr_signal_emit_safe(&subsurface->events.map, subsurface); wl_signal_emit_mutable(&subsurface->events.map, subsurface);
// Try mapping all children too // Try mapping all children too
struct wlr_subsurface *child; struct wlr_subsurface *child;
@ -250,7 +249,7 @@ static void subsurface_unmap(struct wlr_subsurface *subsurface) {
} }
subsurface->mapped = false; subsurface->mapped = false;
wlr_signal_emit_safe(&subsurface->events.unmap, subsurface); wl_signal_emit_mutable(&subsurface->events.unmap, subsurface);
// Unmap all children // Unmap all children
struct wlr_subsurface *child; struct wlr_subsurface *child;
@ -458,7 +457,7 @@ static void subcompositor_handle_display_destroy(
struct wl_listener *listener, void *data) { struct wl_listener *listener, void *data) {
struct wlr_subcompositor *subcompositor = struct wlr_subcompositor *subcompositor =
wl_container_of(listener, subcompositor, display_destroy); wl_container_of(listener, subcompositor, display_destroy);
wlr_signal_emit_safe(&subcompositor->events.destroy, NULL); wl_signal_emit_mutable(&subcompositor->events.destroy, NULL);
wl_list_remove(&subcompositor->display_destroy.link); wl_list_remove(&subcompositor->display_destroy.link);
wl_global_destroy(subcompositor->global); wl_global_destroy(subcompositor->global);
free(subcompositor); free(subcompositor);

View File

@ -8,7 +8,6 @@
#include <wlr/types/wlr_text_input_v3.h> #include <wlr/types/wlr_text_input_v3.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "text-input-unstable-v3-protocol.h" #include "text-input-unstable-v3-protocol.h"
#include "util/signal.h"
static void text_input_clear_focused_surface(struct wlr_text_input_v3 *text_input) { static void text_input_clear_focused_surface(struct wlr_text_input_v3 *text_input) {
wl_list_remove(&text_input->surface_destroy.link); wl_list_remove(&text_input->surface_destroy.link);
@ -66,7 +65,7 @@ void wlr_text_input_v3_send_done(struct wlr_text_input_v3 *text_input) {
} }
static void wlr_text_input_destroy(struct wlr_text_input_v3 *text_input) { static void wlr_text_input_destroy(struct wlr_text_input_v3 *text_input) {
wlr_signal_emit_safe(&text_input->events.destroy, text_input); wl_signal_emit_mutable(&text_input->events.destroy, text_input);
text_input_clear_focused_surface(text_input); text_input_clear_focused_surface(text_input);
wl_list_remove(&text_input->seat_destroy.link); wl_list_remove(&text_input->seat_destroy.link);
// remove from manager::text_inputs // remove from manager::text_inputs
@ -188,12 +187,12 @@ static void text_input_commit(struct wl_client *client,
if (!old_enabled && text_input->current_enabled) { if (!old_enabled && text_input->current_enabled) {
text_input->active_features = text_input->current.features; text_input->active_features = text_input->current.features;
wlr_signal_emit_safe(&text_input->events.enable, text_input); wl_signal_emit_mutable(&text_input->events.enable, text_input);
} else if (old_enabled && !text_input->current_enabled) { } else if (old_enabled && !text_input->current_enabled) {
text_input->active_features = 0; text_input->active_features = 0;
wlr_signal_emit_safe(&text_input->events.disable, text_input); wl_signal_emit_mutable(&text_input->events.disable, text_input);
} else { // including never enabled } else { // including never enabled
wlr_signal_emit_safe(&text_input->events.commit, text_input); wl_signal_emit_mutable(&text_input->events.commit, text_input);
} }
} }
@ -280,7 +279,7 @@ static void text_input_manager_get_text_input(struct wl_client *client,
text_input_manager_from_resource(resource); text_input_manager_from_resource(resource);
wl_list_insert(&manager->text_inputs, &text_input->link); wl_list_insert(&manager->text_inputs, &text_input->link);
wlr_signal_emit_safe(&manager->events.text_input, text_input); wl_signal_emit_mutable(&manager->events.text_input, text_input);
} }
static const struct zwp_text_input_manager_v3_interface static const struct zwp_text_input_manager_v3_interface
@ -307,7 +306,7 @@ static void text_input_manager_bind(struct wl_client *wl_client, void *data,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_text_input_manager_v3 *manager = struct wlr_text_input_manager_v3 *manager =
wl_container_of(listener, manager, display_destroy); wl_container_of(listener, manager, display_destroy);
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->global); wl_global_destroy(manager->global);
free(manager); free(manager);

View File

@ -3,7 +3,6 @@
#include <wlr/types/wlr_compositor.h> #include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_viewporter.h> #include <wlr/types/wlr_viewporter.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
#include "viewporter-protocol.h" #include "viewporter-protocol.h"
#define VIEWPORTER_VERSION 1 #define VIEWPORTER_VERSION 1
@ -211,7 +210,7 @@ static void viewporter_bind(struct wl_client *client, void *data,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_viewporter *viewporter = struct wlr_viewporter *viewporter =
wl_container_of(listener, viewporter, display_destroy); wl_container_of(listener, viewporter, display_destroy);
wlr_signal_emit_safe(&viewporter->events.destroy, NULL); wl_signal_emit_mutable(&viewporter->events.destroy, NULL);
wl_global_destroy(viewporter->global); wl_global_destroy(viewporter->global);
free(viewporter); free(viewporter);
} }

View File

@ -8,7 +8,6 @@
#include <wlr/types/wlr_virtual_keyboard_v1.h> #include <wlr/types/wlr_virtual_keyboard_v1.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include <xkbcommon/xkbcommon.h> #include <xkbcommon/xkbcommon.h>
#include "util/signal.h"
#include "virtual-keyboard-unstable-v1-protocol.h" #include "virtual-keyboard-unstable-v1-protocol.h"
static const struct wlr_keyboard_impl keyboard_impl = { static const struct wlr_keyboard_impl keyboard_impl = {
@ -176,7 +175,7 @@ static void virtual_keyboard_manager_create_virtual_keyboard(
wl_list_insert(&manager->virtual_keyboards, &virtual_keyboard->link); wl_list_insert(&manager->virtual_keyboards, &virtual_keyboard->link);
wlr_signal_emit_safe(&manager->events.new_virtual_keyboard, wl_signal_emit_mutable(&manager->events.new_virtual_keyboard,
virtual_keyboard); virtual_keyboard);
} }
@ -201,7 +200,7 @@ static void virtual_keyboard_manager_bind(struct wl_client *client, void *data,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_virtual_keyboard_manager_v1 *manager = struct wlr_virtual_keyboard_manager_v1 *manager =
wl_container_of(listener, manager, display_destroy); wl_container_of(listener, manager, display_destroy);
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->global); wl_global_destroy(manager->global);
free(manager); free(manager);

View File

@ -5,7 +5,6 @@
#include <wlr/types/wlr_virtual_pointer_v1.h> #include <wlr/types/wlr_virtual_pointer_v1.h>
#include <wlr/types/wlr_pointer.h> #include <wlr/types/wlr_pointer.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
#include "wlr-virtual-pointer-unstable-v1-protocol.h" #include "wlr-virtual-pointer-unstable-v1-protocol.h"
static const struct wlr_pointer_impl pointer_impl = { static const struct wlr_pointer_impl pointer_impl = {
@ -37,7 +36,7 @@ static void virtual_pointer_motion(struct wl_client *client,
.unaccel_dx = wl_fixed_to_double(dx), .unaccel_dx = wl_fixed_to_double(dx),
.unaccel_dy = wl_fixed_to_double(dy), .unaccel_dy = wl_fixed_to_double(dy),
}; };
wlr_signal_emit_safe(&pointer->pointer.events.motion, &event); wl_signal_emit_mutable(&pointer->pointer.events.motion, &event);
} }
static void virtual_pointer_motion_absolute(struct wl_client *client, static void virtual_pointer_motion_absolute(struct wl_client *client,
@ -57,7 +56,7 @@ static void virtual_pointer_motion_absolute(struct wl_client *client,
.x = (double)x / x_extent, .x = (double)x / x_extent,
.y = (double)y / y_extent, .y = (double)y / y_extent,
}; };
wlr_signal_emit_safe(&pointer->pointer.events.motion_absolute, &event); wl_signal_emit_mutable(&pointer->pointer.events.motion_absolute, &event);
} }
static void virtual_pointer_button(struct wl_client *client, static void virtual_pointer_button(struct wl_client *client,
@ -74,7 +73,7 @@ static void virtual_pointer_button(struct wl_client *client,
.button = button, .button = button,
.state = state ? WLR_BUTTON_PRESSED : WLR_BUTTON_RELEASED .state = state ? WLR_BUTTON_PRESSED : WLR_BUTTON_RELEASED
}; };
wlr_signal_emit_safe(&pointer->pointer.events.button, &event); wl_signal_emit_mutable(&pointer->pointer.events.button, &event);
} }
static void virtual_pointer_axis(struct wl_client *client, static void virtual_pointer_axis(struct wl_client *client,
@ -112,14 +111,14 @@ static void virtual_pointer_frame(struct wl_client *client,
++i) { ++i) {
if (pointer->axis_valid[i]) { if (pointer->axis_valid[i]) {
/* Deliver pending axis event */ /* Deliver pending axis event */
wlr_signal_emit_safe(&pointer->pointer.events.axis, wl_signal_emit_mutable(&pointer->pointer.events.axis,
&pointer->axis_event[i]); &pointer->axis_event[i]);
memset(&pointer->axis_event[i], 0, sizeof(pointer->axis_event[i])); memset(&pointer->axis_event[i], 0, sizeof(pointer->axis_event[i]));
pointer->axis_valid[i] = false; pointer->axis_valid[i] = false;
} }
} }
wlr_signal_emit_safe(&pointer->pointer.events.frame, &pointer->pointer); wl_signal_emit_mutable(&pointer->pointer.events.frame, &pointer->pointer);
} }
static void virtual_pointer_axis_source(struct wl_client *client, static void virtual_pointer_axis_source(struct wl_client *client,
@ -270,7 +269,7 @@ static void virtual_pointer_manager_create_virtual_pointer_with_output(
virtual_pointer->resource = pointer_resource; virtual_pointer->resource = pointer_resource;
wl_list_insert(&manager->virtual_pointers, &virtual_pointer->link); wl_list_insert(&manager->virtual_pointers, &virtual_pointer->link);
wlr_signal_emit_safe(&manager->events.new_virtual_pointer, &event); wl_signal_emit_mutable(&manager->events.new_virtual_pointer, &event);
} }
static void virtual_pointer_manager_create_virtual_pointer( static void virtual_pointer_manager_create_virtual_pointer(
@ -308,7 +307,7 @@ static void virtual_pointer_manager_bind(struct wl_client *client, void *data,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_virtual_pointer_manager_v1 *manager = struct wlr_virtual_pointer_manager_v1 *manager =
wl_container_of(listener, manager, display_destroy); wl_container_of(listener, manager, display_destroy);
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->global); wl_global_destroy(manager->global);
struct wlr_virtual_pointer_v1 *pointer, *pointer_tmp; struct wlr_virtual_pointer_v1 *pointer, *pointer_tmp;

View File

@ -6,7 +6,6 @@
#include <wlr/types/wlr_seat.h> #include <wlr/types/wlr_seat.h>
#include <wlr/types/wlr_xdg_activation_v1.h> #include <wlr/types/wlr_xdg_activation_v1.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
#include "util/token.h" #include "util/token.h"
#include "xdg-activation-v1-protocol.h" #include "xdg-activation-v1-protocol.h"
@ -33,7 +32,7 @@ void wlr_xdg_activation_token_v1_destroy(
wl_event_source_remove(token->timeout); wl_event_source_remove(token->timeout);
} }
wlr_signal_emit_safe(&token->events.destroy, NULL); wl_signal_emit_mutable(&token->events.destroy, NULL);
wl_list_remove(&token->link); wl_list_remove(&token->link);
wl_list_remove(&token->seat_destroy.link); wl_list_remove(&token->seat_destroy.link);
@ -312,7 +311,7 @@ static void activation_handle_activate(struct wl_client *client,
.token = token, .token = token,
.surface = surface, .surface = surface,
}; };
wlr_signal_emit_safe(&activation->events.request_activate, &event); wl_signal_emit_mutable(&activation->events.request_activate, &event);
wlr_xdg_activation_token_v1_destroy(token); wlr_xdg_activation_token_v1_destroy(token);
} }
@ -339,7 +338,7 @@ static void activation_bind(struct wl_client *client, void *data,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_xdg_activation_v1 *activation = struct wlr_xdg_activation_v1 *activation =
wl_container_of(listener, activation, display_destroy); wl_container_of(listener, activation, display_destroy);
wlr_signal_emit_safe(&activation->events.destroy, NULL); wl_signal_emit_mutable(&activation->events.destroy, NULL);
struct wlr_xdg_activation_token_v1 *token, *token_tmp; struct wlr_xdg_activation_token_v1 *token, *token_tmp;
wl_list_for_each_safe(token, token_tmp, &activation->tokens, link) { wl_list_for_each_safe(token, token_tmp, &activation->tokens, link) {

View File

@ -3,7 +3,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <wlr/types/wlr_xdg_decoration_v1.h> #include <wlr/types/wlr_xdg_decoration_v1.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
#include "xdg-decoration-unstable-v1-protocol.h" #include "xdg-decoration-unstable-v1-protocol.h"
#define DECORATION_MANAGER_VERSION 1 #define DECORATION_MANAGER_VERSION 1
@ -31,7 +30,7 @@ static void toplevel_decoration_handle_set_mode(struct wl_client *client,
decoration->requested_mode = decoration->requested_mode =
(enum wlr_xdg_toplevel_decoration_v1_mode)mode; (enum wlr_xdg_toplevel_decoration_v1_mode)mode;
wlr_signal_emit_safe(&decoration->events.request_mode, decoration); wl_signal_emit_mutable(&decoration->events.request_mode, decoration);
} }
static void toplevel_decoration_handle_unset_mode(struct wl_client *client, static void toplevel_decoration_handle_unset_mode(struct wl_client *client,
@ -40,7 +39,7 @@ static void toplevel_decoration_handle_unset_mode(struct wl_client *client,
toplevel_decoration_from_resource(resource); toplevel_decoration_from_resource(resource);
decoration->requested_mode = WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_NONE; decoration->requested_mode = WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_NONE;
wlr_signal_emit_safe(&decoration->events.request_mode, decoration); wl_signal_emit_mutable(&decoration->events.request_mode, decoration);
} }
static const struct zxdg_toplevel_decoration_v1_interface static const struct zxdg_toplevel_decoration_v1_interface
@ -62,7 +61,7 @@ static void toplevel_decoration_handle_resource_destroy(
struct wl_resource *resource) { struct wl_resource *resource) {
struct wlr_xdg_toplevel_decoration_v1 *decoration = struct wlr_xdg_toplevel_decoration_v1 *decoration =
toplevel_decoration_from_resource(resource); toplevel_decoration_from_resource(resource);
wlr_signal_emit_safe(&decoration->events.destroy, decoration); wl_signal_emit_mutable(&decoration->events.destroy, decoration);
wl_list_remove(&decoration->surface_commit.link); wl_list_remove(&decoration->surface_commit.link);
wl_list_remove(&decoration->surface_destroy.link); wl_list_remove(&decoration->surface_destroy.link);
wl_list_remove(&decoration->surface_configure.link); wl_list_remove(&decoration->surface_configure.link);
@ -148,7 +147,7 @@ static void toplevel_decoration_handle_surface_commit(
if (decoration->surface->added && !decoration->added) { if (decoration->surface->added && !decoration->added) {
decoration->added = true; decoration->added = true;
wlr_signal_emit_safe(&manager->events.new_toplevel_decoration, wl_signal_emit_mutable(&manager->events.new_toplevel_decoration,
decoration); decoration);
} }
} }
@ -232,7 +231,7 @@ static void decoration_manager_handle_get_toplevel_decoration(
if (toplevel->base->added) { if (toplevel->base->added) {
decoration->added = true; decoration->added = true;
wlr_signal_emit_safe(&manager->events.new_toplevel_decoration, wl_signal_emit_mutable(&manager->events.new_toplevel_decoration,
decoration); decoration);
} }
} }
@ -260,7 +259,7 @@ static void decoration_manager_bind(struct wl_client *client, void *data,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_xdg_decoration_manager_v1 *manager = struct wlr_xdg_decoration_manager_v1 *manager =
wl_container_of(listener, manager, display_destroy); wl_container_of(listener, manager, display_destroy);
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->global); wl_global_destroy(manager->global);
free(manager); free(manager);

View File

@ -1,5 +1,4 @@
#include <wlr/types/wlr_xdg_foreign_registry.h> #include <wlr/types/wlr_xdg_foreign_registry.h>
#include "util/signal.h"
#include "util/token.h" #include "util/token.h"
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
@ -38,7 +37,7 @@ struct wlr_xdg_foreign_exported *wlr_xdg_foreign_registry_find_by_handle(
} }
void wlr_xdg_foreign_exported_finish(struct wlr_xdg_foreign_exported *surface) { void wlr_xdg_foreign_exported_finish(struct wlr_xdg_foreign_exported *surface) {
wlr_signal_emit_safe(&surface->events.destroy, NULL); wl_signal_emit_mutable(&surface->events.destroy, NULL);
surface->registry = NULL; surface->registry = NULL;
wl_list_remove(&surface->link); wl_list_remove(&surface->link);
wl_list_init(&surface->link); wl_list_init(&surface->link);
@ -49,7 +48,7 @@ static void foreign_registry_handle_display_destroy(struct wl_listener *listener
struct wlr_xdg_foreign_registry *registry = struct wlr_xdg_foreign_registry *registry =
wl_container_of(listener, registry, display_destroy); wl_container_of(listener, registry, display_destroy);
wlr_signal_emit_safe(&registry->events.destroy, NULL); wl_signal_emit_mutable(&registry->events.destroy, NULL);
// Implementations are supposed to remove all surfaces // Implementations are supposed to remove all surfaces
assert(wl_list_empty(&registry->exported_surfaces)); assert(wl_list_empty(&registry->exported_surfaces));

View File

@ -6,7 +6,6 @@
#include <wlr/types/wlr_xdg_foreign_v1.h> #include <wlr/types/wlr_xdg_foreign_v1.h>
#include <wlr/types/wlr_xdg_shell.h> #include <wlr/types/wlr_xdg_shell.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
#include "xdg-foreign-unstable-v1-protocol.h" #include "xdg-foreign-unstable-v1-protocol.h"
#define FOREIGN_V1_VERSION 1 #define FOREIGN_V1_VERSION 1
@ -361,7 +360,7 @@ static void xdg_foreign_destroy(struct wlr_xdg_foreign_v1 *foreign) {
return; return;
} }
wlr_signal_emit_safe(&foreign->events.destroy, NULL); wl_signal_emit_mutable(&foreign->events.destroy, NULL);
wl_list_remove(&foreign->foreign_registry_destroy.link); wl_list_remove(&foreign->foreign_registry_destroy.link);
wl_list_remove(&foreign->display_destroy.link); wl_list_remove(&foreign->display_destroy.link);

View File

@ -6,7 +6,6 @@
#include <wlr/types/wlr_xdg_foreign_v2.h> #include <wlr/types/wlr_xdg_foreign_v2.h>
#include <wlr/types/wlr_xdg_shell.h> #include <wlr/types/wlr_xdg_shell.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "util/signal.h"
#include "xdg-foreign-unstable-v2-protocol.h" #include "xdg-foreign-unstable-v2-protocol.h"
#define FOREIGN_V2_VERSION 1 #define FOREIGN_V2_VERSION 1
@ -367,7 +366,7 @@ static void xdg_foreign_destroy(struct wlr_xdg_foreign_v2 *foreign) {
return; return;
} }
wlr_signal_emit_safe(&foreign->events.destroy, NULL); wl_signal_emit_mutable(&foreign->events.destroy, NULL);
wl_list_remove(&foreign->foreign_registry_destroy.link); wl_list_remove(&foreign->foreign_registry_destroy.link);
wl_list_remove(&foreign->display_destroy.link); wl_list_remove(&foreign->display_destroy.link);

View File

@ -6,7 +6,6 @@
#include <wlr/types/wlr_xdg_output_v1.h> #include <wlr/types/wlr_xdg_output_v1.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "xdg-output-unstable-v1-protocol.h" #include "xdg-output-unstable-v1-protocol.h"
#include "util/signal.h"
#define OUTPUT_MANAGER_VERSION 3 #define OUTPUT_MANAGER_VERSION 3
#define OUTPUT_DONE_DEPRECATED_SINCE_VERSION 3 #define OUTPUT_DONE_DEPRECATED_SINCE_VERSION 3
@ -231,7 +230,7 @@ static void manager_destroy(struct wlr_xdg_output_manager_v1 *manager) {
wl_list_for_each_safe(output, tmp, &manager->outputs, link) { wl_list_for_each_safe(output, tmp, &manager->outputs, link) {
output_destroy(output); output_destroy(output);
} }
wlr_signal_emit_safe(&manager->events.destroy, manager); wl_signal_emit_mutable(&manager->events.destroy, manager);
wl_list_remove(&manager->display_destroy.link); wl_list_remove(&manager->display_destroy.link);
wl_list_remove(&manager->layout_add.link); wl_list_remove(&manager->layout_add.link);
wl_list_remove(&manager->layout_change.link); wl_list_remove(&manager->layout_change.link);

View File

@ -2,7 +2,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "types/wlr_xdg_shell.h" #include "types/wlr_xdg_shell.h"
#include "util/signal.h"
void handle_xdg_popup_ack_configure( void handle_xdg_popup_ack_configure(
struct wlr_xdg_popup *popup, struct wlr_xdg_popup *popup,
@ -325,7 +324,7 @@ static void xdg_popup_handle_reposition(
wlr_xdg_surface_schedule_configure(popup->base); wlr_xdg_surface_schedule_configure(popup->base);
wlr_signal_emit_safe(&popup->events.reposition, NULL); wl_signal_emit_mutable(&popup->events.reposition, NULL);
} }
static void xdg_popup_handle_destroy(struct wl_client *client, static void xdg_popup_handle_destroy(struct wl_client *client,
@ -419,7 +418,7 @@ void create_xdg_popup(struct wlr_xdg_surface *surface,
if (parent) { if (parent) {
surface->popup->parent = parent->surface; surface->popup->parent = parent->surface;
wl_list_insert(&parent->popups, &surface->popup->link); wl_list_insert(&parent->popups, &surface->popup->link);
wlr_signal_emit_safe(&parent->events.new_popup, surface->popup); wl_signal_emit_mutable(&parent->events.new_popup, surface->popup);
} else { } else {
wl_list_init(&surface->popup->link); wl_list_init(&surface->popup->link);
} }

View File

@ -1,7 +1,6 @@
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include "types/wlr_xdg_shell.h" #include "types/wlr_xdg_shell.h"
#include "util/signal.h"
#define WM_BASE_VERSION 5 #define WM_BASE_VERSION 5
@ -84,7 +83,7 @@ static int xdg_client_ping_timeout(void *user_data) {
struct wlr_xdg_surface *surface; struct wlr_xdg_surface *surface;
wl_list_for_each(surface, &client->surfaces, link) { wl_list_for_each(surface, &client->surfaces, link) {
wlr_signal_emit_safe(&surface->events.ping_timeout, NULL); wl_signal_emit_mutable(&surface->events.ping_timeout, NULL);
} }
client->ping_serial = 0; client->ping_serial = 0;
@ -131,7 +130,7 @@ static void xdg_shell_bind(struct wl_client *wl_client, void *data,
static void handle_display_destroy(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_xdg_shell *xdg_shell = struct wlr_xdg_shell *xdg_shell =
wl_container_of(listener, xdg_shell, display_destroy); wl_container_of(listener, xdg_shell, display_destroy);
wlr_signal_emit_safe(&xdg_shell->events.destroy, xdg_shell); wl_signal_emit_mutable(&xdg_shell->events.destroy, xdg_shell);
wl_list_remove(&xdg_shell->display_destroy.link); wl_list_remove(&xdg_shell->display_destroy.link);
wl_global_destroy(xdg_shell->global); wl_global_destroy(xdg_shell->global);
free(xdg_shell); free(xdg_shell);

View File

@ -4,7 +4,6 @@
#include <wlr/util/box.h> #include <wlr/util/box.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "types/wlr_xdg_shell.h" #include "types/wlr_xdg_shell.h"
#include "util/signal.h"
bool wlr_surface_is_xdg_surface(struct wlr_surface *surface) { bool wlr_surface_is_xdg_surface(struct wlr_surface *surface) {
return surface->role == &xdg_toplevel_surface_role || return surface->role == &xdg_toplevel_surface_role ||
@ -34,7 +33,7 @@ void unmap_xdg_surface(struct wlr_xdg_surface *surface) {
// TODO: probably need to ungrab before this event // TODO: probably need to ungrab before this event
if (surface->mapped) { if (surface->mapped) {
surface->mapped = false; surface->mapped = false;
wlr_signal_emit_safe(&surface->events.unmap, NULL); wl_signal_emit_mutable(&surface->events.unmap, NULL);
} }
struct wlr_xdg_popup *popup, *popup_tmp; struct wlr_xdg_popup *popup, *popup_tmp;
@ -98,7 +97,7 @@ static void xdg_surface_handle_ack_configure(struct wl_client *client,
if (configure->serial == serial) { if (configure->serial == serial) {
break; break;
} }
wlr_signal_emit_safe(&surface->events.ack_configure, configure); wl_signal_emit_mutable(&surface->events.ack_configure, configure);
xdg_surface_configure_destroy(configure); xdg_surface_configure_destroy(configure);
} }
@ -119,7 +118,7 @@ static void xdg_surface_handle_ack_configure(struct wl_client *client,
surface->configured = true; surface->configured = true;
surface->pending.configure_serial = serial; surface->pending.configure_serial = serial;
wlr_signal_emit_safe(&surface->events.ack_configure, configure); wl_signal_emit_mutable(&surface->events.ack_configure, configure);
xdg_surface_configure_destroy(configure); xdg_surface_configure_destroy(configure);
} }
@ -153,7 +152,7 @@ static void surface_send_configure(void *user_data) {
break; break;
} }
wlr_signal_emit_safe(&surface->events.configure, configure); wl_signal_emit_mutable(&surface->events.configure, configure);
xdg_surface_send_configure(surface->resource, configure->serial); xdg_surface_send_configure(surface->resource, configure->serial);
} }
@ -306,13 +305,13 @@ void xdg_surface_role_commit(struct wlr_surface *wlr_surface) {
if (!surface->added) { if (!surface->added) {
surface->added = true; surface->added = true;
wlr_signal_emit_safe(&surface->client->shell->events.new_surface, wl_signal_emit_mutable(&surface->client->shell->events.new_surface,
surface); surface);
} }
if (surface->configured && wlr_surface_has_buffer(surface->surface) && if (surface->configured && wlr_surface_has_buffer(surface->surface) &&
!surface->mapped) { !surface->mapped) {
surface->mapped = true; surface->mapped = true;
wlr_signal_emit_safe(&surface->events.map, NULL); wl_signal_emit_mutable(&surface->events.map, NULL);
} }
} }
@ -405,7 +404,7 @@ void reset_xdg_surface(struct wlr_xdg_surface *surface) {
} }
if (surface->added) { if (surface->added) {
wlr_signal_emit_safe(&surface->events.destroy, NULL); wl_signal_emit_mutable(&surface->events.destroy, NULL);
surface->added = false; surface->added = false;
} }

View File

@ -5,7 +5,6 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include <wlr/util/edges.h> #include <wlr/util/edges.h>
#include "types/wlr_xdg_shell.h" #include "types/wlr_xdg_shell.h"
#include "util/signal.h"
void handle_xdg_toplevel_ack_configure( void handle_xdg_toplevel_ack_configure(
struct wlr_xdg_toplevel *toplevel, struct wlr_xdg_toplevel *toplevel,
@ -168,7 +167,7 @@ void wlr_xdg_toplevel_set_parent(struct wlr_xdg_toplevel *toplevel,
toplevel->parent = NULL; toplevel->parent = NULL;
} }
wlr_signal_emit_safe(&toplevel->events.set_parent, NULL); wl_signal_emit_mutable(&toplevel->events.set_parent, NULL);
} }
static void xdg_toplevel_handle_set_parent(struct wl_client *client, static void xdg_toplevel_handle_set_parent(struct wl_client *client,
@ -198,7 +197,7 @@ static void xdg_toplevel_handle_set_title(struct wl_client *client,
free(toplevel->title); free(toplevel->title);
toplevel->title = tmp; toplevel->title = tmp;
wlr_signal_emit_safe(&toplevel->events.set_title, NULL); wl_signal_emit_mutable(&toplevel->events.set_title, NULL);
} }
static void xdg_toplevel_handle_set_app_id(struct wl_client *client, static void xdg_toplevel_handle_set_app_id(struct wl_client *client,
@ -215,7 +214,7 @@ static void xdg_toplevel_handle_set_app_id(struct wl_client *client,
free(toplevel->app_id); free(toplevel->app_id);
toplevel->app_id = tmp; toplevel->app_id = tmp;
wlr_signal_emit_safe(&toplevel->events.set_app_id, NULL); wl_signal_emit_mutable(&toplevel->events.set_app_id, NULL);
} }
static void xdg_toplevel_handle_show_window_menu(struct wl_client *client, static void xdg_toplevel_handle_show_window_menu(struct wl_client *client,
@ -246,7 +245,7 @@ static void xdg_toplevel_handle_show_window_menu(struct wl_client *client,
.y = y, .y = y,
}; };
wlr_signal_emit_safe(&toplevel->events.request_show_window_menu, &event); wl_signal_emit_mutable(&toplevel->events.request_show_window_menu, &event);
} }
static void xdg_toplevel_handle_move(struct wl_client *client, static void xdg_toplevel_handle_move(struct wl_client *client,
@ -275,7 +274,7 @@ static void xdg_toplevel_handle_move(struct wl_client *client,
.serial = serial, .serial = serial,
}; };
wlr_signal_emit_safe(&toplevel->events.request_move, &event); wl_signal_emit_mutable(&toplevel->events.request_move, &event);
} }
static void xdg_toplevel_handle_resize(struct wl_client *client, static void xdg_toplevel_handle_resize(struct wl_client *client,
@ -305,7 +304,7 @@ static void xdg_toplevel_handle_resize(struct wl_client *client,
.edges = edges, .edges = edges,
}; };
wlr_signal_emit_safe(&toplevel->events.request_resize, &event); wl_signal_emit_mutable(&toplevel->events.request_resize, &event);
} }
static void xdg_toplevel_handle_set_max_size(struct wl_client *client, static void xdg_toplevel_handle_set_max_size(struct wl_client *client,
@ -329,7 +328,7 @@ static void xdg_toplevel_handle_set_maximized(struct wl_client *client,
struct wlr_xdg_toplevel *toplevel = struct wlr_xdg_toplevel *toplevel =
wlr_xdg_toplevel_from_resource(resource); wlr_xdg_toplevel_from_resource(resource);
toplevel->requested.maximized = true; toplevel->requested.maximized = true;
wlr_signal_emit_safe(&toplevel->events.request_maximize, NULL); wl_signal_emit_mutable(&toplevel->events.request_maximize, NULL);
} }
static void xdg_toplevel_handle_unset_maximized(struct wl_client *client, static void xdg_toplevel_handle_unset_maximized(struct wl_client *client,
@ -337,7 +336,7 @@ static void xdg_toplevel_handle_unset_maximized(struct wl_client *client,
struct wlr_xdg_toplevel *toplevel = struct wlr_xdg_toplevel *toplevel =
wlr_xdg_toplevel_from_resource(resource); wlr_xdg_toplevel_from_resource(resource);
toplevel->requested.maximized = false; toplevel->requested.maximized = false;
wlr_signal_emit_safe(&toplevel->events.request_maximize, NULL); wl_signal_emit_mutable(&toplevel->events.request_maximize, NULL);
} }
static void handle_fullscreen_output_destroy(struct wl_listener *listener, static void handle_fullscreen_output_destroy(struct wl_listener *listener,
@ -376,7 +375,7 @@ static void xdg_toplevel_handle_set_fullscreen(struct wl_client *client,
store_fullscreen_requested(toplevel, true, output); store_fullscreen_requested(toplevel, true, output);
wlr_signal_emit_safe(&toplevel->events.request_fullscreen, NULL); wl_signal_emit_mutable(&toplevel->events.request_fullscreen, NULL);
} }
static void xdg_toplevel_handle_unset_fullscreen(struct wl_client *client, static void xdg_toplevel_handle_unset_fullscreen(struct wl_client *client,
@ -386,7 +385,7 @@ static void xdg_toplevel_handle_unset_fullscreen(struct wl_client *client,
store_fullscreen_requested(toplevel, false, NULL); store_fullscreen_requested(toplevel, false, NULL);
wlr_signal_emit_safe(&toplevel->events.request_fullscreen, NULL); wl_signal_emit_mutable(&toplevel->events.request_fullscreen, NULL);
} }
static void xdg_toplevel_handle_set_minimized(struct wl_client *client, static void xdg_toplevel_handle_set_minimized(struct wl_client *client,
@ -394,7 +393,7 @@ static void xdg_toplevel_handle_set_minimized(struct wl_client *client,
struct wlr_xdg_toplevel *toplevel = struct wlr_xdg_toplevel *toplevel =
wlr_xdg_toplevel_from_resource(resource); wlr_xdg_toplevel_from_resource(resource);
toplevel->requested.minimized = true; toplevel->requested.minimized = true;
wlr_signal_emit_safe(&toplevel->events.request_minimize, NULL); wl_signal_emit_mutable(&toplevel->events.request_minimize, NULL);
} }
static void xdg_toplevel_handle_destroy(struct wl_client *client, static void xdg_toplevel_handle_destroy(struct wl_client *client,

View File

@ -16,7 +16,6 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include <wlr/xwayland.h> #include <wlr/xwayland.h>
#include "sockets.h" #include "sockets.h"
#include "util/signal.h"
#include "xwayland/config.h" #include "xwayland/config.h"
static void safe_close(int fd) { static void safe_close(int fd) {
@ -281,7 +280,7 @@ static int xserver_handle_ready(int fd, uint32_t mask, void *data) {
.server = server, .server = server,
.wm_fd = server->wm_fd[0], .wm_fd = server->wm_fd[0],
}; };
wlr_signal_emit_safe(&server->events.ready, &event); wl_signal_emit_mutable(&server->events.ready, &event);
/* We removed the source, so don't need recheck */ /* We removed the source, so don't need recheck */
return 0; return 0;
@ -432,7 +431,7 @@ void wlr_xwayland_server_destroy(struct wlr_xwayland_server *server) {
server_finish_process(server); server_finish_process(server);
server_finish_display(server); server_finish_display(server);
wlr_signal_emit_safe(&server->events.destroy, NULL); wl_signal_emit_mutable(&server->events.destroy, NULL);
free(server); free(server);
} }

View File

@ -14,7 +14,6 @@
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include <wlr/xwayland.h> #include <wlr/xwayland.h>
#include "sockets.h" #include "sockets.h"
#include "util/signal.h"
#include "xwayland/xwm.h" #include "xwayland/xwm.h"
struct wlr_xwayland_cursor { struct wlr_xwayland_cursor {
@ -54,7 +53,7 @@ static void handle_server_ready(struct wl_listener *listener, void *data) {
cur->height, cur->hotspot_x, cur->hotspot_y); cur->height, cur->hotspot_x, cur->hotspot_y);
} }
wlr_signal_emit_safe(&xwayland->events.ready, NULL); wl_signal_emit_mutable(&xwayland->events.ready, NULL);
} }
void wlr_xwayland_destroy(struct wlr_xwayland *xwayland) { void wlr_xwayland_destroy(struct wlr_xwayland *xwayland) {

View File

@ -16,7 +16,6 @@
#include <xcb/render.h> #include <xcb/render.h>
#include <xcb/res.h> #include <xcb/res.h>
#include <xcb/xfixes.h> #include <xcb/xfixes.h>
#include "util/signal.h"
#include "xwayland/xwm.h" #include "xwayland/xwm.h"
const char *const atom_map[ATOM_LAST] = { const char *const atom_map[ATOM_LAST] = {
@ -125,7 +124,7 @@ static struct wlr_xwayland_surface *lookup_surface(struct wlr_xwm *xwm,
static int xwayland_surface_handle_ping_timeout(void *data) { static int xwayland_surface_handle_ping_timeout(void *data) {
struct wlr_xwayland_surface *surface = data; struct wlr_xwayland_surface *surface = data;
wlr_signal_emit_safe(&surface->events.ping_timeout, surface); wl_signal_emit_mutable(&surface->events.ping_timeout, surface);
surface->pinging = false; surface->pinging = false;
return 1; return 1;
} }
@ -202,7 +201,7 @@ static struct wlr_xwayland_surface *xwayland_surface_create(
wl_list_insert(&xwm->surfaces, &surface->link); wl_list_insert(&xwm->surfaces, &surface->link);
wlr_signal_emit_safe(&xwm->xwayland->events.new_surface, surface); wl_signal_emit_mutable(&xwm->xwayland->events.new_surface, surface);
return surface; return surface;
} }
@ -390,7 +389,7 @@ static void xwayland_surface_destroy(
struct wlr_xwayland_surface *xsurface) { struct wlr_xwayland_surface *xsurface) {
xsurface_unmap(xsurface); xsurface_unmap(xsurface);
wlr_signal_emit_safe(&xsurface->events.destroy, xsurface); wl_signal_emit_mutable(&xsurface->events.destroy, xsurface);
if (xsurface == xsurface->xwm->focus_surface) { if (xsurface == xsurface->xwm->focus_surface) {
xwm_surface_activate(xsurface->xwm, NULL); xwm_surface_activate(xsurface->xwm, NULL);
@ -456,7 +455,7 @@ static void read_surface_class(struct wlr_xwm *xwm,
surface->class = NULL; surface->class = NULL;
} }
wlr_signal_emit_safe(&surface->events.set_class, surface); wl_signal_emit_mutable(&surface->events.set_class, surface);
} }
static void read_surface_startup_id(struct wlr_xwm *xwm, static void read_surface_startup_id(struct wlr_xwm *xwm,
@ -479,7 +478,7 @@ static void read_surface_startup_id(struct wlr_xwm *xwm,
wlr_log(WLR_DEBUG, "XCB_ATOM_NET_STARTUP_ID: %s", wlr_log(WLR_DEBUG, "XCB_ATOM_NET_STARTUP_ID: %s",
xsurface->startup_id ? xsurface->startup_id: "(null)"); xsurface->startup_id ? xsurface->startup_id: "(null)");
wlr_signal_emit_safe(&xsurface->events.set_startup_id, xsurface); wl_signal_emit_mutable(&xsurface->events.set_startup_id, xsurface);
} }
static void read_surface_role(struct wlr_xwm *xwm, static void read_surface_role(struct wlr_xwm *xwm,
@ -500,7 +499,7 @@ static void read_surface_role(struct wlr_xwm *xwm,
xsurface->role = NULL; xsurface->role = NULL;
} }
wlr_signal_emit_safe(&xsurface->events.set_role, xsurface); wl_signal_emit_mutable(&xsurface->events.set_role, xsurface);
} }
static void read_surface_title(struct wlr_xwm *xwm, static void read_surface_title(struct wlr_xwm *xwm,
@ -527,7 +526,7 @@ static void read_surface_title(struct wlr_xwm *xwm,
} }
xsurface->has_utf8_title = is_utf8; xsurface->has_utf8_title = is_utf8;
wlr_signal_emit_safe(&xsurface->events.set_title, xsurface); wl_signal_emit_mutable(&xsurface->events.set_title, xsurface);
} }
static bool has_parent(struct wlr_xwayland_surface *parent, static bool has_parent(struct wlr_xwayland_surface *parent,
@ -572,7 +571,7 @@ static void read_surface_parent(struct wlr_xwm *xwm,
wl_list_init(&xsurface->parent_link); wl_list_init(&xsurface->parent_link);
} }
wlr_signal_emit_safe(&xsurface->events.set_parent, xsurface); wl_signal_emit_mutable(&xsurface->events.set_parent, xsurface);
} }
static void read_surface_client_id(struct wlr_xwm *xwm, static void read_surface_client_id(struct wlr_xwm *xwm,
@ -606,7 +605,7 @@ static void read_surface_client_id(struct wlr_xwm *xwm,
return; return;
} }
xsurface->pid = *pid; xsurface->pid = *pid;
wlr_signal_emit_safe(&xsurface->events.set_pid, xsurface); wl_signal_emit_mutable(&xsurface->events.set_pid, xsurface);
free(reply); free(reply);
} }
@ -629,7 +628,7 @@ static void read_surface_window_type(struct wlr_xwm *xwm,
memcpy(xsurface->window_type, atoms, atoms_size); memcpy(xsurface->window_type, atoms, atoms_size);
xsurface->window_type_len = atoms_len; xsurface->window_type_len = atoms_len;
wlr_signal_emit_safe(&xsurface->events.set_window_type, xsurface); wl_signal_emit_mutable(&xsurface->events.set_window_type, xsurface);
} }
static void read_surface_protocols(struct wlr_xwm *xwm, static void read_surface_protocols(struct wlr_xwm *xwm,
@ -674,7 +673,7 @@ static void read_surface_hints(struct wlr_xwm *xwm,
xsurface->hints->input = true; xsurface->hints->input = true;
} }
wlr_signal_emit_safe(&xsurface->events.set_hints, xsurface); wl_signal_emit_mutable(&xsurface->events.set_hints, xsurface);
} }
static void read_surface_normal_hints(struct wlr_xwm *xwm, static void read_surface_normal_hints(struct wlr_xwm *xwm,
@ -744,7 +743,7 @@ static void read_surface_motif_hints(struct wlr_xwm *xwm,
WLR_XWAYLAND_SURFACE_DECORATIONS_NO_TITLE; WLR_XWAYLAND_SURFACE_DECORATIONS_NO_TITLE;
} }
} }
wlr_signal_emit_safe(&xsurface->events.set_decorations, xsurface); wl_signal_emit_mutable(&xsurface->events.set_decorations, xsurface);
} }
} }
@ -837,7 +836,7 @@ static void xwayland_surface_role_commit(struct wlr_surface *wlr_surface) {
if (!surface->mapped && wlr_surface_has_buffer(surface->surface)) { if (!surface->mapped && wlr_surface_has_buffer(surface->surface)) {
surface->mapped = true; surface->mapped = true;
wlr_signal_emit_safe(&surface->events.map, surface); wl_signal_emit_mutable(&surface->events.map, surface);
xwm_set_net_client_list(surface->xwm); xwm_set_net_client_list(surface->xwm);
} }
} }
@ -854,7 +853,7 @@ static void xwayland_surface_role_precommit(struct wlr_surface *wlr_surface,
// This is a NULL commit // This is a NULL commit
if (surface->mapped) { if (surface->mapped) {
surface->mapped = false; surface->mapped = false;
wlr_signal_emit_safe(&surface->events.unmap, surface); wl_signal_emit_mutable(&surface->events.unmap, surface);
xwm_set_net_client_list(surface->xwm); xwm_set_net_client_list(surface->xwm);
} }
} }
@ -909,7 +908,7 @@ static void xwm_map_shell_surface(struct wlr_xwm *xwm,
static void xsurface_unmap(struct wlr_xwayland_surface *surface) { static void xsurface_unmap(struct wlr_xwayland_surface *surface) {
if (surface->mapped) { if (surface->mapped) {
wlr_signal_emit_safe(&surface->events.unmap, surface); wl_signal_emit_mutable(&surface->events.unmap, surface);
surface->mapped = false; surface->mapped = false;
xwm_set_net_client_list(surface->xwm); xwm_set_net_client_list(surface->xwm);
} }
@ -977,7 +976,7 @@ static void xwm_handle_configure_request(struct wlr_xwm *xwm,
.mask = mask, .mask = mask,
}; };
wlr_signal_emit_safe(&surface->events.request_configure, &wlr_event); wl_signal_emit_mutable(&surface->events.request_configure, &wlr_event);
} }
static void xwm_handle_configure_notify(struct wlr_xwm *xwm, static void xwm_handle_configure_notify(struct wlr_xwm *xwm,
@ -1000,11 +999,11 @@ static void xwm_handle_configure_notify(struct wlr_xwm *xwm,
if (xsurface->override_redirect != ev->override_redirect) { if (xsurface->override_redirect != ev->override_redirect) {
xsurface->override_redirect = ev->override_redirect; xsurface->override_redirect = ev->override_redirect;
wlr_signal_emit_safe(&xsurface->events.set_override_redirect, xsurface); wl_signal_emit_mutable(&xsurface->events.set_override_redirect, xsurface);
} }
if (geometry_changed) { if (geometry_changed) {
wlr_signal_emit_safe(&xsurface->events.set_geometry, NULL); wl_signal_emit_mutable(&xsurface->events.set_geometry, NULL);
} }
} }
@ -1086,7 +1085,7 @@ static void xwm_handle_map_notify(struct wlr_xwm *xwm,
if (xsurface->override_redirect != ev->override_redirect) { if (xsurface->override_redirect != ev->override_redirect) {
xsurface->override_redirect = ev->override_redirect; xsurface->override_redirect = ev->override_redirect;
wlr_signal_emit_safe(&xsurface->events.set_override_redirect, xsurface); wl_signal_emit_mutable(&xsurface->events.set_override_redirect, xsurface);
} }
} }
@ -1198,7 +1197,7 @@ static void xwm_handle_net_wm_moveresize_message(struct wlr_xwm *xwm,
switch (detail) { switch (detail) {
case _NET_WM_MOVERESIZE_MOVE: case _NET_WM_MOVERESIZE_MOVE:
move_event.surface = xsurface; move_event.surface = xsurface;
wlr_signal_emit_safe(&xsurface->events.request_move, &move_event); wl_signal_emit_mutable(&xsurface->events.request_move, &move_event);
break; break;
case _NET_WM_MOVERESIZE_SIZE_TOPLEFT: case _NET_WM_MOVERESIZE_SIZE_TOPLEFT:
case _NET_WM_MOVERESIZE_SIZE_TOP: case _NET_WM_MOVERESIZE_SIZE_TOP:
@ -1210,7 +1209,7 @@ static void xwm_handle_net_wm_moveresize_message(struct wlr_xwm *xwm,
case _NET_WM_MOVERESIZE_SIZE_LEFT: case _NET_WM_MOVERESIZE_SIZE_LEFT:
resize_event.surface = xsurface; resize_event.surface = xsurface;
resize_event.edges = net_wm_edges_to_wlr(detail); resize_event.edges = net_wm_edges_to_wlr(detail);
wlr_signal_emit_safe(&xsurface->events.request_resize, &resize_event); wl_signal_emit_mutable(&xsurface->events.request_resize, &resize_event);
break; break;
case _NET_WM_MOVERESIZE_CANCEL: case _NET_WM_MOVERESIZE_CANCEL:
// handled by the compositor // handled by the compositor
@ -1300,7 +1299,7 @@ static void xwm_handle_net_wm_state_message(struct wlr_xwm *xwm,
xsurface->saved_height = xsurface->height; xsurface->saved_height = xsurface->height;
} }
wlr_signal_emit_safe(&xsurface->events.request_fullscreen, xsurface); wl_signal_emit_mutable(&xsurface->events.request_fullscreen, xsurface);
} }
if (maximized != xsurface_is_maximized(xsurface)) { if (maximized != xsurface_is_maximized(xsurface)) {
@ -1309,7 +1308,7 @@ static void xwm_handle_net_wm_state_message(struct wlr_xwm *xwm,
xsurface->saved_height = xsurface->height; xsurface->saved_height = xsurface->height;
} }
wlr_signal_emit_safe(&xsurface->events.request_maximize, xsurface); wl_signal_emit_mutable(&xsurface->events.request_maximize, xsurface);
} }
if (minimized != xsurface->minimized) { if (minimized != xsurface->minimized) {
@ -1322,7 +1321,7 @@ static void xwm_handle_net_wm_state_message(struct wlr_xwm *xwm,
.surface = xsurface, .surface = xsurface,
.minimize = xsurface->minimized, .minimize = xsurface->minimized,
}; };
wlr_signal_emit_safe(&xsurface->events.request_minimize, &minimize_event); wl_signal_emit_mutable(&xsurface->events.request_minimize, &minimize_event);
} }
} }
@ -1358,7 +1357,7 @@ static void xwm_handle_net_active_window_message(struct wlr_xwm *xwm,
if (surface == NULL) { if (surface == NULL) {
return; return;
} }
wlr_signal_emit_safe(&surface->events.request_activate, surface); wl_signal_emit_mutable(&surface->events.request_activate, surface);
} }
static void pending_startup_id_destroy(struct pending_startup_id *pending) { static void pending_startup_id_destroy(struct pending_startup_id *pending) {
@ -1423,7 +1422,7 @@ static void xwm_handle_net_startup_info_message(struct wlr_xwm *xwm,
if (id) { if (id) {
struct wlr_xwayland_remove_startup_info_event data = { id, ev->window }; struct wlr_xwayland_remove_startup_info_event data = { id, ev->window };
wlr_log(WLR_DEBUG, "Got startup id: %s", id); wlr_log(WLR_DEBUG, "Got startup id: %s", id);
wlr_signal_emit_safe(&xwm->xwayland->events.remove_startup_info, &data); wl_signal_emit_mutable(&xwm->xwayland->events.remove_startup_info, &data);
pending_startup_id_destroy(curr); pending_startup_id_destroy(curr);
} }
} }
@ -1451,7 +1450,7 @@ static void xwm_handle_wm_change_state_message(struct wlr_xwm *xwm,
.surface = xsurface, .surface = xsurface,
.minimize = minimize, .minimize = minimize,
}; };
wlr_signal_emit_safe(&xsurface->events.request_minimize, &minimize_event); wl_signal_emit_mutable(&xsurface->events.request_minimize, &minimize_event);
} }
static void xwm_handle_client_message(struct wlr_xwm *xwm, static void xwm_handle_client_message(struct wlr_xwm *xwm,