Package: unclutter
Version: 8-3
Severity: normal
unclutter can't do subsecond idle times, something which I would find
very useful. This patch adds that.
--- unclutter.c.orig 2006-05-25 17:59:44.000000000 +0200
+++ unclutter-8/unclutter.c 2006-05-25 18:10:41.000000000 +0200
@@ -26,6 +26,8 @@
#include <stdio.h>
#include "vroot.h"
#include <string.h>
+#include <assert.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <regex.h>
@@ -56,6 +58,15 @@
-not or -notname)");
}
+static void dsleep(float t)
+{
+ struct timeval tv;
+ assert(t >= 0);
+ tv.tv_sec = (int) t;
+ tv.tv_usec = (t - tv.tv_sec) * 1000000;
+ select(0, NULL, NULL, NULL, &tv);
+}
+
#define ALMOSTEQUAL(a,b) (abs(a-b)<=jitter)
#define ANYBUTTON (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask)
@@ -147,8 +158,9 @@
main(argc,argv)char **argv;{
Display *display;
int screen,oldx = -99,oldy = -99,numscreens;
- int doroot = 0, jitter = 0, idletime = 5, usegrabmethod = 0, waitagain = 0,
- dovisible = 1, doevents = 1, onescreen = 0;
+ int doroot = 0, jitter = 0, usegrabmethod = 0, waitagain = 0,
+ dovisible = 1, doevents = 1, onescreen = 0;
+ float idletime = 5.0;
Cursor *cursor;
Window *realroot;
Window root;
@@ -160,7 +172,7 @@
if(strcmp(*argv,"-idle")==0){
argc--,argv++;
if(argc<0)usage();
- idletime = atoi(*argv);
+ idletime = atof(*argv);
}else if(strcmp(*argv,"-keystroke")==0){
idletime = -1;
}else if(strcmp(*argv,"-jitter")==0){
@@ -300,7 +312,7 @@
}
}
if(idletime>=0)
- sleep(idletime);
+ dsleep(idletime);
}
/* wait again next time */
if(waitagain)
@@ -322,7 +334,7 @@
}else{
/* go to sleep to prevent tight loops */
if(idletime>=0)
- sleep(idletime);
+ dsleep(idletime);
}
}else{
XSetWindowAttributes attributes;
-- System Information:
Debian Release: testing/unstable
APT prefers testing
APT policy: (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.8-2-686
Locale: LANG=C, LC_CTYPE=C (charmap=ISO-8859-1) (ignored: LC_ALL set to
en_GB.ISO-8859-1)
Versions of packages unclutter depends on:
ii libc6 2.3.6-7 GNU C Library: Shared libraries
ii libx11-6 6.9.0.dfsg.1-6 X Window System protocol client li
unclutter recommends no packages.
-- no debconf information
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]