diff --git a/src/core/lockscreen.cpp b/src/core/lockscreen.cpp index 9fb6cde54..9390678d5 100644 --- a/src/core/lockscreen.cpp +++ b/src/core/lockscreen.cpp @@ -9,6 +9,7 @@ #include "utils/cmdline.h" #include "common/treelandlogging.h" #include "greeter/greeterproxy.h" +#include #ifdef EXT_SESSION_LOCK_V1 #include @@ -96,6 +97,26 @@ void LockScreen::addOutput(Output *output) Q_ASSERT(ok); #endif + connect(output->output(), &WOutput::enabledChanged, this, [this, output]() { + if (!output->output()->isEnabled() || !isLocked()) { + return; + } +#if EXT_SESSION_LOCK_V1 + auto outputItem = output->outputItem(); + if (outputItem) { + auto *lockSurface = m_lockSurfaces[outputItem].get(); + if (lockSurface) { + lockSurface->configureSize(outputItem->size().toSize()); + } + } +#endif + auto it = m_components.find(output); + if (it != m_components.end() && it->second) { + it->second->setSize(output->outputItem()->size()); + } + Helper::instance()->window()->update(); + }); + if (!m_impl) { return; } diff --git a/src/seat/helper.cpp b/src/seat/helper.cpp index 369aed990..121c53d1f 100644 --- a/src/seat/helper.cpp +++ b/src/seat/helper.cpp @@ -936,9 +936,23 @@ void Helper::onSetOutputPowerMode(wlr_output_power_v1_set_mode_event *event) if (output->handle()->enabled) { return; } + if (!output->handle()->current_mode) { + auto mode = output->preferred_mode(); + if (mode) { + newState.set_mode(mode); + } + } + auto outputObj = getOutput(WOutput::fromHandle(output)); + if (outputObj) { + newState.set_scale(outputObj->preferredScaleFactor(output->handle()->width > 0 + ? QSize(output->handle()->width, output->handle()->height) + : QSize())); + } newState.set_enabled(true); if (!output->commit_state(newState)) { qCCritical(lcTlCore, "commit failed on output %s", output->handle()->name); + } else { + output->schedule_frame(); } break; } @@ -2773,6 +2787,12 @@ void Helper::onPrepareForSleep(bool sleep) } else { qCInfo(lcTlCore) << "Re-enabled rendering after hibernate"; enableRender(); + for (auto o : std::as_const(m_outputList)) { + if (o && o->output() && o->output()->isEnabled()) { + o->output()->scheduleFrame(); + } + } + m_renderWindow->update(); } }