mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-11-26 06:45:58 +01:00
fix some default floating windows crashing
This commit is contained in:
parent
aacdd572f4
commit
d1f1643a8f
2 changed files with 10 additions and 4 deletions
|
@ -129,10 +129,10 @@ CWindow* Events::remapFloatingWindow(int windowID, int forcemonitor) {
|
||||||
window.setDefaultSize(Vector2D(g_pWindowManager->Screen->width_in_pixels / 2.f, g_pWindowManager->Screen->height_in_pixels / 2.f));
|
window.setDefaultSize(Vector2D(g_pWindowManager->Screen->width_in_pixels / 2.f, g_pWindowManager->Screen->height_in_pixels / 2.f));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.getDefaultSize().x < 20 || window.getDefaultSize().y < 20) {
|
if (window.getDefaultSize().x < 40 || window.getDefaultSize().y < 40) {
|
||||||
// min size
|
// min size
|
||||||
window.setDefaultSize(Vector2D( std::clamp(window.getDefaultSize().x, (double)20, (double)99999),
|
window.setDefaultSize(Vector2D(std::clamp(window.getDefaultSize().x, (double)40, (double)99999),
|
||||||
std::clamp(window.getDefaultSize().y, (double)20, (double)99999)));
|
std::clamp(window.getDefaultSize().y, (double)40, (double)99999)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nextWindowCentered) {
|
if (nextWindowCentered) {
|
||||||
|
@ -172,6 +172,9 @@ CWindow* Events::remapFloatingWindow(int windowID, int forcemonitor) {
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
|
window.setSize(window.getDefaultSize());
|
||||||
|
window.setPosition(window.getDefaultPosition());
|
||||||
|
|
||||||
// Also sets the old one
|
// Also sets the old one
|
||||||
g_pWindowManager->calculateNewWindowParams(&window);
|
g_pWindowManager->calculateNewWindowParams(&window);
|
||||||
|
|
||||||
|
|
|
@ -681,7 +681,6 @@ void CWindowManager::applyRoundedCornersToWindow(CWindow* pWindow) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWindowManager::setEffectiveSizePosUsingConfig(CWindow* pWindow) {
|
void CWindowManager::setEffectiveSizePosUsingConfig(CWindow* pWindow) {
|
||||||
|
|
||||||
if (!pWindow || pWindow->getIsFloating())
|
if (!pWindow || pWindow->getIsFloating())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -907,6 +906,10 @@ void CWindowManager::calculateNewFloatingWindow(CWindow* pWindow) {
|
||||||
pWindow->setPosition(pWindow->getEffectivePosition() + Vector2D(3,3));
|
pWindow->setPosition(pWindow->getEffectivePosition() + Vector2D(3,3));
|
||||||
pWindow->setSize(pWindow->getEffectiveSize() - Vector2D(6, 6));
|
pWindow->setSize(pWindow->getEffectiveSize() - Vector2D(6, 6));
|
||||||
|
|
||||||
|
// min size
|
||||||
|
pWindow->setSize(Vector2D(std::clamp(pWindow->getSize().x, (double)40, (double)99999),
|
||||||
|
std::clamp(pWindow->getSize().y, (double)40, (double)99999)));
|
||||||
|
|
||||||
pWindow->setEffectivePosition(pWindow->getPosition() + Vector2D(10, 10));
|
pWindow->setEffectivePosition(pWindow->getPosition() + Vector2D(10, 10));
|
||||||
pWindow->setEffectiveSize(pWindow->getSize());
|
pWindow->setEffectiveSize(pWindow->getSize());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue