Skip to content

Commit

Permalink
refactor(xwayland): improve X11 coordinate handling
Browse files Browse the repository at this point in the history
  • Loading branch information
nnyyxxxx committed Jan 31, 2025
1 parent ef03f69 commit 42c7767
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/desktop/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1697,24 +1697,16 @@ Vector2D CWindow::requestedMaxSize() {

void CWindow::sendWindowSize(Vector2D size, bool force, std::optional<Vector2D> overridePos) {
static auto PXWLFORCESCALEZERO = CConfigValue<Hyprlang::INT>("xwayland:force_zero_scaling");

const auto PMONITOR = m_pMonitor.lock();
const auto PMONITOR = m_pMonitor.lock();

size = size.clamp(Vector2D{0, 0}, Vector2D{std::numeric_limits<double>::infinity(), std::numeric_limits<double>::infinity()});

// calculate pos
// TODO: this should be decoupled from setWindowSize IMO
Vector2D windowPos = overridePos.value_or(m_vRealPosition->goal());

if (m_bIsX11 && PMONITOR) {
windowPos -= PMONITOR->vecPosition;

if (*PXWLFORCESCALEZERO) {
windowPos *= PMONITOR->scale;
windowPos = g_pXWaylandManager->waylandToXWaylandCoords(windowPos);
if (*PXWLFORCESCALEZERO)
size *= PMONITOR->scale;
}

windowPos += PMONITOR->vecXWaylandPosition;
}

if (!force && m_vPendingReportedSize == size && (windowPos == m_vReportedPosition || !m_bIsX11))
Expand Down

0 comments on commit 42c7767

Please sign in to comment.