Merge lp:~3v1n0/unity/decoration-edges-improvements into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 3837
Merged at revision: 3882
Proposed branch: lp:~3v1n0/unity/decoration-edges-improvements
Merge into: lp:unity
Diff against target: 1018 lines (+333/-177)
13 files modified
UnityCore/DesktopUtilities.cpp (+0/-2)
decorations/DecoratedWindow.cpp (+139/-64)
decorations/DecorationsEdgeBorders.cpp (+32/-19)
decorations/DecorationsForceQuitDialog.cpp (+17/-3)
decorations/DecorationsManager.cpp (+16/-25)
decorations/DecorationsPriv.h (+11/-3)
decorations/DecorationsTitle.cpp (+1/-0)
decorations/DecorationsWidgets.cpp (+13/-1)
decorations/DecorationsWidgets.h (+5/-0)
plugins/unityshell/src/unityshell.cpp (+1/-0)
unity-shared/CompizUtils.cpp (+73/-54)
unity-shared/CompizUtils.h (+24/-5)
unity-shared/XWindowManager.cpp (+1/-1)
To merge this branch: bzr merge lp:~3v1n0/unity/decoration-edges-improvements
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Brandon Schaefer (community) Approve
Review via email: mp+236744@code.launchpad.net

Commit message

DecoratedWindow: make edges independent from borders and properly update them on actions changed

Now windows can have edges (handles) also if they are not fully decorated, and
the other way around.
Improved the logic to detect which kind of decorations are supported by windows
(so now we add shadows to windows with borders, and we do not to shaped ones).
Removed a lot of duplicated matrix/region computations.
Properly rebuild decorations when _NET_WM_ALLOWED_ACTIONS changes
Fixes to the ForceQuit dialog shadows (and support for backdrop mode).

To post a comment you must log in.
3836. By Marco Trevisan (Treviño)

DecoratedWindow: some code cleanup

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

LGTM

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
3837. By Marco Trevisan (Treviño)

