diff options
author | vaxerski <[email protected]> | 2022-08-02 22:20:45 +0200 |
---|---|---|
committer | vaxerski <[email protected]> | 2022-08-02 22:20:45 +0200 |
commit | 02fbb3a41736c4fcb962f60c7992c5370050ac26 (patch) | |
tree | 73379f4fc72711bbff33c8bf0fa730c70bcb359d | |
parent | 9c8d32d1c2a7009b22b96bca95b8adf589e8c63d (diff) | |
download | Hyprland-02fbb3a41736c4fcb962f60c7992c5370050ac26.tar.gz Hyprland-02fbb3a41736c4fcb962f60c7992c5370050ac26.zip |
fix preferred modev0.9.1beta
-rw-r--r-- | src/render/Renderer.cpp | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index e46775da..980d2a95 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -866,11 +866,37 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR if (!PREFERREDMODE) { Debug::log(ERR, "Monitor %s has NO PREFERRED MODE", (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate); - return true; - } - // Preferred is valid - wlr_output_set_mode(pMonitor->output, PREFERREDMODE); + if (!wl_list_empty(&pMonitor->output->modes)) { + wlr_output_mode* mode; + + wl_list_for_each(mode, &pMonitor->output->modes, link) { + wlr_output_set_mode(pMonitor->output, mode); + + if (!wlr_output_test(pMonitor->output)) { + Debug::log(LOG, "Monitor %s: REJECTED available mode: %ix%i@%2f!", + pMonitor->output->name, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, + mode->width, mode->height, mode->refresh / 1000.f); + continue; + } + + Debug::log(LOG, "Monitor %s: requested %ix%i@%2f, found available mode: %ix%i@%imHz, applying.", + pMonitor->output->name, (int)pMonitorRule->resolution.x, (int)pMonitorRule->resolution.y, (float)pMonitorRule->refreshRate, + mode->width, mode->height, mode->refresh); + + pMonitor->refreshRate = mode->refresh / 1000.f; + pMonitor->vecSize = Vector2D(mode->width, mode->height); + + break; + } + } + } else { + // Preferred is valid + wlr_output_set_mode(pMonitor->output, PREFERREDMODE); + + pMonitor->vecSize = Vector2D(PREFERREDMODE->width, PREFERREDMODE->height); + pMonitor->refreshRate = PREFERREDMODE->refresh / 1000.f; + } } |