~ubuntu-branches/ubuntu/saucy/xscreensaver/saucy

« back to all changes in this revision

Viewing changes to debian/patches/70_fade_oversleep.patch

  • Committer: Bazaar Package Importer
  • Author(s): Tormod Volden
  • Date: 2008-03-06 11:01:03 UTC
  • Revision ID: james.westby@ubuntu.com-20080306110103-3jm7pd3b316l8zqo
Tags: 5.04-4ubuntu1
* Merge from debian unstable, remaining changes: (LP: #201626)
  - debian/control: add Build-Depends on ubuntu-artwork
  - debian/rules: use /usr/share/backgrounds
  - 82_ubuntu-texturl-fridge.patch: use Ubuntu fridge for rss
  - 91_ubuntu-no-pam-conf: don't ship pam.conf
  - 70_ubuntu-xscreensaver-desktop.patch: name the xscreensaver desktop
    file for what it is to not confuse it with gnome-screensaver
  - debian/rules: don't hide the xscreensaver desktop icon if the
    user insists on installing xscreensaver (LP: #86416)
  - 54_drivers_demogtk.patch: Patching a compile failure with
    GTK+ in Hardy
  - 28_rotate.patch: Add in the gdk pixbuf function to rotate JPEGs and
    TIFFs so that they're the right direction
  - debian/control: Increasing the GTK+ version to 2.12 for the patch
    28_rotate.patch
  - glslideshow.desktop: Changing so that it shows only one image, one
    time and no extra black on the edges.
* Fixed upstream:
  - install xscreensaver-properties.desktop to right place (LP: #201481)
  - remove planetary-gears screensaver (LP: #196360)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Index: xscreensaver-5.04/utils/fade.c
 
2
===================================================================
 
3
--- xscreensaver-5.04.orig/utils/fade.c 2008-01-29 20:38:20.000000000 +0100
 
4
+++ xscreensaver-5.04/utils/fade.c      2008-01-29 20:39:23.000000000 +0100
 
5
@@ -157,6 +157,28 @@
 
6
 }
 
7
 
 
8
 
 
9
+static void
 
10
+sleep_from (struct timeval *now, struct timeval *then, long usecs_per_step)
 
11
+{
 
12
+  /* If several seconds have passed, the machine must have been asleep
 
13
+     or thrashing or something.  Don't sleep in that case, to avoid
 
14
+     overflowing and sleeping for an unconscionably long time.  This
 
15
+     function should only be sleeping for very short periods.
 
16
+   */
 
17
+  if (now->tv_sec - then->tv_sec < 5)
 
18
+    {
 
19
+      long diff = (((now->tv_sec - then->tv_sec) * 1000000) +
 
20
+                   now->tv_usec - then->tv_usec);
 
21
+      if (usecs_per_step > diff)
 
22
+        usleep (usecs_per_step - diff);
 
23
+    }
 
24
+
 
25
+  then->tv_sec  = now->tv_sec;
 
26
+  then->tv_usec = now->tv_usec;
 
27
+}
 
28
+
 
29
+
 
30
+
 
31
 /* The business with `cmaps_per_screen' is to fake out the SGI 8-bit video
 
32
    hardware, which is capable of installing multiple (4) colormaps
 
33
    simultaneously.  We have to install multiple copies of the same set of
 
34
@@ -329,14 +351,7 @@
 
35
 
 
36
       /* If we haven't already used up our alotted time, sleep to avoid
 
37
         changing the colormap too fast. */
 
38
-      {
 
39
-       long diff = (((now.tv_sec - then.tv_sec) * 1000000) +
 
40
-                    now.tv_usec - then.tv_usec);
 
41
-       then.tv_sec = now.tv_sec;
 
42
-       then.tv_usec = now.tv_usec;
 
43
-       if (usecs_per_step > diff)
 
44
-         usleep (usecs_per_step - diff);
 
45
-      }
 
46
+      sleep_from (&now, &then, usecs_per_step);
 
47
     }
 
48
 
 
49
  DONE:
 
50
@@ -530,14 +545,7 @@
 
51
 
 
52
          /* If we haven't already used up our alotted time, sleep to avoid
 
53
             changing the colormap too fast. */
 
54
-         {
 
55
-           long diff = (((now.tv_sec - then.tv_sec) * 1000000) +
 
56
-                        now.tv_usec - then.tv_usec);
 
57
-           then.tv_sec = now.tv_sec;
 
58
-           then.tv_usec = now.tv_usec;
 
59
-           if (usecs_per_step > diff)
 
60
-             usleep (usecs_per_step - diff);
 
61
-         }
 
62
+          sleep_from (&now, &then, usecs_per_step);
 
63
        }
 
64
     }
 
65
   
 
66
@@ -757,14 +765,7 @@
 
67
 
 
68
          /* If we haven't already used up our alotted time, sleep to avoid
 
69
             changing the colormap too fast. */
 
70
-         {
 
71
-           long diff = (((now.tv_sec - then.tv_sec) * 1000000) +
 
72
-                        now.tv_usec - then.tv_usec);
 
73
-           then.tv_sec = now.tv_sec;
 
74
-           then.tv_usec = now.tv_usec;
 
75
-           if (usecs_per_step > diff)
 
76
-             usleep (usecs_per_step - diff);
 
77
-         }
 
78
+          sleep_from (&now, &then, usecs_per_step);
 
79
        }
 
80
     }
 
81