mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-25 21:45:59 +01:00
outputmgr applytest
This commit is contained in:
parent
86b6d7f938
commit
bc9d9c9c8d
3 changed files with 44 additions and 2 deletions
|
@ -394,12 +394,12 @@ void Events::listener_newXDGSurface(wl_listener* listener, void* data) {
|
|||
|
||||
void Events::listener_outputMgrApply(wl_listener* listener, void* data) {
|
||||
const auto CONFIG = (wlr_output_configuration_v1*)data;
|
||||
|
||||
g_pHyprRenderer->outputMgrApplyTest(CONFIG, false);
|
||||
}
|
||||
|
||||
void Events::listener_outputMgrTest(wl_listener* listener, void* data) {
|
||||
const auto CONFIG = (wlr_output_configuration_v1*)data;
|
||||
|
||||
g_pHyprRenderer->outputMgrApplyTest(CONFIG, true);
|
||||
}
|
||||
|
||||
void Events::listener_requestMouse(wl_listener* listener, void* data) {
|
||||
|
|
|
@ -99,3 +99,44 @@ void CHyprRenderer::renderAllClientsForMonitor(const int& ID, timespec* time) {
|
|||
wlr_surface_for_each_surface(ls->layerSurface->surface, renderSurface, &renderdata);
|
||||
}
|
||||
}
|
||||
|
||||
void CHyprRenderer::outputMgrApplyTest(wlr_output_configuration_v1* config, bool test) {
|
||||
wlr_output_configuration_head_v1* head;
|
||||
bool noError = true;
|
||||
|
||||
wl_list_for_each(head, &config->heads, link) {
|
||||
const auto OUTPUT = head->state.output;
|
||||
|
||||
wlr_output_enable(OUTPUT, head->state.enabled);
|
||||
if (head->state.enabled) {
|
||||
if (head->state.mode)
|
||||
wlr_output_set_mode(OUTPUT, head->state.mode);
|
||||
else
|
||||
wlr_output_set_custom_mode(OUTPUT, head->state.custom_mode.width, head->state.custom_mode.height, head->state.custom_mode.refresh);
|
||||
|
||||
wlr_output_layout_move(g_pCompositor->m_sWLROutputLayout, OUTPUT, head->state.x, head->state.y);
|
||||
wlr_output_set_transform(OUTPUT, head->state.transform);
|
||||
wlr_output_set_scale(OUTPUT, head->state.scale);
|
||||
}
|
||||
|
||||
noError = wlr_output_test(OUTPUT);
|
||||
|
||||
if (!noError)
|
||||
break;
|
||||
}
|
||||
|
||||
wl_list_for_each(head, &config->heads, link) {
|
||||
if (noError && !test)
|
||||
wlr_output_commit(head->state.output);
|
||||
else
|
||||
wlr_output_rollback(head->state.output);
|
||||
}
|
||||
|
||||
if (noError)
|
||||
wlr_output_configuration_v1_send_succeeded(config);
|
||||
else
|
||||
wlr_output_configuration_v1_send_failed(config);
|
||||
wlr_output_configuration_v1_destroy(config);
|
||||
|
||||
Debug::log(LOG, "OutputMgr Applied/Tested.");
|
||||
}
|
|
@ -6,6 +6,7 @@ class CHyprRenderer {
|
|||
public:
|
||||
|
||||
void renderAllClientsForMonitor(const int&, timespec*);
|
||||
void outputMgrApplyTest(wlr_output_configuration_v1*, bool);
|
||||
|
||||
private:
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue