Merge lp:~smspillaz/compiz-wall-plugin/compiz-wall-plugin.fix_939228 into lp:compiz-wall-plugin
- compiz-wall-plugin.fix_939228
- Merge into 0.9.5
Status: | Merged |
---|---|
Merged at revision: | 133 |
Proposed branch: | lp:~smspillaz/compiz-wall-plugin/compiz-wall-plugin.fix_939228 |
Merge into: | lp:compiz-wall-plugin |
Diff against target: |
452 lines (+343/-44) 8 files modified
CMakeLists.txt (+4/-1) src/offset_movement/CMakeLists.txt (+57/-0) src/offset_movement/include/offset-movement.h (+41/-0) src/offset_movement/src/offset-movement.cpp (+62/-0) src/offset_movement/tests/CMakeLists.txt (+58/-0) src/offset_movement/tests/test-wall-offset-movement.cpp (+97/-0) src/wall.cpp (+22/-43) src/wall.h (+2/-0) |
To merge this branch: | bzr merge lp:~smspillaz/compiz-wall-plugin/compiz-wall-plugin.fix_939228 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel van Vugt | Approve | ||
Review via email: mp+104005@code.launchpad.net |
This proposal supersedes a proposal from 2012-04-24.
Commit message
Description of the change
== Problem ==
Another arm of bug 939228 : if a window spanned two monitors it would shift around on viewport changes
== Solution ==
Take all workareas into account when calculating window shift
== test ==
included.
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal | # |
Linking CXX executable compiz_
/usr/bin/ld: cannot find -lcompiz_core
collect2: ld returned 1 exit status
make[2]: *** [src/offset_
make[1]: *** [src/offset_
make: *** [all] Error 2
Sam Spilsbury (smspillaz) wrote : | # |
Curious. It compiles fine here and
pkg_check_modules (
GLIBMM
REQUIRED
glibmm-2.4 glib-2.0 compiz
)
INCLUDE_DIRECTORIES (
${CMAKE_
${CMAKE_
${CMAKE_
${Boost_
${GLIBMM_
)
LINK_DIRECTORIES (${GLIBMM_
^ should take care of finding the right directory for libcompiz_core . I suspect your install is broken. What is the output of make when CMAKE_VERBOSE_
Daniel van Vugt (vanvugt) wrote : | # |
Looks OK and seems to work.
Preview Diff
1 | === modified file 'CMakeLists.txt' | |||
2 | --- CMakeLists.txt 2012-04-24 08:39:54 +0000 | |||
3 | +++ CMakeLists.txt 2012-04-28 19:08:18 +0000 | |||
4 | @@ -2,4 +2,7 @@ | |||
5 | 2 | 2 | ||
6 | 3 | include (CompizPlugin) | 3 | include (CompizPlugin) |
7 | 4 | 4 | ||
9 | 5 | compiz_plugin (wall PLUGINDEPS composite opengl mousepoll PKGDEPS cairo cairo-xlib-xrender LIBRARIES dl) | 5 | add_subdirectory (src/offset_movement) |
10 | 6 | include_directories (src/offset_movement/include) | ||
11 | 7 | |||
12 | 8 | compiz_plugin (wall PLUGINDEPS composite opengl mousepoll PKGDEPS cairo cairo-xlib-xrender LIBRARIES compiz_wall_offset_movement dl) | ||
13 | 6 | 9 | ||
14 | === added directory 'src/offset_movement' | |||
15 | === added file 'src/offset_movement/CMakeLists.txt' | |||
16 | --- src/offset_movement/CMakeLists.txt 1970-01-01 00:00:00 +0000 | |||
17 | +++ src/offset_movement/CMakeLists.txt 2012-04-28 19:08:18 +0000 | |||
18 | @@ -0,0 +1,57 @@ | |||
19 | 1 | pkg_check_modules ( | ||
20 | 2 | GLIBMM | ||
21 | 3 | REQUIRED | ||
22 | 4 | glibmm-2.4 glib-2.0 compiz | ||
23 | 5 | ) | ||
24 | 6 | |||
25 | 7 | INCLUDE_DIRECTORIES ( | ||
26 | 8 | ${CMAKE_CURRENT_SOURCE_DIR}/include | ||
27 | 9 | ${CMAKE_CURRENT_SOURCE_DIR}/src | ||
28 | 10 | |||
29 | 11 | ${CMAKE_SOURCE_DIR}/include | ||
30 | 12 | |||
31 | 13 | ${Boost_INCLUDE_DIRS} | ||
32 | 14 | |||
33 | 15 | ${GLIBMM_INCLUDE_DIRS} | ||
34 | 16 | ) | ||
35 | 17 | |||
36 | 18 | LINK_DIRECTORIES (${GLIBMM_LIBRARY_DIRS}) | ||
37 | 19 | |||
38 | 20 | SET ( | ||
39 | 21 | PUBLIC_HEADERS | ||
40 | 22 | ) | ||
41 | 23 | |||
42 | 24 | SET ( | ||
43 | 25 | PRIVATE_HEADERS | ||
44 | 26 | ${CMAKE_CURRENT_SOURCE_DIR}/include/offset-movement.h | ||
45 | 27 | ) | ||
46 | 28 | |||
47 | 29 | SET( | ||
48 | 30 | SRCS | ||
49 | 31 | ${CMAKE_CURRENT_SOURCE_DIR}/src/offset-movement.cpp | ||
50 | 32 | ) | ||
51 | 33 | |||
52 | 34 | ADD_LIBRARY( | ||
53 | 35 | compiz_wall_offset_movement STATIC | ||
54 | 36 | |||
55 | 37 | ${SRCS} | ||
56 | 38 | |||
57 | 39 | ${PUBLIC_HEADERS} | ||
58 | 40 | ${PRIVATE_HEADERS} | ||
59 | 41 | ) | ||
60 | 42 | |||
61 | 43 | if (COMPIZ_BUILD_TESTING) | ||
62 | 44 | ADD_SUBDIRECTORY( ${CMAKE_CURRENT_SOURCE_DIR}/tests ) | ||
63 | 45 | endif (COMPIZ_BUILD_TESTING) | ||
64 | 46 | |||
65 | 47 | SET_TARGET_PROPERTIES( | ||
66 | 48 | compiz_wall_offset_movement PROPERTIES | ||
67 | 49 | PUBLIC_HEADER "${PUBLIC_HEADERS}" | ||
68 | 50 | ) | ||
69 | 51 | |||
70 | 52 | TARGET_LINK_LIBRARIES( | ||
71 | 53 | compiz_wall_offset_movement | ||
72 | 54 | |||
73 | 55 | compiz_core | ||
74 | 56 | ${GLIBMM_LIBRARIES} | ||
75 | 57 | ) | ||
76 | 0 | 58 | ||
77 | === added directory 'src/offset_movement/include' | |||
78 | === added file 'src/offset_movement/include/offset-movement.h' | |||
79 | --- src/offset_movement/include/offset-movement.h 1970-01-01 00:00:00 +0000 | |||
80 | +++ src/offset_movement/include/offset-movement.h 2012-04-28 19:08:18 +0000 | |||
81 | @@ -0,0 +1,41 @@ | |||
82 | 1 | /** | ||
83 | 2 | * | ||
84 | 3 | * Compiz wall plugin | ||
85 | 4 | * | ||
86 | 5 | * offset-movement.h | ||
87 | 6 | * | ||
88 | 7 | * Copyright (c) 2006 Robert Carr <racarr@beryl-project.org> | ||
89 | 8 | * | ||
90 | 9 | * Authors: | ||
91 | 10 | * Robert Carr <racarr@beryl-project.org> | ||
92 | 11 | * Dennis Kasprzyk <onestone@opencompositing.org> | ||
93 | 12 | * | ||
94 | 13 | * This program is free software; you can redistribute it and/or | ||
95 | 14 | * modify it under the terms of the GNU General Public License | ||
96 | 15 | * as published by the Free Software Foundation; either version 2 | ||
97 | 16 | * of the License, or (at your option) any later version. | ||
98 | 17 | * | ||
99 | 18 | * This program is distributed in the hope that it will be useful, | ||
100 | 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
101 | 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
102 | 21 | * GNU General Public License for more details. | ||
103 | 22 | * | ||
104 | 23 | **/ | ||
105 | 24 | |||
106 | 25 | #ifndef _COMPIZ_WALL_OFFSET_MOVEMENT_H | ||
107 | 26 | #define _COMPIZ_WALL_OFFSET_MOVEMENT_H | ||
108 | 27 | |||
109 | 28 | #include <core/region.h> | ||
110 | 29 | #include <core/rect.h> | ||
111 | 30 | #include <core/point.h> | ||
112 | 31 | |||
113 | 32 | namespace compiz | ||
114 | 33 | { | ||
115 | 34 | namespace wall | ||
116 | 35 | { | ||
117 | 36 | CompPoint movementWindowOnScreen (const CompRect &serverBorderRect, | ||
118 | 37 | const CompRegion &screenRegion); | ||
119 | 38 | } | ||
120 | 39 | } | ||
121 | 40 | |||
122 | 41 | #endif | ||
123 | 0 | 42 | ||
124 | === added directory 'src/offset_movement/src' | |||
125 | === added file 'src/offset_movement/src/offset-movement.cpp' | |||
126 | --- src/offset_movement/src/offset-movement.cpp 1970-01-01 00:00:00 +0000 | |||
127 | +++ src/offset_movement/src/offset-movement.cpp 2012-04-28 19:08:18 +0000 | |||
128 | @@ -0,0 +1,62 @@ | |||
129 | 1 | /** | ||
130 | 2 | * | ||
131 | 3 | * Compiz wall plugin | ||
132 | 4 | * | ||
133 | 5 | * offset-movement.c | ||
134 | 6 | * | ||
135 | 7 | * Copyright (c) 2006 Robert Carr <racarr@beryl-project.org> | ||
136 | 8 | * | ||
137 | 9 | * Authors: | ||
138 | 10 | * Robert Carr <racarr@beryl-project.org> | ||
139 | 11 | * Dennis Kasprzyk <onestone@opencompositing.org> | ||
140 | 12 | * | ||
141 | 13 | * This program is free software; you can redistribute it and/or | ||
142 | 14 | * modify it under the terms of the GNU General Public License | ||
143 | 15 | * as published by the Free Software Foundation; either version 2 | ||
144 | 16 | * of the License, or (at your option) any later version. | ||
145 | 17 | * | ||
146 | 18 | * This program is distributed in the hope that it will be useful, | ||
147 | 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
148 | 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
149 | 21 | * GNU General Public License for more details. | ||
150 | 22 | * | ||
151 | 23 | **/ | ||
152 | 24 | |||
153 | 25 | #include "offset-movement.h" | ||
154 | 26 | |||
155 | 27 | CompPoint | ||
156 | 28 | compiz::wall::movementWindowOnScreen (const CompRect &serverBorderRect, | ||
157 | 29 | const CompRegion &screenRegion) | ||
158 | 30 | { | ||
159 | 31 | CompRegion sbrRegion (static_cast <const CompRect &> (serverBorderRect)); | ||
160 | 32 | |||
161 | 33 | /* If the window would be partially offscreen | ||
162 | 34 | * after it was moved then we should move it back | ||
163 | 35 | * so that it is completely onscreen, since we moved | ||
164 | 36 | * from mostly offscreen on B to mostly onscreen on A, | ||
165 | 37 | * the user should be able to see their selected window */ | ||
166 | 38 | CompRegion inter = sbrRegion.intersected (screenRegion); | ||
167 | 39 | CompRegion rem = sbrRegion - screenRegion; | ||
168 | 40 | |||
169 | 41 | int dx = 0; | ||
170 | 42 | int dy = 0; | ||
171 | 43 | |||
172 | 44 | for (std::vector <CompRect>::const_iterator it = rem.rects ().begin (); | ||
173 | 45 | it != rem.rects ().end (); | ||
174 | 46 | it++) | ||
175 | 47 | { | ||
176 | 48 | const CompRect &r = *it; | ||
177 | 49 | |||
178 | 50 | if (r.x1 () >= inter.boundingRect ().x2 ()) | ||
179 | 51 | dx -= r.width (); | ||
180 | 52 | else if (r.x2 () <= inter.boundingRect ().x1 ()) | ||
181 | 53 | dx += r.width (); | ||
182 | 54 | |||
183 | 55 | if (r.y1 () >= inter.boundingRect ().y2 ()) | ||
184 | 56 | dy -= r.height (); | ||
185 | 57 | else if (r.y2 () <= inter.boundingRect ().y1 ()) | ||
186 | 58 | dy += r.height (); | ||
187 | 59 | } | ||
188 | 60 | |||
189 | 61 | return CompPoint (dx, dy); | ||
190 | 62 | } | ||
191 | 0 | 63 | ||
192 | === added directory 'src/offset_movement/tests' | |||
193 | === added file 'src/offset_movement/tests/CMakeLists.txt' | |||
194 | --- src/offset_movement/tests/CMakeLists.txt 1970-01-01 00:00:00 +0000 | |||
195 | +++ src/offset_movement/tests/CMakeLists.txt 2012-04-28 19:08:18 +0000 | |||
196 | @@ -0,0 +1,58 @@ | |||
197 | 1 | # Build Google Test and make its headers known | ||
198 | 2 | find_package (GTest) | ||
199 | 3 | |||
200 | 4 | if (NOT GTEST_FOUND) | ||
201 | 5 | |||
202 | 6 | # Check for google test and build it locally | ||
203 | 7 | set (GTEST_ROOT_DIR | ||
204 | 8 | "/usr/src/gtest" # Default value, adjustable by user with e.g., ccmake | ||
205 | 9 | CACHE | ||
206 | 10 | PATH | ||
207 | 11 | "Path to Google test srcs" | ||
208 | 12 | ) | ||
209 | 13 | |||
210 | 14 | find_path (GTEST_INCLUDE_DIR gtest/gtest.h) | ||
211 | 15 | |||
212 | 16 | if (GTEST_INCLUDE_DIR) | ||
213 | 17 | #FIXME - hardcoded is bad! | ||
214 | 18 | add_subdirectory (${GTEST_ROOT_DIR} | ||
215 | 19 | gtest) | ||
216 | 20 | endif(GTEST_INCLUDE_DIR) | ||
217 | 21 | |||
218 | 22 | set (GTEST_BOTH_LIBRARIES gtest gtest_main) | ||
219 | 23 | set (GTEST_FOUND TRUE) | ||
220 | 24 | |||
221 | 25 | endif (NOT GTEST_FOUND) | ||
222 | 26 | |||
223 | 27 | pkg_check_modules ( | ||
224 | 28 | COMPIZ | ||
225 | 29 | REQUIRED | ||
226 | 30 | glibmm-2.4 glib-2.0 compiz | ||
227 | 31 | ) | ||
228 | 32 | |||
229 | 33 | find_library (GMOCK_LIBRARY gmock) | ||
230 | 34 | find_library (GMOCK_MAIN_LIBRARY gmock_main) | ||
231 | 35 | |||
232 | 36 | if (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND) | ||
233 | 37 | message ("Google Mock and Google Test not found - cannot build tests!") | ||
234 | 38 | set (COMPIZ_BUILD_TESTING OFF) | ||
235 | 39 | endif (NOT GMOCK_LIBRARY OR NOT GMOCK_MAIN_LIBRARY OR NOT GTEST_FOUND) | ||
236 | 40 | |||
237 | 41 | include_directories (${GTEST_INCLUDE_DIRS}) | ||
238 | 42 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}) | ||
239 | 43 | include_directories (${COMPIZ_INCLUDE_DIRS}) | ||
240 | 44 | |||
241 | 45 | link_directories (${COMPIZ_LIBRARY_DIRS}) | ||
242 | 46 | |||
243 | 47 | add_executable (compiz_test_wall_offset_movement | ||
244 | 48 | ${CMAKE_CURRENT_SOURCE_DIR}/test-wall-offset-movement.cpp) | ||
245 | 49 | |||
246 | 50 | target_link_libraries (compiz_test_wall_offset_movement | ||
247 | 51 | compiz_wall_offset_movement | ||
248 | 52 | ${GTEST_BOTH_LIBRARIES} | ||
249 | 53 | ${GMOCK_LIBRARY} | ||
250 | 54 | ${GMOCK_MAIN_LIBRARY} | ||
251 | 55 | ${CMAKE_THREAD_LIBS_INIT} # Link in pthread. | ||
252 | 56 | ) | ||
253 | 57 | |||
254 | 58 | gtest_add_tests (compiz_test_wall_offset_movement "" ${CMAKE_CURRENT_SOURCE_DIR}/test-wall-offset-movement.cpp) | ||
255 | 0 | 59 | ||
256 | === added file 'src/offset_movement/tests/test-wall-offset-movement.cpp' | |||
257 | --- src/offset_movement/tests/test-wall-offset-movement.cpp 1970-01-01 00:00:00 +0000 | |||
258 | +++ src/offset_movement/tests/test-wall-offset-movement.cpp 2012-04-28 19:08:18 +0000 | |||
259 | @@ -0,0 +1,97 @@ | |||
260 | 1 | #include <gtest/gtest.h> | ||
261 | 2 | #include <gmock/gmock.h> | ||
262 | 3 | |||
263 | 4 | #include "offset-movement.h" | ||
264 | 5 | |||
265 | 6 | class WallOffsetMovementTest : | ||
266 | 7 | public ::testing::Test | ||
267 | 8 | { | ||
268 | 9 | }; | ||
269 | 10 | |||
270 | 11 | TEST(WallOffsetMovementTest, TestOffsetRight) | ||
271 | 12 | { | ||
272 | 13 | CompRect sbr (750, 0, 500, 500); | ||
273 | 14 | CompRegion sr (0, 0, 1000, 1000); | ||
274 | 15 | |||
275 | 16 | CompPoint offset = compiz::wall::movementWindowOnScreen (sbr, sr); | ||
276 | 17 | |||
277 | 18 | EXPECT_EQ (offset, CompPoint (-250, 0)); | ||
278 | 19 | } | ||
279 | 20 | |||
280 | 21 | TEST(WallOffsetMovementTest, TestOffsetLeft) | ||
281 | 22 | { | ||
282 | 23 | CompRect sbr (-250, 0, 500, 500); | ||
283 | 24 | CompRegion sr (0, 0, 1000, 1000); | ||
284 | 25 | |||
285 | 26 | CompPoint offset = compiz::wall::movementWindowOnScreen (sbr, sr); | ||
286 | 27 | |||
287 | 28 | EXPECT_EQ (offset, CompPoint (250, 0)); | ||
288 | 29 | } | ||
289 | 30 | |||
290 | 31 | TEST(WallOffsetMovementTest, TestOffsetTop) | ||
291 | 32 | { | ||
292 | 33 | CompRect sbr (0, -250, 500, 500); | ||
293 | 34 | CompRegion sr (0, 0, 1000, 1000); | ||
294 | 35 | |||
295 | 36 | CompPoint offset = compiz::wall::movementWindowOnScreen (sbr, sr); | ||
296 | 37 | |||
297 | 38 | EXPECT_EQ (offset, CompPoint (0, 250)); | ||
298 | 39 | } | ||
299 | 40 | |||
300 | 41 | TEST(WallOffsetMovementTest, TestOffsetBottom) | ||
301 | 42 | { | ||
302 | 43 | CompRect sbr (0, 750, 500, 500); | ||
303 | 44 | CompRegion sr (0, 0, 1000, 1000); | ||
304 | 45 | |||
305 | 46 | CompPoint offset = compiz::wall::movementWindowOnScreen (sbr, sr); | ||
306 | 47 | |||
307 | 48 | EXPECT_EQ (offset, CompPoint (0, -250)); | ||
308 | 49 | } | ||
309 | 50 | |||
310 | 51 | TEST(WallOffsetMovementTest, TestOffsetRightMMSlice) | ||
311 | 52 | { | ||
312 | 53 | CompRect sbr (750, 0, 500, 500); | ||
313 | 54 | CompRegion sr (0, 0, 1000, 1000); | ||
314 | 55 | |||
315 | 56 | sr -= CompRegion (400, 0, 200, 0); | ||
316 | 57 | |||
317 | 58 | CompPoint offset = compiz::wall::movementWindowOnScreen (sbr, sr); | ||
318 | 59 | |||
319 | 60 | EXPECT_EQ (offset, CompPoint (-250, 0)); | ||
320 | 61 | } | ||
321 | 62 | |||
322 | 63 | TEST(WallOffsetMovementTest, TestOffsetLeftMMSlice) | ||
323 | 64 | { | ||
324 | 65 | CompRect sbr (-250, 0, 500, 500); | ||
325 | 66 | CompRegion sr (0, 0, 1000, 1000); | ||
326 | 67 | |||
327 | 68 | sr -= CompRegion (400, 0, 200, 0); | ||
328 | 69 | |||
329 | 70 | CompPoint offset = compiz::wall::movementWindowOnScreen (sbr, sr); | ||
330 | 71 | |||
331 | 72 | EXPECT_EQ (offset, CompPoint (250, 0)); | ||
332 | 73 | } | ||
333 | 74 | |||
334 | 75 | TEST(WallOffsetMovementTest, TestOffsetTopMMSlice) | ||
335 | 76 | { | ||
336 | 77 | CompRect sbr (0, -250, 500, 500); | ||
337 | 78 | CompRegion sr (0, 0, 1000, 1000); | ||
338 | 79 | |||
339 | 80 | sr -= CompRegion (400, 0, 200, 0); | ||
340 | 81 | |||
341 | 82 | CompPoint offset = compiz::wall::movementWindowOnScreen (sbr, sr); | ||
342 | 83 | |||
343 | 84 | EXPECT_EQ (offset, CompPoint (0, 250)); | ||
344 | 85 | } | ||
345 | 86 | |||
346 | 87 | TEST(WallOffsetMovementTest, TestOffsetBottomMMSlice) | ||
347 | 88 | { | ||
348 | 89 | CompRect sbr (0, 750, 500, 500); | ||
349 | 90 | CompRegion sr (0, 0, 1000, 1000); | ||
350 | 91 | |||
351 | 92 | sr -= CompRegion (400, 0, 200, 0); | ||
352 | 93 | |||
353 | 94 | CompPoint offset = compiz::wall::movementWindowOnScreen (sbr, sr); | ||
354 | 95 | |||
355 | 96 | EXPECT_EQ (offset, CompPoint (0, -250)); | ||
356 | 97 | } | ||
357 | 0 | 98 | ||
358 | === modified file 'src/wall.cpp' | |||
359 | --- src/wall.cpp 2011-10-11 13:28:07 +0000 | |||
360 | +++ src/wall.cpp 2012-04-28 19:08:18 +0000 | |||
361 | @@ -620,50 +620,29 @@ | |||
362 | 620 | XWindowChanges xwc; | 620 | XWindowChanges xwc; |
363 | 621 | unsigned int mask = 0; | 621 | unsigned int mask = 0; |
364 | 622 | 622 | ||
366 | 623 | ws->moveViewport (-dx, -dy, false); | 623 | /* If changing viewports fails we should not |
367 | 624 | * move the client window */ | ||
368 | 625 | if (!ws->moveViewport (-dx, -dy, false)) | ||
369 | 626 | { | ||
370 | 627 | window->activate (); | ||
371 | 628 | return; | ||
372 | 629 | } | ||
373 | 630 | |||
374 | 624 | ws->focusDefault = false; | 631 | ws->focusDefault = false; |
375 | 625 | 632 | ||
417 | 626 | CompWindow::Geometry sbr (window->serverBorderRect ().x (), | 633 | CompRegion screenRegion; |
418 | 627 | window->serverBorderRect ().y (), | 634 | |
419 | 628 | window->serverBorderRect ().width (), | 635 | foreach (const CompOutput &o, screen->outputDevs ()) |
420 | 629 | window->serverBorderRect ().height (), | 636 | screenRegion += o.workArea (); |
421 | 630 | 0); | 637 | |
422 | 631 | CompRegion sbrRegion (sbr); | 638 | CompPoint d = compiz::wall::movementWindowOnScreen (window->serverBorderRect (), |
423 | 632 | int output = screen->outputDeviceForGeometry (sbr); | 639 | screenRegion); |
424 | 633 | CompRegion outputRegion (screen->outputDevs ()[output].workArea ()); | 640 | |
425 | 634 | 641 | mask |= d.x () !=0 ? CWX : 0; | |
426 | 635 | /* If the window would be partially offscreen | 642 | mask |= d.y () !=0 ? CWY : 0; |
427 | 636 | * after it was moved then we should move it back | 643 | |
428 | 637 | * so that it is completely onscreen, since we moved | 644 | xwc.x = window->serverGeometry ().x () + dx; |
429 | 638 | * from mostly offscreen on B to mostly onscreen on A, | 645 | xwc.y = window->serverGeometry ().y () + dy; |
389 | 639 | * the user should be able to see their selected window */ | ||
390 | 640 | CompRegion inter = sbrRegion.intersected (outputRegion); | ||
391 | 641 | CompRegion rem = sbrRegion - outputRegion; | ||
392 | 642 | |||
393 | 643 | foreach (const CompRect &r, rem.rects ()) | ||
394 | 644 | { | ||
395 | 645 | if (r.x1 () >= inter.boundingRect ().x2 ()) | ||
396 | 646 | { | ||
397 | 647 | xwc.x = window->serverGeometry ().x () - r.width (); | ||
398 | 648 | mask |= CWX; | ||
399 | 649 | } | ||
400 | 650 | else if (r.x2 () <= inter.boundingRect ().x1 ()) | ||
401 | 651 | { | ||
402 | 652 | xwc.x = window->serverGeometry ().x () + r.width (); | ||
403 | 653 | mask |= CWX; | ||
404 | 654 | } | ||
405 | 655 | |||
406 | 656 | if (r.y1 () >= inter.boundingRect ().y2 ()) | ||
407 | 657 | { | ||
408 | 658 | xwc.y = window->serverGeometry ().y () - r.height (); | ||
409 | 659 | mask |= CWY; | ||
410 | 660 | } | ||
411 | 661 | else if (r.y2 () <= inter.boundingRect ().y1 ()) | ||
412 | 662 | { | ||
413 | 663 | xwc.y = window->serverGeometry ().y () + r.height (); | ||
414 | 664 | mask |= CWY; | ||
415 | 665 | } | ||
416 | 666 | } | ||
430 | 667 | 646 | ||
431 | 668 | window->configureXWindow (mask, &xwc); | 647 | window->configureXWindow (mask, &xwc); |
432 | 669 | } | 648 | } |
433 | @@ -1515,7 +1494,7 @@ | |||
434 | 1515 | 1494 | ||
435 | 1516 | if (!moving && !showPreview && grabIndex) | 1495 | if (!moving && !showPreview && grabIndex) |
436 | 1517 | { | 1496 | { |
438 | 1518 | screen->removeGrab (grabIndex, NULL); | 1497 | screen->removeGrab (static_cast <CompScreen::GrabHandle> (grabIndex), NULL); |
439 | 1519 | grabIndex = 0; | 1498 | grabIndex = 0; |
440 | 1520 | } | 1499 | } |
441 | 1521 | 1500 | ||
442 | 1522 | 1501 | ||
443 | === modified file 'src/wall.h' | |||
444 | --- src/wall.h 2012-04-24 09:17:57 +0000 | |||
445 | +++ src/wall.h 2012-04-28 19:08:18 +0000 | |||
446 | @@ -31,6 +31,8 @@ | |||
447 | 31 | #include <cairo-xlib-xrender.h> | 31 | #include <cairo-xlib-xrender.h> |
448 | 32 | #include <cairo.h> | 32 | #include <cairo.h> |
449 | 33 | 33 | ||
450 | 34 | #include "offset-movement.h" | ||
451 | 35 | |||
452 | 34 | #include "wall_options.h" | 36 | #include "wall_options.h" |
453 | 35 | 37 | ||
454 | 36 | 38 |
Deduplicated bugs. This is now bug 755842.