diff options
author | Simon Ser <contact@emersion.fr> | 2020-04-02 12:41:19 +0200 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2020-04-08 16:31:21 +0200 |
commit | e04115898892129977a44e76aa39103a2bdd2144 (patch) | |
tree | 3b2616fabb0ac3e8f94587df034e8637661a6f2e /backend/x11 | |
parent | 1fa9e0203b4192659a36ddd259c174569bc227d5 (diff) |
output: introduce wlr_output_test
Diffstat (limited to 'backend/x11')
-rw-r--r-- | backend/x11/output.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/backend/x11/output.c b/backend/x11/output.c index 9d184c48..6546c23e 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -99,17 +99,28 @@ static bool output_attach_render(struct wlr_output *wlr_output, return wlr_egl_make_current(&x11->egl, output->surf, buffer_age); } +static bool output_test(struct wlr_output *wlr_output) { + if (wlr_output->pending.committed & WLR_OUTPUT_STATE_ENABLED) { + wlr_log(WLR_DEBUG, "Cannot disable an X11 output"); + return false; + } + + if (wlr_output->pending.committed & WLR_OUTPUT_STATE_MODE) { + assert(wlr_output->pending.mode_type == WLR_OUTPUT_STATE_MODE_CUSTOM); + } + + return true; +} + static bool output_commit(struct wlr_output *wlr_output) { struct wlr_x11_output *output = get_x11_output_from_output(wlr_output); struct wlr_x11_backend *x11 = output->x11; - if (wlr_output->pending.committed & WLR_OUTPUT_STATE_ENABLED) { - wlr_log(WLR_DEBUG, "Cannot disable an X11 output"); + if (!output_test(wlr_output)) { return false; } if (wlr_output->pending.committed & WLR_OUTPUT_STATE_MODE) { - assert(wlr_output->pending.mode_type == WLR_OUTPUT_STATE_MODE_CUSTOM); if (!output_set_custom_mode(wlr_output, wlr_output->pending.custom_mode.width, wlr_output->pending.custom_mode.height, @@ -152,6 +163,7 @@ static bool output_commit(struct wlr_output *wlr_output) { static const struct wlr_output_impl output_impl = { .destroy = output_destroy, .attach_render = output_attach_render, + .test = output_test, .commit = output_commit, }; |