diff -uBbr WindowMaker-0.92.0/configure WindowMaker-0.92.0-m3/configure --- WindowMaker-0.92.0/configure 2005-06-19 00:23:02.000000000 -0300 +++ WindowMaker-0.92.0-m3/configure 2007-06-17 12:11:29.000000000 -0300 @@ -1713,7 +1713,7 @@ PACKAGE=WindowMaker -VERSION=0.92.0 +VERSION=0.92.0-m1 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 Only in WindowMaker-0.92.0-m3/: patch_wmaker-0.92.0-m2 diff -uBbr WindowMaker-0.92.0/src/defaults.c WindowMaker-0.92.0-m3/src/defaults.c --- WindowMaker-0.92.0/src/defaults.c 2005-04-08 07:59:16.000000000 -0300 +++ WindowMaker-0.92.0-m3/src/defaults.c 2007-06-17 12:11:29.000000000 -0300 @@ -1207,8 +1207,7 @@ -void -wDefaultsCheckDomains(void *foo) +void wDefaultsCheckDomains(void *foo) { WScreen *scr; struct stat stbuf; @@ -1216,6 +1215,10 @@ WMPropList *dict; int i; +#ifdef DEBUG + fprintf(stdout,"I executed wDefaultsCheckDomains.\n"); +#endif + #ifdef HEARTBEAT puts("Checking domains..."); #endif @@ -1347,9 +1350,6 @@ WDRootMenu->timestamp = stbuf.st_mtime; } #endif /* !LITE */ - - if (!foo) - WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL, wDefaultsCheckDomains, foo); } diff -uBbr WindowMaker-0.92.0/src/event.c WindowMaker-0.92.0-m3/src/event.c --- WindowMaker-0.92.0/src/event.c 2005-03-12 21:13:55.000000000 -0300 +++ WindowMaker-0.92.0-m3/src/event.c 2007-06-17 12:11:29.000000000 -0300 @@ -319,10 +319,19 @@ EventLoop() { XEvent event; + extern volatile int filesChanged; + extern void wDefaultsCheckDomains(); for(;;) { WMNextEvent(dpy, &event); WMHandleEvent(&event); + + /* If configuration files have changed we read them. */ + if (filesChanged){ + fprintf(stdout,"arquivos mudaram\n"); + wDefaultsCheckDomains(NULL); + filesChanged = 0; + } } } diff -uBbr WindowMaker-0.92.0/src/main.c WindowMaker-0.92.0-m3/src/main.c --- WindowMaker-0.92.0/src/main.c 2004-10-24 22:32:51.000000000 -0300 +++ WindowMaker-0.92.0-m3/src/main.c 2007-06-17 12:16:51.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 @@ -63,6 +71,8 @@ unsigned int ValidModMask = 0xff; +volatile int filesChanged; + /* locale to use. NULL==POSIX or C */ char *Locale=NULL; @@ -451,7 +461,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 +499,33 @@ } +/* 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); Only in WindowMaker-0.92.0-m3/src: main.c~ diff -uBbr WindowMaker-0.92.0/src/startup.c WindowMaker-0.92.0-m3/src/startup.c --- WindowMaker-0.92.0/src/startup.c 2005-03-11 22:11:30.000000000 -0300 +++ WindowMaker-0.92.0-m3/src/startup.c 2007-06-17 12:11:29.000000000 -0300 @@ -695,7 +695,12 @@ } /* signal handler stuff that gets called when a signal is caught */ + /* This is the responsable for the wakeups shown in powertop. + * I am not sure it can be simply removed, but it appears so (my + * laptop hasn't exploded up to now) - Mafra + * WMAddPersistentTimerHandler(500, delayedAction, NULL); + */ /* emergency exit... */ sig_action.sa_handler = handleSig; @@ -885,10 +890,6 @@ Exit(1); } - if (!wPreferences.flags.nopolling && !wPreferences.flags.noupdates) { - /* setup defaults file polling */ - WMAddTimerHandler(3000, wDefaultsCheckDomains, NULL); - } } diff -uBbr WindowMaker-0.92.0/WINGs/handlers.c WindowMaker-0.92.0-m3/WINGs/handlers.c --- WindowMaker-0.92.0/WINGs/handlers.c 2004-10-28 06:29:56.000000000 -0300 +++ WindowMaker-0.92.0-m3/WINGs/handlers.c 2007-06-17 12:11:29.000000000 -0300 @@ -335,7 +335,8 @@ } - +// The last while is not being executed in my laptop, +// maybe we can remove it - Mafra void W_CheckTimerHandlers(void) { @@ -364,7 +365,8 @@ if (handler->nextDelay > 0) { handler->when = now; - addmillisecs(&handler->when, handler->nextDelay); + fprintf(stdout, "handler->nextDelay = %d \n", handler->nextDelay); + addmillisecs(&handler->when, 50*(handler->nextDelay)); enqueueTimerHandler(handler); } else { wfree(handler); diff -uBbr WindowMaker-0.92.0/WINGs/userdefaults.c WindowMaker-0.92.0-m3/WINGs/userdefaults.c --- WindowMaker-0.92.0/WINGs/userdefaults.c 2004-10-12 15:32:29.000000000 -0300 +++ WindowMaker-0.92.0-m3/WINGs/userdefaults.c 2007-06-17 12:11:29.000000000 -0300 @@ -45,7 +45,6 @@ #define DEFAULTS_DIR "/Defaults" -#define UD_SYNC_INTERVAL 2000 @@ -122,8 +121,7 @@ } -static void -synchronizeUserDefaults(void *foo) +static void synchronizeUserDefaults(void *foo) { UserDefaults *database = sharedUserDefaults; @@ -135,26 +133,6 @@ } -static void -addSynchronizeTimerHandler(void) -{ - static Bool initialized = False; - - if (!initialized) { - WMAddPersistentTimerHandler(UD_SYNC_INTERVAL, synchronizeUserDefaults, - NULL); - initialized = True; - } -} - - -void -WMEnableUDPeriodicSynchronization(WMUserDefaults *database, Bool enable) -{ - database->dontSync = !enable; -} - - void WMSynchronizeUserDefaults(WMUserDefaults *database) { @@ -335,7 +313,6 @@ defaults->next = sharedUserDefaults; sharedUserDefaults = defaults; - addSynchronizeTimerHandler(); registerSaveOnExit(); return defaults; @@ -412,7 +389,6 @@ defaults->next = sharedUserDefaults; sharedUserDefaults = defaults; - addSynchronizeTimerHandler(); registerSaveOnExit(); return defaults; diff -uBbr WindowMaker-0.92.0/WINGs/wevent.c WindowMaker-0.92.0-m3/WINGs/wevent.c --- WindowMaker-0.92.0/WINGs/wevent.c 2004-10-27 20:05:55.000000000 -0300 +++ WindowMaker-0.92.0-m3/WINGs/wevent.c 2007-06-17 12:11:29.000000000 -0300 @@ -376,7 +376,7 @@ * some timer handler expired). * * If waitForInput is False, it will just peek for available input and return - * without processing. Return vaue will be True if input is available. + * without processing. Return value will be True if input is available. * * If waitForInput is True, it will wait until an input event arrives on the * registered input handlers and ConnectionNumber(dpy), or will return when @@ -404,6 +404,7 @@ void WMNextEvent(Display *dpy, XEvent *event) { + /* Check any expired timers */ W_CheckTimerHandlers(); @@ -407,7 +408,9 @@ /* Check any expired timers */ W_CheckTimerHandlers(); + while (XPending(dpy) == 0) { + /* Do idle and timer stuff while there are no input or X events */ while (!waitForEvent(dpy, 0, False) && W_CheckIdleHandlers()) { /* dispatch timer events */