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
This commit is contained in:
Johan Malm 2022-03-15 21:30:25 +00:00
parent 4ee9f351ea
commit 5fd5024ca6

View file

@ -9,10 +9,9 @@
#define _POSIX_C_SOURCE 200809L
#include "config.h"
#include <assert.h>
#include <types/wlr_output.h>
#include <wlr/types/wlr_buffer.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_xdg_output_v1.h>
#include <wlr/types/wlr_output_damage.h>
#include <wlr/types/wlr_scene.h>
#include <wlr/util/region.h>
#include <wlr/util/log.h>
@ -412,7 +411,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;
}