Skip to content

Commit

Permalink
output-layout: add support for custom modes in wlr-output-management-…
Browse files Browse the repository at this point in the history
…v1 (#1984)
  • Loading branch information
ammen99 authored Oct 29, 2023
1 parent 3a5f33c commit 1744dce
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions src/core/output-layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,20 +540,7 @@ struct output_layout_output_t
/** Check whether the given state can be applied */
bool test_state(const output_state_t& state)
{
if (state.source == OUTPUT_IMAGE_SOURCE_NONE)
{
return true;
}

if (state.source == OUTPUT_IMAGE_SOURCE_MIRROR)
{
return true;
}

/* XXX: are there more things to check? */
refresh_custom_modes();

return is_mode_supported(state.mode);
return true;
}

/** Change the output mode */
Expand Down Expand Up @@ -585,8 +572,7 @@ struct output_layout_output_t
" for output ", handle->name, ". Trying to use custom mode",
"(might not work)");

wlr_output_set_custom_mode(handle, mode.width, mode.height,
mode.refresh);
wlr_output_set_custom_mode(handle, mode.width, mode.height, mode.refresh);
}

wlr_output_commit(handle);
Expand Down Expand Up @@ -970,8 +956,17 @@ class output_layout_t::impl
}

state.source = OUTPUT_IMAGE_SOURCE_SELF;
state.mode = head->state.mode ? *head->state.mode :
this->outputs[handle]->current_state.mode;

if (head->state.mode)
{
state.mode = *head->state.mode;
} else
{
state.mode.width = head->state.custom_mode.width;
state.mode.height = head->state.custom_mode.height;
state.mode.refresh = head->state.custom_mode.refresh;
}

state.position = {head->state.x, head->state.y};
state.scale = head->state.scale;
state.transform = head->state.transform;
Expand Down

0 comments on commit 1744dce

Please sign in to comment.