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

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: c7c912c9985da1a4afe628dea75e066be11bef99
Merged at revision: eab7899aac692e48defbebe4031ffab8417ec0d4
Proposed branch: ~3v1n0/unity:decorations-empty-shape-fix
Merge into: unity:master
Diff against target: 56 lines (+26/-0)
3 files modified
debian/changelog (+15/-0)
decorations/DecoratedWindow.cpp (+6/-0)
decorations/DecorationsShape.cpp (+5/-0)
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+410803@code.launchpad.net
To post a comment you must log in.

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..a06bad7 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,18 @@
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+
19+ -- Marco Trevisan (Treviño) <marco@ubuntu.com> Tue, 26 Oct 2021 14:25:06 +0200
20+
21 unity (7.5.1+21.10.20210601.1-0ubuntu1) impish; urgency=medium
22
23 * New upstream release
24diff --git a/decorations/DecoratedWindow.cpp b/decorations/DecoratedWindow.cpp
25index ed5548f..21f192c 100644
26--- a/decorations/DecoratedWindow.cpp
27+++ b/decorations/DecoratedWindow.cpp
28@@ -750,6 +750,12 @@ void Window::Impl::ComputeShapedShadowQuad()
29 unsigned int radius = active() ? manager_->active_shadow_radius() : manager_->inactive_shadow_radius();
30
31 Shape shape(win_->id());
32+ if (shape.GetRectangles().empty())
33+ {
34+ shaped_shadow_pixmap_.reset();
35+ return;
36+ }
37+
38 auto const& border = win_->borderRect();
39 auto const& shadow_offset = manager_->shadow_offset();
40
41diff --git a/decorations/DecorationsShape.cpp b/decorations/DecorationsShape.cpp
42index bd827d7..0c5395e 100644
43--- a/decorations/DecorationsShape.cpp
44+++ b/decorations/DecorationsShape.cpp
45@@ -61,6 +61,11 @@ Shape::Shape(Window xid)
46 }
47 else
48 {
49+ width_ = 0;
50+ height_ = 0;
51+ xoffs_ = 0;
52+ yoffs_ = 0;
53+
54 LOG_ERROR(logger) << "XShapeQueryExtend returned no extents";
55 return;
56 }

Subscribers

People subscribed via source and target branches