Merge lp:~smspillaz/compiz-core/fix_894688 into lp:compiz-core/0.9.5
- fix_894688
- Merge into 0.9.5
Status: | Superseded | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~smspillaz/compiz-core/fix_894688 | ||||
Merge into: | lp:compiz-core/0.9.5 | ||||
Prerequisite: | lp:~smspillaz/compiz-core/fix_894685 | ||||
Diff against target: |
2208 lines (+1205/-424) 32 files modified
include/core/point.h (+0/-110) include/core/window.h (+2/-10) plugins/CMakeLists.txt (+2/-0) plugins/composite/src/privates.h (+3/-0) plugins/composite/src/window.cpp (+101/-58) plugins/decor/src/decor.cpp (+154/-119) plugins/decor/src/decor.h (+6/-0) plugins/opengl/src/privates.h (+1/-0) plugins/opengl/src/window.cpp (+18/-0) plugins/wobbly/src/wobbly.cpp (+4/-2) src/CMakeLists.txt (+10/-3) src/point.cpp (+0/-100) src/point/CMakeLists.txt (+67/-0) src/point/include/core/point.h (+110/-0) src/point/src/point.cpp (+100/-0) src/point/tests/CMakeLists.txt (+18/-0) src/point/tests/point/src/test-point.cpp (+71/-0) src/point/tests/test-point.cpp (+34/-0) src/point/tests/test-point.h (+43/-0) src/window.cpp (+24/-21) src/window/CMakeLists.txt (+1/-0) src/window/extents/CMakeLists.txt (+67/-0) src/window/extents/include/core/windowextents.h (+63/-0) src/window/extents/src/windowextents.cpp (+81/-0) src/window/extents/tests/CMakeLists.txt (+18/-0) src/window/extents/tests/shift/src/test-window-extents-shift.cpp (+91/-0) src/window/extents/tests/test-window-extents.cpp (+34/-0) src/window/extents/tests/test-window-extents.h (+42/-0) src/window/geometry-saver/CMakeLists.txt (+1/-0) src/window/geometry-saver/tests/CMakeLists.txt (+18/-0) src/window/geometry/CMakeLists.txt (+3/-1) src/window/geometry/tests/CMakeLists.txt (+18/-0) |
||||
To merge this branch: | bzr merge lp:~smspillaz/compiz-core/fix_894688 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Thomas Voß | Approve | ||
Tim Penhey (community) | Needs Fixing | ||
Thomi Richards (community) | Approve | ||
Review via email:
|
This proposal has been superseded by a proposal from 2012-01-13.
Commit message
Description of the change
Make the decor plugin work with paint offsets.
Moved getting the shift distance due to window gravity into a utility function in core and made it so that whenever a plugin tries to change the frame extents of a window, this will always update the saved co-ordinates of maximized windows so that they restore to the correct position if their frame extents change while they are maximized (eg, the unity case)
CompositeWindow
Fixed display matrices not being updated on override redirect windows - ::position never gets called for them, we must do it when the server updates the position.
Moved the geometry and geometry saver tests into a separate subdir
Next pipe: lp:~smspillaz/compiz-core/fix_891591
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Sam Spilsbury (smspillaz) wrote : | # |
- 2903. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 - 2904. By Sam Spilsbury
-
Fix typo
- 2905. By Sam Spilsbury
-
Added tests for compiz:
:window: :extents: :Extents - 2906. By Sam Spilsbury
-
Don't depend on core.h for CompRect
- 2907. By Sam Spilsbury
-
Added missing files
- 2908. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2909. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2910. By Sam Spilsbury
-
Merge
- 2911. By Sam Spilsbury
-
Fixed typo in the test-window-
geometry test that was causing it to fail - 2912. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2913. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2914. By Sam Spilsbury
-
Merge compiz-
core.fix_ 894633 - 2915. By Sam Spilsbury
-
Fix whitespace
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Thomi Richards (thomir-deactivatedaccount) wrote : | # |
ln 130 - is the change from 'geometry' to 'serverGeometry' intentional?
ln 214 - Why not write this as:
cScreen-
ln 980 - this obviously only works as long as both structures have exactly
the same contents and are laid out in exactly the same manner. I assume you have checked that this is the case?
As far as I can tell, this is looking good, with the few points mentioned above.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Sam Spilsbury (smspillaz) wrote : | # |
> ln 130 - is the change from 'geometry' to 'serverGeometry' intentional?
>
Yes, the serverGeometry is what is used to paint the window while we wait on the server to give us the new geometry for the window (which is always guarunteed to be the geometry last sent (eg serverGeometry) as we are the window manager).
> ln 214 - Why not write this as:
>
> cScreen-
fixed
>
> ln 980 - this obviously only works as long as both structures have exactly
> the same contents and are laid out in exactly the same manner. I assume you
> have checked that this is the case?
Yes, they are both CompWindowExtents. Perhaps I should make it so that you can't derive from that class though, I might ask Tim about that.
>
>
> As far as I can tell, this is looking good, with the few points mentioned
> above.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Sam Spilsbury (smspillaz) wrote : | # |
>> ln 214 - Why not write this as:
>>
>> cScreen-
> fixed
Actually, there's no operator+ defined in CompRect which returns a region, and I'm not really sure if I want to introduce a cyclic dependency like that. So I think the explicit conversion is better off for now.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Thomi Richards (thomir-deactivatedaccount) wrote : | # |
OK, I'm happy.
- 2916. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2917. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2918. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2919. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Tim Penhey (thumper) wrote : | # |
> (memcmp (&priv-
> memcmp (&priv->border, b, sizeof (CompWindowExte
Please write an operator == and not use memcmp. Even for simple structs.
Then implement operator != in terms of operator ==.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Daniel van Vugt (vanvugt) wrote : | # |
The main reason (other than stylistic and religious) for not using memcmp on structs is because structs are often not perfectly aligned and so contain padding bytes. The padding bytes are uninitialized, unpredictable and inaccessible unless you also guarantee each struct has first been memset(
In general, memcmp is highly optimized for the architecture and is in fact faster than a bespoke operator. However you can't use memcmp with structs unless you guarantee they're always fully initialized with memset to the full sizeof(yourstruct).
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Sam Spilsbury (smspillaz) wrote : | # |
On Thu, 15 Dec 2011, Daniel van Vugt wrote:
> The main reason (other than stylistic and religious) for not using memcmp on structs is because structs are often not perfectly aligned and so contain padding bytes. The padding bytes are uninitialized, unpredictable and inaccessible unless you also guarantee each struct has first been memset(
>
> In general, memcmp is highly optimized for the architecture and is in fact faster than a bespoke operator. However you can't use memcmp with structs unless you guarantee they're always fully initialized with memset to the full sizeof(yourstruct).
Thanks Daniel - I didn't know that, so I'll keep it in mind (and probably
just implement operator==)
> --
> https:/
> You are the owner of lp:~smspillaz/compiz-core/fix_894688.
>
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Daniel van Vugt (vanvugt) wrote : | # |
I made the same mistake myself...
http://
- 2920. By Sam Spilsbury
-
Merged previous pipe
- 2921. By Sam Spilsbury
-
Use operator== in windowextents
- 2922. By Sam Spilsbury
-
Merge
- 2923. By Sam Spilsbury
-
Merge
- 2924. By Sam Spilsbury
-
Moved compiz:
:window: :extents: :Extents and CompPoint to the new testing structure and Google Test - 2925. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2926. By Sam Spilsbury
-
Expose extents and point in the plugins list
- 2927. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2928. By Sam Spilsbury
-
Merge
- 2929. By Sam Spilsbury
-
Fix typo
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Thomas Voß (thomas-voss) wrote : | # |
Looks good to me.
- 2930. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2931. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2932. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2933. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2934. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2935. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2936. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2937. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2938. By Sam Spilsbury
-
Merge
Unmerged revisions
- 2938. By Sam Spilsbury
-
Merge
- 2937. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2936. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2935. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2934. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2933. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2932. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2931. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2930. By Sam Spilsbury
-
Merged compiz-
core.fix_ 894685 into compiz- core.fix_ 894688. - 2929. By Sam Spilsbury
-
Fix typo
Preview Diff
1 | === removed file 'include/core/point.h' |
2 | --- include/core/point.h 2010-03-24 09:37:19 +0000 |
3 | +++ include/core/point.h 1970-01-01 00:00:00 +0000 |
4 | @@ -1,110 +0,0 @@ |
5 | -/* |
6 | - * Copyright © 2008 Dennis Kasprzyk |
7 | - * |
8 | - * Permission to use, copy, modify, distribute, and sell this software |
9 | - * and its documentation for any purpose is hereby granted without |
10 | - * fee, provided that the above copyright notice appear in all copies |
11 | - * and that both that copyright notice and this permission notice |
12 | - * appear in supporting documentation, and that the name of |
13 | - * Dennis Kasprzyk not be used in advertising or publicity pertaining to |
14 | - * distribution of the software without specific, written prior permission. |
15 | - * Dennis Kasprzyk makes no representations about the suitability of this |
16 | - * software for any purpose. It is provided "as is" without express or |
17 | - * implied warranty. |
18 | - * |
19 | - * DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
20 | - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN |
21 | - * NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
22 | - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS |
23 | - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
24 | - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION |
25 | - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
26 | - * |
27 | - * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org> |
28 | - */ |
29 | - |
30 | -#ifndef _COMPPOINT_H |
31 | -#define _COMPPOINT_H |
32 | - |
33 | -#include <vector> |
34 | -#include <list> |
35 | - |
36 | -/** |
37 | - * A 2D coordinate (likely in screen space) that can only be mutated |
38 | - * through set() methods, since it's data members are private. |
39 | - */ |
40 | -class CompPoint { |
41 | - |
42 | - public: |
43 | - CompPoint (); |
44 | - CompPoint (int, int); |
45 | - |
46 | - /** |
47 | - * Get the x coordinate of this point |
48 | - */ |
49 | - int x () const; |
50 | - |
51 | - /** |
52 | - * Get the y coordinate of this point |
53 | - */ |
54 | - int y () const; |
55 | - |
56 | - /** |
57 | - * Set the x and y coordinate of this point |
58 | - */ |
59 | - void set (int, int); |
60 | - |
61 | - /** |
62 | - * Set the x coordinate of this point |
63 | - */ |
64 | - void setX (int); |
65 | - |
66 | - /** |
67 | - * Set the y coordinate of this point |
68 | - */ |
69 | - void setY (int); |
70 | - |
71 | - bool operator== (const CompPoint &) const; |
72 | - bool operator!= (const CompPoint &) const; |
73 | - |
74 | - /** |
75 | - * Takes from both co-ordinates |
76 | - */ |
77 | - CompPoint & operator-= (const CompPoint &); |
78 | - /** |
79 | - * Adds to both co-ordinates |
80 | - */ |
81 | - CompPoint & operator+= (const CompPoint &); |
82 | - |
83 | - /** |
84 | - * Retuns an added point |
85 | - */ |
86 | - CompPoint operator+ (const CompPoint &) const; |
87 | - /** |
88 | - * Returns a subtracted point |
89 | - */ |
90 | - CompPoint operator- (const CompPoint &) const; |
91 | - |
92 | - typedef std::vector<CompPoint> vector; |
93 | - typedef std::vector<CompPoint *> ptrVector; |
94 | - typedef std::list<CompPoint> list; |
95 | - typedef std::list<CompPoint *> ptrList; |
96 | - |
97 | - private: |
98 | - int mX, mY; |
99 | -}; |
100 | - |
101 | -inline int |
102 | -CompPoint::x () const |
103 | -{ |
104 | - return mX; |
105 | -} |
106 | - |
107 | -inline int |
108 | -CompPoint::y () const |
109 | -{ |
110 | - return mY; |
111 | -} |
112 | - |
113 | - |
114 | -#endif |
115 | |
116 | === modified file 'include/core/window.h' |
117 | --- include/core/window.h 2012-01-11 08:48:40 +0000 |
118 | +++ include/core/window.h 2012-01-11 08:48:40 +0000 |
119 | @@ -43,6 +43,7 @@ |
120 | #include <core/region.h> |
121 | #include <core/windowgeometry.h> |
122 | #include <core/windowgeometrysaver.h> |
123 | +#include <core/windowextents.h> |
124 | |
125 | #include <core/wrapsystem.h> |
126 | |
127 | @@ -197,16 +198,7 @@ |
128 | CompWindowNotifyBeforeMap |
129 | }; |
130 | |
131 | -/** |
132 | - * Specifies the left, right, top and bottom positions of a window's |
133 | - * geometry |
134 | - */ |
135 | -struct CompWindowExtents { |
136 | - int left; |
137 | - int right; |
138 | - int top; |
139 | - int bottom; |
140 | -}; |
141 | + |
142 | |
143 | /** |
144 | * Specifies the area of the screen taken up by strut windows |
145 | |
146 | === modified file 'plugins/CMakeLists.txt' |
147 | --- plugins/CMakeLists.txt 2012-01-11 08:48:40 +0000 |
148 | +++ plugins/CMakeLists.txt 2012-01-11 08:48:40 +0000 |
149 | @@ -17,6 +17,8 @@ |
150 | ${CMAKE_CURRENT_SOURCE_DIR}/../src/logmessage/include |
151 | ${CMAKE_CURRENT_SOURCE_DIR}/../src/window/geometry/include |
152 | ${CMAKE_CURRENT_SOURCE_DIR}/../src/window/geometry-saver/include |
153 | + ${CMAKE_CURRENT_SOURCE_DIR}/../src/window/extents/include |
154 | + ${CMAKE_CURRENT_SOURCE_DIR}/../src/point/include |
155 | ) |
156 | |
157 | compiz_add_plugins_in_folder (${CMAKE_CURRENT_SOURCE_DIR}) |
158 | |
159 | === modified file 'plugins/composite/src/privates.h' |
160 | --- plugins/composite/src/privates.h 2012-01-11 08:48:40 +0000 |
161 | +++ plugins/composite/src/privates.h 2012-01-11 08:48:40 +0000 |
162 | @@ -134,6 +134,9 @@ |
163 | int width, |
164 | int height); |
165 | |
166 | + void damageGeometrySets (const compiz::window::Geometry &ng, |
167 | + const compiz::window::Geometry &og); |
168 | + |
169 | public: |
170 | CompWindow *window; |
171 | CompositeWindow *cWindow; |
172 | |
173 | === modified file 'plugins/composite/src/window.cpp' |
174 | --- plugins/composite/src/window.cpp 2012-01-11 08:48:40 +0000 |
175 | +++ plugins/composite/src/window.cpp 2012-01-11 08:48:40 +0000 |
176 | @@ -273,20 +273,20 @@ |
177 | { |
178 | int x1, x2, y1, y2; |
179 | |
180 | - compiz::window::Geometry geom = priv->window->geometry (); |
181 | - CompWindowExtents output = priv->window->output (); |
182 | + const compiz::window::Geometry &geom = priv->window->serverGeometry (); |
183 | + const CompWindowExtents &output = priv->window->output (); |
184 | |
185 | /* top */ |
186 | x1 = -output.left - geom.border (); |
187 | y1 = -output.top - geom.border (); |
188 | - x2 = priv->window->size ().width () + output.right - geom.border (); |
189 | + x2 = geom.width () + output.right - geom.border (); |
190 | y2 = -geom.border (); |
191 | |
192 | if (x1 < x2 && y1 < y2) |
193 | addDamageRect (CompRect (x1, y1, x2 - x1, y2 - y1)); |
194 | |
195 | /* bottom */ |
196 | - y1 = priv->window->size ().height () - geom.border (); |
197 | + y1 = geom.height () - geom.border (); |
198 | y2 = y1 + output.bottom - geom.border (); |
199 | |
200 | if (x1 < x2 && y1 < y2) |
201 | @@ -296,13 +296,13 @@ |
202 | x1 = -output.left - geom.border (); |
203 | y1 = -geom.border (); |
204 | x2 = -geom.border (); |
205 | - y2 = priv->window->size ().height () - geom.border (); |
206 | + y2 = geom.height () - geom.border (); |
207 | |
208 | if (x1 < x2 && y1 < y2) |
209 | addDamageRect (CompRect (x1, y1, x2 - x1, y2 - y1)); |
210 | |
211 | /* right */ |
212 | - x1 = priv->window->size ().width () - geom.border (); |
213 | + x1 = geom.width () - geom.border (); |
214 | x2 = x1 + output.right - geom.border (); |
215 | |
216 | if (x1 < x2 && y1 < y2) |
217 | @@ -318,23 +318,11 @@ |
218 | |
219 | if (!damageRect (false, rect)) |
220 | { |
221 | - int x, y; |
222 | - CompRegion damage = CompRegion (); |
223 | - |
224 | - x = rect.x (); |
225 | - y = rect.y (); |
226 | - |
227 | - const compiz::window::Geometry &geom = priv->window->geometry (); |
228 | - |
229 | - x += geom.x () + geom.border (); |
230 | - y += geom.y () + geom.border (); |
231 | - |
232 | - /* Damage this region */ |
233 | - |
234 | - x += priv->offset.x (); |
235 | - y += priv->offset.y (); |
236 | - |
237 | - damage += CompRect (x, y, rect.width (), rect.height ()); |
238 | + CompRegion damage = CompRegion (rect); |
239 | + const compiz::window::Geometry &geom = priv->window->serverGeometry (); |
240 | + |
241 | + damage.translate (geom.x () + geom.border () + priv->offset.x (), |
242 | + geom.y () + geom.border () + priv->offset.y ()); |
243 | |
244 | priv->cScreen->damageRegion (damage); |
245 | } |
246 | @@ -355,10 +343,10 @@ |
247 | priv->window->input ().left) - border; |
248 | int y1 = -MAX (priv->window->output ().top, |
249 | priv->window->input ().top) - border; |
250 | - int x2 = priv->window->size ().width () + |
251 | + int x2 = priv->window->geometry ().width () + |
252 | MAX (priv->window->output ().right, |
253 | priv->window->input ().right) ; |
254 | - int y2 = priv->window->size ().height () + |
255 | + int y2 = priv->window->geometry ().height () + |
256 | MAX (priv->window->output ().bottom, |
257 | priv->window->input ().bottom) ; |
258 | CompRect r (x1, y1, x2 - x1, y2 - y1); |
259 | @@ -579,14 +567,46 @@ |
260 | window->windowNotify (n); |
261 | } |
262 | |
263 | +void |
264 | +PrivateCompositeWindow::damageGeometrySets (const compiz::window::Geometry &newGeometry, |
265 | + const compiz::window::Geometry &oldGeometry) |
266 | +{ |
267 | + CompRegion r (newGeometry); |
268 | + r += oldGeometry; |
269 | + |
270 | + cScreen->damageRegion (r); |
271 | +} |
272 | + |
273 | bool |
274 | PrivateCompositeWindow::position (compiz::window::Geometry &g, |
275 | unsigned int source, |
276 | unsigned int constrainment) |
277 | { |
278 | - cWindow->addDamage (); |
279 | cWindow->applyOffset (CompPoint (-offset.x (), -offset.y ())); |
280 | - cWindow->addDamage (); |
281 | + |
282 | + if (window->shaded () || window->isViewable ()) |
283 | + { |
284 | + const CompWindowExtents &output = window->output (); |
285 | + compiz::window::Geometry oldGeom = window->serverGeometry (); |
286 | + compiz::window::Geometry newGeom (g); |
287 | + |
288 | + /* Apply output offsets */ |
289 | + oldGeom.setLeft (oldGeom.left () - output.left); |
290 | + oldGeom.setRight (oldGeom.right () + output.right); |
291 | + oldGeom.setTop (oldGeom.top () - output.top); |
292 | + oldGeom.setBottom (oldGeom.bottom () + output.bottom); |
293 | + |
294 | + newGeom.setLeft (newGeom.left () - output.left); |
295 | + newGeom.setRight (newGeom.right () + output.right); |
296 | + newGeom.setTop (newGeom.top () - output.top); |
297 | + newGeom.setBottom (newGeom.bottom () + output.bottom); |
298 | + |
299 | + /* Translate by position offset */ |
300 | + oldGeom.setPos (oldGeom.pos () + cWindow->paintOffset ()); |
301 | + newGeom.setPos (newGeom.pos () + cWindow->paintOffset ()); |
302 | + |
303 | + damageGeometrySets (newGeom, oldGeom); |
304 | + } |
305 | |
306 | return window->position (g, source, constrainment); |
307 | } |
308 | @@ -599,21 +619,32 @@ |
309 | Pixmap pixmap = None; |
310 | CompSize size = CompSize (); |
311 | |
312 | - if (window->shaded () || (window->isViewable ())) |
313 | + if (window->overrideRedirect () && |
314 | + window->isViewable ()) |
315 | { |
316 | - int x, y, x1, x2, y1, y2; |
317 | - |
318 | - x = window->geometry ().x (); |
319 | - y = window->geometry ().y (); |
320 | - |
321 | - x1 = x - window->output ().left - dx; |
322 | - y1 = y - window->output ().top - dy; |
323 | - x2 = x + window->size ().width () + |
324 | - window->output ().right - dx - dwidth; |
325 | - y2 = y + window->size ().height () + |
326 | - window->output ().bottom - dy - dheight; |
327 | - |
328 | - cScreen->damageRegion (CompRegion (CompRect (x1, y1, x2 - x1, y2 - y1))); |
329 | + const CompWindowExtents &output = window->output (); |
330 | + compiz::window::Geometry oldGeom = window->serverGeometry (); |
331 | + |
332 | + /* Apply output offsets */ |
333 | + oldGeom.setLeft (oldGeom.left () - output.left); |
334 | + oldGeom.setRight (oldGeom.right () + output.right); |
335 | + oldGeom.setTop (oldGeom.top () - output.top); |
336 | + oldGeom.setBottom (oldGeom.bottom () + output.bottom); |
337 | + |
338 | + /* Translate by position offset */ |
339 | + oldGeom.setPos (oldGeom.pos () + cWindow->paintOffset ()); |
340 | + |
341 | + compiz::window::Geometry newGeom = oldGeom; |
342 | + |
343 | + /* Since the geometry has already been updated |
344 | + * at resizeNotify time, we must compute the old |
345 | + * geometry */ |
346 | + |
347 | + oldGeom.setPos (oldGeom.pos () - CompPoint (-dx, -dy)); |
348 | + oldGeom.setWidth (oldGeom.width () - dwidth); |
349 | + oldGeom.setHeight (oldGeom.height () - dheight); |
350 | + |
351 | + damageGeometrySets (oldGeom, window->serverGeometry ()); |
352 | } |
353 | |
354 | if (window->mapNum () && redirected) |
355 | @@ -654,24 +685,36 @@ |
356 | void |
357 | PrivateCompositeWindow::moveNotify (int dx, int dy, bool now) |
358 | { |
359 | - if (window->shaded () || (window->isViewable ())) |
360 | - { |
361 | - int x, y, x1, x2, y1, y2; |
362 | - |
363 | - x = window->geometry ().x (); |
364 | - y = window->geometry ().y (); |
365 | - |
366 | - x1 = x - window->output ().left - dx; |
367 | - y1 = y - window->output ().top - dy; |
368 | - x2 = x + window->size ().width () + |
369 | - window->output ().right - dx; |
370 | - y2 = y + window->size ().height () + |
371 | - window->output ().bottom - dy; |
372 | - |
373 | - cScreen->damageRegion (CompRegion (CompRect (x1, y1, x2 - x1, y2 - y1))); |
374 | - } |
375 | - |
376 | window->moveNotify (dx, dy, now); |
377 | + |
378 | + /* Override redirect windows don't |
379 | + * get a call to position () so |
380 | + * process damage here at ConfigureNotify |
381 | + * time */ |
382 | + if (window->overrideRedirect () && |
383 | + window->isViewable ()) |
384 | + { |
385 | + const CompWindowExtents &output = window->output (); |
386 | + compiz::window::Geometry oldGeom = window->serverGeometry (); |
387 | + |
388 | + /* Apply output offsets */ |
389 | + oldGeom.setLeft (oldGeom.left () - output.left); |
390 | + oldGeom.setRight (oldGeom.right () + output.right); |
391 | + oldGeom.setTop (oldGeom.top () - output.top); |
392 | + oldGeom.setBottom (oldGeom.bottom () + output.bottom); |
393 | + |
394 | + /* Translate by position offset */ |
395 | + oldGeom.setPos (oldGeom.pos () + cWindow->paintOffset ()); |
396 | + |
397 | + compiz::window::Geometry newGeom = oldGeom; |
398 | + |
399 | + /* Since the geometry has already been updated |
400 | + * at moveNotify time, we must compute the old |
401 | + * geometry */ |
402 | + oldGeom.setPos (oldGeom.pos () - CompPoint (-dx, -dy)); |
403 | + |
404 | + damageGeometrySets (oldGeom, newGeom); |
405 | + } |
406 | } |
407 | |
408 | bool |
409 | |
410 | === modified file 'plugins/decor/src/decor.cpp' |
411 | --- plugins/decor/src/decor.cpp 2012-01-11 08:48:40 +0000 |
412 | +++ plugins/decor/src/decor.cpp 2012-01-11 08:48:40 +0000 |
413 | @@ -91,7 +91,10 @@ |
414 | void |
415 | DecorWindow::computeShadowRegion () |
416 | { |
417 | - shadowRegion = CompRegion (window->outputRect ()); |
418 | + shadowRegion = CompRegion (window->serverOutputRect ()); |
419 | + |
420 | + if (dScreen->cmActive) |
421 | + shadowRegion.translate (cWindow->paintOffset ()); |
422 | |
423 | if (window->type () == CompWindowTypeDropdownMenuMask || |
424 | window->type () == CompWindowTypePopupMenuMask) |
425 | @@ -140,13 +143,13 @@ |
426 | * that will look a lot better. |
427 | */ |
428 | if (window->type () == CompWindowTypeDropdownMenuMask && |
429 | - shadowRegion == CompRegion (window->outputRect ())) |
430 | + shadowRegion == CompRegion (window->serverOutputRect ())) |
431 | { |
432 | - CompRect area (window->outputRect ().x1 (), |
433 | - window->outputRect ().y1 (), |
434 | - window->outputRect ().width (), |
435 | - window->inputRect ().y1 () - |
436 | - window->outputRect ().y1 ()); |
437 | + CompRect area (window->serverOutputRect ().x1 (), |
438 | + window->serverOutputRect ().y1 (), |
439 | + window->serverOutputRect ().width (), |
440 | + window->serverInputRect ().y1 () - |
441 | + window->serverOutputRect ().y1 ()); |
442 | |
443 | shadowRegion = shadowRegion.subtracted (area); |
444 | } |
445 | @@ -913,6 +916,27 @@ |
446 | } |
447 | |
448 | /* |
449 | + * WindowDecoration::translate |
450 | + * |
451 | + * Translate window decoration base region |
452 | + * by a specified size, does not update |
453 | + * the window decoration scaling matrix |
454 | + */ |
455 | +void |
456 | +WindowDecoration::translate (const CompPoint &dp) |
457 | +{ |
458 | + int i; |
459 | + |
460 | + for (i = 0; i < nQuad; i++) |
461 | + { |
462 | + quad[i].box.x1 += dp.x (); |
463 | + quad[i].box.y1 += dp.y (); |
464 | + quad[i].box.x2 += dp.x (); |
465 | + quad[i].box.y2 += dp.y (); |
466 | + } |
467 | +} |
468 | + |
469 | +/* |
470 | * DecorWindow::setDecorationMatrices |
471 | * |
472 | * Statically update the quad display matrices |
473 | @@ -1019,7 +1043,7 @@ |
474 | |
475 | for (i = 0; i < wd->nQuad; i++) |
476 | { |
477 | - int x, y; |
478 | + CompPoint pos; |
479 | unsigned int width = window->size ().width (); |
480 | unsigned int height = window->size ().height (); |
481 | |
482 | @@ -1030,13 +1054,15 @@ |
483 | &x1, &y1, &x2, &y2, &sx, &sy); |
484 | |
485 | /* Translate by x and y points of this window */ |
486 | - x = window->geometry ().x (); |
487 | - y = window->geometry ().y (); |
488 | - |
489 | - wd->quad[i].box.x1 = x1 + x; |
490 | - wd->quad[i].box.y1 = y1 + y; |
491 | - wd->quad[i].box.x2 = x2 + x; |
492 | - wd->quad[i].box.y2 = y2 + y; |
493 | + pos = window->serverGeometry ().pos (); |
494 | + |
495 | + if (cWindow) |
496 | + pos += cWindow->paintOffset (); |
497 | + |
498 | + wd->quad[i].box.x1 = x1 + pos.x (); |
499 | + wd->quad[i].box.y1 = y1 + pos.y (); |
500 | + wd->quad[i].box.x2 = x2 + pos.x (); |
501 | + wd->quad[i].box.y2 = y2 + pos.y (); |
502 | wd->quad[i].sx = sx; |
503 | wd->quad[i].sy = sy; |
504 | } |
505 | @@ -1064,64 +1090,6 @@ |
506 | } |
507 | |
508 | /* |
509 | - * DecorWindow::shiftX |
510 | - * |
511 | - * Determines the amount that the window needs to |
512 | - * move based on the gravity hint once it is decorated, |
513 | - * at least in the X direction |
514 | - * |
515 | - * FIXME: This should be merged into a function |
516 | - * that returns CompPoint, there is no reason for |
517 | - * there to be two separate functions |
518 | - * |
519 | - */ |
520 | -int |
521 | -DecorWindow::shiftX () |
522 | -{ |
523 | - switch (window->sizeHints ().win_gravity) { |
524 | - case WestGravity: |
525 | - case NorthWestGravity: |
526 | - case SouthWestGravity: |
527 | - return window->border ().left; |
528 | - case EastGravity: |
529 | - case NorthEastGravity: |
530 | - case SouthEastGravity: |
531 | - return -window->border ().right; |
532 | - } |
533 | - |
534 | - return 0; |
535 | -} |
536 | - |
537 | -/* |
538 | - * DecorWindow::shiftY |
539 | - * |
540 | - * Determines the amount that the window needs to |
541 | - * move based on the gravity hint once it is decorated, |
542 | - * at least in the Y direction |
543 | - * |
544 | - * FIXME: This should be merged into a function |
545 | - * that returns CompPoint, there is no reason for |
546 | - * there to be two separate functions |
547 | - * |
548 | - */ |
549 | -int |
550 | -DecorWindow::shiftY () |
551 | -{ |
552 | - switch (window->sizeHints ().win_gravity) { |
553 | - case NorthGravity: |
554 | - case NorthWestGravity: |
555 | - case NorthEastGravity: |
556 | - return window->border ().top; |
557 | - case SouthGravity: |
558 | - case SouthWestGravity: |
559 | - case SouthEastGravity: |
560 | - return -window->border ().bottom; |
561 | - } |
562 | - |
563 | - return 0; |
564 | -} |
565 | - |
566 | -/* |
567 | * decorOffsetMove |
568 | * |
569 | * Function called on a timer (to avoid calling position from |
570 | @@ -1387,8 +1355,7 @@ |
571 | bool decorate = false; |
572 | bool shadowOnly = true; |
573 | int moveDx, moveDy; |
574 | - int oldShiftX = 0; |
575 | - int oldShiftY = 0; |
576 | + CompPoint oldShift; |
577 | |
578 | old = (wd) ? wd->decor : NULL; |
579 | |
580 | @@ -1507,14 +1474,16 @@ |
581 | * WindowDecoration */ |
582 | if (old) |
583 | { |
584 | - oldShiftX = shiftX (); |
585 | - oldShiftY = shiftY (); |
586 | + oldShift = compiz::window::extents::shift (window->border (), |
587 | + window->sizeHints ().win_gravity); |
588 | |
589 | WindowDecoration::destroy (wd); |
590 | |
591 | wd = NULL; |
592 | } |
593 | |
594 | + CompPoint movement; |
595 | + |
596 | /* If a decoration was found for this window, create |
597 | * a new WindowDecoration for it and set the frame |
598 | * extents accordingly. We should also move the |
599 | @@ -1537,8 +1506,8 @@ |
600 | window->setWindowFrameExtents (&wd->decor->border, |
601 | &wd->decor->input); |
602 | |
603 | - moveDx = shiftX () - oldShiftX; |
604 | - moveDy = shiftY () - oldShiftY; |
605 | + movement = compiz::window::extents::shift (window->border (), |
606 | + window->sizeHints ().win_gravity) - oldShift; |
607 | |
608 | /* Update the input and output frame */ |
609 | if (decorate) |
610 | @@ -1563,8 +1532,7 @@ |
611 | |
612 | window->setWindowFrameExtents (&emptyExtents, &emptyExtents); |
613 | |
614 | - moveDx = -oldShiftX; |
615 | - moveDy = -oldShiftY; |
616 | + movement = CompPoint (-oldShift.x (), -oldShift.y ()); |
617 | } |
618 | |
619 | /* Need to actually move the window */ |
620 | @@ -1575,7 +1543,6 @@ |
621 | * time and not here since serverGeometry may be updated by |
622 | * the time that we do call position () */ |
623 | |
624 | - CompPoint d (moveDx, moveDy); |
625 | unsigned int mask = CHANGE_X | CHANGE_Y; |
626 | |
627 | /* Except if it's fullscreen, maximized or such */ |
628 | @@ -1600,9 +1567,9 @@ |
629 | * refcounting in case we need to keep it alive |
630 | */ |
631 | if (!allowDecoration) |
632 | - decorOffsetMove (window, d, mask); |
633 | + decorOffsetMove (window, movement, mask); |
634 | else |
635 | - moveUpdate.start (boost::bind (decorOffsetMove, window, d, mask), 0); |
636 | + moveUpdate.start (boost::bind (decorOffsetMove, window, movement, mask), 0); |
637 | } |
638 | } |
639 | |
640 | @@ -2129,7 +2096,8 @@ |
641 | void |
642 | DecorWindow::updateWindowRegions () |
643 | { |
644 | - const CompRect &input (window->inputRect ()); |
645 | + CompRect input (window->serverInputRect ()); |
646 | + input.setPos (input.pos () + cWindow->paintOffset ()); |
647 | |
648 | if (regions.size () != gWindow->textures ().size ()) |
649 | regions.resize (gWindow->textures ().size ()); |
650 | @@ -2691,31 +2659,64 @@ |
651 | } |
652 | |
653 | /* |
654 | - * DecorWindow::moveNotify |
655 | + * DecorWindow::position |
656 | * |
657 | * Translate window scaled quad boxes for movement |
658 | * and also recompute shadow clip regions |
659 | * for panels and menus |
660 | */ |
661 | -void |
662 | -DecorWindow::moveNotify (int dx, int dy, bool immediate) |
663 | +bool |
664 | +DecorWindow::position (compiz::window::Geometry &g, |
665 | + unsigned int source, |
666 | + unsigned int constrainment) |
667 | { |
668 | + CompPoint dp = g.pos () - window->serverGeometry ().pos (); |
669 | + CompSize dsize = CompSize (g.width () - window->serverGeometry ().width (), |
670 | + g.height () - window->serverGeometry ().height ()); |
671 | + |
672 | if (wd) |
673 | { |
674 | - int i; |
675 | - |
676 | - for (i = 0; i < wd->nQuad; i++) |
677 | + wd->translate (dp); |
678 | + |
679 | + /* Need to update the scaling factors |
680 | + * on a size change, but not a position change */ |
681 | + if (dsize.width () || dsize.height ()) |
682 | + updateDecorationScale (); |
683 | + else if (dp.x () || dp.y ()) |
684 | + setDecorationMatrices (); |
685 | + } |
686 | + |
687 | + if (abs (dp.x ()) || abs (dp.y ()) || |
688 | + abs (dsize.width ()) || abs (dsize.height ())) |
689 | + updateReg = true; |
690 | + |
691 | + bool ret = window->position (g, source, constrainment); |
692 | + |
693 | + if (dScreen->cmActive) |
694 | + { |
695 | + foreach (CompWindow *cw, |
696 | + DecorScreen::get (screen)->cScreen->getWindowPaintList ()) |
697 | { |
698 | - wd->quad[i].box.x1 += dx; |
699 | - wd->quad[i].box.y1 += dy; |
700 | - wd->quad[i].box.x2 += dx; |
701 | - wd->quad[i].box.y2 += dy; |
702 | + DecorWindow::get (cw)->computeShadowRegion (); |
703 | } |
704 | - |
705 | + } |
706 | + |
707 | + return ret; |
708 | +} |
709 | + |
710 | +void |
711 | +DecorWindow::applyOffset (const CompPoint &dOff) |
712 | +{ |
713 | + if (wd) |
714 | + { |
715 | + wd->translate (dOff); |
716 | setDecorationMatrices (); |
717 | } |
718 | + |
719 | updateReg = true; |
720 | |
721 | + cWindow->applyOffset (dOff); |
722 | + |
723 | if (dScreen->cmActive) |
724 | { |
725 | foreach (CompWindow *cw, |
726 | @@ -2724,8 +2725,6 @@ |
727 | DecorWindow::get (cw)->computeShadowRegion (); |
728 | } |
729 | } |
730 | - |
731 | - window->moveNotify (dx, dy, immediate); |
732 | } |
733 | |
734 | /* |
735 | @@ -2751,6 +2750,7 @@ |
736 | |
737 | if (!window->hasUnmapReference ()) |
738 | update (true); |
739 | + |
740 | return false; |
741 | } |
742 | |
743 | @@ -2761,7 +2761,6 @@ |
744 | * recompute shadow region |
745 | * |
746 | */ |
747 | - |
748 | void |
749 | DecorWindow::resizeNotify (int dx, int dy, int dwidth, int dheight) |
750 | { |
751 | @@ -2773,21 +2772,70 @@ |
752 | processed, we need the timer for the moment. updateWindowOutputExtents |
753 | should be fixed so that it does not emit a resize notification. */ |
754 | resizeUpdate.start (boost::bind (&DecorWindow::resizeTimeout, this), 0); |
755 | - updateDecorationScale (); |
756 | - updateReg = true; |
757 | |
758 | - if (dScreen->cmActive) |
759 | + if (window->overrideRedirect ()) |
760 | { |
761 | - foreach (CompWindow *cw, |
762 | - DecorScreen::get (screen)->cScreen->getWindowPaintList ()) |
763 | - { |
764 | - DecorWindow::get (cw)->computeShadowRegion (); |
765 | + if (wd) |
766 | + { |
767 | + wd->translate (CompPoint (dx, dy)); |
768 | + |
769 | + /* Need to update the scaling factors |
770 | + * on a size change, but not a position change */ |
771 | + if (dwidth || dheight) |
772 | + updateDecorationScale (); |
773 | + else if (dx || dy) |
774 | + setDecorationMatrices (); |
775 | + } |
776 | + |
777 | + updateReg = true; |
778 | + |
779 | + if (dScreen->cmActive) |
780 | + { |
781 | + foreach (CompWindow *cw, |
782 | + DecorScreen::get (screen)->cScreen->getWindowPaintList ()) |
783 | + { |
784 | + DecorWindow::get (cw)->computeShadowRegion (); |
785 | + } |
786 | } |
787 | } |
788 | |
789 | window->resizeNotify (dx, dy, dwidth, dheight); |
790 | } |
791 | |
792 | +/* |
793 | + * DecorWindow::position |
794 | + * |
795 | + * Translate window scaled quad boxes for movement |
796 | + * and also recompute shadow clip regions |
797 | + * for panels and menus, but only for override |
798 | + * redirect windows as normal windows were able |
799 | + * to do this at position () time |
800 | + */ |
801 | +void DecorWindow::moveNotify (int dx, int dy, bool now) |
802 | +{ |
803 | + if (window->overrideRedirect ()) |
804 | + { |
805 | + if (wd) |
806 | + { |
807 | + wd->translate (CompPoint (dx, dy)); |
808 | + |
809 | + setDecorationMatrices (); |
810 | + } |
811 | + |
812 | + updateReg = true; |
813 | + |
814 | + if (dScreen->cmActive) |
815 | + { |
816 | + foreach (CompWindow *cw, |
817 | + DecorScreen::get (screen)->cScreen->getWindowPaintList ()) |
818 | + { |
819 | + DecorWindow::get (cw)->computeShadowRegion (); |
820 | + } |
821 | + } |
822 | + } |
823 | + |
824 | + window->moveNotify (dx, dy, now); |
825 | +} |
826 | |
827 | /* |
828 | * DecorWindow::stateChangeNotify |
829 | @@ -2801,25 +2849,12 @@ |
830 | { |
831 | if (wd && wd->decor) |
832 | { |
833 | - int oldShiftX = shiftX (); |
834 | - int oldShiftY = shiftY (); |
835 | - int moveDx, moveDy; |
836 | - |
837 | if ((window->state () & MAXIMIZE_STATE)) |
838 | window->setWindowFrameExtents (&wd->decor->maxBorder, |
839 | &wd->decor->maxInput); |
840 | else |
841 | window->setWindowFrameExtents (&wd->decor->border, |
842 | &wd->decor->input); |
843 | - |
844 | - /* Since we immediately update the frame extents, we must |
845 | - * also update the stored saved window geometry in order |
846 | - * to prevent the window from shifting back too far once |
847 | - * unmaximized */ |
848 | - |
849 | - moveDx = shiftX () - oldShiftX; |
850 | - moveDy = shiftY () - oldShiftY; |
851 | - |
852 | updateFrame (); |
853 | } |
854 | |
855 | |
856 | === modified file 'plugins/decor/src/decor.h' |
857 | --- plugins/decor/src/decor.h 2011-12-15 07:40:03 +0000 |
858 | +++ plugins/decor/src/decor.h 2012-01-11 08:48:40 +0000 |
859 | @@ -120,6 +120,8 @@ |
860 | static WindowDecoration * create (Decoration *); |
861 | static void destroy (WindowDecoration *); |
862 | |
863 | + void translate (const CompPoint &d); |
864 | + |
865 | public: |
866 | Decoration *decor; |
867 | ScaledQuad *quad; |
868 | @@ -200,10 +202,14 @@ |
869 | void getOutputExtents (CompWindowExtents&); |
870 | void resizeNotify (int, int, int, int); |
871 | void moveNotify (int, int, bool); |
872 | + bool position (compiz::window::Geometry &g, |
873 | + unsigned int source, |
874 | + unsigned int constrainment); |
875 | void stateChangeNotify (unsigned int); |
876 | void updateFrameRegion (CompRegion ®ion); |
877 | |
878 | bool damageRect (bool, const CompRect &); |
879 | + void applyOffset (const CompPoint &); |
880 | |
881 | void computeShadowRegion (); |
882 | |
883 | |
884 | === modified file 'plugins/opengl/src/privates.h' |
885 | --- plugins/opengl/src/privates.h 2012-01-11 08:48:40 +0000 |
886 | +++ plugins/opengl/src/privates.h 2012-01-11 08:48:40 +0000 |
887 | @@ -140,6 +140,7 @@ |
888 | void applyOffset (const CompPoint &); |
889 | bool position (compiz::window::Geometry &g, unsigned int source, unsigned int constrainment); |
890 | void windowNotify (CompWindowNotify n); |
891 | + void moveNotify (int dx, int dy, bool immediate); |
892 | void resizeNotify (int dx, int dy, int dwidth, int dheight); |
893 | void updateFrameRegion (CompRegion ®ion); |
894 | |
895 | |
896 | === modified file 'plugins/opengl/src/window.cpp' |
897 | --- plugins/opengl/src/window.cpp 2012-01-11 08:48:40 +0000 |
898 | +++ plugins/opengl/src/window.cpp 2012-01-11 08:48:40 +0000 |
899 | @@ -208,8 +208,26 @@ |
900 | } |
901 | |
902 | void |
903 | +PrivateGLWindow::moveNotify (int dx, int dy, bool immediate) |
904 | +{ |
905 | + if (window->overrideRedirect ()) |
906 | + { |
907 | + setWindowMatrix (); |
908 | + updateReg = true; |
909 | + } |
910 | + |
911 | + window->moveNotify (dx, dy, immediate); |
912 | +} |
913 | + |
914 | +void |
915 | PrivateGLWindow::resizeNotify (int dx, int dy, int dwidth, int dheight) |
916 | { |
917 | + if (window->overrideRedirect ()) |
918 | + { |
919 | + setWindowMatrix (); |
920 | + updateReg = true; |
921 | + } |
922 | + |
923 | window->resizeNotify (dx, dy, dwidth, dheight); |
924 | if (!window->hasUnmapReference ()) |
925 | gWindow->release (); |
926 | |
927 | === modified file 'plugins/wobbly/src/wobbly.cpp' |
928 | --- plugins/wobbly/src/wobbly.cpp 2012-01-11 08:48:40 +0000 |
929 | +++ plugins/wobbly/src/wobbly.cpp 2012-01-11 08:48:40 +0000 |
930 | @@ -1472,8 +1472,10 @@ |
931 | { |
932 | compiz::window::Geometry ng = w->geometry (); |
933 | |
934 | - ng.setPos (CompPoint (model->topLeft.x, |
935 | - model->topLeft.y)); |
936 | + ng.setPos (CompPoint (model->topLeft.x + |
937 | + w->output ().left, |
938 | + model->topLeft.y + |
939 | + w->output ().top)); |
940 | |
941 | w->positionSetEnabled (ww, false); |
942 | w->position (ng); |
943 | |
944 | === modified file 'src/CMakeLists.txt' |
945 | --- src/CMakeLists.txt 2012-01-11 08:48:40 +0000 |
946 | +++ src/CMakeLists.txt 2012-01-11 08:48:40 +0000 |
947 | @@ -6,6 +6,7 @@ |
948 | add_subdirectory( timer ) |
949 | add_subdirectory( pluginclasshandler ) |
950 | add_subdirectory( window ) |
951 | +add_subdirectory( point ) |
952 | |
953 | compiz_add_bcop_targets ( |
954 | core |
955 | @@ -37,7 +38,10 @@ |
956 | |
957 | ${CMAKE_CURRENT_SOURCE_DIR}/timer/include |
958 | ${CMAKE_CURRENT_SOURCE_DIR}/timer/src |
959 | - |
960 | + |
961 | + ${CMAKE_CURRENT_SOURCE_DIR}/point/include |
962 | + ${CMAKE_CURRENT_SOURCE_DIR}/point/src |
963 | + |
964 | ${CMAKE_CURRENT_SOURCE_DIR}/pluginclasshandler/include |
965 | ${CMAKE_CURRENT_SOURCE_DIR}/pluginclasshandler/src |
966 | |
967 | @@ -46,6 +50,9 @@ |
968 | |
969 | ${CMAKE_CURRENT_SOURCE_DIR}/window/geometry/include |
970 | ${CMAKE_CURRENT_SOURCE_DIR}/window/geometry/src |
971 | + |
972 | + ${CMAKE_CURRENT_SOURCE_DIR}/window/extents/include |
973 | + ${CMAKE_CURRENT_SOURCE_DIR}/window/extents/src |
974 | ) |
975 | |
976 | add_definitions ( |
977 | @@ -79,13 +86,11 @@ |
978 | ${CMAKE_CURRENT_SOURCE_DIR}/session.cpp |
979 | ${CMAKE_CURRENT_SOURCE_DIR}/output.cpp |
980 | ${CMAKE_CURRENT_SOURCE_DIR}/size.cpp |
981 | - ${CMAKE_CURRENT_SOURCE_DIR}/point.cpp |
982 | ${CMAKE_CURRENT_SOURCE_DIR}/icon.cpp |
983 | ${CMAKE_CURRENT_SOURCE_DIR}/modifierhandler.cpp |
984 | ${CMAKE_CURRENT_SOURCE_DIR}/propertywriter.cpp |
985 | ${CMAKE_CURRENT_SOURCE_DIR}/eventsource.cpp |
986 | ${CMAKE_CURRENT_SOURCE_DIR}/stackdebugger.cpp |
987 | - |
988 | ${_bcop_sources} |
989 | ) |
990 | |
991 | @@ -105,10 +110,12 @@ |
992 | |
993 | compiz_string |
994 | compiz_timer |
995 | + compiz_point |
996 | compiz_logmessage |
997 | compiz_pluginclasshandler |
998 | compiz_window_geometry |
999 | compiz_window_geometry_saver |
1000 | + compiz_window_extents |
1001 | # ${CORE_MOD_LIBRARIES} |
1002 | ) |
1003 | |
1004 | |
1005 | === added directory 'src/point' |
1006 | === removed file 'src/point.cpp' |
1007 | --- src/point.cpp 2010-01-21 16:21:30 +0000 |
1008 | +++ src/point.cpp 1970-01-01 00:00:00 +0000 |
1009 | @@ -1,100 +0,0 @@ |
1010 | -/* |
1011 | - * Copyright © 2008 Dennis Kasprzyk |
1012 | - * |
1013 | - * Permission to use, copy, modify, distribute, and sell this software |
1014 | - * and its documentation for any purpose is hereby granted without |
1015 | - * fee, provided that the above copyright notice appear in all copies |
1016 | - * and that both that copyright notice and this permission notice |
1017 | - * appear in supporting documentation, and that the name of |
1018 | - * Dennis Kasprzyk not be used in advertising or publicity pertaining to |
1019 | - * distribution of the software without specific, written prior permission. |
1020 | - * Dennis Kasprzyk makes no representations about the suitability of this |
1021 | - * software for any purpose. It is provided "as is" without express or |
1022 | - * implied warranty. |
1023 | - * |
1024 | - * DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
1025 | - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN |
1026 | - * NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
1027 | - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS |
1028 | - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
1029 | - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION |
1030 | - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
1031 | - * |
1032 | - * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org> |
1033 | - */ |
1034 | - |
1035 | -#include <core/point.h> |
1036 | - |
1037 | -CompPoint::CompPoint () : |
1038 | - mX (0), |
1039 | - mY (0) |
1040 | -{ |
1041 | -} |
1042 | - |
1043 | -CompPoint::CompPoint (int x, int y) : |
1044 | - mX (x), |
1045 | - mY (y) |
1046 | -{ |
1047 | -} |
1048 | - |
1049 | -void |
1050 | -CompPoint::set (int x, int y) |
1051 | -{ |
1052 | - mX = x; |
1053 | - mY = y; |
1054 | -} |
1055 | - |
1056 | -void |
1057 | -CompPoint::setX (int x) |
1058 | -{ |
1059 | - mX = x; |
1060 | -} |
1061 | - |
1062 | -void |
1063 | -CompPoint::setY (int y) |
1064 | -{ |
1065 | - mY = y; |
1066 | -} |
1067 | - |
1068 | -bool |
1069 | -CompPoint::operator== (const CompPoint &point) const |
1070 | -{ |
1071 | - return (mX == point.mX) && (mY == point.mY); |
1072 | -} |
1073 | - |
1074 | -bool |
1075 | -CompPoint::operator!= (const CompPoint &point) const |
1076 | -{ |
1077 | - return !(*this == point); |
1078 | -} |
1079 | - |
1080 | -CompPoint & |
1081 | -CompPoint::operator+= (const CompPoint &point) |
1082 | -{ |
1083 | - mX += point.mX; |
1084 | - mY += point.mY; |
1085 | - |
1086 | - return *this; |
1087 | -} |
1088 | - |
1089 | -CompPoint |
1090 | -CompPoint::operator+ (const CompPoint &rhs) const |
1091 | -{ |
1092 | - return CompPoint (mX + rhs.mX, mY + rhs.mY); |
1093 | -} |
1094 | - |
1095 | -CompPoint & |
1096 | -CompPoint::operator-= (const CompPoint &point) |
1097 | -{ |
1098 | - mX -= point.mX; |
1099 | - mY -= point.mY; |
1100 | - |
1101 | - return *this; |
1102 | -} |
1103 | - |
1104 | -CompPoint |
1105 | -CompPoint::operator- (const CompPoint &rhs) const |
1106 | -{ |
1107 | - return CompPoint (mX - rhs.mX, mY - rhs.mY); |
1108 | -} |
1109 | - |
1110 | |
1111 | === added file 'src/point/CMakeLists.txt' |
1112 | --- src/point/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
1113 | +++ src/point/CMakeLists.txt 2012-01-11 08:48:40 +0000 |
1114 | @@ -0,0 +1,67 @@ |
1115 | +pkg_check_modules ( |
1116 | + GLIBMM |
1117 | + REQUIRED |
1118 | + glibmm-2.4 glib-2.0 |
1119 | +) |
1120 | + |
1121 | +INCLUDE_DIRECTORIES ( |
1122 | + ${CMAKE_CURRENT_SOURCE_DIR}/include |
1123 | + ${CMAKE_CURRENT_SOURCE_DIR}/src |
1124 | + |
1125 | + ${CMAKE_CURRENT_SOURCE_DIR}/point/include |
1126 | + ${CMAKE_CURRENT_SOURCE_DIR}/point/src |
1127 | + |
1128 | + ${compiz_SOURCE_DIR}/include |
1129 | + |
1130 | + ${Boost_INCLUDE_DIRS} |
1131 | + |
1132 | + ${GLIBMM_INCLUDE_DIRS} |
1133 | +) |
1134 | + |
1135 | +LINK_DIRECTORIES (${GLIBMM_LIBRARY_DIRS}) |
1136 | + |
1137 | +SET ( |
1138 | + PUBLIC_HEADERS |
1139 | + ${CMAKE_CURRENT_SOURCE_DIR}/include/core/point.h |
1140 | +) |
1141 | + |
1142 | +SET ( |
1143 | + PRIVATE_HEADERS |
1144 | +) |
1145 | + |
1146 | +SET( |
1147 | + SRCS |
1148 | + ${CMAKE_CURRENT_SOURCE_DIR}/src/point.cpp |
1149 | +) |
1150 | + |
1151 | +ADD_LIBRARY( |
1152 | + compiz_point STATIC |
1153 | + |
1154 | + ${SRCS} |
1155 | + |
1156 | + ${PUBLIC_HEADERS} |
1157 | + ${PRIVATE_HEADERS} |
1158 | +) |
1159 | + |
1160 | +ADD_SUBDIRECTORY( ${CMAKE_CURRENT_SOURCE_DIR}/tests ) |
1161 | + |
1162 | +SET_TARGET_PROPERTIES( |
1163 | + compiz_point PROPERTIES |
1164 | + PUBLIC_HEADER "${PUBLIC_HEADERS}" |
1165 | +) |
1166 | + |
1167 | +INSTALL( |
1168 | + TARGETS compiz_point |
1169 | + RUNTIME DESTINATION bin |
1170 | + LIBRARY DESTINATION lib |
1171 | + ARCHIVE DESTINATION lib |
1172 | + PUBLIC_HEADER DESTINATION include/compiz |
1173 | +) |
1174 | + |
1175 | + |
1176 | + |
1177 | +TARGET_LINK_LIBRARIES( |
1178 | + compiz_point |
1179 | + |
1180 | + ${GLIBMM_LIBRARIES} |
1181 | +) |
1182 | |
1183 | === added directory 'src/point/include' |
1184 | === added directory 'src/point/include/core' |
1185 | === added file 'src/point/include/core/point.h' |
1186 | --- src/point/include/core/point.h 1970-01-01 00:00:00 +0000 |
1187 | +++ src/point/include/core/point.h 2012-01-11 08:48:40 +0000 |
1188 | @@ -0,0 +1,110 @@ |
1189 | +/* |
1190 | + * Copyright © 2008 Dennis Kasprzyk |
1191 | + * |
1192 | + * Permission to use, copy, modify, distribute, and sell this software |
1193 | + * and its documentation for any purpose is hereby granted without |
1194 | + * fee, provided that the above copyright notice appear in all copies |
1195 | + * and that both that copyright notice and this permission notice |
1196 | + * appear in supporting documentation, and that the name of |
1197 | + * Dennis Kasprzyk not be used in advertising or publicity pertaining to |
1198 | + * distribution of the software without specific, written prior permission. |
1199 | + * Dennis Kasprzyk makes no representations about the suitability of this |
1200 | + * software for any purpose. It is provided "as is" without express or |
1201 | + * implied warranty. |
1202 | + * |
1203 | + * DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
1204 | + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN |
1205 | + * NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
1206 | + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS |
1207 | + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
1208 | + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION |
1209 | + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
1210 | + * |
1211 | + * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org> |
1212 | + */ |
1213 | + |
1214 | +#ifndef _COMPPOINT_H |
1215 | +#define _COMPPOINT_H |
1216 | + |
1217 | +#include <vector> |
1218 | +#include <list> |
1219 | + |
1220 | +/** |
1221 | + * A 2D coordinate (likely in screen space) that can only be mutated |
1222 | + * through set() methods, since it's data members are private. |
1223 | + */ |
1224 | +class CompPoint { |
1225 | + |
1226 | + public: |
1227 | + CompPoint (); |
1228 | + CompPoint (int, int); |
1229 | + |
1230 | + /** |
1231 | + * Get the x coordinate of this point |
1232 | + */ |
1233 | + int x () const; |
1234 | + |
1235 | + /** |
1236 | + * Get the y coordinate of this point |
1237 | + */ |
1238 | + int y () const; |
1239 | + |
1240 | + /** |
1241 | + * Set the x and y coordinate of this point |
1242 | + */ |
1243 | + void set (int, int); |
1244 | + |
1245 | + /** |
1246 | + * Set the x coordinate of this point |
1247 | + */ |
1248 | + void setX (int); |
1249 | + |
1250 | + /** |
1251 | + * Set the y coordinate of this point |
1252 | + */ |
1253 | + void setY (int); |
1254 | + |
1255 | + bool operator== (const CompPoint &) const; |
1256 | + bool operator!= (const CompPoint &) const; |
1257 | + |
1258 | + /** |
1259 | + * Takes from both co-ordinates |
1260 | + */ |
1261 | + CompPoint & operator-= (const CompPoint &); |
1262 | + /** |
1263 | + * Adds to both co-ordinates |
1264 | + */ |
1265 | + CompPoint & operator+= (const CompPoint &); |
1266 | + |
1267 | + /** |
1268 | + * Retuns an added point |
1269 | + */ |
1270 | + CompPoint operator+ (const CompPoint &) const; |
1271 | + /** |
1272 | + * Returns a subtracted point |
1273 | + */ |
1274 | + CompPoint operator- (const CompPoint &) const; |
1275 | + |
1276 | + typedef std::vector<CompPoint> vector; |
1277 | + typedef std::vector<CompPoint *> ptrVector; |
1278 | + typedef std::list<CompPoint> list; |
1279 | + typedef std::list<CompPoint *> ptrList; |
1280 | + |
1281 | + private: |
1282 | + int mX, mY; |
1283 | +}; |
1284 | + |
1285 | +inline int |
1286 | +CompPoint::x () const |
1287 | +{ |
1288 | + return mX; |
1289 | +} |
1290 | + |
1291 | +inline int |
1292 | +CompPoint::y () const |
1293 | +{ |
1294 | + return mY; |
1295 | +} |
1296 | + |
1297 | + |
1298 | +#endif |
1299 | |
1300 | === added directory 'src/point/src' |
1301 | === added file 'src/point/src/point.cpp' |
1302 | --- src/point/src/point.cpp 1970-01-01 00:00:00 +0000 |
1303 | +++ src/point/src/point.cpp 2012-01-11 08:48:40 +0000 |
1304 | @@ -0,0 +1,100 @@ |
1305 | +/* |
1306 | + * Copyright © 2008 Dennis Kasprzyk |
1307 | + * |
1308 | + * Permission to use, copy, modify, distribute, and sell this software |
1309 | + * and its documentation for any purpose is hereby granted without |
1310 | + * fee, provided that the above copyright notice appear in all copies |
1311 | + * and that both that copyright notice and this permission notice |
1312 | + * appear in supporting documentation, and that the name of |
1313 | + * Dennis Kasprzyk not be used in advertising or publicity pertaining to |
1314 | + * distribution of the software without specific, written prior permission. |
1315 | + * Dennis Kasprzyk makes no representations about the suitability of this |
1316 | + * software for any purpose. It is provided "as is" without express or |
1317 | + * implied warranty. |
1318 | + * |
1319 | + * DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
1320 | + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN |
1321 | + * NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
1322 | + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS |
1323 | + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
1324 | + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION |
1325 | + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
1326 | + * |
1327 | + * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org> |
1328 | + */ |
1329 | + |
1330 | +#include <core/point.h> |
1331 | + |
1332 | +CompPoint::CompPoint () : |
1333 | + mX (0), |
1334 | + mY (0) |
1335 | +{ |
1336 | +} |
1337 | + |
1338 | +CompPoint::CompPoint (int x, int y) : |
1339 | + mX (x), |
1340 | + mY (y) |
1341 | +{ |
1342 | +} |
1343 | + |
1344 | +void |
1345 | +CompPoint::set (int x, int y) |
1346 | +{ |
1347 | + mX = x; |
1348 | + mY = y; |
1349 | +} |
1350 | + |
1351 | +void |
1352 | +CompPoint::setX (int x) |
1353 | +{ |
1354 | + mX = x; |
1355 | +} |
1356 | + |
1357 | +void |
1358 | +CompPoint::setY (int y) |
1359 | +{ |
1360 | + mY = y; |
1361 | +} |
1362 | + |
1363 | +bool |
1364 | +CompPoint::operator== (const CompPoint &point) const |
1365 | +{ |
1366 | + return (mX == point.mX) && (mY == point.mY); |
1367 | +} |
1368 | + |
1369 | +bool |
1370 | +CompPoint::operator!= (const CompPoint &point) const |
1371 | +{ |
1372 | + return !(*this == point); |
1373 | +} |
1374 | + |
1375 | +CompPoint & |
1376 | +CompPoint::operator+= (const CompPoint &point) |
1377 | +{ |
1378 | + mX += point.mX; |
1379 | + mY += point.mY; |
1380 | + |
1381 | + return *this; |
1382 | +} |
1383 | + |
1384 | +CompPoint |
1385 | +CompPoint::operator+ (const CompPoint &rhs) const |
1386 | +{ |
1387 | + return CompPoint (mX + rhs.mX, mY + rhs.mY); |
1388 | +} |
1389 | + |
1390 | +CompPoint & |
1391 | +CompPoint::operator-= (const CompPoint &point) |
1392 | +{ |
1393 | + mX -= point.mX; |
1394 | + mY -= point.mY; |
1395 | + |
1396 | + return *this; |
1397 | +} |
1398 | + |
1399 | +CompPoint |
1400 | +CompPoint::operator- (const CompPoint &rhs) const |
1401 | +{ |
1402 | + return CompPoint (mX - rhs.mX, mY - rhs.mY); |
1403 | +} |
1404 | + |
1405 | |
1406 | === added directory 'src/point/tests' |
1407 | === added file 'src/point/tests/CMakeLists.txt' |
1408 | --- src/point/tests/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
1409 | +++ src/point/tests/CMakeLists.txt 2012-01-11 08:48:40 +0000 |
1410 | @@ -0,0 +1,18 @@ |
1411 | +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
1412 | + |
1413 | +add_library (compiz_point_test |
1414 | + ${CMAKE_CURRENT_SOURCE_DIR}/test-point.cpp) |
1415 | + |
1416 | +add_executable (compiz_test_point |
1417 | + ${CMAKE_CURRENT_SOURCE_DIR}/point/src/test-point.cpp) |
1418 | + |
1419 | +target_link_libraries (compiz_test_point |
1420 | + compiz_point_test |
1421 | + compiz_point |
1422 | + ${GTEST_BOTH_LIBRARIES} |
1423 | + ${GMOCK_LIBRARY} |
1424 | + ${GMOCK_MAIN_LIBRARY} |
1425 | + ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
1426 | + ) |
1427 | + |
1428 | +add_test (compiz_point compiz_test_point) |
1429 | |
1430 | === added directory 'src/point/tests/point' |
1431 | === added directory 'src/point/tests/point/src' |
1432 | === added file 'src/point/tests/point/src/test-point.cpp' |
1433 | --- src/point/tests/point/src/test-point.cpp 1970-01-01 00:00:00 +0000 |
1434 | +++ src/point/tests/point/src/test-point.cpp 2012-01-11 08:48:40 +0000 |
1435 | @@ -0,0 +1,71 @@ |
1436 | +/* |
1437 | + * Copyright © 2011 Canonical Ltd. |
1438 | + * |
1439 | + * Permission to use, copy, modify, distribute, and sell this software |
1440 | + * and its documentation for any purpose is hereby granted without |
1441 | + * fee, provided that the above copyright notice appear in all copies |
1442 | + * and that both that copyright notice and this permission notice |
1443 | + * appear in supporting documentation, and that the name of |
1444 | + * Canonical Ltd. not be used in advertising or publicity pertaining to |
1445 | + * distribution of the software without specific, written prior permission. |
1446 | + * Canonical Ltd. makes no representations about the suitability of this |
1447 | + * software for any purpose. It is provided "as is" without express or |
1448 | + * implied warranty. |
1449 | + * |
1450 | + * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
1451 | + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN |
1452 | + * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
1453 | + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS |
1454 | + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
1455 | + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION |
1456 | + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
1457 | + * |
1458 | + * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com> |
1459 | + */ |
1460 | + |
1461 | +#include "test-point.h" |
1462 | + |
1463 | +class CompPointTestPoint : |
1464 | + public CompWindowPointTest |
1465 | +{ |
1466 | + public: |
1467 | + |
1468 | + CompPointTestPoint (); |
1469 | + ~CompPointTestPoint (); |
1470 | + |
1471 | + protected: |
1472 | + |
1473 | + CompPoint p; |
1474 | +}; |
1475 | + |
1476 | +CompPointTestPoint::CompPointTestPoint () : |
1477 | + p (0, 0) |
1478 | +{ |
1479 | +} |
1480 | + |
1481 | +CompPointTestPoint::~CompPointTestPoint () |
1482 | +{ |
1483 | +} |
1484 | + |
1485 | +TEST_F (CompPointTestPoint, TestPoint) |
1486 | +{ |
1487 | + p.setX (10); |
1488 | + |
1489 | + EXPECT_EQ (p.x (), 10); |
1490 | + |
1491 | + p.setY (10); |
1492 | + |
1493 | + EXPECT_EQ (p.y (), 10); |
1494 | + EXPECT_EQ (p, CompPoint (10, 10)); |
1495 | + |
1496 | + EXPECT_TRUE (p == CompPoint (10, 10)); |
1497 | + EXPECT_FALSE (p != CompPoint (10, 10)); |
1498 | + |
1499 | + p -= CompPoint (5, 5); |
1500 | + |
1501 | + EXPECT_EQ (p, CompPoint (5, 5)); |
1502 | + |
1503 | + p += CompPoint (3, 3); |
1504 | + |
1505 | + EXPECT_EQ (p, CompPoint (8, 8)); |
1506 | +} |
1507 | |
1508 | === added file 'src/point/tests/test-point.cpp' |
1509 | --- src/point/tests/test-point.cpp 1970-01-01 00:00:00 +0000 |
1510 | +++ src/point/tests/test-point.cpp 2012-01-11 08:48:40 +0000 |
1511 | @@ -0,0 +1,34 @@ |
1512 | +/* |
1513 | + * Copyright © 2011 Canonical Ltd. |
1514 | + * |
1515 | + * Permission to use, copy, modify, distribute, and sell this software |
1516 | + * and its documentation for any purpose is hereby granted without |
1517 | + * fee, provided that the above copyright notice appear in all copies |
1518 | + * and that both that copyright notice and this permission notice |
1519 | + * appear in supporting documentation, and that the name of |
1520 | + * Canonical Ltd. not be used in advertising or publicity pertaining to |
1521 | + * distribution of the software without specific, written prior permission. |
1522 | + * Canonical Ltd. makes no representations about the suitability of this |
1523 | + * software for any purpose. It is provided "as is" without express or |
1524 | + * implied warranty. |
1525 | + * |
1526 | + * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
1527 | + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN |
1528 | + * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
1529 | + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS |
1530 | + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
1531 | + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION |
1532 | + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
1533 | + * |
1534 | + * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com> |
1535 | + */ |
1536 | + |
1537 | +#include "test-point.h" |
1538 | + |
1539 | +CompWindowPointTest::CompWindowPointTest () |
1540 | +{ |
1541 | +} |
1542 | + |
1543 | +CompWindowPointTest::~CompWindowPointTest () |
1544 | +{ |
1545 | +} |
1546 | |
1547 | === added file 'src/point/tests/test-point.h' |
1548 | --- src/point/tests/test-point.h 1970-01-01 00:00:00 +0000 |
1549 | +++ src/point/tests/test-point.h 2012-01-11 08:48:40 +0000 |
1550 | @@ -0,0 +1,43 @@ |
1551 | +/* |
1552 | + * Copyright © 2011 Canonical Ltd. |
1553 | + * |
1554 | + * Permission to use, copy, modify, distribute, and sell this software |
1555 | + * and its documentation for any purpose is hereby granted without |
1556 | + * fee, provided that the above copyright notice appear in all copies |
1557 | + * and that both that copyright notice and this permission notice |
1558 | + * appear in supporting documentation, and that the name of |
1559 | + * Canonical Ltd. not be used in advertising or publicity pertaining to |
1560 | + * distribution of the software without specific, written prior permission. |
1561 | + * Canonical Ltd. makes no representations about the suitability of this |
1562 | + * software for any purpose. It is provided "as is" without express or |
1563 | + * implied warranty. |
1564 | + * |
1565 | + * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
1566 | + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN |
1567 | + * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
1568 | + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS |
1569 | + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
1570 | + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION |
1571 | + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
1572 | + * |
1573 | + * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com> |
1574 | + */ |
1575 | + |
1576 | +#ifndef _COMPIZ_TEST_WINDOW_GEOMETRY_H |
1577 | +#define _COMPIZ_TEST_WINDOW_GEOMETRY_H |
1578 | + |
1579 | +#include <gtest/gtest.h> |
1580 | +#include <core/point.h> |
1581 | +#include <iostream> |
1582 | +#include <boost/bind.hpp> |
1583 | + |
1584 | +class CompWindowPointTest : public ::testing::Test |
1585 | +{ |
1586 | +public: |
1587 | + |
1588 | + CompWindowPointTest (); |
1589 | + virtual ~CompWindowPointTest (); |
1590 | + |
1591 | +}; |
1592 | + |
1593 | +#endif |
1594 | |
1595 | === modified file 'src/window.cpp' |
1596 | --- src/window.cpp 2012-01-11 08:48:40 +0000 |
1597 | +++ src/window.cpp 2012-01-11 08:48:40 +0000 |
1598 | @@ -1834,7 +1834,6 @@ |
1599 | priv->height = ph; |
1600 | |
1601 | /* Update the entire region again here */ |
1602 | - |
1603 | if (priv->mapNum) |
1604 | priv->updateRegion (); |
1605 | |
1606 | @@ -1852,6 +1851,17 @@ |
1607 | priv->geometry.setX (gm.x ()); |
1608 | priv->geometry.setY (gm.y ()); |
1609 | |
1610 | + /* Non override redirect windows get their |
1611 | + * region updated on position () time |
1612 | + * but for override redirect windows we must |
1613 | + * update the position here */ |
1614 | + |
1615 | + if (priv->attrib.override_redirect) |
1616 | + { |
1617 | + priv->region.translate (dx, dy); |
1618 | + priv->inputRegion.translate (dx, dy); |
1619 | + } |
1620 | + |
1621 | priv->invisible = WINDOW_INVISIBLE (priv); |
1622 | |
1623 | window->moveNotify (dx, dy, true); |
1624 | @@ -2165,17 +2175,7 @@ |
1625 | { |
1626 | gettimeofday (&priv->lastGeometryUpdate, NULL); |
1627 | |
1628 | - priv->geometry.setX (priv->geometry.x () + dx); |
1629 | - priv->geometry.setY (priv->geometry.y () + dy); |
1630 | - priv->frameGeometry.setX (priv->frameGeometry.x () + dx); |
1631 | - priv->frameGeometry.setY (priv->frameGeometry.y () + dy); |
1632 | - |
1633 | - priv->region.translate (dx, dy); |
1634 | - priv->inputRegion.translate (dx, dy); |
1635 | - if (!priv->frameRegion.isEmpty ()) |
1636 | - priv->frameRegion.translate (dx, dy); |
1637 | - |
1638 | - priv->invisible = WINDOW_INVISIBLE (priv); |
1639 | + |
1640 | |
1641 | window->moveNotify (dx, dy, immediate); |
1642 | } |
1643 | @@ -2568,7 +2568,8 @@ |
1644 | |
1645 | /* Also translate regions but don't do a full update |
1646 | * since that involves round trips to get the shape |
1647 | - * rectangles and is slow. */ |
1648 | + * rectangles and is slow. Do the full update |
1649 | + * on the actual resize notification */ |
1650 | |
1651 | priv->region.translate (dp); |
1652 | priv->inputRegion.translate (dp); |
1653 | @@ -6969,19 +6970,21 @@ |
1654 | if (!i) |
1655 | i = b; |
1656 | |
1657 | - if (priv->serverInput.left != i->left || |
1658 | - priv->serverInput.right != i->right || |
1659 | - priv->serverInput.top != i->top || |
1660 | - priv->serverInput.bottom != i->bottom || |
1661 | - priv->border.left != b->left || |
1662 | - priv->border.right != b->right || |
1663 | - priv->border.top != b->top || |
1664 | - priv->border.bottom != b->bottom) |
1665 | + if (priv->serverInput != *i || |
1666 | + priv->border != *b) |
1667 | { |
1668 | + const CompPoint &oldShift = compiz::window::extents::shift (priv->border, priv->sizeHints.win_gravity); |
1669 | + const CompPoint &shift = compiz::window::extents::shift (*b, priv->sizeHints.win_gravity); |
1670 | + compiz::window::Geometry ng; |
1671 | + |
1672 | + priv->geometrySaver.get (ng); |
1673 | + ng.setPos (ng.pos () + (oldShift - shift)); |
1674 | + |
1675 | priv->serverInput = *i; |
1676 | priv->border = *b; |
1677 | |
1678 | recalcActions (); |
1679 | + priv->geometrySaver.update (ng, CHANGE_X | CHANGE_Y); |
1680 | |
1681 | priv->updateSize (); |
1682 | priv->updateFrameWindow (); |
1683 | |
1684 | === modified file 'src/window/CMakeLists.txt' |
1685 | --- src/window/CMakeLists.txt 2012-01-11 08:48:40 +0000 |
1686 | +++ src/window/CMakeLists.txt 2012-01-11 08:48:40 +0000 |
1687 | @@ -1,2 +1,3 @@ |
1688 | add_subdirectory (geometry) |
1689 | add_subdirectory (geometry-saver) |
1690 | +add_subdirectory (extents) |
1691 | |
1692 | === added directory 'src/window/extents' |
1693 | === added file 'src/window/extents/CMakeLists.txt' |
1694 | --- src/window/extents/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
1695 | +++ src/window/extents/CMakeLists.txt 2012-01-11 08:48:40 +0000 |
1696 | @@ -0,0 +1,67 @@ |
1697 | +pkg_check_modules ( |
1698 | + GLIBMM |
1699 | + REQUIRED |
1700 | + glibmm-2.4 glib-2.0 |
1701 | +) |
1702 | + |
1703 | +INCLUDE_DIRECTORIES ( |
1704 | + ${CMAKE_CURRENT_SOURCE_DIR}/include |
1705 | + ${CMAKE_CURRENT_SOURCE_DIR}/src |
1706 | + |
1707 | + ${compiz_SOURCE_DIR}/include |
1708 | + |
1709 | + ${compiz_SOURCE_DIR}/src/point/include |
1710 | + |
1711 | + ${Boost_INCLUDE_DIRS} |
1712 | + |
1713 | + ${GLIBMM_INCLUDE_DIRS} |
1714 | +) |
1715 | + |
1716 | +LINK_DIRECTORIES (${GLIBMM_LIBRARY_DIRS}) |
1717 | + |
1718 | +SET ( |
1719 | + PUBLIC_HEADERS |
1720 | + ${CMAKE_CURRENT_SOURCE_DIR}/include/core/windowextents.h |
1721 | +) |
1722 | + |
1723 | +SET ( |
1724 | + PRIVATE_HEADERS |
1725 | +) |
1726 | + |
1727 | +SET( |
1728 | + SRCS |
1729 | + ${CMAKE_CURRENT_SOURCE_DIR}/src/windowextents.cpp |
1730 | +) |
1731 | + |
1732 | +ADD_LIBRARY( |
1733 | + compiz_window_extents STATIC |
1734 | + |
1735 | + ${SRCS} |
1736 | + |
1737 | + ${PUBLIC_HEADERS} |
1738 | + ${PRIVATE_HEADERS} |
1739 | +) |
1740 | + |
1741 | +ADD_SUBDIRECTORY( ${CMAKE_CURRENT_SOURCE_DIR}/tests ) |
1742 | + |
1743 | +SET_TARGET_PROPERTIES( |
1744 | + compiz_window_extents PROPERTIES |
1745 | + PUBLIC_HEADER "${PUBLIC_HEADERS}" |
1746 | +) |
1747 | + |
1748 | +INSTALL( |
1749 | + TARGETS compiz_window_extents |
1750 | + RUNTIME DESTINATION bin |
1751 | + LIBRARY DESTINATION lib |
1752 | + ARCHIVE DESTINATION lib |
1753 | + PUBLIC_HEADER DESTINATION include/compiz |
1754 | +) |
1755 | + |
1756 | + |
1757 | + |
1758 | +TARGET_LINK_LIBRARIES( |
1759 | + compiz_window_extents |
1760 | + compiz_point |
1761 | + |
1762 | + ${GLIBMM_LIBRARIES} |
1763 | +) |
1764 | |
1765 | === added directory 'src/window/extents/include' |
1766 | === added directory 'src/window/extents/include/core' |
1767 | === added file 'src/window/extents/include/core/windowextents.h' |
1768 | --- src/window/extents/include/core/windowextents.h 1970-01-01 00:00:00 +0000 |
1769 | +++ src/window/extents/include/core/windowextents.h 2012-01-11 08:48:40 +0000 |
1770 | @@ -0,0 +1,63 @@ |
1771 | +/* |
1772 | + * Copyright © 2011 Canonical Ltd. |
1773 | + * Copyright © 2008 Dennis Kasprzyk |
1774 | + * Copyright © 2007 Novell, Inc. |
1775 | + * |
1776 | + * Permission to use, copy, modify, distribute, and sell this software |
1777 | + * and its documentation for any purpose is hereby granted without |
1778 | + * fee, provided that the above copyright notice appear in all copies |
1779 | + * and that both that copyright notice and this permission notice |
1780 | + * appear in supporting documentation, and that the name of |
1781 | + * Dennis Kasprzyk not be used in advertising or publicity pertaining to |
1782 | + * distribution of the software without specific, written prior permission. |
1783 | + * Dennis Kasprzyk makes no representations about the suitability of this |
1784 | + * software for any purpose. It is provided "as is" without express or |
1785 | + * implied warranty. |
1786 | + * |
1787 | + * DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
1788 | + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN |
1789 | + * NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
1790 | + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS |
1791 | + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
1792 | + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION |
1793 | + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
1794 | + * |
1795 | + * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org> |
1796 | + * David Reveman <davidr@novell.com> |
1797 | + */ |
1798 | + |
1799 | +#ifndef _COMPWINDOWEXTENTS_H |
1800 | +#define _COMPWINDOWEXTENTS_H |
1801 | + |
1802 | +#include <core/point.h> |
1803 | + |
1804 | +namespace compiz |
1805 | +{ |
1806 | +namespace window |
1807 | +{ |
1808 | +namespace extents |
1809 | +{ |
1810 | +/** |
1811 | + * Specifies the left, right, top and bottom positions of a window's |
1812 | + * geometry |
1813 | + */ |
1814 | +struct Extents { |
1815 | + public: |
1816 | + int left; |
1817 | + int right; |
1818 | + int top; |
1819 | + int bottom; |
1820 | + |
1821 | + bool operator== (const Extents &other); |
1822 | + bool operator!= (const Extents &other); |
1823 | +}; |
1824 | + |
1825 | +CompPoint shift (const Extents &extents, |
1826 | + unsigned int gravity = 0); |
1827 | +} |
1828 | +} |
1829 | +} |
1830 | + |
1831 | +typedef compiz::window::extents::Extents CompWindowExtents; |
1832 | + |
1833 | +#endif |
1834 | |
1835 | === added directory 'src/window/extents/src' |
1836 | === added file 'src/window/extents/src/windowextents.cpp' |
1837 | --- src/window/extents/src/windowextents.cpp 1970-01-01 00:00:00 +0000 |
1838 | +++ src/window/extents/src/windowextents.cpp 2012-01-11 08:48:40 +0000 |
1839 | @@ -0,0 +1,81 @@ |
1840 | +/* |
1841 | + * Copyright © 2005 Novell, Inc. |
1842 | + * |
1843 | + * Permission to use, copy, modify, distribute, and sell this software |
1844 | + * and its documentation for any purpose is hereby granted without |
1845 | + * fee, provided that the above copyright notice appear in all copies |
1846 | + * and that both that copyright notice and this permission notice |
1847 | + * appear in supporting documentation, and that the name of |
1848 | + * Novell, Inc. not be used in advertising or publicity pertaining to |
1849 | + * distribution of the software without specific, written prior permission. |
1850 | + * Novell, Inc. makes no representations about the suitability of this |
1851 | + * software for any purpose. It is provided "as is" without express or |
1852 | + * implied warranty. |
1853 | + * |
1854 | + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
1855 | + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN |
1856 | + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
1857 | + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS |
1858 | + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
1859 | + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION |
1860 | + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
1861 | + * |
1862 | + * Author: David Reveman <davidr@novell.com> |
1863 | + */ |
1864 | + |
1865 | +#include <core/windowextents.h> |
1866 | +#include <core/point.h> |
1867 | +#include <X11/Xlib.h> |
1868 | +#include <X11/Xutil.h> |
1869 | + |
1870 | +CompPoint |
1871 | +compiz::window::extents::shift (const CompWindowExtents &extents, |
1872 | + unsigned int gravity) |
1873 | +{ |
1874 | + CompPoint rv = CompPoint (); |
1875 | + |
1876 | + switch (gravity) { |
1877 | + case NorthGravity: |
1878 | + case NorthWestGravity: |
1879 | + case NorthEastGravity: |
1880 | + rv.setY (extents.top); |
1881 | + break; |
1882 | + case SouthGravity: |
1883 | + case SouthWestGravity: |
1884 | + case SouthEastGravity: |
1885 | + rv.setY (-extents.bottom); |
1886 | + break; |
1887 | + default: |
1888 | + break; |
1889 | + } |
1890 | + |
1891 | + switch (gravity) { |
1892 | + case WestGravity: |
1893 | + case NorthWestGravity: |
1894 | + case SouthWestGravity: |
1895 | + rv.setX (extents.left); |
1896 | + break; |
1897 | + case EastGravity: |
1898 | + case NorthEastGravity: |
1899 | + case SouthEastGravity: |
1900 | + rv.setX (-extents.right); |
1901 | + break; |
1902 | + } |
1903 | + |
1904 | + return rv; |
1905 | +} |
1906 | + |
1907 | +bool |
1908 | +compiz::window::extents::Extents::operator== (const Extents &other) |
1909 | +{ |
1910 | + return this->left == other.left && |
1911 | + this->right == other.right && |
1912 | + this->top == other.top && |
1913 | + this->bottom == other.bottom; |
1914 | +} |
1915 | + |
1916 | +bool |
1917 | +compiz::window::extents::Extents::operator!= (const Extents &other) |
1918 | +{ |
1919 | + return !(*this == other); |
1920 | +} |
1921 | |
1922 | === added directory 'src/window/extents/tests' |
1923 | === added file 'src/window/extents/tests/CMakeLists.txt' |
1924 | --- src/window/extents/tests/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
1925 | +++ src/window/extents/tests/CMakeLists.txt 2012-01-11 08:48:40 +0000 |
1926 | @@ -0,0 +1,18 @@ |
1927 | +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
1928 | + |
1929 | +add_library (compiz_window_extents_test |
1930 | + ${CMAKE_CURRENT_SOURCE_DIR}/test-window-extents.cpp) |
1931 | + |
1932 | +add_executable (compiz_test_window_extents_shift |
1933 | + ${CMAKE_CURRENT_SOURCE_DIR}/shift/src/test-window-extents-shift.cpp) |
1934 | + |
1935 | +target_link_libraries (compiz_test_window_extents_shift |
1936 | + compiz_window_extents_test |
1937 | + compiz_window_extents |
1938 | + ${GTEST_BOTH_LIBRARIES} |
1939 | + ${GMOCK_LIBRARY} |
1940 | + ${GMOCK_MAIN_LIBRARY} |
1941 | + ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
1942 | + ) |
1943 | + |
1944 | +add_test (compiz_window_extents_shift compiz_test_window_extents_shift) |
1945 | |
1946 | === added directory 'src/window/extents/tests/shift' |
1947 | === added directory 'src/window/extents/tests/shift/src' |
1948 | === added file 'src/window/extents/tests/shift/src/test-window-extents-shift.cpp' |
1949 | --- src/window/extents/tests/shift/src/test-window-extents-shift.cpp 1970-01-01 00:00:00 +0000 |
1950 | +++ src/window/extents/tests/shift/src/test-window-extents-shift.cpp 2012-01-11 08:48:40 +0000 |
1951 | @@ -0,0 +1,91 @@ |
1952 | +/* |
1953 | + * Copyright © 2011 Canonical Ltd. |
1954 | + * |
1955 | + * Permission to use, copy, modify, distribute, and sell this software |
1956 | + * and its documentation for any purpose is hereby granted without |
1957 | + * fee, provided that the above copyright notice appear in all copies |
1958 | + * and that both that copyright notice and this permission notice |
1959 | + * appear in supporting documentation, and that the name of |
1960 | + * Canonical Ltd. not be used in advertising or publicity pertaining to |
1961 | + * distribution of the software without specific, written prior permission. |
1962 | + * Canonical Ltd. makes no representations about the suitability of this |
1963 | + * software for any purpose. It is provided "as is" without express or |
1964 | + * implied warranty. |
1965 | + * |
1966 | + * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
1967 | + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN |
1968 | + * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
1969 | + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS |
1970 | + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
1971 | + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION |
1972 | + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
1973 | + * |
1974 | + * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com> |
1975 | + */ |
1976 | + |
1977 | +#include "test-window-extents.h" |
1978 | +#include <X11/Xlib.h> |
1979 | +#include <X11/Xutil.h> |
1980 | + |
1981 | +class CompWindowExtentsTestShift : |
1982 | + public CompWindowExtentsTest |
1983 | +{ |
1984 | +public: |
1985 | + |
1986 | + CompWindowExtentsTestShift (); |
1987 | + virtual ~CompWindowExtentsTestShift (); |
1988 | + |
1989 | +protected: |
1990 | + |
1991 | + compiz::window::extents::Extents e; |
1992 | +}; |
1993 | + |
1994 | +CompWindowExtentsTestShift::CompWindowExtentsTestShift () |
1995 | +{ |
1996 | +} |
1997 | + |
1998 | +CompWindowExtentsTestShift::~CompWindowExtentsTestShift () |
1999 | +{ |
2000 | +} |
2001 | + |
2002 | +TEST_F (CompWindowExtentsTestShift, TestShift) |
2003 | +{ |
2004 | + CompPoint rp; |
2005 | + e.left = 5; |
2006 | + e.right = 7; |
2007 | + e.top = 10; |
2008 | + e.bottom = 7; |
2009 | + |
2010 | + /* Check each gravity */ |
2011 | + rp = compiz::window::extents::shift (e, NorthGravity); |
2012 | + |
2013 | + EXPECT_EQ (rp, CompPoint (0, e.top)); |
2014 | + |
2015 | + rp = compiz::window::extents::shift (e, NorthWestGravity); |
2016 | + |
2017 | + EXPECT_EQ (rp, CompPoint (e.left, e.top)); |
2018 | + |
2019 | + rp = compiz::window::extents::shift (e, NorthEastGravity); |
2020 | + |
2021 | + EXPECT_EQ (rp, CompPoint (-e.right, e.top)); |
2022 | + |
2023 | + rp = compiz::window::extents::shift (e, EastGravity); |
2024 | + |
2025 | + EXPECT_EQ (rp, CompPoint (-e.right, 0)); |
2026 | + |
2027 | + rp = compiz::window::extents::shift (e, WestGravity); |
2028 | + |
2029 | + EXPECT_EQ (rp, CompPoint (e.left, 0)); |
2030 | + |
2031 | + rp = compiz::window::extents::shift (e, SouthGravity); |
2032 | + |
2033 | + EXPECT_EQ (rp, CompPoint (0, -e.bottom)); |
2034 | + |
2035 | + rp = compiz::window::extents::shift (e, SouthWestGravity); |
2036 | + |
2037 | + EXPECT_EQ (rp, CompPoint (e.left, -e.bottom)); |
2038 | + |
2039 | + rp = compiz::window::extents::shift (e, SouthEastGravity); |
2040 | + |
2041 | + EXPECT_EQ (rp, CompPoint (-e.right, -e.bottom)); |
2042 | +} |
2043 | |
2044 | === added file 'src/window/extents/tests/test-window-extents.cpp' |
2045 | --- src/window/extents/tests/test-window-extents.cpp 1970-01-01 00:00:00 +0000 |
2046 | +++ src/window/extents/tests/test-window-extents.cpp 2012-01-11 08:48:40 +0000 |
2047 | @@ -0,0 +1,34 @@ |
2048 | +/* |
2049 | + * Copyright © 2011 Canonical Ltd. |
2050 | + * |
2051 | + * Permission to use, copy, modify, distribute, and sell this software |
2052 | + * and its documentation for any purpose is hereby granted without |
2053 | + * fee, provided that the above copyright notice appear in all copies |
2054 | + * and that both that copyright notice and this permission notice |
2055 | + * appear in supporting documentation, and that the name of |
2056 | + * Canonical Ltd. not be used in advertising or publicity pertaining to |
2057 | + * distribution of the software without specific, written prior permission. |
2058 | + * Canonical Ltd. makes no representations about the suitability of this |
2059 | + * software for any purpose. It is provided "as is" without express or |
2060 | + * implied warranty. |
2061 | + * |
2062 | + * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
2063 | + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN |
2064 | + * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
2065 | + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS |
2066 | + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
2067 | + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION |
2068 | + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
2069 | + * |
2070 | + * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com> |
2071 | + */ |
2072 | + |
2073 | +#include "test-window-extents.h" |
2074 | + |
2075 | +CompWindowExtentsTest::CompWindowExtentsTest () |
2076 | +{ |
2077 | +} |
2078 | + |
2079 | +CompWindowExtentsTest::~CompWindowExtentsTest () |
2080 | +{ |
2081 | +} |
2082 | |
2083 | === added file 'src/window/extents/tests/test-window-extents.h' |
2084 | --- src/window/extents/tests/test-window-extents.h 1970-01-01 00:00:00 +0000 |
2085 | +++ src/window/extents/tests/test-window-extents.h 2012-01-11 08:48:40 +0000 |
2086 | @@ -0,0 +1,42 @@ |
2087 | +/* |
2088 | + * Copyright © 2011 Canonical Ltd. |
2089 | + * |
2090 | + * Permission to use, copy, modify, distribute, and sell this software |
2091 | + * and its documentation for any purpose is hereby granted without |
2092 | + * fee, provided that the above copyright notice appear in all copies |
2093 | + * and that both that copyright notice and this permission notice |
2094 | + * appear in supporting documentation, and that the name of |
2095 | + * Canonical Ltd. not be used in advertising or publicity pertaining to |
2096 | + * distribution of the software without specific, written prior permission. |
2097 | + * Canonical Ltd. makes no representations about the suitability of this |
2098 | + * software for any purpose. It is provided "as is" without express or |
2099 | + * implied warranty. |
2100 | + * |
2101 | + * CANONICAL, LTD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
2102 | + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN |
2103 | + * NO EVENT SHALL CANONICAL, LTD. BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
2104 | + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS |
2105 | + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
2106 | + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION |
2107 | + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
2108 | + * |
2109 | + * Authored by: Sam Spilsbury <sam.spilsbury@canonical.com> |
2110 | + */ |
2111 | + |
2112 | +#ifndef _COMPIZ_TEST_WINDOW_EXTENTS_H |
2113 | +#define _COMPIZ_TEST_WINDOW_EXTENTS_H |
2114 | + |
2115 | +#include <gtest/gtest.h> |
2116 | +#include <core/windowextents.h> |
2117 | +#include <iostream> |
2118 | +#include <boost/bind.hpp> |
2119 | + |
2120 | +class CompWindowExtentsTest : public ::testing::Test |
2121 | +{ |
2122 | +public: |
2123 | + |
2124 | + CompWindowExtentsTest (); |
2125 | + virtual ~CompWindowExtentsTest (); |
2126 | +}; |
2127 | + |
2128 | +#endif |
2129 | |
2130 | === modified file 'src/window/geometry-saver/CMakeLists.txt' |
2131 | --- src/window/geometry-saver/CMakeLists.txt 2012-01-11 08:48:40 +0000 |
2132 | +++ src/window/geometry-saver/CMakeLists.txt 2012-01-11 08:48:40 +0000 |
2133 | @@ -15,6 +15,7 @@ |
2134 | ${GLIBMM_INCLUDE_DIRS} |
2135 | |
2136 | ${compiz_SOURCE_DIR}/src/window/geometry/include |
2137 | + ${compiz_SOURCE_DIR}/src/point/include |
2138 | ) |
2139 | |
2140 | LINK_DIRECTORIES (${GLIBMM_LIBRARY_DIRS}) |
2141 | |
2142 | === added file 'src/window/geometry-saver/tests/CMakeLists.txt' |
2143 | --- src/window/geometry-saver/tests/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
2144 | +++ src/window/geometry-saver/tests/CMakeLists.txt 2012-01-11 08:48:40 +0000 |
2145 | @@ -0,0 +1,18 @@ |
2146 | +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
2147 | + |
2148 | +add_library (compiz_window_geometry_saver_test |
2149 | + ${CMAKE_CURRENT_SOURCE_DIR}/test-window-geometry-saver.cpp) |
2150 | + |
2151 | +add_executable (compiz_test_window_geometry_saver |
2152 | + ${CMAKE_CURRENT_SOURCE_DIR}/window-geometry-saver/src/test-window-geometry-saver.cpp) |
2153 | + |
2154 | +target_link_libraries (compiz_test_window_geometry_saver |
2155 | + compiz_window_geometry_saver_test |
2156 | + compiz_window_geometry_saver |
2157 | + ${GTEST_BOTH_LIBRARIES} |
2158 | + ${GMOCK_LIBRARY} |
2159 | + ${GMOCK_MAIN_LIBRARY} |
2160 | + ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
2161 | + ) |
2162 | + |
2163 | +add_test (compiz_window_geometry_saver compiz_test_window_geometry_saver) |
2164 | |
2165 | === modified file 'src/window/geometry/CMakeLists.txt' |
2166 | --- src/window/geometry/CMakeLists.txt 2012-01-11 08:48:40 +0000 |
2167 | +++ src/window/geometry/CMakeLists.txt 2012-01-11 08:48:40 +0000 |
2168 | @@ -9,7 +9,8 @@ |
2169 | ${CMAKE_CURRENT_SOURCE_DIR}/src |
2170 | |
2171 | ${compiz_SOURCE_DIR}/include |
2172 | - |
2173 | + ${compiz_SOURCE_DIR}/src/point/include |
2174 | + |
2175 | ${Boost_INCLUDE_DIRS} |
2176 | |
2177 | ${GLIBMM_INCLUDE_DIRS} |
2178 | @@ -60,6 +61,7 @@ |
2179 | |
2180 | TARGET_LINK_LIBRARIES( |
2181 | compiz_window_geometry |
2182 | + compiz_point |
2183 | |
2184 | ${GLIBMM_LIBRARIES} |
2185 | ) |
2186 | |
2187 | === added file 'src/window/geometry/tests/CMakeLists.txt' |
2188 | --- src/window/geometry/tests/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
2189 | +++ src/window/geometry/tests/CMakeLists.txt 2012-01-11 08:48:40 +0000 |
2190 | @@ -0,0 +1,18 @@ |
2191 | +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
2192 | + |
2193 | +add_library (compiz_window_geometry_test |
2194 | + ${CMAKE_CURRENT_SOURCE_DIR}/test-window-geometry.cpp) |
2195 | + |
2196 | +add_executable (compiz_test_window_geometry |
2197 | + ${CMAKE_CURRENT_SOURCE_DIR}/window-geometry/src/test-window-geometry.cpp) |
2198 | + |
2199 | +target_link_libraries (compiz_test_window_geometry |
2200 | + compiz_window_geometry_test |
2201 | + compiz_window_geometry |
2202 | + ${GTEST_BOTH_LIBRARIES} |
2203 | + ${GMOCK_LIBRARY} |
2204 | + ${GMOCK_MAIN_LIBRARY} |
2205 | + ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. |
2206 | + ) |
2207 | + |
2208 | +add_test (compiz_window_geometry compiz_test_window_geometry) |
Make the decor plugin work with paint offsets.
Moved getting the shift distance due to window gravity into a utility function in core and made it so that whenever a plugin tries to change the frame extents of a window, this will always update the saved co-ordinates of maximized windows so that they restore to the correct position if their frame extents change while they are maximized (eg, the unity case)