1 /*
  2  * Copyright �� 2007 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 #ifndef _COMPIZ_SCALE_H
 27 #define _COMPIZ_SCALE_H
 28 
 29 #include <core/pluginclasshandler.h>
 30 
 31 #include <composite/composite.h>
 32 #include <opengl/opengl.h>
 33 
 34 #define COMPIZ_SCALE_ABI 3
 35 
 36 class ScaleScreen;
 37 class PrivateScaleScreen;
 38 class ScaleWindow;
 39 class PrivateScaleWindow;
 40 
 41 class ScaleSlot :
 42     public CompRect
 43 {
 44     public:
CID 12587 - UNINIT_CTOR
Non-static class member "filled" is not initialized in this constructor nor in any functions that it calls.
Non-static class member "scale" is not initialized in this constructor nor in any functions that it calls.
 45 	ScaleSlot () {}
 46 	ScaleSlot (const CompRect &r) :
 47 	    CompRect (r) {}
 48     public:
CID 12587 - UNINIT_CTOR
Class member declaration for "filled".
 49 	bool  filled;
CID 12587 - UNINIT_CTOR
Class member declaration for "scale".
 50 	float scale;
 51 };
 52 
 53 class ScalePosition :
 54     public CompPoint
 55 {
 56     public:
 57 	float scale;
 58 };
 59 
 60 enum ScaleType {
 61     ScaleTypeNormal = 0,
 62     ScaleTypeOutput,
 63     ScaleTypeGroup,
 64     ScaleTypeAll
 65 };
 66 
 67 class ScaleScreenInterface :
 68     public WrapableInterface<ScaleScreen, ScaleScreenInterface>
 69 {
 70     public:
 71 	virtual bool layoutSlotsAndAssignWindows ();
 72 
 73 };
 74 
 75 extern template class PluginClassHandler<ScaleScreen, CompScreen, COMPIZ_SCALE_ABI>;
 76 
 77 class ScaleScreen :
 78     public WrapableHandler<ScaleScreenInterface, 1>,
 79     public PluginClassHandler<ScaleScreen, CompScreen, COMPIZ_SCALE_ABI>,
 80     public CompOption::Class
 81 {
 82     public:
 83 	typedef enum {
 84 	    Idle,
 85 	    Out,
 86 	    Wait,
 87 	    In
 88 	} State;
 89 
 90 	typedef std::list<ScaleWindow *> WindowList;
 91 	ScaleScreen (CompScreen *s);
 92 	~ScaleScreen ();
 93 
 94 	bool hasGrab () const;
 95 	State getState () const;
 96 	ScaleType getType () const;
 97 
 98 	const Window & getHoveredWindow () const;
 99 	const Window & getSelectedWindow () const;
100 
101 	const CompMatch & getCustomMatch () const;
102 	const WindowList& getWindows () const;
103 	
104 
105 	void relayoutSlots (const CompMatch& match);
106 
107 	CompOption::Vector & getOptions ();
108         bool setOption (const CompString &name, CompOption::Value &value);
109 
110 	WRAPABLE_HND (0, ScaleScreenInterface, bool,
111 		      layoutSlotsAndAssignWindows)
112 
113 	friend class ScaleWindow;
114 	friend class PrivateScaleScreen;
115 	friend class PrivateScaleWindow;
116 
117     private:
118 	PrivateScaleScreen *priv;
119 };
120 
121 class ScaleWindowInterface :
122     public WrapableInterface<ScaleWindow, ScaleWindowInterface>
123 {
124     public:
125 	virtual void scalePaintDecoration (const GLWindowPaintAttrib &,
126 					   const GLMatrix &,
127 					   const CompRegion &, unsigned int);
128 	virtual bool setScaledPaintAttributes (GLWindowPaintAttrib &);
129 	virtual void scaleSelectWindow ();
130 };
131 
132 extern template class PluginClassHandler<ScaleWindow, CompWindow, COMPIZ_SCALE_ABI>;
133 
134 class ScaleWindow :
135     public WrapableHandler<ScaleWindowInterface, 3>,
136     public PluginClassHandler<ScaleWindow, CompWindow, COMPIZ_SCALE_ABI>
137 {
138     public:
139 	ScaleWindow (CompWindow *w);
140 	~ScaleWindow ();
141 	
142 	CompWindow	*window;
143 
144 	bool hasSlot () const;
145 
146 	/* Scaled window target position (slot) */
147 
148 	ScaleSlot getSlot () const;
149 	void setSlot (const ScaleSlot &);
150 
151 	/* Scaled window current position (animation) */
152 
153 	ScalePosition getCurrentPosition () const;
154 	void setCurrentPosition (const ScalePosition &);
155 
156 	WRAPABLE_HND (0, ScaleWindowInterface, void, scalePaintDecoration,
157 		      const GLWindowPaintAttrib &, const GLMatrix &,
158 		      const CompRegion &, unsigned int)
159 	WRAPABLE_HND (1, ScaleWindowInterface, bool, setScaledPaintAttributes,
160 		      GLWindowPaintAttrib &)
161 	WRAPABLE_HND (2, ScaleWindowInterface, void, scaleSelectWindow)
162 
163 	friend class ScaleScreen;
164 	friend class PrivateScaleScreen;
165 	friend class PrivateScaleWindow;
166 
167     private:
168 	PrivateScaleWindow *priv;
169 };
170 
171 #define SCALE_SCREEN(s) \
172     ScaleScreen *ss = ScaleScreen::get (s)
173 
174 #define SCALE_WINDOW(w) \
175     ScaleWindow *sw = ScaleWindow::get (w)
176 
177 #endif