Merge lp:~compiz-team/compiz/compiz.fix_1037142 into lp:compiz/0.9.8

Proposed by Sam Spilsbury
Status: Superseded
Proposed branch: lp:~compiz-team/compiz/compiz.fix_1037142
Merge into: lp:compiz/0.9.8
Prerequisite: lp:~compiz-team/compiz/compiz.fix_1053820
Diff against target: 317 lines (+111/-39)
6 files modified
plugins/expo/src/expo.cpp (+0/-26)
plugins/grid/src/grabhandler/include/grabhandler.h (+38/-2)
plugins/grid/src/grabhandler/src/grabhandler.cpp (+7/-2)
plugins/grid/src/grabhandler/tests/test-grid-grab-handler.cpp (+58/-5)
plugins/grid/src/grid.cpp (+5/-1)
src/event.cpp (+3/-3)
To merge this branch: bzr merge lp:~compiz-team/compiz/compiz.fix_1037142
Reviewer Review Type Date Requested Status
Daniel van Vugt Needs Resubmitting
jenkins (community) continuous-integration Needs Fixing
Review via email: mp+125837@code.launchpad.net

This proposal has been superseded by a proposal from 2012-09-24.

Commit message

Don't trigger the grid plugin during expo mode. Remove redundant checks in Expo which could cause this to happen.

Description of the change

Don't trigger the grid plugin during expo mode. Remove redundant checks in Expo which could cause this to happen.

Tests added for the first part. The second part is better tested by the branch this one depends on.

To post a comment you must log in.
Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

CI appears to be 404ing

Revision history for this message
Martin Mrazik (mrazik) wrote :

> CI appears to be 404ing

Sorry. That is a but that needs to be workarounded every now and then. Should work now. This is the relevant error:

