[drm] Re-enable Output on input event

If an Output went into DPMS standby we need to re-enable the Output
once we get any input event.

For this we connect to the signals of InputRedirection once we go
to standby. Once we enable again, we disconnect (to not handle the
events all the time), blank the screen (initial modesetting) and
trigger a complete repaint.
icc-effect-5.14.5
Martin Gräßlin 2015-08-31 09:03:31 +02:00
parent 6281cf84b4
commit e3ff85d4d9
2 changed files with 22 additions and 0 deletions

View File

@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "drm_backend.h"
#include "composite.h"
#include "cursor.h"
#include "input.h"
#include "logging.h"
#include "logind.h"
#include "scene_qpainter_drm_backend.h"
@ -895,6 +896,26 @@ void DrmOutput::setDpms(DrmOutput::DpmsMode mode)
return;
}
m_dpmsMode = mode;
if (m_dpmsMode != DpmsMode::On) {
connect(input(), &InputRedirection::globalPointerChanged, this, &DrmOutput::reenableDpms);
connect(input(), &InputRedirection::pointerButtonStateChanged, this, &DrmOutput::reenableDpms);
connect(input(), &InputRedirection::pointerAxisChanged, this, &DrmOutput::reenableDpms);
connect(input(), &InputRedirection::keyStateChanged, this, &DrmOutput::reenableDpms);
} else {
disconnect(input(), &InputRedirection::globalPointerChanged, this, &DrmOutput::reenableDpms);
disconnect(input(), &InputRedirection::pointerButtonStateChanged, this, &DrmOutput::reenableDpms);
disconnect(input(), &InputRedirection::pointerAxisChanged, this, &DrmOutput::reenableDpms);
disconnect(input(), &InputRedirection::keyStateChanged, this, &DrmOutput::reenableDpms);
blank();
if (Compositor *compositor = Compositor::self()) {
compositor->addRepaintFull();
}
}
}
void DrmOutput::reenableDpms()
{
setDpms(DpmsMode::On);
}
QString DrmOutput::name() const

View File

@ -159,6 +159,7 @@ private:
void initEdid(drmModeConnector *connector);
void initDpms(drmModeConnector *connector);
bool isCurrentMode(const drmModeModeInfo *mode) const;
void reenableDpms();
DrmBackend *m_backend;
QPoint m_globalPos;