You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
116 lines
4.1 KiB
116 lines
4.1 KiB
Description: Remove DPMS-related and screensaver-suspending-related code
|
|
lxqt-powermanagement added some code that allows the power manager to mess
|
|
with DPMS stuff. However it appears that DPMS is oftentimes not available in
|
|
Lubuntu, making lxqt-powermanagement crash over and over until it finally
|
|
gets disabled by LXQt until the next login. Some screensaver-related stuff
|
|
was also thrown in which seems unrelated but is in with a function that
|
|
sets DPMS timeouts. This patch removes all of that code, fixing the crashes.
|
|
Author: Aaron Rainbolt
|
|
Origin: ubuntu
|
|
Last-Update: 2024-06-26
|
|
---
|
|
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
|
|
|
|
--- lxqt-powermanagement-2.0.0.orig/CMakeLists.txt
|
|
+++ lxqt-powermanagement-2.0.0/CMakeLists.txt
|
|
@@ -29,7 +29,6 @@ find_package(KF6IdleTime ${KF6_MINIMUM_V
|
|
find_package(KF6Solid ${KF6_MINIMUM_VERSION} REQUIRED)
|
|
find_package(lxqt ${LXQT_MINIMUM_VERSION} REQUIRED)
|
|
find_package(lxqt-globalkeys-ui ${LXQT_GLOBALKEYS_MINIMUM_VERSION} REQUIRED)
|
|
-find_package(XCB REQUIRED COMPONENTS xcb-dpms xcb-screensaver)
|
|
|
|
message(STATUS "Building with Qt${Qt6Core_VERSION}")
|
|
|
|
--- lxqt-powermanagement-2.0.0.orig/src/idlenesswatcher.cpp
|
|
+++ lxqt-powermanagement-2.0.0/src/idlenesswatcher.cpp
|
|
@@ -35,8 +35,6 @@
|
|
#include <QDebug>
|
|
#include <LXQt/lxqtnotification.h>
|
|
#include <QObject>
|
|
-#include <xcb/dpms.h>
|
|
-#include <xcb/screensaver.h>
|
|
|
|
IdlenessWatcher::IdlenessWatcher(QObject* parent):
|
|
Watcher(parent)
|
|
@@ -70,47 +68,14 @@ IdlenessWatcher::IdlenessWatcher(QObject
|
|
|
|
connect(&mPSettings, &LXQt::Settings::settingsChanged, this, &IdlenessWatcher::onSettingsChanged);
|
|
|
|
- // retrieve DPMS timeouts
|
|
- mDpmsStandby = mDpmsSuspend = mDpmsOff = 0;
|
|
- if (QGuiApplication::platformName() == QStringLiteral("xcb")) {
|
|
- if (auto x11NativeInterface = qGuiApp->nativeInterface<QNativeInterface::QX11Application>()) {
|
|
- xcb_connection_t* c = x11NativeInterface->connection();
|
|
- xcb_dpms_get_timeouts_cookie_t cookie = xcb_dpms_get_timeouts(c);
|
|
- xcb_dpms_get_timeouts_reply_t* reply = xcb_dpms_get_timeouts_reply(c, cookie, nullptr);
|
|
- if (reply) {
|
|
- mDpmsStandby = reply->standby_timeout;
|
|
- mDpmsSuspend = reply->suspend_timeout;
|
|
- mDpmsOff = reply->off_timeout;
|
|
- free(reply);
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
setup();
|
|
}
|
|
|
|
IdlenessWatcher::~IdlenessWatcher()
|
|
{
|
|
- setDpmsTimeouts(true);
|
|
KIdleTime::instance()->removeAllIdleTimeouts();
|
|
}
|
|
|
|
-void IdlenessWatcher::setDpmsTimeouts(bool restore) {
|
|
- if (QGuiApplication::platformName() == QStringLiteral("xcb")) {
|
|
- if (auto x11NativeInterface = qGuiApp->nativeInterface<QNativeInterface::QX11Application>()) {
|
|
- xcb_connection_t* c = x11NativeInterface->connection();
|
|
- if (restore) {
|
|
- xcb_dpms_set_timeouts(c, mDpmsStandby, mDpmsSuspend, mDpmsOff);
|
|
- xcb_screensaver_suspend(c, 0); // WARNING: This is not documented but works.
|
|
- }
|
|
- else {
|
|
- xcb_dpms_set_timeouts(c, 0, 0, 0);
|
|
- xcb_screensaver_suspend(c, XCB_SCREENSAVER_SUSPEND);
|
|
- }
|
|
- }
|
|
- }
|
|
-}
|
|
-
|
|
void IdlenessWatcher::setup()
|
|
{
|
|
if(mPSettings.isIdlenessWatcherEnabled()) {
|
|
@@ -144,13 +109,6 @@ void IdlenessWatcher::setup()
|
|
milliseconds = 1000;
|
|
mIdleBacklightWatcher = KIdleTime::instance()->addIdleTimeout(milliseconds);
|
|
}
|
|
-
|
|
- // override DPMS settings
|
|
- setDpmsTimeouts(false);
|
|
- }
|
|
- else {
|
|
- // restore DPMS settings
|
|
- setDpmsTimeouts(true);
|
|
}
|
|
}
|
|
|
|
--- lxqt-powermanagement-2.0.0.orig/src/idlenesswatcher.h
|
|
+++ lxqt-powermanagement-2.0.0/src/idlenesswatcher.h
|
|
@@ -45,8 +45,6 @@ private Q_SLOTS:
|
|
void onSettingsChanged();
|
|
|
|
private:
|
|
- void setDpmsTimeouts(bool restore);
|
|
-
|
|
PowerManagementSettings mPSettings;
|
|
int mIdleACWatcher;
|
|
int mIdleBatteryWatcher;
|
|
@@ -54,7 +52,6 @@ private:
|
|
LXQt::Backlight *mBacklight;
|
|
int mBacklightActualValue;
|
|
bool mDischarging;
|
|
- quint16 mDpmsStandby, mDpmsSuspend, mDpmsOff;
|
|
};
|
|
|
|
#endif // IDLENESSWATCHER_H
|