~unity-team/compiz/plugins-main-trunk.fix_wrong_window_move_expo

« back to all changes in this revision

Viewing changes to winrules/src/winrules.h

  • Committer: David Barth
  • Date: 2011-03-29 16:36:40 UTC
  • Revision ID: david.barth@canonical.com-20110329163640-fpen5qsoo0lbjode
initial import from compiz-plugins-main_0.9.4git20110322.orig.tar.gz

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * winrules plugin for compiz
 
3
 *
 
4
 * Copyright (C) 2007 Bellegarde Cedric (gnumdk (at) gmail.com)
 
5
 * Copyright (C) 2009 Sam Spilsbury (smspillaz@gmail.com)
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or
 
8
 * modify it under the terms of the GNU General Public License
 
9
 * as published by the Free Software Foundation; either version 2
 
10
 * of the License, or (at your option) any later version.
 
11
 *
 
12
 * This program is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 * GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License
 
18
 * along with this program; if not, write to the
 
19
 * Free Software Foundation, Inc.,
 
20
 * 51 Franklin Street, Fifth Floor,
 
21
 * Boston, MA  02110-1301, USA.
 
22
 */
 
23
 
 
24
#include <core/core.h>
 
25
#include <core/pluginclasshandler.h>
 
26
#include <core/timer.h>
 
27
#include <core/atoms.h>
 
28
#include <X11/Xatom.h>
 
29
#include "winrules_options.h"
 
30
 
 
31
 
 
32
class WinrulesScreen :
 
33
    public PluginClassHandler <WinrulesScreen, CompScreen>,
 
34
    public WinrulesOptions,
 
35
    public ScreenInterface
 
36
{
 
37
    public:
 
38
 
 
39
        WinrulesScreen (CompScreen *screen);
 
40
 
 
41
        void
 
42
        handleEvent (XEvent *event);
 
43
 
 
44
        void
 
45
        matchExpHandlerChanged ();
 
46
 
 
47
        void
 
48
        matchPropertyChanged (CompWindow *w);
 
49
 
 
50
        void
 
51
        setProtocols (unsigned int protocols,
 
52
                      Window       id);
 
53
 
 
54
        void
 
55
        optionChanged (CompOption               *option,
 
56
                       WinrulesOptions::Options num);   
 
57
};
 
58
 
 
59
#define WINRULES_SCREEN(screen)                                        \
 
60
    WinrulesScreen *ws = WinrulesScreen::get(screen);
 
61
 
 
62
class WinrulesWindow :
 
63
    public PluginClassHandler <WinrulesWindow, CompWindow>,
 
64
    public WindowInterface
 
65
{
 
66
    public:
 
67
 
 
68
        WinrulesWindow (CompWindow *window);
 
69
 
 
70
        CompWindow *window;
 
71
 
 
72
        void
 
73
        getAllowedActions (unsigned int &,
 
74
                           unsigned int &);
 
75
 
 
76
        bool is ();
 
77
 
 
78
        void setNoFocus (int optNum);
 
79
 
 
80
        void setNoAlpha (int optNum);
 
81
 
 
82
        void
 
83
        updateState (int optNum,
 
84
                     int mask);
 
85
 
 
86
        void
 
87
        setAllowedActions (int        optNum,
 
88
                           int        action);
 
89
 
 
90
        bool
 
91
        matchSizeValue (CompOption::Value::Vector matches,
 
92
                        CompOption::Value::Vector widthValues,
 
93
                        CompOption::Value::Vector heightValues,
 
94
                        int                       *width,
 
95
                        int                       *height);
 
96
 
 
97
        bool
 
98
        matchSize (int        *width,
 
99
                   int        *height);
 
100
 
 
101
        void
 
102
        updateWindowSize (int        width,
 
103
                          int        height);
 
104
 
 
105
        bool applyRules ();
 
106
 
 
107
        bool alpha ();
 
108
        bool isFocussable ();
 
109
        bool focus ();
 
110
 
 
111
        unsigned int allowedActions;
 
112
        unsigned int stateSetMask;
 
113
        unsigned int protocolSetMask;
 
114
};
 
115
 
 
116
#define WINRULES_WINDOW(window)                                        \
 
117
    WinrulesWindow *ww = WinrulesWindow::get(window);
 
118
 
 
119
class WinrulesPluginVTable:
 
120
    public CompPlugin::VTableForScreenAndWindow <WinrulesScreen, WinrulesWindow>
 
121
{
 
122
    public:
 
123
 
 
124
        bool init ();
 
125
};