Merge ~3v1n0/unity:decorations-empty-shape-fix into unity:impish

Proposed by Marco Trevisan (Treviño)
Status: Approved
Approved by: Marco Trevisan (Treviño)
Approved revision: c7c912c9985da1a4afe628dea75e066be11bef99
Proposed branch: ~3v1n0/unity:decorations-empty-shape-fix
Merge into: unity:impish
Diff against target: 99 lines (+33/-3)
6 files modified
debian/changelog (+19/-0)
decorations/DecoratedWindow.cpp (+6/-0)
decorations/DecorationsShape.cpp (+5/-0)
tests/dummy-xorg-test-runner.sh (+1/-1)
tests/test_switcher_controller.h (+1/-1)
tests/test_switcher_controller_class.cpp (+1/-1)
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+410804@code.launchpad.net
To post a comment you must log in.
c7c912c... by Marco Trevisan (Treviño)

Update changelog

109e176... by Marco Trevisan (Treviño)

dummy-xorg-test-runner: Use command -v instead of deprecated which

d7c6424... by Marco Trevisan (Treviño)

TestSwitchController: Do not define FakeApplicationWindow as NiceMock twice

It's already used as ::Nice later, no need to define it initially,
otherwise newer gtest won't compile

Unmerged commits

c7c912c... by Marco Trevisan (Treviño)

Update changelog

d7c6424... by Marco Trevisan (Treviño)

TestSwitchController: Do not define FakeApplicationWindow as NiceMock twice

It's already used as ::Nice later, no need to define it initially,
otherwise newer gtest won't compile

109e176... by Marco Trevisan (Treviño)

dummy-xorg-test-runner: Use command -v instead of deprecated which

54b016c... by Marco Trevisan (Treviño)

DecorationsShape: Initialize parameters on missing rectangles

In such case the shape should just be empty, but we didn't really handle
the case properly.

eb67abc... by Uladzislau Nikalayevich

DecoratedWindow: Do not try to use shaped shadows on empty quads

Windows may have no shaped rectangles, but we're still trying to set
them. This is because we might not initialize the shape size, leading
to invalid values.

LP: #1904337

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index cc2e91c..4758188 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,22 @@
6+unity (7.5.1+22.04.20211026-0ubuntu1) UNRELEASED; urgency=medium
7+
8+ [ Uladzislau Nikalayevich ]
9+ * DecoratedWindow: Do not try to use shaped shadows on empty quads.
10+ Windows may have no shaped rectangles, but we're still trying to set
11+ them. This is because we might not initialize the shape size, leading
12+ to invalid values. (LP: #1904337)
13+
14+ [ Marco Trevisan (Treviño) ]
15+ * DecorationsShape: Initialize parameters on missing rectangles.
16+ In such case the shape should just be empty, but we didn't really handle
17+ the case properly.
18+ * dummy-xorg-test-runner: Use command -v instead of deprecated which
19+ * TestSwitchController: Do not define FakeApplicationWindow as NiceMock twice.
20+ It's already used as ::Nice later, no need to define it initially,
21+ otherwise newer gtest won't compile
22+
23+ -- Marco Trevisan (Treviño) <marco@ubuntu.com> Tue, 26 Oct 2021 19:19:56 +0200
24+
25 unity (7.5.1+21.10.20210601.1-0ubuntu1) impish; urgency=medium
26
27 * New upstream release
28diff --git a/decorations/DecoratedWindow.cpp b/decorations/DecoratedWindow.cpp
29index ed5548f..21f192c 100644
30--- a/decorations/DecoratedWindow.cpp
31+++ b/decorations/DecoratedWindow.cpp
32@@ -750,6 +750,12 @@ void Window::Impl::ComputeShapedShadowQuad()
33 unsigned int radius = active() ? manager_->active_shadow_radius() : manager_->inactive_shadow_radius();
34
35 Shape shape(win_->id());
36+ if (shape.GetRectangles().empty())
37+ {
38+ shaped_shadow_pixmap_.reset();
39+ return;
40+ }
41+
42 auto const& border = win_->borderRect();
43 auto const& shadow_offset = manager_->shadow_offset();
44
45diff --git a/decorations/DecorationsShape.cpp b/decorations/DecorationsShape.cpp
46index bd827d7..0c5395e 100644
47--- a/decorations/DecorationsShape.cpp
48+++ b/decorations/DecorationsShape.cpp
49@@ -61,6 +61,11 @@ Shape::Shape(Window xid)
50 }
51 else
52 {
53+ width_ = 0;
54+ height_ = 0;
55+ xoffs_ = 0;
56+ yoffs_ = 0;
57+
58 LOG_ERROR(logger) << "XShapeQueryExtend returned no extents";
59 return;
60 }
61diff --git a/tests/dummy-xorg-test-runner.sh b/tests/dummy-xorg-test-runner.sh
62index a4808f8..3909ecd 100755
63--- a/tests/dummy-xorg-test-runner.sh
64+++ b/tests/dummy-xorg-test-runner.sh
65@@ -17,7 +17,7 @@
66
67 MAX_WAIT=10
68
69-binary=$(which $1)
70+binary=$(command -v $1)
71
72 if [ -z "$binary" ]; then
73 if [ -z "$1" ]; then
74diff --git a/tests/test_switcher_controller.h b/tests/test_switcher_controller.h
75index 5e35b2e..cacde1d 100644
76--- a/tests/test_switcher_controller.h
77+++ b/tests/test_switcher_controller.h
78@@ -49,7 +49,7 @@ const unsigned TICK_DURATION = 10 * 1000;
79 /**
80 * A fake ApplicationWindow for verifying selection of the switcher.
81 */
82-struct FakeApplicationWindow : public ::testmocks::MockApplicationWindow::Nice
83+struct FakeApplicationWindow : public ::testmocks::MockApplicationWindow
84 {
85 typedef NiceMock<FakeApplicationWindow> Nice;
86 FakeApplicationWindow(Window xid, uint64_t active_number = 0);
87diff --git a/tests/test_switcher_controller_class.cpp b/tests/test_switcher_controller_class.cpp
88index 807a239..bea4d88 100644
89--- a/tests/test_switcher_controller_class.cpp
90+++ b/tests/test_switcher_controller_class.cpp
91@@ -26,7 +26,7 @@ using namespace unity::switcher;
92 using namespace std::chrono;
93
94 FakeApplicationWindow::FakeApplicationWindow(Window xid, uint64_t active_number)
95- : MockApplicationWindow::Nice(xid)
96+ : MockApplicationWindow(xid)
97 {
98 SetMonitor(-1);
99 auto standalone_window = std::make_shared<StandaloneWindow>(window_id());

Subscribers

People subscribed via source and target branches