Summary: | global dpms disabled on KDE startup | ||
---|---|---|---|
Product: | kcontrol | Reporter: | Olaf Hering <kde> |
Component: | kcmenergy | Assignee: | Geert Jansen <g.t.jansen> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: | /tmp/kdebase_dpms-3.1rc6.patch |
Description
Olaf Hering
2003-01-06 15:04:57 UTC
this patch seems to fix it: KDE_3_1_BRANCH/kdebase # cvs diff -pu kcontrol/energy/ cvsro server: Diffing kcontrol/energy Index: kcontrol/energy/energy.cpp =================================================================== RCS file: /home/kde/kdebase/kcontrol/energy/energy.cpp,v retrieving revision 1.18 diff -p -u -r1.18 energy.cpp --- kcontrol/energy/energy.cpp 1 Jul 2002 11:42:14 -0000 1.18 +++ kcontrol/energy/energy.cpp 6 Jan 2003 14:41:41 -0000 @@ -86,7 +86,7 @@ extern "C" { KConfig *cfg = new KConfig("kcmdisplayrc", true /*readonly*/, false /*no globals*/); cfg->setGroup("DisplayEnergy"); - bool enabled = cfg->readBoolEntry("displayEnergySaving", false); + bool enabled = cfg->readBoolEntry("displayEnergySaving", true); int standby = cfg->readNumEntry("displayStandby", DFLT_STANDBY); int suspend = cfg->readNumEntry("displaySuspend", DFLT_SUSPEND); int off = cfg->readNumEntry("displayPowerOff", DFLT_OFF); Created attachment 707 [details]
/tmp/kdebase_dpms-3.1rc6.patch
one way to do it, see attached patch.
The same is required for KEnergy::readSettings(), it does blindly provide bogus
defaults instead of using the already configured DPMS (from xset in .xinitrd or
XF86config).
It would be clever if the whole dpms panel is disabled if the X server has no
dpms extension or if the display cant do dpms.
should be fixed for 3.1
> startkde does DISABLE an already configured DPMS.
> /kdebase-3.1rc6/kcontrol/energy/energy.cpp seems to be the culprit.
Sure? Why should a control center module be run at KDE start? Just wondering...
Subject: kdebase/kcontrol/energy CVS commit by danimo: Patch to query the DPMS extension and figure out system defaults this way instead of dumbly relying on our own hardcoded defaults. Patch by Olaf Hering, fixes #52663 CCMAIL:52663-done@bugs.kde.org M +29 -5 energy.cpp 1.23 --- kdebase/kcontrol/energy/energy.cpp #1.22:1.23 @@ -60,4 +60,5 @@ extern "C" { Status DPMSEnable(Display *); Status DPMSDisable(Display *); + Bool DPMSGetTimeouts(Display *, CARD16 *, CARD16 *, CARD16 *); Bool DPMSSetTimeouts(Display *, CARD16, CARD16, CARD16); #if defined(XIMStringConversionRetrival) || defined (__sun) || defined(__hpux) @@ -84,8 +85,31 @@ extern "C" { cfg->setGroup("DisplayEnergy"); - bool enabled = cfg->readBoolEntry("displayEnergySaving", false); - int standby = cfg->readNumEntry("displayStandby", DFLT_STANDBY); - int suspend = cfg->readNumEntry("displaySuspend", DFLT_SUSPEND); - int off = cfg->readNumEntry("displayPowerOff", DFLT_OFF); + Display *dpy = qt_xdisplay(); + CARD16 pre_configured_status; + BOOL pre_configured_enabled; + CARD16 pre_configured_standby; + CARD16 pre_configured_suspend; + CARD16 pre_configured_off; + bool enabled; + CARD16 standby; + CARD16 suspend; + CARD16 off; + int dummy; + /* query the running X server if DPMS is supported */ + if (DPMSQueryExtension(dpy, &dummy, &dummy) && DPMSCapable(dpy)) { + DPMSGetTimeouts(dpy, &pre_configured_standby, &pre_configured_suspend, &pre_configured_off); + DPMSInfo(dpy, &pre_configured_status, &pre_configured_enabled); + /* let the user override the settings */ + enabled = cfg->readBoolEntry("displayEnergySaving", pre_configured_enabled); + standby = cfg->readNumEntry("displayStandby", pre_configured_standby); + suspend = cfg->readNumEntry("displaySuspend", pre_configured_suspend); + off = cfg->readNumEntry("displayPowerOff", pre_configured_off); + } else { + /* provide our defauts */ + enabled = true; + standby = DFLT_STANDBY; + suspend = DFLT_SUSPEND; + off = DFLT_OFF; + } delete cfg; |