diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2023-05-26 14:49:03 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2023-05-26 14:49:03 +0200 |
| commit | 5f4659afef5856c509d53957e62b7f6c38d39f41 (patch) | |
| tree | cb34fa57ce00ec120ffa705310e40c6dd9d78fa2 /src/events/Windows.cpp | |
| parent | 0887e2ee6ec9c7ef106b71c906c6531730c8fdd4 (diff) | |
xdgshell: check and conform to rigid float sizes on commit
Diffstat (limited to 'src/events/Windows.cpp')
| -rw-r--r-- | src/events/Windows.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index d9230f8a..d1cb72f0 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -741,7 +741,26 @@ void Events::listener_commitWindow(void* owner, void* data) { g_pHyprRenderer->damageSurface(PWINDOW->m_pWLSurface.wlr(), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y); - // Debug::log(LOG, "Window %lx committed", PWINDOW); // SPAM! + if (PWINDOW->m_bIsX11 || !PWINDOW->m_bIsFloating || PWINDOW->m_bIsFullscreen) + return; + + const auto ISRIGID = PWINDOW->m_uSurface.xdg->toplevel->current.max_height == PWINDOW->m_uSurface.xdg->toplevel->current.min_height && + PWINDOW->m_uSurface.xdg->toplevel->current.max_width == PWINDOW->m_uSurface.xdg->toplevel->current.min_width; + + if (!ISRIGID) + return; + + const Vector2D REQUESTEDSIZE = {PWINDOW->m_uSurface.xdg->toplevel->current.max_width, PWINDOW->m_uSurface.xdg->toplevel->current.max_height}; + + if (REQUESTEDSIZE == PWINDOW->m_vReportedSize || REQUESTEDSIZE.x < 5 || REQUESTEDSIZE.y < 5) + return; + + const Vector2D DELTA = PWINDOW->m_vReportedSize - REQUESTEDSIZE; + + PWINDOW->m_vRealPosition = PWINDOW->m_vRealPosition.goalv() + DELTA / 2.0; + PWINDOW->m_vRealSize = REQUESTEDSIZE; + g_pXWaylandManager->setWindowSize(PWINDOW, REQUESTEDSIZE, true); + g_pHyprRenderer->damageWindow(PWINDOW); } void Events::listener_destroyWindow(void* owner, void* data) { |
