output: disallow NULL event for wlr_output_send_present()

This commit is contained in:
Kirill Primak 2021-10-14 22:32:40 +03:00 committed by Simon Ser
parent 1b65a80e9d
commit 1089b7b8d6
3 changed files with 13 additions and 9 deletions

View File

@ -64,7 +64,10 @@ static bool output_commit(struct wlr_output *wlr_output) {
} }
if (wlr_output->pending.committed & WLR_OUTPUT_STATE_BUFFER) { if (wlr_output->pending.committed & WLR_OUTPUT_STATE_BUFFER) {
wlr_output_send_present(wlr_output, NULL); struct wlr_output_event_present present_event = {
.commit_seq = wlr_output->commit_seq + 1,
};
wlr_output_send_present(wlr_output, &present_event);
} }
return true; return true;

View File

@ -89,7 +89,10 @@ static void presentation_feedback_handle_discarded(void *data,
struct wp_presentation_feedback *wp_feedback) { struct wp_presentation_feedback *wp_feedback) {
struct wlr_wl_presentation_feedback *feedback = data; struct wlr_wl_presentation_feedback *feedback = data;
wlr_output_send_present(&feedback->output->wlr_output, NULL); struct wlr_output_event_present event = {
.commit_seq = feedback->commit_seq,
};
wlr_output_send_present(&feedback->output->wlr_output, &event);
presentation_feedback_destroy(feedback); presentation_feedback_destroy(feedback);
} }
@ -345,7 +348,10 @@ static bool output_commit(struct wlr_output *wlr_output) {
wp_presentation_feedback_add_listener(wp_feedback, wp_presentation_feedback_add_listener(wp_feedback,
&presentation_feedback_listener, feedback); &presentation_feedback_listener, feedback);
} else { } else {
wlr_output_send_present(wlr_output, NULL); struct wlr_output_event_present present_event = {
.commit_seq = wlr_output->commit_seq + 1,
};
wlr_output_send_present(wlr_output, &present_event);
} }
} }

View File

@ -956,12 +956,7 @@ void wlr_output_schedule_frame(struct wlr_output *output) {
void wlr_output_send_present(struct wlr_output *output, void wlr_output_send_present(struct wlr_output *output,
struct wlr_output_event_present *event) { struct wlr_output_event_present *event) {
struct wlr_output_event_present _event = {0}; assert(event);
if (event == NULL) {
event = &_event;
event->commit_seq = output->commit_seq + 1;
}
event->output = output; event->output = output;
struct timespec now; struct timespec now;