1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 21:08:08 +01:00

Make inotify optional

This time keeping the ability to fall back to the old polling method.
This commit is contained in:
Tamas TEVESZ
2010-03-18 19:18:18 +01:00
committed by Carlos R. Mafra
parent 118a93808a
commit c7868fa405
10 changed files with 118 additions and 12 deletions

View File

@@ -134,6 +134,11 @@ extern Atom _XA_WM_IGNORE_FOCUS_EVENTS;
/* cursors */
extern Cursor wCursor[WCUR_LAST];
#ifndef HAVE_INOTIFY
/* special flags */
extern char WDelayedActionSet;
#endif
/***** Local *****/
static WScreen **wScreen = NULL;
@@ -187,6 +192,28 @@ static int handleXIO(Display * xio_dpy)
return 0;
}
#ifndef HAVE_INOTIFY
/*
*----------------------------------------------------------------------
* delayedAction-
* Action to be executed after the signal() handler is exited.
*----------------------------------------------------------------------
*/
static void delayedAction(void *cdata)
{
if (WDelayedActionSet == 0)
return;
WDelayedActionSet--;
/*
* Make the event dispatcher do whatever it needs to do,
* including handling zombie processes, restart and exit
* signals.
*/
DispatchEvent(NULL);
}
#endif
/*
*----------------------------------------------------------------------
* handleExitSig--
@@ -574,6 +601,11 @@ void StartUp(Bool defaultScreenOnly)
XFreePixmap(dpy, cur);
}
#ifndef HAVE_INOTIFY
/* signal handler stuff that gets called when a signal is caught */
WMAddPersistentTimerHandler(500, delayedAction, NULL);
#endif
/* emergency exit... */
sig_action.sa_handler = handleSig;
sigemptyset(&sig_action.sa_mask);
@@ -757,6 +789,13 @@ void StartUp(Bool defaultScreenOnly)
Exit(1);
}
#ifndef HAVE_INOTIFY
if (!wPreferences.flags.nopolling && !wPreferences.flags.noupdates) {
/* setup defaults file polling */
WMAddTimerHandler(3000, wDefaultsCheckDomains, NULL);
}
#endif
}
static Bool windowInList(Window window, Window * list, int count)