mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 02:25:59 +01:00
xwayland: add force_zero_scaling
This commit is contained in:
parent
64ce06a353
commit
6beb79f27b
8 changed files with 28 additions and 9 deletions
|
@ -217,6 +217,7 @@ class CWindow {
|
||||||
bool m_bIsModal = false;
|
bool m_bIsModal = false;
|
||||||
bool m_bX11DoesntWantBorders = false;
|
bool m_bX11DoesntWantBorders = false;
|
||||||
bool m_bX11ShouldntFocus = false;
|
bool m_bX11ShouldntFocus = false;
|
||||||
|
float m_fX11SurfaceScaledBy = 1.f;
|
||||||
//
|
//
|
||||||
|
|
||||||
// For nofocus
|
// For nofocus
|
||||||
|
|
|
@ -207,6 +207,7 @@ void CConfigManager::setDefaultVars() {
|
||||||
configValues["gestures:workspace_swipe_numbered"].intValue = 0;
|
configValues["gestures:workspace_swipe_numbered"].intValue = 0;
|
||||||
|
|
||||||
configValues["xwayland:use_nearest_neighbor"].intValue = 1;
|
configValues["xwayland:use_nearest_neighbor"].intValue = 1;
|
||||||
|
configValues["xwayland:force_zero_scaling"].intValue = 0;
|
||||||
|
|
||||||
configValues["autogenerated"].intValue = 0;
|
configValues["autogenerated"].intValue = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -739,7 +739,8 @@ void Events::listener_commitWindow(void* owner, void* data) {
|
||||||
|
|
||||||
PWINDOW->updateSurfaceOutputs();
|
PWINDOW->updateSurfaceOutputs();
|
||||||
|
|
||||||
g_pHyprRenderer->damageSurface(PWINDOW->m_pWLSurface.wlr(), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y);
|
g_pHyprRenderer->damageSurface(PWINDOW->m_pWLSurface.wlr(), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y,
|
||||||
|
PWINDOW->m_bIsX11 ? 1.0 / PWINDOW->m_fX11SurfaceScaledBy : 1.0);
|
||||||
|
|
||||||
if (PWINDOW->m_bIsX11 || !PWINDOW->m_bIsFloating || PWINDOW->m_bIsFullscreen)
|
if (PWINDOW->m_bIsX11 || !PWINDOW->m_bIsFloating || PWINDOW->m_bIsFullscreen)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -229,6 +229,8 @@ void Events::listener_commitSubsurface(void* owner, void* data) {
|
||||||
|
|
||||||
addSurfaceGlobalOffset(pNode, &lx, &ly);
|
addSurfaceGlobalOffset(pNode, &lx, &ly);
|
||||||
|
|
||||||
|
const double SCALE = pNode->pWindowOwner && pNode->pWindowOwner->m_bIsX11 ? 1.0 / pNode->pWindowOwner->m_fX11SurfaceScaledBy : 1.0;
|
||||||
|
|
||||||
// I do not think this is correct, but it solves a lot of issues with some apps (e.g. firefox)
|
// I do not think this is correct, but it solves a lot of issues with some apps (e.g. firefox)
|
||||||
// What this does is that basically, if the pNode is a child of some other node, on commit,
|
// What this does is that basically, if the pNode is a child of some other node, on commit,
|
||||||
// it will also damage (check & damage if needed) all its siblings.
|
// it will also damage (check & damage if needed) all its siblings.
|
||||||
|
@ -237,12 +239,12 @@ void Events::listener_commitSubsurface(void* owner, void* data) {
|
||||||
const auto NODECOORDS = pNode->pSubsurface ? Vector2D(pNode->pSubsurface->pSubsurface->current.x, pNode->pSubsurface->pSubsurface->current.y) : Vector2D();
|
const auto NODECOORDS = pNode->pSubsurface ? Vector2D(pNode->pSubsurface->pSubsurface->current.x, pNode->pSubsurface->pSubsurface->current.y) : Vector2D();
|
||||||
|
|
||||||
if (&cs != pNode->pSubsurface && cs.pSubsurface) {
|
if (&cs != pNode->pSubsurface && cs.pSubsurface) {
|
||||||
g_pHyprRenderer->damageSurface(cs.pSubsurface->surface, lx - NODECOORDS.x + cs.pSubsurface->current.x, ly - NODECOORDS.y + cs.pSubsurface->current.y);
|
g_pHyprRenderer->damageSurface(cs.pSubsurface->surface, lx - NODECOORDS.x + cs.pSubsurface->current.x, ly - NODECOORDS.y + cs.pSubsurface->current.y, SCALE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pNode->pSurface && pNode->pSurface->exists())
|
if (pNode->pSurface && pNode->pSurface->exists())
|
||||||
g_pHyprRenderer->damageSurface(pNode->pSurface->wlr(), lx, ly);
|
g_pHyprRenderer->damageSurface(pNode->pSurface->wlr(), lx, ly, SCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_destroySubsurface(void* owner, void* data) {
|
void Events::listener_destroySubsurface(void* owner, void* data) {
|
||||||
|
|
|
@ -148,6 +148,17 @@ void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, Vector2D size, bool f
|
||||||
pWindow->m_vReportedPosition = pWindow->m_vRealPosition.vec();
|
pWindow->m_vReportedPosition = pWindow->m_vRealPosition.vec();
|
||||||
pWindow->m_vReportedSize = size;
|
pWindow->m_vReportedSize = size;
|
||||||
|
|
||||||
|
static auto* const PXWLFORCESCALEZERO = &g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling")->intValue;
|
||||||
|
|
||||||
|
pWindow->m_fX11SurfaceScaledBy = 1.f;
|
||||||
|
|
||||||
|
if (*PXWLFORCESCALEZERO && pWindow->m_bIsX11) {
|
||||||
|
if (const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID); PMONITOR) {
|
||||||
|
size = size * PMONITOR->scale;
|
||||||
|
pWindow->m_fX11SurfaceScaledBy = PMONITOR->scale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (pWindow->m_bIsX11)
|
if (pWindow->m_bIsX11)
|
||||||
wlr_xwayland_surface_configure(pWindow->m_uSurface.xwayland, pWindow->m_vRealPosition.vec().x, pWindow->m_vRealPosition.vec().y, size.x, size.y);
|
wlr_xwayland_surface_configure(pWindow->m_uSurface.xwayland, pWindow->m_vRealPosition.vec().x, pWindow->m_vRealPosition.vec().y, size.x, size.y);
|
||||||
else
|
else
|
||||||
|
|
|
@ -330,6 +330,9 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
surfaceLocal = mouseCoords - surfacePos + Vector2D(geom.x, geom.y);
|
surfaceLocal = mouseCoords - surfacePos + Vector2D(geom.x, geom.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pFoundWindow && pFoundWindow->m_bIsX11) // for x11 force scale zero
|
||||||
|
surfaceLocal = surfaceLocal * pFoundWindow->m_fX11SurfaceScaledBy;
|
||||||
|
|
||||||
bool allowKeyboardRefocus = true;
|
bool allowKeyboardRefocus = true;
|
||||||
|
|
||||||
if (*PHOGFOCUS && !refocus && g_pCompositor->m_pLastFocus) {
|
if (*PHOGFOCUS && !refocus && g_pCompositor->m_pLastFocus) {
|
||||||
|
|
|
@ -1355,7 +1355,7 @@ void CHyprRenderer::arrangeLayersForMonitor(const int& monitor) {
|
||||||
PMONITOR->vecReservedBottomRight.x, PMONITOR->vecReservedBottomRight.y);
|
PMONITOR->vecReservedBottomRight.x, PMONITOR->vecReservedBottomRight.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::damageSurface(wlr_surface* pSurface, double x, double y) {
|
void CHyprRenderer::damageSurface(wlr_surface* pSurface, double x, double y, double scale) {
|
||||||
if (!pSurface)
|
if (!pSurface)
|
||||||
return; // wut?
|
return; // wut?
|
||||||
|
|
||||||
|
@ -1365,6 +1365,8 @@ void CHyprRenderer::damageSurface(wlr_surface* pSurface, double x, double y) {
|
||||||
pixman_region32_t damageBox;
|
pixman_region32_t damageBox;
|
||||||
pixman_region32_init(&damageBox);
|
pixman_region32_init(&damageBox);
|
||||||
wlr_surface_get_effective_damage(pSurface, &damageBox);
|
wlr_surface_get_effective_damage(pSurface, &damageBox);
|
||||||
|
if (scale != 1.0)
|
||||||
|
wlr_region_scale(&damageBox, &damageBox, scale);
|
||||||
|
|
||||||
// schedule frame events
|
// schedule frame events
|
||||||
if (!wl_list_empty(&pSurface->current.frame_callback_list)) {
|
if (!wl_list_empty(&pSurface->current.frame_callback_list)) {
|
||||||
|
|
|
@ -11,16 +11,14 @@
|
||||||
struct SMonitorRule;
|
struct SMonitorRule;
|
||||||
|
|
||||||
// TODO: add fuller damage tracking for updating only parts of a window
|
// TODO: add fuller damage tracking for updating only parts of a window
|
||||||
enum DAMAGETRACKINGMODES
|
enum DAMAGETRACKINGMODES {
|
||||||
{
|
|
||||||
DAMAGE_TRACKING_INVALID = -1,
|
DAMAGE_TRACKING_INVALID = -1,
|
||||||
DAMAGE_TRACKING_NONE = 0,
|
DAMAGE_TRACKING_NONE = 0,
|
||||||
DAMAGE_TRACKING_MONITOR,
|
DAMAGE_TRACKING_MONITOR,
|
||||||
DAMAGE_TRACKING_FULL
|
DAMAGE_TRACKING_FULL
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eRenderPassMode
|
enum eRenderPassMode {
|
||||||
{
|
|
||||||
RENDER_PASS_ALL = 0,
|
RENDER_PASS_ALL = 0,
|
||||||
RENDER_PASS_MAIN,
|
RENDER_PASS_MAIN,
|
||||||
RENDER_PASS_POPUP
|
RENDER_PASS_POPUP
|
||||||
|
@ -35,7 +33,7 @@ class CHyprRenderer {
|
||||||
void renderMonitor(CMonitor* pMonitor);
|
void renderMonitor(CMonitor* pMonitor);
|
||||||
void outputMgrApplyTest(wlr_output_configuration_v1*, bool);
|
void outputMgrApplyTest(wlr_output_configuration_v1*, bool);
|
||||||
void arrangeLayersForMonitor(const int&);
|
void arrangeLayersForMonitor(const int&);
|
||||||
void damageSurface(wlr_surface*, double, double);
|
void damageSurface(wlr_surface*, double, double, double scale = 1.0);
|
||||||
void damageWindow(CWindow*);
|
void damageWindow(CWindow*);
|
||||||
void damageBox(wlr_box*);
|
void damageBox(wlr_box*);
|
||||||
void damageBox(const int& x, const int& y, const int& w, const int& h);
|
void damageBox(const int& x, const int& y, const int& w, const int& h);
|
||||||
|
|
Loading…
Reference in a new issue