aboutsummaryrefslogblamecommitdiff
path: root/misc/xosd/files/extra-patch-msec-timeout
blob: 762a73b60b3f74b24a43bb4145b0789153174603 (plain) (tree)
1
2

                

















                                                                         

                        




















                                                              

                   








                                      

                   








                                                                                                     

                                








                                                  
--- a/src/xosd.h
+++ b/src/xosd.h
@@ -64,7 +64,7 @@ extern "C"
  *     font           X Logical Font Descriptor, see "xfontsel".
  *     colour         X colour, see "rgb.txt" that comes with your X11
  *                    distribution.
- *     timeout        Seconds before the display is hidden (-1 for
+ *     timeout        Milliseconds before the display is hidden (-1 for
  *                    never).
  *     pos            Position to write text (top or bottom).
  *     offset         Number of pixels between the "pos" and the
@@ -286,7 +286,7 @@ extern "C"
  *
  * ARGUMENTS
  *     osd      The xosd "object".
- *     timeout  The number of seconds before the display is hidden.
+ *     timeout  The number of milliseconds before the display is hidden.
  *
  * RETURNS
  *   0 on success
--- a/src/libxosd/xosd.c
+++ b/src/libxosd/xosd.c
@@ -402,15 +402,13 @@ event_loop(void *osdv)
     }
     /* Calculate timeout delta or hide display. */
     if (timerisset(&osd->timeout_start)) {
+      struct timeval timo;
+      timo.tv_sec = osd->timeout / 1000,
+      timo.tv_usec = (osd->timeout % 1000) * 1000,
       gettimeofday(&tv, NULL);
-      tv.tv_sec -= osd->timeout;
+      timersub(&tv, &timo, &tv);
       if (timercmp(&tv, &osd->timeout_start, <)) {
-        tv.tv_sec = osd->timeout_start.tv_sec - tv.tv_sec;
-        tv.tv_usec = osd->timeout_start.tv_usec - tv.tv_usec;
-        if (tv.tv_usec < 0) {
-          tv.tv_usec += 1000000;
-          tv.tv_sec -= 1;
-        }
+        timersub(&osd->timeout_start, &tv, &tv);
         tvp = &tv;
       } else {
         timerclear(&osd->timeout_start);
--- a/src/osd_cat.c
+++ b/src/osd_cat.c
@@ -53,7 +53,7 @@ int percentage = 50;
 int outline_offset = 0;
 char *outline_colour = NULL;
 char *shadow_colour = NULL;
-int delay = 5;
+int delay = 5000;
 int forcewait = 0;
 xosd_pos pos = XOSD_top;
 int voffset = 0;
--- a/man/osd_cat.1
+++ b/man/osd_cat.1
@@ -37,7 +37,7 @@ This option specifies the \fIFONT\fP to 
 This option specifies the \fICOLOR\fP to be used for displaying the text. The default is \fBred\fP. 
 .TP
 \fB\-d\fP, \fB\-\-delay\fP=\fITIME\fP
-This option specifies the number of seconds the text is displayed. The default is \fB5\fP seconds.
+This option specifies the number of milliseconds the text is displayed. The default is \fB5000\fP.
 .TP
 \fB\-l\fP, \fB\-\-lines\fP=\fILINES\fP
 This option specifies the number of \fILINES\fP to scroll the display over. The default is \fB5\fP.
--- a/src/xmms_plugin/xmms_osd.c
+++ b/src/xmms_plugin/xmms_osd.c
@@ -260,7 +260,7 @@ apply_config(void)
       DEBUG("invalid font %s", font);
 
     xosd_set_colour(osd, colour);
-    xosd_set_timeout(osd, timeout);
+    xosd_set_timeout(osd, timeout * 1000);
     xosd_set_shadow_offset(osd, shadow_offset);
     xosd_set_outline_offset(osd, outline_offset);
     xosd_set_pos(osd, pos);