Change all timespec pointers in events to owned

Follow-up from !4803.  Make things consistent by making all `struct
timespec`s in events owned.  Reduces the need for thinking about
ownership/lifetimes.
This commit is contained in:
David Turner 2025-04-24 14:12:43 +01:00 committed by Simon Ser
parent f04ef79f61
commit c9f0dbc159
6 changed files with 10 additions and 10 deletions

View file

@ -245,13 +245,13 @@ struct wlr_output_event_damage {
struct wlr_output_event_precommit {
struct wlr_output *output;
struct timespec *when;
struct timespec when;
const struct wlr_output_state *state;
};
struct wlr_output_event_commit {
struct wlr_output *output;
struct timespec *when;
struct timespec when;
const struct wlr_output_state *state;
};

View file

@ -40,7 +40,7 @@ struct wlr_ext_output_image_capture_source_v1 {
struct wlr_ext_output_image_capture_source_v1_frame_event {
struct wlr_ext_image_capture_source_v1_frame_event base;
struct wlr_buffer *buffer;
struct timespec *when;
struct timespec when;
};
static void output_source_start(struct wlr_ext_image_capture_source_v1 *base,
@ -85,7 +85,7 @@ static void output_source_copy_frame(struct wlr_ext_image_capture_source_v1 *bas
if (wlr_ext_image_copy_capture_frame_v1_copy_buffer(frame,
event->buffer, source->output->renderer)) {
wlr_ext_image_copy_capture_frame_v1_ready(frame,
source->output->transform, event->when);
source->output->transform, &event->when);
}
}

View file

@ -728,7 +728,7 @@ bool output_prepare_commit(struct wlr_output *output, const struct wlr_output_st
struct wlr_output_event_precommit pre_event = {
.output = output,
.when = &now,
.when = now,
.state = state,
};
wl_signal_emit_mutable(&output->events.precommit, &pre_event);
@ -750,7 +750,7 @@ void output_apply_commit(struct wlr_output *output, const struct wlr_output_stat
clock_gettime(CLOCK_MONOTONIC, &now);
struct wlr_output_event_commit event = {
.output = output,
.when = &now,
.when = now,
.state = state,
};
wl_signal_emit_mutable(&output->events.commit, &event);

View file

@ -650,7 +650,7 @@ static void output_cursor_output_handle_output_commit(
struct wlr_surface *surface = output_cursor->cursor->state->surface;
if (surface && output_cursor->output_cursor->visible &&
(event->state->committed & WLR_OUTPUT_STATE_BUFFER)) {
wlr_surface_send_frame_done(surface, event->when);
wlr_surface_send_frame_done(surface, &event->when);
}
}

View file

@ -85,11 +85,11 @@ static void frame_output_handle_commit(struct wl_listener *listener,
attribs.fd[i], size, attribs.offset[i], attribs.stride[i], i);
}
time_t tv_sec = event->when->tv_sec;
time_t tv_sec = event->when.tv_sec;
uint32_t tv_sec_hi = (sizeof(tv_sec) > 4) ? tv_sec >> 32 : 0;
uint32_t tv_sec_lo = tv_sec & 0xFFFFFFFF;
zwlr_export_dmabuf_frame_v1_send_ready(frame->resource,
tv_sec_hi, tv_sec_lo, event->when->tv_nsec);
tv_sec_hi, tv_sec_lo, event->when.tv_nsec);
frame_destroy(frame);
}

View file

@ -334,7 +334,7 @@ static void frame_handle_output_commit(struct wl_listener *listener,
zwlr_screencopy_frame_v1_send_flags(frame->resource, 0);
frame_send_damage(frame);
frame_send_ready(frame, event->when);
frame_send_ready(frame, &event->when);
frame_destroy(frame);
return;