MCPcopy Create free account
hub / github.com/TranslucentTB/TranslucentTB / InsertWindow

Method InsertWindow

TranslucentTB/taskbar/taskbarattributeworker.cpp:677–736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

675}
676
677void TaskbarAttributeWorker::InsertWindow(Window window, bool refresh)
678{
679 if (window.classname() == CORE_WINDOW) [[unlikely]]
680 {
681 // Windows.UI.Core.CoreWindow is always shell UI stuff
682 // that we either have a dynamic mode for or should ignore.
683 // so just skip it.
684 return;
685 }
686
687 AttributeRefresher refresher(*this, refresh);
688
689 // Note: The checks are done before iterating because
690 // some methods (most notably Window::on_current_desktop)
691 // will trigger a Windows internal message loop,
692 // which pumps messages to the worker. When the DPI is
693 // changing, it means m_Taskbars is cleared while we still
694 // have an iterator to it. Acquiring the iterator after the
695 // call to on_current_desktop resolves this issue.
696 const bool windowMatches = window.is_user_window() && !m_ConfigManager.GetConfig().IgnoredWindows.IsFiltered(window);
697 const HMONITOR mon = window.monitor();
698
699 for (auto it = m_Taskbars.begin(); it != m_Taskbars.end(); ++it)
700 {
701 auto &maximised = it->second.MaximisedWindows;
702 auto &normal = it->second.NormalWindows;
703
704 if (it->first == mon)
705 {
706 if (windowMatches && window.maximised())
707 {
708 if (normal.erase(window) > 0)
709 {
710 LogWindowRemoval(L"normal", window, mon);
711 }
712
713 LogWindowInsertion(maximised.insert(window), L"maximised", mon);
714
715 refresher.refresh(it);
716 continue;
717 }
718 else if (windowMatches && !window.minimised())
719 {
720 if (maximised.erase(window) > 0)
721 {
722 LogWindowRemoval(L"maximised", window, mon);
723 }
724
725 LogWindowInsertion(normal.insert(window), L"normal", mon);
726
727 refresher.refresh(it);
728 continue;
729 }
730
731 // fall out the if if the window is minimized
732 }
733
734 RemoveWindow(window, it, refresher);

Callers

nothing calls this directly

Calls 10

classnameMethod · 0.80
is_user_windowMethod · 0.80
IsFilteredMethod · 0.80
GetConfigMethod · 0.80
monitorMethod · 0.80
maximisedMethod · 0.80
refreshMethod · 0.80
minimisedMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected