Skip to content

Commit

Permalink
xwayland: various window handling fixes
Browse files Browse the repository at this point in the history
I hate this fucking garbage
  • Loading branch information
vaxerski committed Jan 25, 2025
1 parent 089fdd1 commit 354d459
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/desktop/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1556,10 +1556,10 @@ void CWindow::onX11Configure(CBox box) {
}
}

m_vPosition = m_vRealPosition->value();
m_vSize = m_vRealSize->value();
m_vPosition = m_vRealPosition->goal();
m_vSize = m_vRealSize->goal();

m_pXWaylandSurface->configure(box);
g_pXWaylandManager->setWindowSize(m_pSelf.lock(), box.size(), true);

m_vPendingReportedSize = box.size();
m_vReportedSize = box.size();
Expand All @@ -1569,7 +1569,7 @@ void CWindow::onX11Configure(CBox box) {
if (!m_pWorkspace || !m_pWorkspace->isVisible())
return; // further things are only for visible windows

m_pWorkspace = g_pCompositor->getMonitorFromVector(m_vRealPosition->value() + m_vRealSize->value() / 2.f)->activeWorkspace;
m_pWorkspace = g_pCompositor->getMonitorFromVector(m_vRealPosition->goal() + m_vRealSize->goal() / 2.f)->activeWorkspace;

g_pCompositor->changeWindowZOrder(m_pSelf.lock(), true);

Expand Down
5 changes: 4 additions & 1 deletion src/events/Windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static void setVector2DAnimToMove(WP<CBaseAnimatedVariable> pav) {
animvar->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsMove"));

const auto PHLWINDOW = animvar->m_Context.pWindow.lock();
if (PHLWINDOW && !PHLWINDOW->m_vRealPosition->isBeingAnimated() && !PHLWINDOW->m_vRealSize->isBeingAnimated())
if (PHLWINDOW)
PHLWINDOW->m_bAnimatingIn = false;
}

Expand Down Expand Up @@ -680,6 +680,9 @@ void Events::listener_mapWindow(void* owner, void* data) {

if (PMONITOR && PWINDOW->isX11OverrideRedirect())
PWINDOW->m_fX11SurfaceScaledBy = PMONITOR->scale;

if (!PWINDOW->isX11OverrideRedirect() && PWINDOW->m_bIsX11 && PWINDOW->m_bIsFloating)
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize->goal(), true);
}

void Events::listener_unmapWindow(void* owner, void* data) {
Expand Down
6 changes: 4 additions & 2 deletions src/managers/XWaylandManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void CHyprXWaylandManager::activateWindow(PHLWINDOW pWindow, bool activate) {
if (pWindow->m_bIsX11) {

if (activate) {
setWindowSize(pWindow, pWindow->m_vRealSize->goal()); // update xwayland output pos
setWindowSize(pWindow, pWindow->m_vRealSize->value(), true); // update xwayland output pos
pWindow->m_pXWaylandSurface->setMinimized(false);

if (!pWindow->isX11OverrideRedirect())
Expand Down Expand Up @@ -162,7 +162,9 @@ bool CHyprXWaylandManager::shouldBeFloated(PHLWINDOW pWindow, bool pending) {
if (a == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"])
pWindow->m_bX11ShouldntFocus = true;

pWindow->m_bNoInitialFocus = true;
if (a != HYPRATOMS["_NET_WM_WINDOW_TYPE_DIALOG"])
pWindow->m_bNoInitialFocus = true;

return true;
}

Expand Down

0 comments on commit 354d459

Please sign in to comment.