[compiz] Flat file backend (ini)

Gerd Kohlberger lowfi at chello.at
Sun Mar 4 13:47:02 PST 2007


David Reveman schrieb:
> 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?

Yes the functionality is already there, but with this patch it's just more convenient
to monitor more than just 2 or 3 files.
I modified inotify while playing around with the ini plugin and do doing it with the
current interface will get you lots of callback functions which isn't really necessary.

e.g if you listen for 3 different events in 5 files, you would need 15 callbacks in a plugin.

You don't have to include the patch, i just thought it might be useful, but it seems Mike has
already an ini version which works with the current interface.

Gerd.



More information about the compiz mailing list