diff options
| author | Jack Barnes <135401840+yuukibarns@users.noreply.github.com> | 2025-05-06 09:53:43 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-06 03:53:43 +0200 |
| commit | 930eeac900c60d147bf26491e15b0727605b3944 (patch) | |
| tree | f442230ac5b171b2fd404c6a19c0f5c063c4f110 /src/config/ConfigManager.cpp | |
| parent | ec93f8a1cda30f1cf22a24cbc00f680b8bfd0ba8 (diff) | |
window: use stored size for new floating window when persistentsize is set (#10212)
* fix(window): use stored size for new floating window when persistentsize is set. fix hyprwm#9422.
* fix: replace `std::any_of` with `std::ranges:any_of`
* fix: use initialClass and initialTitle when storing sizes on close
* fix: add `xdgTag` as a new indicator
* fix: no {}
* fix: format with clang-format
Diffstat (limited to 'src/config/ConfigManager.cpp')
| -rw-r--r-- | src/config/ConfigManager.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 90e4fe12..4ef39280 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -3043,13 +3043,18 @@ void CConfigManager::ensurePersistentWorkspacesPresent() { } void CConfigManager::storeFloatingSize(PHLWINDOW window, const Vector2D& size) { - Debug::log(LOG, "storing floating size {}x{} for window {}::{}", size.x, size.y, window->m_class, window->m_title); - SFloatCache id{window}; + Debug::log(LOG, "storing floating size {}x{} for window {}::{}", size.x, size.y, window->m_initialClass, window->m_initialTitle); + // true -> use m_initialClass and m_initialTitle + SFloatCache id{window, true}; m_mStoredFloatingSizes[id] = size; } std::optional<Vector2D> CConfigManager::getStoredFloatingSize(PHLWINDOW window) { - SFloatCache id{window}; + // At startup, m_initialClass and m_initialTitle are undefined + // and m_class and m_title are just "initial" ones. + // false -> use m_class and m_title + SFloatCache id{window, false}; + Debug::log(LOG, "Hash for window {}::{} = {}", window->m_class, window->m_title, id.hash); if (m_mStoredFloatingSizes.contains(id)) { Debug::log(LOG, "got stored size {}x{} for window {}::{}", m_mStoredFloatingSizes[id].x, m_mStoredFloatingSizes[id].y, window->m_class, window->m_title); return m_mStoredFloatingSizes[id]; |
