Don't reset the lastDeviceEventTime when doing DPMS actions
Peter Hutterer
peter.hutterer at who-t.net
Mon Aug 17 18:31:03 PDT 2009
On Mon, Aug 17, 2009 at 09:36:25AM +0100, Richard Hughes wrote:
> 2009/8/17 Peter Hutterer <peter.hutterer at who-t.net>:
> > On Fri, Aug 14, 2009 at 12:07:28PM +0100, Richard Hughes wrote:
> >> When we change the DPMS mode, don't play games with the last event
> >> time as this breaks applications using IDLETIME to turn the backlight
> >> off after a preset time.
> >>
> >> This patch fixes gnome-power-manager and xfce-power-manager.
> >> Previously gnome-power-manager was working around the idletime reset
> >> by setting a 1ms second timer and ignoring the first if there was a
> >> DPMS action in the last few ms. This was racey as hell, and it's
> >> probably best just to fix the X bug once and for all.
> >>
> >> The comment for TimeSinceLastInputEvent even says "Function used for
> >> screensaver purposes by the os module. Returns the time in
> >> milliseconds since there last was any input." so it's clearly for use
> >> for screensavers and power managers rather than "what's the last time
> >> of any action in the server".
> >>
> >> Patch attached. Please review.
> >
> > Tested, seems to work fine.
> > Pushed as c1d901d723c3bee523736eacc15b44a7dff484fe, thanks for the patch!
> > (btw. next time please send patches to xorg-devel at freedesktop.org)
>
> Will do, thanks. With the patch the explicit lastDeviceEventTime does
> not happen (good), although dixSaveScreens still resets this on DPMS
> change (not good). You can still see this if you using
> http://people.freedesktop.org/~hughsient/temp/idlecounter-demo.c and
> then do:
>
> sleep 10 && xset dpms force off && sleep 1 && xset dpms force on
>
> You'll see that the DPMS setting off /still/ resets the idletime.
>
> The attached patch removes the reset of lastDeviceEventTime when we do
> dixSaveScreens to turn on the screensaver, when the screen is turned
> off. I can now remove all the bodges working around X bugs with the
> previous and this patch added to Fedora 11.
>
> Please review,
>
> Richard.
> From 9c5fcee00d247c5bcf8a9af3a2e332ea4416f7e8 Mon Sep 17 00:00:00 2001
> From: Richard Hughes <richard at hughsie.com>
> Date: Mon, 17 Aug 2009 09:15:32 +0100
> Subject: [PATCH 2/2] Do not reset lastDeviceEventTime when we do dixSaveScreens
>
> When we turn off DPMS with DPMSModeOff and do dixSaveScreens, don't reset the
> event time else session clients using IDLETIME will be reset.
> ---
> dix/window.c | 2 --
> 1 files changed, 0 insertions(+), 2 deletions(-)
>
> diff --git a/dix/window.c b/dix/window.c
> index 32e26d9..1a645f6 100644
> --- a/dix/window.c
> +++ b/dix/window.c
> @@ -3128,8 +3128,6 @@ dixSaveScreens(ClientPtr client, int on, int mode)
>
> if (on == SCREEN_SAVER_FORCER)
> {
> - UpdateCurrentTimeIf();
> - lastDeviceEventTime = currentTime;
> if (mode == ScreenSaverReset)
> what = SCREEN_SAVER_OFF;
> else
> --
> 1.6.2.5
>
pushed as 6b5978dcf1f7ac3ecc2f22df06f7000f360e2066, thanks again for the
patches.
Cheers,
Peter
More information about the xorg-devel
mailing list