kcontrol: drop inhibition feature of randr module

screen inhibition based on monitor name and lid button presence sounds like
someone wanted X11 DPMS (which is automatic nowdays) on his laptop to me

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-03-29 05:43:06 +02:00
parent 57d9753f70
commit 649c7b8876
2 changed files with 0 additions and 57 deletions

View file

@ -50,14 +50,11 @@ RandrMonitorModule::RandrMonitorModule( QObject* parent, const QList<QVariant>&
, have_randr( false )
, dialog(0)
{
m_inhibitionCookie = 0;
setModuleName( "randrmonitor" );
initRandr();
connect( Solid::PowerManagement::notifier(), SIGNAL(resumingFromSuspend()),
this, SLOT(resumedFromSuspend()) );
checkInhibition();
}
RandrMonitorModule::~RandrMonitorModule()
@ -118,9 +115,6 @@ void RandrMonitorModule::processX11Event( XEvent* e )
kDebug() << "Monitor change detected";
QStringList newMonitors = connectedMonitors();
//If we are already inhibiting and we should stop it, do it
checkInhibition();
if( newMonitors == currentMonitors ) {
kDebug() << "Same monitors";
return;
@ -211,54 +205,6 @@ QStringList RandrMonitorModule::activeMonitors() const
return ret;
}
void RandrMonitorModule::checkInhibition()
{
if (!have_randr) {
kDebug() << "Can't check inhibition, XRandR minor to 1.2 detected";
return;
}
if (!isLidPresent()) {
kDebug() << "This feature is only for laptop, and there is no Lid present";
return;
}
QStringList activeMonitorsList = activeMonitors();
kDebug() << "Active monitor list";
kDebug() << activeMonitorsList;
bool inhibit = false;
Q_FOREACH(const QString monitor, activeMonitorsList) {
//LVDS is the default type reported by most drivers, default is needed because the
//NVIDIA binary blob always report default as active monitor.
if (!monitor.contains("LVDS") && !monitor.contains("default") && !monitor.contains("eDP")) {
inhibit = true;
break;
}
}
if (m_inhibitionCookie > 0 && !inhibit) {
kDebug() << "Stopping: " << m_inhibitionCookie;
Solid::PowerManagement::stopSuppressingSleep(m_inhibitionCookie);
m_inhibitionCookie = 0;
} else if (m_inhibitionCookie < 0 && inhibit) { // If we are NOT inhibiting and we should, do it
m_inhibitionCookie = Solid::PowerManagement::beginSuppressingSleep();
kDebug() << "Inhibing: " << m_inhibitionCookie;
}
}
bool RandrMonitorModule::isLidPresent()
{
// get a list of all devices that are Buttons
foreach (Solid::Device device, Solid::Device::listFromType(Solid::DeviceInterface::Button, QString())) {
Solid::Button *button = device.as<Solid::Button>();
if (button->type() == Solid::Button::LidButton) {
return true;
}
}
return false;
}
void RandrMonitorModule::switchDisplay()
{
QList< RandROutput* > outputs;

View file

@ -50,7 +50,6 @@ private slots:
void poll();
void switchDisplay();
void resumedFromSuspend();
void checkInhibition();
void showKcm();
void tryAutoConfig();
@ -63,11 +62,9 @@ private:
QList< RandROutput* > activeOutputs( RandRDisplay &display );
QList< RandROutput* > validCrtcOutputs( RandRDisplay &display );
QList< RandROutput* > outputs( RandRDisplay &display, bool connected = false, bool active = false, bool validCrtc = false );
bool isLidPresent();
bool have_randr;
int randr_base;
int randr_error;
uint m_inhibitionCookie;
Window window;
QStringList currentMonitors;
RandrMonitorHelper* helper;