DecorationsManager: update the active window only on _NET_ACTIVE_WINDOW updates

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'UnityCore/DesktopUtilities.cpp'
--- UnityCore/DesktopUtilities.cpp 2014-08-26 22:59:57 +0000
+++ UnityCore/DesktopUtilities.cpp 2014-10-10 14:56:03 +0000
@@ -71,8 +71,6 @@
71 const char *config_dir = g_get_user_config_dir();71 const char *config_dir = g_get_user_config_dir();
72 auto unity_config = glib::gchar_to_string(config_dir).append(G_DIR_SEPARATOR_S "unity" G_DIR_SEPARATOR_S);72 auto unity_config = glib::gchar_to_string(config_dir).append(G_DIR_SEPARATOR_S "unity" G_DIR_SEPARATOR_S);
7373
74 printf("CONFIG %s\n", unity_config.c_str());
75
76 if (g_mkdir_with_parents(unity_config.c_str(), 0700) >= 0)74 if (g_mkdir_with_parents(unity_config.c_str(), 0700) >= 0)
77 return unity_config;75 return unity_config;
7876
7977
=== modified file 'decorations/DecoratedWindow.cpp'
--- decorations/DecoratedWindow.cpp 2014-07-30 00:49:35 +0000
+++ decorations/DecoratedWindow.cpp 2014-10-10 14:56:03 +0000
@@ -1,6 +1,6 @@
1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2/*2/*
3 * Copyright (C) 2013 Canonical Ltd3 * Copyright (C) 2013-2014 Canonical Ltd
4 *4 *
5 * This program is free software: you can redistribute it and/or modify5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as6 * it under the terms of the GNU General Public License version 3 as
@@ -44,8 +44,12 @@
44 , cwin_(CompositeWindow::get(win_))44 , cwin_(CompositeWindow::get(win_))
45 , glwin_(GLWindow::get(win_))45 , glwin_(GLWindow::get(win_))
46 , frame_(0)46 , frame_(0)
47 , monitor_(0)
47 , dirty_geo_(true)48 , dirty_geo_(true)
48 , monitor_(0)49 , dirty_frame_(false)
50 , deco_elements_(cu::DecorationElement::NONE)
51 , last_mwm_decor_(win_->mwmDecor())
52 , last_actions_(win_->actions())
49 , cv_(Settings::Instance().em())53 , cv_(Settings::Instance().em())
50{54{
51 active.changed.connect([this] (bool active) {55 active.changed.connect([this] (bool active) {
@@ -105,14 +109,27 @@
105109
106void Window::Impl::Update()110void Window::Impl::Update()
107{111{
108 ShouldBeDecorated() ? Decorate() : Undecorate();112 UpdateElements();
113 (deco_elements_ & (cu::DecorationElement::EDGE | cu::DecorationElement::BORDER)) ? Decorate() : Undecorate();
114 last_mwm_decor_ = win_->mwmDecor();
115 last_actions_ = win_->actions();
109}116}
110117
111void Window::Impl::Decorate()118void Window::Impl::Decorate()
112{119{
113 SetupExtents();120 SetupExtents();
114 UpdateFrame();121 UpdateFrame();
115 SetupWindowControls();122 SetupWindowEdges();
123
124 if (deco_elements_ & cu::DecorationElement::BORDER)
125 {
126 SetupWindowControls();
127 }
128 else
129 {
130 CleanupWindowControls();
131 bg_textures_.clear();
132 }
116}133}
117134
118void Window::Impl::Undecorate()135void Window::Impl::Undecorate()
@@ -120,6 +137,7 @@
120 UnsetExtents();137 UnsetExtents();
121 UnsetFrame();138 UnsetFrame();
122 CleanupWindowControls();139 CleanupWindowControls();
140 CleanupWindowEdges();
123 bg_textures_.clear();141 bg_textures_.clear();
124}142}
125143
@@ -139,17 +157,27 @@
139 if (win_->hasUnmapReference())157 if (win_->hasUnmapReference())
140 return;158 return;
141159
142 auto const& sb = Style::Get()->Border();160 CompWindowExtents border;
143 CompWindowExtents border(cv_->CP(sb.left),161
144 cv_->CP(sb.right),162 if (deco_elements_ & cu::DecorationElement::BORDER)
145 cv_->CP(sb.top),163 {
146 cv_->CP(sb.bottom));164 auto const& sb = Style::Get()->Border();
147165 border.left = cv_->CP(sb.left);
148 auto const& ib = Style::Get()->InputBorder();166 border.right = cv_->CP(sb.right);
149 CompWindowExtents input(cv_->CP(sb.left + ib.left),167 border.top = cv_->CP(sb.top);
150 cv_->CP(sb.right + ib.right),168 border.bottom = cv_->CP(sb.bottom);
151 cv_->CP(sb.top + ib.top),169 }
152 cv_->CP(sb.bottom + ib.bottom));170
171 CompWindowExtents input(border);
172
173 if (deco_elements_ & cu::DecorationElement::EDGE)
174 {
175 auto const& ib = Style::Get()->InputBorder();
176 input.left += cv_->CP(ib.left);
177 input.right += cv_->CP(ib.right);
178 input.top += cv_->CP(ib.top);
179 input.bottom += cv_->CP(ib.bottom);
180 }
153181
154 if (win_->border() != border || win_->input() != input)182 if (win_->border() != border || win_->input() != input)
155 win_->setWindowFrameExtents(&border, &input);183 win_->setWindowFrameExtents(&border, &input);
@@ -183,6 +211,15 @@
183 UpdateFrameGeo(frame_geo);211 UpdateFrameGeo(frame_geo);
184}212}
185213
214void Window::Impl::UpdateFrameActions()
215{
216 if (!dirty_frame_ && (win_->mwmDecor() != last_mwm_decor_ || win_->actions() != last_actions_))
217 {
218 dirty_frame_ = true;
219 Damage();
220 }
221}
222
186void Window::Impl::CreateFrame(nux::Geometry const& frame_geo)223void Window::Impl::CreateFrame(nux::Geometry const& frame_geo)
187{224{
188 /* Since we're reparenting windows here, we need to grab the server225 /* Since we're reparenting windows here, we need to grab the server
@@ -280,6 +317,42 @@
280 win_->updateFrameRegion();317 win_->updateFrameRegion();
281}318}
282319
320void Window::Impl::SetupWindowEdges()
321{
322 if (input_mixer_)
323 return;
324
325 dpi_changed_ = Settings::Instance().dpi_changed.connect([this] {
326 Update();
327 edge_borders_->scale = cv_->DPIScale();
328 if (top_layout_) top_layout_->scale = cv_->DPIScale();
329 });
330
331 input_mixer_ = std::make_shared<InputMixer>();
332 edge_borders_ = std::make_shared<EdgeBorders>(win_);
333 edge_borders_->scale = cv_->DPIScale();
334 input_mixer_->PushToFront(edge_borders_);
335
336 UpdateWindowEdgesGeo();
337}
338
339void Window::Impl::UpdateWindowEdgesGeo()
340{
341 if (!edge_borders_)
342 return;
343
344 auto const& input = win_->inputRect();
345 edge_borders_->SetCoords(input.x(), input.y());
346 edge_borders_->SetSize(input.width(), input.height());
347}
348
349void Window::Impl::CleanupWindowEdges()
350{
351 input_mixer_.reset();
352 edge_borders_.reset();
353 dpi_changed_->disconnect();
354}
355
283void Window::Impl::SetupWindowControls()356void Window::Impl::SetupWindowControls()
284{357{
285 if (top_layout_)358 if (top_layout_)
@@ -291,26 +364,7 @@
291 Decorate();364 Decorate();
292 });365 });
293366
294 dpi_changed_ = Settings::Instance().dpi_changed.connect([this] {367 grab_edge_ = std::static_pointer_cast<EdgeBorders>(edge_borders_)->GetEdge(Edge::Type::GRAB);
295 Update();
296 top_layout_->scale = cv_->DPIScale();
297 });
298
299 input_mixer_ = std::make_shared<InputMixer>();
300
301 if (win_->actions() & CompWindowActionResizeMask)
302 {
303 auto edges = std::make_shared<EdgeBorders>(win_);
304 grab_edge_ = edges->GetEdge(Edge::Type::GRAB);
305 edge_borders_ = edges;
306 }
307 else /*if (win_->actions() & CompWindowActionMoveMask)*/
308 {
309 edge_borders_ = std::make_shared<GrabEdge>(win_);
310 grab_edge_ = edge_borders_;
311 }
312
313 input_mixer_->PushToFront(edge_borders_);
314368
315 auto padding = style->Padding(Side::TOP);369 auto padding = style->Padding(Side::TOP);
316 top_layout_ = std::make_shared<Layout>();370 top_layout_ = std::make_shared<Layout>();
@@ -345,6 +399,7 @@
345 top_layout_->Append(title_layout);399 top_layout_->Append(title_layout);
346400
347 input_mixer_->PushToFront(top_layout_);401 input_mixer_->PushToFront(top_layout_);
402 dirty_frame_ = false;
348403
349 SetupAppMenu();404 SetupAppMenu();
350 RedrawDecorations();405 RedrawDecorations();
@@ -355,12 +410,12 @@
355 if (title_)410 if (title_)
356 last_title_ = title_->text();411 last_title_ = title_->text();
357412
413 if (input_mixer_)
414 input_mixer_->Remove(top_layout_);
415
358 UnsetAppMenu();416 UnsetAppMenu();
359 theme_changed_->disconnect();417 theme_changed_->disconnect();
360 dpi_changed_->disconnect();
361 top_layout_.reset();418 top_layout_.reset();
362 input_mixer_.reset();
363 edge_borders_.reset();
364}419}
365420
366bool Window::Impl::IsMaximized() const421bool Window::Impl::IsMaximized() const
@@ -368,26 +423,25 @@
368 return (win_->state() & MAXIMIZE_STATE) == MAXIMIZE_STATE;423 return (win_->state() & MAXIMIZE_STATE) == MAXIMIZE_STATE;
369}424}
370425
426void Window::Impl::UpdateElements()
427{
428 if (!parent_->scaled() && IsMaximized())
429 {
430 deco_elements_ = cu::DecorationElement::NONE;
431 return;
432 }
433
434 deco_elements_ = cu::WindowDecorationElements(win_);
435}
436
371bool Window::Impl::ShadowDecorated() const437bool Window::Impl::ShadowDecorated() const
372{438{
373 if (!parent_->scaled() && IsMaximized())439 return deco_elements_ & cu::DecorationElement::SHADOW;
374 return false;
375
376 if (!cu::IsWindowShadowDecorable(win_))
377 return false;
378
379 return true;
380}440}
381441
382bool Window::Impl::FullyDecorated() const442bool Window::Impl::FullyDecorated() const
383{443{
384 if (!parent_->scaled() && IsMaximized())444 return deco_elements_ & cu::DecorationElement::BORDER;
385 return false;
386
387 if (!cu::IsWindowFullyDecorable(win_))
388 return false;
389
390 return true;
391}445}
392446
393bool Window::Impl::ShouldBeDecorated() const447bool Window::Impl::ShouldBeDecorated() const
@@ -429,6 +483,7 @@
429 }483 }
430484
431 deco_tex.SetCoords(geo.x, geo.y);485 deco_tex.SetCoords(geo.x, geo.y);
486 deco_tex.quad.region = deco_tex.quad.box;
432}487}
433488
434void Window::Impl::UpdateDecorationTextures()489void Window::Impl::UpdateDecorationTextures()
@@ -440,7 +495,6 @@
440 }495 }
441496
442 auto const& geo = win_->borderRect();497 auto const& geo = win_->borderRect();
443 auto const& input = win_->inputRect();
444 auto const& border = win_->border();498 auto const& border = win_->border();
445499
446 bg_textures_.resize(4);500 bg_textures_.resize(4);
@@ -452,19 +506,18 @@
452 top_layout_->SetCoords(geo.x(), geo.y());506 top_layout_->SetCoords(geo.x(), geo.y());
453 top_layout_->SetSize(geo.width(), border.top);507 top_layout_->SetSize(geo.width(), border.top);
454508
455 if (edge_borders_)
456 {
457 edge_borders_->SetCoords(input.x(), input.y());
458 edge_borders_->SetSize(input.width(), input.height());
459 }
460
461 SyncMenusGeometries();509 SyncMenusGeometries();
462}510}
463511
464void Window::Impl::ComputeShadowQuads()512void Window::Impl::ComputeShadowQuads()
465{513{
466 if (last_shadow_rect_.isEmpty() && !ShadowDecorated())514 if (!(deco_elements_ & cu::DecorationElement::SHADOW))
515 {
516 if (!last_shadow_rect_.isEmpty())
517 last_shadow_rect_.setGeometry(0, 0, 0, 0);
518
467 return;519 return;
520 }
468521
469 const auto* texture = ShadowTexture();522 const auto* texture = ShadowTexture();
470523
@@ -552,6 +605,12 @@
552605
553 if (shadows_rect != last_shadow_rect_)606 if (shadows_rect != last_shadow_rect_)
554 {607 {
608 auto const& win_region = win_->region();
609 quads[Quads::Pos::TOP_LEFT].region = CompRegion(quads[Quads::Pos::TOP_LEFT].box) - win_region;
610 quads[Quads::Pos::TOP_RIGHT].region = CompRegion(quads[Quads::Pos::TOP_RIGHT].box) - win_region;
611 quads[Quads::Pos::BOTTOM_LEFT].region = CompRegion(quads[Quads::Pos::BOTTOM_LEFT].box) - win_region;
612 quads[Quads::Pos::BOTTOM_RIGHT].region = CompRegion(quads[Quads::Pos::BOTTOM_RIGHT].box) - win_region;
613
555 last_shadow_rect_ = shadows_rect;614 last_shadow_rect_ = shadows_rect;
556 win_->updateWindowOutputExtents();615 win_->updateWindowOutputExtents();
557 }616 }
@@ -561,15 +620,26 @@
561 GLWindowPaintAttrib const& attrib,620 GLWindowPaintAttrib const& attrib,
562 CompRegion const& region, unsigned mask)621 CompRegion const& region, unsigned mask)
563{622{
623 if (win_->defaultViewport() != screen->vp())
624 return;
625
564 if (dirty_geo_)626 if (dirty_geo_)
565 parent_->UpdateDecorationPosition();627 parent_->UpdateDecorationPosition();
628
629 if (dirty_frame_)
630 {
631 dirty_frame_ = false;
632 CleanupWindowControls();
633 CleanupWindowEdges();
634 Update();
635 }
566}636}
567637
568void Window::Impl::Draw(GLMatrix const& transformation,638void Window::Impl::Draw(GLMatrix const& transformation,
569 GLWindowPaintAttrib const& attrib,639 GLWindowPaintAttrib const& attrib,
570 CompRegion const& region, unsigned mask)640 CompRegion const& region, unsigned mask)
571{641{
572 if (last_shadow_rect_.isEmpty())642 if (last_shadow_rect_.isEmpty() || win_->defaultViewport() != screen->vp())
573 return;643 return;
574644
575 auto const& clip_region = (mask & PAINT_WINDOW_TRANSFORMED_MASK) ? infiniteRegion : region;645 auto const& clip_region = (mask & PAINT_WINDOW_TRANSFORMED_MASK) ? infiniteRegion : region;
@@ -580,7 +650,7 @@
580 for (unsigned i = 0; i < shadow_quads_.size(); ++i)650 for (unsigned i = 0; i < shadow_quads_.size(); ++i)
581 {651 {
582 auto& quad = shadow_quads_[Quads::Pos(i)];652 auto& quad = shadow_quads_[Quads::Pos(i)];
583 glwin_->glAddGeometry({quad.matrix}, CompRegion(quad.box) - win_->region(), clip_region);653 glwin_->glAddGeometry(quad.matrices, quad.region, clip_region);
584 }654 }
585655
586 if (glwin_->vertexBuffer()->end())656 if (glwin_->vertexBuffer()->end())
@@ -592,7 +662,7 @@
592 continue;662 continue;
593663
594 glwin_->vertexBuffer()->begin();664 glwin_->vertexBuffer()->begin();
595 glwin_->glAddGeometry({dtex.quad.matrix}, dtex.quad.box, clip_region);665 glwin_->glAddGeometry(dtex.quad.matrices, dtex.quad.region, clip_region);
596666
597 if (glwin_->vertexBuffer()->end())667 if (glwin_->vertexBuffer()->end())
598 glwin_->glDrawTexture(dtex, transformation, attrib, mask);668 glwin_->glDrawTexture(dtex, transformation, attrib, mask);
@@ -705,6 +775,9 @@
705775
706 if (top_layout_)776 if (top_layout_)
707 top_layout_->scale = cv_->DPIScale();777 top_layout_->scale = cv_->DPIScale();
778
779 if (edge_borders_)
780 edge_borders_->scale = cv_->DPIScale();
708 }781 }
709}782}
710783
@@ -787,6 +860,7 @@
787{860{
788 impl_->UpdateMonitor();861 impl_->UpdateMonitor();
789 impl_->ComputeShadowQuads();862 impl_->ComputeShadowQuads();
863 impl_->UpdateWindowEdgesGeo();
790 impl_->UpdateDecorationTextures();864 impl_->UpdateDecorationTextures();
791 impl_->UpdateForceQuitDialogPosition();865 impl_->UpdateForceQuitDialogPosition();
792 impl_->dirty_geo_ = false;866 impl_->dirty_geo_ = false;
@@ -806,7 +880,8 @@
806{880{
807 data.add(impl_->win_->borderRect())881 data.add(impl_->win_->borderRect())
808 .add("input_geo", impl_->win_->inputRect())882 .add("input_geo", impl_->win_->inputRect())
809 .add("content_geo", impl_->win_->region().boundingRect())883 .add("content_geo", impl_->win_->geometry())
884 .add("region", impl_->win_->region().boundingRect())
810 .add("title", title())885 .add("title", title())
811 .add("active", impl_->active())886 .add("active", impl_->active())
812 .add("scaled", scaled())887 .add("scaled", scaled())
813888
=== modified file 'decorations/DecorationsEdgeBorders.cpp'
--- decorations/DecorationsEdgeBorders.cpp 2014-02-18 23:01:33 +0000
+++ decorations/DecorationsEdgeBorders.cpp 2014-10-10 14:56:03 +0000
@@ -26,21 +26,31 @@
26{26{
27namespace27namespace
28{28{
29const int MIN_CORNER_EDGE = 10;29const RawPixel MIN_CORNER_EDGE = 10_em;
30}30}
3131
32EdgeBorders::EdgeBorders(CompWindow* win)32EdgeBorders::EdgeBorders(CompWindow* win)
33{33{
34 items_.resize(size_t(Edge::Type::Size));34 scale.changed.connect(sigc::hide(sigc::mem_fun(this, &EdgeBorders::Relayout)));
3535
36 for (unsigned i = 0; i < unsigned(Edge::Type::Size); ++i)36 if (win->actions() & CompWindowActionResizeMask)
37 {37 {
38 auto type = Edge::Type(i);38 items_.resize(size_t(Edge::Type::Size));
3939
40 if (type == Edge::Type::GRAB)40 for (unsigned i = 0; i < unsigned(Edge::Type::Size); ++i)
41 items_[i] = std::make_shared<GrabEdge>(win);41 {
42 else42 auto type = Edge::Type(i);
43 items_[i] = std::make_shared<Edge>(win, type);43
44 if (type == Edge::Type::GRAB)
45 items_[i] = std::make_shared<GrabEdge>(win);
46 else
47 items_[i] = std::make_shared<Edge>(win, type);
48 }
49 }
50 else /*if (win->actions() & CompWindowActionMoveMask)*/
51 {
52 items_.resize(size_t(Edge::Type::GRAB) + 1);
53 items_[unsigned(Edge::Type::GRAB)] = std::make_shared<GrabEdge>(win);
44 }54 }
4555
46 Relayout();56 Relayout();
@@ -54,10 +64,17 @@
54 auto const& ib = win->input();64 auto const& ib = win->input();
5565
56 using namespace compiz::window::extents;66 using namespace compiz::window::extents;
57 Extents edges(std::max(ib.left, MIN_CORNER_EDGE),67 int min_corner_edge = MIN_CORNER_EDGE.CP(scale);
58 std::max(ib.right, MIN_CORNER_EDGE),68 Extents edges(std::max(ib.left, min_corner_edge),
59 std::max(ib.top, MIN_CORNER_EDGE),69 std::max(ib.right, min_corner_edge),
60 std::max(ib.bottom, MIN_CORNER_EDGE));70 std::max(ib.top, min_corner_edge),
71 std::max(ib.bottom, min_corner_edge));
72
73 grab_edge->SetCoords(rect_.x() + ib.left, rect_.y() + ib.top - b.top);
74 grab_edge->SetSize(rect_.width() - ib.left - ib.right, b.top);
75
76 if (items_.size() != size_t(Edge::Type::Size))
77 return;
6178
62 auto item = items_[unsigned(Edge::Type::TOP)];79 auto item = items_[unsigned(Edge::Type::TOP)];
63 item->SetCoords(rect_.x() + edges.left, rect_.y());80 item->SetCoords(rect_.x() + edges.left, rect_.y());
@@ -90,10 +107,6 @@
90 item = items_[unsigned(Edge::Type::BOTTOM_RIGHT)];107 item = items_[unsigned(Edge::Type::BOTTOM_RIGHT)];
91 item->SetCoords(rect_.x2() - edges.right, rect_.y2() - edges.bottom);108 item->SetCoords(rect_.x2() - edges.right, rect_.y2() - edges.bottom);
92 item->SetSize(edges.right, edges.bottom);109 item->SetSize(edges.right, edges.bottom);
93
94 item = items_[unsigned(Edge::Type::GRAB)];
95 item->SetCoords(rect_.x() + ib.left, rect_.y() + ib.top - b.top);
96 item->SetSize(rect_.width() - ib.left - ib.right, b.top);
97}110}
98111
99Item::Ptr const& EdgeBorders::GetEdge(Edge::Type type) const112Item::Ptr const& EdgeBorders::GetEdge(Edge::Type type) const
100113
=== modified file 'decorations/DecorationsForceQuitDialog.cpp'
--- decorations/DecorationsForceQuitDialog.cpp 2014-06-13 15:23:12 +0000
+++ decorations/DecorationsForceQuitDialog.cpp 2014-10-10 14:56:03 +0000
@@ -141,7 +141,7 @@
141141
142 auto const& deco_style = decoration::Style::Get();142 auto const& deco_style = decoration::Style::Get();
143 auto const& offset = deco_style->ShadowOffset();143 auto const& offset = deco_style->ShadowOffset();
144 int max_offset = std::max(std::abs(offset.x), std::abs(offset.y));144 int max_offset = std::max(std::abs(offset.x * 4), std::abs(offset.y * 4));
145 gtk_container_set_border_width(GTK_CONTAINER(self), deco_style->ActiveShadowRadius()+max_offset);145 gtk_container_set_border_width(GTK_CONTAINER(self), deco_style->ActiveShadowRadius()+max_offset);
146146
147 auto* screen = gtk_window_get_screen(self);147 auto* screen = gtk_window_get_screen(self);
@@ -259,18 +259,32 @@
259 auto const& radius = deco_style->CornerRadius();259 auto const& radius = deco_style->CornerRadius();
260 auto const& offset = deco_style->ShadowOffset();260 auto const& offset = deco_style->ShadowOffset();
261 auto const& color = deco_style->ActiveShadowColor();261 auto const& color = deco_style->ActiveShadowColor();
262 auto const& backcolor = deco_style->InactiveShadowColor();
262 int decoration_radius = std::max({radius.top, radius.left, radius.right, radius.bottom});263 int decoration_radius = std::max({radius.top, radius.left, radius.right, radius.bottom});
263264
264 gtk_css_provider_load_from_data(style, (R"(SheetStyleDialog {265 gtk_css_provider_load_from_data(style, (R"(
266 SheetStyleDialog {
265 background-color: #f7f6f5;267 background-color: #f7f6f5;
266 color: #4a4a4a;268 color: #4a4a4a;
267 border-radius: )"+std::to_string(decoration_radius)+R"(px;269 border-radius: )"+std::to_string(decoration_radius)+R"(px;
268 box-shadow: )"+std::to_string(offset.x)+"px "+std::to_string(offset.y)+"px "+270 box-shadow: )"+std::to_string(2 * offset.x)+"px "+std::to_string(2 * offset.y)+"px "+
269 std::to_string(deco_style->ActiveShadowRadius())+"px "+271 std::to_string(deco_style->ActiveShadowRadius())+"px "+
270 "rgba("+std::to_string(int(color.red * 255.0))+", "+272 "rgba("+std::to_string(int(color.red * 255.0))+", "+
271 std::to_string(int(color.green * 255.0))+", "+273 std::to_string(int(color.green * 255.0))+", "+
272 std::to_string(int(color.blue * 255.0))+", "+274 std::to_string(int(color.blue * 255.0))+", "+
273 std::to_string(int(color.alpha))+'.'+std::to_string(int(color.alpha*10000.0))+')'+R"(;275 std::to_string(int(color.alpha))+'.'+std::to_string(int(color.alpha*10000.0))+')'+R"(;
276 }
277
278 SheetStyleDialog:backdrop {
279 background-color: shade(#f7f6f5, 1.2);
280 color: shade(#4a4a4a, 1.5);
281 border-radius: )"+std::to_string(decoration_radius)+R"(px;
282 box-shadow: )"+std::to_string(2 * offset.x)+"px "+std::to_string(2 * offset.y)+"px "+
283 std::to_string(deco_style->InactiveShadowRadius())+"px "+
284 "rgba("+std::to_string(int(backcolor.red * 255.0))+", "+
285 std::to_string(int(backcolor.green * 255.0))+", "+
286 std::to_string(int(backcolor.blue * 255.0))+", "+
287 std::to_string(int(backcolor.alpha))+'.'+std::to_string(int(backcolor.alpha*10000.0))+')'+R"(;
274 })").c_str(), -1, nullptr);288 })").c_str(), -1, nullptr);
275289
276 auto* style_ctx = gtk_widget_get_style_context(self);290 auto* style_ctx = gtk_widget_get_style_context(self);
277291
=== modified file 'decorations/DecorationsManager.cpp'
--- decorations/DecorationsManager.cpp 2014-07-30 00:49:35 +0000
+++ decorations/DecorationsManager.cpp 2014-10-10 14:56:03 +0000
@@ -41,8 +41,7 @@
41}41}
4242
43Manager::Impl::Impl(decoration::Manager* parent, menu::Manager::Ptr const& menu)43Manager::Impl::Impl(decoration::Manager* parent, menu::Manager::Ptr const& menu)
44 : active_window_(0)44 : enable_add_supported_atoms_(true)
45 , enable_add_supported_atoms_(true)
46 , data_pool_(DataPool::Get())45 , data_pool_(DataPool::Get())
47 , menu_manager_(menu)46 , menu_manager_(menu)
48{47{
@@ -52,7 +51,6 @@
52 Display* dpy = screen->dpy();51 Display* dpy = screen->dpy();
53 atom::_NET_REQUEST_FRAME_EXTENTS = XInternAtom(dpy, "_NET_REQUEST_FRAME_EXTENTS", False);52 atom::_NET_REQUEST_FRAME_EXTENTS = XInternAtom(dpy, "_NET_REQUEST_FRAME_EXTENTS", False);
54 atom::_NET_WM_VISIBLE_NAME = XInternAtom(dpy, "_NET_WM_VISIBLE_NAME", False);53 atom::_NET_WM_VISIBLE_NAME = XInternAtom(dpy, "_NET_WM_VISIBLE_NAME", False);
55 screen->updateSupportedWmHints();
5654
57 auto rebuild_cb = sigc::mem_fun(this, &Impl::OnShadowOptionsChanged);55 auto rebuild_cb = sigc::mem_fun(this, &Impl::OnShadowOptionsChanged);
58 manager_->active_shadow_color.changed.connect(sigc::hide(sigc::bind(rebuild_cb, true)));56 manager_->active_shadow_color.changed.connect(sigc::hide(sigc::bind(rebuild_cb, true)));
@@ -205,8 +203,6 @@
205203
206bool Manager::Impl::HandleEventBefore(XEvent* event)204bool Manager::Impl::HandleEventBefore(XEvent* event)
207{205{
208 active_window_ = screen->activeWindow();
209
210 switch (event->type)206 switch (event->type)
211 {207 {
212 case ClientMessage:208 case ClientMessage:
@@ -251,31 +247,26 @@
251247
252bool Manager::Impl::HandleEventAfter(XEvent* event)248bool Manager::Impl::HandleEventAfter(XEvent* event)
253{249{
254 if (screen->activeWindow() != active_window_)
255 {
256 // Do this when _NET_ACTIVE_WINDOW changes on root!
257 if (active_deco_win_)
258 active_deco_win_->impl_->active = false;
259
260 active_window_ = screen->activeWindow();
261 auto const& new_active = GetWindowByXid(active_window_);
262 active_deco_win_ = new_active;
263
264 if (new_active)
265 new_active->impl_->active = true;
266 }
267
268 switch (event->type)250 switch (event->type)
269 {251 {
270 case PropertyNotify:252 case PropertyNotify:
271 {253 {
272 if (event->xproperty.atom == Atoms::mwmHints)254 if (event->xproperty.atom == Atoms::winActive)
255 {
256 if (active_deco_win_)
257 active_deco_win_->impl_->active = false;
258
259 auto const& new_active = GetWindowByXid(screen->activeWindow());
260 active_deco_win_ = new_active;
261
262 if (new_active)
263 new_active->impl_->active = true;
264 }
265 else if (event->xproperty.atom == Atoms::mwmHints ||
266 event->xproperty.atom == Atoms::wmAllowedActions)
273 {267 {
274 if (Window::Ptr const& win = GetWindowByXid(event->xproperty.window))268 if (Window::Ptr const& win = GetWindowByXid(event->xproperty.window))
275 {269 win->impl_->UpdateFrameActions();
276 win->impl_->CleanupWindowControls();
277 win->Update();
278 }
279 }270 }
280 else if (event->xproperty.atom == XA_WM_NAME ||271 else if (event->xproperty.atom == XA_WM_NAME ||
281 event->xproperty.atom == Atoms::wmName ||272 event->xproperty.atom == Atoms::wmName ||
@@ -442,7 +433,7 @@
442 .add("active_shadow_radius", active_shadow_radius())433 .add("active_shadow_radius", active_shadow_radius())
443 .add("inactive_shadow_color", inactive_shadow_color())434 .add("inactive_shadow_color", inactive_shadow_color())
444 .add("inactive_shadow_radius", inactive_shadow_radius())435 .add("inactive_shadow_radius", inactive_shadow_radius())
445 .add("active_window", impl_->active_window_);436 .add("active_window", screen->activeWindow());
446}437}
447438
448debug::Introspectable::IntrospectableList Manager::GetIntrospectableChildren()439debug::Introspectable::IntrospectableList Manager::GetIntrospectableChildren()
449440
=== modified file 'decorations/DecorationsPriv.h'
--- decorations/DecorationsPriv.h 2014-04-02 09:05:59 +0000
+++ decorations/DecorationsPriv.h 2014-10-10 14:56:03 +0000
@@ -1,6 +1,6 @@
1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2/*2/*
3 * Copyright (C) 2013 Canonical Ltd3 * Copyright (C) 2013-2014 Canonical Ltd
4 *4 *
5 * This program is free software: you can redistribute it and/or modify5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as6 * it under the terms of the GNU General Public License version 3 as
@@ -92,11 +92,15 @@
92private:92private:
93 void UnsetExtents();93 void UnsetExtents();
94 void SetupExtents();94 void SetupExtents();
95 void UpdateElements();
95 void UpdateMonitor();96 void UpdateMonitor();
96 void UpdateFrame();97 void UpdateFrame();
97 void CreateFrame(nux::Geometry const&);98 void CreateFrame(nux::Geometry const&);
98 void UpdateFrameGeo(nux::Geometry const&);99 void UpdateFrameGeo(nux::Geometry const&);
100 void UpdateFrameActions();
99 void UnsetFrame();101 void UnsetFrame();
102 void SetupWindowEdges();
103 void CleanupWindowEdges();
100 void SetupWindowControls();104 void SetupWindowControls();
101 void CleanupWindowControls();105 void CleanupWindowControls();
102 void UnsetAppMenu();106 void UnsetAppMenu();
@@ -109,6 +113,7 @@
109113
110 void ComputeShadowQuads();114 void ComputeShadowQuads();
111 void UpdateDecorationTextures();115 void UpdateDecorationTextures();
116 void UpdateWindowEdgesGeo();
112 void UpdateForceQuitDialogPosition();117 void UpdateForceQuitDialogPosition();
113 void RenderDecorationTexture(Side, nux::Geometry const&);118 void RenderDecorationTexture(Side, nux::Geometry const&);
114 void Paint(GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask);119 void Paint(GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask);
@@ -122,8 +127,12 @@
122 ::CompositeWindow* cwin_;127 ::CompositeWindow* cwin_;
123 ::GLWindow* glwin_;128 ::GLWindow* glwin_;
124 ::Window frame_;129 ::Window frame_;
130 int monitor_;
125 bool dirty_geo_;131 bool dirty_geo_;
126 int monitor_;132 bool dirty_frame_;
133 unsigned deco_elements_;
134 unsigned last_mwm_decor_;
135 unsigned last_actions_;
127136
128 CompRect last_shadow_rect_;137 CompRect last_shadow_rect_;
129 Quads shadow_quads_;138 Quads shadow_quads_;
@@ -176,7 +185,6 @@
176 friend class Manager;185 friend class Manager;
177 friend struct Window::Impl;186 friend struct Window::Impl;
178187
179 ::Window active_window_;
180 bool enable_add_supported_atoms_;188 bool enable_add_supported_atoms_;
181189
182 DataPool::Ptr data_pool_;190 DataPool::Ptr data_pool_;
183191
=== modified file 'decorations/DecorationsTitle.cpp'
--- decorations/DecorationsTitle.cpp 2014-03-31 18:36:07 +0000
+++ decorations/DecorationsTitle.cpp 2014-10-10 14:56:03 +0000
@@ -80,6 +80,7 @@
8080
81 Style::Get()->DrawTitle(text(), state, text_ctx, texture_size_.width / scale(), texture_size_.height / scale(), bg_geo * (1.0/scale));81 Style::Get()->DrawTitle(text(), state, text_ctx, texture_size_.width / scale(), texture_size_.height / scale(), bg_geo * (1.0/scale));
82 SetTexture(text_ctx);82 SetTexture(text_ctx);
83 texture_.UpdateMatrix();
83}84}
8485
85void Title::SetX(int x)86void Title::SetX(int x)
8687
=== modified file 'decorations/DecorationsWidgets.cpp'
--- decorations/DecorationsWidgets.cpp 2014-02-27 07:10:31 +0000
+++ decorations/DecorationsWidgets.cpp 2014-10-10 14:56:03 +0000
@@ -226,6 +226,12 @@
226226
227//227//
228228
229TexturedItem::TexturedItem()
230 : dirty_region_(false)
231{
232 geo_parameters_changed.connect([this] { dirty_region_ = true; });
233}
234
229void TexturedItem::SetTexture(cu::SimpleTexture::Ptr const& tex)235void TexturedItem::SetTexture(cu::SimpleTexture::Ptr const& tex)
230{236{
231 auto prev_geo = Geometry();237 auto prev_geo = Geometry();
@@ -254,8 +260,14 @@
254 if (!visible || Geometry().isEmpty() || !texture_)260 if (!visible || Geometry().isEmpty() || !texture_)
255 return;261 return;
256262
263 if (dirty_region_)
264 {
265 texture_.quad.region = texture_.quad.box;
266 dirty_region_ = false;
267 }
268
257 ctx->vertexBuffer()->begin();269 ctx->vertexBuffer()->begin();
258 ctx->glAddGeometry({texture_.quad.matrix}, texture_.quad.box, clip);270 ctx->glAddGeometry(texture_.quad.matrices, texture_.quad.region, clip);
259271
260 if (ctx->vertexBuffer()->end())272 if (ctx->vertexBuffer()->end())
261 ctx->glDrawTexture(texture_, transformation, attrib, mask);273 ctx->glDrawTexture(texture_, transformation, attrib, mask);
262274
=== modified file 'decorations/DecorationsWidgets.h'
--- decorations/DecorationsWidgets.h 2014-02-27 07:10:31 +0000
+++ decorations/DecorationsWidgets.h 2014-10-10 14:56:03 +0000
@@ -121,6 +121,8 @@
121public:121public:
122 typedef std::shared_ptr<TexturedItem> Ptr;122 typedef std::shared_ptr<TexturedItem> Ptr;
123123
124 TexturedItem();
125
124 void SetTexture(cu::SimpleTexture::Ptr const&);126 void SetTexture(cu::SimpleTexture::Ptr const&);
125 void Draw(GLWindow*, GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask);127 void Draw(GLWindow*, GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask);
126 void SetCoords(int x, int y);128 void SetCoords(int x, int y);
@@ -133,6 +135,9 @@
133135
134 CompRect& InternalGeo();136 CompRect& InternalGeo();
135 cu::SimpleTextureQuad texture_;137 cu::SimpleTextureQuad texture_;
138
139private:
140 bool dirty_region_;
136};141};
137142
138143
139144
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2014-09-04 22:12:01 +0000
+++ plugins/unityshell/src/unityshell.cpp 2014-10-10 14:56:03 +0000
@@ -281,6 +281,7 @@
281 CompositeScreenInterface::setHandler(cScreen);281 CompositeScreenInterface::setHandler(cScreen);
282 GLScreenInterface::setHandler(gScreen);282 GLScreenInterface::setHandler(gScreen);
283 ScaleScreenInterface::setHandler(sScreen);283 ScaleScreenInterface::setHandler(sScreen);
284 screen->updateSupportedWmHints();
284285
285 PluginAdapter::Initialize(screen);286 PluginAdapter::Initialize(screen);
286 AddChild(&WindowManager::Default());287 AddChild(&WindowManager::Default());
287288
=== modified file 'unity-shared/CompizUtils.cpp'
--- unity-shared/CompizUtils.cpp 2014-04-14 13:51:58 +0000
+++ unity-shared/CompizUtils.cpp 2014-10-10 14:56:03 +0000
@@ -1,6 +1,6 @@
1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2/*2/*
3* Copyright (C) 2013 Canonical Ltd3* Copyright (C) 2013-2014 Canonical Ltd
4*4*
5* This program is free software: you can redistribute it and/or modify5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License version 3 as6* it under the terms of the GNU General Public License version 3 as
@@ -30,6 +30,11 @@
30{30{
31 const unsigned PIXMAP_DEPTH = 32;31 const unsigned PIXMAP_DEPTH = 32;
32 const float DEFAULT_SCALE = 1.0f;32 const float DEFAULT_SCALE = 1.0f;
33 const unsigned DECORABLE_WINDOW_TYPES = CompWindowTypeDialogMask |
34 CompWindowTypeModalDialogMask |
35 CompWindowTypeUtilMask |
36 CompWindowTypeMenuMask |
37 CompWindowTypeNormalMask;
33}38}
3439
35SimpleTexture::SimpleTexture(GLTexture::List const& tex)40SimpleTexture::SimpleTexture(GLTexture::List const& tex)
@@ -39,7 +44,7 @@
39//44//
4045
41SimpleTextureQuad::SimpleTextureQuad()46SimpleTextureQuad::SimpleTextureQuad()
42 : scale(DEFAULT_SCALE)47 : scale_(DEFAULT_SCALE)
43{}48{}
4449
45bool SimpleTextureQuad::SetTexture(SimpleTexture::Ptr const& simple_texture)50bool SimpleTextureQuad::SetTexture(SimpleTexture::Ptr const& simple_texture)
@@ -52,24 +57,27 @@
52 if (st && st->texture())57 if (st && st->texture())
53 {58 {
54 auto* tex = st->texture();59 auto* tex = st->texture();
55 CompPoint old_coords(quad.box.x(), quad.box.y());60 CompSize size(tex->width() * scale_, tex->height() * scale_);
56 short invalid = std::numeric_limits<short>::min();61
57 quad.box.setGeometry(invalid, invalid, tex->width() * scale, tex->height() * scale);62 if (quad.box.width() != size.width() || quad.box.height() != size.height())
58 SetCoords(old_coords.x(), old_coords.y());63 {
64 quad.box.setSize(size);
65 UpdateMatrix();
66 }
59 }67 }
6068
61 return true;69 return true;
62}70}
6371
64bool SimpleTextureQuad::SetScale(float s)72bool SimpleTextureQuad::SetScale(double s)
65{73{
66 if (!st || scale == s)74 if (!st || scale_ == s)
67 return false;75 return false;
6876
69 scale = s;77 scale_ = s;
70 auto* tex = st->texture();78 auto* tex = st->texture();
71 quad.box.setWidth(tex->width() * scale);79 quad.box.setWidth(tex->width() * scale_);
72 quad.box.setHeight(tex->height() * scale);80 quad.box.setHeight(tex->height() * scale_);
73 UpdateMatrix();81 UpdateMatrix();
74 return true;82 return true;
75}83}
@@ -91,8 +99,8 @@
91 int y = quad.box.y();99 int y = quad.box.y();
92100
93 quad.matrix = (st && st->texture()) ? st->texture()->matrix() : GLTexture::Matrix();101 quad.matrix = (st && st->texture()) ? st->texture()->matrix() : GLTexture::Matrix();
94 quad.matrix.xx /= scale;102 quad.matrix.xx /= scale_;
95 quad.matrix.yy /= scale;103 quad.matrix.yy /= scale_;
96 quad.matrix.x0 = 0.0f - COMP_TEX_COORD_X(quad.matrix, x);104 quad.matrix.x0 = 0.0f - COMP_TEX_COORD_X(quad.matrix, x);
97 quad.matrix.y0 = 0.0f - COMP_TEX_COORD_Y(quad.matrix, y);105 quad.matrix.y0 = 0.0f - COMP_TEX_COORD_Y(quad.matrix, y);
98}106}
@@ -166,57 +174,68 @@
166 return cairo_xlib_surface_get_height(surface_);174 return cairo_xlib_surface_get_height(surface_);
167}175}
168176
169bool IsWindowShadowDecorable(CompWindow* win)177//
178//
179
180unsigned WindowDecorationElements(CompWindow* win)
170{181{
182 unsigned elements = DecorationElement::NONE;
183
171 if (!win)184 if (!win)
172 return false;185 return elements;
173186
174 if (!win->isViewable())187 if (!win->isViewable())
175 return false;188 return elements;
176189
177 if (win->wmType() & (CompWindowTypeDockMask | CompWindowTypeDesktopMask))190 if (win->wmType() & (CompWindowTypeDockMask | CompWindowTypeDesktopMask))
178 return false;191 return elements;
179192
180 if (win->region().numRects() != 1) // Non rectangular windows193 if (win->inShowDesktopMode())
181 return false;194 return elements;
182195
183 if (win->alpha())196 auto const& region = win->region();
184 return WindowHasMotifDecorations(win);197 bool rectangular = (region.numRects() == 1);
185198 bool alpha = win->alpha();
186 return true;199
200 if (!rectangular && alpha) // Non-rectangular windows with alpha channel
201 return elements;
202
203 if (region.boundingRect() != win->geometry()) // Shaped windows
204 return elements;
205
206 if (rectangular)
207 elements |= DecorationElement::SHADOW;
208
209 if (!win->overrideRedirect() &&
210 (win->type() & DECORABLE_WINDOW_TYPES) &&
211 (win->frame() || win->hasUnmapReference()))
212 {
213 if (win->actions() & CompWindowActionResizeMask)
214 elements |= DecorationElement::EDGE;
215
216 if (rectangular && (win->mwmDecor() & (MwmDecorAll | MwmDecorTitle)))
217 elements |= DecorationElement::BORDER;
218 }
219
220 if (alpha && !(elements & DecorationElement::BORDER) && !(win->mwmDecor() & MwmDecorBorder))
221 elements &= ~DecorationElement::SHADOW;
222
223 return elements;
224}
225
226bool IsWindowEdgeDecorable(CompWindow* win)
227{
228 return WindowDecorationElements(win) & DecorationElement::EDGE;
229}
230
231bool IsWindowShadowDecorable(CompWindow* win)
232{
233 return WindowDecorationElements(win) & DecorationElement::SHADOW;
187}234}
188235
189bool IsWindowFullyDecorable(CompWindow* win)236bool IsWindowFullyDecorable(CompWindow* win)
190{237{
191 if (!win)238 return WindowDecorationElements(win) & DecorationElement::BORDER;
192 return false;
193
194 if (!IsWindowShadowDecorable(win))
195 return false;
196
197 return WindowHasMotifDecorations(win);
198}
199
200bool WindowHasMotifDecorations(CompWindow* win)
201{
202 if (!win)
203 return false;
204
205 if (win->overrideRedirect())
206 return false;
207
208 switch (win->type())
209 {
210 case CompWindowTypeDialogMask:
211 case CompWindowTypeModalDialogMask:
212 case CompWindowTypeUtilMask:
213 case CompWindowTypeMenuMask:
214 case CompWindowTypeNormalMask:
215 if (win->mwmDecor() & (MwmDecorAll | MwmDecorTitle))
216 return true;
217 }
218
219 return false;
220}239}
221240
222} // compiz_utils namespace241} // compiz_utils namespace
223242
=== modified file 'unity-shared/CompizUtils.h'
--- unity-shared/CompizUtils.h 2014-04-14 13:51:58 +0000
+++ unity-shared/CompizUtils.h 2014-10-10 14:56:03 +0000
@@ -31,8 +31,15 @@
3131
32struct TextureQuad32struct TextureQuad
33{33{
34 TextureQuad()
35 : matrices(1)
36 , matrix(matrices[0])
37 {}
38
34 CompRect box;39 CompRect box;
35 GLTexture::Matrix matrix;40 CompRegion region;
41 GLTexture::MatrixList matrices;
42 GLTexture::Matrix& matrix;
36};43};
3744
38struct SimpleTexture45struct SimpleTexture
@@ -59,11 +66,13 @@
59{66{
60 SimpleTextureQuad();67 SimpleTextureQuad();
61 bool SetTexture(SimpleTexture::Ptr const&);68 bool SetTexture(SimpleTexture::Ptr const&);
62 bool SetScale(float scale);69 bool SetScale(double scale);
63 bool SetCoords(int x, int y);70 bool SetCoords(int x, int y);
64 bool SetX(int x);71 bool SetX(int x);
65 bool SetY(int y);72 bool SetY(int y);
6673
74 void UpdateMatrix();
75
67 operator SimpleTexture::Ptr() const { return st; }76 operator SimpleTexture::Ptr() const { return st; }
68 operator bool() const { return st && st->texture(); }77 operator bool() const { return st && st->texture(); }
69 operator GLTexture*() const { return st ? st->texture() : nullptr; }78 operator GLTexture*() const { return st ? st->texture() : nullptr; }
@@ -73,8 +82,7 @@
73 TextureQuad quad;82 TextureQuad quad;
7483
75private:84private:
76 void UpdateMatrix();85 double scale_;
77 float scale;
78};86};
7987
80struct PixmapTexture : SimpleTexture88struct PixmapTexture : SimpleTexture
@@ -111,9 +119,20 @@
111 cairo_t *cr_;119 cairo_t *cr_;
112};120};
113121
122enum DecorationElement
123{
124 NONE = 0,
125 EDGE = (1 << 0),
126 SHADOW = (1 << 1),
127 BORDER = (1 << 2),
128 FULL = EDGE|SHADOW|BORDER
129};
130
131unsigned WindowDecorationElements(CompWindow*);
132
133bool IsWindowEdgeDecorable(CompWindow*);
114bool IsWindowShadowDecorable(CompWindow*);134bool IsWindowShadowDecorable(CompWindow*);
115bool IsWindowFullyDecorable(CompWindow*);135bool IsWindowFullyDecorable(CompWindow*);
116bool WindowHasMotifDecorations(CompWindow*);
117136
118} // compiz_utils namespace137} // compiz_utils namespace
119} // unity namespace138} // unity namespace
120139
=== modified file 'unity-shared/XWindowManager.cpp'
--- unity-shared/XWindowManager.cpp 2014-02-14 03:05:02 +0000
+++ unity-shared/XWindowManager.cpp 2014-10-10 14:56:03 +0000
@@ -83,7 +83,7 @@
83 {83 {
84 LOG_ERROR(logger) << "Impossible to get the property " << gdk_x11_get_xatom_name(atom)84 LOG_ERROR(logger) << "Impossible to get the property " << gdk_x11_get_xatom_name(atom)
85 << " for window " << window_id << ": invalid string type: "85 << " for window " << window_id << ": invalid string type: "
86 << gdk_x11_get_xatom_name(Atoms::utf8String);86 << gdk_x11_get_xatom_name(type);
87 return std::string();87 return std::string();
88 }88 }
8989