mirror of
https://github.com/hyprwm/Hyprland
synced 2025-01-09 20:29:50 +01:00
compositor: send preferred scale and transform events to surfaces
fixes #3635
This commit is contained in:
parent
edb26e0306
commit
59f27e7f57
6 changed files with 23 additions and 6 deletions
|
@ -2677,3 +2677,12 @@ void CCompositor::leaveUnsafeState() {
|
||||||
|
|
||||||
m_pUnsafeOutput = nullptr;
|
m_pUnsafeOutput = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCompositor::setPreferredScaleForSurface(wlr_surface* pSurface, double scale) {
|
||||||
|
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(pSurface, scale);
|
||||||
|
wlr_surface_set_preferred_buffer_scale(pSurface, scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCompositor::setPreferredTransformForSurface(wlr_surface* pSurface, wl_output_transform transform) {
|
||||||
|
wlr_surface_set_preferred_buffer_transform(pSurface, transform);
|
||||||
|
}
|
|
@ -207,6 +207,8 @@ class CCompositor {
|
||||||
void arrangeMonitors();
|
void arrangeMonitors();
|
||||||
void enterUnsafeState();
|
void enterUnsafeState();
|
||||||
void leaveUnsafeState();
|
void leaveUnsafeState();
|
||||||
|
void setPreferredScaleForSurface(wlr_surface* pSurface, double scale);
|
||||||
|
void setPreferredTransformForSurface(wlr_surface* pSurface, wl_output_transform transform);
|
||||||
|
|
||||||
std::string explicitConfigPath;
|
std::string explicitConfigPath;
|
||||||
|
|
||||||
|
|
|
@ -325,7 +325,8 @@ void CWindow::updateSurfaceOutputs() {
|
||||||
m_pWLSurface.wlr(),
|
m_pWLSurface.wlr(),
|
||||||
[](wlr_surface* surf, int x, int y, void* data) {
|
[](wlr_surface* surf, int x, int y, void* data) {
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(((CWindow*)data)->m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(((CWindow*)data)->m_iMonitorID);
|
||||||
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(surf, PMONITOR ? PMONITOR->scale : 1.f);
|
g_pCompositor->setPreferredScaleForSurface(surf, PMONITOR ? PMONITOR->scale : 1.f);
|
||||||
|
g_pCompositor->setPreferredTransformForSurface(surf, PMONITOR->transform);
|
||||||
},
|
},
|
||||||
this);
|
this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,7 +171,8 @@ void Events::listener_mapLayerSurface(void* owner, void* data) {
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"openlayer", std::string(layersurface->layerSurface->_namespace ? layersurface->layerSurface->_namespace : "")});
|
g_pEventManager->postEvent(SHyprIPCEvent{"openlayer", std::string(layersurface->layerSurface->_namespace ? layersurface->layerSurface->_namespace : "")});
|
||||||
EMIT_HOOK_EVENT("openLayer", layersurface);
|
EMIT_HOOK_EVENT("openLayer", layersurface);
|
||||||
|
|
||||||
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(layersurface->layerSurface->surface, PMONITOR->scale);
|
g_pCompositor->setPreferredScaleForSurface(layersurface->layerSurface->surface, PMONITOR->scale);
|
||||||
|
g_pCompositor->setPreferredTransformForSurface(layersurface->layerSurface->surface, PMONITOR->transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_unmapLayerSurface(void* owner, void* data) {
|
void Events::listener_unmapLayerSurface(void* owner, void* data) {
|
||||||
|
@ -342,5 +343,6 @@ void Events::listener_commitLayerSurface(void* owner, void* data) {
|
||||||
|
|
||||||
g_pHyprRenderer->damageSurface(layersurface->layerSurface->surface, layersurface->position.x, layersurface->position.y);
|
g_pHyprRenderer->damageSurface(layersurface->layerSurface->surface, layersurface->position.x, layersurface->position.y);
|
||||||
|
|
||||||
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(layersurface->layerSurface->surface, PMONITOR->scale);
|
g_pCompositor->setPreferredScaleForSurface(layersurface->layerSurface->surface, PMONITOR->scale);
|
||||||
|
g_pCompositor->setPreferredTransformForSurface(layersurface->layerSurface->surface, PMONITOR->transform);
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,8 +164,10 @@ void Events::listener_mapPopupXDG(void* owner, void* data) {
|
||||||
|
|
||||||
g_pHyprRenderer->damageBox(lx - extents.x, ly - extents.y, extents.width + 2, extents.height + 2);
|
g_pHyprRenderer->damageBox(lx - extents.x, ly - extents.y, extents.width + 2, extents.height + 2);
|
||||||
|
|
||||||
if (PPOPUP->monitor)
|
if (PPOPUP->monitor) {
|
||||||
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(PPOPUP->popup->base->surface, PPOPUP->monitor->scale);
|
g_pCompositor->setPreferredScaleForSurface(PPOPUP->popup->base->surface, PPOPUP->monitor->scale);
|
||||||
|
g_pCompositor->setPreferredTransformForSurface(PPOPUP->popup->base->surface, PPOPUP->monitor->transform);
|
||||||
|
}
|
||||||
|
|
||||||
Debug::log(LOG, "XDG Popup got assigned a surfaceTreeNode {:x}", (uintptr_t)PPOPUP->pSurfaceTree);
|
Debug::log(LOG, "XDG Popup got assigned a surfaceTreeNode {:x}", (uintptr_t)PPOPUP->pSurfaceTree);
|
||||||
}
|
}
|
||||||
|
|
|
@ -646,7 +646,8 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
if (PWORKSPACE->m_bHasFullscreenWindow && !PWINDOW->m_bIsFullscreen && !PWINDOW->m_bIsFloating)
|
if (PWORKSPACE->m_bHasFullscreenWindow && !PWINDOW->m_bIsFullscreen && !PWINDOW->m_bIsFloating)
|
||||||
PWINDOW->m_fAlpha.setValueAndWarp(0.f);
|
PWINDOW->m_fAlpha.setValueAndWarp(0.f);
|
||||||
|
|
||||||
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(PWINDOW->m_pWLSurface.wlr(), PMONITOR->scale);
|
g_pCompositor->setPreferredScaleForSurface(PWINDOW->m_pWLSurface.wlr(), PMONITOR->scale);
|
||||||
|
g_pCompositor->setPreferredTransformForSurface(PWINDOW->m_pWLSurface.wlr(), PMONITOR->transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_unmapWindow(void* owner, void* data) {
|
void Events::listener_unmapWindow(void* owner, void* data) {
|
||||||
|
|
Loading…
Reference in a new issue