Merge lp:~compiz-team/compiz/compiz.fix_1195522 into lp:compiz/0.9.10
- compiz.fix_1195522
- Merge into 0.9.10
Status: | Merged |
---|---|
Approved by: | Brandon Schaefer |
Approved revision: | 3755 |
Merged at revision: | 3751 |
Proposed branch: | lp:~compiz-team/compiz/compiz.fix_1195522 |
Merge into: | lp:compiz/0.9.10 |
Diff against target: |
2357 lines (+758/-645) 24 files modified
.bzrignore (+1/-0) plugins/decor/src/decor.cpp (+47/-132) plugins/decor/src/decor.h (+5/-1) plugins/decor/tests/acceptance/xorg-gtest/CMakeLists.txt (+1/-1) plugins/decor/tests/acceptance/xorg-gtest/compiz_decor_acceptance_tests.cpp (+74/-212) plugins/move/src/move.cpp (+19/-9) plugins/opengl/src/paint.cpp (+1/-1) plugins/place/src/constrain-to-workarea/include/constrain-to-workarea.h (+3/-6) plugins/place/src/constrain-to-workarea/src/constrain-to-workarea.cpp (+25/-49) plugins/place/src/constrain-to-workarea/tests/constrain-to-workarea/src/test-place-constrain-to-workarea.cpp (+4/-57) plugins/place/src/place.cpp (+15/-16) src/event.cpp (+7/-2) src/plugin.cpp (+15/-2) src/plugin/tests/test-plugin.cpp (+40/-0) src/window.cpp (+71/-58) src/window/extents/src/windowextents.cpp (+10/-0) tests/manual/README.txt (+9/-0) tests/manual/plugins/decor.txt (+40/-0) tests/system/xorg-gtest/tests/compiz_xorg_gtest_configure_window.cpp (+91/-73) tests/xorg-gtest/CMakeLists.txt (+2/-1) tests/xorg-gtest/include/compiz-xorg-gtest.h (+79/-3) tests/xorg-gtest/plugins/testhelper/src/testhelper.cpp (+5/-8) tests/xorg-gtest/src/compiz-xorg-gtest-config.h.in (+2/-1) tests/xorg-gtest/src/compiz-xorg-gtest.cpp (+192/-13) |
To merge this branch: | bzr merge lp:~compiz-team/compiz/compiz.fix_1195522 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
MC Return | Approve | ||
Brandon Schaefer (community) | Approve | ||
Andrea Azzarone | Pending | ||
Compiz Maintainers | Pending | ||
Review via email:
|
Commit message
Unrevert 3728, fix failing tests.
Change the behaviour of undecorating windows.
Previously when a window was undecorated, we would shift it back to an appropriate position according to its gravity member. That behaviour was problematic because in the StaticGravity case the window has to just stay in the same place. But then if you had a window with StaticGravity which then did get a decoration and later removed it, it would be placed as though it was decorated and appear to be in the wrong place.
The correct behaviour is to place all windows as though they have decorations, and then when decorations are removed, to move the window back to the corner as indicated in its gravity and then expand its size to cover the obscured regions no longer hidden because the decorations went away.
(LP: #1165343).
1. Completely remove decorOffsetMove and other related code from
decor.cpp. Put the logic to handle the window->input () - window->border ()
placement offset inside of setWindowFrameE
will always be offset from its original non-decorated position to the new
decorated position, rather than having to guess between decoration sizes.
2. Make saveGeometry and restoreGeometry work relative to window->border ()
as opposed to including it in the saved geometry. It is possible that the
border size might change during maximization, as such, we don't want to
save the position with the border before maximizing. Instead save the position
as if it were never decorated so that when the window is restored it can be
restored to its original position and then adjusted for its new border size.
3. Fix a few typoes in the tests.
4. Moved some commonly used matchers into compiz::testing
5. Make COMPIZ_PLUGIN_DIR accept multiple directories and look in each one
of them for the plugin
6. Set COMPIZ_PLUGIN_DIR appropriately for each plugin that we wish to load
on startup so that we load locally built plugins as opposed to installed
ones.
7. Uncomment compiz_
run by default.
(LP: #1195522)
Description of the change
Unrevert 3728, fix failing tests.
Change the behaviour of undecorating windows.
Previously when a window was undecorated, we would shift it back to an appropriate position according to its gravity member. That behaviour was problematic because in the StaticGravity case the window has to just stay in the same place. But then if you had a window with StaticGravity which then did get a decoration and later removed it, it would be placed as though it was decorated and appear to be in the wrong place.
The correct behaviour is to place all windows as though they have decorations, and then when decorations are removed, to move the window back to the corner as indicated in its gravity and then expand its size to cover the obscured regions no longer hidden because the decorations went away.
(LP: #1165343).
1. Completely remove decorOffsetMove and other related code from
decor.cpp. Put the logic to handle the window->input () - window->border ()
placement offset inside of setWindowFrameE
will always be offset from its original non-decorated position to the new
decorated position, rather than having to guess between decoration sizes.
2. Make saveGeometry and restoreGeometry work relative to window->border ()
as opposed to including it in the saved geometry. It is possible that the
border size might change during maximization, as such, we don't want to
save the position with the border before maximizing. Instead save the position
as if it were never decorated so that when the window is restored it can be
restored to its original position and then adjusted for its new border size.
3. Fix a few typoes in the tests.
4. Moved some commonly used matchers into compiz::testing
5. Make COMPIZ_PLUGIN_DIR accept multiple directories and look in each one
of them for the plugin
6. Set COMPIZ_PLUGIN_DIR appropriately for each plugin that we wish to load
on startup so that we load locally built plugins as opposed to installed
ones.
7. Uncomment compiz_
run by default.
(LP: #1195522)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Sam Spilsbury (smspillaz) wrote : | # |
> 368 + int GetEventMask ();
>
> Const?
Yeah, I can fix that, cheers.
>
> The following tests FAILED:
> 1481 - PixmapDecorated
> (Failed)
> 1482 -
> PixmapDecorated
> 1483 -
> PixmapDecorated
> 1484 -
> PixmapDecorated
> 1485 -
> PixmapDecorated
> (Failed)
> 1486 -
> PixmapDecorated
> (Failed)
> 1487 -
> PixmapDecorated
> 1488 -
> PixmapDecorated
> (Failed)
> 1489 -
> PixmapDecorated
> 1490 - PixmapDecorated
> (Failed)
>
> Note this is just with a compiled branch...though it shoudn't depend on if I
> have the branch running or not if they are unit tests.
>
> Start 1451: AdjustmentExten
> dWindowBorderSh
>
> This test hangs sometimes forever. (At lease as far as im willing to let it
> sit :)
>
> Start 1485:
> PixmapDecorated
>
> Then this wont hung...as well as some others :)...not entirely sure why.
>
> Still have some more reviewing to go :)
I've had some trouble with llvmpipe hanging on the tests. My plan is to make decor not depend on opengl and drop in a "fakecompositor" plugin instead which allows us to use the pixmap decorations without drawing anything.
... try running them when your system has cooled off a bit. I'll remove my local installation and check if there's some kind of hidden dependency but there shouldn't be.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
MC Return (mc-return) wrote : | # |
Thanks a lot for this, Sam.
Your last version in r3278 already brought massive improvements, especially when running Emerald.
I am quite sure that this one will finally get rid of all decor problems.
Will test this ASAP.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
MC Return (mc-return) wrote : | # |
First review:
726 + /* As the window is shrunk to accomadate the border size, we must subtract
should be (typo):
726 + /* As the window is shrunk to accommodate the border size, we must subtract
===
738 + ct::WINDOW_WIDTH - shrink.width () + size.width (),
739 + ct::WINDOW_HEIGHT - shrink.height () + size.height ());
795 + ct::WINDOW_WIDTH - shrink.width () + size.width (),
796 + ct::WINDOW_HEIGHT - shrink.height () + size.height (),
I would align those (just a suggestion, no real need to fix):
738 + ct::WINDOW_WIDTH - shrink.width () + size.width (),
739 + ct::WINDOW_HEIGHT - shrink.height () + size.height ());
===
You could remove the brackets here:
832 + xwc.x = xRoot - (width / 2);
855 + xwc.x = xRoot - (width / 2);
===
I guess this was just an indentation fix ?
871 - gw->priv-
872 + gw->priv-
===
The rest LGTM also.
As this touches many source-files it is not really easy to manually test though, but the old version of this was already great and now this additionally has massive test coverage, so "Approve" from me.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3751
http://
Executed test runs:
None: http://
FAILURE: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Sam Spilsbury (smspillaz) wrote : | # |
> First review:
>
> 726 + /* As the window is shrunk to accomadate the border size, we must
> subtract
>
> should be (typo):
>
> 726 + /* As the window is shrunk to accommodate the border size, we
> must subtract
Fixed.
>
> I guess this was just an indentation fix ?
>
> 871 - gw->priv-
> 872 + gw->priv-
>
> ===
Pretty much
>
> The rest LGTM also.
> As this touches many source-files it is not really easy to manually test
> though, but the old version of this was already great and now this
> additionally has massive test coverage, so "Approve" from me.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Sam Spilsbury (smspillaz) wrote : | # |
Note: I've removed the acceptance tests from the CI target as llvmpipe does not work correctly there. We'll re-enable them once we can run the tests without llvmpipe.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
MC Return (mc-return) wrote : | # |
I would say -> let's give it a try.
With the PPAs in place we will notice possible regressions early and can combat them then, if any will occur, which I doubt to happen...
The final decision to merge is yours. +1 from me. :)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
MC Return (mc-return) wrote : | # |
One note:
If r3747 of this MP ( http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
Your branch hates me:
The following tests FAILED:
1481 - PixmapDecorated
1482 - PixmapDecorated
1483 - PixmapDecorated
1484 - PixmapDecorated
1485 - PixmapDecorated
1486 - PixmapDecorated
1487 - PixmapDecorated
1488 - PixmapDecorated
1489 - PixmapDecorated
1490 - PixmapDecorated
1494 - CompizXorgSyste
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
I need to fix my system up though...
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Brandon Schaefer (brandontschaefer) wrote : | # |
After talking with Sam its turning out that the tests failures are due to llvmpipe and some timeout problems. Since this branch fixes some blockers, and each failing tests passes when ran individually, Im approving this branch.
The tests do need to be fixed up, but lets get the blockers fixed first :)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
- 3755. By Sam Spilsbury
-
Fix typo
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
MC Return (mc-return) : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3752
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3755
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === added file '.bzrignore' |
2 | --- .bzrignore 1970-01-01 00:00:00 +0000 |
3 | +++ .bzrignore 2013-06-29 07:09:28 +0000 |
4 | @@ -0,0 +1,1 @@ |
5 | +.bzr-repo |
6 | |
7 | === modified file 'plugins/decor/src/decor.cpp' |
8 | --- plugins/decor/src/decor.cpp 2013-06-07 05:51:45 +0000 |
9 | +++ plugins/decor/src/decor.cpp 2013-06-29 07:09:28 +0000 |
10 | @@ -1147,31 +1147,6 @@ |
11 | } |
12 | |
13 | /* |
14 | - * decorOffsetMove |
15 | - * |
16 | - * Function called on a timer (to avoid calling configureXWindow from |
17 | - * within a ::moveNotify) which actually moves the window by the offset |
18 | - * specified in the xwc. Also sends a notification that the window |
19 | - * was decorated |
20 | - * |
21 | - */ |
22 | -static bool |
23 | -decorOffsetMove (CompWindow *w, XWindowChanges xwc, unsigned int mask) |
24 | -{ |
25 | - CompOption::Vector o (1); |
26 | - |
27 | - o.at (0).setName ("window", CompOption::TypeInt); |
28 | - o.at (0).value ().set ((int) w->id ()); |
29 | - |
30 | - xwc.x += w->serverGeometry ().x (); |
31 | - xwc.y += w->serverGeometry ().y (); |
32 | - |
33 | - w->configureXWindow (mask, &xwc); |
34 | - screen->handleCompizEvent ("decor", "window_decorated", o); |
35 | - return false; |
36 | -} |
37 | - |
38 | -/* |
39 | * DecorWindow::matchType |
40 | * |
41 | * Converts libdecoration window types packed |
42 | @@ -1507,60 +1482,6 @@ |
43 | return decoration; |
44 | } |
45 | |
46 | -void |
47 | -DecorWindow::moveDecoratedWindowBy (const CompPoint &movement, |
48 | - bool instant) |
49 | -{ |
50 | - /* Need to actually move the window */ |
51 | - if (window->placed () && !window->overrideRedirect () && |
52 | - (movement.x () || movement.y ())) |
53 | - { |
54 | - XWindowChanges xwc; |
55 | - unsigned int mask = CWX | CWY; |
56 | - |
57 | - memset (&xwc, 0, sizeof (XWindowChanges)); |
58 | - |
59 | - /* Grab the geometry last sent to server at configureXWindow |
60 | - * time and not here since serverGeometry may be updated by |
61 | - * the time that we do call configureXWindow */ |
62 | - xwc.x = movement.x (); |
63 | - xwc.y = movement.y (); |
64 | - |
65 | - /* Except if it's fullscreen, maximized or such */ |
66 | - if (window->state () & CompWindowStateFullscreenMask) |
67 | - mask &= ~(CWX | CWY); |
68 | - |
69 | - if (window->state () & CompWindowStateMaximizedHorzMask) |
70 | - mask &= ~CWX; |
71 | - |
72 | - if (window->state () & CompWindowStateMaximizedVertMask) |
73 | - mask &= ~CWY; |
74 | - |
75 | - if (window->saveMask () & CWX) |
76 | - window->saveWc ().x += movement.x (); |
77 | - |
78 | - if (window->saveMask () & CWY) |
79 | - window->saveWc ().y += movement.y (); |
80 | - |
81 | - if (mask) |
82 | - { |
83 | - /* instant is only true in the case of |
84 | - * the destructor calling the update function so since it |
85 | - * is not safe to put the function in a timer (since |
86 | - * it will get unref'd on the vtable destruction) we |
87 | - * need to do it immediately |
88 | - * |
89 | - * FIXME: CompTimer should really be PIMPL and allow |
90 | - * refcounting in case we need to keep it alive |
91 | - */ |
92 | - if (instant) |
93 | - decorOffsetMove (window, xwc, mask); |
94 | - else |
95 | - moveUpdate.start (boost::bind (decorOffsetMove, window, xwc, mask), 0); |
96 | - } |
97 | - } |
98 | -} |
99 | - |
100 | namespace |
101 | { |
102 | bool |
103 | @@ -1568,14 +1489,30 @@ |
104 | bool shadowOnly, |
105 | bool isSwitcher) |
106 | { |
107 | - const bool visible = (w->frame () || |
108 | + const bool frameOrUnmapReference = (w->frame () || |
109 | w->hasUnmapReference ()); |
110 | - const bool realDecoration = visible && !shadowOnly; |
111 | + const bool realDecoration = frameOrUnmapReference && !shadowOnly; |
112 | const bool forceDecoration = isSwitcher; |
113 | |
114 | return realDecoration || forceDecoration; |
115 | } |
116 | -} |
117 | + |
118 | +/* |
119 | + * notifyDecoration |
120 | + * |
121 | + * Notify other plugins that the window is now fully decorated |
122 | + */ |
123 | +void notifyDecoration (CompWindow *window) |
124 | +{ |
125 | + CompOption::Vector o (1); |
126 | + |
127 | + o.at (0).setName ("window", CompOption::TypeInt); |
128 | + o.at (0).value ().set ((int) window->id ()); |
129 | + |
130 | + screen->handleCompizEvent ("decor", "window_decorated", o); |
131 | +} |
132 | +} |
133 | + |
134 | /* |
135 | * DecorWindow::update |
136 | * This is the master function for managing decorations on windows |
137 | @@ -1616,7 +1553,8 @@ |
138 | DecorWindow::update (bool allowDecoration) |
139 | { |
140 | Decoration::Ptr old, decoration; |
141 | - CompPoint oldShift, movement; |
142 | + CompPoint movement; |
143 | + CompSize sizeDelta; |
144 | |
145 | if (wd) |
146 | old = wd->decor; |
147 | @@ -1625,6 +1563,7 @@ |
148 | |
149 | bool shadowOnly = bareDecorationOnly (); |
150 | bool decorate = shouldDecorateWindow (window, shadowOnly, isSwitcher); |
151 | + unsigned int decorMaximizeState = window->state () & MAXIMIZE_STATE; |
152 | |
153 | if (decorate || frameExtentsRequested) |
154 | { |
155 | @@ -1647,16 +1586,13 @@ |
156 | /* Don't bother going any further if |
157 | * this window is going to get the same |
158 | * decoration, just use the old one */ |
159 | - if (decoration == old) |
160 | + if (decoration == old && |
161 | + lastMaximizedStateDecorated == decorMaximizeState) |
162 | return false; |
163 | |
164 | - /* Determine how much we moved the window for the old |
165 | - * decoration and save that, also destroy the old |
166 | - * WindowDecoration */ |
167 | + /* Destroy the old WindowDecoration */ |
168 | if (old) |
169 | { |
170 | - oldShift = cwe::shift (window->border (), window->sizeHints ().win_gravity); |
171 | - |
172 | WindowDecoration::destroy (wd); |
173 | wd = NULL; |
174 | } |
175 | @@ -1672,13 +1608,15 @@ |
176 | /* Set extents based on maximize/unmaximize state |
177 | * FIXME: With the new type system, this should be |
178 | * removed */ |
179 | - if ((window->state () & MAXIMIZE_STATE)) |
180 | + if (decorMaximizeState) |
181 | window->setWindowFrameExtents (&decoration->maxBorder, |
182 | &decoration->maxInput); |
183 | else if (!window->hasUnmapReference ()) |
184 | window->setWindowFrameExtents (&decoration->border, |
185 | &decoration->input); |
186 | |
187 | + lastMaximizedStateDecorated = decorMaximizeState; |
188 | + |
189 | /* This window actually needs its decoration contents updated |
190 | * as it was actually visible */ |
191 | if (decorate || |
192 | @@ -1694,9 +1632,6 @@ |
193 | return false; |
194 | } |
195 | |
196 | - movement = cwe::shift (window->border (), window->sizeHints ().win_gravity); |
197 | - movement -= oldShift; |
198 | - |
199 | window->updateWindowOutputExtents (); |
200 | |
201 | updateReg = true; |
202 | @@ -1724,8 +1659,6 @@ |
203 | memset (&emptyExtents, 0, sizeof (CompWindowExtents)); |
204 | |
205 | window->setWindowFrameExtents (&emptyExtents, &emptyExtents); |
206 | - |
207 | - movement -= oldShift; |
208 | } |
209 | |
210 | /* We need to damage the current output extents |
211 | @@ -1738,8 +1671,7 @@ |
212 | updateGroupShadows (); |
213 | } |
214 | |
215 | - moveDecoratedWindowBy (movement, |
216 | - !allowDecoration); |
217 | + notifyDecoration (window); |
218 | |
219 | return true; |
220 | } |
221 | @@ -2280,6 +2212,20 @@ |
222 | } |
223 | |
224 | /* |
225 | + * DecorWindow::place |
226 | + * |
227 | + * Update any windows just before placement |
228 | + * so that placement algorithms will have the |
229 | + * border size at place-time |
230 | + */ |
231 | +bool |
232 | +DecorWindow::place (CompPoint &pos) |
233 | +{ |
234 | + update (true); |
235 | + return window->place (pos); |
236 | +} |
237 | + |
238 | +/* |
239 | * DecorWindow::windowNotify |
240 | * |
241 | * Window event notification handler. On various |
242 | @@ -2924,13 +2870,7 @@ |
243 | shading = false; |
244 | unshading = false; |
245 | } |
246 | - /* FIXME: we should not need a timer for calling decorWindowUpdate, |
247 | - and only call updateWindowDecorationScale if decorWindowUpdate |
248 | - returns false. Unfortunately, decorWindowUpdate may call |
249 | - updateWindowOutputExtents, which may call WindowResizeNotify. As |
250 | - we never should call a wrapped function that's currently |
251 | - processed, we need the timer for the moment. updateWindowOutputExtents |
252 | - should be fixed so that it does not emit a resize notification. */ |
253 | + |
254 | updateMatrix = true; |
255 | updateReg = true; |
256 | |
257 | @@ -2955,33 +2895,7 @@ |
258 | void |
259 | DecorWindow::stateChangeNotify (unsigned int lastState) |
260 | { |
261 | - if (wd && wd->decor) |
262 | - { |
263 | - CompPoint oldShift = compiz::window::extents::shift (window->border (), window->sizeHints ().win_gravity); |
264 | - |
265 | - |
266 | - if ((window->state () & MAXIMIZE_STATE)) |
267 | - window->setWindowFrameExtents (&wd->decor->maxBorder, |
268 | - &wd->decor->maxInput); |
269 | - else |
270 | - window->setWindowFrameExtents (&wd->decor->border, |
271 | - &wd->decor->input); |
272 | - |
273 | - /* Since we immediately update the frame extents, we must |
274 | - * also update the stored saved window geometry in order |
275 | - * to prevent the window from shifting back too far once |
276 | - * unmaximized */ |
277 | - |
278 | - CompPoint movement = compiz::window::extents::shift (window->border (), window->sizeHints ().win_gravity) - oldShift; |
279 | - |
280 | - if (window->saveMask () & CWX) |
281 | - window->saveWc ().x += movement.x (); |
282 | - |
283 | - if (window->saveMask () & CWY) |
284 | - window->saveWc ().y += movement.y (); |
285 | - |
286 | - updateFrame (); |
287 | - } |
288 | + update (true); |
289 | |
290 | window->stateChangeNotify (lastState); |
291 | } |
292 | @@ -3218,7 +3132,8 @@ |
293 | mClipGroup (NULL), |
294 | mOutputRegion (window->outputRect ()), |
295 | mInputRegion (window->inputRect ()), |
296 | - mRequestor (screen->dpy (), w->id (), &decor) |
297 | + mRequestor (screen->dpy (), w->id (), &decor), |
298 | + lastMaximizedStateDecorated (0) |
299 | { |
300 | WindowInterface::setHandler (window); |
301 | |
302 | |
303 | === modified file 'plugins/decor/src/decor.h' |
304 | --- plugins/decor/src/decor.h 2013-06-07 05:51:45 +0000 |
305 | +++ plugins/decor/src/decor.h 2013-06-29 07:09:28 +0000 |
306 | @@ -293,6 +293,8 @@ |
307 | |
308 | bool damageRect (bool, const CompRect &); |
309 | |
310 | + bool place (CompPoint &pos); |
311 | + |
312 | bool glDraw (const GLMatrix &, const GLWindowPaintAttrib &, |
313 | const CompRegion &, unsigned int); |
314 | void glDecorate (const GLMatrix &, const GLWindowPaintAttrib &, |
315 | @@ -380,13 +382,15 @@ |
316 | |
317 | X11DecorPixmapRequestor mRequestor; |
318 | |
319 | + unsigned int lastMaximizedStateDecorated; |
320 | + |
321 | private: |
322 | |
323 | bool bareDecorationOnly (); |
324 | Decoration::Ptr findRealDecoration (); |
325 | Decoration::Ptr findBareDecoration (); |
326 | void moveDecoratedWindowBy (const CompPoint &movement, |
327 | - bool instant); |
328 | + const CompSize &sizeDelta); |
329 | }; |
330 | |
331 | class DecorPluginVTable : |
332 | |
333 | === modified file 'plugins/decor/tests/acceptance/xorg-gtest/CMakeLists.txt' |
334 | --- plugins/decor/tests/acceptance/xorg-gtest/CMakeLists.txt 2013-06-22 12:27:36 +0000 |
335 | +++ plugins/decor/tests/acceptance/xorg-gtest/CMakeLists.txt 2013-06-29 07:09:28 +0000 |
336 | @@ -31,7 +31,7 @@ |
337 | target_link_libraries (compiz_test_decor_acceptance |
338 | ${COMPIZ_DECOR_ACCEPTANCE_TEST_LIBRARIES}) |
339 | |
340 | - # Not run by default yet until we're able to load plugins locally |
341 | + # Disabled until the tests can be run without opengl |
342 | #compiz_discover_tests (compiz_test_decor_acceptance WITH_XORG_GTEST) |
343 | |
344 | endif (BUILD_XORG_GTEST) |
345 | |
346 | === modified file 'plugins/decor/tests/acceptance/xorg-gtest/compiz_decor_acceptance_tests.cpp' |
347 | --- plugins/decor/tests/acceptance/xorg-gtest/compiz_decor_acceptance_tests.cpp 2013-06-22 14:31:25 +0000 |
348 | +++ plugins/decor/tests/acceptance/xorg-gtest/compiz_decor_acceptance_tests.cpp 2013-06-29 07:09:28 +0000 |
349 | @@ -57,6 +57,10 @@ |
350 | using ::testing::WithParamInterface; |
351 | using ::testing::_; |
352 | |
353 | +using ::compiz::testing::HasGeometry; |
354 | +using ::compiz::testing::RelativeWindowGeometry; |
355 | +using ::compiz::testing::AbsoluteWindowGeometry; |
356 | + |
357 | class BaseDecorAcceptance : |
358 | public ct::AutostartCompizXorgSystemTestWithTestHelper |
359 | { |
360 | @@ -78,6 +82,10 @@ |
361 | Atom mDecorationTypeWindow; |
362 | Atom mDecorationInputFrameAtom; |
363 | Atom mDecorationOutputFrameAtom; |
364 | + |
365 | + private: |
366 | + |
367 | + int GetEventMask () const; |
368 | }; |
369 | |
370 | BaseDecorAcceptance::BaseDecorAcceptance () : |
371 | @@ -92,6 +100,13 @@ |
372 | { |
373 | } |
374 | |
375 | +int |
376 | +BaseDecorAcceptance::GetEventMask () const |
377 | +{ |
378 | + return ct::AutostartCompizXorgSystemTestWithTestHelper::GetEventMask () | |
379 | + SubstructureNotifyMask; |
380 | +} |
381 | + |
382 | void |
383 | BaseDecorAcceptance::SetUp () |
384 | { |
385 | @@ -151,9 +166,12 @@ |
386 | ct::CompizProcess::PluginList baseList (Base::GetPluginList ()); |
387 | ct::CompizProcess::PluginList list; |
388 | |
389 | - list.push_back ("composite"); |
390 | - list.push_back ("opengl"); |
391 | - list.push_back ("decor"); |
392 | + list.push_back (ct::CompizProcess::Plugin ("composite", |
393 | + ct::CompizProcess::Real)); |
394 | + list.push_back (ct::CompizProcess::Plugin ("opengl", |
395 | + ct::CompizProcess::Real)); |
396 | + list.push_back (ct::CompizProcess::Plugin ("decor", |
397 | + ct::CompizProcess::Real)); |
398 | |
399 | for (ct::CompizProcess::PluginList::iterator it = baseList.begin (); |
400 | it != baseList.end (); |
401 | @@ -1122,17 +1140,13 @@ |
402 | height, |
403 | mask); |
404 | |
405 | - /* The use of the timeout is currently because some functionality |
406 | - * is broken which would cause these barrier conditions to never |
407 | - * eventuate. For now just get to the fail condition */ |
408 | Advance (display, |
409 | ct::WaitForEventOfTypeOnWindowMatching (display, |
410 | window, |
411 | ConfigureNotify, |
412 | -1, |
413 | -1, |
414 | - matcher, |
415 | - 1000)); |
416 | + matcher)); |
417 | } |
418 | |
419 | void WaitForFrameExtents (Display *dpy, |
420 | @@ -1729,9 +1743,6 @@ |
421 | Window window, |
422 | const FakeDecorPtr &decor) |
423 | { |
424 | - /* Wait for the frame extents to change */ |
425 | - WaitForPropertyNotify (display, window, "_NET_FRAME_EXTENTS"); |
426 | - |
427 | const CompPoint &framePos (decor->restoredFrameWindowOffset ()); |
428 | |
429 | /* Wait for the ConfigureNotify on the frame window |
430 | @@ -1743,6 +1754,9 @@ |
431 | 0, |
432 | 0, |
433 | CWX | CWY); |
434 | + |
435 | + /* Wait for the frame extents to change */ |
436 | + WaitForPropertyNotify (display, window, "_NET_FRAME_EXTENTS"); |
437 | } |
438 | |
439 | void |
440 | @@ -1802,6 +1816,8 @@ |
441 | { |
442 | public: |
443 | |
444 | + PixmapDecoratedWindowAcceptance (); |
445 | + |
446 | virtual void SetUp (); |
447 | virtual void TearDown (); |
448 | |
449 | @@ -1809,12 +1825,19 @@ |
450 | |
451 | protected: |
452 | |
453 | + unsigned int RealDecorationActiveBorderExtent; |
454 | + |
455 | Window mTestWindow; |
456 | Window mTestWindowParent; |
457 | |
458 | cdt::FakePixmapTypeDecoration::Ptr mTestWindowDecoration; |
459 | }; |
460 | |
461 | +PixmapDecoratedWindowAcceptance::PixmapDecoratedWindowAcceptance () : |
462 | + RealDecorationActiveBorderExtent (ActiveBorderExtent + 1) |
463 | +{ |
464 | +} |
465 | + |
466 | void |
467 | PixmapDecoratedWindowAcceptance::SetUp () |
468 | { |
469 | @@ -1828,7 +1851,9 @@ |
470 | /* Start the decorator */ |
471 | SetUpDecorator (); |
472 | |
473 | - unsigned int ResBo = ActiveBorderExtent; |
474 | + /* We need to change the border extent so that the window |
475 | + * will move from its position in the default decoration */ |
476 | + unsigned int ResBo = RealDecorationActiveBorderExtent; |
477 | unsigned int ResIn = ActiveInputExtent; |
478 | unsigned int MaxEx = MaximizedBorderExtent; |
479 | |
480 | @@ -2077,167 +2102,6 @@ |
481 | |
482 | namespace |
483 | { |
484 | -void RelativeWindowGeometry (Display *dpy, |
485 | - Window w, |
486 | - int &x, |
487 | - int &y, |
488 | - unsigned int &width, |
489 | - unsigned int &height, |
490 | - unsigned int &border) |
491 | -{ |
492 | - Window root; |
493 | - unsigned int depth; |
494 | - |
495 | - if (!XGetGeometry (dpy, w, &root, &x, &y, &width, &height, &border, &depth)) |
496 | - throw std::logic_error ("XGetGeometry failed"); |
497 | -} |
498 | - |
499 | -void AbsoluteWindowGeometry (::Display *display, |
500 | - Window window, |
501 | - int &x, |
502 | - int &y, |
503 | - unsigned int &width, |
504 | - unsigned int &height, |
505 | - unsigned int &border) |
506 | -{ |
507 | - Window root; |
508 | - Window child; |
509 | - unsigned int depth; |
510 | - |
511 | - if (!XGetGeometry (display, window, &root, |
512 | - &x, &y, &width, &height, |
513 | - &border, &depth)) |
514 | - throw std::logic_error ("XGetGeometry failed"); |
515 | - |
516 | - if (!XTranslateCoordinates (display, window, root, x, y, |
517 | - &x, &y, &child)) |
518 | - throw std::logic_error ("XTranslateCoordinates failed"); |
519 | -} |
520 | - |
521 | -typedef void (*RetrievalFunc) (Display *dpy, |
522 | - Window window, |
523 | - int &x, |
524 | - int &y, |
525 | - unsigned int &width, |
526 | - unsigned int &height, |
527 | - unsigned int &border); |
528 | - |
529 | -class WindowGeometryMatcher : |
530 | - public MatcherInterface <Window> |
531 | -{ |
532 | - public: |
533 | - |
534 | - WindowGeometryMatcher (Display *dpy, |
535 | - RetrievalFunc func, |
536 | - const Matcher <int> &x, |
537 | - const Matcher <int> &y, |
538 | - const Matcher <unsigned int> &width, |
539 | - const Matcher <unsigned int> &height, |
540 | - const Matcher <unsigned int> &border); |
541 | - |
542 | - bool MatchAndExplain (Window x, MatchResultListener *listener) const; |
543 | - void DescribeTo (std::ostream *os) const; |
544 | - |
545 | - private: |
546 | - |
547 | - Display *mDpy; |
548 | - |
549 | - RetrievalFunc mFunc; |
550 | - |
551 | - Matcher <int> mX; |
552 | - Matcher <int> mY; |
553 | - Matcher <unsigned int> mWidth; |
554 | - Matcher <unsigned int> mHeight; |
555 | - Matcher <unsigned int> mBorder; |
556 | -}; |
557 | - |
558 | -Matcher <Window> |
559 | -HasGeometry (Display *dpy, |
560 | - RetrievalFunc func, |
561 | - const Matcher <int> &x, |
562 | - const Matcher <int> &y, |
563 | - const Matcher <unsigned int> &width, |
564 | - const Matcher <unsigned int> &height, |
565 | - const Matcher <unsigned int> &border) |
566 | -{ |
567 | - return MakeMatcher (new WindowGeometryMatcher (dpy, |
568 | - func, |
569 | - x, |
570 | - y, |
571 | - width, |
572 | - height, |
573 | - border)); |
574 | -} |
575 | -} |
576 | - |
577 | -WindowGeometryMatcher::WindowGeometryMatcher (Display *dpy, |
578 | - RetrievalFunc func, |
579 | - const Matcher <int> &x, |
580 | - const Matcher <int> &y, |
581 | - const Matcher <unsigned int> &width, |
582 | - const Matcher <unsigned int> &height, |
583 | - const Matcher <unsigned int> &border) : |
584 | - mDpy (dpy), |
585 | - mFunc (func), |
586 | - mX (x), |
587 | - mY (y), |
588 | - mWidth (width), |
589 | - mHeight (height), |
590 | - mBorder (border) |
591 | -{ |
592 | -} |
593 | - |
594 | -bool |
595 | -WindowGeometryMatcher::MatchAndExplain (Window w, |
596 | - MatchResultListener *listener) const |
597 | -{ |
598 | - int x, y; |
599 | - unsigned int width, height, border; |
600 | - |
601 | - mFunc (mDpy, w, x, y, width, height, border); |
602 | - |
603 | - bool match = mX.MatchAndExplain (x, listener) && |
604 | - mY.MatchAndExplain (y, listener) && |
605 | - mWidth.MatchAndExplain (width, listener) && |
606 | - mHeight.MatchAndExplain (height, listener) && |
607 | - mBorder.MatchAndExplain (border, listener); |
608 | - |
609 | - if (!match) |
610 | - { |
611 | - *listener << "Geometry:" |
612 | - << " x: " << x |
613 | - << " y: " << y |
614 | - << " width: " << width |
615 | - << " height: " << height |
616 | - << " border: " << border; |
617 | - } |
618 | - |
619 | - return match; |
620 | -} |
621 | - |
622 | -void |
623 | -WindowGeometryMatcher::DescribeTo (std::ostream *os) const |
624 | -{ |
625 | - *os << "Window geometry matching :"; |
626 | - |
627 | - *os << std::endl << " - "; |
628 | - mX.DescribeTo (os); |
629 | - |
630 | - *os << std::endl << " - "; |
631 | - mY.DescribeTo (os); |
632 | - |
633 | - *os << std::endl << " - "; |
634 | - mWidth.DescribeTo (os); |
635 | - |
636 | - *os << std::endl << " - "; |
637 | - mHeight.DescribeTo (os); |
638 | - |
639 | - *os << std::endl << " - "; |
640 | - mBorder.DescribeTo (os); |
641 | -} |
642 | - |
643 | -namespace |
644 | -{ |
645 | void WindowBorderPositionAttributes (Display *dpy, |
646 | Window w, |
647 | XWindowAttributes &attrib, |
648 | @@ -2246,16 +2110,15 @@ |
649 | { |
650 | XGetWindowAttributes (dpy, w, &attrib); |
651 | |
652 | - /* Remove border - input offset */ |
653 | - attrib.x -= (ActiveBorderExtent - ActiveInputExtent); |
654 | - attrib.y -= (ActiveBorderExtent - ActiveInputExtent); |
655 | - attrib.width -= (ActiveBorderExtent - ActiveInputExtent) * 2; |
656 | - attrib.height -= (ActiveBorderExtent - ActiveInputExtent) * 2; |
657 | + /* Remove input - border offset */ |
658 | + attrib.x += (ActiveInputExtent - ActiveBorderExtent); |
659 | + attrib.y += (ActiveInputExtent - ActiveBorderExtent); |
660 | + attrib.width -= (ActiveInputExtent - ActiveBorderExtent) * 2; |
661 | + attrib.height -= (ActiveInputExtent - ActiveBorderExtent) * 2; |
662 | } |
663 | } |
664 | |
665 | -/* DISABLED - Upon maximization, x offset is 1, width offset is 10 */ |
666 | -TEST_F (PixmapDecoratedWindowAcceptance, DISABLED_VertMaximizeFrameWindowSizeSameXWidth) |
667 | +TEST_F (PixmapDecoratedWindowAcceptance, VertMaximizeFrameWindowSizeSameXWidth) |
668 | { |
669 | XWindowAttributes rootAttrib, attrib; |
670 | XGetWindowAttributes (Display (), DefaultRootWindow (Display ()), &rootAttrib); |
671 | @@ -2263,7 +2126,7 @@ |
672 | WindowBorderPositionAttributes (Display (), |
673 | mTestWindowParent, |
674 | attrib, |
675 | - ActiveBorderExtent, |
676 | + RealDecorationActiveBorderExtent, |
677 | ActiveInputExtent); |
678 | |
679 | ChangeStateOfWindow (Display (), |
680 | @@ -2293,8 +2156,7 @@ |
681 | _)); |
682 | } |
683 | |
684 | -/* DISABLED - Upon maximization, y offset is 1, height offset is 10 */ |
685 | -TEST_F (PixmapDecoratedWindowAcceptance, DISABLED_HorzMaximizeFrameWindowSizeSameYHeight) |
686 | +TEST_F (PixmapDecoratedWindowAcceptance, HorzMaximizeFrameWindowSizeSameYHeight) |
687 | { |
688 | XWindowAttributes rootAttrib, attrib; |
689 | XGetWindowAttributes (Display (), DefaultRootWindow (Display ()), &rootAttrib); |
690 | @@ -2302,7 +2164,7 @@ |
691 | WindowBorderPositionAttributes (Display (), |
692 | mTestWindowParent, |
693 | attrib, |
694 | - ActiveBorderExtent, |
695 | + RealDecorationActiveBorderExtent, |
696 | ActiveInputExtent); |
697 | |
698 | ChangeStateOfWindow (Display (), |
699 | @@ -2356,12 +2218,7 @@ |
700 | _)); |
701 | } |
702 | |
703 | -/* DISABLED - Ensure that a window with StaticGravity expands to its |
704 | - * original size when it is undecorated |
705 | - * |
706 | - * X and Y positions do not revert back to their original state. |
707 | - */ |
708 | -TEST_F (PixmapDecoratedWindowAcceptance, DISABLED_UndecorateStaticGravityWindow) |
709 | +TEST_F (PixmapDecoratedWindowAcceptance, UndecorateStaticGravityWindow) |
710 | { |
711 | XSizeHints hints; |
712 | |
713 | @@ -2474,7 +2331,7 @@ |
714 | _)); |
715 | } |
716 | |
717 | -TEST_P (PixmapDecorationAdjustment, DISABLED_AdjustRestoredWindowBorderShrinkClient) |
718 | +TEST_P (PixmapDecorationAdjustment, AdjustRestoredWindowBorderShrinkClient) |
719 | { |
720 | ReconfigureDecoration (Display (), |
721 | mTestWindow, |
722 | @@ -2494,7 +2351,7 @@ |
723 | _)); |
724 | } |
725 | |
726 | -TEST_P (PixmapDecorationAdjustment, DISABLED_ClientExpandsAsBorderShrinks) |
727 | +TEST_P (PixmapDecorationAdjustment, ClientExpandsAsBorderShrinks) |
728 | { |
729 | decor_extents_t newExtents = GetParam (); |
730 | |
731 | @@ -2523,7 +2380,7 @@ |
732 | _)); |
733 | } |
734 | |
735 | -TEST_P (PixmapDecorationAdjustment, DISABLED_ClientExpandsAsBorderShrinksWhilstMaximized) |
736 | +TEST_P (PixmapDecorationAdjustment, ClientExpandsAsBorderShrinksWhilstMaximized) |
737 | { |
738 | decor_extents_t newExtents = GetParam (); |
739 | |
740 | @@ -2546,16 +2403,21 @@ |
741 | const CompPoint &off (mTestWindowDecoration->restoredFrameWindowOffset ()); |
742 | const CompSize &size (mTestWindowDecoration->restoredDecorationSize ()); |
743 | |
744 | + /* As the window is shrunk to accomodate the border size, we must subtract |
745 | + * the border from the original window size */ |
746 | + CompSize shrink ((newExtents.left + newExtents.right), |
747 | + (newExtents.top + newExtents.bottom)); |
748 | + |
749 | RestoreWindow (mTestWindow, |
750 | - ct::WINDOW_X - off.x (), |
751 | - ct::WINDOW_Y - off.y (), |
752 | - ct::WINDOW_WIDTH + size.width (), |
753 | - ct::WINDOW_HEIGHT + size.height ()); |
754 | + ct::WINDOW_X + off.x (), |
755 | + ct::WINDOW_Y + off.y (), |
756 | + ct::WINDOW_WIDTH - shrink.width () + size.width (), |
757 | + ct::WINDOW_HEIGHT - shrink.height () + size.height ()); |
758 | |
759 | EXPECT_THAT (mTestWindow, HasGeometry (Display (), |
760 | AbsoluteWindowGeometry, |
761 | ct::WINDOW_X + newExtents.left, |
762 | - ct::WINDOW_Y + newExtents.right, |
763 | + ct::WINDOW_Y + newExtents.top, |
764 | ct::WINDOW_WIDTH - (newExtents.left + |
765 | newExtents.right), |
766 | ct::WINDOW_HEIGHT - (newExtents.top + |
767 | @@ -2563,7 +2425,7 @@ |
768 | _)); |
769 | } |
770 | |
771 | -TEST_P (PixmapDecorationAdjustment, DISABLED_ClientExpandsAsBorderShrinksWhilstUndecorated) |
772 | +TEST_P (PixmapDecorationAdjustment, ClientExpandsAsBorderShrinksWhilstUndecorated) |
773 | { |
774 | decor_extents_t newExtents = GetParam (); |
775 | |
776 | @@ -2574,16 +2436,11 @@ |
777 | DecorationExtents (10, 10, 10, 10), |
778 | DecorationExtents (10, 10, 10, 10)); |
779 | |
780 | + /* When decorations are disabled on this window, the frame window |
781 | + * will retain the exact same size, as border == input in the previous |
782 | + * case. So there's no need to wait */ |
783 | DisallowDecorationsOnWindow (mTestWindow); |
784 | |
785 | - WaitForConfigureOn (Display (), |
786 | - mTestWindowParent, |
787 | - ct::WINDOW_X, |
788 | - ct::WINDOW_Y, |
789 | - ct::WINDOW_WIDTH, |
790 | - ct::WINDOW_HEIGHT, |
791 | - CWX | CWY | CWWidth | CWHeight); |
792 | - |
793 | /* Set the property on the window, then decorate without waiting |
794 | * for a response we will continue to use the maximized window decoration */ |
795 | mTestWindowDecoration->changeRestoredBorder (newExtents); |
796 | @@ -2596,18 +2453,23 @@ |
797 | const CompPoint &off (mTestWindowDecoration->restoredFrameWindowOffset ()); |
798 | const CompSize &size (mTestWindowDecoration->restoredDecorationSize ()); |
799 | |
800 | + /* As the window is shrunk to accomadate the border size, we must subtract |
801 | + * the border from the original window size */ |
802 | + CompSize shrink ((newExtents.left + newExtents.right), |
803 | + (newExtents.top + newExtents.bottom)); |
804 | + |
805 | WaitForConfigureOn (Display (), |
806 | mTestWindowParent, |
807 | - ct::WINDOW_X - off.x (), |
808 | - ct::WINDOW_Y - off.y (), |
809 | - ct::WINDOW_WIDTH + size.width (), |
810 | - ct::WINDOW_HEIGHT + size.height (), |
811 | + ct::WINDOW_X + off.x (), |
812 | + ct::WINDOW_Y + off.y (), |
813 | + ct::WINDOW_WIDTH - shrink.width () + size.width (), |
814 | + ct::WINDOW_HEIGHT - shrink.height () + size.height (), |
815 | CWX | CWY | CWWidth | CWHeight); |
816 | |
817 | EXPECT_THAT (mTestWindow, HasGeometry (Display (), |
818 | AbsoluteWindowGeometry, |
819 | ct::WINDOW_X + newExtents.left, |
820 | - ct::WINDOW_Y + newExtents.right, |
821 | + ct::WINDOW_Y + newExtents.top, |
822 | ct::WINDOW_WIDTH - (newExtents.left + |
823 | newExtents.right), |
824 | ct::WINDOW_HEIGHT - (newExtents.top + |
825 | |
826 | === modified file 'plugins/move/src/move.cpp' |
827 | --- plugins/move/src/move.cpp 2013-05-09 13:43:07 +0000 |
828 | +++ plugins/move/src/move.cpp 2013-06-29 07:09:28 +0000 |
829 | @@ -395,18 +395,23 @@ |
830 | { |
831 | int width = w->serverGeometry ().width (); |
832 | |
833 | - w->saveMask () |= CWX | CWY; |
834 | - |
835 | if (w->saveMask () & CWWidth) |
836 | width = w->saveWc ().width; |
837 | |
838 | - w->saveWc ().x = xRoot - (width >> 1); |
839 | - w->saveWc ().y = yRoot + (w->border ().top >> 1); |
840 | - |
841 | ms->x = ms->y = 0; |
842 | |
843 | + /* Get a lock on configure requests so that we can make |
844 | + * any movement here atomic */ |
845 | + compiz::window::configure_buffers::ReleasablePtr lock (w->obtainLockOnConfigureRequests ()); |
846 | + |
847 | w->maximize (0); |
848 | |
849 | + XWindowChanges xwc; |
850 | + xwc.x = xRoot - (width / 2); |
851 | + xwc.y = yRoot + w->border ().top / 2; |
852 | + |
853 | + w->configureXWindow (CWX | CWY, &xwc); |
854 | + |
855 | ms->snapOffY = ms->snapBackY; |
856 | |
857 | return; |
858 | @@ -440,13 +445,18 @@ |
859 | if (w->saveMask () & CWWidth) |
860 | width = w->saveWc ().width; |
861 | |
862 | - w->saveWc ().x = xRoot - (width >> 1); |
863 | - w->saveWc ().y = yRoot + (w->border ().top >> 1); |
864 | - |
865 | - ms->x = ms->y = 0; |
866 | + /* Get a lock on configure requests so that we can make |
867 | + * any movement here atomic */ |
868 | + compiz::window::configure_buffers::ReleasablePtr lock (w->obtainLockOnConfigureRequests ()); |
869 | |
870 | w->maximize (0); |
871 | |
872 | + XWindowChanges xwc; |
873 | + xwc.x = xRoot - (width / 2); |
874 | + xwc.y = yRoot + w->border ().top / 2; |
875 | + |
876 | + w->configureXWindow (CWX | CWY, &xwc); |
877 | + |
878 | ms->snapOffX = ms->snapBackX; |
879 | |
880 | return; |
881 | |
882 | === modified file 'plugins/opengl/src/paint.cpp' |
883 | --- plugins/opengl/src/paint.cpp 2013-05-08 15:13:28 +0000 |
884 | +++ plugins/opengl/src/paint.cpp 2013-06-29 07:09:28 +0000 |
885 | @@ -426,7 +426,7 @@ |
886 | gw = GLWindow::get (w); |
887 | |
888 | /* Release any queued ConfigureWindow requests now */ |
889 | - gw->priv->configureLock->release (); |
890 | + gw->priv->configureLock->release (); |
891 | |
892 | if (unredirected.find (w) != unredirected.end ()) |
893 | continue; |
894 | |
895 | === modified file 'plugins/place/src/constrain-to-workarea/include/constrain-to-workarea.h' |
896 | --- plugins/place/src/constrain-to-workarea/include/constrain-to-workarea.h 2013-06-07 05:51:45 +0000 |
897 | +++ plugins/place/src/constrain-to-workarea/include/constrain-to-workarea.h 2013-06-29 07:09:28 +0000 |
898 | @@ -45,8 +45,7 @@ |
899 | CompPoint & constrainPositionToWorkArea (CompPoint &pos, |
900 | const compiz::window::Geometry &serverGeometry, |
901 | const CompWindowExtents &border, |
902 | - const CompRect &workArea, |
903 | - bool staticGravity); |
904 | + const CompRect &workArea); |
905 | |
906 | |
907 | CompPoint getViewportRelativeCoordinates (const compiz::window::Geometry &geom, |
908 | @@ -54,8 +53,7 @@ |
909 | |
910 | CompWindowExtents getWindowEdgePositions (const CompPoint &position, |
911 | const compiz::window::Geometry &geom, |
912 | - const CompWindowExtents &border, |
913 | - unsigned int gravity); |
914 | + const CompWindowExtents &border); |
915 | |
916 | void clampHorizontalEdgePositionsToWorkArea (CompWindowExtents &edgePositions, |
917 | const CompRect &workArea); |
918 | @@ -64,8 +62,7 @@ |
919 | |
920 | void subtractBordersFromEdgePositions (CompWindowExtents &edgePositions, |
921 | const CompWindowExtents &border, |
922 | - unsigned int legacyBorder, |
923 | - unsigned int gravity); |
924 | + unsigned int legacyBorder); |
925 | |
926 | bool onlySizeChanged (unsigned int mask); |
927 | bool applyWidthChange (const CompWindowExtents &edgePositions, |
928 | |
929 | === modified file 'plugins/place/src/constrain-to-workarea/src/constrain-to-workarea.cpp' |
930 | --- plugins/place/src/constrain-to-workarea/src/constrain-to-workarea.cpp 2013-06-07 05:51:45 +0000 |
931 | +++ plugins/place/src/constrain-to-workarea/src/constrain-to-workarea.cpp 2013-06-29 07:09:28 +0000 |
932 | @@ -140,35 +140,21 @@ |
933 | |
934 | CompPoint & |
935 | cp::constrainPositionToWorkArea (CompPoint &pos, |
936 | - const cw::Geometry &serverGeometry, |
937 | - const CompWindowExtents &border, |
938 | - const CompRect &workArea, |
939 | - bool staticGravity) |
940 | + const cw::Geometry &serverGeometry, |
941 | + const CompWindowExtents &border, |
942 | + const CompRect &workArea) |
943 | { |
944 | CompWindowExtents extents; |
945 | int delta; |
946 | |
947 | - CompWindowExtents effectiveBorders = border; |
948 | - |
949 | - /* Ignore borders in the StaticGravity case for placement |
950 | - * because the window intended to be placed as if it didn't |
951 | - * have them */ |
952 | - if (staticGravity) |
953 | - { |
954 | - effectiveBorders.left = 0; |
955 | - effectiveBorders.right = 0; |
956 | - effectiveBorders.top = 0; |
957 | - effectiveBorders.bottom = 0; |
958 | - } |
959 | - |
960 | - extents.left = pos.x () - effectiveBorders.left; |
961 | - extents.top = pos.y () - effectiveBorders.top; |
962 | + extents.left = pos.x () - border.left; |
963 | + extents.top = pos.y () - border.top; |
964 | extents.right = extents.left + serverGeometry.widthIncBorders () + |
965 | - (effectiveBorders.left + |
966 | - effectiveBorders.right); |
967 | + (border.left + |
968 | + border.right); |
969 | extents.bottom = extents.top + serverGeometry.heightIncBorders () + |
970 | - (effectiveBorders.top + |
971 | - effectiveBorders.bottom); |
972 | + (border.top + |
973 | + border.bottom); |
974 | |
975 | delta = workArea.right () - extents.right; |
976 | if (delta < 0) |
977 | @@ -186,8 +172,8 @@ |
978 | if (delta > 0) |
979 | extents.top += delta; |
980 | |
981 | - pos.setX (extents.left + effectiveBorders.left); |
982 | - pos.setY (extents.top + effectiveBorders.top); |
983 | + pos.setX (extents.left + border.left); |
984 | + pos.setY (extents.top + border.top); |
985 | |
986 | return pos; |
987 | } |
988 | @@ -213,23 +199,18 @@ |
989 | |
990 | CompWindowExtents cp::getWindowEdgePositions (const CompPoint &position, |
991 | const cw::Geometry &geom, |
992 | - const CompWindowExtents &border, |
993 | - unsigned int gravity) |
994 | + const CompWindowExtents &border) |
995 | { |
996 | CompWindowExtents edgePositions; |
997 | - CompWindowExtents effectiveBorder (border); |
998 | - |
999 | - if (gravity & StaticGravity) |
1000 | - effectiveBorder = CompWindowExtents (0, 0, 0, 0); |
1001 | - |
1002 | - edgePositions.left = position.x () - effectiveBorder.left; |
1003 | + |
1004 | + edgePositions.left = position.x () - border.left; |
1005 | edgePositions.right = edgePositions.left + |
1006 | - geom.widthIncBorders () + (effectiveBorder.left + |
1007 | - effectiveBorder.right); |
1008 | - edgePositions.top = position.y () - effectiveBorder.top; |
1009 | + geom.widthIncBorders () + (border.left + |
1010 | + border.right); |
1011 | + edgePositions.top = position.y () - border.top; |
1012 | edgePositions.bottom = edgePositions.top + |
1013 | - geom.heightIncBorders () + (effectiveBorder.top + |
1014 | - effectiveBorder.bottom); |
1015 | + geom.heightIncBorders () + (border.top + |
1016 | + border.bottom); |
1017 | |
1018 | return edgePositions; |
1019 | } |
1020 | @@ -285,19 +266,14 @@ |
1021 | |
1022 | void cp::subtractBordersFromEdgePositions (CompWindowExtents &edgePositions, |
1023 | const CompWindowExtents &border, |
1024 | - unsigned int legacyBorder, |
1025 | - unsigned int gravity) |
1026 | + unsigned int legacyBorder) |
1027 | { |
1028 | const unsigned int doubleBorder = 2 * legacyBorder; |
1029 | - CompWindowExtents effectiveBorder = border; |
1030 | - |
1031 | - if (gravity & StaticGravity) |
1032 | - effectiveBorder = CompWindowExtents (0, 0, 0, 0); |
1033 | - |
1034 | - edgePositions.left += effectiveBorder.left; |
1035 | - edgePositions.right -= effectiveBorder.right + doubleBorder; |
1036 | - edgePositions.top += effectiveBorder.top; |
1037 | - edgePositions.bottom -= effectiveBorder.bottom + doubleBorder; |
1038 | + |
1039 | + edgePositions.left += border.left; |
1040 | + edgePositions.right -= border.right + doubleBorder; |
1041 | + edgePositions.top += border.top; |
1042 | + edgePositions.bottom -= border.bottom + doubleBorder; |
1043 | } |
1044 | |
1045 | bool cp::onlySizeChanged (unsigned int mask) |
1046 | |
1047 | === modified file 'plugins/place/src/constrain-to-workarea/tests/constrain-to-workarea/src/test-place-constrain-to-workarea.cpp' |
1048 | --- plugins/place/src/constrain-to-workarea/tests/constrain-to-workarea/src/test-place-constrain-to-workarea.cpp 2013-06-07 05:51:45 +0000 |
1049 | +++ plugins/place/src/constrain-to-workarea/tests/constrain-to-workarea/src/test-place-constrain-to-workarea.cpp 2013-06-29 07:09:28 +0000 |
1050 | @@ -226,7 +226,7 @@ |
1051 | extents = WindowExtents (GetParam ()); |
1052 | |
1053 | CompPoint pos = InitialPosition (GetParam ()); |
1054 | - pos = cp::constrainPositionToWorkArea (pos, g, extents, WArea, false); |
1055 | + pos = cp::constrainPositionToWorkArea (pos, g, extents, WArea); |
1056 | |
1057 | const CompPoint expectedAfterExtentsAdjustment = ExpectedPosition + |
1058 | CompPoint (extents.left, |
1059 | @@ -235,19 +235,6 @@ |
1060 | EXPECT_EQ (expectedAfterExtentsAdjustment, pos); |
1061 | } |
1062 | |
1063 | -TEST_P (PlaceConstrainPositionToWorkArea, PositionConstrainedStaticGravity) |
1064 | -{ |
1065 | - g = WindowGeometry (GetParam ()); |
1066 | - extents = WindowExtents (GetParam ()); |
1067 | - |
1068 | - CompPoint pos = InitialPosition (GetParam ()); |
1069 | - pos = cp::constrainPositionToWorkArea (pos, g, extents, WArea, true); |
1070 | - |
1071 | - /* Do not adjust residual position for extents with windows |
1072 | - * that have a static gravity */ |
1073 | - EXPECT_EQ (ExpectedPosition, pos); |
1074 | -} |
1075 | - |
1076 | namespace |
1077 | { |
1078 | cwe::Extents PossibleExtents[] = |
1079 | @@ -297,7 +284,7 @@ |
1080 | CompPoint pos; |
1081 | }; |
1082 | |
1083 | -TEST_F (PlaceGetEdgePositions, GetEdgePositionsNWGravity) |
1084 | +TEST_F (PlaceGetEdgePositions, GetEdgePositions) |
1085 | { |
1086 | int left = geom.x () - border.left; |
1087 | int right = left + (geom.widthIncBorders ()) + |
1088 | @@ -309,25 +296,7 @@ |
1089 | const cwe::Extents ExpectedExtents (left, right, top, bottom); |
1090 | cwe::Extents actualExtents (cp::getWindowEdgePositions (pos, |
1091 | geom, |
1092 | - border, |
1093 | - NorthWestGravity)); |
1094 | - |
1095 | - EXPECT_EQ (ExpectedExtents, actualExtents); |
1096 | -} |
1097 | - |
1098 | -TEST_F (PlaceGetEdgePositions, GetEdgePositionsStaticGravity) |
1099 | -{ |
1100 | - /* Don't count borders in validation */ |
1101 | - int left = geom.x (); |
1102 | - int right = left + (geom.widthIncBorders ()); |
1103 | - int top = geom.y (); |
1104 | - int bottom = top + (geom.heightIncBorders ()); |
1105 | - |
1106 | - const cwe::Extents ExpectedExtents (left, right, top, bottom); |
1107 | - cwe::Extents actualExtents (cp::getWindowEdgePositions (pos, |
1108 | - geom, |
1109 | - border, |
1110 | - StaticGravity)); |
1111 | + border)); |
1112 | |
1113 | EXPECT_EQ (ExpectedExtents, actualExtents); |
1114 | } |
1115 | @@ -527,29 +496,7 @@ |
1116 | |
1117 | cp::subtractBordersFromEdgePositions (modifiedEdgePositions, |
1118 | borders, |
1119 | - legacyBorder, |
1120 | - NorthWestGravity); |
1121 | - |
1122 | - EXPECT_EQ (expectedEdgePositions, modifiedEdgePositions); |
1123 | -} |
1124 | - |
1125 | -TEST (PlaceSubtractBordersFromEdgePositions, StaticGravityDefinition) |
1126 | -{ |
1127 | - const CompWindowExtents borders (1, 2, 3, 4); |
1128 | - const CompWindowExtents edgePositions (100, 200, 100, 200); |
1129 | - const unsigned int legacyBorder = 1; |
1130 | - |
1131 | - CompWindowExtents expectedEdgePositions (edgePositions.left, |
1132 | - edgePositions.right - (2 * legacyBorder), |
1133 | - edgePositions.top, |
1134 | - edgePositions.bottom - (2 * legacyBorder)); |
1135 | - |
1136 | - CompWindowExtents modifiedEdgePositions (edgePositions); |
1137 | - |
1138 | - cp::subtractBordersFromEdgePositions (modifiedEdgePositions, |
1139 | - borders, |
1140 | - legacyBorder, |
1141 | - StaticGravity); |
1142 | + legacyBorder); |
1143 | |
1144 | EXPECT_EQ (expectedEdgePositions, modifiedEdgePositions); |
1145 | } |
1146 | |
1147 | === modified file 'plugins/place/src/place.cpp' |
1148 | --- plugins/place/src/place.cpp 2013-06-07 05:51:45 +0000 |
1149 | +++ plugins/place/src/place.cpp 2013-06-29 07:09:28 +0000 |
1150 | @@ -362,8 +362,7 @@ |
1151 | |
1152 | CompWindowExtents edgePositions = cp::getWindowEdgePositions (pos, |
1153 | geom, |
1154 | - window->border (), |
1155 | - window->sizeHints ().win_gravity); |
1156 | + window->border ()); |
1157 | |
1158 | int output = screen->outputDeviceForGeometry (geom); |
1159 | CompRect workArea = screen->getWorkareaForOutput (output); |
1160 | @@ -386,8 +385,7 @@ |
1161 | /* bring left/right/top/bottom to actual window coordinates */ |
1162 | cp::subtractBordersFromEdgePositions (edgePositions, |
1163 | window->border (), |
1164 | - geom.border (), |
1165 | - window->sizeHints ().win_gravity); |
1166 | + geom.border ()); |
1167 | |
1168 | /* always validate position if the application changed only its size, |
1169 | * as it might become partially offscreen because of that */ |
1170 | @@ -436,7 +434,9 @@ |
1171 | if (!mask) |
1172 | return; |
1173 | |
1174 | - if (source == ClientTypePager) |
1175 | + /* Clamp all windows initially on placement */ |
1176 | + if (window->placed () && |
1177 | + source == ClientTypePager) |
1178 | return; |
1179 | |
1180 | if (window->state () & CompWindowStateFullscreenMask) |
1181 | @@ -446,14 +446,16 @@ |
1182 | CompWindowTypeDesktopMask)) |
1183 | return; |
1184 | |
1185 | - /* do nothing if the window was already (at least partially) offscreen */ |
1186 | - if (window->serverX () < 0 || |
1187 | - window->serverX () + window->serverWidth () > screen->width () || |
1188 | - window->serverY () < 0 || |
1189 | - window->serverY () + window->serverHeight () > screen->height ()) |
1190 | - { |
1191 | + /* do nothing if the window was already (at least partially) offscreen |
1192 | + * and already placed */ |
1193 | + bool onscreen = |
1194 | + CompRect (0, |
1195 | + 0, |
1196 | + screen->width (), |
1197 | + screen->height ()).contains (window->geometry ()); |
1198 | + |
1199 | + if (window->placed () && !onscreen) |
1200 | return; |
1201 | - } |
1202 | |
1203 | if (hasUserDefinedPosition (false)) |
1204 | /* try to keep the window position intact for USPosition - |
1205 | @@ -1143,13 +1145,10 @@ |
1206 | PlaceWindow::constrainToWorkarea (const CompRect &workArea, |
1207 | CompPoint &pos) |
1208 | { |
1209 | - bool staticGravity = window->sizeHints ().win_gravity & StaticGravity; |
1210 | - |
1211 | pos = cp::constrainPositionToWorkArea (pos, |
1212 | window->serverGeometry (), |
1213 | window->border (), |
1214 | - workArea, |
1215 | - staticGravity); |
1216 | + workArea); |
1217 | |
1218 | } |
1219 | |
1220 | |
1221 | === modified file 'src/event.cpp' |
1222 | --- src/event.cpp 2013-03-19 10:00:10 +0000 |
1223 | +++ src/event.cpp 2013-06-29 07:09:28 +0000 |
1224 | @@ -1343,8 +1343,13 @@ |
1225 | * that to wait until the map request */ |
1226 | if (wa.root == privateScreen.rootWindow()) |
1227 | { |
1228 | - PrivateWindow::createCompWindow (CompWindowToWindow (getTopWindow ()), CompWindowToWindow (getTopServerWindow ()), wa, event->xcreatewindow.window); |
1229 | - } |
1230 | + Window top = CompWindowToWindow (getTopWindow ()); |
1231 | + Window topServer = CompWindowToWindow (getTopServerWindow ()); |
1232 | + PrivateWindow::createCompWindow (top, |
1233 | + topServer, |
1234 | + wa, |
1235 | + event->xcreatewindow.window); |
1236 | + } |
1237 | else |
1238 | XSelectInput (privateScreen.dpy, event->xcreatewindow.window, |
1239 | FocusChangeMask); |
1240 | |
1241 | === modified file 'src/plugin.cpp' |
1242 | --- src/plugin.cpp 2013-06-22 14:47:34 +0000 |
1243 | +++ src/plugin.cpp 2013-06-29 07:09:28 +0000 |
1244 | @@ -31,6 +31,8 @@ |
1245 | #include <boost/scoped_array.hpp> |
1246 | #include <boost/foreach.hpp> |
1247 | |
1248 | +#include <boost/algorithm/string.hpp> |
1249 | + |
1250 | #include <stdio.h> |
1251 | #include <stdlib.h> |
1252 | #include <string.h> |
1253 | @@ -424,8 +426,19 @@ |
1254 | |
1255 | if (compiz_plugin_dir_override) |
1256 | { |
1257 | - if (loaderLoadPlugin (p.get (), compiz_plugin_dir_override, name)) |
1258 | - return p.release (); |
1259 | + std::vector <std::string> paths; |
1260 | + boost::split (paths, |
1261 | + compiz_plugin_dir_override, |
1262 | + boost::is_any_of (":")); |
1263 | + |
1264 | + foreach (const std::string &path, paths) |
1265 | + { |
1266 | + if (path.empty ()) |
1267 | + continue; |
1268 | + |
1269 | + if (loaderLoadPlugin (p.get (), path.c_str (), name)) |
1270 | + return p.release (); |
1271 | + } |
1272 | } |
1273 | |
1274 | if (char* home = getenv ("HOME")) |
1275 | |
1276 | === modified file 'src/plugin/tests/test-plugin.cpp' |
1277 | --- src/plugin/tests/test-plugin.cpp 2013-05-28 23:36:08 +0000 |
1278 | +++ src/plugin/tests/test-plugin.cpp 2013-06-29 07:09:28 +0000 |
1279 | @@ -182,6 +182,46 @@ |
1280 | CompPlugin::unload(cp); |
1281 | } |
1282 | |
1283 | +TEST_F (PluginTest, load_plugin_from_multi_COMPIZ_PLUGIN_DIR_env_succeeds) |
1284 | +{ |
1285 | + std::string COMPIZ_PLUGIN_DIR_PART1 = "/path/to/plugin/dir"; |
1286 | + std::string COMPIZ_PLUGIN_DIR_PART2 = "/dir/plugin/to/path"; |
1287 | + std::string COMPIZ_PLUGIN_DIR_VALUE = COMPIZ_PLUGIN_DIR_PART1 + ":" + |
1288 | + COMPIZ_PLUGIN_DIR_PART2; |
1289 | + TmpEnv env ("COMPIZ_PLUGIN_DIR", COMPIZ_PLUGIN_DIR_VALUE.c_str ()); |
1290 | + |
1291 | + using namespace testing; |
1292 | + |
1293 | + EXPECT_CALL(mockfs, LoadPlugin(_, |
1294 | + EndsWith(COMPIZ_PLUGIN_DIR_PART1), |
1295 | + StrEq("dummy"))). |
1296 | + WillOnce(Return(false)); |
1297 | + |
1298 | + EXPECT_CALL(mockfs, LoadPlugin(Ne((void*)0), |
1299 | + StrEq(COMPIZ_PLUGIN_DIR_PART2), |
1300 | + StrEq("dummy"))). |
1301 | + WillOnce(Return(true)); |
1302 | + |
1303 | + EXPECT_CALL(mockfs, LoadPlugin(Ne((void*)0), |
1304 | + EndsWith(HOME_PLUGINDIR), StrEq("dummy"))). |
1305 | + Times(AtMost(0)); |
1306 | + |
1307 | + EXPECT_CALL(mockfs, LoadPlugin(Ne((void*)0), |
1308 | + EndsWith(PLUGINDIR), StrEq("dummy"))). |
1309 | + Times(AtMost(0)); |
1310 | + |
1311 | + EXPECT_CALL(mockfs, LoadPlugin(Ne((void*)0), |
1312 | + Eq((void*)0), StrEq("dummy"))). |
1313 | + Times(AtMost(0)); |
1314 | + |
1315 | + EXPECT_CALL(mockfs, UnloadPlugin(_)).Times(1); |
1316 | + |
1317 | + CompPlugin* cp = CompPlugin::load("dummy"); |
1318 | + ASSERT_NE((void*)0, cp); |
1319 | + |
1320 | + CompPlugin::unload(cp); |
1321 | +} |
1322 | + |
1323 | TEST_F (PluginTest, load_plugin_from_void_succeeds) |
1324 | { |
1325 | using namespace testing; |
1326 | |
1327 | === modified file 'src/window.cpp' |
1328 | --- src/window.cpp 2013-05-27 16:19:59 +0000 |
1329 | +++ src/window.cpp 2013-06-29 07:09:28 +0000 |
1330 | @@ -2884,17 +2884,21 @@ |
1331 | |
1332 | int m = mask & ~saveMask; |
1333 | |
1334 | + /* The saved window geometry is always saved in terms of the non-decorated |
1335 | + * geometry as we may need to restore it with a different decoration size */ |
1336 | if (m & CWX) |
1337 | - saveWc.x = serverGeometry.x (); |
1338 | + saveWc.x = serverGeometry.x () - window->border ().left; |
1339 | |
1340 | if (m & CWY) |
1341 | - saveWc.y = serverGeometry.y (); |
1342 | + saveWc.y = serverGeometry.y () - window->border ().top; |
1343 | |
1344 | if (m & CWWidth) |
1345 | - saveWc.width = serverGeometry.width (); |
1346 | + saveWc.width = serverGeometry.width () + (window->border ().left + |
1347 | + window->border ().right); |
1348 | |
1349 | if (m & CWHeight) |
1350 | - saveWc.height = serverGeometry.height (); |
1351 | + saveWc.height = serverGeometry.height () + (window->border ().top + |
1352 | + window->border ().bottom); |
1353 | |
1354 | if (m & CWBorderWidth) |
1355 | saveWc.border_width = serverGeometry.border (); |
1356 | @@ -2909,44 +2913,18 @@ |
1357 | int m = mask & saveMask; |
1358 | |
1359 | if (m & CWX) |
1360 | - xwc->x = saveWc.x; |
1361 | + xwc->x = saveWc.x + window->border ().left; |
1362 | |
1363 | if (m & CWY) |
1364 | - xwc->y = saveWc.y; |
1365 | + xwc->y = saveWc.y + window->border ().top; |
1366 | |
1367 | if (m & CWWidth) |
1368 | - { |
1369 | - xwc->width = saveWc.width; |
1370 | - |
1371 | - /* This is not perfect but it works OK for now. If the saved width is |
1372 | - the same as the current width then make it a little be smaller so |
1373 | - the user can see that it changed and it also makes sure that |
1374 | - windowResizeNotify is called and plugins are notified. |
1375 | - TODO: Eliminate these arbitrary magic numbers here */ |
1376 | - if (xwc->width == (int) serverGeometry.width ()) |
1377 | - { |
1378 | - xwc->width -= 10; |
1379 | - |
1380 | - if (m & CWX) |
1381 | - xwc->x += 5; |
1382 | - } |
1383 | - } |
1384 | + xwc->width = saveWc.width - (window->border ().left + |
1385 | + window->border ().right); |
1386 | |
1387 | if (m & CWHeight) |
1388 | - { |
1389 | - xwc->height = saveWc.height; |
1390 | - |
1391 | - /* As above, if the saved height is the same as the current height |
1392 | - then make it a little be smaller. |
1393 | - TODO: As above, find a better solution without magic numbers here */ |
1394 | - if (xwc->height == (int) serverGeometry.height ()) |
1395 | - { |
1396 | - xwc->height -= 10; |
1397 | - |
1398 | - if (m & CWY) |
1399 | - xwc->y += 5; |
1400 | - } |
1401 | - } |
1402 | + xwc->height = saveWc.height - (window->border ().top + |
1403 | + window->border ().bottom); |
1404 | |
1405 | if (m & CWBorderWidth) |
1406 | xwc->border_width = saveWc.border_width; |
1407 | @@ -5493,8 +5471,8 @@ |
1408 | unsigned int xwcm; |
1409 | |
1410 | /* adjust for gravity, but only for frame size */ |
1411 | - xwc.x = priv->serverGeometry.x (); |
1412 | - xwc.y = priv->serverGeometry.y (); |
1413 | + xwc.x = priv->serverGeometry.x () - priv->border.left; |
1414 | + xwc.y = priv->serverGeometry.y () - priv->border.top; |
1415 | xwc.width = 0; |
1416 | xwc.height = 0; |
1417 | |
1418 | @@ -5503,6 +5481,9 @@ |
1419 | xwc.width = priv->serverGeometry.width (); |
1420 | xwc.height = priv->serverGeometry.height (); |
1421 | |
1422 | + /* Validate size */ |
1423 | + xwcm |= CWWidth | CWHeight; |
1424 | + |
1425 | window->validateResizeRequest (xwcm, &xwc, ClientTypeApplication); |
1426 | |
1427 | CompPoint pos (xwc.x, xwc.y); |
1428 | @@ -6605,24 +6586,39 @@ |
1429 | priv->border.top != b->top || |
1430 | priv->border.bottom != b->bottom) |
1431 | { |
1432 | + CompPoint movement = |
1433 | + compiz::window::extents::shift (*b, |
1434 | + priv->sizeHints.win_gravity) - |
1435 | + compiz::window::extents::shift (priv->border, |
1436 | + priv->sizeHints.win_gravity); |
1437 | + CompSize sizeDelta = CompSize (-((b->left + b->right) - |
1438 | + (priv->border.left + priv->border.right)), |
1439 | + -((b->top + b->bottom) - |
1440 | + (priv->border.top + priv->border.bottom))); |
1441 | + |
1442 | priv->serverInput = *i; |
1443 | priv->border = *b; |
1444 | |
1445 | + /* Offset client for any new decoration size */ |
1446 | + XWindowChanges xwc; |
1447 | + |
1448 | + xwc.x = movement.x () + priv->serverGeometry.x (); |
1449 | + xwc.y = movement.y () + priv->serverGeometry.y (); |
1450 | + xwc.width = sizeDelta.width () + priv->serverGeometry.width (); |
1451 | + xwc.height = sizeDelta.height () + priv->serverGeometry.height (); |
1452 | + |
1453 | + configureXWindow (CWX | CWY | CWWidth | CWHeight, &xwc); |
1454 | + |
1455 | + windowNotify (CompWindowNotifyFrameUpdate); |
1456 | recalcActions (); |
1457 | |
1458 | - bool sizeUpdated = false; |
1459 | - |
1460 | - sizeUpdated |= priv->updateSize (); |
1461 | - sizeUpdated |= priv->updateFrameWindow (); |
1462 | - |
1463 | /* Always send a moveNotify |
1464 | * whenever the frame extents update |
1465 | * so that plugins can re-position appropriately */ |
1466 | moveNotify (0, 0, true); |
1467 | |
1468 | /* Once we have updated everything, re-set lastServerInput */ |
1469 | - if (sizeUpdated) |
1470 | - priv->lastServerInput = priv->serverInput; |
1471 | + priv->lastServerInput = priv->serverInput; |
1472 | } |
1473 | |
1474 | /* Use b for _NET_WM_FRAME_EXTENTS here because |
1475 | @@ -6746,11 +6742,28 @@ |
1476 | /* Gravity here is assumed to be SouthEast, clients can update |
1477 | * that if need be */ |
1478 | |
1479 | + serverFrameGeometry.set (serverInput.left - border.left, |
1480 | + serverInput.top - border.top, |
1481 | + wa.width + (serverInput.left + |
1482 | + serverInput.right), |
1483 | + wa.height + (serverInput.top + |
1484 | + serverInput.bottom), |
1485 | + 0); |
1486 | + |
1487 | /* Awaiting a new frame to be given to us */ |
1488 | frame = None; |
1489 | - serverFrame = XCreateWindow (dpy, screen->root (), 0, 0, |
1490 | - wa.width, wa.height, 0, wa.depth, |
1491 | - InputOutput, visual, mask, &attr); |
1492 | + serverFrame = XCreateWindow (dpy, |
1493 | + screen->root (), |
1494 | + serverFrameGeometry.x (), |
1495 | + serverFrameGeometry.y (), |
1496 | + serverFrameGeometry.width (), |
1497 | + serverFrameGeometry.height (), |
1498 | + serverFrameGeometry.border (), |
1499 | + wa.depth, |
1500 | + InputOutput, |
1501 | + visual, |
1502 | + mask, |
1503 | + &attr); |
1504 | |
1505 | /* Do not get any events from here on */ |
1506 | XSelectInput (dpy, screen->root (), NoEventMask); |
1507 | @@ -6758,11 +6771,16 @@ |
1508 | /* If we have some frame extents, we should apply them here and |
1509 | * set lastFrameExtents */ |
1510 | wrapper = XCreateWindow (dpy, serverFrame, |
1511 | - serverInput.left, serverInput.top, |
1512 | - wa.width - (serverInput.left + serverInput.right), |
1513 | - wa.height - (serverInput.top + serverInput.bottom), |
1514 | - 0, wa.depth, |
1515 | - InputOutput, visual, mask, &attr); |
1516 | + serverInput.left, |
1517 | + serverInput.top, |
1518 | + wa.width, |
1519 | + wa.height, |
1520 | + 0, |
1521 | + wa.depth, |
1522 | + InputOutput, |
1523 | + visual, |
1524 | + mask, |
1525 | + &attr); |
1526 | |
1527 | lastServerInput = serverInput; |
1528 | xwc.stack_mode = Above; |
1529 | @@ -6836,11 +6854,6 @@ |
1530 | attr.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | |
1531 | EnterWindowMask | LeaveWindowMask; |
1532 | |
1533 | - serverFrameGeometry = serverGeometry; |
1534 | - |
1535 | - XMoveResizeWindow (dpy, serverFrame, serverFrameGeometry.x (), serverFrameGeometry.y (), |
1536 | - serverFrameGeometry.width (), serverFrameGeometry.height ()); |
1537 | - |
1538 | XChangeWindowAttributes (dpy, serverFrame, CWEventMask, &attr); |
1539 | XChangeWindowAttributes (dpy, wrapper, CWEventMask, &attr); |
1540 | |
1541 | |
1542 | === modified file 'src/window/extents/src/windowextents.cpp' |
1543 | --- src/window/extents/src/windowextents.cpp 2013-06-07 05:51:45 +0000 |
1544 | +++ src/window/extents/src/windowextents.cpp 2013-06-29 07:09:28 +0000 |
1545 | @@ -35,6 +35,11 @@ |
1546 | CompPoint rv = CompPoint (); |
1547 | |
1548 | switch (gravity) { |
1549 | + /* We treat StaticGravity like NorthWestGravity here |
1550 | + * as when decorating / undecorating the window we |
1551 | + * really do need to move it in order to handle |
1552 | + * any cases where it goes offscreen */ |
1553 | + case StaticGravity: |
1554 | case NorthGravity: |
1555 | case NorthWestGravity: |
1556 | case NorthEastGravity: |
1557 | @@ -50,6 +55,11 @@ |
1558 | } |
1559 | |
1560 | switch (gravity) { |
1561 | + /* We treat StaticGravity like NorthWestGravity here |
1562 | + * as when decorating / undecorating the window we |
1563 | + * really do need to move it in order to handle |
1564 | + * any cases where it goes offscreen */ |
1565 | + case StaticGravity: |
1566 | case WestGravity: |
1567 | case NorthWestGravity: |
1568 | case SouthWestGravity: |
1569 | |
1570 | === added file 'tests/manual/README.txt' |
1571 | --- tests/manual/README.txt 1970-01-01 00:00:00 +0000 |
1572 | +++ tests/manual/README.txt 2013-06-29 07:09:28 +0000 |
1573 | @@ -0,0 +1,9 @@ |
1574 | +Compiz Manual Tests |
1575 | +=================== |
1576 | + |
1577 | +Avoid writing manual tests if you can. Acceptance tests that can be run |
1578 | +on an automatic basis are always preferred. |
1579 | + |
1580 | +If getting some part of the code would be too difficult or invasive, then |
1581 | +write a manual test in here so that we can remind ourselves to deploy test |
1582 | +frameworks for the code in quesiton. |
1583 | |
1584 | === added file 'tests/manual/plugins/decor.txt' |
1585 | --- tests/manual/plugins/decor.txt 1970-01-01 00:00:00 +0000 |
1586 | +++ tests/manual/plugins/decor.txt 2013-06-29 07:09:28 +0000 |
1587 | @@ -0,0 +1,40 @@ |
1588 | +COMPIZ DECOR PLUGIN |
1589 | +=================== |
1590 | +Sam Spilsbury <smspillaz@gmail.com> |
1591 | + |
1592 | +Static Gravity Handling - no decorations |
1593 | +---------------------------------------- |
1594 | +Setup: |
1595 | +# Install guake |
1596 | + |
1597 | +Actions: |
1598 | +# Start and launch guake |
1599 | + |
1600 | +Expected Result: |
1601 | + Guake should sit flush with the panels and work area |
1602 | + |
1603 | +Static Gravity Handling - decorations |
1604 | +------------------------------------- |
1605 | +Setup: |
1606 | +# Install friends-app |
1607 | + |
1608 | +Actions: |
1609 | +# Start and launch friends-app |
1610 | + |
1611 | +Expected Result: |
1612 | + The QML window should have its decorations visible and |
1613 | + be contained in the top left hand corner of the work area |
1614 | + |
1615 | +_NET_REQUEST_FRAME_EXTENTS handling |
1616 | +----------------------------------- |
1617 | +Setup: |
1618 | +# Install any sun-awt application - examples: |
1619 | + 1. netbeans |
1620 | + 2. ecplise |
1621 | + |
1622 | +Actions: |
1623 | +# Run the application |
1624 | + |
1625 | +Expected Result: |
1626 | + The application should not have its contents offset |
1627 | + by its decoration size |
1628 | |
1629 | === modified file 'tests/system/xorg-gtest/tests/compiz_xorg_gtest_configure_window.cpp' |
1630 | --- tests/system/xorg-gtest/tests/compiz_xorg_gtest_configure_window.cpp 2013-06-22 12:27:36 +0000 |
1631 | +++ tests/system/xorg-gtest/tests/compiz_xorg_gtest_configure_window.cpp 2013-06-29 07:09:28 +0000 |
1632 | @@ -44,6 +44,11 @@ |
1633 | using ::testing::MatchResultListener; |
1634 | using ::testing::MakeMatcher; |
1635 | using ::testing::Matcher; |
1636 | +using ::testing::_; |
1637 | + |
1638 | +using ::compiz::testing::HasGeometry; |
1639 | +using ::compiz::testing::RelativeWindowGeometry; |
1640 | +using ::compiz::testing::AbsoluteWindowGeometry; |
1641 | |
1642 | namespace ct = compiz::testing; |
1643 | |
1644 | @@ -191,7 +196,6 @@ |
1645 | void SendConfigureLockRequest (Window w, bool lockRequests); |
1646 | bool VerifyConfigureResponse (Window w, int x, int y, int width, int height); |
1647 | bool VerifySetFrameExtentsResponse (Window w, int left, int right, int top, int bottom); |
1648 | - bool VerifyWindowSize (Window w, int x, int y, int width, int height); |
1649 | |
1650 | /* Helper functions for the Create*WindowOverrideRedirect* tests */ |
1651 | Window GrabAndCreateWindowWithAttrs (::Display *dpy, |
1652 | @@ -204,7 +208,7 @@ |
1653 | protected: |
1654 | |
1655 | ReparentedWindow CreateWindow (::Display *); |
1656 | - int GetEventMask (); |
1657 | + int GetEventMask () const; |
1658 | |
1659 | private: |
1660 | |
1661 | @@ -212,7 +216,7 @@ |
1662 | }; |
1663 | |
1664 | int |
1665 | -CompizXorgSystemConfigureWindowTest::GetEventMask () |
1666 | +CompizXorgSystemConfigureWindowTest::GetEventMask () const |
1667 | { |
1668 | return ct::AutostartCompizXorgSystemTestWithTestHelper::GetEventMask () | |
1669 | SubstructureNotifyMask; |
1670 | @@ -336,28 +340,6 @@ |
1671 | return false; |
1672 | } |
1673 | |
1674 | -bool |
1675 | -CompizXorgSystemConfigureWindowTest::VerifyWindowSize (Window w, |
1676 | - int x, |
1677 | - int y, |
1678 | - int width, |
1679 | - int height) |
1680 | -{ |
1681 | - ::Display *dpy = Display (); |
1682 | - |
1683 | - int xRet, yRet; |
1684 | - unsigned int widthRet, heightRet; |
1685 | - if (!QueryGeometry (dpy, w, xRet, yRet, widthRet, heightRet)) |
1686 | - return false; |
1687 | - |
1688 | - EXPECT_EQ (x, xRet); |
1689 | - EXPECT_EQ (y, yRet); |
1690 | - EXPECT_EQ (width, widthRet); |
1691 | - EXPECT_EQ (height, heightRet); |
1692 | - |
1693 | - return true; |
1694 | -} |
1695 | - |
1696 | ReparentedWindow |
1697 | CompizXorgSystemConfigureWindowTest::CreateWindow (::Display *dpy) |
1698 | { |
1699 | @@ -385,7 +367,13 @@ |
1700 | ASSERT_TRUE (VerifyConfigureResponse (w.client, x, y, width, height)); |
1701 | |
1702 | /* Query the window size again */ |
1703 | - ASSERT_TRUE (VerifyWindowSize (w.frame, x, y, width, height)); |
1704 | + ASSERT_THAT (w.frame, HasGeometry (dpy, |
1705 | + RelativeWindowGeometry, |
1706 | + x, |
1707 | + y, |
1708 | + width, |
1709 | + height, |
1710 | + _)); |
1711 | |
1712 | } |
1713 | |
1714 | @@ -410,7 +398,13 @@ |
1715 | ASSERT_TRUE (VerifySetFrameExtentsResponse (w.client, left, right, top, bottom)); |
1716 | |
1717 | /* Client geometry is always unchanged */ |
1718 | - ASSERT_TRUE (VerifyWindowSize (w.client, x, y, width, height)); |
1719 | + ASSERT_THAT (w.client, HasGeometry (dpy, |
1720 | + RelativeWindowGeometry, |
1721 | + x, |
1722 | + y, |
1723 | + width, |
1724 | + height, |
1725 | + _)); |
1726 | |
1727 | /* Frame geometry is frame geometry offset by extents */ |
1728 | x -= left; |
1729 | @@ -418,7 +412,13 @@ |
1730 | width += left + right; |
1731 | height += top + bottom; |
1732 | |
1733 | - ASSERT_TRUE (VerifyWindowSize (w.frame, x, y, width, height)); |
1734 | + ASSERT_THAT (w.frame, HasGeometry (dpy, |
1735 | + RelativeWindowGeometry, |
1736 | + x, |
1737 | + y, |
1738 | + width, |
1739 | + height, |
1740 | + _)); |
1741 | } |
1742 | |
1743 | TEST_F (CompizXorgSystemConfigureWindowTest, MoveFrameLocked) |
1744 | @@ -448,11 +448,13 @@ |
1745 | ASSERT_TRUE (VerifyConfigureResponse (w.client, x, y, width, height)); |
1746 | |
1747 | /* Query the window size again - it should be the same */ |
1748 | - ASSERT_TRUE (VerifyWindowSize (w.frame, |
1749 | - currentX, |
1750 | - currentY, |
1751 | - currentWidth, |
1752 | - currentHeight)); |
1753 | + ASSERT_THAT (w.frame, HasGeometry (dpy, |
1754 | + RelativeWindowGeometry, |
1755 | + currentX, |
1756 | + currentY, |
1757 | + currentWidth, |
1758 | + currentHeight, |
1759 | + _)); |
1760 | |
1761 | |
1762 | SendConfigureLockRequest (w.client, false); |
1763 | @@ -510,11 +512,13 @@ |
1764 | SendConfigureLockRequest (w.client, false); |
1765 | |
1766 | /* Query the window size again - it should be the same */ |
1767 | - ASSERT_TRUE (VerifyWindowSize (w.frame, |
1768 | - currentX, |
1769 | - currentY, |
1770 | - width, |
1771 | - height)); |
1772 | + ASSERT_THAT (w.frame, HasGeometry (dpy, |
1773 | + RelativeWindowGeometry, |
1774 | + currentX, |
1775 | + currentY, |
1776 | + width, |
1777 | + height, |
1778 | + _)); |
1779 | } |
1780 | |
1781 | TEST_F (CompizXorgSystemConfigureWindowTest, SetFrameExtentsLocked) |
1782 | @@ -562,11 +566,13 @@ |
1783 | SendConfigureLockRequest (w.client, false); |
1784 | |
1785 | /* Query the window size again - it should be the same */ |
1786 | - ASSERT_TRUE (VerifyWindowSize (w.frame, |
1787 | - currentX - left, |
1788 | - currentY - top, |
1789 | - currentWidth + (left + right), |
1790 | - currentHeight + (top + bottom))); |
1791 | + ASSERT_THAT (w.frame, HasGeometry (dpy, |
1792 | + RelativeWindowGeometry, |
1793 | + currentX - left, |
1794 | + currentY - top, |
1795 | + currentWidth + (left + right), |
1796 | + currentHeight + (top + bottom), |
1797 | + _)); |
1798 | } |
1799 | |
1800 | /* Check that changing the frame extents by one on each side |
1801 | @@ -598,11 +604,13 @@ |
1802 | /* Wrapper geometry is extents.xy, size.wh */ |
1803 | Window root; |
1804 | Window wrapper = ct::GetImmediateParent (dpy, w.client, root); |
1805 | - ASSERT_TRUE (VerifyWindowSize (wrapper, |
1806 | - left, |
1807 | - top, |
1808 | - currentWidth, |
1809 | - currentHeight)); |
1810 | + ASSERT_THAT (wrapper, HasGeometry (dpy, |
1811 | + RelativeWindowGeometry, |
1812 | + left, |
1813 | + top, |
1814 | + currentWidth, |
1815 | + currentHeight, |
1816 | + _)); |
1817 | } |
1818 | |
1819 | TEST_F (CompizXorgSystemConfigureWindowTest, SetFrameExtentsUnmapped) |
1820 | @@ -632,11 +640,13 @@ |
1821 | SendSetFrameExtentsRequest (client, left, right, top, bottom); |
1822 | ASSERT_TRUE (VerifySetFrameExtentsResponse (client, left, right, top, bottom)); |
1823 | |
1824 | - ASSERT_TRUE (VerifyWindowSize (client, |
1825 | - currentX, |
1826 | - currentY, |
1827 | - currentWidth, |
1828 | - currentHeight)); |
1829 | + ASSERT_THAT (client, HasGeometry (dpy, |
1830 | + RelativeWindowGeometry, |
1831 | + currentX, |
1832 | + currentY, |
1833 | + currentWidth, |
1834 | + currentHeight, |
1835 | + _)); |
1836 | } |
1837 | |
1838 | TEST_F (CompizXorgSystemConfigureWindowTest, SetFrameExtentsCorrectMapBehaviour) |
1839 | @@ -670,20 +680,24 @@ |
1840 | |
1841 | /* Check the geometry of the frame */ |
1842 | Window frame = GetTopParent (dpy, client); |
1843 | - ASSERT_TRUE (VerifyWindowSize (frame, |
1844 | - currentX, |
1845 | - currentY, |
1846 | - currentWidth + (left + right), |
1847 | - currentHeight + (top + bottom))); |
1848 | + ASSERT_THAT (frame, HasGeometry (dpy, |
1849 | + RelativeWindowGeometry, |
1850 | + currentX - left, |
1851 | + currentY - top, |
1852 | + currentWidth + (left + right), |
1853 | + currentHeight + (top + bottom), |
1854 | + _)); |
1855 | |
1856 | /* Wrapper geometry is extents.xy, size.wh */ |
1857 | Window root; |
1858 | Window wrapper = ct::GetImmediateParent (dpy, client, root); |
1859 | - ASSERT_TRUE (VerifyWindowSize (wrapper, |
1860 | - left, |
1861 | - top, |
1862 | - currentWidth, |
1863 | - currentHeight)); |
1864 | + ASSERT_THAT (wrapper, HasGeometry (dpy, |
1865 | + RelativeWindowGeometry, |
1866 | + left, |
1867 | + top, |
1868 | + currentWidth, |
1869 | + currentHeight, |
1870 | + _)); |
1871 | } |
1872 | |
1873 | TEST_F (CompizXorgSystemConfigureWindowTest, SetFrameExtentsConsistentBehaviourAfterMap) |
1874 | @@ -725,20 +739,24 @@ |
1875 | |
1876 | /* Check the geometry of the frame */ |
1877 | Window frame = GetTopParent (dpy, client); |
1878 | - ASSERT_TRUE (VerifyWindowSize (frame, |
1879 | - currentX, |
1880 | - currentY, |
1881 | - currentWidth + (left + right), |
1882 | - currentHeight + (top + bottom))); |
1883 | + ASSERT_THAT (frame, HasGeometry (dpy, |
1884 | + RelativeWindowGeometry, |
1885 | + currentX - left, |
1886 | + currentY - top, |
1887 | + currentWidth + (left + right), |
1888 | + currentHeight + (top + bottom), |
1889 | + _)); |
1890 | |
1891 | /* Wrapper geometry is extents.xy, size.wh */ |
1892 | Window root; |
1893 | Window wrapper = ct::GetImmediateParent (dpy, client, root); |
1894 | - ASSERT_TRUE (VerifyWindowSize (wrapper, |
1895 | - left, |
1896 | - top, |
1897 | - currentWidth, |
1898 | - currentHeight)); |
1899 | + ASSERT_THAT (wrapper, HasGeometry (dpy, |
1900 | + RelativeWindowGeometry, |
1901 | + left, |
1902 | + top, |
1903 | + currentWidth, |
1904 | + currentHeight, |
1905 | + _)); |
1906 | } |
1907 | |
1908 | |
1909 | |
1910 | === modified file 'tests/xorg-gtest/CMakeLists.txt' |
1911 | --- tests/xorg-gtest/CMakeLists.txt 2013-06-10 08:43:28 +0000 |
1912 | +++ tests/xorg-gtest/CMakeLists.txt 2013-06-29 07:09:28 +0000 |
1913 | @@ -4,7 +4,8 @@ |
1914 | set (COMPIZ_XORG_GTEST_COMMUNICATOR_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/communicator CACHE PATH "" FORCE) |
1915 | set (COMPIZ_XORG_GTEST_COMMUNICATOR_LIBRARY_DIRS ${CMAKE_CURRENT_BINARY_DIR}/communicator CACHE PATH "" FORCE) |
1916 | set (COMPIZ_XORG_GTEST_COMMUNICATOR_LIBRARY compiz_xorg_gtest_communicator CACHE STRING "" FORCE) |
1917 | -set (COMPIZ_OVERRIDE_PLUGIN_PATH ${CMAKE_CURRENT_BINARY_DIR}/plugins/testhelper) |
1918 | +set (COMPIZ_TEST_ONLY_PLUGIN_PATH ${CMAKE_CURRENT_BINARY_DIR}/plugins/) |
1919 | +set (COMPIZ_REAL_PLUGIN_PATH ${CMAKE_BINARY_DIR}/plugins/) |
1920 | |
1921 | configure_file (${CMAKE_CURRENT_SOURCE_DIR}/src/compiz-xorg-gtest-config.h.in |
1922 | ${CMAKE_CURRENT_BINARY_DIR}/src/compiz-xorg-gtest-config.h |
1923 | |
1924 | === modified file 'tests/xorg-gtest/include/compiz-xorg-gtest.h' |
1925 | --- tests/xorg-gtest/include/compiz-xorg-gtest.h 2013-06-22 12:27:36 +0000 |
1926 | +++ tests/xorg-gtest/include/compiz-xorg-gtest.h 2013-06-29 07:09:28 +0000 |
1927 | @@ -30,6 +30,7 @@ |
1928 | |
1929 | using ::testing::MatcherInterface; |
1930 | using ::testing::MatchResultListener; |
1931 | +using ::testing::Matcher; |
1932 | |
1933 | namespace compiz |
1934 | { |
1935 | @@ -143,6 +144,62 @@ |
1936 | const XEventMatcher &matcher, |
1937 | int timeout = 0); |
1938 | |
1939 | + void RelativeWindowGeometry (Display *dpy, |
1940 | + Window w, |
1941 | + int &x, |
1942 | + int &y, |
1943 | + unsigned int &width, |
1944 | + unsigned int &height, |
1945 | + unsigned int &border); |
1946 | + |
1947 | + void AbsoluteWindowGeometry (::Display *display, |
1948 | + Window window, |
1949 | + int &x, |
1950 | + int &y, |
1951 | + unsigned int &width, |
1952 | + unsigned int &height, |
1953 | + unsigned int &border); |
1954 | + |
1955 | + typedef void (*RetrievalFunc) (Display *dpy, |
1956 | + Window window, |
1957 | + int &x, |
1958 | + int &y, |
1959 | + unsigned int &width, |
1960 | + unsigned int &height, |
1961 | + unsigned int &border); |
1962 | + |
1963 | + class WindowGeometryMatcher : |
1964 | + public MatcherInterface <Window> |
1965 | + { |
1966 | + public: |
1967 | + |
1968 | + WindowGeometryMatcher (Display *dpy, |
1969 | + RetrievalFunc func, |
1970 | + const Matcher <int> &x, |
1971 | + const Matcher <int> &y, |
1972 | + const Matcher <unsigned int> &width, |
1973 | + const Matcher <unsigned int> &height, |
1974 | + const Matcher <unsigned int> &border); |
1975 | + |
1976 | + bool MatchAndExplain (Window x, MatchResultListener *listener) const; |
1977 | + void DescribeTo (std::ostream *os) const; |
1978 | + |
1979 | + private: |
1980 | + |
1981 | + class Private; |
1982 | + |
1983 | + std::auto_ptr <Private> priv; |
1984 | + }; |
1985 | + |
1986 | + Matcher <Window> |
1987 | + HasGeometry (Display *dpy, |
1988 | + RetrievalFunc func, |
1989 | + const Matcher <int> &x, |
1990 | + const Matcher <int> &y, |
1991 | + const Matcher <unsigned int> &width, |
1992 | + const Matcher <unsigned int> &height, |
1993 | + const Matcher <unsigned int> &border); |
1994 | + |
1995 | class PrivateCompizProcess; |
1996 | class CompizProcess |
1997 | { |
1998 | @@ -154,7 +211,26 @@ |
1999 | ExpectStartupFailure = (1 << 2) |
2000 | } StartupFlags; |
2001 | |
2002 | - typedef std::vector <std::string> PluginList; |
2003 | + typedef enum _PluginType |
2004 | + { |
2005 | + Real = 0, |
2006 | + TestOnly = 1 |
2007 | + } PluginType; |
2008 | + |
2009 | + struct Plugin |
2010 | + { |
2011 | + Plugin (const char *name, |
2012 | + PluginType type) : |
2013 | + name (name), |
2014 | + type (type) |
2015 | + { |
2016 | + } |
2017 | + |
2018 | + std::string name; |
2019 | + PluginType type; |
2020 | + }; |
2021 | + |
2022 | + typedef std::vector <Plugin> PluginList; |
2023 | |
2024 | CompizProcess (Display *dpy, |
2025 | StartupFlags, |
2026 | @@ -196,7 +272,7 @@ |
2027 | AutostartCompizXorgSystemTest (); |
2028 | |
2029 | virtual CompizProcess::StartupFlags GetStartupFlags (); |
2030 | - virtual int GetEventMask (); |
2031 | + virtual int GetEventMask () const; |
2032 | virtual CompizProcess::PluginList GetPluginList (); |
2033 | virtual void SetUp (); |
2034 | |
2035 | @@ -222,7 +298,7 @@ |
2036 | std::vector <long> WaitForWindowCreation (Window w); |
2037 | bool IsOverrideRedirect (std::vector <long> &data); |
2038 | |
2039 | - virtual int GetEventMask (); |
2040 | + virtual int GetEventMask () const; |
2041 | |
2042 | private: |
2043 | |
2044 | |
2045 | === modified file 'tests/xorg-gtest/plugins/testhelper/src/testhelper.cpp' |
2046 | --- tests/xorg-gtest/plugins/testhelper/src/testhelper.cpp 2013-05-09 13:43:07 +0000 |
2047 | +++ tests/xorg-gtest/plugins/testhelper/src/testhelper.cpp 2013-06-29 07:09:28 +0000 |
2048 | @@ -141,14 +141,11 @@ |
2049 | void |
2050 | TestHelperWindow::setFrameExtentsAndReport (long *data) |
2051 | { |
2052 | - CompWindowExtents input; |
2053 | - |
2054 | - input.left = data[0]; |
2055 | - input.right = data[1]; |
2056 | - input.top = data[2]; |
2057 | - input.bottom = data[3]; |
2058 | - |
2059 | - window->setWindowFrameExtents (&input, &input); |
2060 | + /* Only change the frame input and not the border */ |
2061 | + CompWindowExtents input (data[0], data[1], data[2], data[3]); |
2062 | + CompWindowExtents border (0, 0, 0, 0); |
2063 | + |
2064 | + window->setWindowFrameExtents (&border, &input); |
2065 | |
2066 | std::vector <long> response; |
2067 | |
2068 | |
2069 | === modified file 'tests/xorg-gtest/src/compiz-xorg-gtest-config.h.in' |
2070 | --- tests/xorg-gtest/src/compiz-xorg-gtest-config.h.in 2013-02-14 05:57:39 +0000 |
2071 | +++ tests/xorg-gtest/src/compiz-xorg-gtest-config.h.in 2013-06-29 07:09:28 +0000 |
2072 | @@ -27,7 +27,8 @@ |
2073 | { |
2074 | const std::string compizLDLibraryPath ("@COMPIZ_LD_LIBRARY_PATH@"); |
2075 | const std::string compizBinaryPath ("@COMPIZ_BINARY@"); |
2076 | - const std::string compizOverridePluginPath ("@COMPIZ_OVERRIDE_PLUGIN_PATH@"); |
2077 | + const std::string compizTestOnlyPluginPath ("@COMPIZ_TEST_ONLY_PLUGIN_PATH@"); |
2078 | + const std::string compizRealPluginPath ("@COMPIZ_REAL_PLUGIN_PATH@"); |
2079 | } |
2080 | |
2081 | #endif |
2082 | |
2083 | === modified file 'tests/xorg-gtest/src/compiz-xorg-gtest.cpp' |
2084 | --- tests/xorg-gtest/src/compiz-xorg-gtest.cpp 2013-06-22 12:27:36 +0000 |
2085 | +++ tests/xorg-gtest/src/compiz-xorg-gtest.cpp 2013-06-29 07:09:28 +0000 |
2086 | @@ -38,8 +38,10 @@ |
2087 | |
2088 | #include "compiz-xorg-gtest-config.h" |
2089 | |
2090 | +using ::testing::MakeMatcher; |
2091 | using ::testing::MatchResultListener; |
2092 | using ::testing::MatcherInterface; |
2093 | +using ::testing::Matcher; |
2094 | |
2095 | namespace ct = compiz::testing; |
2096 | namespace |
2097 | @@ -512,6 +514,161 @@ |
2098 | { |
2099 | } |
2100 | |
2101 | +void ct::RelativeWindowGeometry (Display *dpy, |
2102 | + Window w, |
2103 | + int &x, |
2104 | + int &y, |
2105 | + unsigned int &width, |
2106 | + unsigned int &height, |
2107 | + unsigned int &border) |
2108 | +{ |
2109 | + Window root; |
2110 | + unsigned int depth; |
2111 | + |
2112 | + if (!XGetGeometry (dpy, w, &root, &x, &y, &width, &height, &border, &depth)) |
2113 | + throw std::logic_error ("XGetGeometry failed"); |
2114 | +} |
2115 | + |
2116 | +void ct::AbsoluteWindowGeometry (Display *display, |
2117 | + Window window, |
2118 | + int &x, |
2119 | + int &y, |
2120 | + unsigned int &width, |
2121 | + unsigned int &height, |
2122 | + unsigned int &border) |
2123 | +{ |
2124 | + Window root; |
2125 | + Window child; |
2126 | + unsigned int depth; |
2127 | + |
2128 | + if (!XGetGeometry (display, window, &root, |
2129 | + &x, &y, &width, &height, |
2130 | + &border, &depth)) |
2131 | + throw std::logic_error ("XGetGeometry failed"); |
2132 | + |
2133 | + if (!XTranslateCoordinates (display, window, root, x, y, |
2134 | + &x, &y, &child)) |
2135 | + throw std::logic_error ("XTranslateCoordinates failed"); |
2136 | +} |
2137 | + |
2138 | +class ct::WindowGeometryMatcher::Private |
2139 | +{ |
2140 | + public: |
2141 | + |
2142 | + Private (Display *dpy, |
2143 | + ct::RetrievalFunc func, |
2144 | + const Matcher <int> &x, |
2145 | + const Matcher <int> &y, |
2146 | + const Matcher <unsigned int> &width, |
2147 | + const Matcher <unsigned int> &height, |
2148 | + const Matcher <unsigned int> &border); |
2149 | + |
2150 | + Display *mDpy; |
2151 | + |
2152 | + RetrievalFunc mFunc; |
2153 | + |
2154 | + Matcher <int> mX; |
2155 | + Matcher <int> mY; |
2156 | + Matcher <unsigned int> mWidth; |
2157 | + Matcher <unsigned int> mHeight; |
2158 | + Matcher <unsigned int> mBorder; |
2159 | +}; |
2160 | + |
2161 | +Matcher <Window> |
2162 | +ct::HasGeometry (Display *dpy, |
2163 | + RetrievalFunc func, |
2164 | + const Matcher <int> &x, |
2165 | + const Matcher <int> &y, |
2166 | + const Matcher <unsigned int> &width, |
2167 | + const Matcher <unsigned int> &height, |
2168 | + const Matcher <unsigned int> &border) |
2169 | +{ |
2170 | + return MakeMatcher (new WindowGeometryMatcher (dpy, |
2171 | + func, |
2172 | + x, |
2173 | + y, |
2174 | + width, |
2175 | + height, |
2176 | + border)); |
2177 | +} |
2178 | + |
2179 | +ct::WindowGeometryMatcher::WindowGeometryMatcher (Display *dpy, |
2180 | + RetrievalFunc func, |
2181 | + const Matcher <int> &x, |
2182 | + const Matcher <int> &y, |
2183 | + const Matcher <unsigned int> &width, |
2184 | + const Matcher <unsigned int> &height, |
2185 | + const Matcher <unsigned int> &border) : |
2186 | + priv (new Private (dpy, func, x, y, width, height, border)) |
2187 | +{ |
2188 | +} |
2189 | + |
2190 | +ct::WindowGeometryMatcher::Private::Private (Display *dpy, |
2191 | + RetrievalFunc func, |
2192 | + const Matcher <int> &x, |
2193 | + const Matcher <int> &y, |
2194 | + const Matcher <unsigned int> &width, |
2195 | + const Matcher <unsigned int> &height, |
2196 | + const Matcher <unsigned int> &border): |
2197 | + mDpy (dpy), |
2198 | + mFunc (func), |
2199 | + mX (x), |
2200 | + mY (y), |
2201 | + mWidth (width), |
2202 | + mHeight (height), |
2203 | + mBorder (border) |
2204 | +{ |
2205 | +} |
2206 | + |
2207 | +bool |
2208 | +ct::WindowGeometryMatcher::MatchAndExplain (Window w, |
2209 | + MatchResultListener *listener) const |
2210 | +{ |
2211 | + int x, y; |
2212 | + unsigned int width, height, border; |
2213 | + |
2214 | + priv->mFunc (priv->mDpy, w, x, y, width, height, border); |
2215 | + |
2216 | + bool match = priv->mX.MatchAndExplain (x, listener) && |
2217 | + priv->mY.MatchAndExplain (y, listener) && |
2218 | + priv->mWidth.MatchAndExplain (width, listener) && |
2219 | + priv->mHeight.MatchAndExplain (height, listener) && |
2220 | + priv->mBorder.MatchAndExplain (border, listener); |
2221 | + |
2222 | + if (!match) |
2223 | + { |
2224 | + *listener << "Geometry:" |
2225 | + << " x: " << x |
2226 | + << " y: " << y |
2227 | + << " width: " << width |
2228 | + << " height: " << height |
2229 | + << " border: " << border; |
2230 | + } |
2231 | + |
2232 | + return match; |
2233 | +} |
2234 | + |
2235 | +void |
2236 | +ct::WindowGeometryMatcher::DescribeTo (std::ostream *os) const |
2237 | +{ |
2238 | + *os << "Window geometry matching :"; |
2239 | + |
2240 | + *os << std::endl << " - "; |
2241 | + priv->mX.DescribeTo (os); |
2242 | + |
2243 | + *os << std::endl << " - "; |
2244 | + priv->mY.DescribeTo (os); |
2245 | + |
2246 | + *os << std::endl << " - "; |
2247 | + priv->mWidth.DescribeTo (os); |
2248 | + |
2249 | + *os << std::endl << " - "; |
2250 | + priv->mHeight.DescribeTo (os); |
2251 | + |
2252 | + *os << std::endl << " - "; |
2253 | + priv->mBorder.DescribeTo (os); |
2254 | +} |
2255 | + |
2256 | class ct::PrivateCompizProcess |
2257 | { |
2258 | public: |
2259 | @@ -530,6 +687,9 @@ |
2260 | ct::CompizProcess::StartupFlags mFlags; |
2261 | bool mIsRunning; |
2262 | xorg::testing::Process mProcess; |
2263 | + |
2264 | + std::string mPluginPaths; |
2265 | + std::auto_ptr <TmpEnv> mPluginPathsEnv; |
2266 | }; |
2267 | |
2268 | void |
2269 | @@ -564,6 +724,26 @@ |
2270 | XSelectInput (dpy, root, attrib.your_event_mask); |
2271 | } |
2272 | |
2273 | +namespace |
2274 | +{ |
2275 | +std::string PathForPlugin (const std::string &name, |
2276 | + ct::CompizProcess::PluginType type) |
2277 | +{ |
2278 | + switch (type) |
2279 | + { |
2280 | + case ct::CompizProcess::Real: |
2281 | + return compizRealPluginPath + name; |
2282 | + case ct::CompizProcess::TestOnly: |
2283 | + return compizTestOnlyPluginPath + name; |
2284 | + default: |
2285 | + throw std::logic_error ("Incorrect value for type"); |
2286 | + } |
2287 | + |
2288 | + return ""; |
2289 | +} |
2290 | + |
2291 | +} |
2292 | + |
2293 | ct::CompizProcess::CompizProcess (::Display *dpy, |
2294 | ct::CompizProcess::StartupFlags flags, |
2295 | const ct::CompizProcess::PluginList &plugins, |
2296 | @@ -579,11 +759,17 @@ |
2297 | |
2298 | args.push_back ("--send-startup-message"); |
2299 | |
2300 | - /* Copy in plugin list */ |
2301 | + /* Copy in plugin list and set environment variables */ |
2302 | for (ct::CompizProcess::PluginList::const_iterator it = plugins.begin (); |
2303 | it != plugins.end (); |
2304 | ++it) |
2305 | - args.push_back (*it); |
2306 | + { |
2307 | + priv->mPluginPaths += PathForPlugin (it->name, it->type) + ":"; |
2308 | + args.push_back (it->name); |
2309 | + } |
2310 | + |
2311 | + priv->mPluginPathsEnv.reset (new TmpEnv ("COMPIZ_PLUGIN_DIR", |
2312 | + priv->mPluginPaths.c_str ())); |
2313 | |
2314 | priv->mProcess.Start (compizBinaryPath, args); |
2315 | EXPECT_EQ (priv->mProcess.GetState (), xorg::testing::Process::RUNNING); |
2316 | @@ -703,14 +889,6 @@ |
2317 | |
2318 | class ct::PrivateAutostartCompizXorgSystemTest |
2319 | { |
2320 | - public: |
2321 | - |
2322 | - PrivateAutostartCompizXorgSystemTest () : |
2323 | - overridePluginDirEnv ("COMPIZ_PLUGIN_DIR", compizOverridePluginPath.c_str ()) |
2324 | - { |
2325 | - } |
2326 | - |
2327 | - TmpEnv overridePluginDirEnv; |
2328 | }; |
2329 | |
2330 | ct::AutostartCompizXorgSystemTest::AutostartCompizXorgSystemTest () : |
2331 | @@ -727,7 +905,7 @@ |
2332 | } |
2333 | |
2334 | int |
2335 | -ct::AutostartCompizXorgSystemTest::GetEventMask () |
2336 | +ct::AutostartCompizXorgSystemTest::GetEventMask () const |
2337 | { |
2338 | return 0; |
2339 | } |
2340 | @@ -805,7 +983,7 @@ |
2341 | } |
2342 | |
2343 | int |
2344 | -ct::AutostartCompizXorgSystemTestWithTestHelper::GetEventMask () |
2345 | +ct::AutostartCompizXorgSystemTestWithTestHelper::GetEventMask () const |
2346 | { |
2347 | return AutostartCompizXorgSystemTest::GetEventMask () | |
2348 | StructureNotifyMask; |
2349 | @@ -837,6 +1015,7 @@ |
2350 | ct::AutostartCompizXorgSystemTestWithTestHelper::GetPluginList () |
2351 | { |
2352 | ct::CompizProcess::PluginList list; |
2353 | - list.push_back ("testhelper"); |
2354 | + list.push_back (ct::CompizProcess::Plugin ("testhelper", |
2355 | + ct::CompizProcess::TestOnly)); |
2356 | return list; |
2357 | } |
368 + int GetEventMask ();
Const?
The following tests FAILED: WindowAcceptanc e.MaximizeBorde rExtentsOnMaxim ize (Failed) WindowAcceptanc e.MaximizeBorde rExtentsOnVertM aximize (Failed) WindowAcceptanc e.MaximizeBorde rExtentsOnHorzM aximize (Failed) WindowAcceptanc e.MaximizeFrame WindowSizeEqOut putSize (Failed) WindowAcceptanc e.VertMaximizeF rameWindowSizeE qOutputYHeight (Failed) WindowAcceptanc e.HorzMaximizeF rameWindowSizeE qOutputXWidth (Failed) WindowAcceptanc e.VertMaximizeF rameWindowSizeS ameXWidth (Failed) WindowAcceptanc e.HorzMaximizeF rameWindowSizeS ameYHeight (Failed) WindowAcceptanc e.UndecoratedWi ndowExpandToOri gSize (Failed) WindowAcceptanc e.UndecorateSta ticGravityWindo w (Failed)
1481 - PixmapDecorated
1482 - PixmapDecorated
1483 - PixmapDecorated
1484 - PixmapDecorated
1485 - PixmapDecorated
1486 - PixmapDecorated
1487 - PixmapDecorated
1488 - PixmapDecorated
1489 - PixmapDecorated
1490 - PixmapDecorated
Note this is just with a compiled branch...though it shoudn't depend on if I have the branch running or not if they are unit tests.
Start 1451: AdjustmentExten ts/PixmapDecora tionAdjustment. AdjustRestoredW indowBorderShri nkClient/ 0
This test hangs sometimes forever. (At lease as far as im willing to let it sit :)
Start 1485: PixmapDecorated WindowAcceptanc e.VertMaximizeF rameWindowSizeE qOutputYHeight
Then this wont hung...as well as some others :)...not entirely sure why.
Still have some more reviewing to go :)