Package: xscreensaver
Version: 5.11-1
Severity: normal
Tags: patch

When xscreensaver-command sends a command to the X server it will sleep
for one second up to ten times waiting for the response from
xscreensaver.  In my experience it will normally check for events before
the event has arrived and require a one second sleep, and generally
the one second delay doesn't matter.
For 2.6.35 on this system `echo mem > /sys/power/state` is taking 1.4 seconds
to complete.  The current acpi sleep.sh is calling xscreensaver-command
twice, once with --throttle and another with --lock (which has an extra
second delay), which is adding an extra three seconds to the suspend.
This patch will make most of two seconds go away by using a select
to process any responses as soon as they are received.
---
 driver/remote.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/driver/remote.c b/driver/remote.c
index 1e67c97..dba8171 100644
--- a/driver/remote.c
+++ b/driver/remote.c
@@ -380,7 +380,20 @@ xscreensaver_command_response (Display *dpy, Window window,
                                     &xscreensaver_command_event_p, 0)) &&
         sleep_count++ < 10)
     {
+#if defined(HAVE_SELECT)
+      struct timeval tv = {10, 0};
+      int fd=XConnectionNumber(dpy);
+      fd_set rset;
+      FD_ZERO(&rset);
+      FD_SET(fd, &rset);
+      if (select (fd+1, &rset, NULL, NULL, &tv) == 0)
+        {
+          /* timeout, no need to wait any more */
+          sleep_count += 10;
+        }
+#else
       sleep(1);
+#endif
     }
 
   if (!got_event)
-- 
1.7.1


-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.35 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash

Versions of packages xscreensaver depends on:
ii  libatk1.0-0                 1.30.0-1     The ATK accessibility toolkit
ii  libc6                       2.11.2-2     Embedded GNU C Library: Shared lib
ii  libcairo2                   1.8.10-4     The Cairo 2D vector graphics libra
ii  libfontconfig1              2.8.0-2.1    generic font configuration library
ii  libfreetype6                2.4.0-2      FreeType 2 font engine, shared lib
ii  libglade2-0                 1:2.6.4-1    library to load .glade files at ru
ii  libglib2.0-0                2.24.1-1     The GLib library of C routines
ii  libgtk2.0-0                 2.20.1-1     The GTK+ graphical user interface 
ii  libice6                     2:1.0.6-1    X11 Inter-Client Exchange library
ii  libpam0g                    1.1.1-3      Pluggable Authentication Modules l
ii  libpango1.0-0               1.28.1-1     Layout and rendering of internatio
ii  libsm6                      2:1.1.1-1    X11 Session Management library
ii  libx11-6                    2:1.3.3-3    X11 client-side library
ii  libxext6                    2:1.1.2-1    X11 miscellaneous extension librar
ii  libxinerama1                2:1.1-3      X11 Xinerama extension library
ii  libxml2                     2.7.7.dfsg-4 GNOME XML library
ii  libxmu6                     2:1.0.5-1    X11 miscellaneous utility library
ii  libxpm4                     1:3.5.8-1    X11 pixmap library
ii  libxrandr2                  2:1.3.0-3    X11 RandR extension library
ii  libxrender1                 1:0.9.6-1    X Rendering Extension client libra
ii  libxt6                      1:1.0.7-1    X11 toolkit intrinsics library
ii  libxxf86vm1                 1:1.1.0-2    X11 XFree86 video mode extension l
ii  xscreensaver-data           5.11-1       data files to be shared among scre

Versions of packages xscreensaver recommends:
ii  libjpeg-progs          8b-1              Programs for manipulating JPEG fil
ii  perl [perl5]           5.10.1-13         Larry Wall's Practical Extraction 
ii  wamerican [wordlist]   6-3               American English dictionary words 
ii  xli                    1.17.0+20061110-3 command line tool for viewing imag
ii  xloadimage             4.1-16.1          Graphics file viewer under X11

Versions of packages xscreensaver suggests:
pn  fortune                       <none>     (no description available)
ii  iceape-browser [www-browser]  2.0.6-1    Iceape Navigator (Internet browser
ii  iceweasel [www-browser]       3.5.10-1   Web browser based on Firefox
ii  konqueror [www-browser]       4:4.4.5-1  advanced file manager, web browser
pn  qcam | streamer               <none>     (no description available)
ii  w3m [www-browser]             0.5.2-7    WWW browsable pager with excellent
pn  xdaliclock                    <none>     (no description available)
pn  xfishtank                     <none>     (no description available)
pn  xscreensaver-gl               <none>     (no description available)

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to