patching file plugins/expo/src/windows_on_viewport/src/windows-on-viewport.cpp
patching file plugins/expo/src/windows_on_viewport/tests/CMakeLists.txt
patching file plugins/expo/src/windows_on_viewport/tests/test-windows-on-viewport.cpp
patching file plugins/expo/src/client-list-generator.h
patching file plugins/expo/src/viewport-member-window.h
Patch 100_expo_layout.patch does not apply (enforce with -f)
dh_quilt_patch: quilt --quiltrc /dev/null push -a || test $? = 2 returned exit code 1
make[1]: *** [override_dh_quilt_patch] Error 1
make[1]: Leaving directory `/tmp/buildd/compiz-0.9.8.2+bzr3377'
make: *** [build] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2
E: Failed autobuilding of package

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Resubmit per the prereq branch.

review: Needs Resubmitting

Unmerged revisions

3391. By Sam Spilsbury

Don't trigger the grid grab handler when expo is active, don't trigger
inactive actions and remove redundant checks for the root window match
because we don't support the multi-screen case and haven't since
0.9.0

3390. By Sam Spilsbury

Don't trigger actions unless they're actually added

3389. By Sam Spilsbury

Restrict access of private data in CompAction to a separate nonmember
function, add a test for its usage

3388. By Sam Spilsbury

Refactored out the rest of that function and tested it

3387. By Sam Spilsbury

Reworked the way actions are set up to be more in line with how
compiz expects it. Now the tests pass

3386. By Sam Spilsbury

Split out some of triggerButtonPressBindings and get it under test, currently
some tests fail due to incorrect behaviour in CompOption::set, a failing
test added to show this

3385. By Sam Spilsbury

Use boost::bind

3384. By Sam Spilsbury

Move the check for the button action modifiers & event state to a separate
function

3383. By Sam Spilsbury

Refactored out the edge detection code from triggerButtonPressBindings
into a separate util function under test

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/expo/src/expo.cpp'
2--- plugins/expo/src/expo.cpp 2012-09-05 17:15:39 +0000
3+++ plugins/expo/src/expo.cpp 2012-09-22 03:08:44 +0000
4@@ -46,10 +46,6 @@
5 CompAction::State state,
6 CompOption::Vector& options)
7 {
8- Window xid = CompOption::getIntOptionNamed (options, "root", 0);
9- if (xid != screen->root ())
10- return false;
11-
12 if (expoMode)
13 {
14 dndState = DnDStart;
15@@ -67,10 +63,6 @@
16 CompAction::State state,
17 CompOption::Vector& options)
18 {
19- Window xid = CompOption::getIntOptionNamed (options, "root", 0);
20- if (xid != screen->root ())
21- return false;
22-
23 if (dndState == DnDDuring || dndState == DnDStart)
24 {
25 if (dndWindow)
26@@ -93,10 +85,6 @@
27 CompAction::State state,
28 CompOption::Vector& options)
29 {
30- Window xid = CompOption::getIntOptionNamed (options, "root", 0);
31- if (xid != screen->root ())
32- return false;
33-
34 if (screen->otherGrabExist ("expo", NULL))
35 return false;
36
37@@ -139,10 +127,6 @@
38 CompAction::State state,
39 CompOption::Vector& options)
40 {
41- Window xid = CompOption::getIntOptionNamed (options, "root", 0);
42- if (xid && xid != screen->root ())
43- return false;
44-
45 if (!expoMode)
46 return true;
47
48@@ -175,10 +159,6 @@
49 CompAction::State state,
50 CompOption::Vector& options)
51 {
52- Window xid = CompOption::getIntOptionNamed (options, "root", 0);
53- if (xid != screen->root ())
54- return false;
55-
56 if (!expoMode)
57 return false;
58
59@@ -195,9 +175,6 @@
60 CompOption::Vector& options)
61 {
62 unsigned int newX, newY;
63- Window xid = CompOption::getIntOptionNamed (options, "root", 0);
64- if (xid != screen->root ())
65- return false;
66
67 if (!expoMode)
68 return false;
69@@ -226,9 +203,6 @@
70 CompOption::Vector& options)
71 {
72 int newX, newY;
73- Window xid = CompOption::getIntOptionNamed (options, "root", 0);
74- if (xid != screen->root ())
75- return false;
76
77 if (!expoMode)
78 return false;
79
80=== modified file 'plugins/grid/src/grabhandler/include/grabhandler.h'
81--- plugins/grid/src/grabhandler/include/grabhandler.h 2012-05-26 23:31:12 +0000
82+++ plugins/grid/src/grabhandler/include/grabhandler.h 2012-09-22 03:08:44 +0000
83@@ -1,3 +1,33 @@
84+/*
85+ * Compiz Fusion Grid plugin, GrabHandler class
86+ *
87+ * Copyright (c) 2011 Canonical Ltd.
88+ *
89+ * This program is free software; you can redistribute it and/or
90+ * modify it under the terms of the GNU General Public License
91+ * as published by the Free Software Foundation; either version 2
92+ * of the License, or (at your option) any later version.
93+ *
94+ * This program is distributed in the hope that it will be useful,
95+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
96+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
97+ * GNU General Public License for more details.
98+ *
99+ * Description:
100+ *
101+ * Plugin to act like winsplit revolution (http://www.winsplit-revolution.com/)
102+ * use <Control><Alt>NUMPAD_KEY to move and tile your windows.
103+ *
104+ * Press the tiling keys several times to cycle through some tiling options.
105+ *
106+ * Authored By:
107+ * Sam Spilsbury <sam.spilsbury@canonical.com>
108+ */
109+#ifndef _COMPIZ_GRID_GRABHANDLER_H
110+#define _COMPIZ_GRID_GRABHANDLER_H
111+
112+#include <boost/function.hpp>
113+
114 #define CompWindowGrabKeyMask (1 << 0)
115 #define CompWindowGrabButtonMask (1 << 1)
116 #define CompWindowGrabMoveMask (1 << 2)
117@@ -11,11 +41,14 @@
118 namespace window
119 {
120
121+typedef boost::function <bool (const char *)> GrabActiveFunc;
122+
123 class GrabWindowHandler
124 {
125 public:
126
127- GrabWindowHandler (unsigned int mask);
128+ GrabWindowHandler (unsigned int mask,
129+ const GrabActiveFunc &grabActive);
130 ~GrabWindowHandler ();
131
132 bool track ();
133@@ -23,9 +56,12 @@
134
135 private:
136
137- unsigned int mMask;
138+ unsigned int mMask;
139+ const GrabActiveFunc &mGrabActive;
140
141 };
142 }
143 }
144 }
145+
146+#endif
147
148=== modified file 'plugins/grid/src/grabhandler/src/grabhandler.cpp'
149--- plugins/grid/src/grabhandler/src/grabhandler.cpp 2012-05-26 23:31:12 +0000
150+++ plugins/grid/src/grabhandler/src/grabhandler.cpp 2012-09-22 03:08:44 +0000
151@@ -24,8 +24,10 @@
152
153 #include "grabhandler.h"
154
155-compiz::grid::window::GrabWindowHandler::GrabWindowHandler (unsigned int mask) :
156- mMask (mask)
157+compiz::grid::window::GrabWindowHandler::GrabWindowHandler (unsigned int mask,
158+ const GrabActiveFunc &grabActive) :
159+ mMask (mask),
160+ mGrabActive (grabActive)
161 {
162 }
163
164@@ -36,6 +38,9 @@
165 bool
166 compiz::grid::window::GrabWindowHandler::track ()
167 {
168+ if (mGrabActive ("expo"))
169+ return false;
170+
171 return ((mMask & (CompWindowGrabMoveMask | CompWindowGrabButtonMask)) &&
172 !(mMask & CompWindowGrabResizeMask));
173 }
174
175=== modified file 'plugins/grid/src/grabhandler/tests/test-grid-grab-handler.cpp'
176--- plugins/grid/src/grabhandler/tests/test-grid-grab-handler.cpp 2012-05-26 23:31:12 +0000
177+++ plugins/grid/src/grabhandler/tests/test-grid-grab-handler.cpp 2012-09-22 03:08:44 +0000
178@@ -1,4 +1,32 @@
179+/*
180+ * Compiz Fusion Grid plugin, GrabHandler class
181+ *
182+ * Copyright (c) 2011 Canonical Ltd.
183+ *
184+ * This program is free software; you can redistribute it and/or
185+ * modify it under the terms of the GNU General Public License
186+ * as published by the Free Software Foundation; either version 2
187+ * of the License, or (at your option) any later version.
188+ *
189+ * This program is distributed in the hope that it will be useful,
190+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
191+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
192+ * GNU General Public License for more details.
193+ *
194+ * Description:
195+ *
196+ * Plugin to act like winsplit revolution (http://www.winsplit-revolution.com/)
197+ * use <Control><Alt>NUMPAD_KEY to move and tile your windows.
198+ *
199+ * Press the tiling keys several times to cycle through some tiling options.
200+ *
201+ * Authored By:
202+ * Sam Spilsbury <sam.spilsbury@canonical.com>
203+ */
204+
205 #include <gtest/gtest.h>
206+#include <gmock/gmock.h>
207+#include <boost/bind.hpp>
208
209 #include <grabhandler.h>
210
211@@ -12,15 +40,26 @@
212 #define CompWindowGrabResizeMask (1 << 3)
213 #define CompWindowGrabExternalAppMask (1 << 4)
214
215-class GridGrabHandlerTest :
216- public ::testing::Test
217+using testing::Eq;
218+using testing::Return;
219+
220+namespace
221 {
222-};
223+ bool returnFalse () { return false; }
224+
225+ class MockGrabExist
226+ {
227+ public:
228+
229+ MOCK_METHOD1 (grabExist, bool (const char *));
230+ };
231+}
232
233 TEST(GridGrabHandlerTest, TestMoveHandler)
234 {
235 compiz::grid::window::GrabWindowHandler moveHandler (CompWindowGrabMoveMask |
236- CompWindowGrabButtonMask);
237+ CompWindowGrabButtonMask,
238+ boost::bind (returnFalse));
239
240 EXPECT_TRUE (moveHandler.track ());
241 EXPECT_FALSE (moveHandler.resetResize ());
242@@ -29,8 +68,22 @@
243 TEST(GridGrabHandlerTest, TestResizeHandler)
244 {
245 compiz::grid::window::GrabWindowHandler resizeHandler (CompWindowGrabButtonMask |
246- CompWindowGrabResizeMask);
247+ CompWindowGrabResizeMask,
248+ boost::bind (returnFalse));
249
250 EXPECT_FALSE (resizeHandler.track ());
251 EXPECT_TRUE (resizeHandler.resetResize ());
252 }
253+
254+TEST(GridGrabHandlerTest, TestNoTrackOnExpoGrab)
255+{
256+ MockGrabExist mge;
257+ compiz::grid::window::GrabActiveFunc grabExist (boost::bind (&MockGrabExist::grabExist,
258+ &mge, _1));
259+ compiz::grid::window::GrabWindowHandler moveHandler (CompWindowGrabMoveMask |
260+ CompWindowGrabButtonMask,
261+ grabExist);
262+
263+ EXPECT_CALL (mge, grabExist (Eq ("expo"))).WillOnce (Return (true));
264+ EXPECT_FALSE (moveHandler.track ());
265+}
266
267=== modified file 'plugins/grid/src/grid.cpp'
268--- plugins/grid/src/grid.cpp 2012-08-06 01:36:00 +0000
269+++ plugins/grid/src/grid.cpp 2012-09-22 03:08:44 +0000
270@@ -22,10 +22,12 @@
271 * Press the tiling keys several times to cycle through some tiling options.
272 */
273
274+#include <boost/bind.hpp>
275 #include "grid.h"
276 #include "grabhandler.h"
277
278 using namespace GridWindowType;
279+namespace cgw = compiz::grid::window;
280
281 static std::map <unsigned int, GridProps> gridProps;
282
283@@ -834,7 +836,9 @@
284 unsigned int state,
285 unsigned int mask)
286 {
287- compiz::grid::window::GrabWindowHandler gwHandler (mask);
288+ static cgw::GrabActiveFunc grabActive (boost::bind (&CompScreen::grabExist,
289+ screen, _1));
290+ cgw::GrabWindowHandler gwHandler (mask, grabActive);
291
292 if (gwHandler.track ())
293 {
294
295=== modified file 'src/event.cpp'
296--- src/event.cpp 2012-09-22 03:08:44 +0000
297+++ src/event.cpp 2012-09-22 03:08:44 +0000
298@@ -111,6 +111,9 @@
299 if (!(option.value ().action ().state () & state))
300 return false;
301
302+ if (!option.value ().action ().active ())
303+ return false;
304+
305 return true;
306 }
307
308@@ -126,9 +129,6 @@
309 if (option.value ().action ().initiate ().empty ())
310 return false;
311
312- if (!option.value ().action ().active ())
313- return false;
314-
315 *action = &option.value ().action ();
316
317 return true;

Subscribers

People subscribed via source and target branches