From 2e65ae0a0f115c98f419721b71288e754ce93ac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 30 Oct 2012 11:24:07 +0100 Subject: WindowManager: avoid to call the spread actions for every windows Call it only for target ones. (bzr r2846.1.24) --- plugins/unityshell/src/unityshell.cpp | 28 +++++++++++++++++++++------- plugins/unityshell/src/unityshell.h | 3 +++ 2 files changed, 24 insertions(+), 7 deletions(-) (limited to 'plugins/unityshell/src') diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 0df14c2c4..cfeb91eff 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -405,6 +405,10 @@ UnityScreen::UnityScreen(CompScreen* screen) sigc::mem_fun(this, &UnityScreen::OnMinimizeDurationChanged) ); + WindowManager& wm = WindowManager::Default(); + wm.initiate_spread.connect(sigc::mem_fun(this, &UnityScreen::OnInitiateSpread)); + wm.terminate_spread.connect(sigc::mem_fun(this, &UnityScreen::OnTerminateSpread)); + AddChild(&screen_introspection_); } } @@ -465,6 +469,22 @@ void UnityScreen::initAltTabNextWindow() } +void UnityScreen::OnInitiateSpread() +{ + UnityWindow::SetupSharedTextures(); + + for (auto const& swin : ScaleScreen::get(screen)->getWindows()) + UnityWindow::get(swin->window)->OnInitiateSpread(); +} + +void UnityScreen::OnTerminateSpread() +{ + for (auto const& swin : ScaleScreen::get(screen)->getWindows()) + UnityWindow::get(swin->window)->OnTerminateSpread(); + + UnityWindow::CleanupSharedTextures(); +} + void UnityScreen::EnsureSuperKeybindings() { for (auto action : _shortcut_actions) @@ -3570,9 +3590,6 @@ UnityWindow::UnityWindow(CompWindow* window) } } } - WindowManager& wm = WindowManager::Default(); - wm.initiate_spread.connect(sigc::mem_fun(this, &UnityWindow::OnInitiateSpread)); - wm.terminate_spread.connect(sigc::mem_fun(this, &UnityWindow::OnTerminateSpread)); } @@ -3845,6 +3862,7 @@ void UnityWindow::paintFakeDecoration(nux::Geometry const& geo, GLWindowPaintAtt int text_x = win::decoration::ITEMS_PADDING * 2 + win::decoration::CLOSE_SIZE; RenderText(context, text_x, 0.0, width - win::decoration::ITEMS_PADDING, height); decoration_selected_tex_ = context.pixmap_texture_; + uScreen->damageRegion(CompRegion(geo.x, geo.y, width, height)); } else { @@ -3856,9 +3874,6 @@ void UnityWindow::paintFakeDecoration(nux::Geometry const& geo, GLWindowPaintAtt if (decoration_selected_tex_) DrawTexture(decoration_selected_tex_->texture_, attrib, transform, mask, geo.x, geo.y); - if (redraw_decoration) - uScreen->damageRegion(CompRegion(geo.x, geo.y, width, height)); - int x = geo.x + win::decoration::ITEMS_PADDING; int y = geo.y + (height - win::decoration::CLOSE_SIZE) / 2.0f; @@ -3928,7 +3943,6 @@ void UnityWindow::OnInitiateSpread() { close_icon_state_ = panel::WindowState::NORMAL; middle_clicked_ = false; - SetupSharedTextures(); WindowManager& wm = WindowManager::Default(); Window xid = window->id(); diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index 1264e961b..42ff77728 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -236,6 +236,9 @@ private: void OnSwitcherStart(GVariant* data); void OnSwitcherEnd(GVariant* data); + void OnInitiateSpread(); + void OnTerminateSpread(); + void RestoreWindow(GVariant* data); bool SaveInputThenFocus(const guint xid); -- cgit v1.2.3