Merge lp:~compiz-team/compiz/compiz.fix_1096455 into lp:compiz/0.9.9

Proposed by Sam Spilsbury
Status: Merged
Approved by: Daniel van Vugt
Approved revision: 3559
Merged at revision: 3569
Proposed branch: lp:~compiz-team/compiz/compiz.fix_1096455
Merge into: lp:compiz/0.9.9
Diff against target: 199 lines (+155/-4)
3 files modified
src/screen.cpp (+3/-4)
tests/system/xorg-gtest/tests/CMakeLists.txt (+8/-0)
tests/system/xorg-gtest/tests/compiz_xorg_gtest_ewmh.cpp (+144/-0)
To merge this branch: bzr merge lp:~compiz-team/compiz/compiz.fix_1096455
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+142847@code.launchpad.net

Commit message

Don't set _NET_DESKTOP_GEOMETRY until we've set the default viewport size. (LP: #1096455)

Description of the change

Don't set _NET_DESKTOP_GEOMETRY until we've set the default viewport size. (LP: #1096455)

Added a system test to verify that.

To post a comment you must log in.
3558. By Sam Spilsbury

Don't leak property

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Minor issue:
+ * Copyright (C) 2012 Canonical Ltd.

It should probably be 2013 and yourself.

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

Trying to make this build, I'm missing xig-0 for raring. Doesn't seem to exist for raring or quantal so I can't test it right now.

Robert is working on updating the Xig PPA to support Q and R.

Abstain for now.

review: Abstain
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

On Wed, Jan 16, 2013 at 8:55 AM, Daniel van Vugt
<email address hidden> wrote:
> Review: Abstain
>
> Trying to make this build, I'm missing xig-0 for raring. Doesn't seem to exist for raring or quantal so I can't test it right now.
>
> Robert is working on updating the Xig PPA to support Q and R.
>

This doesn't use Xig, it uses xorg-gtest. It also doesn't require
either of them to build, just for the tests.

I've been thinking of dropping the Xig support for some time. Its a
really neat concept, but AFAICT its not really maintained, and there's
a large maintenance burden because it actually requires us to
re-implement support for the various bits of the protocol.

xorg-gtest gets us most of the way there. It doesn't allow us to truly
verify whats going on server side, but it does allow us to watch what
the server is saying.

xorg-gtest is a bit of a pain to build, but if I remember correctly it
was something like this:

1. sudo apt-get install libx11-dev libxi-dev xutils-dev xserver-xorg-dev
2. install xf86-video-dummy:
git://anongit.freedesktop.org/xorg/driver/xf86-video-dummy
3. install xorg-gtest: http://cgit.freedesktop.org/xorg/test/xorg-gtest/

You can try it out with that. Be aware that the xorg-gtest tests run a
little slowly (about 2 seconds per test), but thats because they start
a full xserver in the background.

> Abstain for now.
> --
> https://code.launchpad.net/~compiz-team/compiz/compiz.fix_1096455/+merge/142847
> Your team Compiz Maintainers is subscribed to branch lp:compiz.

--
Sam Spilsbury

3559. By Sam Spilsbury

Update copyrights

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

On Wed, Jan 16, 2013 at 8:18 AM, Daniel van Vugt
<email address hidden> wrote:
> Minor issue:
> + * Copyright (C) 2012 Canonical Ltd.
>
> It should probably be 2013 and yourself.

Thanks. Done.

> --
> https://code.launchpad.net/~compiz-team/compiz/compiz.fix_1096455/+merge/142847
> Your team Compiz Maintainers is requested to review the proposed merge of lp:~compiz-team/compiz/compiz.fix_1096455 into lp:compiz.

--
Sam Spilsbury

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

Hmm, I thought the missing Xig was a problem because I was getting strange FTBFS after I installed xorg-gtest. Lost the log file for now sorry.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

On Wed, Jan 16, 2013 at 10:27 AM, Daniel van Vugt
<email address hidden> wrote:
> Hmm, I thought the missing Xig was a problem because I was getting strange FTBFS after I installed xorg-gtest. Lost the log file for now sorry.

Weird. Can you post details of the ftbfs?

> --
> https://code.launchpad.net/~compiz-team/compiz/compiz.fix_1096455/+merge/142847
> Your team Compiz Maintainers is subscribed to branch lp:compiz.

--
Sam Spilsbury

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Ok, I can't build/test this proposal right now because I'm blocked by bug 1100382. Please review that.

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

Seems I won't be able to build the test for a while. But I did test the code with compiz a while back. So that's OK for now.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/screen.cpp'
2--- src/screen.cpp 2012-12-30 11:13:36 +0000
3+++ src/screen.cpp 2013-01-16 02:06:20 +0000
4@@ -4998,7 +4998,6 @@
5
6 updateScreenEdges ();
7
8- setDesktopHints ();
9 eventManager.setSupportingWmCheck (dpy, rootWindow());
10 screen->updateSupportedWmHints ();
11
12@@ -5114,11 +5113,11 @@
13 if (!init_succeeded)
14 return false;
15
16- /* The active plugins list might have been changed - load any
17- * new plugins */
18-
19+ /* The viewport geometry depends on the new new plugins loaded
20+ * especially those that modify option values */
21 viewPort.vpSize.setWidth (optionGetHsize ());
22 viewPort.vpSize.setHeight (optionGetVsize ());
23+ setDesktopHints ();
24
25 setAudibleBell (optionGetAudibleBell ());
26
27
28=== modified file 'tests/system/xorg-gtest/tests/CMakeLists.txt'
29--- tests/system/xorg-gtest/tests/CMakeLists.txt 2012-12-05 03:35:37 +0000
30+++ tests/system/xorg-gtest/tests/CMakeLists.txt 2013-01-16 02:06:20 +0000
31@@ -18,6 +18,9 @@
32 add_executable (compiz_xorg_gtest_test_icccm
33 ${CMAKE_CURRENT_SOURCE_DIR}/compiz_xorg_gtest_icccm.cpp)
34
35+ add_executable (compiz_xorg_gtest_test_ewmh
36+ ${CMAKE_CURRENT_SOURCE_DIR}/compiz_xorg_gtest_ewmh.cpp)
37+
38 set (COMPIZ_XORG_GTEST_LIBRARIES
39 compiz_xorg_gtest_system_test
40 xorg_gtest_all
41@@ -38,4 +41,9 @@
42
43 compiz_discover_tests (compiz_xorg_gtest_test_icccm)
44
45+ target_link_libraries (compiz_xorg_gtest_test_ewmh
46+ ${COMPIZ_XORG_GTEST_LIBRARIES})
47+
48+ compiz_discover_tests (compiz_xorg_gtest_test_ewmh)
49+
50 endif (BUILD_XORG_GTEST AND X11_XI_FOUND)
51
52=== added file 'tests/system/xorg-gtest/tests/compiz_xorg_gtest_ewmh.cpp'
53--- tests/system/xorg-gtest/tests/compiz_xorg_gtest_ewmh.cpp 1970-01-01 00:00:00 +0000
54+++ tests/system/xorg-gtest/tests/compiz_xorg_gtest_ewmh.cpp 2013-01-16 02:06:20 +0000
55@@ -0,0 +1,144 @@
56+/*
57+ * Compiz XOrg GTest, EWMH compliance
58+ *
59+ * Copyright (C) 2013 Sam Spilsbury
60+ *
61+ * This library is free software; you can redistribute it and/or
62+ * modify it under the terms of the GNU Lesser General Public
63+ * License as published by the Free Software Foundation; either
64+ * version 2.1 of the License, or (at your option) any later version.
65+
66+ * This library is distributed in the hope that it will be useful,
67+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
68+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
69+ * Lesser General Public License for more details.
70+
71+ * You should have received a copy of the GNU Lesser General Public
72+ * License along with this library; if not, write to the Free Software
73+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
74+ *
75+ * Authored By:
76+ * Sam Spilsbury <smspillaz@gmail.com>
77+ */
78+#include <list>
79+#include <string>
80+#include <stdexcept>
81+#include <boost/function.hpp>
82+#include <boost/bind.hpp>
83+#include <boost/shared_ptr.hpp>
84+#include <boost/make_shared.hpp>
85+#include <gtest/gtest.h>
86+#include <gmock/gmock.h>
87+#include <xorg/gtest/xorg-gtest.h>
88+#include <compiz-xorg-gtest.h>
89+
90+#include <gtest_shared_tmpenv.h>
91+#include <gtest_shared_characterwrapper.h>
92+
93+#include <X11/Xlib.h>
94+#include <X11/Xatom.h>
95+
96+using ::testing::MatchResultListener;
97+using ::testing::MakeMatcher;
98+using ::testing::Matcher;
99+
100+namespace ct = compiz::testing;
101+
102+namespace
103+{
104+unsigned int DEFAULT_VIEWPORT_WIDTH = 4;
105+unsigned int DEFAULT_VIEWPORT_HEIGHT = 1;
106+
107+bool Advance (Display *d, bool r)
108+{
109+ return ct::AdvanceToNextEventOnSuccess (d, r);
110+}
111+
112+}
113+
114+class CompizXorgSystemEWMH :
115+ public ct::CompizXorgSystemTest
116+{
117+ public:
118+
119+ virtual void SetUp ()
120+ {
121+ ct::CompizXorgSystemTest::SetUp ();
122+
123+ ::Display *dpy = Display ();
124+
125+ XSelectInput (dpy, DefaultRootWindow (dpy),
126+ PropertyChangeMask);
127+
128+ Window wDummy;
129+ unsigned int uiDummy;
130+ int iDummy;
131+
132+ ASSERT_TRUE (XGetGeometry (dpy, DefaultRootWindow (dpy),
133+ &wDummy,
134+ &iDummy,
135+ &iDummy,
136+ &screenWidth,
137+ &screenHeight,
138+ &uiDummy,
139+ &uiDummy));
140+ }
141+
142+ unsigned int screenWidth;
143+ unsigned int screenHeight;
144+
145+ private:
146+};
147+
148+TEST_F (CompizXorgSystemEWMH, InitialViewportGeometry)
149+{
150+ ::Display *dpy = Display ();
151+ StartCompiz (static_cast <ct::CompizProcess::StartupFlags> (
152+ ct::CompizProcess::ReplaceCurrentWM));
153+
154+ ct::PropertyNotifyXEventMatcher desktopHintsProperty (dpy,
155+ "_NET_DESKTOP_GEOMETRY");
156+
157+ /* Assert that we get the property update */
158+ ASSERT_TRUE (Advance (dpy,
159+ ct::WaitForEventOfTypeOnWindowMatching (dpy,
160+ DefaultRootWindow (dpy),
161+ PropertyNotify,
162+ -1,
163+ -1,
164+ desktopHintsProperty)));
165+
166+ unsigned int expectedDefaultWidth = screenWidth * DEFAULT_VIEWPORT_WIDTH;
167+ unsigned int expectedDefaultHeight = screenHeight * DEFAULT_VIEWPORT_HEIGHT;
168+
169+ Atom actualType;
170+ int actualFmt;
171+ unsigned long nItems, bytesAfter;
172+ unsigned char *property;
173+
174+ ASSERT_EQ (Success,
175+ XGetWindowProperty (dpy,
176+ DefaultRootWindow (dpy),
177+ XInternAtom (dpy, "_NET_DESKTOP_GEOMETRY", False),
178+ 0L,
179+ 8L,
180+ False,
181+ XA_CARDINAL,
182+ &actualType,
183+ &actualFmt,
184+ &nItems,
185+ &bytesAfter,
186+ &property));
187+
188+ ASSERT_EQ (XA_CARDINAL, actualType);
189+ ASSERT_EQ (32, actualFmt);
190+ ASSERT_EQ (2, nItems);
191+
192+ unsigned long *geometry = reinterpret_cast <unsigned long *> (property);
193+
194+ EXPECT_EQ (expectedDefaultWidth, geometry[0]);
195+ EXPECT_EQ (expectedDefaultHeight, geometry[1]);
196+
197+ if (property)
198+ XFree (property);
199+}

Subscribers

People subscribed via source and target branches