diff options
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/unityshell/src/unityshell.cpp | 79 | ||||
| -rw-r--r-- | plugins/unityshell/src/unityshell.h | 4 |
2 files changed, 56 insertions, 27 deletions
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 93bd78fdc..087ec5441 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -393,9 +393,6 @@ UnityScreen::UnityScreen(CompScreen* screen) ubus_manager_.RegisterInterest(UBUS_LAUNCHER_END_KEY_SWITCHER, sigc::mem_fun(this, &UnityScreen::OnLauncherEndKeyNav)); - ubus_manager_.RegisterInterest(UBUS_SWITCHER_END, - sigc::mem_fun(this, &UnityScreen::OnSwitcherEnd)); - auto init_plugins_cb = sigc::mem_fun(this, &UnityScreen::initPluginActions); sources_.Add(std::make_shared<glib::Idle>(init_plugins_cb, glib::Source::Priority::DEFAULT)); @@ -533,7 +530,11 @@ void UnityScreen::OnInitiateSpread() }); for (auto const& swin : sScreen->getWindows()) - UnityWindow::get(swin->window)->OnInitiateSpread(); + { + auto* uwin = UnityWindow::get(swin->window); + fake_decorated_windows_.insert(uwin); + uwin->OnInitiateSpread(); + } } void UnityScreen::OnTerminateSpread() @@ -542,6 +543,8 @@ void UnityScreen::OnTerminateSpread() for (auto const& swin : sScreen->getWindows()) UnityWindow::get(swin->window)->OnTerminateSpread(); + + fake_decorated_windows_.clear(); } void UnityScreen::DamagePanelShadow() @@ -876,9 +879,9 @@ void UnityScreen::paintDisplay() } } - if (switcher_controller_->Opacity() > 0.0f) + if (switcher_controller_->detail()) { - LayoutWindow::Vector const& targets = switcher_controller_->ExternalRenderTargets(); + auto const& targets = switcher_controller_->ExternalRenderTargets(); for (LayoutWindow::Ptr const& target : targets) { @@ -1709,7 +1712,7 @@ void UnityScreen::handleEvent(XEvent* event) if (CompWindow *w = screen->findWindow(sScreen->getSelectedWindow())) skip_other_plugins = UnityWindow::get(w)->handleEvent(event); } - else if (switcher_controller_->IsDetailViewShown()) + else if (switcher_controller_->detail()) { Window win = switcher_controller_->GetCurrentSelection().window_; CompWindow* w = screen->findWindow(win); @@ -1740,7 +1743,7 @@ void UnityScreen::handleEvent(XEvent* event) skip_other_plugins = UnityWindow::get(w)->handleEvent(event); } } - else if (switcher_controller_->IsDetailViewShown()) + else if (switcher_controller_->detail()) { Window win = switcher_controller_->GetCurrentSelection().window_; CompWindow* w = screen->findWindow(win); @@ -1805,7 +1808,7 @@ void UnityScreen::handleEvent(XEvent* event) break; case ButtonRelease: - if (switcher_controller_->IsDetailViewShown()) + if (switcher_controller_->detail()) { Window win = switcher_controller_->GetCurrentSelection().window_; CompWindow* w = screen->findWindow(win); @@ -2312,13 +2315,13 @@ bool UnityScreen::altTabNextWindowInitiate(CompAction* action, CompAction::State switcher_controller_->Select((switcher_controller_->StartIndex())); // always select the current application switcher_controller_->InitiateDetail(); } - else if (switcher_controller_->IsDetailViewShown()) + else if (switcher_controller_->detail()) { switcher_controller_->NextDetail(); } else { - switcher_controller_->SetDetail(true); + switcher_controller_->detail = true; } action->setState(action->state() | CompAction::StateTermKey); @@ -2413,13 +2416,27 @@ void UnityScreen::OnLauncherEndKeyNav(GVariant* data) PluginAdapter::Default().RestoreInputFocus(); } -void UnityScreen::OnSwitcherEnd(GVariant* data) +void UnityScreen::OnSwitcherDetailChanged(bool detail) { - for (UnityWindow* uwin : fake_decorated_windows_) + if (detail) { - uwin->close_icon_state_ = decoration::WidgetState::NORMAL; - uwin->middle_clicked_ = false; - uwin->CleanupCachedTextures(); + for (LayoutWindow::Ptr const& target : switcher_controller_->ExternalRenderTargets()) + { + if (CompWindow* window = screen->findWindow(target->xid)) + { + auto* uwin = UnityWindow::get(window); + uwin->close_icon_state_ = decoration::WidgetState::NORMAL; + uwin->middle_clicked_ = false; + fake_decorated_windows_.insert(uwin); + } + } + } + else + { + for (UnityWindow* uwin : fake_decorated_windows_) + uwin->CleanupCachedTextures(); + + fake_decorated_windows_.clear(); } } @@ -2881,7 +2898,9 @@ bool UnityWindow::glPaint(const GLWindowPaintAttrib& attrib, wAttrib.brightness *= 0.75f; } - return gWindow->glPaint(wAttrib, matrix, region, mask); + bool ret = gWindow->glPaint(wAttrib, matrix, region, mask); + deco_win_->Paint(matrix, wAttrib, region, mask); + return ret; } /* handle window painting in an opengl context @@ -3494,7 +3513,7 @@ void UnityScreen::optionChanged(CompOption* opt, UnityshellOptions::Options num) launcher_options->super_tap_duration = optionGetDashTapDuration(); break; case UnityshellOptions::AltTabTimeout: - switcher_controller_->SetDetailOnTimeout(optionGetAltTabTimeout()); + switcher_controller_->detail_on_timeout = optionGetAltTabTimeout(); case UnityshellOptions::AltTabBiasViewport: PluginAdapter::Default().bias_active_to_viewport = optionGetAltTabBiasViewport(); break; @@ -3715,6 +3734,7 @@ void UnityScreen::initLauncher() AddChild(launcher_controller_.get()); switcher_controller_ = std::make_shared<switcher::Controller>(); + switcher_controller_->detail.changed.connect(sigc::mem_fun(this, &UnityScreen::OnSwitcherDetailChanged)); AddChild(switcher_controller_.get()); LOG_INFO(logger) << "initLauncher-Launcher " << timer.ElapsedSeconds() << "s"; @@ -3890,6 +3910,7 @@ UnityWindow::UnityWindow(CompWindow* window) , gWindow(GLWindow::get(window)) , close_icon_state_(decoration::WidgetState::NORMAL) , deco_win_(uScreen->deco_manager_->HandleWindow(window)) + , need_fake_deco_redraw_(false) , is_nux_window_(isNuxWindow(window)) { WindowInterface::setHandler(window); @@ -4063,14 +4084,11 @@ void UnityWindow::paintFakeDecoration(nux::Geometry const& geo, GLWindowPaintAtt { mask |= PAINT_WINDOW_BLEND_MASK; + if (!decoration_tex_ && compiz_utils::IsWindowFullyDecorable(window)) + BuildDecorationTexture(); + if (!highlighted) { - if (!compiz_utils::IsWindowFullyDecorable(window)) - return; - - if (!decoration_tex_) - BuildDecorationTexture(); - if (decoration_tex_) DrawTexture(*decoration_tex_, attrib, transform, mask, geo.x, geo.y, scale); @@ -4113,7 +4131,14 @@ void UnityWindow::paintFakeDecoration(nux::Geometry const& geo, GLWindowPaintAtt int text_x = padding.left + (close_texture ? close_texture->width() : 0) / dpi_scale; RenderTitle(context, text_x, padding.top, (width - padding.right) / dpi_scale, height / dpi_scale, scale); decoration_selected_tex_ = context; + decoration_title_ = deco_win_->title(); uScreen->damageRegion(CompRegionFromNuxGeo(geo)); + need_fake_deco_redraw_ = true; + + if (decoration_tex_) + DrawTexture(*decoration_tex_, attrib, transform, mask, geo.x, geo.y, scale); + + return; // Let's draw this at next repaint cycle } else { @@ -4121,6 +4146,10 @@ void UnityWindow::paintFakeDecoration(nux::Geometry const& geo, GLWindowPaintAtt redraw_decoration = false; } } + else + { + need_fake_deco_redraw_ = false; + } if (decoration_selected_tex_) DrawTexture(*decoration_selected_tex_, attrib, transform, mask, geo.x, geo.y); @@ -4157,7 +4186,7 @@ void UnityWindow::scalePaintDecoration(GLWindowPaintAttrib const& attrib, auto state = uScreen->sScreen->getState(); - if (state != ScaleScreen::Wait && state != ScaleScreen::Out) + if (state != ScaleScreen::Wait && state != ScaleScreen::Out && !need_fake_deco_redraw_) return; nux::Geometry const& scale_geo = GetScaledGeometry(); diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h index a572ae50d..a9bf144d7 100644 --- a/plugins/unityshell/src/unityshell.h +++ b/plugins/unityshell/src/unityshell.h @@ -278,8 +278,7 @@ private: void OnLauncherStartKeyNav(GVariant* data); void OnLauncherEndKeyNav(GVariant* data); - - void OnSwitcherEnd(GVariant* data); + void OnSwitcherDetailChanged(bool detail); void OnInitiateSpread(); void OnTerminateSpread(); @@ -558,6 +557,7 @@ private: nux::Geometry close_button_geo_; std::shared_ptr<decoration::Window> deco_win_; bool middle_clicked_; + bool need_fake_deco_redraw_; bool is_nux_window_; glib::Source::UniquePtr focus_desktop_timeout_; |
