[Workspaces] Arranger: smart timer (#36096)

* [Workspaces] Add move functionality

* spell checker

* [Workspaces] Modify Arranger to move apps without launch

* moved ipc helper

* removed callback

* use LauncherStatus in WindowArranger

* wait for launching next app

* launch in a separate thread and protect by mutexes

* update app version in advance

* changed canceling launch

* increased waiting time

* Fix optional parameter load from json

* changed arranger waiting time

* additional waiting time for Outlook

* added app id

* ensure ids before launch

* set id in editor

* minor updates

* [Workspaces] Move: Get the nearest window when moving a window

* [Workspaces] convert optional boolean to enum to avoid json problems

* Handle case when the new Application Property "moveIfExists" does not exist

* Re-implementing app-window pairing for moving feature.

* spell checker

* XAML formatting

* Fixing bug: IPC message not arriving

* spell checker

* Removing app-level-setting for move app. Also fixed compiler errors due styling.

* Updating editor window layout

* Re-implementing window positioning UI elements

* XAML formatting

* Code review findings

* Code cleanup

* Code cleanup

* Code cleanup

* code cleanup

* Code cleanup

* Code cleanup

* [Workspaces] Arranger: Reset wait timer after each successful arrange action

* fix merge error

---------

Co-authored-by: Seraphima <zykovas91@gmail.com>
Co-authored-by: donlaci <donlaci@yahoo.com>
This commit is contained in:
Laszlo Nemeth 2024-12-06 15:09:09 +01:00 коммит произвёл GitHub
Родитель 4df8a97256
Коммит 1212ce2216
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 19 добавлений и 11 удалений

Просмотреть файл

@ -313,7 +313,11 @@ WindowArranger::WindowArranger(WorkspacesData::WorkspacesProject project) :
// process launching windows
while (!m_launchingStatus.AllLaunched() && waitingTime < maxLaunchingWaitingTime)
{
processWindows(false);
if (processWindows(false))
{
waitingTime = 0;
}
std::this_thread::sleep_for(std::chrono::milliseconds(ms));
waitingTime += ms;
}
@ -340,8 +344,9 @@ WindowArranger::WindowArranger(WorkspacesData::WorkspacesProject project) :
}
}
void WindowArranger::processWindows(bool processAll)
bool WindowArranger::processWindows(bool processAll)
{
bool processedAnyWindow = false;
std::vector<HWND> windows = WindowEnumerator::Enumerate(WindowFilter::Filter);
if (!processAll)
@ -353,27 +358,29 @@ void WindowArranger::processWindows(bool processAll)
for (HWND window : windows)
{
processWindow(window);
processedAnyWindow |= processWindow(window);
}
return processedAnyWindow;
}
void WindowArranger::processWindow(HWND window)
bool WindowArranger::processWindow(HWND window)
{
if (m_launchingStatus.IsWindowProcessed(window))
{
return;
return false;
}
RECT rect = WindowUtils::GetWindowRect(window);
if (rect.right - rect.left <= 0 || rect.bottom - rect.top <= 0)
{
return;
return false;
}
std::wstring processPath = get_process_path(window);
if (processPath.empty())
{
return;
return false;
}
DWORD pid{};
@ -382,7 +389,7 @@ void WindowArranger::processWindow(HWND window)
auto data = Utils::Apps::GetApp(processPath, pid, m_installedApps);
if (!data.has_value())
{
return;
return false;
}
const auto& apps = m_launchingStatus.Get();
@ -395,7 +402,7 @@ void WindowArranger::processWindow(HWND window)
if (iter == apps.end())
{
Logger::info(L"Skip {}", processPath);
return;
return false;
}
if (moveWindow(window, iter->first))
@ -412,6 +419,7 @@ void WindowArranger::processWindow(HWND window)
{
sendUpdatedState(state.value());
}
return true;
}
bool WindowArranger::moveWindow(HWND window, const WorkspacesData::WorkspacesProject::Application& app)

Просмотреть файл

@ -32,8 +32,8 @@ private:
bool TryMoveWindow(const WorkspacesData::WorkspacesProject::Application& app, HWND windowToMove);
//void onWindowCreated(HWND window);
void processWindows(bool processAll);
void processWindow(HWND window);
bool processWindows(bool processAll);
bool processWindow(HWND window);
bool moveWindow(HWND window, const WorkspacesData::WorkspacesProject::Application& app);
void receiveIpcMessage(const std::wstring& message);