diff -uNr -B -b WindowMaker-0.92.0/src/defaults.c WindowMaker-0.92.0-dnotify2/src/defaults.c --- WindowMaker-0.92.0/src/defaults.c 2005-04-08 07:59:16.000000000 -0300 +++ WindowMaker-0.92.0-dnotify2/src/defaults.c 2007-06-27 23:26:46.000000000 -0300 @@ -1348,8 +1348,6 @@ } #endif /* !LITE */ - if (!foo) - WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL, wDefaultsCheckDomains, foo); } diff -uNr -B -b WindowMaker-0.92.0/src/event.c WindowMaker-0.92.0-dnotify2/src/event.c --- WindowMaker-0.92.0/src/event.c 2005-03-12 21:13:55.000000000 -0300 +++ WindowMaker-0.92.0-dnotify2/src/event.c 2007-06-27 23:26:50.000000000 -0300 @@ -319,10 +319,20 @@ EventLoop() { XEvent event; + extern volatile int filesChanged; + extern void wDefaultsCheckDomains(); for(;;) { WMNextEvent(dpy, &event); WMHandleEvent(&event); + + /* If configuration files in defaults database have + changed we read them. */ + if (filesChanged){ + fprintf(stdout,"Rereading config files in defaults database...\n"); + wDefaultsCheckDomains(NULL); + filesChanged = 0; + } } } diff -uNr -B -b WindowMaker-0.92.0/src/main.c WindowMaker-0.92.0-dnotify2/src/main.c --- WindowMaker-0.92.0/src/main.c 2004-10-24 22:32:51.000000000 -0300 +++ WindowMaker-0.92.0-dnotify2/src/main.c 2007-06-27 23:26:56.000000000 -0300 @@ -19,6 +19,14 @@ * USA. */ +/* The notify code was copied from Documentation/dnotify.txt + * in the linux kernel. + */ + +#define _GNU_SOURCE /* needed to get the defines in glibc 2.2 */ +#include /* this has the needed values defined */ +#include + #include "wconfig.h" #include @@ -62,6 +70,7 @@ char *ProgName; unsigned int ValidModMask = 0xff; +volatile int filesChanged; /* locale to use. NULL==POSIX or C */ char *Locale=NULL; @@ -451,7 +460,6 @@ puts(_(" --create-stdcmap create the standard colormap hint in PseudoColor visuals")); puts(_(" --visual-id visualid visual id of visual to use")); puts(_(" --static do not update or save configurations")); - puts(_(" --no-polling do not periodically check for configuration updates")); #ifdef DEBUG puts(_(" --synchronous turn on synchronous display mode")); #endif @@ -490,10 +498,32 @@ } +/* This is the handler used to notify if configuration + * files have changed. + */ +void handler(int sig, siginfo_t *si, void *data) +{ + filesChanged = si->si_fd; +} + static void execInitScript() { - char *file, *paths; + char *file, *path, *paths; + struct sigaction act; + volatile int fd; + + path = wstrconcat(wusergnusteppath(), "/Defaults"); + + act.sa_sigaction = handler; + sigemptyset(&act.sa_mask); + act.sa_flags = SA_SIGINFO; + sigaction(SIGRTMIN + 1, &act, NULL); + + fd = open(path, O_RDONLY); + fcntl(fd, F_SETSIG, SIGRTMIN + 1); + fcntl(fd, F_NOTIFY, DN_MODIFY|DN_MULTISHOT); + wfree(path); paths = wstrconcat(wusergnusteppath(), "/Library/WindowMaker"); paths = wstrappend(paths, ":"DEF_CONFIG_PATHS); @@ -746,10 +776,6 @@ || strcmp(argv[i], "--static")==0) { wPreferences.flags.noupdates = 1; - } else if (strcmp(argv[i], "-nopolling")==0 - || strcmp(argv[i], "--no-polling")==0) { - - wPreferences.flags.nopolling = 1; #ifdef XSMP_ENABLED } else if (strcmp(argv[i], "-clientid")==0 || strcmp(argv[i], "-restore")==0) { diff -uNr -B -b WindowMaker-0.92.0/src/startup.c WindowMaker-0.92.0-dnotify2/src/startup.c --- WindowMaker-0.92.0/src/startup.c 2005-03-11 22:11:30.000000000 -0300 +++ WindowMaker-0.92.0-dnotify2/src/startup.c 2007-06-27 23:27:10.000000000 -0300 @@ -885,10 +885,6 @@ Exit(1); } - if (!wPreferences.flags.nopolling && !wPreferences.flags.noupdates) { - /* setup defaults file polling */ - WMAddTimerHandler(3000, wDefaultsCheckDomains, NULL); - } } diff -uNr -B -b WindowMaker-0.92.0/src/wconfig.h.in WindowMaker-0.92.0-dnotify2/src/wconfig.h.in --- WindowMaker-0.92.0/src/wconfig.h.in 2004-11-11 11:23:38.000000000 -0200 +++ WindowMaker-0.92.0-dnotify2/src/wconfig.h.in 2007-06-27 23:27:17.000000000 -0300 @@ -457,8 +457,6 @@ #define MAX_WINDOWLIST_WIDTH 160 /* max width of window title in * window list */ -#define DEFAULTS_CHECK_INTERVAL 2000 /* how often wmaker will check for - * changes in the config files */ /* if your keyboard don't have arrow keys */ #undef ARROWLESS_KBD diff -uNr -B -b WindowMaker-0.92.0/src/WindowMaker.h WindowMaker-0.92.0-dnotify2/src/WindowMaker.h --- WindowMaker-0.92.0/src/WindowMaker.h 2004-10-24 22:48:39.000000000 -0300 +++ WindowMaker-0.92.0-dnotify2/src/WindowMaker.h 2007-06-27 23:27:21.000000000 -0300 @@ -483,7 +483,6 @@ unsigned int noautolaunch:1; /* don't autolaunch apps */ unsigned int norestore:1; /* don't restore session */ unsigned int create_stdcmap:1; /* create std colormap */ - unsigned int nopolling:1; /* don't poll for defaults changes */ unsigned int restarting:2; } flags; /* internal flags */ } WPreferences;