2
* Copyright (C) 2011 Canonical Ltd
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Sam Spilsbury <sam.spilsbury@canonical.com>
20
#include <core/core.h>
21
#include <composite/composite.h>
22
#include <opengl/opengl.h>
24
#include <core/atoms.h>
26
#include "unitymtgrabhandles_options.h"
32
typedef std::pair <GLTexture::List, CompSize> TextureSize;
33
typedef std::pair <GLTexture::List *, CompRect *> TextureLayout;
41
GrabHandle (TextureSize *texture, Window owner, unsigned int id);
44
void handleButtonPress (XButtonEvent *ev);
45
void reposition (CompPoint *p, bool);
50
TextureLayout layout ();
56
TextureSize *mTexture;
60
class GrabHandleGroup :
61
public std::vector <Unity::MT::GrabHandle>
65
GrabHandleGroup (Window owner);
68
void relayout (const CompRect &, bool);
72
bool animate (unsigned int);
80
std::vector <TextureLayout> layout ();
98
class UnityMTGrabHandlesScreen :
99
public PluginClassHandler <UnityMTGrabHandlesScreen, CompScreen>,
100
public ScreenInterface,
101
public CompositeScreenInterface,
102
public GLScreenInterface,
103
public UnitymtgrabhandlesOptions
107
UnityMTGrabHandlesScreen (CompScreen *);
108
~UnityMTGrabHandlesScreen ();
110
CompositeScreen *cScreen;
115
void handleEvent (XEvent *);
117
bool showHandles (CompAction *action,
118
CompAction::State state,
119
CompOption::Vector &options);
121
void addHandles (Unity::MT::GrabHandleGroup *handles);
122
void removeHandles (Unity::MT::GrabHandleGroup *handles);
124
void addHandleWindow (Unity::MT::GrabHandle *, Window);
125
void removeHandleWindow (Window);
127
void preparePaint (int);
130
std::vector <Unity::MT::TextureSize> & textures () { return mHandleTextures; }
134
std::list <Unity::MT::GrabHandleGroup *> mGrabHandles;
135
std::vector <Unity::MT::TextureSize> mHandleTextures;
137
std::map <Window, Unity::MT::GrabHandle *> mInputHandles;
138
CompWindowVector mLastClientListStacking;
139
Atom mCompResizeWindowAtom;
144
#define UMTGH_SCREEN(screen) \
145
UnityMTGrabHandlesScreen *us = UnityMTGrabHandlesScreen::get (screen)
147
class UnityMTGrabHandlesWindow :
148
public PluginClassHandler <UnityMTGrabHandlesWindow, CompWindow>,
149
public WindowInterface,
150
public CompositeWindowInterface,
151
public GLWindowInterface
155
UnityMTGrabHandlesWindow (CompWindow *);
156
~UnityMTGrabHandlesWindow ();
159
CompositeWindow *cWindow;
164
void grabNotify (int, int, unsigned int, unsigned int);
165
void ungrabNotify ();
167
void relayout (const CompRect &, bool);
169
void getOutputExtents (CompWindowExtents &output);
171
void moveNotify (int dx, int dy, bool immediate);
173
bool glDraw (const GLMatrix &,
174
GLFragment::Attrib &,
180
void restackHandles ();
184
Unity::MT::GrabHandleGroup *mHandles;
187
#define UMTGH_WINDOW(window) \
188
UnityMTGrabHandlesWindow *uw = UnityMTGrabHandlesWindow::get (window)
190
class UnityMTGrabHandlesPluginVTable :
191
public CompPlugin::VTableForScreenAndWindow <UnityMTGrabHandlesScreen,
192
UnityMTGrabHandlesWindow>