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

Proposed by Sam Spilsbury
Status: Merged
Approved by: Daniel van Vugt
Approved revision: 3387
Merged at revision: 3394
Proposed branch: lp:~compiz-team/compiz/compiz.grid.fix_1037142
Merge into: lp:compiz/0.9.8
Diff against target: 214 lines (+108/-10)
4 files modified
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)
To merge this branch: bzr merge lp:~compiz-team/compiz/compiz.grid.fix_1037142
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
jenkins (community) continuous-integration Approve
Review via email: mp+126357@code.launchpad.net

This proposal supersedes a proposal from 2012-09-24.

Commit message

Check if expo is active before tracking grabbed windows so that grid doesn't fire
(LP: #1037142)

Description of the change

Check if expo is active before tracking grabbed windows so that grid doesn't fire. Tests added.

To post a comment you must log in.
Revision history for this message
jenkins (martin-mrazik+qa) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

The following tests FAILED:
 509 - GridGrabHandlerTest.TestMoveHandler (Failed)
 510 - GridGrabHandlerTest.TestResizeHandler (Failed)
Errors while running CTest

...

test 509
        Start 509: GridGrabHandlerTest.TestMoveHandler

509: Test command: /home/dan/bzr/compiz/tmp.142/build/plugins/grid/src/grabhandler/tests/compiz_test_grid_grabhandler "--gtest_filter=GridGrabHandlerTest.TestMoveHandler"
509: Test timeout computed to be: 1500
509: Running main() from gtest_main.cc
509: Note: Google Test filter = GridGrabHandlerTest.TestMoveHandler
509: [==========] Running 1 test from 1 test case.
509: [----------] Global test environment set-up.
509: [----------] 1 test from GridGrabHandlerTest
509: [ RUN ] GridGrabHandlerTest.TestMoveHandler
509: unknown file: Failure
509: C++ exception with description "call to empty boost::function" thrown in the test body.
509: [ FAILED ] GridGrabHandlerTest.TestMoveHandler (0 ms)
509: [----------] 1 test from GridGrabHandlerTest (1 ms total)
509:
509: [----------] Global test environment tear-down
509: [==========] 1 test from 1 test case ran. (1 ms total)
509: [ PASSED ] 0 tests.
509: [ FAILED ] 1 test, listed below:
509: [ FAILED ] GridGrabHandlerTest.TestMoveHandler
509:
509: 1 FAILED TEST
509/540 Test #509: GridGrabHandlerTest.TestMoveHandler .........................................................................................................................***Failed 0.00 sec
test 510
        Start 510: GridGrabHandlerTest.TestResizeHandler

510: Test command: /home/dan/bzr/compiz/tmp.142/build/plugins/grid/src/grabhandler/tests/compiz_test_grid_grabhandler "--gtest_filter=GridGrabHandlerTest.TestResizeHandler"
510: Test timeout computed to be: 1500
510: Running main() from gtest_main.cc
510: Note: Google Test filter = GridGrabHandlerTest.TestResizeHandler
510: [==========] Running 1 test from 1 test case.
510: [----------] Global test environment set-up.
510: [----------] 1 test from GridGrabHandlerTest
510: [ RUN ] GridGrabHandlerTest.TestResizeHandler
510: unknown file: Failure
510: C++ exception with description "call to empty boost::function" thrown in the test body.
510: [ FAILED ] GridGrabHandlerTest.TestResizeHandler (0 ms)
510: [----------] 1 test from GridGrabHandlerTest (0 ms total)
510:
510: [----------] Global test environment tear-down
510: [==========] 1 test from 1 test case ran. (0 ms total)
510: [ PASSED ] 0 tests.
510: [ FAILED ] 1 test, listed below:
510: [ FAILED ] GridGrabHandlerTest.TestResizeHandler
510:
510: 1 FAILED TEST

review: Needs Fixing
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Why on earth did CI not catch that ....

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Okay, it was a memory error. Not something that CI is set up to catch at the moment.

Revision history for this message
jenkins (martin-mrazik+qa) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Aaaaannnnnndddd CI is once again broken

Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

It works.

I just had an idea for a simpler and more general fix though...
(in grid) If the last repaint used PAINT_SCREEN_TRANSFORMED_MASK then disable grid behaviour.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/grid/src/grabhandler/include/grabhandler.h'
2--- plugins/grid/src/grabhandler/include/grabhandler.h 2012-05-26 23:31:12 +0000
3+++ plugins/grid/src/grabhandler/include/grabhandler.h 2012-09-26 00:23:25 +0000
4@@ -1,3 +1,33 @@
5+/*
6+ * Compiz Fusion Grid plugin, GrabHandler class
7+ *
8+ * Copyright (c) 2011 Canonical Ltd.
9+ *
10+ * This program is free software; you can redistribute it and/or
11+ * modify it under the terms of the GNU General Public License
12+ * as published by the Free Software Foundation; either version 2
13+ * of the License, or (at your option) any later version.
14+ *
15+ * This program is distributed in the hope that it will be useful,
16+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+ * GNU General Public License for more details.
19+ *
20+ * Description:
21+ *
22+ * Plugin to act like winsplit revolution (http://www.winsplit-revolution.com/)
23+ * use <Control><Alt>NUMPAD_KEY to move and tile your windows.
24+ *
25+ * Press the tiling keys several times to cycle through some tiling options.
26+ *
27+ * Authored By:
28+ * Sam Spilsbury <sam.spilsbury@canonical.com>
29+ */
30+#ifndef _COMPIZ_GRID_GRABHANDLER_H
31+#define _COMPIZ_GRID_GRABHANDLER_H
32+
33+#include <boost/function.hpp>
34+
35 #define CompWindowGrabKeyMask (1 << 0)
36 #define CompWindowGrabButtonMask (1 << 1)
37 #define CompWindowGrabMoveMask (1 << 2)
38@@ -11,11 +41,14 @@
39 namespace window
40 {
41
42+typedef boost::function <bool (const char *)> GrabActiveFunc;
43+
44 class GrabWindowHandler
45 {
46 public:
47
48- GrabWindowHandler (unsigned int mask);
49+ GrabWindowHandler (unsigned int mask,
50+ const GrabActiveFunc &grabActive);
51 ~GrabWindowHandler ();
52
53 bool track ();
54@@ -23,9 +56,12 @@
55
56 private:
57
58- unsigned int mMask;
59+ unsigned int mMask;
60+ GrabActiveFunc mGrabActive;
61
62 };
63 }
64 }
65 }
66+
67+#endif
68
69=== modified file 'plugins/grid/src/grabhandler/src/grabhandler.cpp'
70--- plugins/grid/src/grabhandler/src/grabhandler.cpp 2012-05-26 23:31:12 +0000
71+++ plugins/grid/src/grabhandler/src/grabhandler.cpp 2012-09-26 00:23:25 +0000
72@@ -24,8 +24,10 @@
73
74 #include "grabhandler.h"
75
76-compiz::grid::window::GrabWindowHandler::GrabWindowHandler (unsigned int mask) :
77- mMask (mask)
78+compiz::grid::window::GrabWindowHandler::GrabWindowHandler (unsigned int mask,
79+ const GrabActiveFunc &grabActive) :
80+ mMask (mask),
81+ mGrabActive (grabActive)
82 {
83 }
84
85@@ -36,6 +38,9 @@
86 bool
87 compiz::grid::window::GrabWindowHandler::track ()
88 {
89+ if (mGrabActive ("expo"))
90+ return false;
91+
92 return ((mMask & (CompWindowGrabMoveMask | CompWindowGrabButtonMask)) &&
93 !(mMask & CompWindowGrabResizeMask));
94 }
95
96=== modified file 'plugins/grid/src/grabhandler/tests/test-grid-grab-handler.cpp'
97--- plugins/grid/src/grabhandler/tests/test-grid-grab-handler.cpp 2012-05-26 23:31:12 +0000
98+++ plugins/grid/src/grabhandler/tests/test-grid-grab-handler.cpp 2012-09-26 00:23:25 +0000
99@@ -1,4 +1,32 @@
100+/*
101+ * Compiz Fusion Grid plugin, GrabHandler class
102+ *
103+ * Copyright (c) 2011 Canonical Ltd.
104+ *
105+ * This program is free software; you can redistribute it and/or
106+ * modify it under the terms of the GNU General Public License
107+ * as published by the Free Software Foundation; either version 2
108+ * of the License, or (at your option) any later version.
109+ *
110+ * This program is distributed in the hope that it will be useful,
111+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
112+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
113+ * GNU General Public License for more details.
114+ *
115+ * Description:
116+ *
117+ * Plugin to act like winsplit revolution (http://www.winsplit-revolution.com/)
118+ * use <Control><Alt>NUMPAD_KEY to move and tile your windows.
119+ *
120+ * Press the tiling keys several times to cycle through some tiling options.
121+ *
122+ * Authored By:
123+ * Sam Spilsbury <sam.spilsbury@canonical.com>
124+ */
125+
126 #include <gtest/gtest.h>
127+#include <gmock/gmock.h>
128+#include <boost/bind.hpp>
129
130 #include <grabhandler.h>
131
132@@ -12,15 +40,26 @@
133 #define CompWindowGrabResizeMask (1 << 3)
134 #define CompWindowGrabExternalAppMask (1 << 4)
135
136-class GridGrabHandlerTest :
137- public ::testing::Test
138+using testing::Eq;
139+using testing::Return;
140+
141+namespace
142 {
143-};
144+ bool returnFalse () { return false; }
145+
146+ class MockGrabExist
147+ {
148+ public:
149+
150+ MOCK_METHOD1 (grabExist, bool (const char *));
151+ };
152+}
153
154 TEST(GridGrabHandlerTest, TestMoveHandler)
155 {
156 compiz::grid::window::GrabWindowHandler moveHandler (CompWindowGrabMoveMask |
157- CompWindowGrabButtonMask);
158+ CompWindowGrabButtonMask,
159+ boost::bind (returnFalse));
160
161 EXPECT_TRUE (moveHandler.track ());
162 EXPECT_FALSE (moveHandler.resetResize ());
163@@ -29,8 +68,22 @@
164 TEST(GridGrabHandlerTest, TestResizeHandler)
165 {
166 compiz::grid::window::GrabWindowHandler resizeHandler (CompWindowGrabButtonMask |
167- CompWindowGrabResizeMask);
168+ CompWindowGrabResizeMask,
169+ boost::bind (returnFalse));
170
171 EXPECT_FALSE (resizeHandler.track ());
172 EXPECT_TRUE (resizeHandler.resetResize ());
173 }
174+
175+TEST(GridGrabHandlerTest, TestNoTrackOnExpoGrab)
176+{
177+ MockGrabExist mge;
178+ compiz::grid::window::GrabActiveFunc grabExist (boost::bind (&MockGrabExist::grabExist,
179+ &mge, _1));
180+ compiz::grid::window::GrabWindowHandler moveHandler (CompWindowGrabMoveMask |
181+ CompWindowGrabButtonMask,
182+ grabExist);
183+
184+ EXPECT_CALL (mge, grabExist (Eq ("expo"))).WillOnce (Return (true));
185+ EXPECT_FALSE (moveHandler.track ());
186+}
187
188=== modified file 'plugins/grid/src/grid.cpp'
189--- plugins/grid/src/grid.cpp 2012-08-06 01:36:00 +0000
190+++ plugins/grid/src/grid.cpp 2012-09-26 00:23:25 +0000
191@@ -22,10 +22,12 @@
192 * Press the tiling keys several times to cycle through some tiling options.
193 */
194
195+#include <boost/bind.hpp>
196 #include "grid.h"
197 #include "grabhandler.h"
198
199 using namespace GridWindowType;
200+namespace cgw = compiz::grid::window;
201
202 static std::map <unsigned int, GridProps> gridProps;
203
204@@ -834,7 +836,9 @@
205 unsigned int state,
206 unsigned int mask)
207 {
208- compiz::grid::window::GrabWindowHandler gwHandler (mask);
209+ static cgw::GrabActiveFunc grabActive (boost::bind (&CompScreen::grabExist,
210+ screen, _1));
211+ cgw::GrabWindowHandler gwHandler (mask, grabActive);
212
213 if (gwHandler.track ())
214 {

Subscribers

People subscribed via source and target branches