~vanvugt/compiz-plugins-main/fix-915236

« back to all changes in this revision

Viewing changes to mousepoll/src/private.h

  • Committer: Sam Spilsbury
  • Date: 2011-08-04 16:31:54 UTC
  • Revision ID: sam.spilsbury@canonical.com-20110804163154-ys9vvppcvh3k8ay7
Sync in changes from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *
 
3
 * Compiz mouse position polling plugin
 
4
 *
 
5
 * mousepoll.c
 
6
 *
 
7
 * Copyright : (C) 2008 by Dennis Kasprzyk
 
8
 * E-mail    : onestone@opencompositing.org
 
9
 *
 
10
 *
 
11
 * This program is free software; you can redistribute it and/or
 
12
 * modify it under the terms of the GNU General Public License
 
13
 * as published by the Free Software Foundation; either version 2
 
14
 * of the License, or (at your option) any later version.
 
15
 *
 
16
 * This program is distributed in the hope that it will be useful,
 
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
19
 * GNU General Public License for more details.
 
20
 *
 
21
 */
 
22
 
 
23
#include <core/core.h>
 
24
#include <core/pluginclasshandler.h>
 
25
#include <core/timer.h>
 
26
 
 
27
#include <mousepoll/mousepoll.h>
 
28
 
 
29
#include "mousepoll_options.h"
 
30
 
 
31
typedef enum _MousepollOptions
 
32
{
 
33
    MP_DISPLAY_OPTION_MOUSE_POLL_INTERVAL,
 
34
    MP_DISPLAY_OPTION_NUM
 
35
} MousepollDisplayOptions;
 
36
 
 
37
#define MP_OPTION_MOUSE_POLL_INTERVAL 0
 
38
#define MP_OPTION_NUM 1
 
39
 
 
40
class MousepollScreen :
 
41
    public PluginClassHandler <MousepollScreen, CompScreen, COMPIZ_MOUSEPOLL_ABI>,
 
42
    public MousepollOptions
 
43
{
 
44
    public:
 
45
 
 
46
        MousepollScreen (CompScreen *screen);
 
47
 
 
48
        std::list<MousePoller *> pollers;
 
49
        CompTimer                timer;
 
50
 
 
51
        CompPoint pos;
 
52
 
 
53
        bool
 
54
        updatePosition ();
 
55
 
 
56
        bool
 
57
        getMousePosition ();
 
58
 
 
59
        bool
 
60
        addTimer (MousePoller *poller);
 
61
 
 
62
        void
 
63
        removeTimer (MousePoller *poller);
 
64
 
 
65
        void updateTimer ();
 
66
};
 
67
 
 
68
#define MOUSEPOLL_SCREEN(s)                                             \
 
69
    MousepollScreen *ms = MousepollScreen::get (s)
 
70
 
 
71
#define NUM_OPTIONS(s) (sizeof ((s)->opt) / sizeof (CompOption))
 
72
 
 
73
class MousepollPluginVTable :
 
74
    public CompPlugin::VTableForScreen<MousepollScreen>
 
75
{
 
76
    public:
 
77
 
 
78
        bool init ();
 
79
        void fini ();
 
80
};
 
81