mirror of
https://github.com/labwc/labwc.git
synced 2026-06-13 14:33:18 -04:00
v2: Switch XRGB to XBGR
v3: Rewrite HDR mode checking and setting
v4: Restructure HDR support detection
v5: Fix code style
v6: Fix old style function declaration
v7: This function should be declared static
v8: This helper function can accept a const struct on input
v9: Rebase now that 0.20 is merged
v10: Rewrite with multiple color format attempts
v11: Add in the parts that accidentally got left in my
original color-management-v1 patch
v12: Add missing function prototype
v13: Apply suggested changes
v14: Changed HDR application setup in new output
v15: Rewrite configure_new_output to use lab_wlr_scene_output_commit
v16: Fixed application of HDR on external mode or output config change
v17: Fixed it for real this time instead of crashing
v18: Moved the effective resolution collection, plus one style change.
43 lines
1.2 KiB
C
43 lines
1.2 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
#include "output-state.h"
|
|
#include <wlr/types/wlr_output.h>
|
|
#include <wlr/types/wlr_output_management_v1.h>
|
|
#include <wlr/util/log.h>
|
|
#include "output.h"
|
|
|
|
void
|
|
output_state_init(struct output *output)
|
|
{
|
|
wlr_output_state_init(&output->pending);
|
|
|
|
/*
|
|
* As there is no direct way to convert an existing output
|
|
* configuration to an output_state we first convert it
|
|
* to a temporary output-management config and then apply
|
|
* it to an empty wlr_output_state.
|
|
*/
|
|
struct wlr_output_configuration_v1 *backup_config =
|
|
wlr_output_configuration_v1_create();
|
|
struct wlr_output_configuration_head_v1 *backup_head =
|
|
wlr_output_configuration_head_v1_create(
|
|
backup_config, output->wlr_output);
|
|
|
|
wlr_output_head_v1_state_apply(&backup_head->state, &output->pending);
|
|
|
|
wlr_output_configuration_v1_destroy(backup_config);
|
|
}
|
|
|
|
bool
|
|
output_state_commit(struct output *output)
|
|
{
|
|
bool committed =
|
|
wlr_output_commit_state(output->wlr_output, &output->pending);
|
|
if (committed) {
|
|
wlr_output_state_finish(&output->pending);
|
|
wlr_output_state_init(&output->pending);
|
|
} else {
|
|
wlr_log(WLR_ERROR, "Failed to commit frame");
|
|
}
|
|
return committed;
|
|
}
|