summaryrefslogtreecommitdiff
path: root/decorations
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2016-03-08 01:05:03 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2016-03-08 01:05:03 +0100
commitafde6bb3b2b11d4d24487d4563c5f6b4f92109f4 (patch)
tree902c0281dc7469362e542759b7a22d36c791a8b8 /decorations
parente458255a70f549540647961074475d0c9f47b9d3 (diff)
DecoratedWindow: get client borders from window atom _UNITY_GTK_BORDER_RADIUS
(bzr r3983.15.6)
Diffstat (limited to 'decorations')
-rw-r--r--decorations/DecoratedWindow.cpp26
-rw-r--r--decorations/DecorationsManager.cpp13
-rw-r--r--decorations/DecorationsPriv.h8
3 files changed, 28 insertions, 19 deletions
diff --git a/decorations/DecoratedWindow.cpp b/decorations/DecoratedWindow.cpp
index 82463535c..a84926808 100644
--- a/decorations/DecoratedWindow.cpp
+++ b/decorations/DecoratedWindow.cpp
@@ -445,16 +445,19 @@ void Window::Impl::UpdateElements(cu::WindowFilter wf)
deco_elements_ = cu::WindowDecorationElements(win_, wf);
}
-void Window::Impl::UpdateClientDecorationsState(bool maybe_available)
+void Window::Impl::UpdateClientDecorationsState()
{
- if (maybe_available && win_->alpha())
+ if (win_->alpha())
{
- if (!WindowManager::Default().GetCardinalProperty(win_->id(), manager_->impl_->gtk_border_radius_atom_).empty())
+ auto const& corners = WindowManager::Default().GetCardinalProperty(win_->id(), atom::_UNITY_GTK_BORDER_RADIUS);
+
+ if (!corners.empty())
{
- // FIXME: add actual values
- client_borders_.top = 6;
- client_borders_.left = 6;
- client_borders_.right = 6;
+ enum Corner { TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT };
+ client_borders_.top = std::max(corners[TOP_LEFT], corners[TOP_RIGHT]);
+ client_borders_.left = std::max(corners[TOP_LEFT], corners[BOTTOM_LEFT]);
+ client_borders_.right = std::max(corners[TOP_RIGHT], corners[BOTTOM_RIGHT]);
+ client_borders_.bottom = std::max(corners[BOTTOM_LEFT], corners[BOTTOM_RIGHT]);
client_decorated_ = true;
return;
}
@@ -639,8 +642,13 @@ void Window::Impl::ComputeShadowQuads()
if (shadows_rect != last_shadow_rect_)
{
auto win_region = win_->region();
- win_region.shrink(client_borders_.left + client_borders_.right, client_borders_.top + client_borders_.bottom);
- win_region.translate(client_borders_.left - client_borders_.right, client_borders_.top - client_borders_.bottom);
+
+ if (client_decorated_)
+ {
+ win_region.shrink(client_borders_.left + client_borders_.right, client_borders_.top + client_borders_.bottom);
+ win_region.translate(client_borders_.left - client_borders_.right, client_borders_.top - client_borders_.bottom);
+ }
+
quads[Quads::Pos::TOP_LEFT].region = CompRegion(quads[Quads::Pos::TOP_LEFT].box) - win_region;
quads[Quads::Pos::TOP_RIGHT].region = CompRegion(quads[Quads::Pos::TOP_RIGHT].box) - win_region;
quads[Quads::Pos::BOTTOM_LEFT].region = CompRegion(quads[Quads::Pos::BOTTOM_LEFT].box) - win_region;
diff --git a/decorations/DecorationsManager.cpp b/decorations/DecorationsManager.cpp
index 4c94d827e..1c11138e7 100644
--- a/decorations/DecorationsManager.cpp
+++ b/decorations/DecorationsManager.cpp
@@ -31,13 +31,11 @@ namespace decoration
{
Manager* manager_ = nullptr;
-namespace
-{
namespace atom
{
Atom _NET_REQUEST_FRAME_EXTENTS = 0;
Atom _NET_WM_VISIBLE_NAME = 0;
-}
+Atom _UNITY_GTK_BORDER_RADIUS = 0;
}
Manager::Impl::Impl(decoration::Manager* parent, menu::Manager::Ptr const& menu)
@@ -51,7 +49,7 @@ Manager::Impl::Impl(decoration::Manager* parent, menu::Manager::Ptr const& menu)
Display* dpy = screen->dpy();
atom::_NET_REQUEST_FRAME_EXTENTS = XInternAtom(dpy, "_NET_REQUEST_FRAME_EXTENTS", False);
atom::_NET_WM_VISIBLE_NAME = XInternAtom(dpy, "_NET_WM_VISIBLE_NAME", False);
- gtk_border_radius_atom_ = XInternAtom(dpy, "_UNITY_GTK_BORDER_RADIUS", False);
+ atom::_UNITY_GTK_BORDER_RADIUS = XInternAtom(dpy, "_UNITY_GTK_BORDER_RADIUS", False);
auto rebuild_cb = sigc::mem_fun(this, &Impl::OnShadowOptionsChanged);
manager_->active_shadow_color.changed.connect(sigc::hide(sigc::bind(rebuild_cb, true)));
@@ -280,10 +278,9 @@ bool Manager::Impl::HandleEventAfter(XEvent* event)
win->title = wm.GetStringProperty(event->xproperty.window, event->xproperty.atom);
}
}
- else if (event->xproperty.atom == gtk_border_radius_atom_)
+ else if (event->xproperty.atom == atom::_UNITY_GTK_BORDER_RADIUS)
{
- if (Window::Ptr const& win = GetWindowByXid(event->xproperty.window))
- win->impl_->UpdateClientDecorationsState(event->xproperty.state != PropertyDelete);
+ UpdateWindow(event->xproperty.window);
}
break;
}
@@ -409,7 +406,7 @@ void Manager::AddSupportedAtoms(std::vector<Atom>& atoms) const
if (impl_->enable_add_supported_atoms_)
{
atoms.push_back(atom::_NET_REQUEST_FRAME_EXTENTS);
- atoms.push_back(impl_->gtk_border_radius_atom_);
+ atoms.push_back(atom::_UNITY_GTK_BORDER_RADIUS);
}
}
diff --git a/decorations/DecorationsPriv.h b/decorations/DecorationsPriv.h
index 069c86023..a781015a1 100644
--- a/decorations/DecorationsPriv.h
+++ b/decorations/DecorationsPriv.h
@@ -50,6 +50,11 @@ class ForceQuitDialog;
namespace cu = compiz_utils;
+namespace atom
+{
+extern Atom _UNITY_GTK_BORDER_RADIUS;
+}
+
struct Quads
{
enum class Pos
@@ -94,7 +99,7 @@ private:
void UnsetExtents();
void SetupExtents();
void UpdateElements(cu::WindowFilter wf = cu::WindowFilter::NONE);
- void UpdateClientDecorationsState(bool maybe_available = true);
+ void UpdateClientDecorationsState();
void UpdateMonitor();
void UpdateFrame();
void CreateFrame(nux::Geometry const&);
@@ -192,7 +197,6 @@ private:
friend struct Window::Impl;
bool enable_add_supported_atoms_;
- Atom gtk_border_radius_atom_;
DataPool::Ptr data_pool_;
cu::PixmapTexture::Ptr active_shadow_pixmap_;