[compiz] Flat file backend (ini)

David Reveman davidr at novell.com
Fri Mar 2 04:36:30 PST 2007


On Tue, 2007-02-27 at 20:58 +0100, Gerd Kohlberger wrote:
> >> It is working fine but there are a couple of problems.
> >>
> >> 1. It looks like I should use addFileWatch rather than
> >> directly accessing FAM, is this correct?  I notice dbus
> >> uses addFileWatch rather than (*d->addFileWatch) is
> >> this intentional, and does it get wrapped in the same
> >> way?
> > 
> > Yep, you should use the file watch interface instead of FAM. You should
> > call addFileWatch to add a watch for a specific file or directory.
> > addFileWatch will then call display->fileWatchAdded which is a wrapped
> > function that plugins that provide file watch functionality like the
> > inotify function will hook into. If you have any problems with using the
> > file watch interface please let me know.
> > 
> 
> Hi,
> 
> I modified the inotify plugin to send an event structure instead of just
> the file name in the callback. The event contains an event mask to allow to
> switch between event types in the callback, and the file name.

hm, you're currently suppose to use different call-back functions for
this.

e.g. if you want to know the difference between move or delete do:

addFileWatch (d, path, NOTIFY_MOVE_MASK, fileMovedCallBackFunc, (void *) data);
addFileWatch (d, path, NOTIFY_DELETE_MASK, fileDeleteCallBackFunc, (void *) data);

instead of:

addFileWatch (d, path, NOTIFY_MOVE_MASK | NOTIFY_DELETE_MASK, fileRemovedCallBackFunc, (void *) data);

> 
> Currently the name variable in the callback sends the event->name of the inotify struct,
> but that's not very useful. eg. if you watch two files directly, there is no way to distinguish
> between them in the callback, because event->name will be empty.

if you want to watch two different files you should currently use two
different call-back functions. The name variable is intended for when
you're watching directories.

> 
> So the new CompNotifyEvent will send the watch path if a file is watched,
> or the relative filename if a directory is watched.
> 
> I think this can be very useful for the ini plugin and for other plugins as well.

I'm not sure we want to do these changes as unless I'm misunderstanding
something the current interface provides the same functionality. What
are the advantages of changing this way?

- David



More information about the compiz mailing list