Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

output-layout: add support for custom modes in wlr-output-management-v1 #1984

Merged
merged 1 commit into from
Oct 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading