mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 00:45:57 +01:00
parent
8dd02eb5f3
commit
b8a615ffb8
3 changed files with 18 additions and 12 deletions
|
@ -205,11 +205,11 @@ class CWindow {
|
|||
CAnimatedVariable m_vRealSize;
|
||||
|
||||
// for not spamming the protocols
|
||||
Vector2D m_vReportedPosition;
|
||||
Vector2D m_vReportedSize;
|
||||
Vector2D m_vPendingReportedSize;
|
||||
bool m_bPendingSizeAcked = false;
|
||||
std::optional<uint32_t> m_iPendingSizeAck;
|
||||
Vector2D m_vReportedPosition;
|
||||
Vector2D m_vReportedSize;
|
||||
Vector2D m_vPendingReportedSize;
|
||||
std::optional<std::pair<uint32_t, Vector2D>> m_pPendingSizeAck;
|
||||
std::vector<std::pair<uint32_t, Vector2D>> m_vPendingSizeAcks;
|
||||
|
||||
// for restoring floating statuses
|
||||
Vector2D m_vLastFloatingSize;
|
||||
|
|
|
@ -794,11 +794,14 @@ void Events::listener_ackConfigure(void* owner, void* data) {
|
|||
CWindow* PWINDOW = (CWindow*)owner;
|
||||
const auto E = (wlr_xdg_surface_configure*)data;
|
||||
|
||||
if (!PWINDOW->m_iPendingSizeAck.has_value() || E->serial != PWINDOW->m_iPendingSizeAck)
|
||||
// find last matching serial
|
||||
const auto SERIAL = std::find_if(PWINDOW->m_vPendingSizeAcks.rbegin(), PWINDOW->m_vPendingSizeAcks.rend(), [&](const auto& e) { return e.first == E->serial; });
|
||||
|
||||
if (SERIAL == PWINDOW->m_vPendingSizeAcks.rend())
|
||||
return;
|
||||
|
||||
PWINDOW->m_bPendingSizeAcked = true;
|
||||
PWINDOW->m_iPendingSizeAck.reset();
|
||||
PWINDOW->m_pPendingSizeAck = *SERIAL;
|
||||
std::erase_if(PWINDOW->m_vPendingSizeAcks, [&](const auto& el) { return el.first == SERIAL->first; });
|
||||
}
|
||||
|
||||
void Events::listener_commitWindow(void* owner, void* data) {
|
||||
|
@ -807,9 +810,12 @@ void Events::listener_commitWindow(void* owner, void* data) {
|
|||
if (!PWINDOW->m_bMappedX11 || PWINDOW->isHidden() || (PWINDOW->m_bIsX11 && !PWINDOW->m_bMappedX11))
|
||||
return;
|
||||
|
||||
if (PWINDOW->m_bIsX11 || PWINDOW->m_bPendingSizeAcked)
|
||||
if (PWINDOW->m_bIsX11)
|
||||
PWINDOW->m_vReportedSize = PWINDOW->m_vPendingReportedSize; // apply pending size. We pinged, the window ponged.
|
||||
PWINDOW->m_bPendingSizeAcked = false;
|
||||
else if (PWINDOW->m_pPendingSizeAck.has_value()) {
|
||||
PWINDOW->m_vReportedSize = PWINDOW->m_pPendingSizeAck->second;
|
||||
PWINDOW->m_pPendingSizeAck.reset();
|
||||
}
|
||||
|
||||
PWINDOW->updateSurfaceOutputs();
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, Vector2D size, bool f
|
|||
windowPos = windowPos + PMONITOR->vecXWaylandPosition; // move to correct position for xwayland
|
||||
}
|
||||
|
||||
if (!force && ((pWindow->m_vReportedSize == size && windowPos == pWindow->m_vReportedPosition) || (pWindow->m_vReportedSize == size && !pWindow->m_bIsX11)))
|
||||
if (!force && ((pWindow->m_vPendingReportedSize == size && windowPos == pWindow->m_vReportedPosition) || (pWindow->m_vPendingReportedSize == size && !pWindow->m_bIsX11)))
|
||||
return;
|
||||
|
||||
pWindow->m_vReportedPosition = windowPos;
|
||||
|
@ -180,7 +180,7 @@ void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, Vector2D size, bool f
|
|||
if (pWindow->m_bIsX11)
|
||||
wlr_xwayland_surface_configure(pWindow->m_uSurface.xwayland, windowPos.x, windowPos.y, size.x, size.y);
|
||||
else
|
||||
pWindow->m_iPendingSizeAck = wlr_xdg_toplevel_set_size(pWindow->m_uSurface.xdg->toplevel, size.x, size.y);
|
||||
pWindow->m_vPendingSizeAcks.push_back(std::make_pair<>(wlr_xdg_toplevel_set_size(pWindow->m_uSurface.xdg->toplevel, size.x, size.y), size.floor()));
|
||||
}
|
||||
|
||||
void CHyprXWaylandManager::setWindowStyleTiled(CWindow* pWindow, uint32_t edgez) {
|
||||
|
|
Loading…
Reference in a new issue