Fix fractional scale updates in some cases (#2447)

* fix fractional scale update in moveWorkspaceToMonitor

* fix fractional scale update in moveToWorkspace

* Revert "fix fractional scale update in moveWorkspaceToMonitor"

This reverts commit 6612197a38.

* Revert "fix fractional scale update in moveToWorkspace"

This reverts commit 75d9795a06.

* move fractional scale code to updateSurfaceOutputs

* remove duplicate check

* remove superfluous setPreferredScale()
This commit is contained in:
Franz Berger 2023-06-06 09:48:07 +02:00 committed by GitHub
parent 10db5a4fdb
commit 4afeedbd56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -283,6 +283,14 @@ void CWindow::updateSurfaceOutputs() {
wlr_surface_for_each_surface(m_pWLSurface.wlr(), sendLeaveIter, PLASTMONITOR->output); wlr_surface_for_each_surface(m_pWLSurface.wlr(), sendLeaveIter, PLASTMONITOR->output);
wlr_surface_for_each_surface(m_pWLSurface.wlr(), sendEnterIter, PNEWMONITOR->output); wlr_surface_for_each_surface(m_pWLSurface.wlr(), sendEnterIter, PNEWMONITOR->output);
wlr_surface_for_each_surface(
m_pWLSurface.wlr(),
[](wlr_surface* surf, int x, int y, void* data) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(((CWindow*)data)->m_iMonitorID);
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(surf, PMONITOR ? PMONITOR->scale : 1.f);
},
this);
} }
void CWindow::moveToWorkspace(int workspaceID) { void CWindow::moveToWorkspace(int workspaceID) {
@ -291,7 +299,6 @@ void CWindow::moveToWorkspace(int workspaceID) {
m_iWorkspaceID = workspaceID; m_iWorkspaceID = workspaceID;
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID); const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID);
if (PWORKSPACE) { if (PWORKSPACE) {
@ -303,20 +310,6 @@ void CWindow::moveToWorkspace(int workspaceID) {
m_pSwallowed->moveToWorkspace(workspaceID); m_pSwallowed->moveToWorkspace(workspaceID);
m_pSwallowed->m_iMonitorID = m_iMonitorID; m_pSwallowed->m_iMonitorID = m_iMonitorID;
} }
if (PMONITOR)
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(m_pWLSurface.wlr(), PMONITOR->scale);
if (!m_bIsMapped)
return;
wlr_surface_for_each_surface(
m_pWLSurface.wlr(),
[](wlr_surface* surf, int x, int y, void* data) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(((CWindow*)data)->m_iMonitorID);
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(surf, PMONITOR ? PMONITOR->scale : 1.f);
},
this);
} }
CWindow* CWindow::X11TransientFor() { CWindow* CWindow::X11TransientFor() {