[compiz] Flat file backend (ini)

Gerd Kohlberger lowfi at chello.at
Sun Mar 4 14:06:30 PST 2007


Mike Dransfield schrieb:
> David Reveman wrote:
>> On Fri, 2007-03-02 at 13:35 +0000, Mike Dransfield wrote:
>>  
>>> This seems roughly what I would need.  I applied your patches and added
>>> IN_MODIFY since I need that too.
>>>     
>>
>> Yes, we need a MODIFY bit.
>>   
> 
> I am attaching a patch for that
> 
> I have also changed the notification functions as you said.
> I now create a custom structure to pass through which contains
> all the information that I need.
> 
> There are 2 major problems though:
> 
> 1. If I add a delete and a notify function then the closure gets
> mixed up.  Everything works if I just add 1 but more than 1 and
> they seem to interact with each other.  I am creating the watches
> with different functions, I just pass the same closure (line 1031).
> 
> 2. The modify notification works, but only the first time.  With
> the current version I can modify a file once and I get the notification
> and the option reloads, but if I modify the file a second time then
> I get no notification.
> 

The IN_MODIFY bit isn't really useful for text files.

If you watch the event sequence which get emited by inotify you'll see something like:

1) MOVE compiz.conf -> compiz.conf~
2) MOVE compiz.conf~ -> compiz.conf
3) DELETE compiz.conf~

So if you watch compiz.conf directly and you open it in a text editor it gets moved.
After that inotify seems to loose track of that file and the kernel will send an IN_IGNORED event,
which automatically removes the watch. This is why modify only works the first time.

I think the best solution would be to watch only the ~/.compiz/options dir and put all files in
this directory. You could changed the filenames to something like <plugin>-<screen>.conf to represent
the different screens.

Also the inotify plugin should probably handle those kernel events (like IN_UNMOUNT), because if watches get automatically
removed by the kernel, it will confuse compiz internal list of watches. But i haven't really tested this, so might not be necessary.

Gerd.


More information about the compiz mailing list