summaryrefslogtreecommitdiff
path: root/src/decorator.h
blob: a3a3c76e1fb8530ee250a6169f5317eca692a483 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*
 *  Aquamarine the KDE window decorator
 *
 *  Copyright (c) 2006 Dennis Kasprzyk <onestone@beryl-project.org>
 *  Copyright (c) 2006 Volker Krause <vkrause@kde.org>
 *
 *  Uses code of:
 *      Emerald window decorator (www.beryl-project.org)
 *      gtk-window-decorator (www.freedesktop.org/wiki/Software/Compiz)
 *      KWin window manager (www.kde.org)
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

#ifndef AQUAMARINE_DECORATOR_H
#define AQUAMARINE_DECORATOR_H

#ifdef HAVE_CONFIG_H
#  include "../config.h"
#endif

#include <kapplication.h>

#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/cursorfont.h>

#include <fixx11h.h>
#include <kconfig.h>
#include <kdecoration_plugins_p.h>
#include <kdecoration_p.h>

#include "window.h"
#include "defaultDeco.h"
#include "defaultShadow.h"
#include "KWinInterface.h"

#define C(name) { 0, XC_ ## name }

#define DECOR_INTERFACE_VERSION 20061011

struct _cursor
{
    Cursor cursor;
    unsigned int shape;
};

class KConfig;
class KWinModule;



static const long defaultMask = StructureNotifyMask | PropertyChangeMask;

namespace Aquamarine
{

    class Options;
    class Switcher;

    class PluginManager:public KDecorationPlugins
    {
      public:
        PluginManager (KConfig * config);
        virtual bool provides (Requirement)
        {
            return false;
        }
    };


    class Decorator:public KApplication, public KWinInterface
    {
      Q_OBJECT public:
        Decorator (Display * dpy, Qt::HANDLE visual = 0, Qt::HANDLE colormap =
                   0);
        ~Decorator ();

        bool isReady ()
        {
            return ready;
        }
        bool x11EventFilter (XEvent *);

        static PluginManager *pluginManager ()
        {
            return m_plugins;
        }
        static Aquamarine::Options * options ()
        {
            return m_options;
        }

        static void sendClientMessage (WId w, Atom a, Atom protocol,
                                       long data1 = 0, long data2 =
                                       0, long data3 = 0);

        static int onViewport (QPoint pos);
        static QSize viewports ();
        static void moveToViewport (WId id, int vp);

        bool restart () const
        {
            return m_restart;
        }

      public slots:
        void reconfigure ();

      signals:
        void desktopGeometryChanged();

      private:
        WId fetchFrame (WId window);
        void updateDesktopGeometry ();

      private slots:
        void slotWindowAdded (WId id);
        void slotWindowRemoved (WId id);
        void slotActiveWindowChanged (WId id);
        void slotWindowChanged (WId id, const unsigned long *properties);
		void slotSettingsChanged (int category);

      private:

        bool ready;

        Aquamarine::DefaultDecoration * m_defDeco;
        Aquamarine::DefaultDecoration * m_defDecoActive;
		Aquamarine::DefaultShadow * m_defShadow;

        QMap < WId, Aquamarine::Window * >m_windows;
        QMap < WId, Aquamarine::Window * >m_frames;
        Aquamarine::Window * m_activeWindow;

        KConfig *m_config;

        static PluginManager *m_plugins;
        static Aquamarine::Options * m_options;

        KWinModule *m_kwinmodule;

        Switcher *m_switcher;

        static QSize m_desktop;
        static QPoint m_viewport;
        static QSize m_rootSize;

        WId m_activeWM;
        bool m_restart;

    };

}

#endif