summaryrefslogtreecommitdiff
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2016-08-02 13:25:00 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2016-08-02 13:25:00 +0200
commit962890f95f74b03b1f43c816bee690e249ac524d (patch)
treecc8cb7621eea3358be59fdb51c16bb2ec60b60a5
parentd9b043ab8aa6d72ee31f998ec977c271022a67c1 (diff)
DecoratedWindow: add UpdateWindowState and only change state change butto type in this case
(bzr r4163.3.5)
-rw-r--r--decorations/DecoratedWindow.cpp42
-rw-r--r--decorations/DecoratedWindow.h1
-rw-r--r--decorations/DecorationsPriv.h3
-rw-r--r--plugins/unityshell/src/unityshell.cpp2
4 files changed, 29 insertions, 19 deletions
diff --git a/decorations/DecoratedWindow.cpp b/decorations/DecoratedWindow.cpp
index d15748559..21c2c68ff 100644
--- a/decorations/DecoratedWindow.cpp
+++ b/decorations/DecoratedWindow.cpp
@@ -118,20 +118,6 @@ void Window::Impl::Update()
else
Undecorate();
- if (maximize_button_)
- {
- auto const& maximize_button = maximize_button_.lock();
-
- if (win_->state() & (CompWindowStateMaximizedVertMask|CompWindowStateMaximizedHorzMask))
- {
- maximize_button->type = WindowButtonType::UNMAXIMIZE;
- }
- else
- {
- maximize_button->type = WindowButtonType::MAXIMIZE;
- }
- }
-
last_mwm_decor_ = win_->mwmDecor();
last_actions_ = win_->actions();
}
@@ -162,6 +148,23 @@ void Window::Impl::Undecorate()
bg_textures_.clear();
}
+void Window::Impl::UpdateWindowState(unsigned old_state)
+{
+ Update();
+
+ if (state_change_button_)
+ {
+ if (win_->state() & (CompWindowStateMaximizedVertMask|CompWindowStateMaximizedHorzMask))
+ {
+ state_change_button_->type = WindowButtonType::UNMAXIMIZE;
+ }
+ else
+ {
+ state_change_button_->type = WindowButtonType::MAXIMIZE;
+ }
+ }
+}
+
void Window::Impl::UnsetExtents()
{
if (win_->hasUnmapReference())
@@ -425,9 +428,9 @@ void Window::Impl::SetupWindowControls()
if (win_->actions() & (CompWindowActionMaximizeHorzMask|CompWindowActionMaximizeVertMask))
{
- auto maximize_button = std::make_shared<WindowButton>(win_, WindowButtonType::MAXIMIZE);
- maximize_button_ = maximize_button;
- top_layout_->Append(maximize_button);
+ auto state_change_button = std::make_shared<WindowButton>(win_, WindowButtonType::MAXIMIZE);
+ top_layout_->Append(state_change_button);
+ state_change_button_ = state_change_button;
}
auto title = std::make_shared<Title>();
@@ -1011,6 +1014,11 @@ void Window::Update()
impl_->Update();
}
+void Window::UpdateWindowState(unsigned old_state)
+{
+ impl_->UpdateWindowState(old_state);
+}
+
void Window::UpdateFrameRegion(CompRegion& r)
{
if (impl_->frame_region_.isEmpty())
diff --git a/decorations/DecoratedWindow.h b/decorations/DecoratedWindow.h
index 049b04d9f..3edfb2777 100644
--- a/decorations/DecoratedWindow.h
+++ b/decorations/DecoratedWindow.h
@@ -53,6 +53,7 @@ public:
void UpdateDecorationPositionDelayed();
void UpdateFrameRegion(CompRegion&);
void UpdateOutputExtents(compiz::window::extents::Extents&);
+ void UpdateWindowState(unsigned old_state);
void Paint(GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask);
void Draw(GLMatrix const&, GLWindowPaintAttrib const&, CompRegion const&, unsigned mask);
diff --git a/decorations/DecorationsPriv.h b/decorations/DecorationsPriv.h
index 69daa2263..f60b4fd19 100644
--- a/decorations/DecorationsPriv.h
+++ b/decorations/DecorationsPriv.h
@@ -103,6 +103,7 @@ private:
void SetupExtents();
void ComputeBorderExtent(CompWindowExtents &border);
void UpdateElements(cu::WindowFilter wf = cu::WindowFilter::NONE);
+ void UpdateWindowState(unsigned old_state);
void UpdateClientDecorationsState();
void UpdateMonitor();
void UpdateFrame();
@@ -165,7 +166,7 @@ private:
std::shared_ptr<ForceQuitDialog> force_quit_;
InputMixer::Ptr input_mixer_;
Layout::Ptr top_layout_;
- uweak_ptr<WindowButton> maximize_button_;
+ uweak_ptr<WindowButton> state_change_button_;
uweak_ptr<MenuLayout> menus_;
uweak_ptr<Title> title_;
uweak_ptr<SlidingLayout> sliding_layout_;
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 4c1faab10..48cd2edd4 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -3421,7 +3421,7 @@ void UnityWindow::stateChangeNotify(unsigned int lastState)
uScreen->fullscreen_windows_.remove(window);
}
- deco_win_->Update();
+ deco_win_->UpdateWindowState(lastState);
PluginAdapter::Default().NotifyStateChange(window, window->state(), lastState);
window->stateChangeNotify(lastState);
}