output: fix incorrect call to private wlroots function

Use wlr_output_test() instead of output_ensure_buffer() which is not a
public function and only compiled when linking statically to wlroots.

Also wlr_output_rollback() on failed test.

Fixes issue #273

Backport of 5fd5024ca6
This commit is contained in:
Johan Malm 2022-03-15 21:30:25 +00:00 committed by Consolatis
parent 0fb33066e9
commit 834ee3dfd4

View file

@ -9,6 +9,7 @@
#define _POSIX_C_SOURCE 200809L
#include "config.h"
#include <assert.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_xdg_output_v1.h>
#include <wlr/types/wlr_output_damage.h>
#include <wlr/util/region.h>
@ -1299,7 +1300,9 @@ handle_output_power_manager_set_mode(struct wl_listener *listener, void *data)
break;
case ZWLR_OUTPUT_POWER_V1_MODE_ON:
wlr_output_enable(event->output, true);
output_ensure_buffer(event->output);
if (!wlr_output_test(event->output)) {
wlr_output_rollback(event->output);
}
wlr_output_commit(event->output);
break;
}