~mc-return/compiz/compiz.merge-src-screen.cpp-improvements

« back to all changes in this revision

Viewing changes to plugins/inotify/src/inotify.h

  • Committer: Dennis kasprzyk
  • Author(s): Dennis Kasprzyk
  • Date: 2009-03-15 05:09:18 UTC
  • Revision ID: git-v1:163f6b6f3c3b7764987cbdf8e03cc355edeaa499
New generalized build system.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2006 Novell, Inc.
 
3
 *
 
4
 * Permission to use, copy, modify, distribute, and sell this software
 
5
 * and its documentation for any purpose is hereby granted without
 
6
 * fee, provided that the above copyright notice appear in all copies
 
7
 * and that both that copyright notice and this permission notice
 
8
 * appear in supporting documentation, and that the name of
 
9
 * Novell, Inc. not be used in advertising or publicity pertaining to
 
10
 * distribution of the software without specific, written prior permission.
 
11
 * Novell, Inc. makes no representations about the suitability of this
 
12
 * software for any purpose. It is provided "as is" without express or
 
13
 * implied warranty.
 
14
 *
 
15
 * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 
16
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
 
17
 * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 
18
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
 
19
 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
 
20
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
 
21
 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
22
 *
 
23
 * Author: David Reveman <davidr@novell.com>
 
24
 */
 
25
 
 
26
#include <stdlib.h>
 
27
#include <unistd.h>
 
28
#include <poll.h>
 
29
#include <sys/inotify.h>
 
30
 
 
31
#include <core/core.h>
 
32
#include <core/privatehandler.h>
 
33
 
 
34
class InotifyScreen :
 
35
    public ScreenInterface,
 
36
    public PrivateHandler<InotifyScreen, CompScreen>
 
37
{
 
38
    public:
 
39
        InotifyScreen (CompScreen *screen);
 
40
        ~InotifyScreen ();
 
41
 
 
42
        void fileWatchAdded (CompFileWatch *fileWatch);
 
43
        void fileWatchRemoved (CompFileWatch *fileWatch);
 
44
 
 
45
    private:
 
46
        typedef struct {
 
47
            CompFileWatchHandle handle;
 
48
            int                 wd;
 
49
        } InotifyWatch;
 
50
        typedef std::list<InotifyWatch> WatchList;
 
51
 
 
52
        void         processEvents ();
 
53
 
 
54
        WatchList watches;
 
55
 
 
56
        int               fd;
 
57
        CompWatchFdHandle fdHandle;
 
58
};
 
59
 
 
60
class InotifyPluginVTable :
 
61
    public CompPlugin::VTableForScreen<InotifyScreen>
 
62
{
 
63
    public:
 
64
 
 
65
        bool init ();
 
66
};