Merge lp:~3v1n0/unity/shadows-on-existing-pixmaps-cleanup into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 4162
Proposed branch: lp:~3v1n0/unity/shadows-on-existing-pixmaps-cleanup
Merge into: lp:unity
Prerequisite: lp:~hikiko/unity/unity.shadows-on-existing-pixmaps
Diff against target: 567 lines (+171/-150)
8 files modified
decorations/DecoratedWindow.cpp (+58/-29)
decorations/DecoratedWindow.h (+1/-0)
decorations/DecorationsManager.cpp (+0/-27)
decorations/DecorationsPriv.h (+5/-3)
decorations/DecorationsShape.cpp (+72/-67)
decorations/DecorationsShape.h (+28/-17)
plugins/unityshell/src/unityshell.cpp (+1/-0)
unity-shared/CompizUtils.cpp (+6/-7)
To merge this branch: bzr merge lp:~3v1n0/unity/shadows-on-existing-pixmaps-cleanup
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Review via email: mp+301099@code.launchpad.net

Commit message

DecoratedWindow: Cleanup shadows for shaped windows, reduce recomputation

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

The changes to the prerequiste make sense to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'decorations/DecoratedWindow.cpp'
--- decorations/DecoratedWindow.cpp 2016-07-27 10:19:12 +0000
+++ decorations/DecoratedWindow.cpp 2016-07-27 10:19:13 +0000
@@ -31,8 +31,6 @@
31#include "WindowManager.h"31#include "WindowManager.h"
32#include "UnitySettings.h"32#include "UnitySettings.h"
3333
34#include <X11/extensions/shape.h>
35
36namespace unity34namespace unity
37{35{
38namespace decoration36namespace decoration
@@ -40,6 +38,7 @@
40namespace38namespace
41{39{
42const std::string MENUS_PANEL_NAME = "WindowLIM";40const std::string MENUS_PANEL_NAME = "WindowLIM";
41const int SHADOW_BLUR_MARGIN_FACTOR = 2;
43}42}
4443
45Window::Impl::Impl(Window* parent, CompWindow* win)44Window::Impl::Impl(Window* parent, CompWindow* win)
@@ -504,13 +503,21 @@
504 return (win_->frame() || win_->hasUnmapReference()) && FullyDecorated();503 return (win_->frame() || win_->hasUnmapReference()) && FullyDecorated();
505}504}
506505
506bool Window::Impl::IsRectangular() const
507{
508 return win_->region().numRects() == 1;
509}
510
507GLTexture* Window::Impl::ShadowTexture() const511GLTexture* Window::Impl::ShadowTexture() const
508{512{
513 if (!IsRectangular())
514 return shaped_shadow_pixmap_->texture();
515
509 auto const& mi = manager_->impl_;516 auto const& mi = manager_->impl_;
510 if (active() || parent_->scaled())517 if (active() || parent_->scaled())
511 return win_->region().numRects() > 1 ? shaped_shadow_pixmap_->texture() : mi->active_shadow_pixmap_->texture();518 return mi->active_shadow_pixmap_->texture();
512519
513 return win_->region().numRects() > 1 ? shaped_shadow_pixmap_->texture() : mi->inactive_shadow_pixmap_->texture();520 return mi->inactive_shadow_pixmap_->texture();
514}521}
515522
516unsigned Window::Impl::ShadowRadius() const523unsigned Window::Impl::ShadowRadius() const
@@ -678,6 +685,26 @@
678 }685 }
679}686}
680687
688cu::PixmapTexture::Ptr Window::Impl::BuildShapedShadowTexture(nux::Size const& size, unsigned radius, nux::Color const& color, Shape const& shape) {
689 nux::CairoGraphics img(CAIRO_FORMAT_ARGB32, size.width, size.height);
690 auto* img_ctx = img.GetInternalContext();
691
692 for (auto const& rect : shape.GetRectangles())
693 {
694 cairo_rectangle(img_ctx, rect.x + radius * SHADOW_BLUR_MARGIN_FACTOR - shape.XOffset(), rect.y + radius * SHADOW_BLUR_MARGIN_FACTOR - shape.YOffset(), rect.width, rect.height);
695 cairo_set_source_rgba(img_ctx, color.red, color.green, color.blue, color.alpha);
696 cairo_fill(img_ctx);
697 }
698
699 img.BlurSurface(radius);
700
701 cu::CairoContext shadow_ctx(size.width, size.height);
702 cairo_set_source_surface(shadow_ctx, img.GetSurface(), 0, 0);
703 cairo_paint(shadow_ctx);
704
705 return shadow_ctx;
706}
707
681void Window::Impl::ComputeShapedShadowQuad()708void Window::Impl::ComputeShapedShadowQuad()
682{709{
683 if (!(deco_elements_ & cu::DecorationElement::SHADOW))710 if (!(deco_elements_ & cu::DecorationElement::SHADOW))
@@ -690,23 +717,26 @@
690717
691 nux::Color color = active() ? manager_->active_shadow_color() : manager_->inactive_shadow_color();718 nux::Color color = active() ? manager_->active_shadow_color() : manager_->inactive_shadow_color();
692 unsigned int radius = active() ? manager_->active_shadow_radius() : manager_->inactive_shadow_radius();719 unsigned int radius = active() ? manager_->active_shadow_radius() : manager_->inactive_shadow_radius();
693 DecorationsShape shape;720
694 shape.initShape(win_->id());721 Shape shape(win_->id());
695 shaped_shadow_pixmap_ = manager_->impl_->BuildShapedShadowTexture(radius, color, shape);722 auto const& border = win_->borderRect();
696723 auto const& shadow_offset = manager_->shadow_offset();
697 const auto* texture = ShadowTexture();724
725 // Ideally it would be shape.getWidth + radius * 2 but Cairographics::BlurSurface
726 // isn't bounded by the radius and we need to compensate by using a larger texture.
727 int width = shape.Width() + radius * 2 * SHADOW_BLUR_MARGIN_FACTOR;
728 int height = shape.Height() + radius * 2 * SHADOW_BLUR_MARGIN_FACTOR;
729
730 if (width != last_shadow_rect_.width() || height != last_shadow_rect_.height())
731 shaped_shadow_pixmap_ = BuildShapedShadowTexture({width, height}, radius, color, shape);
732
733 const auto* texture = shaped_shadow_pixmap_->texture();
698734
699 if (!texture || !texture->width() || !texture->height())735 if (!texture || !texture->width() || !texture->height())
700 return;736 return;
701737
702 CompRect border = win_->borderRect();738 int x = border.x() + shadow_offset.x - radius * 2 + shape.XOffset();
703 nux::Point2D<int> shadow_offset = manager_->shadow_offset();739 int y = border.y() + shadow_offset.y - radius * 2 + shape.YOffset();
704// ideally it would be -radius for the *2 part see comment in Manager::Impl::BuildShapedShadowTexture
705// in DecorationsManager.cpp Make sure to keep these factors in sync.
706 int x = border.x() + shadow_offset.x - radius * 2 + shape.getXoffs();
707 int y = border.y() + shadow_offset.y - radius * 2 + shape.getYoffs();
708 int width = texture->width();
709 int height = texture->height();
710740
711 auto* quad = &shadow_quads_[Quads::Pos(0)];741 auto* quad = &shadow_quads_[Quads::Pos(0)];
712 quad->box.setGeometry(x, y, width, height);742 quad->box.setGeometry(x, y, width, height);
@@ -715,14 +745,14 @@
715 quad->matrix.y0 = -COMP_TEX_COORD_Y(quad->matrix, quad->box.y1());745 quad->matrix.y0 = -COMP_TEX_COORD_Y(quad->matrix, quad->box.y1());
716746
717 CompRect shaped_shadow_rect(x, y, width, height);747 CompRect shaped_shadow_rect(x, y, width, height);
718 if (shaped_shadow_rect != last_shadow_rect_) {748 if (shaped_shadow_rect != last_shadow_rect_)
749 {
719 auto const& win_region = win_->region();750 auto const& win_region = win_->region();
720 quad->region = CompRegion(quad->box) - win_region;751 quad->region = CompRegion(quad->box) - win_region;
721752
722 last_shadow_rect_ = shaped_shadow_rect;753 last_shadow_rect_ = shaped_shadow_rect;
723 win_->updateWindowOutputExtents();754 win_->updateWindowOutputExtents();
724 }755 }
725 cwin_->addDamage(true);
726}756}
727757
728void Window::Impl::Paint(GLMatrix const& transformation,758void Window::Impl::Paint(GLMatrix const& transformation,
@@ -763,11 +793,7 @@
763793
764 glwin_->vertexBuffer()->begin();794 glwin_->vertexBuffer()->begin();
765795
766 // numRects is != 1 when the window is shaped796 unsigned int num_quads = IsRectangular() ? shadow_quads_.size() : 1;
767 unsigned int num_quads = shadow_quads_.size();
768 if (win_->region().numRects() != 1)
769 num_quads = 1;
770
771 for (unsigned int i = 0; i < num_quads; ++i)797 for (unsigned int i = 0; i < num_quads; ++i)
772 {798 {
773 auto& quad = shadow_quads_[Quads::Pos(i)];799 auto& quad = shadow_quads_[Quads::Pos(i)];
@@ -775,7 +801,10 @@
775 }801 }
776802
777 if (glwin_->vertexBuffer()->end())803 if (glwin_->vertexBuffer()->end())
778 glwin_->glDrawTexture(ShadowTexture(), transformation, attrib, mask);804 {
805 if (GLTexture* texture = ShadowTexture())
806 glwin_->glDrawTexture(texture, transformation, attrib, mask);
807 }
779808
780 for (auto const& dtex : bg_textures_)809 for (auto const& dtex : bg_textures_)
781 {810 {
@@ -800,6 +829,9 @@
800829
801void Window::Impl::RedrawDecorations()830void Window::Impl::RedrawDecorations()
802{831{
832 if (!win_->isMapped())
833 return;
834
803 dirty_geo_ = true;835 dirty_geo_ = true;
804 cwin_->damageOutputExtents();836 cwin_->damageOutputExtents();
805}837}
@@ -1003,10 +1035,7 @@
1003void Window::UpdateDecorationPosition()1035void Window::UpdateDecorationPosition()
1004{1036{
1005 impl_->UpdateMonitor();1037 impl_->UpdateMonitor();
1006 if (impl_->win_->region().numRects() > 1)1038 impl_->IsRectangular() ? impl_->ComputeShadowQuads() : impl_->ComputeShapedShadowQuad();
1007 impl_->ComputeShapedShadowQuad();
1008 else
1009 impl_->ComputeShadowQuads();
1010 impl_->UpdateWindowEdgesGeo();1039 impl_->UpdateWindowEdgesGeo();
1011 impl_->UpdateDecorationTextures();1040 impl_->UpdateDecorationTextures();
1012 impl_->UpdateForceQuitDialogPosition();1041 impl_->UpdateForceQuitDialogPosition();
10131042
=== modified file 'decorations/DecoratedWindow.h'
--- decorations/DecoratedWindow.h 2015-08-07 18:54:07 +0000
+++ decorations/DecoratedWindow.h 2016-07-27 10:19:13 +0000
@@ -21,6 +21,7 @@
21#define UNITY_DECORATED_WINDOW21#define UNITY_DECORATED_WINDOW
2222
23#include "Introspectable.h"23#include "Introspectable.h"
24#include <NuxCore/Property.h>
24#include <memory>25#include <memory>
2526
26class CompRegion;27class CompRegion;
2728
=== modified file 'decorations/DecorationsManager.cpp'
--- decorations/DecorationsManager.cpp 2016-07-27 10:19:12 +0000
+++ decorations/DecorationsManager.cpp 2016-07-27 10:19:13 +0000
@@ -20,10 +20,8 @@
20#include "DecorationsPriv.h"20#include "DecorationsPriv.h"
2121
22#include <core/atoms.h>22#include <core/atoms.h>
23#include <NuxGraphics/CairoGraphics.h>
24#include <UnityCore/DBusIndicators.h>23#include <UnityCore/DBusIndicators.h>
25#include <X11/Xatom.h>24#include <X11/Xatom.h>
26#include <X11/extensions/shape.h>
2725
28#include "WindowManager.h"26#include "WindowManager.h"
2927
@@ -82,31 +80,6 @@
82 return shadow_ctx;80 return shadow_ctx;
83}81}
8482
85cu::PixmapTexture::Ptr Manager::Impl::BuildShapedShadowTexture(unsigned int radius, nux::Color const& color, DecorationsShape const& shape) {
86 //Ideally it would be shape.getWidth + radius * 2 but Cairographics::BlurSurface isn't bounded by the radius
87 //and we need to compensate by using a larger texture. Make sure to modify Window::Impl::ComputeShapedShadowQuad in
88 //DecoratedWindow.cpp if you change the factor.
89 int blur_margin_factor = 2;
90 int img_width = shape.getWidth() + radius * 2 * blur_margin_factor;
91 int img_height = shape.getHeight() + radius * 2 * blur_margin_factor;
92 nux::CairoGraphics img(CAIRO_FORMAT_ARGB32, img_width, img_height);
93 auto* img_ctx = img.GetInternalContext();
94
95 for (int i=0; i<shape.getRectangleCount(); i++) {
96 XRectangle rect = shape.getRectangle(i);
97 cairo_rectangle(img_ctx, rect.x + radius * blur_margin_factor - shape.getXoffs(), rect.y + radius * blur_margin_factor - shape.getYoffs(), rect.width, rect.height);
98 cairo_set_source_rgba(img_ctx, color.red, color.green, color.blue, color.alpha);
99 cairo_fill(img_ctx);
100 }
101 img.BlurSurface(radius);
102
103 cu::CairoContext shadow_ctx(img_width, img_height);
104 cairo_set_source_surface(shadow_ctx, img.GetSurface(), 0, 0);
105 cairo_paint(shadow_ctx);
106
107 return shadow_ctx;
108}
109
110void Manager::Impl::BuildActiveShadowTexture()83void Manager::Impl::BuildActiveShadowTexture()
111{84{
112 active_shadow_pixmap_ = BuildShadowTexture(manager_->active_shadow_radius(), manager_->active_shadow_color());85 active_shadow_pixmap_ = BuildShadowTexture(manager_->active_shadow_radius(), manager_->active_shadow_color());
11386
=== modified file 'decorations/DecorationsPriv.h'
--- decorations/DecorationsPriv.h 2016-07-27 10:19:12 +0000
+++ decorations/DecorationsPriv.h 2016-07-27 10:19:13 +0000
@@ -23,11 +23,13 @@
23#include <unordered_map>23#include <unordered_map>
24#include <NuxCore/NuxCore.h>24#include <NuxCore/NuxCore.h>
25#include <NuxCore/Rect.h>25#include <NuxCore/Rect.h>
26#include <NuxGraphics/CairoGraphics.h>
26#include <UnityCore/ConnectionManager.h>27#include <UnityCore/ConnectionManager.h>
27#include <UnityCore/Indicators.h>28#include <UnityCore/Indicators.h>
28#include <core/core.h>29#include <core/core.h>
29#include <opengl/opengl.h>30#include <opengl/opengl.h>
30#include <composite/composite.h>31#include <composite/composite.h>
32#include <X11/extensions/shape.h>
3133
32#include "DecorationsShape.h"34#include "DecorationsShape.h"
33#include "DecorationsDataPool.h"35#include "DecorationsDataPool.h"
@@ -116,6 +118,7 @@
116 void SyncXShapeWithFrameRegion();118 void SyncXShapeWithFrameRegion();
117 void SyncMenusGeometries() const;119 void SyncMenusGeometries() const;
118 bool ShouldBeDecorated() const;120 bool ShouldBeDecorated() const;
121 bool IsRectangular() const;
119 GLTexture* ShadowTexture() const;122 GLTexture* ShadowTexture() const;
120 unsigned ShadowRadius() const;123 unsigned ShadowRadius() const;
121 std::string const& GetMenusPanelID() const;124 std::string const& GetMenusPanelID() const;
@@ -126,6 +129,7 @@
126 void UpdateWindowEdgesGeo();129 void UpdateWindowEdgesGeo();
127 void UpdateForceQuitDialogPosition();130 void UpdateForceQuitDialogPosition();
128 void RenderDecorationTexture(Side, nux::Geometry const&);131 void RenderDecorationTexture(Side, nux::Geometry const&);
132 cu::PixmapTexture::Ptr BuildShapedShadowTexture(nux::Size const&, unsigned radius, nux::Color const&, Shape const&);
129 void Paint(GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask);133 void Paint(GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask);
130 void Draw(GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask);134 void Draw(GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask);
131135
@@ -156,6 +160,7 @@
156 std::string last_title_;160 std::string last_title_;
157 std::string panel_id_;161 std::string panel_id_;
158 std::vector<cu::SimpleTextureQuad> bg_textures_;162 std::vector<cu::SimpleTextureQuad> bg_textures_;
163 cu::PixmapTexture::Ptr shaped_shadow_pixmap_;
159 std::shared_ptr<ForceQuitDialog> force_quit_;164 std::shared_ptr<ForceQuitDialog> force_quit_;
160 InputMixer::Ptr input_mixer_;165 InputMixer::Ptr input_mixer_;
161 Layout::Ptr top_layout_;166 Layout::Ptr top_layout_;
@@ -166,8 +171,6 @@
166 Item::Ptr edge_borders_;171 Item::Ptr edge_borders_;
167172
168 EMConverter::Ptr cv_;173 EMConverter::Ptr cv_;
169
170 cu::PixmapTexture::Ptr shaped_shadow_pixmap_;
171};174};
172175
173struct Manager::Impl : sigc::trackable176struct Manager::Impl : sigc::trackable
@@ -192,7 +195,6 @@
192 void BuildActiveShadowTexture();195 void BuildActiveShadowTexture();
193 void BuildInactiveShadowTexture();196 void BuildInactiveShadowTexture();
194 cu::PixmapTexture::Ptr BuildShadowTexture(unsigned radius, nux::Color const&);197 cu::PixmapTexture::Ptr BuildShadowTexture(unsigned radius, nux::Color const&);
195 cu::PixmapTexture::Ptr BuildShapedShadowTexture(unsigned int radius, nux::Color const& color, DecorationsShape const& shape);
196 void OnShadowOptionsChanged(bool active);198 void OnShadowOptionsChanged(bool active);
197 void OnWindowFrameChanged(bool, ::Window, std::weak_ptr<decoration::Window> const&);199 void OnWindowFrameChanged(bool, ::Window, std::weak_ptr<decoration::Window> const&);
198 bool OnMenuKeyActivated(std::string const&);200 bool OnMenuKeyActivated(std::string const&);
199201
=== modified file 'decorations/DecorationsShape.cpp'
--- decorations/DecorationsShape.cpp 2016-07-27 10:19:12 +0000
+++ decorations/DecorationsShape.cpp 2016-07-27 10:19:13 +0000
@@ -17,86 +17,91 @@
17 * Authored by: Eleni Maria Stea <elenimaria.stea@canonical.com>17 * Authored by: Eleni Maria Stea <elenimaria.stea@canonical.com>
18 */18 */
1919
20#include <string.h>20#include "DecorationsShape.h"
21
22#include <core/core.h>
23#include <NuxCore/Logger.h>
21#include <X11/extensions/shape.h>24#include <X11/extensions/shape.h>
22#include "DecoratedWindow.h"25
23#include "DecorationsShape.h"26namespace unity
2427{
25bool DecorationsShape::initShape(XID win)28namespace decoration
29{
30namespace
31{
32DECLARE_LOGGER(logger, "unity.decoration.shape");
33}
34
35Shape::Shape(Window xid)
26{36{
27 Bool buse, cuse;37 Bool buse, cuse;
28 int bx, by, cx, cy;38 int bx, by, cx, cy;
29 unsigned int bw, bh, cw, ch;39 unsigned int bw, bh, cw, ch;
30 Display *dpy = screen->dpy();40 Display *dpy = screen->dpy();
3141
32 XShapeQueryExtents(dpy, win, &buse, &bx, &by, &bw, &bh, &cuse, &cx, &cy, &cw, &ch);42 XShapeQueryExtents(dpy, xid, &buse, &bx, &by, &bw, &bh, &cuse, &cx, &cy, &cw, &ch);
3343
34 int kind;44 int kind;
35 if (buse) {45
36 width = bw;46 if (buse)
37 height = bh;47 {
38 xoffs = bx;48 width_ = bw;
39 yoffs = by;49 height_ = bh;
50 xoffs_ = bx;
51 yoffs_ = by;
40 kind = ShapeBounding;52 kind = ShapeBounding;
41 }53 }
42 else if (cuse) {54 else if (cuse)
43 width = cw;55 {
44 height = ch;56 width_ = cw;
45 xoffs = cx;57 height_ = ch;
46 yoffs = cy;58 xoffs_ = cx;
59 yoffs_ = cy;
47 kind = ShapeClip;60 kind = ShapeClip;
48 }61 }
49 else {62 else
50 fprintf(stderr, "XShapeQueryExtend returned no extends.\n");63 {
51 return false;64 LOG_ERROR(logger) << "XShapeQueryExtend returned no extents";
65 return;
52 }66 }
5367
54 int rect_count, rect_order;68 int rect_count, rect_order;
55 XRectangle *rectangles;69 std::unique_ptr<XRectangle[], int(*)(void*)> rectangles(XShapeGetRectangles(dpy, xid, kind, &rect_count, &rect_order), XFree);
56 if (!(rectangles = XShapeGetRectangles(dpy, win, kind, &rect_count, &rect_order))) {70
57 fprintf(stderr, "Failed to get shape rectangles\n");71 if (!rectangles)
58 return false;72 {
59 }73 LOG_ERROR(logger) << "Failed to get shape rectangles";
6074 return;
61 for (int i=0; i< rect_count; i++) {75 }
62 rects.push_back(rectangles[i]);76
63 }77 for (int i = 0; i < rect_count; ++i)
6478 rectangles_.push_back(rectangles[i]);
65 XFree(rectangles);79}
66 return true;80
67}81std::vector<XRectangle> const& Shape::GetRectangles() const
6882{
69const XRectangle& DecorationsShape::getRectangle(int idx) const83 return rectangles_;
70{84}
71 return rects[idx];85
72}86int Shape::Width() const
7387{
74int DecorationsShape::getRectangleCount() const88 return width_;
75{89}
76 return (int)rects.size();90
77}91int Shape::Height() const
7892{
79int DecorationsShape::getWidth() const93 return height_;
80{94}
81 return width;95
82}96int Shape::XOffset() const
8397{
84int DecorationsShape::getHeight() const98 return xoffs_;
85{99}
86 return height;100
87}101int Shape::YOffset() const
88102{
89int DecorationsShape::getXoffs() const103 return yoffs_;
90{104}
91 return xoffs;105
92}106} // decoration namespace
93107} // unity namespace
94int DecorationsShape::getYoffs() const
95{
96 return yoffs;
97}
98void DecorationsShape::clear()
99{
100 width = height = 0;
101 rects.clear();
102}
103108
=== modified file 'decorations/DecorationsShape.h'
--- decorations/DecorationsShape.h 2016-07-27 10:19:12 +0000
+++ decorations/DecorationsShape.h 2016-07-27 10:19:13 +0000
@@ -20,24 +20,35 @@
20#ifndef DECORATIONS_SHAPE_H_20#ifndef DECORATIONS_SHAPE_H_
21#define DECORATIONS_SHAPE_H_21#define DECORATIONS_SHAPE_H_
2222
23#include "WindowManager.h"23#include <X11/Xlib.h>
24#include "DecoratedWindow.h"24#include <vector>
2525
26class DecorationsShape26namespace unity
27{27{
28namespace decoration
29{
30class Shape
31{
32public:
33 Shape(Window);
34
35 int Width() const;
36 int Height() const;
37 int XOffset() const;
38 int YOffset() const;
39
40 std::vector<XRectangle> const& GetRectangles() const;
41
28private:42private:
29 std::vector<XRectangle> rects;43 int width_;
30 int width, height;44 int height_;
31 int xoffs, yoffs;45 int xoffs_;
46 int yoffs_;
3247
33public:48 std::vector<XRectangle> rectangles_;
34 bool initShape(XID win);
35 const XRectangle& getRectangle(int idx) const;
36 int getRectangleCount() const;
37 int getWidth() const;
38 int getHeight() const;
39 int getXoffs() const;
40 int getYoffs() const;
41 void clear();
42};49};
50
51} // decoration namespace
52} // unity namespace
53
43#endif //DECORATIONS_SHAPE_H_54#endif //DECORATIONS_SHAPE_H_
4455
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2016-07-27 10:19:12 +0000
+++ plugins/unityshell/src/unityshell.cpp 2016-07-27 10:19:13 +0000
@@ -3357,6 +3357,7 @@
3357 PluginAdapter::Default().UpdateShowDesktopState();3357 PluginAdapter::Default().UpdateShowDesktopState();
3358 break;3358 break;
3359 case CompWindowNotifyBeforeDestroy:3359 case CompWindowNotifyBeforeDestroy:
3360 deco_win_->Undecorate();
3360 being_destroyed.emit();3361 being_destroyed.emit();
3361 break;3362 break;
3362 case CompWindowNotifyMinimize:3363 case CompWindowNotifyMinimize:
33633364
=== modified file 'unity-shared/CompizUtils.cpp'
--- unity-shared/CompizUtils.cpp 2016-07-27 10:19:12 +0000
+++ unity-shared/CompizUtils.cpp 2016-07-27 10:19:13 +0000
@@ -190,11 +190,7 @@
190 if (win->wmType() & (CompWindowTypeDockMask | CompWindowTypeDesktopMask))190 if (win->wmType() & (CompWindowTypeDockMask | CompWindowTypeDesktopMask))
191 return elements;191 return elements;
192192
193 auto const& region = win->region();193 if (win->alpha())
194 bool rectangular = (region.numRects() == 1);
195 bool alpha = win->alpha();
196
197 if (alpha)
198 {194 {
199 if (wf == WindowFilter::CLIENTSIDE_DECORATED)195 if (wf == WindowFilter::CLIENTSIDE_DECORATED)
200 {196 {
@@ -205,7 +201,7 @@
205201
206 return elements;202 return elements;
207 }203 }
208 else if (!rectangular) // Non-rectangular windows with alpha channel204 else if (win->region().numRects() != 1) // Non-rectangular windows with alpha channel
209 {205 {
210 return elements;206 return elements;
211 }207 }
@@ -220,11 +216,14 @@
220 if (win->actions() & CompWindowActionResizeMask)216 if (win->actions() & CompWindowActionResizeMask)
221 elements |= DecorationElement::EDGE;217 elements |= DecorationElement::EDGE;
222218
219 auto const& region = win->region();
220 bool rectangular = (region.numRects() == 1);
221
223 if (rectangular && (win->mwmDecor() & (MwmDecorAll | MwmDecorTitle)))222 if (rectangular && (win->mwmDecor() & (MwmDecorAll | MwmDecorTitle)))
224 elements |= DecorationElement::BORDER;223 elements |= DecorationElement::BORDER;
225 }224 }
226225
227 if (alpha && !(elements & DecorationElement::BORDER) && !(win->mwmDecor() & MwmDecorBorder))226 if (win->alpha() && !(elements & DecorationElement::BORDER) && !(win->mwmDecor() & MwmDecorBorder))
228 elements &= ~DecorationElement::SHADOW;227 elements &= ~DecorationElement::SHADOW;
229228
230 return elements;229 return elements;