mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-29 22:05:58 +01:00
xdgshell: set predicted tiled windows to monitor res size pre-map
Should improve #4022 although not exactly fix. Fixing would require more witchcraft
This commit is contained in:
parent
9fd928e114
commit
763d5fa05f
2 changed files with 38 additions and 2 deletions
|
@ -230,6 +230,7 @@ class CWindow {
|
||||||
int m_iWorkspaceID = -1;
|
int m_iWorkspaceID = -1;
|
||||||
|
|
||||||
bool m_bIsMapped = false;
|
bool m_bIsMapped = false;
|
||||||
|
bool m_bInitialCommitPassed = false;
|
||||||
|
|
||||||
bool m_bRequestsFloat = false;
|
bool m_bRequestsFloat = false;
|
||||||
|
|
||||||
|
|
|
@ -791,7 +791,42 @@ void Events::listener_ackConfigure(void* owner, void* data) {
|
||||||
void Events::listener_commitWindow(void* owner, void* data) {
|
void Events::listener_commitWindow(void* owner, void* data) {
|
||||||
CWindow* PWINDOW = (CWindow*)owner;
|
CWindow* PWINDOW = (CWindow*)owner;
|
||||||
|
|
||||||
if (!PWINDOW->m_bIsMapped || PWINDOW->isHidden())
|
if (!PWINDOW->m_bIsMapped) {
|
||||||
|
|
||||||
|
// dupes shouldn't happen, but you never know, really.
|
||||||
|
if (PWINDOW->m_bInitialCommitPassed || PWINDOW->m_bIsX11)
|
||||||
|
return;
|
||||||
|
|
||||||
|
PWINDOW->m_bInitialCommitPassed = true;
|
||||||
|
|
||||||
|
// this is an initial commit of a surface
|
||||||
|
// in here, the surface will ask us what size we'd like it to be.
|
||||||
|
// wlroots by default doesn't send anything, so the app can use its preferred floating size
|
||||||
|
// if we predict it will be tiled, it's better to set it to the monitor size
|
||||||
|
// so it doesn't appear with the wrong size at the beginning.
|
||||||
|
// too big > too small, because will be clipped and won't look that bad.
|
||||||
|
|
||||||
|
auto willFloat = g_pXWaylandManager->shouldBeFloated(PWINDOW);
|
||||||
|
const auto WRULES = g_pConfigManager->getMatchingRules(PWINDOW);
|
||||||
|
for (auto& r : WRULES) {
|
||||||
|
if (r.szRule == "float") {
|
||||||
|
willFloat = true;
|
||||||
|
break;
|
||||||
|
} else if (r.szRule == "tile") {
|
||||||
|
willFloat = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (willFloat)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_pXWaylandManager->setWindowSize(PWINDOW, g_pCompositor->m_pLastMonitor ? g_pCompositor->m_pLastMonitor->vecSize : Vector2D{1920, 1080}, true);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PWINDOW->isHidden())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (PWINDOW->m_bIsX11)
|
if (PWINDOW->m_bIsX11)
|
||||||
|
|
Loading…
Reference in a new issue