Merge lp:~smspillaz/compiz-core/compiz-core.use-extents-shift into lp:compiz-core/0.9.5

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 2944
Proposed branch: lp:~smspillaz/compiz-core/compiz-core.use-extents-shift
Merge into: lp:compiz-core/0.9.5
Diff against target: 223 lines (+24/-81)
4 files modified
cmake/CompizPlugin.cmake (+1/-0)
plugins/decor/src/decor.cpp (+15/-79)
plugins/decor/src/decor.h (+1/-0)
src/CMakeLists.txt (+7/-2)
To merge this branch: bzr merge lp:~smspillaz/compiz-core/compiz-core.use-extents-shift
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
Review via email: mp+89554@code.launchpad.net

Description of the change

Use compiz::window::extents::shift

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

I'm still not happy with the with the overuse of namespaces.

One consequence of which is verbosity like "compiz::window::extents::shift" (although this could be reduced by a using declaration or namespace alias).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmake/CompizPlugin.cmake'
2--- cmake/CompizPlugin.cmake 2012-01-12 06:48:58 +0000
3+++ cmake/CompizPlugin.cmake 2012-01-21 19:09:24 +0000
4@@ -404,6 +404,7 @@
5 ${${_PLUGIN}_PKG_LIBRARIES}
6 ${${_PLUGIN}_LIBRARIES}
7 ${${_PLUGIN}_MOD_LIBRARIES}
8+ compiz_core
9 )
10
11 install (
12
13=== modified file 'plugins/decor/src/decor.cpp'
14--- plugins/decor/src/decor.cpp 2012-01-19 18:12:31 +0000
15+++ plugins/decor/src/decor.cpp 2012-01-21 19:09:24 +0000
16@@ -1064,64 +1064,6 @@
17 }
18
19 /*
20- * DecorWindow::shiftX
21- *
22- * Determines the amount that the window needs to
23- * move based on the gravity hint once it is decorated,
24- * at least in the X direction
25- *
26- * FIXME: This should be merged into a function
27- * that returns CompPoint, there is no reason for
28- * there to be two separate functions
29- *
30- */
31-int
32-DecorWindow::shiftX ()
33-{
34- switch (window->sizeHints ().win_gravity) {
35- case WestGravity:
36- case NorthWestGravity:
37- case SouthWestGravity:
38- return window->border ().left;
39- case EastGravity:
40- case NorthEastGravity:
41- case SouthEastGravity:
42- return -window->border ().right;
43- }
44-
45- return 0;
46-}
47-
48-/*
49- * DecorWindow::shiftY
50- *
51- * Determines the amount that the window needs to
52- * move based on the gravity hint once it is decorated,
53- * at least in the Y direction
54- *
55- * FIXME: This should be merged into a function
56- * that returns CompPoint, there is no reason for
57- * there to be two separate functions
58- *
59- */
60-int
61-DecorWindow::shiftY ()
62-{
63- switch (window->sizeHints ().win_gravity) {
64- case NorthGravity:
65- case NorthWestGravity:
66- case NorthEastGravity:
67- return window->border ().top;
68- case SouthGravity:
69- case SouthWestGravity:
70- case SouthEastGravity:
71- return -window->border ().bottom;
72- }
73-
74- return 0;
75-}
76-
77-/*
78 * decorOffsetMove
79 *
80 * Function called on a timer (to avoid calling configureXWindow from
81@@ -1385,9 +1327,7 @@
82 Decoration *old, *decoration = NULL;
83 bool decorate = false;
84 bool shadowOnly = true;
85- int moveDx, moveDy;
86- int oldShiftX = 0;
87- int oldShiftY = 0;
88+ CompPoint oldShift, movement;
89
90 old = (wd) ? wd->decor : NULL;
91
92@@ -1506,8 +1446,7 @@
93 * WindowDecoration */
94 if (old)
95 {
96- oldShiftX = shiftX ();
97- oldShiftY = shiftY ();
98+ oldShift = compiz::window::extents::shift (window->border (), window->sizeHints ().win_gravity);
99
100 WindowDecoration::destroy (wd);
101
102@@ -1536,8 +1475,8 @@
103 window->setWindowFrameExtents (&wd->decor->border,
104 &wd->decor->input);
105
106- moveDx = shiftX () - oldShiftX;
107- moveDy = shiftY () - oldShiftY;
108+ movement = compiz::window::extents::shift (window->border (), window->sizeHints ().win_gravity);
109+ movement -= oldShift;
110
111 /* Update the input and output frame */
112 if (decorate)
113@@ -1562,13 +1501,12 @@
114
115 window->setWindowFrameExtents (&emptyExtents, &emptyExtents);
116
117- moveDx = -oldShiftX;
118- moveDy = -oldShiftY;
119+ movement -= oldShift;
120 }
121
122 /* Need to actually move the window */
123 if (window->placed () && !window->overrideRedirect () &&
124- (moveDx || moveDy))
125+ (movement.x () || movement.y ()))
126 {
127 XWindowChanges xwc;
128 unsigned int mask = CWX | CWY;
129@@ -1578,8 +1516,8 @@
130 /* Grab the geometry last sent to server at configureXWindow
131 * time and not here since serverGeometry may be updated by
132 * the time that we do call configureXWindow */
133- xwc.x = moveDx;
134- xwc.y = moveDy;
135+ xwc.x = movement.x ();
136+ xwc.y = movement.y ();
137
138 /* Except if it's fullscreen, maximized or such */
139 if (window->state () & CompWindowStateFullscreenMask)
140@@ -1592,10 +1530,10 @@
141 mask &= ~CWY;
142
143 if (window->saveMask () & CWX)
144- window->saveWc ().x += moveDx;
145+ window->saveWc ().x += movement.x ();
146
147 if (window->saveMask () & CWY)
148- window->saveWc ().y += moveDy;
149+ window->saveWc ().y += movement.y ();
150
151 if (mask)
152 {
153@@ -2810,9 +2748,8 @@
154 {
155 if (wd && wd->decor)
156 {
157- int oldShiftX = shiftX ();
158- int oldShiftY = shiftY ();
159- int moveDx, moveDy;
160+ CompPoint oldShift = compiz::window::extents::shift (window->border (), window->sizeHints ().win_gravity);
161+
162
163 if ((window->state () & MAXIMIZE_STATE))
164 window->setWindowFrameExtents (&wd->decor->maxBorder,
165@@ -2826,14 +2763,13 @@
166 * to prevent the window from shifting back too far once
167 * unmaximized */
168
169- moveDx = shiftX () - oldShiftX;
170- moveDy = shiftY () - oldShiftY;
171+ CompPoint movement = compiz::window::extents::shift (window->border (), window->sizeHints ().win_gravity) - oldShift;
172
173 if (window->saveMask () & CWX)
174- window->saveWc ().x += moveDx;
175+ window->saveWc ().x += movement.x ();
176
177 if (window->saveMask () & CWY)
178- window->saveWc ().y += moveDy;
179+ window->saveWc ().y += movement.y ();
180
181 updateFrame ();
182 }
183
184=== modified file 'plugins/decor/src/decor.h'
185--- plugins/decor/src/decor.h 2012-01-19 18:12:31 +0000
186+++ plugins/decor/src/decor.h 2012-01-21 19:09:24 +0000
187@@ -30,6 +30,7 @@
188 #include <composite/composite.h>
189 #include <opengl/opengl.h>
190 #include <core/atoms.h>
191+#include <core/windowextents.h>
192
193 #include "decor_options.h"
194
195
196=== modified file 'src/CMakeLists.txt'
197--- src/CMakeLists.txt 2012-01-20 15:42:52 +0000
198+++ src/CMakeLists.txt 2012-01-21 19:09:24 +0000
199@@ -77,6 +77,7 @@
200 link_directories (
201 ${COMPIZ_LINK_DIRS}
202 ${CORE_MOD_LIBRARY_DIRS}
203+ ${libdir}
204 )
205
206 add_library (compiz_core SHARED
207@@ -144,10 +145,14 @@
208
209 install (
210 TARGETS compiz_core
211+ LIBRARY DESTINATION ${COMPIZ_DESTDIR}${libdir}
212+)
213+
214+install (
215+ TARGETS compiz
216 RUNTIME DESTINATION ${COMPIZ_DESTDIR}${exec_prefix}
217- LIBRARY DESTINATION ${COMPIZ_DESTDIR}${libdir}
218- ARCHIVE DESTINATION ${COMPIZ_DESTDIR}${libdir}
219 )
220+
221 add_subdirectory(tests)
222
223 enable_coverage_report( TARGETS compiz )

Subscribers

People subscribed via source and target branches