2024-09-25 12:13:38 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <WindowCreationHandler.h>
|
|
|
|
|
|
|
|
|
|
#include <WorkspacesLib/AppUtils.h>
|
|
|
|
|
#include <WorkspacesLib/IPCHelper.h>
|
|
|
|
|
#include <WorkspacesLib/LaunchingStatus.h>
|
2024-12-04 18:17:54 +01:00
|
|
|
#include <WorkspacesLib/PwaHelper.h>
|
2024-09-25 12:13:38 +03:00
|
|
|
#include <WorkspacesLib/WorkspacesData.h>
|
|
|
|
|
|
2024-12-04 18:17:54 +01:00
|
|
|
struct WindowWithDistance
|
|
|
|
|
{
|
|
|
|
|
int distance;
|
|
|
|
|
HWND window;
|
|
|
|
|
};
|
|
|
|
|
|
2024-09-25 12:13:38 +03:00
|
|
|
class WindowArranger
|
|
|
|
|
{
|
|
|
|
|
public:
|
2024-10-14 16:51:02 +03:00
|
|
|
WindowArranger(WorkspacesData::WorkspacesProject project);
|
2024-09-25 12:13:38 +03:00
|
|
|
~WindowArranger() = default;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
const WorkspacesData::WorkspacesProject m_project;
|
|
|
|
|
const std::vector<HWND> m_windowsBefore;
|
|
|
|
|
const std::vector<WorkspacesData::WorkspacesProject::Monitor> m_monitors;
|
|
|
|
|
const Utils::Apps::AppList m_installedApps;
|
|
|
|
|
//const WindowCreationHandler m_windowCreationHandler;
|
2024-10-14 16:51:02 +03:00
|
|
|
IPCHelper m_ipcHelper;
|
|
|
|
|
LaunchingStatus m_launchingStatus;
|
2024-12-04 18:17:54 +01:00
|
|
|
std::optional<WindowWithDistance> GetNearestWindow(const WorkspacesData::WorkspacesProject::Application& app, const std::vector<HWND>& movedWindows, Utils::PwaHelper& pwaHelper);
|
|
|
|
|
bool TryMoveWindow(const WorkspacesData::WorkspacesProject::Application& app, HWND windowToMove);
|
|
|
|
|
|
2024-09-25 12:13:38 +03:00
|
|
|
//void onWindowCreated(HWND window);
|
2024-10-14 16:51:02 +03:00
|
|
|
void processWindows(bool processAll);
|
2024-09-25 12:13:38 +03:00
|
|
|
void processWindow(HWND window);
|
|
|
|
|
bool moveWindow(HWND window, const WorkspacesData::WorkspacesProject::Application& app);
|
|
|
|
|
|
2024-10-14 16:51:02 +03:00
|
|
|
void receiveIpcMessage(const std::wstring& message);
|
|
|
|
|
void sendUpdatedState(const WorkspacesData::LaunchingAppState& data) const;
|
2024-09-25 12:13:38 +03:00
|
|
|
};
|