Migrate the config to hyprlang (#4656)

* Migrate to hyprlang

* pop up errors

* fix swapped args

* Meson & Nix: build with hyprlang

* CI: add hyprlang to setup action

* add infra for plugin stuff

* fix hyprctl getoption

* fix hyprctl getoption with json

* format

* fix post parse logic

* fix autogen config

* oops missed exec-once

* fmt

* fix ws rules

* require 0.3.0 for hyprlang

* nix: flaek

* minor type fixes

* fix cfg usages in swipe

* use cvarlist for ws rules

* fix throw in addPluginConfigVar

* Nix: update hyprlang

* minor fixes

* fix disableLogs

* mention hyprlang docs

* bump hyprlang dep in cmake

* Meson: bump min hyprlang version

Nix: update hyprlang

* minor fix

* Nix: update meson patch

---------

Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
This commit is contained in:
Vaxry 2024-02-18 15:00:34 +00:00 committed by GitHub
parent 7e8bcd675d
commit 13f6f0b923
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
42 changed files with 2300 additions and 2462 deletions

View File

@ -23,6 +23,7 @@ runs:
glm \ glm \
glslang \ glslang \
go \ go \
hyprlang \
jq \ jq \
libc++ \ libc++ \
libdisplay-info \ libdisplay-info \

View File

@ -101,7 +101,7 @@ message(STATUS "Checking deps...")
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
pkg_check_modules(deps REQUIRED IMPORTED_TARGET wayland-server wayland-client wayland-cursor wayland-protocols cairo libdrm xkbcommon libinput pango pangocairo pixman-1) # we do not check for wlroots, as we provide it ourselves pkg_check_modules(deps REQUIRED IMPORTED_TARGET wayland-server wayland-client wayland-cursor wayland-protocols cairo libdrm xkbcommon libinput pango pangocairo pixman-1 hyprlang>=0.3.2) # we do not check for wlroots, as we provide it ourselves
file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp") file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp")

View File

@ -24,6 +24,26 @@
} }
}, },
"hyprlang": { "hyprlang": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1708005943,
"narHash": "sha256-9TT3xk++LI5/SPYgjYX34xZ4ebR93c1uerIq+SE/ues=",
"owner": "hyprwm",
"repo": "hyprlang",
"rev": "aeb3e012adc7b3235335c540b214b82267c2b983",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprlang",
"type": "github"
}
},
"hyprlang_2": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"xdph", "xdph",
@ -63,6 +83,7 @@
"root": { "root": {
"inputs": { "inputs": {
"hyprland-protocols": "hyprland-protocols", "hyprland-protocols": "hyprland-protocols",
"hyprlang": "hyprlang",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"systems": "systems", "systems": "systems",
"wlroots": "wlroots", "wlroots": "wlroots",
@ -108,7 +129,7 @@
"hyprland-protocols": [ "hyprland-protocols": [
"hyprland-protocols" "hyprland-protocols"
], ],
"hyprlang": "hyprlang", "hyprlang": "hyprlang_2",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],

View File

@ -22,6 +22,11 @@
inputs.systems.follows = "systems"; inputs.systems.follows = "systems";
}; };
hyprlang = {
url = "github:hyprwm/hyprlang";
inputs.nixpkgs.follows = "nixpkgs";
};
xdph = { xdph = {
url = "github:hyprwm/xdg-desktop-portal-hyprland"; url = "github:hyprwm/xdg-desktop-portal-hyprland";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -86,7 +91,7 @@
name = "hyprland-shell"; name = "hyprland-shell";
nativeBuildInputs = with pkgsFor.${system}; [cmake python3]; nativeBuildInputs = with pkgsFor.${system}; [cmake python3];
buildInputs = [self.packages.${system}.wlroots-hyprland]; buildInputs = [self.packages.${system}.wlroots-hyprland];
hardeningDisable = [ "fortify" ]; hardeningDisable = ["fortify"];
inputsFrom = [ inputsFrom = [
self.packages.${system}.wlroots-hyprland self.packages.${system}.wlroots-hyprland
self.packages.${system}.hyprland self.packages.${system}.hyprland

View File

@ -9,6 +9,7 @@
cairo, cairo,
git, git,
hyprland-protocols, hyprland-protocols,
hyprlang,
jq, jq,
libGL, libGL,
libdrm, libdrm,
@ -75,6 +76,7 @@ assert lib.assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been remov
cairo cairo
git git
hyprland-protocols hyprland-protocols
hyprlang
libdrm libdrm
libGL libGL
libinput libinput

View File

@ -22,6 +22,7 @@ in {
hyprland-packages = lib.composeManyExtensions [ hyprland-packages = lib.composeManyExtensions [
# Dependencies # Dependencies
inputs.hyprland-protocols.overlays.default inputs.hyprland-protocols.overlays.default
inputs.hyprlang.overlays.default
self.overlays.wlroots-hyprland self.overlays.wlroots-hyprland
self.overlays.udis86 self.overlays.udis86
# Hyprland packages themselves # Hyprland packages themselves

View File

@ -34,16 +34,17 @@ index 1d2c7f9f..c5ef4e67 100644
headers = globber.stdout().strip().split('\n') headers = globber.stdout().strip().split('\n')
foreach file : headers foreach file : headers
diff --git a/src/meson.build b/src/meson.build diff --git a/src/meson.build b/src/meson.build
index 0af864b9..38723b8c 100644 index 45701f5f..3505cefe 100644
--- a/src/meson.build --- a/src/meson.build
+++ b/src/meson.build +++ b/src/meson.build
@@ -9,16 +9,16 @@ executable('Hyprland', src, @@ -9,17 +9,17 @@ executable('Hyprland', src,
server_protos, server_protos,
dependency('wayland-server'), dependency('wayland-server'),
dependency('wayland-client'), dependency('wayland-client'),
- wlroots.get_variable('wlroots'), - wlroots.get_variable('wlroots'),
+ dependency('wlroots'), + dependency('wlroots'),
dependency('cairo'), dependency('cairo'),
dependency('hyprlang', version: '>= 0.3.2'),
dependency('libdrm'), dependency('libdrm'),
dependency('egl'), dependency('egl'),
dependency('xkbcommon'), dependency('xkbcommon'),

View File

@ -699,11 +699,11 @@ bool CCompositor::monitorExists(CMonitor* pMonitor) {
CWindow* CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t properties, CWindow* pIgnoreWindow) { CWindow* CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t properties, CWindow* pIgnoreWindow) {
const auto PMONITOR = getMonitorFromVector(pos); const auto PMONITOR = getMonitorFromVector(pos);
static auto* const PRESIZEONBORDER = &g_pConfigManager->getConfigValuePtr("general:resize_on_border")->intValue; static auto* const PRESIZEONBORDER = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:resize_on_border");
static auto* const PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue; static auto* const PBORDERSIZE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:border_size");
static auto* const PBORDERGRABEXTEND = &g_pConfigManager->getConfigValuePtr("general:extend_border_grab_area")->intValue; static auto* const PBORDERGRABEXTEND = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:extend_border_grab_area");
static auto* const PSPECIALFALLTHRU = &g_pConfigManager->getConfigValuePtr("input:special_fallthrough")->intValue; static auto* const PSPECIALFALLTHRU = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("input:special_fallthrough");
const auto BORDER_GRAB_AREA = *PRESIZEONBORDER ? *PBORDERSIZE + *PBORDERGRABEXTEND : 0; const auto BORDER_GRAB_AREA = **PRESIZEONBORDER ? **PBORDERSIZE + **PBORDERGRABEXTEND : 0;
// pinned windows on top of floating regardless // pinned windows on top of floating regardless
if (properties & ALLOW_FLOATING) { if (properties & ALLOW_FLOATING) {
@ -793,7 +793,7 @@ CWindow* CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t propert
}; };
// special workspace // special workspace
if (PMONITOR->specialWorkspaceID && !*PSPECIALFALLTHRU) if (PMONITOR->specialWorkspaceID && !**PSPECIALFALLTHRU)
return windowForWorkspace(true); return windowForWorkspace(true);
if (PMONITOR->specialWorkspaceID) { if (PMONITOR->specialWorkspaceID) {
@ -893,8 +893,8 @@ CMonitor* CCompositor::getRealMonitorFromOutput(wlr_output* out) {
void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) { void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
static auto* const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue; static auto* const PFOLLOWMOUSE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("input:follow_mouse");
static auto* const PSPECIALFALLTHROUGH = &g_pConfigManager->getConfigValuePtr("input:special_fallthrough")->intValue; static auto* const PSPECIALFALLTHROUGH = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("input:special_fallthrough");
if (g_pCompositor->m_sSeat.exclusiveClient) { if (g_pCompositor->m_sSeat.exclusiveClient) {
Debug::log(LOG, "Disallowing setting focus to a window due to there being an active input inhibitor layer."); Debug::log(LOG, "Disallowing setting focus to a window due to there being an active input inhibitor layer.");
@ -968,7 +968,7 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
/* If special fallthrough is enabled, this behavior will be disabled, as I have no better idea of nicely tracking which /* If special fallthrough is enabled, this behavior will be disabled, as I have no better idea of nicely tracking which
window focuses are "via keybinds" and which ones aren't. */ window focuses are "via keybinds" and which ones aren't. */
if (PMONITOR->specialWorkspaceID && PMONITOR->specialWorkspaceID != pWindow->m_iWorkspaceID && !pWindow->m_bPinned && !*PSPECIALFALLTHROUGH) if (PMONITOR->specialWorkspaceID && PMONITOR->specialWorkspaceID != pWindow->m_iWorkspaceID && !pWindow->m_bPinned && !**PSPECIALFALLTHROUGH)
PMONITOR->setSpecialWorkspace(nullptr); PMONITOR->setSpecialWorkspace(nullptr);
// we need to make the PLASTWINDOW not equal to m_pLastWindow so that RENDERDATA is correct for an unfocused window // we need to make the PLASTWINDOW not equal to m_pLastWindow so that RENDERDATA is correct for an unfocused window
@ -1035,7 +1035,7 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
std::rotate(m_vWindowFocusHistory.begin(), HISTORYPIVOT, HISTORYPIVOT + 1); std::rotate(m_vWindowFocusHistory.begin(), HISTORYPIVOT, HISTORYPIVOT + 1);
} }
if (*PFOLLOWMOUSE == 0) if (**PFOLLOWMOUSE == 0)
g_pInputManager->sendMotionEventsToFocused(); g_pInputManager->sendMotionEventsToFocused();
} }
@ -1502,7 +1502,7 @@ CWindow* CCompositor::getWindowInDirection(CWindow* pWindow, char dir) {
return nullptr; return nullptr;
// 0 -> history, 1 -> shared length // 0 -> history, 1 -> shared length
static auto* const PMETHOD = &g_pConfigManager->getConfigValuePtr("binds:focus_preferred_method")->intValue; static auto* const PMETHOD = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("binds:focus_preferred_method");
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
@ -1564,7 +1564,7 @@ CWindow* CCompositor::getWindowInDirection(CWindow* pWindow, char dir) {
break; break;
} }
if (*PMETHOD == 0 /* history */) { if (**PMETHOD == 0 /* history */) {
if (intersectLength > 0) { if (intersectLength > 0) {
// get idx // get idx
@ -1863,21 +1863,30 @@ void CCompositor::updateWorkspaceWindows(const int64_t& id) {
void CCompositor::updateWindowAnimatedDecorationValues(CWindow* pWindow) { void CCompositor::updateWindowAnimatedDecorationValues(CWindow* pWindow) {
// optimization // optimization
static auto* const ACTIVECOL = (CGradientValueData*)g_pConfigManager->getConfigValuePtr("general:col.active_border")->data.get(); static auto* const PACTIVECOL = (Hyprlang::CUSTOMTYPE* const*)g_pConfigManager->getConfigValuePtr("general:col.active_border");
static auto* const INACTIVECOL = (CGradientValueData*)g_pConfigManager->getConfigValuePtr("general:col.inactive_border")->data.get(); static auto* const PINACTIVECOL = (Hyprlang::CUSTOMTYPE* const*)g_pConfigManager->getConfigValuePtr("general:col.inactive_border");
static auto* const NOGROUPACTIVECOL = (CGradientValueData*)g_pConfigManager->getConfigValuePtr("general:col.nogroup_border_active")->data.get(); static auto* const PNOGROUPACTIVECOL = (Hyprlang::CUSTOMTYPE* const*)g_pConfigManager->getConfigValuePtr("general:col.nogroup_border_active");
static auto* const NOGROUPINACTIVECOL = (CGradientValueData*)g_pConfigManager->getConfigValuePtr("general:col.nogroup_border")->data.get(); static auto* const PNOGROUPINACTIVECOL = (Hyprlang::CUSTOMTYPE* const*)g_pConfigManager->getConfigValuePtr("general:col.nogroup_border");
static auto* const GROUPACTIVECOL = (CGradientValueData*)g_pConfigManager->getConfigValuePtr("group:col.border_active")->data.get(); static auto* const PGROUPACTIVECOL = (Hyprlang::CUSTOMTYPE* const*)g_pConfigManager->getConfigValuePtr("group:col.border_active");
static auto* const GROUPINACTIVECOL = (CGradientValueData*)g_pConfigManager->getConfigValuePtr("group:col.border_inactive")->data.get(); static auto* const PGROUPINACTIVECOL = (Hyprlang::CUSTOMTYPE* const*)g_pConfigManager->getConfigValuePtr("group:col.border_inactive");
static auto* const GROUPACTIVELOCKEDCOL = (CGradientValueData*)g_pConfigManager->getConfigValuePtr("group:col.border_locked_active")->data.get(); static auto* const PGROUPACTIVELOCKEDCOL = (Hyprlang::CUSTOMTYPE* const*)g_pConfigManager->getConfigValuePtr("group:col.border_locked_active");
static auto* const GROUPINACTIVELOCKEDCOL = (CGradientValueData*)g_pConfigManager->getConfigValuePtr("group:col.border_locked_inactive")->data.get(); static auto* const PGROUPINACTIVELOCKEDCOL = (Hyprlang::CUSTOMTYPE* const*)g_pConfigManager->getConfigValuePtr("group:col.border_locked_inactive");
static auto* const PINACTIVEALPHA = &g_pConfigManager->getConfigValuePtr("decoration:inactive_opacity")->floatValue; static auto* const PINACTIVEALPHA = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:inactive_opacity");
static auto* const PACTIVEALPHA = &g_pConfigManager->getConfigValuePtr("decoration:active_opacity")->floatValue; static auto* const PACTIVEALPHA = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:active_opacity");
static auto* const PFULLSCREENALPHA = &g_pConfigManager->getConfigValuePtr("decoration:fullscreen_opacity")->floatValue; static auto* const PFULLSCREENALPHA = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:fullscreen_opacity");
static auto* const PSHADOWCOL = &g_pConfigManager->getConfigValuePtr("decoration:col.shadow")->intValue; static auto* const PSHADOWCOL = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:col.shadow");
static auto* const PSHADOWCOLINACTIVE = &g_pConfigManager->getConfigValuePtr("decoration:col.shadow_inactive")->intValue; static auto* const PSHADOWCOLINACTIVE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:col.shadow_inactive");
static auto* const PDIMSTRENGTH = &g_pConfigManager->getConfigValuePtr("decoration:dim_strength")->floatValue; static auto* const PDIMSTRENGTH = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:dim_strength");
static auto* const PDIMENABLED = &g_pConfigManager->getConfigValuePtr("decoration:dim_inactive")->intValue; static auto* const PDIMENABLED = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:dim_inactive");
auto* const ACTIVECOL = (CGradientValueData*)(*PACTIVECOL)->getData();
auto* const INACTIVECOL = (CGradientValueData*)(*PINACTIVECOL)->getData();
auto* const NOGROUPACTIVECOL = (CGradientValueData*)(*PNOGROUPACTIVECOL)->getData();
auto* const NOGROUPINACTIVECOL = (CGradientValueData*)(*PNOGROUPINACTIVECOL)->getData();
auto* const GROUPACTIVECOL = (CGradientValueData*)(*PGROUPACTIVECOL)->getData();
auto* const GROUPINACTIVECOL = (CGradientValueData*)(*PGROUPINACTIVECOL)->getData();
auto* const GROUPACTIVELOCKEDCOL = (CGradientValueData*)(*PGROUPACTIVELOCKEDCOL)->getData();
auto* const GROUPINACTIVELOCKEDCOL = (CGradientValueData*)(*PGROUPINACTIVELOCKEDCOL)->getData();
auto setBorderColor = [&](CGradientValueData grad) -> void { auto setBorderColor = [&](CGradientValueData grad) -> void {
if (grad == pWindow->m_cRealBorderColor) if (grad == pWindow->m_cRealBorderColor)
@ -1915,31 +1924,31 @@ void CCompositor::updateWindowAnimatedDecorationValues(CWindow* pWindow) {
// opacity // opacity
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID); const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
if (pWindow->m_bIsFullscreen && PWORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL) { if (pWindow->m_bIsFullscreen && PWORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL) {
pWindow->m_fActiveInactiveAlpha = *PFULLSCREENALPHA; pWindow->m_fActiveInactiveAlpha = **PFULLSCREENALPHA;
} else { } else {
if (pWindow == m_pLastWindow) if (pWindow == m_pLastWindow)
pWindow->m_fActiveInactiveAlpha = pWindow->m_sSpecialRenderData.alphaOverride.toUnderlying() ? pWindow->m_sSpecialRenderData.alpha.toUnderlying() : pWindow->m_fActiveInactiveAlpha = pWindow->m_sSpecialRenderData.alphaOverride.toUnderlying() ? pWindow->m_sSpecialRenderData.alpha.toUnderlying() :
pWindow->m_sSpecialRenderData.alpha.toUnderlying() * *PACTIVEALPHA; pWindow->m_sSpecialRenderData.alpha.toUnderlying() * **PACTIVEALPHA;
else else
pWindow->m_fActiveInactiveAlpha = pWindow->m_sSpecialRenderData.alphaInactive.toUnderlying() != -1 ? pWindow->m_fActiveInactiveAlpha = pWindow->m_sSpecialRenderData.alphaInactive.toUnderlying() != -1 ?
(pWindow->m_sSpecialRenderData.alphaInactiveOverride.toUnderlying() ? pWindow->m_sSpecialRenderData.alphaInactive.toUnderlying() : (pWindow->m_sSpecialRenderData.alphaInactiveOverride.toUnderlying() ? pWindow->m_sSpecialRenderData.alphaInactive.toUnderlying() :
pWindow->m_sSpecialRenderData.alphaInactive.toUnderlying() * *PINACTIVEALPHA) : pWindow->m_sSpecialRenderData.alphaInactive.toUnderlying() * **PINACTIVEALPHA) :
*PINACTIVEALPHA; **PINACTIVEALPHA;
} }
// dim // dim
if (pWindow == m_pLastWindow || pWindow->m_sAdditionalConfigData.forceNoDim || !*PDIMENABLED) { if (pWindow == m_pLastWindow || pWindow->m_sAdditionalConfigData.forceNoDim || !**PDIMENABLED) {
pWindow->m_fDimPercent = 0; pWindow->m_fDimPercent = 0;
} else { } else {
pWindow->m_fDimPercent = *PDIMSTRENGTH; pWindow->m_fDimPercent = **PDIMSTRENGTH;
} }
// shadow // shadow
if (pWindow->m_iX11Type != 2 && !pWindow->m_bX11DoesntWantBorders) { if (pWindow->m_iX11Type != 2 && !pWindow->m_bX11DoesntWantBorders) {
if (pWindow == m_pLastWindow) { if (pWindow == m_pLastWindow) {
pWindow->m_cRealShadowColor = CColor(*PSHADOWCOL); pWindow->m_cRealShadowColor = CColor(**PSHADOWCOL);
} else { } else {
pWindow->m_cRealShadowColor = CColor(*PSHADOWCOLINACTIVE != INT_MAX ? *PSHADOWCOLINACTIVE : *PSHADOWCOL); pWindow->m_cRealShadowColor = CColor(**PSHADOWCOLINACTIVE != INT_MAX ? **PSHADOWCOLINACTIVE : **PSHADOWCOL);
} }
} else { } else {
pWindow->m_cRealShadowColor.setValueAndWarp(CColor(0, 0, 0, 0)); // no shadow pWindow->m_cRealShadowColor.setValueAndWarp(CColor(0, 0, 0, 0)); // no shadow
@ -2439,9 +2448,9 @@ void CCompositor::warpCursorTo(const Vector2D& pos, bool force) {
// warpCursorTo should only be used for warps that // warpCursorTo should only be used for warps that
// should be disabled with no_cursor_warps // should be disabled with no_cursor_warps
static auto* const PNOWARPS = &g_pConfigManager->getConfigValuePtr("general:no_cursor_warps")->intValue; static auto* const PNOWARPS = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:no_cursor_warps");
if (*PNOWARPS && !force) if (**PNOWARPS && !force)
return; return;
if (!m_sSeat.mouse) if (!m_sSeat.mouse)
@ -2704,7 +2713,7 @@ void CCompositor::setIdleActivityInhibit(bool enabled) {
wlr_idle_notifier_v1_set_inhibited(g_pCompositor->m_sWLRIdleNotifier, !enabled); wlr_idle_notifier_v1_set_inhibited(g_pCompositor->m_sWLRIdleNotifier, !enabled);
} }
void CCompositor::arrangeMonitors() { void CCompositor::arrangeMonitors() {
static auto* const PXWLFORCESCALEZERO = &g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling")->intValue; static auto* const PXWLFORCESCALEZERO = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling");
std::vector<CMonitor*> toArrange; std::vector<CMonitor*> toArrange;
std::vector<CMonitor*> arranged; std::vector<CMonitor*> arranged;
@ -2753,9 +2762,9 @@ void CCompositor::arrangeMonitors() {
for (auto& m : m_vMonitors) { for (auto& m : m_vMonitors) {
Debug::log(LOG, "arrangeMonitors: {} xwayland [{}, {:.2f}]", m->szName, maxOffset, 0.f); Debug::log(LOG, "arrangeMonitors: {} xwayland [{}, {:.2f}]", m->szName, maxOffset, 0.f);
m->vecXWaylandPosition = {maxOffset, 0}; m->vecXWaylandPosition = {maxOffset, 0};
maxOffset += (*PXWLFORCESCALEZERO ? m->vecTransformedSize.x : m->vecSize.x); maxOffset += (**PXWLFORCESCALEZERO ? m->vecTransformedSize.x : m->vecSize.x);
if (*PXWLFORCESCALEZERO) if (**PXWLFORCESCALEZERO)
m->xwaylandScale = m->scale; m->xwaylandScale = m->scale;
else else
m->xwaylandScale = 1.f; m->xwaylandScale = 1.f;

View File

@ -371,7 +371,7 @@ void CWindow::moveToWorkspace(int workspaceID) {
if (m_iWorkspaceID == workspaceID) if (m_iWorkspaceID == workspaceID)
return; return;
static auto* const PCLOSEONLASTSPECIAL = &g_pConfigManager->getConfigValuePtr("misc:close_special_on_empty")->intValue; static auto* const PCLOSEONLASTSPECIAL = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:close_special_on_empty");
const int OLDWORKSPACE = m_iWorkspaceID; const int OLDWORKSPACE = m_iWorkspaceID;
@ -394,7 +394,7 @@ void CWindow::moveToWorkspace(int workspaceID) {
// update xwayland coords // update xwayland coords
g_pXWaylandManager->setWindowSize(this, m_vRealSize.vec()); g_pXWaylandManager->setWindowSize(this, m_vRealSize.vec());
if (g_pCompositor->isWorkspaceSpecial(OLDWORKSPACE) && g_pCompositor->getWindowsOnWorkspace(OLDWORKSPACE) == 0 && *PCLOSEONLASTSPECIAL) { if (g_pCompositor->isWorkspaceSpecial(OLDWORKSPACE) && g_pCompositor->getWindowsOnWorkspace(OLDWORKSPACE) == 0 && **PCLOSEONLASTSPECIAL) {
const auto PWS = g_pCompositor->getWorkspaceByID(OLDWORKSPACE); const auto PWS = g_pCompositor->getWorkspaceByID(OLDWORKSPACE);
if (PWS) { if (PWS) {
@ -437,7 +437,7 @@ void unregisterVar(void* ptr) {
} }
void CWindow::onUnmap() { void CWindow::onUnmap() {
static auto* const PCLOSEONLASTSPECIAL = &g_pConfigManager->getConfigValuePtr("misc:close_special_on_empty")->intValue; static auto* const PCLOSEONLASTSPECIAL = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:close_special_on_empty");
if (g_pCompositor->m_pLastWindow == this) if (g_pCompositor->m_pLastWindow == this)
g_pCompositor->m_pLastWindow = nullptr; g_pCompositor->m_pLastWindow = nullptr;
@ -459,7 +459,7 @@ void CWindow::onUnmap() {
hyprListener_unmapWindow.removeCallback(); hyprListener_unmapWindow.removeCallback();
if (*PCLOSEONLASTSPECIAL && g_pCompositor->getWindowsOnWorkspace(m_iWorkspaceID) == 0 && g_pCompositor->isWorkspaceSpecial(m_iWorkspaceID)) { if (**PCLOSEONLASTSPECIAL && g_pCompositor->getWindowsOnWorkspace(m_iWorkspaceID) == 0 && g_pCompositor->isWorkspaceSpecial(m_iWorkspaceID)) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
if (PMONITOR && PMONITOR->specialWorkspaceID == m_iWorkspaceID) if (PMONITOR && PMONITOR->specialWorkspaceID == m_iWorkspaceID)
PMONITOR->setSpecialWorkspace(nullptr); PMONITOR->setSpecialWorkspace(nullptr);
@ -1023,19 +1023,21 @@ bool CWindow::opaque() {
} }
float CWindow::rounding() { float CWindow::rounding() {
static auto* const PROUNDING = &g_pConfigManager->getConfigValuePtr("decoration:rounding")->intValue; static auto* const PROUNDING = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:rounding");
float rounding = m_sAdditionalConfigData.rounding.toUnderlying() == -1 ? *PROUNDING : m_sAdditionalConfigData.rounding.toUnderlying(); float rounding = m_sAdditionalConfigData.rounding.toUnderlying() == -1 ? **PROUNDING : m_sAdditionalConfigData.rounding.toUnderlying();
return m_sSpecialRenderData.rounding ? rounding : 0; return m_sSpecialRenderData.rounding ? rounding : 0;
} }
void CWindow::updateSpecialRenderData() { void CWindow::updateSpecialRenderData() {
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID); const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID);
const auto WORKSPACERULE = PWORKSPACE ? g_pConfigManager->getWorkspaceRuleFor(PWORKSPACE) : SWorkspaceRule{}; const auto WORKSPACERULE = PWORKSPACE ? g_pConfigManager->getWorkspaceRuleFor(PWORKSPACE) : SWorkspaceRule{};
bool border = true; bool border = true;
if (m_bIsFloating && g_pConfigManager->getConfigValuePtr("general:no_border_on_floating")->intValue == 1) static auto* const* PNOBORDERONFLOATING = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:no_border_on_floating");
if (m_bIsFloating && **PNOBORDERONFLOATING == 1)
border = false; border = false;
m_sSpecialRenderData.border = WORKSPACERULE.border.value_or(border); m_sSpecialRenderData.border = WORKSPACERULE.border.value_or(border);
@ -1055,7 +1057,9 @@ int CWindow::getRealBorderSize() {
if (m_sSpecialRenderData.borderSize.toUnderlying() != -1) if (m_sSpecialRenderData.borderSize.toUnderlying() != -1)
return m_sSpecialRenderData.borderSize.toUnderlying(); return m_sSpecialRenderData.borderSize.toUnderlying();
return g_pConfigManager->getConfigValuePtr("general:border_size")->intValue; static auto* const* PBORDERSIZE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:border_size");
return **PBORDERSIZE;
} }
bool CWindow::canBeTorn() { bool CWindow::canBeTorn() {

File diff suppressed because it is too large Load Diff

View File

@ -21,21 +21,13 @@
#include "defaultConfig.hpp" #include "defaultConfig.hpp"
#include "ConfigDataValues.hpp" #include "ConfigDataValues.hpp"
#include <hyprlang.hpp>
#define INITANIMCFG(name) animationConfig[name] = {} #define INITANIMCFG(name) animationConfig[name] = {}
#define CREATEANIMCFG(name, parent) animationConfig[name] = {false, "", "", 0.f, -1, &animationConfig["global"], &animationConfig[parent]} #define CREATEANIMCFG(name, parent) animationConfig[name] = {false, "", "", 0.f, -1, &animationConfig["global"], &animationConfig[parent]}
#define HANDLE void* #define HANDLE void*
struct SConfigValue {
int64_t intValue = -INT64_MAX;
float floatValue = -__FLT_MAX__;
std::string strValue = "";
Vector2D vecValue = Vector2D(-__FLT_MAX__, -__FLT_MAX__);
std::shared_ptr<ICustomConfigValueData> data;
bool set = false; // used for device configs
};
struct SWorkspaceRule { struct SWorkspaceRule {
std::string monitor = ""; std::string monitor = "";
std::string workspaceString = ""; std::string workspaceString = "";
@ -74,9 +66,14 @@ struct SAnimationPropertyConfig {
}; };
struct SPluginKeyword { struct SPluginKeyword {
HANDLE handle = 0; HANDLE handle = 0;
std::string name = ""; std::string name = "";
std::function<void(const std::string&, const std::string&)> fn; Hyprlang::PCONFIGHANDLERFUNC fn = nullptr;
};
struct SPluginVariable {
HANDLE handle = 0;
std::string name = "";
}; };
struct SExecRequestedRule { struct SExecRequestedRule {
@ -91,24 +88,17 @@ class CConfigManager {
void tick(); void tick();
void init(); void init();
int getInt(const std::string&);
float getFloat(const std::string&);
Vector2D getVec(const std::string&);
std::string getString(const std::string&);
void setFloat(const std::string&, float);
void setInt(const std::string&, int);
void setVec(const std::string&, Vector2D);
void setString(const std::string&, const std::string&);
int getDeviceInt(const std::string&, const std::string&, const std::string& fallback = ""); int getDeviceInt(const std::string&, const std::string&, const std::string& fallback = "");
float getDeviceFloat(const std::string&, const std::string&, const std::string& fallback = ""); float getDeviceFloat(const std::string&, const std::string&, const std::string& fallback = "");
Vector2D getDeviceVec(const std::string&, const std::string&, const std::string& fallback = ""); Vector2D getDeviceVec(const std::string&, const std::string&, const std::string& fallback = "");
std::string getDeviceString(const std::string&, const std::string&, const std::string& fallback = ""); std::string getDeviceString(const std::string&, const std::string&, const std::string& fallback = "");
bool deviceConfigExists(const std::string&); bool deviceConfigExists(const std::string&);
Hyprlang::CConfigValue* getConfigValueSafeDevice(const std::string& dev, const std::string& val, const std::string& fallback);
bool shouldBlurLS(const std::string&); bool shouldBlurLS(const std::string&);
SConfigValue* getConfigValuePtr(const std::string&); void* const* getConfigValuePtr(const std::string&);
SConfigValue* getConfigValuePtrSafe(const std::string&); Hyprlang::CConfigValue* getHyprlangConfigValuePtr(const std::string& name, const std::string& specialCat = "");
void onPluginLoadUnload(const std::string& name, bool load);
static std::string getConfigDir(); static std::string getConfigDir();
static std::string getMainConfigPath(); static std::string getMainConfigPath();
@ -127,8 +117,8 @@ class CConfigManager {
std::unordered_map<std::string, SAnimationPropertyConfig> getAnimationConfig(); std::unordered_map<std::string, SAnimationPropertyConfig> getAnimationConfig();
void addPluginConfigVar(HANDLE handle, const std::string& name, const SConfigValue& value); void addPluginConfigVar(HANDLE handle, const std::string& name, const Hyprlang::CConfigValue& value);
void addPluginKeyword(HANDLE handle, const std::string& name, std::function<void(const std::string& cmd, const std::string& val)> fun); void addPluginKeyword(HANDLE handle, const std::string& name, Hyprlang::PCONFIGHANDLERFUNC fun, Hyprlang::SHandlerOptions opts = {});
void removePluginConfig(HANDLE handle); void removePluginConfig(HANDLE handle);
// no-op when done. // no-op when done.
@ -141,7 +131,7 @@ class CConfigManager {
void ensureMonitorStatus(); void ensureMonitorStatus();
void ensureVRR(CMonitor* pMonitor = nullptr); void ensureVRR(CMonitor* pMonitor = nullptr);
std::string parseKeyword(const std::string&, const std::string&, bool dynamic = false); std::string parseKeyword(const std::string&, const std::string&);
void addParseError(const std::string&); void addParseError(const std::string&);
@ -151,77 +141,65 @@ class CConfigManager {
void handlePluginLoads(); void handlePluginLoads();
std::string configCurrentPath; // keywords
std::optional<std::string> handleRawExec(const std::string&, const std::string&);
std::optional<std::string> handleExecOnce(const std::string&, const std::string&);
std::optional<std::string> handleMonitor(const std::string&, const std::string&);
std::optional<std::string> handleBind(const std::string&, const std::string&);
std::optional<std::string> handleUnbind(const std::string&, const std::string&);
std::optional<std::string> handleWindowRule(const std::string&, const std::string&);
std::optional<std::string> handleLayerRule(const std::string&, const std::string&);
std::optional<std::string> handleWindowRuleV2(const std::string&, const std::string&);
std::optional<std::string> handleWorkspaceRules(const std::string&, const std::string&);
std::optional<std::string> handleBezier(const std::string&, const std::string&);
std::optional<std::string> handleAnimation(const std::string&, const std::string&);
std::optional<std::string> handleSource(const std::string&, const std::string&);
std::optional<std::string> handleSubmap(const std::string&, const std::string&);
std::optional<std::string> handleBlurLS(const std::string&, const std::string&);
std::optional<std::string> handleBindWS(const std::string&, const std::string&);
std::optional<std::string> handleEnv(const std::string&, const std::string&);
std::optional<std::string> handlePlugin(const std::string&, const std::string&);
std::string configCurrentPath;
private: private:
std::deque<std::string> configPaths; // stores all the config paths std::unique_ptr<Hyprlang::CConfig> m_pConfig;
std::unordered_map<std::string, time_t> configModifyTimes; // stores modify times
std::vector<std::pair<std::string, std::string>> configDynamicVars; // stores dynamic vars declared by the user
std::unordered_map<std::string, SConfigValue> configValues;
std::unordered_map<std::string, std::unordered_map<std::string, SConfigValue>> deviceConfigs; // stores device configs
std::unordered_map<std::string, SAnimationPropertyConfig> animationConfig; // stores all the animations with their set values std::deque<std::string> configPaths; // stores all the config paths
std::unordered_map<std::string, time_t> configModifyTimes; // stores modify times
std::string currentCategory = ""; // For storing the category of the current item std::unordered_map<std::string, SAnimationPropertyConfig> animationConfig; // stores all the animations with their set values
std::string parseError = ""; // For storing a parse error to display later std::string m_szCurrentSubmap = ""; // For storing the current keybind submap
std::string m_szCurrentSubmap = ""; // For storing the current keybind submap std::vector<SExecRequestedRule> execRequestedRules; // rules requested with exec, e.g. [workspace 2] kitty
std::vector<SExecRequestedRule> execRequestedRules; // rules requested with exec, e.g. [workspace 2] kitty std::vector<std::string> m_vDeclaredPlugins;
std::vector<SPluginKeyword> pluginKeywords;
std::vector<SPluginVariable> pluginVariables;
std::vector<std::string> m_vDeclaredPlugins; bool isFirstLaunch = true; // For exec-once
std::unordered_map<HANDLE, std::unique_ptr<std::unordered_map<std::string, SConfigValue>>> pluginConfigs; // stores plugin configs
std::vector<SPluginKeyword> pluginKeywords;
bool isFirstLaunch = true; // For exec-once std::deque<SMonitorRule> m_dMonitorRules;
std::deque<SWorkspaceRule> m_dWorkspaceRules;
std::deque<SWindowRule> m_dWindowRules;
std::deque<SLayerRule> m_dLayerRules;
std::deque<std::string> m_dBlurLSNamespaces;
std::deque<SMonitorRule> m_dMonitorRules; bool firstExecDispatched = false;
std::deque<SWorkspaceRule> m_dWorkspaceRules; bool m_bManualCrashInitiated = false;
std::deque<SWindowRule> m_dWindowRules; std::deque<std::string> firstExecRequests;
std::deque<SLayerRule> m_dLayerRules;
std::deque<std::string> m_dBlurLSNamespaces;
bool firstExecDispatched = false; std::vector<std::pair<std::string, std::string>> m_vFailedPluginConfigValues; // for plugin values of unloaded plugins
bool m_bManualCrashInitiated = false;
std::deque<std::string> firstExecRequests;
std::vector<std::pair<std::string, std::string>> environmentVariables;
std::vector<std::pair<std::string, std::string>> m_vFailedPluginConfigValues; // for plugin values of unloaded plugins
// internal methods // internal methods
void setDefaultVars(); void setAnimForChildren(SAnimationPropertyConfig* const);
void setDefaultAnimationVars(); void updateBlurredLS(const std::string&, const bool);
void setDeviceDefaultVars(const std::string&); void setDefaultAnimationVars();
void populateEnvironment(); std::optional<std::string> resetHLConfig();
std::optional<std::string> verifyConfigExists();
void setAnimForChildren(SAnimationPropertyConfig* const); void postConfigReload(const Hyprlang::CParseResult& result);
void updateBlurredLS(const std::string&, const bool); void reload();
void applyUserDefinedVars(std::string&, const size_t);
void loadConfigLoadVars();
SConfigValue getConfigValueSafe(const std::string&);
SConfigValue getConfigValueSafeDevice(const std::string&, const std::string&, const std::string& fallback = "");
void parseLine(std::string&);
void configSetValueSafe(const std::string&, const std::string&);
void handleDeviceConfig(const std::string&, const std::string&);
void handleRawExec(const std::string&, const std::string&);
void handleMonitor(const std::string&, const std::string&);
void handleBind(const std::string&, const std::string&);
void handleUnbind(const std::string&, const std::string&);
void handleWindowRule(const std::string&, const std::string&);
void handleLayerRule(const std::string&, const std::string&);
void handleWindowRuleV2(const std::string&, const std::string&);
void handleWorkspaceRules(const std::string&, const std::string&);
void handleBezier(const std::string&, const std::string&);
void handleAnimation(const std::string&, const std::string&);
void handleSource(const std::string&, const std::string&);
void handleSubmap(const std::string&, const std::string&);
void handleBlurLS(const std::string&, const std::string&);
void handleBindWS(const std::string&, const std::string&);
void handleEnv(const std::string&, const std::string&);
void handlePlugin(const std::string&, const std::string&);
}; };
inline std::unique_ptr<CConfigManager> g_pConfigManager; inline std::unique_ptr<CConfigManager> g_pConfigManager;

View File

@ -4,9 +4,9 @@
inline const std::string AUTOCONFIG = R"#( inline const std::string AUTOCONFIG = R"#(
######################################################################################## ########################################################################################
AUTOGENERATED HYPR CONFIG. # AUTOGENERATED HYPR CONFIG.
PLEASE USE THE CONFIG PROVIDED IN THE GIT REPO /examples/hypr.conf AND EDIT IT, # PLEASE USE THE CONFIG PROVIDED IN THE GIT REPO /examples/hypr.conf AND EDIT IT,
OR EDIT THIS ONE ACCORDING TO THE WIKI INSTRUCTIONS. # OR EDIT THIS ONE ACCORDING TO THE WIKI INSTRUCTIONS.
######################################################################################## ########################################################################################
# #

View File

@ -14,6 +14,7 @@
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <typeindex>
static void trimTrailingComma(std::string& str) { static void trimTrailingComma(std::string& str) {
if (!str.empty() && str.back() == ',') if (!str.empty() && str.back() == ',')
@ -856,7 +857,7 @@ std::string dispatchKeyword(eHyprCtlOutputFormat format, std::string in) {
const auto VALUE = in.substr(in.find_first_of(' ') + 1); const auto VALUE = in.substr(in.find_first_of(' ') + 1);
std::string retval = g_pConfigManager->parseKeyword(COMMAND, VALUE, true); std::string retval = g_pConfigManager->parseKeyword(COMMAND, VALUE);
if (COMMAND == "monitor") if (COMMAND == "monitor")
g_pConfigManager->m_bWantsMonitorReload = true; // for monitor keywords g_pConfigManager->m_bWantsMonitorReload = true; // for monitor keywords
@ -868,8 +869,10 @@ std::string dispatchKeyword(eHyprCtlOutputFormat format, std::string in) {
g_pInputManager->setTabletConfigs(); // update tablets g_pInputManager->setTabletConfigs(); // update tablets
} }
static auto* const PLAYOUT = (Hyprlang::STRING const*)g_pConfigManager->getConfigValuePtr("general:layout");
if (COMMAND.contains("general:layout")) if (COMMAND.contains("general:layout"))
g_pLayoutManager->switchToLayout(g_pConfigManager->getString("general:layout")); // update layout g_pLayoutManager->switchToLayout(*PLAYOUT); // update layout
if (COMMAND.contains("decoration:screen_shader")) if (COMMAND.contains("decoration:screen_shader"))
g_pHyprOpenGL->m_bReloadScreenShader = true; g_pHyprOpenGL->m_bReloadScreenShader = true;
@ -1193,28 +1196,40 @@ std::string dispatchGetOption(eHyprCtlOutputFormat format, std::string request)
nextItem(); nextItem();
nextItem(); nextItem();
const auto PCFGOPT = g_pConfigManager->getConfigValuePtrSafe(curitem); const auto VAR = g_pConfigManager->getHyprlangConfigValuePtr(curitem);
if (!PCFGOPT) if (!VAR)
return "no such option"; return "no such option";
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) const auto VAL = VAR->getValue();
return std::format("option {}\n\tint: {}\n\tfloat: {:.5f}\n\tstr: \"{}\"\n\tdata: {:x}\n\tset: {}", curitem, PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue, const auto TYPE = std::type_index(VAL.type());
(uintptr_t)PCFGOPT->data.get(), PCFGOPT->set);
else { if (format == FORMAT_NORMAL) {
return std::format( if (TYPE == typeid(Hyprlang::INT))
R"#( return std::format("int: {}\nset: {}", std::any_cast<Hyprlang::INT>(VAL), VAR->m_bSetByUser);
{{ else if (TYPE == typeid(Hyprlang::FLOAT))
"option": "{}", return std::format("float: {:2f}\nset: {}", std::any_cast<Hyprlang::FLOAT>(VAL), VAR->m_bSetByUser);
"int": {}, else if (TYPE == typeid(Hyprlang::VEC2))
"float": {:.5f}, return std::format("vec2: [{}, {}]\nset: {}", std::any_cast<Hyprlang::VEC2>(VAL).x, std::any_cast<Hyprlang::VEC2>(VAL).y, VAR->m_bSetByUser);
"str": "{}", else if (TYPE == typeid(Hyprlang::STRING))
"data": "0x{:x}", return std::format("str: {}\nset: {}", std::any_cast<Hyprlang::STRING>(VAL), VAR->m_bSetByUser);
"set": {} else if (TYPE == typeid(Hyprlang::CUSTOMTYPE*))
}} return std::format("custom type at: {:x}\nset: {}", (uintptr_t)std::any_cast<Hyprlang::CUSTOMTYPE*>(VAL), VAR->m_bSetByUser);
)#", } else {
curitem, PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue, (uintptr_t)PCFGOPT->data.get(), PCFGOPT->set); if (TYPE == typeid(Hyprlang::INT))
return std::format("{{\"option\": \"{}\", \"int\": {}, \"set\": {} }}", curitem, std::any_cast<Hyprlang::INT>(VAL), VAR->m_bSetByUser);
else if (TYPE == typeid(Hyprlang::FLOAT))
return std::format("{{\"option\": \"{}\", \"float\": {:2f}, \"set\": {} }}", curitem, std::any_cast<Hyprlang::FLOAT>(VAL), VAR->m_bSetByUser);
else if (TYPE == typeid(Hyprlang::VEC2))
return std::format("{{\"option\": \"{}\", \"vec2\": [{},{}], \"set\": {} }}", curitem, std::any_cast<Hyprlang::VEC2>(VAL).x, std::any_cast<Hyprlang::VEC2>(VAL).y,
VAR->m_bSetByUser);
else if (TYPE == typeid(Hyprlang::STRING))
return std::format("{{\"option\": \"{}\", \"str\": \"{}\", \"set\": {} }}", curitem, escapeJSONStrings(std::any_cast<Hyprlang::STRING>(VAL)), VAR->m_bSetByUser);
else if (TYPE == typeid(Hyprlang::CUSTOMTYPE*))
return std::format("{{\"option\": \"{}\", \"custom\": \"{:x}\", \"set\": {} }}", curitem, (uintptr_t)std::any_cast<Hyprlang::CUSTOMTYPE*>(VAL), VAR->m_bSetByUser);
} }
return "invalid type (internal error)";
} }
std::string decorationRequest(eHyprCtlOutputFormat format, std::string request) { std::string decorationRequest(eHyprCtlOutputFormat format, std::string request) {

View File

@ -22,7 +22,7 @@ void Debug::wlrLog(wlr_log_importance level, const char* fmt, va_list args) {
rollingLog += output + "\n"; rollingLog += output + "\n";
if (!disableLogs || !*disableLogs) { if (!disableLogs || !**disableLogs) {
std::ofstream ofs; std::ofstream ofs;
ofs.open(logFile, std::ios::out | std::ios::app); ofs.open(logFile, std::ios::out | std::ios::app);
ofs << "[wlr] " << output << "\n"; ofs << "[wlr] " << output << "\n";

View File

@ -21,16 +21,16 @@ enum LogLevel {
}; };
namespace Debug { namespace Debug {
inline std::string logFile; inline std::string logFile;
inline int64_t* disableLogs = nullptr; inline int64_t* const* disableLogs = nullptr;
inline int64_t* disableTime = nullptr; inline int64_t* const* disableTime = nullptr;
inline bool disableStdout = false; inline bool disableStdout = false;
inline bool trace = false; inline bool trace = false;
inline bool shuttingDown = false; inline bool shuttingDown = false;
inline std::string rollingLog = ""; // rolling log contains the ROLLING_LOG_SIZE tail of the log inline std::string rollingLog = ""; // rolling log contains the ROLLING_LOG_SIZE tail of the log
void init(const std::string& IS); void init(const std::string& IS);
template <typename... Args> template <typename... Args>
void log(LogLevel level, std::format_string<Args...> fmt, Args&&... args) { void log(LogLevel level, std::format_string<Args...> fmt, Args&&... args) {
if (level == TRACE && !trace) if (level == TRACE && !trace)
@ -52,7 +52,7 @@ namespace Debug {
} }
// print date and time to the ofs // print date and time to the ofs
if (disableTime && !*disableTime) { if (disableTime && !**disableTime) {
#ifndef _LIBCPP_VERSION #ifndef _LIBCPP_VERSION
logMsg += std::format("[{:%T}] ", std::chrono::hh_mm_ss{std::chrono::system_clock::now() - std::chrono::floor<std::chrono::days>(std::chrono::system_clock::now())}); logMsg += std::format("[{:%T}] ", std::chrono::hh_mm_ss{std::chrono::system_clock::now() - std::chrono::floor<std::chrono::days>(std::chrono::system_clock::now())});
#else #else
@ -73,7 +73,7 @@ namespace Debug {
if (rollingLog.size() > ROLLING_LOG_SIZE) if (rollingLog.size() > ROLLING_LOG_SIZE)
rollingLog = rollingLog.substr(rollingLog.size() - ROLLING_LOG_SIZE); rollingLog = rollingLog.substr(rollingLog.size() - ROLLING_LOG_SIZE);
if (!disableLogs || !*disableLogs) { if (!disableLogs || !**disableLogs) {
// log to a file // log to a file
std::ofstream ofs; std::ofstream ofs;
ofs.open(logFile, std::ios::out | std::ios::app); ofs.open(logFile, std::ios::out | std::ios::app);

View File

@ -147,12 +147,12 @@ void Events::listener_monitorFrame(void* owner, void* data) {
PMONITOR->tearingState.frameScheduledWhileBusy = false; PMONITOR->tearingState.frameScheduledWhileBusy = false;
} }
static auto* const PENABLERAT = &g_pConfigManager->getConfigValuePtr("misc:render_ahead_of_time")->intValue; static auto* const PENABLERAT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:render_ahead_of_time");
static auto* const PRATSAFE = &g_pConfigManager->getConfigValuePtr("misc:render_ahead_safezone")->intValue; static auto* const PRATSAFE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:render_ahead_safezone");
PMONITOR->lastPresentationTimer.reset(); PMONITOR->lastPresentationTimer.reset();
if (*PENABLERAT && !PMONITOR->tearingState.nextRenderTorn) { if (**PENABLERAT && !PMONITOR->tearingState.nextRenderTorn) {
if (!PMONITOR->RATScheduled) { if (!PMONITOR->RATScheduled) {
// render // render
g_pHyprRenderer->renderMonitor(PMONITOR); g_pHyprRenderer->renderMonitor(PMONITOR);
@ -162,14 +162,14 @@ void Events::listener_monitorFrame(void* owner, void* data) {
const auto& [avg, max, min] = g_pHyprRenderer->getRenderTimes(PMONITOR); const auto& [avg, max, min] = g_pHyprRenderer->getRenderTimes(PMONITOR);
if (max + *PRATSAFE > 1000.0 / PMONITOR->refreshRate) if (max + **PRATSAFE > 1000.0 / PMONITOR->refreshRate)
return; return;
const auto MSLEFT = 1000.0 / PMONITOR->refreshRate - PMONITOR->lastPresentationTimer.getMillis(); const auto MSLEFT = 1000.0 / PMONITOR->refreshRate - PMONITOR->lastPresentationTimer.getMillis();
PMONITOR->RATScheduled = true; PMONITOR->RATScheduled = true;
const auto ESTRENDERTIME = std::ceil(avg + *PRATSAFE); const auto ESTRENDERTIME = std::ceil(avg + **PRATSAFE);
const auto TIMETOSLEEP = std::floor(MSLEFT - ESTRENDERTIME); const auto TIMETOSLEEP = std::floor(MSLEFT - ESTRENDERTIME);
if (MSLEFT < 1 || MSLEFT < ESTRENDERTIME || TIMETOSLEEP < 1) if (MSLEFT < 1 || MSLEFT < ESTRENDERTIME || TIMETOSLEEP < 1)

View File

@ -40,13 +40,13 @@ void setAnimToMove(void* data) {
void Events::listener_mapWindow(void* owner, void* data) { void Events::listener_mapWindow(void* owner, void* data) {
CWindow* PWINDOW = (CWindow*)owner; CWindow* PWINDOW = (CWindow*)owner;
static auto* const PINACTIVEALPHA = &g_pConfigManager->getConfigValuePtr("decoration:inactive_opacity")->floatValue; static auto* const PINACTIVEALPHA = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:inactive_opacity");
static auto* const PACTIVEALPHA = &g_pConfigManager->getConfigValuePtr("decoration:active_opacity")->floatValue; static auto* const PACTIVEALPHA = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:active_opacity");
static auto* const PDIMSTRENGTH = &g_pConfigManager->getConfigValuePtr("decoration:dim_strength")->floatValue; static auto* const PDIMSTRENGTH = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:dim_strength");
static auto* const PSWALLOW = &g_pConfigManager->getConfigValuePtr("misc:enable_swallow")->intValue; static auto* const PSWALLOW = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:enable_swallow");
static auto* const PSWALLOWREGEX = &g_pConfigManager->getConfigValuePtr("misc:swallow_regex")->strValue; static auto* const PSWALLOWREGEX = (Hyprlang::STRING const*)g_pConfigManager->getConfigValuePtr("misc:swallow_regex");
static auto* const PSWALLOWEXREGEX = &g_pConfigManager->getConfigValuePtr("misc:swallow_exception_regex")->strValue; static auto* const PSWALLOWEXREGEX = (Hyprlang::STRING const*)g_pConfigManager->getConfigValuePtr("misc:swallow_exception_regex");
static auto* const PNEWTAKESOVERFS = &g_pConfigManager->getConfigValuePtr("misc:new_window_takes_over_fullscreen")->intValue; static auto* const PNEWTAKESOVERFS = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:new_window_takes_over_fullscreen");
auto PMONITOR = g_pCompositor->m_pLastMonitor; auto PMONITOR = g_pCompositor->m_pLastMonitor;
const auto PWORKSPACE = const auto PWORKSPACE =
@ -464,9 +464,9 @@ void Events::listener_mapWindow(void* owner, void* data) {
if (PLSFROMFOCUS && PLSFROMFOCUS->layerSurface->current.keyboard_interactive) if (PLSFROMFOCUS && PLSFROMFOCUS->layerSurface->current.keyboard_interactive)
PWINDOW->m_bNoInitialFocus = true; PWINDOW->m_bNoInitialFocus = true;
if (PWORKSPACE->m_bHasFullscreenWindow && !requestsFullscreen && !PWINDOW->m_bIsFloating) { if (PWORKSPACE->m_bHasFullscreenWindow && !requestsFullscreen && !PWINDOW->m_bIsFloating) {
if (*PNEWTAKESOVERFS == 0) if (**PNEWTAKESOVERFS == 0)
PWINDOW->m_bNoInitialFocus = true; PWINDOW->m_bNoInitialFocus = true;
else if (*PNEWTAKESOVERFS == 2) else if (**PNEWTAKESOVERFS == 2)
g_pCompositor->setWindowFullscreen(g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID), false, FULLSCREEN_INVALID); g_pCompositor->setWindowFullscreen(g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID), false, FULLSCREEN_INVALID);
else if (PWORKSPACE->m_efFullscreenMode == FULLSCREEN_MAXIMIZED) else if (PWORKSPACE->m_efFullscreenMode == FULLSCREEN_MAXIMIZED)
requestsMaximize = true; requestsMaximize = true;
@ -478,10 +478,10 @@ void Events::listener_mapWindow(void* owner, void* data) {
(PWINDOW->m_iX11Type != 2 || (PWINDOW->m_bIsX11 && wlr_xwayland_or_surface_wants_focus(PWINDOW->m_uSurface.xwayland))) && !workspaceSilent && (PWINDOW->m_iX11Type != 2 || (PWINDOW->m_bIsX11 && wlr_xwayland_or_surface_wants_focus(PWINDOW->m_uSurface.xwayland))) && !workspaceSilent &&
(!PFORCEFOCUS || PFORCEFOCUS == PWINDOW)) { (!PFORCEFOCUS || PFORCEFOCUS == PWINDOW)) {
g_pCompositor->focusWindow(PWINDOW); g_pCompositor->focusWindow(PWINDOW);
PWINDOW->m_fActiveInactiveAlpha.setValueAndWarp(*PACTIVEALPHA); PWINDOW->m_fActiveInactiveAlpha.setValueAndWarp(**PACTIVEALPHA);
PWINDOW->m_fDimPercent.setValueAndWarp(PWINDOW->m_sAdditionalConfigData.forceNoDim ? 0.f : *PDIMSTRENGTH); PWINDOW->m_fDimPercent.setValueAndWarp(PWINDOW->m_sAdditionalConfigData.forceNoDim ? 0.f : **PDIMSTRENGTH);
} else { } else {
PWINDOW->m_fActiveInactiveAlpha.setValueAndWarp(*PINACTIVEALPHA); PWINDOW->m_fActiveInactiveAlpha.setValueAndWarp(**PINACTIVEALPHA);
PWINDOW->m_fDimPercent.setValueAndWarp(0); PWINDOW->m_fDimPercent.setValueAndWarp(0);
} }
@ -550,7 +550,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
} }
// verify swallowing // verify swallowing
if (*PSWALLOW && *PSWALLOWREGEX != STRVAL_EMPTY) { if (**PSWALLOW && std::string{*PSWALLOWREGEX} != STRVAL_EMPTY) {
// don't swallow ourselves // don't swallow ourselves
std::regex rgx(*PSWALLOWREGEX); std::regex rgx(*PSWALLOWREGEX);
if (!std::regex_match(g_pXWaylandManager->getAppIDClass(PWINDOW), rgx)) { if (!std::regex_match(g_pXWaylandManager->getAppIDClass(PWINDOW), rgx)) {
@ -597,7 +597,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
if (finalFound) { if (finalFound) {
bool valid = std::regex_match(g_pXWaylandManager->getAppIDClass(finalFound), rgx); bool valid = std::regex_match(g_pXWaylandManager->getAppIDClass(finalFound), rgx);
if (*PSWALLOWEXREGEX != STRVAL_EMPTY) { if (std::string{*PSWALLOWEXREGEX} != STRVAL_EMPTY) {
std::regex exc(*PSWALLOWEXREGEX); std::regex exc(*PSWALLOWEXREGEX);
valid = valid && !std::regex_match(g_pXWaylandManager->getTitle(finalFound), exc); valid = valid && !std::regex_match(g_pXWaylandManager->getTitle(finalFound), exc);
@ -969,7 +969,7 @@ void Events::listener_fullscreenWindow(void* owner, void* data) {
void Events::listener_activateXDG(wl_listener* listener, void* data) { void Events::listener_activateXDG(wl_listener* listener, void* data) {
const auto E = (wlr_xdg_activation_v1_request_activate_event*)data; const auto E = (wlr_xdg_activation_v1_request_activate_event*)data;
static auto* const PFOCUSONACTIVATE = &g_pConfigManager->getConfigValuePtr("misc:focus_on_activate")->intValue; static auto* const PFOCUSONACTIVATE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:focus_on_activate");
Debug::log(LOG, "Activate request for surface at {:x}", (uintptr_t)E->surface); Debug::log(LOG, "Activate request for surface at {:x}", (uintptr_t)E->surface);
@ -986,7 +986,7 @@ void Events::listener_activateXDG(wl_listener* listener, void* data) {
PWINDOW->m_bIsUrgent = true; PWINDOW->m_bIsUrgent = true;
if (!*PFOCUSONACTIVATE || (PWINDOW->m_eSuppressedEvents & SUPPRESS_ACTIVATE_FOCUSONLY)) if (!**PFOCUSONACTIVATE || (PWINDOW->m_eSuppressedEvents & SUPPRESS_ACTIVATE_FOCUSONLY))
return; return;
if (PWINDOW->m_bIsFloating) if (PWINDOW->m_bIsFloating)
@ -999,7 +999,7 @@ void Events::listener_activateXDG(wl_listener* listener, void* data) {
void Events::listener_activateX11(void* owner, void* data) { void Events::listener_activateX11(void* owner, void* data) {
const auto PWINDOW = (CWindow*)owner; const auto PWINDOW = (CWindow*)owner;
static auto* const PFOCUSONACTIVATE = &g_pConfigManager->getConfigValuePtr("misc:focus_on_activate")->intValue; static auto* const PFOCUSONACTIVATE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:focus_on_activate");
Debug::log(LOG, "X11 Activate request for window {}", PWINDOW); Debug::log(LOG, "X11 Activate request for window {}", PWINDOW);
@ -1023,7 +1023,7 @@ void Events::listener_activateX11(void* owner, void* data) {
g_pEventManager->postEvent(SHyprIPCEvent{"urgent", std::format("{:x}", (uintptr_t)PWINDOW)}); g_pEventManager->postEvent(SHyprIPCEvent{"urgent", std::format("{:x}", (uintptr_t)PWINDOW)});
EMIT_HOOK_EVENT("urgent", PWINDOW); EMIT_HOOK_EVENT("urgent", PWINDOW);
if (!*PFOCUSONACTIVATE || (PWINDOW->m_eSuppressedEvents & SUPPRESS_ACTIVATE_FOCUSONLY)) if (!**PFOCUSONACTIVATE || (PWINDOW->m_eSuppressedEvents & SUPPRESS_ACTIVATE_FOCUSONLY))
return; return;
if (PWINDOW->m_bIsFloating) if (PWINDOW->m_bIsFloating)
@ -1064,8 +1064,8 @@ void Events::listener_configureX11(void* owner, void* data) {
PWINDOW->m_vRealPosition.setValueAndWarp(LOGICALPOS); PWINDOW->m_vRealPosition.setValueAndWarp(LOGICALPOS);
PWINDOW->m_vRealSize.setValueAndWarp(Vector2D(E->width, E->height)); PWINDOW->m_vRealSize.setValueAndWarp(Vector2D(E->width, E->height));
static auto* const PXWLFORCESCALEZERO = &g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling")->intValue; static auto* const PXWLFORCESCALEZERO = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling");
if (*PXWLFORCESCALEZERO) { if (**PXWLFORCESCALEZERO) {
if (const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID); PMONITOR) if (const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID); PMONITOR)
PWINDOW->m_vRealSize.setValueAndWarp(PWINDOW->m_vRealSize.goalv() / PMONITOR->scale); PWINDOW->m_vRealSize.setValueAndWarp(PWINDOW->m_vRealSize.goalv() / PMONITOR->scale);
} }
@ -1115,7 +1115,7 @@ void Events::listener_unmanagedSetGeometry(void* owner, void* data) {
return; return;
} }
static auto* const PXWLFORCESCALEZERO = &g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling")->intValue; static auto* const PXWLFORCESCALEZERO = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling");
const auto LOGICALPOS = g_pXWaylandManager->xwaylandToWaylandCoords({PWINDOW->m_uSurface.xwayland->x, PWINDOW->m_uSurface.xwayland->y}); const auto LOGICALPOS = g_pXWaylandManager->xwaylandToWaylandCoords({PWINDOW->m_uSurface.xwayland->x, PWINDOW->m_uSurface.xwayland->y});
@ -1130,7 +1130,7 @@ void Events::listener_unmanagedSetGeometry(void* owner, void* data) {
if (abs(std::floor(SIZ.x) - PWINDOW->m_uSurface.xwayland->width) > 2 || abs(std::floor(SIZ.y) - PWINDOW->m_uSurface.xwayland->height) > 2) if (abs(std::floor(SIZ.x) - PWINDOW->m_uSurface.xwayland->width) > 2 || abs(std::floor(SIZ.y) - PWINDOW->m_uSurface.xwayland->height) > 2)
PWINDOW->m_vRealSize.setValueAndWarp(Vector2D(PWINDOW->m_uSurface.xwayland->width, PWINDOW->m_uSurface.xwayland->height)); PWINDOW->m_vRealSize.setValueAndWarp(Vector2D(PWINDOW->m_uSurface.xwayland->width, PWINDOW->m_uSurface.xwayland->height));
if (*PXWLFORCESCALEZERO) { if (**PXWLFORCESCALEZERO) {
if (const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID); PMONITOR) { if (const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID); PMONITOR) {
const Vector2D DELTA = PWINDOW->m_vRealSize.goalv() - PWINDOW->m_vRealSize.goalv() / PMONITOR->scale; const Vector2D DELTA = PWINDOW->m_vRealSize.goalv() - PWINDOW->m_vRealSize.goalv() / PMONITOR->scale;
PWINDOW->m_vRealSize.setValueAndWarp(PWINDOW->m_vRealSize.goalv() / PMONITOR->scale); PWINDOW->m_vRealSize.setValueAndWarp(PWINDOW->m_vRealSize.goalv() / PMONITOR->scale);

View File

@ -316,8 +316,8 @@ void CMonitor::onDisconnect(bool destroy) {
} }
void CMonitor::addDamage(const pixman_region32_t* rg) { void CMonitor::addDamage(const pixman_region32_t* rg) {
static auto* const PZOOMFACTOR = &g_pConfigManager->getConfigValuePtr("misc:cursor_zoom_factor")->floatValue; static auto* const PZOOMFACTOR = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("misc:cursor_zoom_factor");
if (*PZOOMFACTOR != 1.f && g_pCompositor->getMonitorFromCursor() == this) { if (**PZOOMFACTOR != 1.f && g_pCompositor->getMonitorFromCursor() == this) {
wlr_damage_ring_add_whole(&damage); wlr_damage_ring_add_whole(&damage);
g_pCompositor->scheduleFrameForMonitor(this); g_pCompositor->scheduleFrameForMonitor(this);
} else if (wlr_damage_ring_add(&damage, rg)) } else if (wlr_damage_ring_add(&damage, rg))
@ -329,8 +329,8 @@ void CMonitor::addDamage(const CRegion* rg) {
} }
void CMonitor::addDamage(const CBox* box) { void CMonitor::addDamage(const CBox* box) {
static auto* const PZOOMFACTOR = &g_pConfigManager->getConfigValuePtr("misc:cursor_zoom_factor")->floatValue; static auto* const PZOOMFACTOR = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("misc:cursor_zoom_factor");
if (*PZOOMFACTOR != 1.f && g_pCompositor->getMonitorFromCursor() == this) { if (**PZOOMFACTOR != 1.f && g_pCompositor->getMonitorFromCursor() == this) {
wlr_damage_ring_add_whole(&damage); wlr_damage_ring_add_whole(&damage);
g_pCompositor->scheduleFrameForMonitor(this); g_pCompositor->scheduleFrameForMonitor(this);
} }
@ -541,11 +541,11 @@ void CMonitor::changeWorkspace(CWorkspace* const pWorkspace, bool internal, bool
} }
if (!noFocus && !g_pCompositor->m_pLastMonitor->specialWorkspaceID) { if (!noFocus && !g_pCompositor->m_pLastMonitor->specialWorkspaceID) {
static auto* const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue; static auto* const PFOLLOWMOUSE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("input:follow_mouse");
CWindow* pWindow = pWorkspace->getLastFocusedWindow(); CWindow* pWindow = pWorkspace->getLastFocusedWindow();
if (!pWindow) { if (!pWindow) {
if (*PFOLLOWMOUSE == 1) if (**PFOLLOWMOUSE == 1)
pWindow = g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING); pWindow = g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
if (!pWindow) if (!pWindow)

View File

@ -225,8 +225,8 @@ void Events::listener_commitSubsurface(void* owner, void* data) {
if (!g_pHyprRenderer->shouldRenderWindow(pNode->pWindowOwner)) { if (!g_pHyprRenderer->shouldRenderWindow(pNode->pWindowOwner)) {
pNode->lastSize = pNode->pSurface->exists() ? Vector2D{pNode->pSurface->wlr()->current.width, pNode->pSurface->wlr()->current.height} : Vector2D{}; pNode->lastSize = pNode->pSurface->exists() ? Vector2D{pNode->pSurface->wlr()->current.width, pNode->pSurface->wlr()->current.height} : Vector2D{};
static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue; static auto* const PLOGDAMAGE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:log_damage");
if (*PLOGDAMAGE) if (**PLOGDAMAGE)
Debug::log(LOG, "Refusing to commit damage from {} because it's invisible.", pNode->pWindowOwner); Debug::log(LOG, "Refusing to commit damage from {} because it's invisible.", pNode->pWindowOwner);
return; return;
} }

View File

@ -12,6 +12,11 @@ Vector2D::Vector2D() {
y = 0; y = 0;
} }
Vector2D::Vector2D(const Hyprlang::VEC2& ref) {
x = ref.x;
y = ref.y;
}
Vector2D::~Vector2D() {} Vector2D::~Vector2D() {}
double Vector2D::normalize() { double Vector2D::normalize() {

View File

@ -3,12 +3,14 @@
#include <cmath> #include <cmath>
#include <format> #include <format>
#include "../macros.hpp" #include "../macros.hpp"
#include <hyprlang.hpp>
class Vector2D { class Vector2D {
public: public:
Vector2D(double, double); Vector2D(double, double);
Vector2D(); Vector2D();
~Vector2D(); ~Vector2D();
Vector2D(const Hyprlang::VEC2&);
double x = 0; double x = 0;
double y = 0; double y = 0;

View File

@ -13,7 +13,7 @@ CWatchdog::CWatchdog() {
m_iMainThreadPID = pthread_self(); m_iMainThreadPID = pthread_self();
m_pWatchdog = std::make_unique<std::thread>([this] { m_pWatchdog = std::make_unique<std::thread>([this] {
static auto* const PTIMEOUT = &g_pConfigManager->getConfigValuePtr("debug:watchdog_timeout")->intValue; static auto* const PTIMEOUT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:watchdog_timeout");
while (1337) { while (1337) {
std::unique_lock lk(m_mWatchdogMutex); std::unique_lock lk(m_mWatchdogMutex);
@ -21,7 +21,7 @@ CWatchdog::CWatchdog() {
if (!m_bWillWatch) if (!m_bWillWatch)
m_cvWatchdogCondition.wait(lk, [this] { return m_bNotified; }); m_cvWatchdogCondition.wait(lk, [this] { return m_bNotified; });
else { else {
if (m_cvWatchdogCondition.wait_for(lk, std::chrono::milliseconds((int)(*PTIMEOUT * 1000.0)), [this] { return m_bNotified; }) == false) if (m_cvWatchdogCondition.wait_for(lk, std::chrono::milliseconds((int)(**PTIMEOUT * 1000.0)), [this] { return m_bNotified; }) == false)
pthread_kill(m_iMainThreadPID, SIGUSR1); pthread_kill(m_iMainThreadPID, SIGUSR1);
} }
@ -37,9 +37,9 @@ CWatchdog::CWatchdog() {
} }
void CWatchdog::startWatching() { void CWatchdog::startWatching() {
static auto* const PTIMEOUT = &g_pConfigManager->getConfigValuePtr("debug:watchdog_timeout")->intValue; static auto* const PTIMEOUT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:watchdog_timeout");
if (*PTIMEOUT == 0) if (**PTIMEOUT == 0)
return; return;
m_tTriggered = std::chrono::high_resolution_clock::now(); m_tTriggered = std::chrono::high_resolution_clock::now();

View File

@ -38,8 +38,8 @@ CWorkspace::~CWorkspace() {
} }
void CWorkspace::startAnim(bool in, bool left, bool instant) { void CWorkspace::startAnim(bool in, bool left, bool instant) {
const auto ANIMSTYLE = m_fAlpha.m_pConfig->pValues->internalStyle; const auto ANIMSTYLE = m_fAlpha.m_pConfig->pValues->internalStyle;
const auto PWORKSPACEGAP = &g_pConfigManager->getConfigValuePtr("general:gaps_workspaces")->intValue; static auto* const PWORKSPACEGAP = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:gaps_workspaces");
if (ANIMSTYLE.starts_with("slidefade")) { if (ANIMSTYLE.starts_with("slidefade")) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
@ -91,7 +91,7 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
} else if (ANIMSTYLE == "slidevert") { } else if (ANIMSTYLE == "slidevert") {
// fallback is slide // fallback is slide
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
const auto YDISTANCE = PMONITOR->vecSize.y + *PWORKSPACEGAP; const auto YDISTANCE = PMONITOR->vecSize.y + **PWORKSPACEGAP;
m_fAlpha.setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide. m_fAlpha.setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide.
@ -104,7 +104,7 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
} else { } else {
// fallback is slide // fallback is slide
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
const auto XDISTANCE = PMONITOR->vecSize.x + *PWORKSPACEGAP; const auto XDISTANCE = PMONITOR->vecSize.x + **PWORKSPACEGAP;
m_fAlpha.setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide. m_fAlpha.setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide.

View File

@ -4,13 +4,12 @@
void SDwindleNodeData::recalcSizePosRecursive(bool force, bool horizontalOverride, bool verticalOverride) { void SDwindleNodeData::recalcSizePosRecursive(bool force, bool horizontalOverride, bool verticalOverride) {
if (children[0]) { if (children[0]) {
static auto* const PSMARTSPLIT = &g_pConfigManager->getConfigValuePtr("dwindle:smart_split")->intValue; static auto* const PSMARTSPLIT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("dwindle:smart_split");
static auto* const PPRESERVESPLIT = &g_pConfigManager->getConfigValuePtr("dwindle:preserve_split")->intValue; static auto* const PPRESERVESPLIT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("dwindle:preserve_split");
static auto* const PFLMULT = &g_pConfigManager->getConfigValuePtr("dwindle:split_width_multiplier")->floatValue; static auto* const PFLMULT = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("dwindle:split_width_multiplier");
if (*PPRESERVESPLIT == 0 && *PSMARTSPLIT == 0) { if (**PPRESERVESPLIT == 0 && **PSMARTSPLIT == 0)
splitTop = box.h * *PFLMULT > box.w; splitTop = box.h * **PFLMULT > box.w;
}
if (verticalOverride == true) if (verticalOverride == true)
splitTop = true; splitTop = true;
@ -135,12 +134,12 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
PWINDOW->updateSpecialRenderData(); PWINDOW->updateSpecialRenderData();
static auto* const PGAPSIN = &g_pConfigManager->getConfigValuePtr("general:gaps_in")->intValue; static auto* const PGAPSIN = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:gaps_in");
static auto* const PGAPSOUT = &g_pConfigManager->getConfigValuePtr("general:gaps_out")->intValue; static auto* const PGAPSOUT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:gaps_out");
static auto* const PNOGAPSWHENONLY = &g_pConfigManager->getConfigValuePtr("dwindle:no_gaps_when_only")->intValue; static auto* const PNOGAPSWHENONLY = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("dwindle:no_gaps_when_only");
auto gapsIn = WORKSPACERULE.gapsIn.value_or(*PGAPSIN); auto gapsIn = WORKSPACERULE.gapsIn.value_or(**PGAPSIN);
auto gapsOut = WORKSPACERULE.gapsOut.value_or(*PGAPSOUT); auto gapsOut = WORKSPACERULE.gapsOut.value_or(**PGAPSOUT);
if (!g_pCompositor->windowExists(PWINDOW) || !PWINDOW->m_bIsMapped) { if (!g_pCompositor->windowExists(PWINDOW) || !PWINDOW->m_bIsMapped) {
Debug::log(ERR, "Node {} holding invalid {}!!", pNode, PWINDOW); Debug::log(ERR, "Node {} holding invalid {}!!", pNode, PWINDOW);
@ -156,10 +155,10 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
const auto NODESONWORKSPACE = getNodesOnWorkspace(PWINDOW->m_iWorkspaceID); const auto NODESONWORKSPACE = getNodesOnWorkspace(PWINDOW->m_iWorkspaceID);
if (*PNOGAPSWHENONLY && !g_pCompositor->isWorkspaceSpecial(PWINDOW->m_iWorkspaceID) && if (**PNOGAPSWHENONLY && !g_pCompositor->isWorkspaceSpecial(PWINDOW->m_iWorkspaceID) &&
(NODESONWORKSPACE == 1 || (PWINDOW->m_bIsFullscreen && g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID)->m_efFullscreenMode == FULLSCREEN_MAXIMIZED))) { (NODESONWORKSPACE == 1 || (PWINDOW->m_bIsFullscreen && g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID)->m_efFullscreenMode == FULLSCREEN_MAXIMIZED))) {
PWINDOW->m_sSpecialRenderData.border = WORKSPACERULE.border.value_or(*PNOGAPSWHENONLY == 2); PWINDOW->m_sSpecialRenderData.border = WORKSPACERULE.border.value_or(**PNOGAPSWHENONLY == 2);
PWINDOW->m_sSpecialRenderData.decorate = WORKSPACERULE.decorate.value_or(true); PWINDOW->m_sSpecialRenderData.decorate = WORKSPACERULE.decorate.value_or(true);
PWINDOW->m_sSpecialRenderData.rounding = false; PWINDOW->m_sSpecialRenderData.rounding = false;
PWINDOW->m_sSpecialRenderData.shadow = false; PWINDOW->m_sSpecialRenderData.shadow = false;
@ -216,9 +215,9 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
if (g_pCompositor->isWorkspaceSpecial(PWINDOW->m_iWorkspaceID)) { if (g_pCompositor->isWorkspaceSpecial(PWINDOW->m_iWorkspaceID)) {
// if special, we adjust the coords a bit // if special, we adjust the coords a bit
static auto* const PSCALEFACTOR = &g_pConfigManager->getConfigValuePtr("dwindle:special_scale_factor")->floatValue; static auto* const PSCALEFACTOR = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("dwindle:special_scale_factor");
CBox wb = {calcPos + (calcSize - calcSize * *PSCALEFACTOR) / 2.f, calcSize * *PSCALEFACTOR}; CBox wb = {calcPos + (calcSize - calcSize * **PSCALEFACTOR) / 2.f, calcSize * **PSCALEFACTOR};
wb.round(); // avoid rounding mess wb.round(); // avoid rounding mess
PWINDOW->m_vRealPosition = wb.pos(); PWINDOW->m_vRealPosition = wb.pos();
@ -256,8 +255,8 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection dire
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
static auto* const PUSEACTIVE = &g_pConfigManager->getConfigValuePtr("dwindle:use_active_for_splits")->intValue; static auto* const PUSEACTIVE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("dwindle:use_active_for_splits");
static auto* const PDEFAULTSPLIT = &g_pConfigManager->getConfigValuePtr("dwindle:default_split_ratio")->floatValue; static auto* const PDEFAULTSPLIT = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("dwindle:default_split_ratio");
if (direction != DIRECTION_DEFAULT && overrideDirection == DIRECTION_DEFAULT) if (direction != DIRECTION_DEFAULT && overrideDirection == DIRECTION_DEFAULT)
overrideDirection = direction; overrideDirection = direction;
@ -274,13 +273,13 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection dire
const auto MONFROMCURSOR = g_pCompositor->getMonitorFromVector(MOUSECOORDS); const auto MONFROMCURSOR = g_pCompositor->getMonitorFromVector(MOUSECOORDS);
if (PMONITOR->ID == MONFROMCURSOR->ID && if (PMONITOR->ID == MONFROMCURSOR->ID &&
(PNODE->workspaceID == PMONITOR->activeWorkspace || (g_pCompositor->isWorkspaceSpecial(PNODE->workspaceID) && PMONITOR->specialWorkspaceID)) && !*PUSEACTIVE) { (PNODE->workspaceID == PMONITOR->activeWorkspace || (g_pCompositor->isWorkspaceSpecial(PNODE->workspaceID) && PMONITOR->specialWorkspaceID)) && !**PUSEACTIVE) {
OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS)); OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS));
if (!OPENINGON && g_pCompositor->isPointOnReservedArea(MOUSECOORDS, PMONITOR)) if (!OPENINGON && g_pCompositor->isPointOnReservedArea(MOUSECOORDS, PMONITOR))
OPENINGON = getClosestNodeOnWorkspace(PNODE->workspaceID, MOUSECOORDS); OPENINGON = getClosestNodeOnWorkspace(PNODE->workspaceID, MOUSECOORDS);
} else if (*PUSEACTIVE) { } else if (**PUSEACTIVE) {
if (g_pCompositor->m_pLastWindow && !g_pCompositor->m_pLastWindow->m_bIsFloating && g_pCompositor->m_pLastWindow != pWindow && if (g_pCompositor->m_pLastWindow && !g_pCompositor->m_pLastWindow->m_bIsFloating && g_pCompositor->m_pLastWindow != pWindow &&
g_pCompositor->m_pLastWindow->m_iWorkspaceID == pWindow->m_iWorkspaceID && g_pCompositor->m_pLastWindow->m_bIsMapped) { g_pCompositor->m_pLastWindow->m_iWorkspaceID == pWindow->m_iWorkspaceID && g_pCompositor->m_pLastWindow->m_bIsMapped) {
OPENINGON = getNodeFromWindow(g_pCompositor->m_pLastWindow); OPENINGON = getNodeFromWindow(g_pCompositor->m_pLastWindow);
@ -342,8 +341,8 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection dire
&& pWindow->canBeGroupedInto(OPENINGON->pWindow) && !m_vOverrideFocalPoint) { // we are not moving window && pWindow->canBeGroupedInto(OPENINGON->pWindow) && !m_vOverrideFocalPoint) { // we are not moving window
m_lDwindleNodesData.remove(*PNODE); m_lDwindleNodesData.remove(*PNODE);
static const auto* USECURRPOS = &g_pConfigManager->getConfigValuePtr("group:insert_after_current")->intValue; static const auto* USECURRPOS = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:insert_after_current");
(*USECURRPOS ? OPENINGON->pWindow : OPENINGON->pWindow->getGroupTail())->insertWindowToGroup(pWindow); (**USECURRPOS ? OPENINGON->pWindow : OPENINGON->pWindow->getGroupTail())->insertWindowToGroup(pWindow);
OPENINGON->pWindow->setGroupCurrent(pWindow); OPENINGON->pWindow->setGroupCurrent(pWindow);
pWindow->applyGroupRules(); pWindow->applyGroupRules();
@ -366,17 +365,17 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection dire
NEWPARENT->workspaceID = OPENINGON->workspaceID; NEWPARENT->workspaceID = OPENINGON->workspaceID;
NEWPARENT->pParent = OPENINGON->pParent; NEWPARENT->pParent = OPENINGON->pParent;
NEWPARENT->isNode = true; // it is a node NEWPARENT->isNode = true; // it is a node
NEWPARENT->splitRatio = std::clamp(*PDEFAULTSPLIT, 0.1f, 1.9f); NEWPARENT->splitRatio = std::clamp(**PDEFAULTSPLIT, 0.1f, 1.9f);
const auto PWIDTHMULTIPLIER = &g_pConfigManager->getConfigValuePtr("dwindle:split_width_multiplier")->floatValue; const auto PWIDTHMULTIPLIER = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("dwindle:split_width_multiplier");
// if cursor over first child, make it first, etc // if cursor over first child, make it first, etc
const auto SIDEBYSIDE = NEWPARENT->box.w > NEWPARENT->box.h * *PWIDTHMULTIPLIER; const auto SIDEBYSIDE = NEWPARENT->box.w > NEWPARENT->box.h * **PWIDTHMULTIPLIER;
NEWPARENT->splitTop = !SIDEBYSIDE; NEWPARENT->splitTop = !SIDEBYSIDE;
static auto* const PFORCESPLIT = &g_pConfigManager->getConfigValuePtr("dwindle:force_split")->intValue; static auto* const PFORCESPLIT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("dwindle:force_split");
static auto* const PERMANENTDIRECTIONOVERRIDE = &g_pConfigManager->getConfigValuePtr("dwindle:permanent_direction_override")->intValue; static auto* const PERMANENTDIRECTIONOVERRIDE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("dwindle:permanent_direction_override");
static auto* const PSMARTSPLIT = &g_pConfigManager->getConfigValuePtr("dwindle:smart_split")->intValue; static auto* const PSMARTSPLIT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("dwindle:smart_split");
bool horizontalOverride = false; bool horizontalOverride = false;
bool verticalOverride = false; bool verticalOverride = false;
@ -400,9 +399,9 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection dire
} }
// whether or not the override persists after opening one window // whether or not the override persists after opening one window
if (*PERMANENTDIRECTIONOVERRIDE == 0) if (**PERMANENTDIRECTIONOVERRIDE == 0)
overrideDirection = DIRECTION_DEFAULT; overrideDirection = DIRECTION_DEFAULT;
} else if (*PSMARTSPLIT == 1) { } else if (**PSMARTSPLIT == 1) {
const auto PARENT_CENTER = NEWPARENT->box.pos() + NEWPARENT->box.size() / 2; const auto PARENT_CENTER = NEWPARENT->box.pos() + NEWPARENT->box.size() / 2;
const auto PARENT_PROPORTIONS = NEWPARENT->box.h / NEWPARENT->box.w; const auto PARENT_PROPORTIONS = NEWPARENT->box.h / NEWPARENT->box.w;
const auto DELTA = MOUSECOORDS - PARENT_CENTER; const auto DELTA = MOUSECOORDS - PARENT_CENTER;
@ -433,11 +432,11 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection dire
NEWPARENT->children[1] = OPENINGON; NEWPARENT->children[1] = OPENINGON;
} }
} }
} else if (*PFORCESPLIT == 0 || !pWindow->m_bFirstMap) { } else if (**PFORCESPLIT == 0 || !pWindow->m_bFirstMap) {
if ((SIDEBYSIDE && if ((SIDEBYSIDE &&
VECINRECT(MOUSECOORDS, NEWPARENT->box.x, NEWPARENT->box.y / *PWIDTHMULTIPLIER, NEWPARENT->box.x + NEWPARENT->box.w / 2.f, NEWPARENT->box.y + NEWPARENT->box.h)) || VECINRECT(MOUSECOORDS, NEWPARENT->box.x, NEWPARENT->box.y / **PWIDTHMULTIPLIER, NEWPARENT->box.x + NEWPARENT->box.w / 2.f, NEWPARENT->box.y + NEWPARENT->box.h)) ||
(!SIDEBYSIDE && (!SIDEBYSIDE &&
VECINRECT(MOUSECOORDS, NEWPARENT->box.x, NEWPARENT->box.y / *PWIDTHMULTIPLIER, NEWPARENT->box.x + NEWPARENT->box.w, NEWPARENT->box.y + NEWPARENT->box.h / 2.f))) { VECINRECT(MOUSECOORDS, NEWPARENT->box.x, NEWPARENT->box.y / **PWIDTHMULTIPLIER, NEWPARENT->box.x + NEWPARENT->box.w, NEWPARENT->box.y + NEWPARENT->box.h / 2.f))) {
// we are hovering over the first node, make PNODE first. // we are hovering over the first node, make PNODE first.
NEWPARENT->children[1] = OPENINGON; NEWPARENT->children[1] = OPENINGON;
NEWPARENT->children[0] = PNODE; NEWPARENT->children[0] = PNODE;
@ -447,7 +446,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection dire
NEWPARENT->children[1] = PNODE; NEWPARENT->children[1] = PNODE;
} }
} else { } else {
if (*PFORCESPLIT == 1) { if (**PFORCESPLIT == 1) {
NEWPARENT->children[1] = OPENINGON; NEWPARENT->children[1] = OPENINGON;
NEWPARENT->children[0] = PNODE; NEWPARENT->children[0] = PNODE;
} else { } else {
@ -466,7 +465,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection dire
} }
// Update the children // Update the children
if (!verticalOverride && (NEWPARENT->box.w * *PWIDTHMULTIPLIER > NEWPARENT->box.h || horizontalOverride)) { if (!verticalOverride && (NEWPARENT->box.w * **PWIDTHMULTIPLIER > NEWPARENT->box.h || horizontalOverride)) {
// split left/right -> forced // split left/right -> forced
OPENINGON->box = {NEWPARENT->box.pos(), Vector2D(NEWPARENT->box.w / 2.f, NEWPARENT->box.h)}; OPENINGON->box = {NEWPARENT->box.pos(), Vector2D(NEWPARENT->box.w / 2.f, NEWPARENT->box.h)};
PNODE->box = {Vector2D(NEWPARENT->box.x + NEWPARENT->box.w / 2.f, NEWPARENT->box.y), Vector2D(NEWPARENT->box.w / 2.f, NEWPARENT->box.h)}; PNODE->box = {Vector2D(NEWPARENT->box.x + NEWPARENT->box.w / 2.f, NEWPARENT->box.y), Vector2D(NEWPARENT->box.w / 2.f, NEWPARENT->box.h)};
@ -610,8 +609,8 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorn
return; return;
} }
const auto PANIMATE = &g_pConfigManager->getConfigValuePtr("misc:animate_manual_resizes")->intValue; const auto PANIMATE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:animate_manual_resizes");
const auto PSMARTRESIZING = &g_pConfigManager->getConfigValuePtr("dwindle:smart_resizing")->intValue; const auto PSMARTRESIZING = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("dwindle:smart_resizing");
// get some data about our window // get some data about our window
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
@ -654,7 +653,7 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorn
PWINDOW->m_vPseudoSize = {std::clamp(PWINDOW->m_vPseudoSize.x, 30.0, wbox.w), std::clamp(PWINDOW->m_vPseudoSize.y, 30.0, wbox.h)}; PWINDOW->m_vPseudoSize = {std::clamp(PWINDOW->m_vPseudoSize.x, 30.0, wbox.w), std::clamp(PWINDOW->m_vPseudoSize.y, 30.0, wbox.h)};
PWINDOW->m_vLastFloatingSize = PWINDOW->m_vPseudoSize; PWINDOW->m_vLastFloatingSize = PWINDOW->m_vPseudoSize;
PNODE->recalcSizePosRecursive(*PANIMATE == 0); PNODE->recalcSizePosRecursive(**PANIMATE == 0);
return; return;
} }
@ -668,7 +667,7 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorn
if (DISPLAYBOTTOM && DISPLAYTOP) if (DISPLAYBOTTOM && DISPLAYTOP)
allowedMovement.y = 0; allowedMovement.y = 0;
if (*PSMARTRESIZING == 1) { if (**PSMARTRESIZING == 1) {
// Identify inner and outer nodes for both directions // Identify inner and outer nodes for both directions
SDwindleNodeData* PVOUTER = nullptr; SDwindleNodeData* PVOUTER = nullptr;
SDwindleNodeData* PVINNER = nullptr; SDwindleNodeData* PVINNER = nullptr;
@ -702,14 +701,14 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorn
if (PHINNER) { if (PHINNER) {
const auto ORIGINAL = PHINNER->box.w; const auto ORIGINAL = PHINNER->box.w;
PHOUTER->pParent->recalcSizePosRecursive(*PANIMATE == 0); PHOUTER->pParent->recalcSizePosRecursive(**PANIMATE == 0);
if (PHINNER->pParent->children[0] == PHINNER) if (PHINNER->pParent->children[0] == PHINNER)
PHINNER->pParent->splitRatio = std::clamp((ORIGINAL - allowedMovement.x) / PHINNER->pParent->box.w * 2.f, 0.1, 1.9); PHINNER->pParent->splitRatio = std::clamp((ORIGINAL - allowedMovement.x) / PHINNER->pParent->box.w * 2.f, 0.1, 1.9);
else else
PHINNER->pParent->splitRatio = std::clamp(2 - (ORIGINAL + allowedMovement.x) / PHINNER->pParent->box.w * 2.f, 0.1, 1.9); PHINNER->pParent->splitRatio = std::clamp(2 - (ORIGINAL + allowedMovement.x) / PHINNER->pParent->box.w * 2.f, 0.1, 1.9);
PHINNER->pParent->recalcSizePosRecursive(*PANIMATE == 0); PHINNER->pParent->recalcSizePosRecursive(**PANIMATE == 0);
} else } else
PHOUTER->pParent->recalcSizePosRecursive(*PANIMATE == 0); PHOUTER->pParent->recalcSizePosRecursive(**PANIMATE == 0);
} }
if (PVOUTER) { if (PVOUTER) {
@ -717,14 +716,14 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorn
if (PVINNER) { if (PVINNER) {
const auto ORIGINAL = PVINNER->box.h; const auto ORIGINAL = PVINNER->box.h;
PVOUTER->pParent->recalcSizePosRecursive(*PANIMATE == 0); PVOUTER->pParent->recalcSizePosRecursive(**PANIMATE == 0);
if (PVINNER->pParent->children[0] == PVINNER) if (PVINNER->pParent->children[0] == PVINNER)
PVINNER->pParent->splitRatio = std::clamp((ORIGINAL - allowedMovement.y) / PVINNER->pParent->box.h * 2.f, 0.1, 1.9); PVINNER->pParent->splitRatio = std::clamp((ORIGINAL - allowedMovement.y) / PVINNER->pParent->box.h * 2.f, 0.1, 1.9);
else else
PVINNER->pParent->splitRatio = std::clamp(2 - (ORIGINAL + allowedMovement.y) / PVINNER->pParent->box.h * 2.f, 0.1, 1.9); PVINNER->pParent->splitRatio = std::clamp(2 - (ORIGINAL + allowedMovement.y) / PVINNER->pParent->box.h * 2.f, 0.1, 1.9);
PVINNER->pParent->recalcSizePosRecursive(*PANIMATE == 0); PVINNER->pParent->recalcSizePosRecursive(**PANIMATE == 0);
} else } else
PVOUTER->pParent->recalcSizePosRecursive(*PANIMATE == 0); PVOUTER->pParent->recalcSizePosRecursive(**PANIMATE == 0);
} }
} else { } else {
// get the correct containers to apply splitratio to // get the correct containers to apply splitratio to
@ -743,11 +742,11 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorn
if (PARENTSIDEBYSIDE) { if (PARENTSIDEBYSIDE) {
allowedMovement.x *= 2.f / PPARENT->box.w; allowedMovement.x *= 2.f / PPARENT->box.w;
PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.x, 0.1, 1.9); PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.x, 0.1, 1.9);
PPARENT->recalcSizePosRecursive(*PANIMATE == 0); PPARENT->recalcSizePosRecursive(**PANIMATE == 0);
} else { } else {
allowedMovement.y *= 2.f / PPARENT->box.h; allowedMovement.y *= 2.f / PPARENT->box.h;
PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.y, 0.1, 1.9); PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.y, 0.1, 1.9);
PPARENT->recalcSizePosRecursive(*PANIMATE == 0); PPARENT->recalcSizePosRecursive(**PANIMATE == 0);
} }
return; return;
@ -762,11 +761,11 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorn
if (PARENTSIDEBYSIDE) { if (PARENTSIDEBYSIDE) {
allowedMovement.x *= 2.f / PPARENT->box.w; allowedMovement.x *= 2.f / PPARENT->box.w;
PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.x, 0.1, 1.9); PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.x, 0.1, 1.9);
PPARENT->recalcSizePosRecursive(*PANIMATE == 0); PPARENT->recalcSizePosRecursive(**PANIMATE == 0);
} else { } else {
allowedMovement.y *= 2.f / PPARENT->box.h; allowedMovement.y *= 2.f / PPARENT->box.h;
PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.y, 0.1, 1.9); PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.y, 0.1, 1.9);
PPARENT->recalcSizePosRecursive(*PANIMATE == 0); PPARENT->recalcSizePosRecursive(**PANIMATE == 0);
} }
return; return;
@ -781,8 +780,8 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorn
SIDECONTAINER->splitRatio = std::clamp(SIDECONTAINER->splitRatio + allowedMovement.x, 0.1, 1.9); SIDECONTAINER->splitRatio = std::clamp(SIDECONTAINER->splitRatio + allowedMovement.x, 0.1, 1.9);
TOPCONTAINER->splitRatio = std::clamp(TOPCONTAINER->splitRatio + allowedMovement.y, 0.1, 1.9); TOPCONTAINER->splitRatio = std::clamp(TOPCONTAINER->splitRatio + allowedMovement.y, 0.1, 1.9);
SIDECONTAINER->recalcSizePosRecursive(*PANIMATE == 0); SIDECONTAINER->recalcSizePosRecursive(**PANIMATE == 0);
TOPCONTAINER->recalcSizePosRecursive(*PANIMATE == 0); TOPCONTAINER->recalcSizePosRecursive(**PANIMATE == 0);
} }
} }

View File

@ -87,7 +87,7 @@ void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) {
desiredGeometry.y = xy.y; desiredGeometry.y = xy.y;
} }
static auto* const PXWLFORCESCALEZERO = &g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling")->intValue; static auto* const PXWLFORCESCALEZERO = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling");
if (!PMONITOR) { if (!PMONITOR) {
Debug::log(ERR, "{:m} has an invalid monitor in onWindowCreatedFloating!!!", pWindow); Debug::log(ERR, "{:m} has an invalid monitor in onWindowCreatedFloating!!!", pWindow);
@ -151,7 +151,7 @@ void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) {
} }
} }
if (*PXWLFORCESCALEZERO && pWindow->m_bIsX11) if (**PXWLFORCESCALEZERO && pWindow->m_bIsX11)
pWindow->m_vRealSize = pWindow->m_vRealSize.goalv() / PMONITOR->scale; pWindow->m_vRealSize = pWindow->m_vRealSize.goalv() / PMONITOR->scale;
if (pWindow->m_bX11DoesntWantBorders || (pWindow->m_bIsX11 && pWindow->m_uSurface.xwayland->override_redirect)) { if (pWindow->m_bX11DoesntWantBorders || (pWindow->m_bIsX11 && pWindow->m_uSurface.xwayland->override_redirect)) {
@ -275,8 +275,8 @@ void IHyprLayout::onEndDragWindow() {
return; return;
if (pWindow->m_sGroupData.pNextWindow && DRAGGINGWINDOW->canBeGroupedInto(pWindow)) { if (pWindow->m_sGroupData.pNextWindow && DRAGGINGWINDOW->canBeGroupedInto(pWindow)) {
static const auto* USECURRPOS = &g_pConfigManager->getConfigValuePtr("group:insert_after_current")->intValue; static const auto* USECURRPOS = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:insert_after_current");
(*USECURRPOS ? pWindow : pWindow->getGroupTail())->insertWindowToGroup(DRAGGINGWINDOW); (**USECURRPOS ? pWindow : pWindow->getGroupTail())->insertWindowToGroup(DRAGGINGWINDOW);
pWindow->setGroupCurrent(DRAGGINGWINDOW); pWindow->setGroupCurrent(DRAGGINGWINDOW);
DRAGGINGWINDOW->updateWindowDecos(); DRAGGINGWINDOW->updateWindowDecos();
@ -309,8 +309,8 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
const auto DELTA = Vector2D(mousePos.x - m_vBeginDragXY.x, mousePos.y - m_vBeginDragXY.y); const auto DELTA = Vector2D(mousePos.x - m_vBeginDragXY.x, mousePos.y - m_vBeginDragXY.y);
const auto TICKDELTA = Vector2D(mousePos.x - m_vLastDragXY.x, mousePos.y - m_vLastDragXY.y); const auto TICKDELTA = Vector2D(mousePos.x - m_vLastDragXY.x, mousePos.y - m_vLastDragXY.y);
static auto* const PANIMATEMOUSE = &g_pConfigManager->getConfigValuePtr("misc:animate_mouse_windowdragging")->intValue; static auto* const PANIMATEMOUSE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:animate_mouse_windowdragging");
static auto* const PANIMATE = &g_pConfigManager->getConfigValuePtr("misc:animate_manual_resizes")->intValue; static auto* const PANIMATE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:animate_manual_resizes");
if ((abs(TICKDELTA.x) < 1.f && abs(TICKDELTA.y) < 1.f) || if ((abs(TICKDELTA.x) < 1.f && abs(TICKDELTA.y) < 1.f) ||
(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - TIMER).count() < (std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - TIMER).count() <
@ -328,7 +328,7 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
CBox wb = {m_vBeginDragPositionXY + DELTA, DRAGGINGWINDOW->m_vRealSize.goalv()}; CBox wb = {m_vBeginDragPositionXY + DELTA, DRAGGINGWINDOW->m_vRealSize.goalv()};
wb.round(); wb.round();
if (*PANIMATEMOUSE) if (**PANIMATEMOUSE)
DRAGGINGWINDOW->m_vRealPosition = wb.pos(); DRAGGINGWINDOW->m_vRealPosition = wb.pos();
else else
DRAGGINGWINDOW->m_vRealPosition.setValueAndWarp(wb.pos()); DRAGGINGWINDOW->m_vRealPosition.setValueAndWarp(wb.pos());
@ -386,7 +386,7 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
CBox wb = {newPos, newSize}; CBox wb = {newPos, newSize};
wb.round(); wb.round();
if (*PANIMATE) { if (**PANIMATE) {
DRAGGINGWINDOW->m_vRealSize = wb.size(); DRAGGINGWINDOW->m_vRealSize = wb.size();
DRAGGINGWINDOW->m_vRealPosition = wb.pos(); DRAGGINGWINDOW->m_vRealPosition = wb.pos();
} else { } else {

View File

@ -39,11 +39,11 @@ SMasterWorkspaceData* CHyprMasterLayout::getMasterWorkspaceData(const int& ws) {
} }
//create on the fly if it doesn't exist yet //create on the fly if it doesn't exist yet
const auto PWORKSPACEDATA = &m_lMasterWorkspacesData.emplace_back(); const auto PWORKSPACEDATA = &m_lMasterWorkspacesData.emplace_back();
PWORKSPACEDATA->workspaceID = ws; PWORKSPACEDATA->workspaceID = ws;
const auto orientation = &g_pConfigManager->getConfigValuePtr("master:orientation")->strValue; const auto orientation = (Hyprlang::STRING const*)g_pConfigManager->getConfigValuePtr("master:orientation");
const auto layoutoptsForWs = g_pConfigManager->getWorkspaceRuleFor(g_pCompositor->getWorkspaceByID(ws)).layoutopts; const auto layoutoptsForWs = g_pConfigManager->getWorkspaceRuleFor(g_pCompositor->getWorkspaceByID(ws)).layoutopts;
auto orientationForWs = *orientation; std::string orientationForWs = *orientation;
if (layoutoptsForWs.contains("orientation")) if (layoutoptsForWs.contains("orientation"))
orientationForWs = layoutoptsForWs.at("orientation"); orientationForWs = layoutoptsForWs.at("orientation");
@ -80,20 +80,20 @@ void CHyprMasterLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection direc
if (pWindow->m_bIsFloating) if (pWindow->m_bIsFloating)
return; return;
static auto* const PNEWTOP = &g_pConfigManager->getConfigValuePtr("master:new_on_top")->intValue; static auto* const PNEWTOP = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("master:new_on_top");
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
const auto PNODE = *PNEWTOP ? &m_lMasterNodesData.emplace_front() : &m_lMasterNodesData.emplace_back(); const auto PNODE = **PNEWTOP ? &m_lMasterNodesData.emplace_front() : &m_lMasterNodesData.emplace_back();
PNODE->workspaceID = pWindow->m_iWorkspaceID; PNODE->workspaceID = pWindow->m_iWorkspaceID;
PNODE->pWindow = pWindow; PNODE->pWindow = pWindow;
static auto* const PNEWISMASTER = &g_pConfigManager->getConfigValuePtr("master:new_is_master")->intValue; static auto* const PNEWISMASTER = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("master:new_is_master");
const auto WINDOWSONWORKSPACE = getNodesOnWorkspace(PNODE->workspaceID); const auto WINDOWSONWORKSPACE = getNodesOnWorkspace(PNODE->workspaceID);
static auto* const PMFACT = &g_pConfigManager->getConfigValuePtr("master:mfact")->floatValue; static auto* const PMFACT = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("master:mfact");
float lastSplitPercent = *PMFACT; float lastSplitPercent = **PMFACT;
auto OPENINGON = isWindowTiled(g_pCompositor->m_pLastWindow) && g_pCompositor->m_pLastWindow->m_iWorkspaceID == pWindow->m_iWorkspaceID ? auto OPENINGON = isWindowTiled(g_pCompositor->m_pLastWindow) && g_pCompositor->m_pLastWindow->m_iWorkspaceID == pWindow->m_iWorkspaceID ?
getNodeFromWindow(g_pCompositor->m_pLastWindow) : getNodeFromWindow(g_pCompositor->m_pLastWindow) :
@ -112,8 +112,8 @@ void CHyprMasterLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection direc
m_lMasterNodesData.remove(*PNODE); m_lMasterNodesData.remove(*PNODE);
static const auto* USECURRPOS = &g_pConfigManager->getConfigValuePtr("group:insert_after_current")->intValue; static const auto* USECURRPOS = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:insert_after_current");
(*USECURRPOS ? OPENINGON->pWindow : OPENINGON->pWindow->getGroupTail())->insertWindowToGroup(pWindow); (**USECURRPOS ? OPENINGON->pWindow : OPENINGON->pWindow->getGroupTail())->insertWindowToGroup(pWindow);
OPENINGON->pWindow->setGroupCurrent(pWindow); OPENINGON->pWindow->setGroupCurrent(pWindow);
pWindow->applyGroupRules(); pWindow->applyGroupRules();
@ -128,14 +128,14 @@ void CHyprMasterLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection direc
pWindow->applyGroupRules(); pWindow->applyGroupRules();
static auto* const PDROPATCURSOR = &g_pConfigManager->getConfigValuePtr("master:drop_at_cursor")->intValue; static auto* const PDROPATCURSOR = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("master:drop_at_cursor");
const auto PWORKSPACEDATA = getMasterWorkspaceData(pWindow->m_iWorkspaceID); const auto PWORKSPACEDATA = getMasterWorkspaceData(pWindow->m_iWorkspaceID);
eOrientation orientation = PWORKSPACEDATA->orientation; eOrientation orientation = PWORKSPACEDATA->orientation;
const auto NODEIT = std::find(m_lMasterNodesData.begin(), m_lMasterNodesData.end(), *PNODE); const auto NODEIT = std::find(m_lMasterNodesData.begin(), m_lMasterNodesData.end(), *PNODE);
bool forceDropAsMaster = false; bool forceDropAsMaster = false;
// if dragging window to move, drop it at the cursor position instead of bottom/top of stack // if dragging window to move, drop it at the cursor position instead of bottom/top of stack
if (*PDROPATCURSOR && g_pInputManager->dragMode == MBIND_MOVE) { if (**PDROPATCURSOR && g_pInputManager->dragMode == MBIND_MOVE) {
if (WINDOWSONWORKSPACE > 2) { if (WINDOWSONWORKSPACE > 2) {
for (auto it = m_lMasterNodesData.begin(); it != m_lMasterNodesData.end(); ++it) { for (auto it = m_lMasterNodesData.begin(); it != m_lMasterNodesData.end(); ++it) {
if (it->workspaceID != pWindow->m_iWorkspaceID) if (it->workspaceID != pWindow->m_iWorkspaceID)
@ -191,7 +191,7 @@ void CHyprMasterLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection direc
} }
} }
if ((*PNEWISMASTER && g_pInputManager->dragMode != MBIND_MOVE) || WINDOWSONWORKSPACE == 1 || (WINDOWSONWORKSPACE > 2 && !pWindow->m_bFirstMap && OPENINGON->isMaster) || if ((**PNEWISMASTER && g_pInputManager->dragMode != MBIND_MOVE) || WINDOWSONWORKSPACE == 1 || (WINDOWSONWORKSPACE > 2 && !pWindow->m_bFirstMap && OPENINGON->isMaster) ||
forceDropAsMaster) { forceDropAsMaster) {
for (auto& nd : m_lMasterNodesData) { for (auto& nd : m_lMasterNodesData) {
if (nd.isMaster && nd.workspaceID == PNODE->workspaceID) { if (nd.isMaster && nd.workspaceID == PNODE->workspaceID) {
@ -239,14 +239,14 @@ void CHyprMasterLayout::onWindowRemovedTiling(CWindow* pWindow) {
const auto WORKSPACEID = PNODE->workspaceID; const auto WORKSPACEID = PNODE->workspaceID;
const auto MASTERSLEFT = getMastersOnWorkspace(WORKSPACEID); const auto MASTERSLEFT = getMastersOnWorkspace(WORKSPACEID);
static const auto* SMALLSPLIT = &g_pConfigManager->getConfigValuePtr("master:allow_small_split")->intValue; static const auto* SMALLSPLIT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("master:allow_small_split");
pWindow->updateSpecialRenderData(); pWindow->updateSpecialRenderData();
if (pWindow->m_bIsFullscreen) if (pWindow->m_bIsFullscreen)
g_pCompositor->setWindowFullscreen(pWindow, false, FULLSCREEN_FULL); g_pCompositor->setWindowFullscreen(pWindow, false, FULLSCREEN_FULL);
if (PNODE->isMaster && (MASTERSLEFT <= 1 || *SMALLSPLIT == 1)) { if (PNODE->isMaster && (MASTERSLEFT <= 1 || **SMALLSPLIT == 1)) {
// find a new master from top of the list // find a new master from top of the list
for (auto& nd : m_lMasterNodesData) { for (auto& nd : m_lMasterNodesData) {
if (!nd.isMaster && nd.workspaceID == WORKSPACEID) { if (!nd.isMaster && nd.workspaceID == WORKSPACEID) {
@ -338,8 +338,8 @@ void CHyprMasterLayout::calculateWorkspace(const int& ws) {
eOrientation orientation = PWORKSPACEDATA->orientation; eOrientation orientation = PWORKSPACEDATA->orientation;
bool centerMasterWindow = false; bool centerMasterWindow = false;
static auto* const ALWAYSCENTER = &g_pConfigManager->getConfigValuePtr("master:always_center_master")->intValue; static auto* const ALWAYSCENTER = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("master:always_center_master");
static auto* const PSMARTRESIZING = &g_pConfigManager->getConfigValuePtr("master:smart_resizing")->intValue; static auto* const PSMARTRESIZING = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("master:smart_resizing");
const auto MASTERS = getMastersOnWorkspace(PWORKSPACE->m_iID); const auto MASTERS = getMastersOnWorkspace(PWORKSPACE->m_iID);
const auto WINDOWS = getNodesOnWorkspace(PWORKSPACE->m_iID); const auto WINDOWS = getNodesOnWorkspace(PWORKSPACE->m_iID);
@ -348,7 +348,7 @@ void CHyprMasterLayout::calculateWorkspace(const int& ws) {
const auto WSPOS = PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft; const auto WSPOS = PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft;
if (orientation == ORIENTATION_CENTER) { if (orientation == ORIENTATION_CENTER) {
if (STACKWINDOWS >= 2 || (*ALWAYSCENTER == 1)) { if (STACKWINDOWS >= 2 || (**ALWAYSCENTER == 1)) {
centerMasterWindow = true; centerMasterWindow = true;
} else { } else {
orientation = ORIENTATION_LEFT; orientation = ORIENTATION_LEFT;
@ -361,7 +361,7 @@ void CHyprMasterLayout::calculateWorkspace(const int& ws) {
float masterAccumulatedSize = 0; float masterAccumulatedSize = 0;
float slaveAccumulatedSize = 0; float slaveAccumulatedSize = 0;
if (*PSMARTRESIZING) { if (**PSMARTRESIZING) {
// check the total width and height so that later // check the total width and height so that later
// if larger/smaller than screen size them down/up // if larger/smaller than screen size them down/up
for (auto& nd : m_lMasterNodesData) { for (auto& nd : m_lMasterNodesData) {
@ -399,7 +399,7 @@ void CHyprMasterLayout::calculateWorkspace(const int& ws) {
if (WIDTH > widthLeft * 0.9f && mastersLeft > 1) if (WIDTH > widthLeft * 0.9f && mastersLeft > 1)
WIDTH = widthLeft * 0.9f; WIDTH = widthLeft * 0.9f;
if (*PSMARTRESIZING) { if (**PSMARTRESIZING) {
nd.percSize *= WSSIZE.x / masterAccumulatedSize; nd.percSize *= WSSIZE.x / masterAccumulatedSize;
WIDTH = masterAverageSize * nd.percSize; WIDTH = masterAverageSize * nd.percSize;
} }
@ -436,7 +436,7 @@ void CHyprMasterLayout::calculateWorkspace(const int& ws) {
if (HEIGHT > heightLeft * 0.9f && mastersLeft > 1) if (HEIGHT > heightLeft * 0.9f && mastersLeft > 1)
HEIGHT = heightLeft * 0.9f; HEIGHT = heightLeft * 0.9f;
if (*PSMARTRESIZING) { if (**PSMARTRESIZING) {
nd.percSize *= WSSIZE.y / masterAccumulatedSize; nd.percSize *= WSSIZE.y / masterAccumulatedSize;
HEIGHT = masterAverageSize * nd.percSize; HEIGHT = masterAverageSize * nd.percSize;
} }
@ -473,7 +473,7 @@ void CHyprMasterLayout::calculateWorkspace(const int& ws) {
if (WIDTH > widthLeft * 0.9f && slavesLeft > 1) if (WIDTH > widthLeft * 0.9f && slavesLeft > 1)
WIDTH = widthLeft * 0.9f; WIDTH = widthLeft * 0.9f;
if (*PSMARTRESIZING) { if (**PSMARTRESIZING) {
nd.percSize *= WSSIZE.x / slaveAccumulatedSize; nd.percSize *= WSSIZE.x / slaveAccumulatedSize;
WIDTH = slaveAverageSize * nd.percSize; WIDTH = slaveAverageSize * nd.percSize;
} }
@ -503,7 +503,7 @@ void CHyprMasterLayout::calculateWorkspace(const int& ws) {
if (HEIGHT > heightLeft * 0.9f && slavesLeft > 1) if (HEIGHT > heightLeft * 0.9f && slavesLeft > 1)
HEIGHT = heightLeft * 0.9f; HEIGHT = heightLeft * 0.9f;
if (*PSMARTRESIZING) { if (**PSMARTRESIZING) {
nd.percSize *= WSSIZE.y / slaveAccumulatedSize; nd.percSize *= WSSIZE.y / slaveAccumulatedSize;
HEIGHT = slaveAverageSize * nd.percSize; HEIGHT = slaveAverageSize * nd.percSize;
} }
@ -534,7 +534,7 @@ void CHyprMasterLayout::calculateWorkspace(const int& ws) {
const float slaveAverageHeightR = WSSIZE.y / slavesLeftR; const float slaveAverageHeightR = WSSIZE.y / slavesLeftR;
float slaveAccumulatedHeightL = 0; float slaveAccumulatedHeightL = 0;
float slaveAccumulatedHeightR = 0; float slaveAccumulatedHeightR = 0;
if (*PSMARTRESIZING) { if (**PSMARTRESIZING) {
for (auto& nd : m_lMasterNodesData) { for (auto& nd : m_lMasterNodesData) {
if (nd.workspaceID != PWORKSPACE->m_iID || nd.isMaster) if (nd.workspaceID != PWORKSPACE->m_iID || nd.isMaster)
continue; continue;
@ -569,7 +569,7 @@ void CHyprMasterLayout::calculateWorkspace(const int& ws) {
if (HEIGHT > heightLeft * 0.9f && slavesLeft > 1) if (HEIGHT > heightLeft * 0.9f && slavesLeft > 1)
HEIGHT = heightLeft * 0.9f; HEIGHT = heightLeft * 0.9f;
if (*PSMARTRESIZING) { if (**PSMARTRESIZING) {
if (onRight) { if (onRight) {
nd.percSize *= WSSIZE.y / slaveAccumulatedHeightR; nd.percSize *= WSSIZE.y / slaveAccumulatedHeightR;
HEIGHT = slaveAverageHeightR * nd.percSize; HEIGHT = slaveAverageHeightR * nd.percSize;
@ -633,13 +633,13 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
PWINDOW->updateSpecialRenderData(); PWINDOW->updateSpecialRenderData();
static auto* const PGAPSIN = &g_pConfigManager->getConfigValuePtr("general:gaps_in")->intValue; static auto* const PGAPSIN = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:gaps_in");
static auto* const PGAPSOUT = &g_pConfigManager->getConfigValuePtr("general:gaps_out")->intValue; static auto* const PGAPSOUT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:gaps_out");
static auto* const PNOGAPSWHENONLY = &g_pConfigManager->getConfigValuePtr("master:no_gaps_when_only")->intValue; static auto* const PNOGAPSWHENONLY = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("master:no_gaps_when_only");
static auto* const PANIMATE = &g_pConfigManager->getConfigValuePtr("misc:animate_manual_resizes")->intValue; static auto* const PANIMATE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:animate_manual_resizes");
auto gapsIn = WORKSPACERULE.gapsIn.value_or(*PGAPSIN); auto gapsIn = WORKSPACERULE.gapsIn.value_or(**PGAPSIN);
auto gapsOut = WORKSPACERULE.gapsOut.value_or(*PGAPSOUT); auto gapsOut = WORKSPACERULE.gapsOut.value_or(**PGAPSOUT);
if (!g_pCompositor->windowValidMapped(PWINDOW)) { if (!g_pCompositor->windowValidMapped(PWINDOW)) {
Debug::log(ERR, "Node {} holding invalid {}!!", pNode, PWINDOW); Debug::log(ERR, "Node {} holding invalid {}!!", pNode, PWINDOW);
@ -649,11 +649,11 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
PWINDOW->m_vSize = pNode->size; PWINDOW->m_vSize = pNode->size;
PWINDOW->m_vPosition = pNode->position; PWINDOW->m_vPosition = pNode->position;
if (*PNOGAPSWHENONLY && !g_pCompositor->isWorkspaceSpecial(PWINDOW->m_iWorkspaceID) && if (**PNOGAPSWHENONLY && !g_pCompositor->isWorkspaceSpecial(PWINDOW->m_iWorkspaceID) &&
(getNodesOnWorkspace(PWINDOW->m_iWorkspaceID) == 1 || (getNodesOnWorkspace(PWINDOW->m_iWorkspaceID) == 1 ||
(PWINDOW->m_bIsFullscreen && g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID)->m_efFullscreenMode == FULLSCREEN_MAXIMIZED))) { (PWINDOW->m_bIsFullscreen && g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID)->m_efFullscreenMode == FULLSCREEN_MAXIMIZED))) {
PWINDOW->m_sSpecialRenderData.border = WORKSPACERULE.border.value_or(*PNOGAPSWHENONLY == 2); PWINDOW->m_sSpecialRenderData.border = WORKSPACERULE.border.value_or(**PNOGAPSWHENONLY == 2);
PWINDOW->m_sSpecialRenderData.decorate = WORKSPACERULE.decorate.value_or(true); PWINDOW->m_sSpecialRenderData.decorate = WORKSPACERULE.decorate.value_or(true);
PWINDOW->m_sSpecialRenderData.rounding = false; PWINDOW->m_sSpecialRenderData.rounding = false;
PWINDOW->m_sSpecialRenderData.shadow = false; PWINDOW->m_sSpecialRenderData.shadow = false;
@ -685,9 +685,9 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
calcSize = calcSize - (RESERVED.topLeft + RESERVED.bottomRight); calcSize = calcSize - (RESERVED.topLeft + RESERVED.bottomRight);
if (g_pCompositor->isWorkspaceSpecial(PWINDOW->m_iWorkspaceID)) { if (g_pCompositor->isWorkspaceSpecial(PWINDOW->m_iWorkspaceID)) {
static auto* const PSCALEFACTOR = &g_pConfigManager->getConfigValuePtr("master:special_scale_factor")->floatValue; static auto* const PSCALEFACTOR = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("master:special_scale_factor");
CBox wb = {calcPos + (calcSize - calcSize * *PSCALEFACTOR) / 2.f, calcSize * *PSCALEFACTOR}; CBox wb = {calcPos + (calcSize - calcSize * **PSCALEFACTOR) / 2.f, calcSize * **PSCALEFACTOR};
wb.round(); // avoid rounding mess wb.round(); // avoid rounding mess
PWINDOW->m_vRealPosition = wb.pos(); PWINDOW->m_vRealPosition = wb.pos();
@ -736,11 +736,11 @@ void CHyprMasterLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorne
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
const auto PWORKSPACEDATA = getMasterWorkspaceData(PMONITOR->activeWorkspace); const auto PWORKSPACEDATA = getMasterWorkspaceData(PMONITOR->activeWorkspace);
static auto* const ALWAYSCENTER = &g_pConfigManager->getConfigValuePtr("master:always_center_master")->intValue; static auto* const ALWAYSCENTER = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("master:always_center_master");
static auto* const PSMARTRESIZING = &g_pConfigManager->getConfigValuePtr("master:smart_resizing")->intValue; static auto* const PSMARTRESIZING = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("master:smart_resizing");
eOrientation orientation = PWORKSPACEDATA->orientation; eOrientation orientation = PWORKSPACEDATA->orientation;
bool centered = orientation == ORIENTATION_CENTER && (*ALWAYSCENTER == 1); bool centered = orientation == ORIENTATION_CENTER && (**ALWAYSCENTER == 1);
double delta = 0; double delta = 0;
const bool DISPLAYBOTTOM = STICKS(PWINDOW->m_vPosition.y + PWINDOW->m_vSize.y, PMONITOR->vecPosition.y + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y); const bool DISPLAYBOTTOM = STICKS(PWINDOW->m_vPosition.y + PWINDOW->m_vSize.y, PMONITOR->vecPosition.y + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y);
@ -797,7 +797,7 @@ void CHyprMasterLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorne
const auto SIZE = isStackVertical ? WSSIZE.y / nodesInSameColumn : WSSIZE.x / nodesInSameColumn; const auto SIZE = isStackVertical ? WSSIZE.y / nodesInSameColumn : WSSIZE.x / nodesInSameColumn;
if (RESIZEDELTA != 0 && nodesInSameColumn > 1) { if (RESIZEDELTA != 0 && nodesInSameColumn > 1) {
if (!*PSMARTRESIZING) { if (!**PSMARTRESIZING) {
PNODE->percSize = std::clamp(PNODE->percSize + RESIZEDELTA / SIZE, 0.05, 1.95); PNODE->percSize = std::clamp(PNODE->percSize + RESIZEDELTA / SIZE, 0.05, 1.95);
} else { } else {
const auto NODEIT = std::find(m_lMasterNodesData.begin(), m_lMasterNodesData.end(), *PNODE); const auto NODEIT = std::find(m_lMasterNodesData.begin(), m_lMasterNodesData.end(), *PNODE);
@ -1055,8 +1055,8 @@ bool CHyprMasterLayout::prepareLoseFocus(CWindow* pWindow) {
//if the current window is fullscreen, make it normal again if we are about to lose focus //if the current window is fullscreen, make it normal again if we are about to lose focus
if (pWindow->m_bIsFullscreen) { if (pWindow->m_bIsFullscreen) {
g_pCompositor->setWindowFullscreen(pWindow, false, FULLSCREEN_FULL); g_pCompositor->setWindowFullscreen(pWindow, false, FULLSCREEN_FULL);
static auto* const INHERIT = &g_pConfigManager->getConfigValuePtr("master:inherit_fullscreen")->intValue; static auto* const INHERIT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("master:inherit_fullscreen");
return *INHERIT == 1; return **INHERIT == 1;
} }
return false; return false;
@ -1233,9 +1233,9 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
const auto WINDOWS = getNodesOnWorkspace(header.pWindow->m_iWorkspaceID); const auto WINDOWS = getNodesOnWorkspace(header.pWindow->m_iWorkspaceID);
const auto MASTERS = getMastersOnWorkspace(header.pWindow->m_iWorkspaceID); const auto MASTERS = getMastersOnWorkspace(header.pWindow->m_iWorkspaceID);
static const auto* SMALLSPLIT = &g_pConfigManager->getConfigValuePtr("master:allow_small_split")->intValue; static const auto* SMALLSPLIT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("master:allow_small_split");
if (MASTERS + 2 > WINDOWS && *SMALLSPLIT == 0) if (MASTERS + 2 > WINDOWS && **SMALLSPLIT == 0)
return 0; return 0;
prepareLoseFocus(header.pWindow); prepareLoseFocus(header.pWindow);

View File

@ -53,12 +53,12 @@ void CAnimationManager::tick() {
bool animGlobalDisabled = false; bool animGlobalDisabled = false;
static auto* const PANIMENABLED = &g_pConfigManager->getConfigValuePtr("animations:enabled")->intValue; static auto* const PANIMENABLED = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("animations:enabled");
if (!*PANIMENABLED) if (!**PANIMENABLED)
animGlobalDisabled = true; animGlobalDisabled = true;
static auto* const PSHADOWSENABLED = &g_pConfigManager->getConfigValuePtr("decoration:drop_shadow")->intValue; static auto* const PSHADOWSENABLED = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:drop_shadow");
const auto DEFAULTBEZIER = m_mBezierCurves.find("default"); const auto DEFAULTBEZIER = m_mBezierCurves.find("default");
@ -66,7 +66,7 @@ void CAnimationManager::tick() {
for (auto& av : m_vActiveAnimatedVariables) { for (auto& av : m_vActiveAnimatedVariables) {
if (av->m_eDamagePolicy == AVARDAMAGE_SHADOW && !*PSHADOWSENABLED) { if (av->m_eDamagePolicy == AVARDAMAGE_SHADOW && !**PSHADOWSENABLED) {
av->warp(false); av->warp(false);
animationEndedVars.push_back(av); animationEndedVars.push_back(av);
continue; continue;
@ -232,9 +232,9 @@ void CAnimationManager::tick() {
// TODO: move this to the border class // TODO: move this to the border class
// damage only the border. // damage only the border.
static auto* const PROUNDING = &g_pConfigManager->getConfigValuePtr("decoration:rounding")->intValue; const auto ROUNDING = PWINDOW->rounding();
const auto ROUNDINGSIZE = *PROUNDING + 1; const auto ROUNDINGSIZE = ROUNDING + 1;
const auto BORDERSIZE = PWINDOW->getRealBorderSize(); const auto BORDERSIZE = PWINDOW->getRealBorderSize();
// damage for old box // damage for old box
g_pHyprRenderer->damageBox(WLRBOXPREV.x - BORDERSIZE, WLRBOXPREV.y - BORDERSIZE, WLRBOXPREV.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // top g_pHyprRenderer->damageBox(WLRBOXPREV.x - BORDERSIZE, WLRBOXPREV.y - BORDERSIZE, WLRBOXPREV.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // top

View File

@ -164,19 +164,26 @@ void CKeybindManager::updateXKBTranslationState() {
m_pXKBTranslationState = nullptr; m_pXKBTranslationState = nullptr;
} }
const auto FILEPATH = g_pConfigManager->getString("input:kb_file"); static auto* const PFILEPATH = (Hyprlang::STRING const*)g_pConfigManager->getConfigValuePtr("input:kb_file");
const auto RULES = g_pConfigManager->getString("input:kb_rules"); static auto* const PRULES = (Hyprlang::STRING const*)g_pConfigManager->getConfigValuePtr("input:kb_rules");
const auto MODEL = g_pConfigManager->getString("input:kb_model"); static auto* const PMODEL = (Hyprlang::STRING const*)g_pConfigManager->getConfigValuePtr("input:kb_model");
const auto LAYOUT = g_pConfigManager->getString("input:kb_layout"); static auto* const PLAYOUT = (Hyprlang::STRING const*)g_pConfigManager->getConfigValuePtr("input:kb_layout");
const auto VARIANT = g_pConfigManager->getString("input:kb_variant"); static auto* const PVARIANT = (Hyprlang::STRING const*)g_pConfigManager->getConfigValuePtr("input:kb_variant");
const auto OPTIONS = g_pConfigManager->getString("input:kb_options"); static auto* const POPTIONS = (Hyprlang::STRING const*)g_pConfigManager->getConfigValuePtr("input:kb_options");
xkb_rule_names rules = {.rules = RULES.c_str(), .model = MODEL.c_str(), .layout = LAYOUT.c_str(), .variant = VARIANT.c_str(), .options = OPTIONS.c_str()}; const std::string FILEPATH = std::string{*PFILEPATH} == STRVAL_EMPTY ? "" : *PFILEPATH;
const auto PCONTEXT = xkb_context_new(XKB_CONTEXT_NO_FLAGS); const std::string RULES = std::string{*PRULES} == STRVAL_EMPTY ? "" : *PRULES;
FILE* const KEYMAPFILE = FILEPATH == "" ? NULL : fopen(absolutePath(FILEPATH, g_pConfigManager->configCurrentPath).c_str(), "r"); const std::string MODEL = std::string{*PMODEL} == STRVAL_EMPTY ? "" : *PMODEL;
const std::string LAYOUT = std::string{*PLAYOUT} == STRVAL_EMPTY ? "" : *PLAYOUT;
const std::string VARIANT = std::string{*PVARIANT} == STRVAL_EMPTY ? "" : *PVARIANT;
const std::string OPTIONS = std::string{*POPTIONS} == STRVAL_EMPTY ? "" : *POPTIONS;
auto PKEYMAP = KEYMAPFILE ? xkb_keymap_new_from_file(PCONTEXT, KEYMAPFILE, XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS) : xkb_rule_names rules = {.rules = RULES.c_str(), .model = MODEL.c_str(), .layout = LAYOUT.c_str(), .variant = VARIANT.c_str(), .options = OPTIONS.c_str()};
xkb_keymap_new_from_names(PCONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS); const auto PCONTEXT = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
FILE* const KEYMAPFILE = FILEPATH == "" ? NULL : fopen(absolutePath(FILEPATH, g_pConfigManager->configCurrentPath).c_str(), "r");
auto PKEYMAP = KEYMAPFILE ? xkb_keymap_new_from_file(PCONTEXT, KEYMAPFILE, XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS) :
xkb_keymap_new_from_names(PCONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);
if (KEYMAPFILE) if (KEYMAPFILE)
fclose(KEYMAPFILE); fclose(KEYMAPFILE);
@ -369,9 +376,9 @@ bool CKeybindManager::onKeyEvent(wlr_keyboard_key_event* e, SKeyboard* pKeyboard
bool CKeybindManager::onAxisEvent(wlr_pointer_axis_event* e) { bool CKeybindManager::onAxisEvent(wlr_pointer_axis_event* e) {
const auto MODS = g_pInputManager->accumulateModsFromAllKBs(); const auto MODS = g_pInputManager->accumulateModsFromAllKBs();
static auto* const PDELAY = &g_pConfigManager->getConfigValuePtr("binds:scroll_event_delay")->intValue; static auto* const PDELAY = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("binds:scroll_event_delay");
if (m_tScrollTimer.getMillis() < *PDELAY) { if (m_tScrollTimer.getMillis() < **PDELAY) {
m_tScrollTimer.reset(); m_tScrollTimer.reset();
return true; // timer hasn't passed yet! return true; // timer hasn't passed yet!
} }
@ -864,9 +871,9 @@ void CKeybindManager::changeworkspace(std::string args) {
// Workspace_back_and_forth being enabled means that an attempt to switch to // Workspace_back_and_forth being enabled means that an attempt to switch to
// the current workspace will instead switch to the previous. // the current workspace will instead switch to the previous.
static auto* const PBACKANDFORTH = &g_pConfigManager->getConfigValuePtr("binds:workspace_back_and_forth")->intValue; static auto* const PBACKANDFORTH = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("binds:workspace_back_and_forth");
static auto* const PALLOWWORKSPACECYCLES = &g_pConfigManager->getConfigValuePtr("binds:allow_workspace_cycles")->intValue; static auto* const PALLOWWORKSPACECYCLES = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("binds:allow_workspace_cycles");
static auto* const PWORKSPACECENTERON = &g_pConfigManager->getConfigValuePtr("binds:workspace_center_on")->intValue; static auto* const PWORKSPACECENTERON = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("binds:workspace_center_on");
const auto PMONITOR = g_pCompositor->m_pLastMonitor; const auto PMONITOR = g_pCompositor->m_pLastMonitor;
@ -901,7 +908,7 @@ void CKeybindManager::changeworkspace(std::string args) {
const bool BISWORKSPACECURRENT = workspaceToChangeTo == PCURRENTWORKSPACE->m_iID; const bool BISWORKSPACECURRENT = workspaceToChangeTo == PCURRENTWORKSPACE->m_iID;
if (BISWORKSPACECURRENT && (!(*PBACKANDFORTH || EXPLICITPREVIOUS) || PCURRENTWORKSPACE->m_sPrevWorkspace.iID == -1)) if (BISWORKSPACECURRENT && (!(**PBACKANDFORTH || EXPLICITPREVIOUS) || PCURRENTWORKSPACE->m_sPrevWorkspace.iID == -1))
return; return;
g_pInputManager->unconstrainMouse(); g_pInputManager->unconstrainMouse();
@ -933,14 +940,14 @@ void CKeybindManager::changeworkspace(std::string args) {
Vector2D middle = PMONITORWORKSPACEOWNER->middle(); Vector2D middle = PMONITORWORKSPACEOWNER->middle();
if (const auto PLAST = pWorkspaceToChangeTo->getLastFocusedWindow(); PLAST) { if (const auto PLAST = pWorkspaceToChangeTo->getLastFocusedWindow(); PLAST) {
g_pCompositor->focusWindow(PLAST); g_pCompositor->focusWindow(PLAST);
if (*PWORKSPACECENTERON == 1) if (**PWORKSPACECENTERON == 1)
middle = PLAST->middle(); middle = PLAST->middle();
} }
g_pCompositor->warpCursorTo(middle); g_pCompositor->warpCursorTo(middle);
} }
if (BISWORKSPACECURRENT) { if (BISWORKSPACECURRENT) {
if (*PALLOWWORKSPACECYCLES) if (**PALLOWWORKSPACECYCLES)
pWorkspaceToChangeTo->rememberPrevWorkspace(PCURRENTWORKSPACE); pWorkspaceToChangeTo->rememberPrevWorkspace(PCURRENTWORKSPACE);
else if (!EXPLICITPREVIOUS) else if (!EXPLICITPREVIOUS)
pWorkspaceToChangeTo->rememberPrevWorkspace(nullptr); pWorkspaceToChangeTo->rememberPrevWorkspace(nullptr);
@ -1001,7 +1008,7 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
auto pWorkspace = g_pCompositor->getWorkspaceByID(WORKSPACEID); auto pWorkspace = g_pCompositor->getWorkspaceByID(WORKSPACEID);
CMonitor* pMonitor = nullptr; CMonitor* pMonitor = nullptr;
const auto POLDWS = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID); const auto POLDWS = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID);
static auto* const PALLOWWORKSPACECYCLES = &g_pConfigManager->getConfigValuePtr("binds:allow_workspace_cycles")->intValue; static auto* const PALLOWWORKSPACECYCLES = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("binds:allow_workspace_cycles");
g_pHyprRenderer->damageWindow(PWINDOW); g_pHyprRenderer->damageWindow(PWINDOW);
@ -1027,7 +1034,7 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
g_pCompositor->focusWindow(PWINDOW); g_pCompositor->focusWindow(PWINDOW);
g_pCompositor->warpCursorTo(PWINDOW->middle()); g_pCompositor->warpCursorTo(PWINDOW->middle());
if (*PALLOWWORKSPACECYCLES) if (**PALLOWWORKSPACECYCLES)
pWorkspace->rememberPrevWorkspace(POLDWS); pWorkspace->rememberPrevWorkspace(POLDWS);
} }
@ -1079,7 +1086,7 @@ void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
} }
void CKeybindManager::moveFocusTo(std::string args) { void CKeybindManager::moveFocusTo(std::string args) {
static auto* const PFULLCYCLE = &g_pConfigManager->getConfigValuePtr("binds:movefocus_cycles_fullscreen")->intValue; static auto* const PFULLCYCLE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("binds:movefocus_cycles_fullscreen");
char arg = args[0]; char arg = args[0];
if (!isDirection(args)) { if (!isDirection(args)) {
@ -1096,7 +1103,7 @@ void CKeybindManager::moveFocusTo(std::string args) {
// remove constraints // remove constraints
g_pInputManager->unconstrainMouse(); g_pInputManager->unconstrainMouse();
const auto PWINDOWTOCHANGETO = *PFULLCYCLE && PLASTWINDOW->m_bIsFullscreen ? const auto PWINDOWTOCHANGETO = **PFULLCYCLE && PLASTWINDOW->m_bIsFullscreen ?
(arg == 'd' || arg == 'b' || arg == 'r' ? g_pCompositor->getNextWindowOnWorkspace(PLASTWINDOW, true) : g_pCompositor->getPrevWindowOnWorkspace(PLASTWINDOW, true)) : (arg == 'd' || arg == 'b' || arg == 'r' ? g_pCompositor->getNextWindowOnWorkspace(PLASTWINDOW, true) : g_pCompositor->getPrevWindowOnWorkspace(PLASTWINDOW, true)) :
g_pCompositor->getWindowInDirection(PLASTWINDOW, arg); g_pCompositor->getWindowInDirection(PLASTWINDOW, arg);
@ -1111,8 +1118,8 @@ void CKeybindManager::moveFocusTo(std::string args) {
if (tryMoveFocusToMonitor(g_pCompositor->getMonitorInDirection(arg))) if (tryMoveFocusToMonitor(g_pCompositor->getMonitorInDirection(arg)))
return; return;
static auto* const PNOFALLBACK = &g_pConfigManager->getConfigValuePtr("general:no_focus_fallback")->intValue; static auto* const PNOFALLBACK = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:no_focus_fallback");
if (*PNOFALLBACK) if (**PNOFALLBACK)
return; return;
Debug::log(LOG, "No monitor found in direction {}, falling back to next window on current workspace", arg); Debug::log(LOG, "No monitor found in direction {}, falling back to next window on current workspace", arg);
@ -1570,7 +1577,7 @@ void CKeybindManager::focusWorkspaceOnCurrentMonitor(std::string args) {
void CKeybindManager::toggleSpecialWorkspace(std::string args) { void CKeybindManager::toggleSpecialWorkspace(std::string args) {
static auto* const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue; static auto* const PFOLLOWMOUSE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("input:follow_mouse");
std::string workspaceName = ""; std::string workspaceName = "";
int workspaceID = getWorkspaceIDFromString("special:" + args, workspaceName); int workspaceID = getWorkspaceIDFromString("special:" + args, workspaceName);
@ -1581,7 +1588,7 @@ void CKeybindManager::toggleSpecialWorkspace(std::string args) {
} }
bool requestedWorkspaceIsAlreadyOpen = false; bool requestedWorkspaceIsAlreadyOpen = false;
const auto PMONITOR = *PFOLLOWMOUSE == 1 ? g_pCompositor->getMonitorFromCursor() : g_pCompositor->m_pLastMonitor; const auto PMONITOR = **PFOLLOWMOUSE == 1 ? g_pCompositor->getMonitorFromCursor() : g_pCompositor->m_pLastMonitor;
int specialOpenOnMonitor = PMONITOR->specialWorkspaceID; int specialOpenOnMonitor = PMONITOR->specialWorkspaceID;
for (auto& m : g_pCompositor->m_vMonitors) { for (auto& m : g_pCompositor->m_vMonitors) {
@ -2093,8 +2100,8 @@ void CKeybindManager::moveWindowIntoGroup(CWindow* pWindow, CWindow* pWindowInDi
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow); // This removes groupped property! g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow); // This removes groupped property!
static const auto* USECURRPOS = &g_pConfigManager->getConfigValuePtr("group:insert_after_current")->intValue; static const auto* USECURRPOS = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:insert_after_current");
pWindowInDirection = *USECURRPOS ? pWindowInDirection : pWindowInDirection->getGroupTail(); pWindowInDirection = **USECURRPOS ? pWindowInDirection : pWindowInDirection->getGroupTail();
pWindowInDirection->insertWindowToGroup(pWindow); pWindowInDirection->insertWindowToGroup(pWindow);
pWindowInDirection->setGroupCurrent(pWindow); pWindowInDirection->setGroupCurrent(pWindow);
@ -2108,7 +2115,7 @@ void CKeybindManager::moveWindowIntoGroup(CWindow* pWindow, CWindow* pWindowInDi
} }
void CKeybindManager::moveWindowOutOfGroup(CWindow* pWindow, const std::string& dir) { void CKeybindManager::moveWindowOutOfGroup(CWindow* pWindow, const std::string& dir) {
static auto* const BFOCUSREMOVEDWINDOW = &g_pConfigManager->getConfigValuePtr("group:focus_removed_window")->intValue; static auto* const BFOCUSREMOVEDWINDOW = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:focus_removed_window");
const auto PWINDOWPREV = pWindow->getGroupPrevious(); const auto PWINDOWPREV = pWindow->getGroupPrevious();
eDirection direction; eDirection direction;
@ -2135,7 +2142,7 @@ void CKeybindManager::moveWindowOutOfGroup(CWindow* pWindow, const std::string&
g_pKeybindManager->m_bGroupsLocked = GROUPSLOCKEDPREV; g_pKeybindManager->m_bGroupsLocked = GROUPSLOCKEDPREV;
} }
if (*BFOCUSREMOVEDWINDOW) { if (**BFOCUSREMOVEDWINDOW) {
g_pCompositor->focusWindow(pWindow); g_pCompositor->focusWindow(pWindow);
g_pCompositor->warpCursorTo(pWindow->middle()); g_pCompositor->warpCursorTo(pWindow->middle());
} else { } else {
@ -2147,9 +2154,9 @@ void CKeybindManager::moveWindowOutOfGroup(CWindow* pWindow, const std::string&
void CKeybindManager::moveIntoGroup(std::string args) { void CKeybindManager::moveIntoGroup(std::string args) {
char arg = args[0]; char arg = args[0];
static auto* const PIGNOREGROUPLOCK = &g_pConfigManager->getConfigValuePtr("binds:ignore_group_lock")->intValue; static auto* const PIGNOREGROUPLOCK = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("binds:ignore_group_lock");
if (!*PIGNOREGROUPLOCK && g_pKeybindManager->m_bGroupsLocked) if (!**PIGNOREGROUPLOCK && g_pKeybindManager->m_bGroupsLocked)
return; return;
if (!isDirection(args)) { if (!isDirection(args)) {
@ -2168,16 +2175,16 @@ void CKeybindManager::moveIntoGroup(std::string args) {
return; return;
// Do not move window into locked group if binds:ignore_group_lock is false // Do not move window into locked group if binds:ignore_group_lock is false
if (!*PIGNOREGROUPLOCK && (PWINDOWINDIR->getGroupHead()->m_sGroupData.locked || (PWINDOW->m_sGroupData.pNextWindow && PWINDOW->getGroupHead()->m_sGroupData.locked))) if (!**PIGNOREGROUPLOCK && (PWINDOWINDIR->getGroupHead()->m_sGroupData.locked || (PWINDOW->m_sGroupData.pNextWindow && PWINDOW->getGroupHead()->m_sGroupData.locked)))
return; return;
moveWindowIntoGroup(PWINDOW, PWINDOWINDIR); moveWindowIntoGroup(PWINDOW, PWINDOWINDIR);
} }
void CKeybindManager::moveOutOfGroup(std::string args) { void CKeybindManager::moveOutOfGroup(std::string args) {
static auto* const PIGNOREGROUPLOCK = &g_pConfigManager->getConfigValuePtr("binds:ignore_group_lock")->intValue; static auto* const PIGNOREGROUPLOCK = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("binds:ignore_group_lock");
if (!*PIGNOREGROUPLOCK && g_pKeybindManager->m_bGroupsLocked) if (!**PIGNOREGROUPLOCK && g_pKeybindManager->m_bGroupsLocked)
return; return;
CWindow* PWINDOW = nullptr; CWindow* PWINDOW = nullptr;
@ -2196,7 +2203,7 @@ void CKeybindManager::moveOutOfGroup(std::string args) {
void CKeybindManager::moveWindowOrGroup(std::string args) { void CKeybindManager::moveWindowOrGroup(std::string args) {
char arg = args[0]; char arg = args[0];
static auto* const PIGNOREGROUPLOCK = &g_pConfigManager->getConfigValuePtr("binds:ignore_group_lock")->intValue; static auto* const PIGNOREGROUPLOCK = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("binds:ignore_group_lock");
if (!isDirection(args)) { if (!isDirection(args)) {
Debug::log(ERR, "Cannot move into group in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg); Debug::log(ERR, "Cannot move into group in direction {}, unsupported direction. Supported: l,r,u/t,d/b", arg);
@ -2207,7 +2214,7 @@ void CKeybindManager::moveWindowOrGroup(std::string args) {
if (!PWINDOW || PWINDOW->m_bIsFullscreen) if (!PWINDOW || PWINDOW->m_bIsFullscreen)
return; return;
if (!*PIGNOREGROUPLOCK && g_pKeybindManager->m_bGroupsLocked) { if (!**PIGNOREGROUPLOCK && g_pKeybindManager->m_bGroupsLocked) {
g_pLayoutManager->getCurrentLayout()->moveWindowTo(PWINDOW, args); g_pLayoutManager->getCurrentLayout()->moveWindowTo(PWINDOW, args);
return; return;
} }
@ -2220,13 +2227,13 @@ void CKeybindManager::moveWindowOrGroup(std::string args) {
// note: PWINDOWINDIR is not null implies !PWINDOW->m_bIsFloating // note: PWINDOWINDIR is not null implies !PWINDOW->m_bIsFloating
if (PWINDOWINDIR && PWINDOWINDIR->m_sGroupData.pNextWindow) { // target is group if (PWINDOWINDIR && PWINDOWINDIR->m_sGroupData.pNextWindow) { // target is group
if (!*PIGNOREGROUPLOCK && (PWINDOWINDIR->getGroupHead()->m_sGroupData.locked || ISWINDOWGROUPLOCKED || PWINDOW->m_sGroupData.deny)) { if (!**PIGNOREGROUPLOCK && (PWINDOWINDIR->getGroupHead()->m_sGroupData.locked || ISWINDOWGROUPLOCKED || PWINDOW->m_sGroupData.deny)) {
g_pLayoutManager->getCurrentLayout()->moveWindowTo(PWINDOW, args); g_pLayoutManager->getCurrentLayout()->moveWindowTo(PWINDOW, args);
g_pCompositor->warpCursorTo(PWINDOW->middle()); g_pCompositor->warpCursorTo(PWINDOW->middle());
} else } else
moveWindowIntoGroup(PWINDOW, PWINDOWINDIR); moveWindowIntoGroup(PWINDOW, PWINDOWINDIR);
} else if (PWINDOWINDIR) { // target is regular window } else if (PWINDOWINDIR) { // target is regular window
if ((!*PIGNOREGROUPLOCK && ISWINDOWGROUPLOCKED) || !ISWINDOWGROUP || (ISWINDOWGROUPSINGLE && PWINDOW->m_eGroupRules & GROUP_SET_ALWAYS)) { if ((!**PIGNOREGROUPLOCK && ISWINDOWGROUPLOCKED) || !ISWINDOWGROUP || (ISWINDOWGROUPSINGLE && PWINDOW->m_eGroupRules & GROUP_SET_ALWAYS)) {
g_pLayoutManager->getCurrentLayout()->moveWindowTo(PWINDOW, args); g_pLayoutManager->getCurrentLayout()->moveWindowTo(PWINDOW, args);
g_pCompositor->warpCursorTo(PWINDOW->middle()); g_pCompositor->warpCursorTo(PWINDOW->middle());
} else } else
@ -2238,14 +2245,14 @@ void CKeybindManager::moveWindowOrGroup(std::string args) {
} }
void CKeybindManager::setIgnoreGroupLock(std::string args) { void CKeybindManager::setIgnoreGroupLock(std::string args) {
static auto* const BIGNOREGROUPLOCK = &g_pConfigManager->getConfigValuePtr("binds:ignore_group_lock")->intValue; static auto* const BIGNOREGROUPLOCK = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("binds:ignore_group_lock");
if (args == "toggle") if (args == "toggle")
*BIGNOREGROUPLOCK = !*BIGNOREGROUPLOCK; **BIGNOREGROUPLOCK = !*BIGNOREGROUPLOCK;
else else
*BIGNOREGROUPLOCK = args == "on"; **BIGNOREGROUPLOCK = args == "on";
g_pEventManager->postEvent(SHyprIPCEvent{"ignoregrouplock", std::to_string(*BIGNOREGROUPLOCK)}); g_pEventManager->postEvent(SHyprIPCEvent{"ignoregrouplock", std::to_string(**BIGNOREGROUPLOCK)});
} }
void CKeybindManager::denyWindowFromGroup(std::string args) { void CKeybindManager::denyWindowFromGroup(std::string args) {

View File

@ -44,9 +44,9 @@ static void handleSurfaceDestroy(void* owner, void* data) {
void CSessionLockManager::onNewSessionLock(wlr_session_lock_v1* pWlrLock) { void CSessionLockManager::onNewSessionLock(wlr_session_lock_v1* pWlrLock) {
static auto* const PALLOWRELOCK = &g_pConfigManager->getConfigValuePtr("misc:allow_session_lock_restore")->intValue; static auto* const PALLOWRELOCK = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:allow_session_lock_restore");
if (m_sSessionLock.active && (!*PALLOWRELOCK || m_sSessionLock.pWlrLock)) { if (m_sSessionLock.active && (!**PALLOWRELOCK || m_sSessionLock.pWlrLock)) {
Debug::log(LOG, "Attempted to lock a locked session!"); Debug::log(LOG, "Attempted to lock a locked session!");
wlr_session_lock_v1_destroy(pWlrLock); wlr_session_lock_v1_destroy(pWlrLock);
return; return;

View File

@ -7,9 +7,9 @@ int slowUpdate = 0;
int handleTimer(void* data) { int handleTimer(void* data) {
const auto PTM = (CThreadManager*)data; const auto PTM = (CThreadManager*)data;
static auto* const PDISABLECFGRELOAD = &g_pConfigManager->getConfigValuePtr("misc:disable_autoreload")->intValue; static auto* const PDISABLECFGRELOAD = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:disable_autoreload");
if (*PDISABLECFGRELOAD != 1) if (**PDISABLECFGRELOAD != 1)
g_pConfigManager->tick(); g_pConfigManager->tick();
wl_event_source_timer_update(PTM->m_esConfigTimer, 1000); wl_event_source_timer_update(PTM->m_esConfigTimer, 1000);

View File

@ -147,7 +147,7 @@ void CHyprXWaylandManager::sendCloseWindow(CWindow* pWindow) {
void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, Vector2D size, bool force) { void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, Vector2D size, bool force) {
static auto* const PXWLFORCESCALEZERO = &g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling")->intValue; static auto* const PXWLFORCESCALEZERO = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling");
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID); const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
@ -159,7 +159,7 @@ void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, Vector2D size, bool f
if (pWindow->m_bIsX11 && PMONITOR) { if (pWindow->m_bIsX11 && PMONITOR) {
windowPos = windowPos - PMONITOR->vecPosition; // normalize to monitor windowPos = windowPos - PMONITOR->vecPosition; // normalize to monitor
if (*PXWLFORCESCALEZERO) if (**PXWLFORCESCALEZERO)
windowPos = windowPos * PMONITOR->scale; // scale if applicable windowPos = windowPos * PMONITOR->scale; // scale if applicable
windowPos = windowPos + PMONITOR->vecXWaylandPosition; // move to correct position for xwayland windowPos = windowPos + PMONITOR->vecXWaylandPosition; // move to correct position for xwayland
} }
@ -172,7 +172,7 @@ void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, Vector2D size, bool f
pWindow->m_fX11SurfaceScaledBy = 1.f; pWindow->m_fX11SurfaceScaledBy = 1.f;
if (*PXWLFORCESCALEZERO && pWindow->m_bIsX11 && PMONITOR) { if (**PXWLFORCESCALEZERO && pWindow->m_bIsX11 && PMONITOR) {
size = size * PMONITOR->scale; size = size * PMONITOR->scale;
pWindow->m_fX11SurfaceScaledBy = PMONITOR->scale; pWindow->m_fX11SurfaceScaledBy = PMONITOR->scale;
} }
@ -317,12 +317,12 @@ Vector2D CHyprXWaylandManager::getMaxSizeForWindow(CWindow* pWindow) {
Vector2D CHyprXWaylandManager::xwaylandToWaylandCoords(const Vector2D& coord) { Vector2D CHyprXWaylandManager::xwaylandToWaylandCoords(const Vector2D& coord) {
static auto* const PXWLFORCESCALEZERO = &g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling")->intValue; static auto* const PXWLFORCESCALEZERO = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling");
CMonitor* pMonitor = nullptr; CMonitor* pMonitor = nullptr;
double bestDistance = __FLT_MAX__; double bestDistance = __FLT_MAX__;
for (auto& m : g_pCompositor->m_vMonitors) { for (auto& m : g_pCompositor->m_vMonitors) {
const auto SIZ = *PXWLFORCESCALEZERO ? m->vecTransformedSize : m->vecSize; const auto SIZ = **PXWLFORCESCALEZERO ? m->vecTransformedSize : m->vecSize;
double distance = double distance =
vecToRectDistanceSquared(coord, {m->vecXWaylandPosition.x, m->vecXWaylandPosition.y}, {m->vecXWaylandPosition.x + SIZ.x - 1, m->vecXWaylandPosition.y + SIZ.y - 1}); vecToRectDistanceSquared(coord, {m->vecXWaylandPosition.x, m->vecXWaylandPosition.y}, {m->vecXWaylandPosition.x + SIZ.x - 1, m->vecXWaylandPosition.y + SIZ.y - 1});
@ -339,7 +339,7 @@ Vector2D CHyprXWaylandManager::xwaylandToWaylandCoords(const Vector2D& coord) {
// get local coords // get local coords
Vector2D result = coord - pMonitor->vecXWaylandPosition; Vector2D result = coord - pMonitor->vecXWaylandPosition;
// if scaled, unscale // if scaled, unscale
if (*PXWLFORCESCALEZERO) if (**PXWLFORCESCALEZERO)
result = result / pMonitor->scale; result = result / pMonitor->scale;
// add pos // add pos
result = result + pMonitor->vecPosition; result = result + pMonitor->vecPosition;

View File

@ -16,20 +16,20 @@ CInputManager::~CInputManager() {
} }
void CInputManager::onMouseMoved(wlr_pointer_motion_event* e) { void CInputManager::onMouseMoved(wlr_pointer_motion_event* e) {
static auto* const PSENS = &g_pConfigManager->getConfigValuePtr("general:sensitivity")->floatValue; static auto* const PSENS = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("general:sensitivity");
static auto* const PNOACCEL = &g_pConfigManager->getConfigValuePtr("input:force_no_accel")->intValue; static auto* const PNOACCEL = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("input:force_no_accel");
static auto* const PSENSTORAW = &g_pConfigManager->getConfigValuePtr("general:apply_sens_to_raw")->intValue; static auto* const PSENSTORAW = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:apply_sens_to_raw");
const auto DELTA = *PNOACCEL == 1 ? Vector2D(e->unaccel_dx, e->unaccel_dy) : Vector2D(e->delta_x, e->delta_y); const auto DELTA = **PNOACCEL == 1 ? Vector2D(e->unaccel_dx, e->unaccel_dy) : Vector2D(e->delta_x, e->delta_y);
if (*PSENSTORAW == 1) if (**PSENSTORAW == 1)
wlr_relative_pointer_manager_v1_send_relative_motion(g_pCompositor->m_sWLRRelPointerMgr, g_pCompositor->m_sSeat.seat, (uint64_t)e->time_msec * 1000, DELTA.x * *PSENS, wlr_relative_pointer_manager_v1_send_relative_motion(g_pCompositor->m_sWLRRelPointerMgr, g_pCompositor->m_sSeat.seat, (uint64_t)e->time_msec * 1000, DELTA.x * **PSENS,
DELTA.y * *PSENS, e->unaccel_dx * *PSENS, e->unaccel_dy * *PSENS); DELTA.y * **PSENS, e->unaccel_dx * **PSENS, e->unaccel_dy * **PSENS);
else else
wlr_relative_pointer_manager_v1_send_relative_motion(g_pCompositor->m_sWLRRelPointerMgr, g_pCompositor->m_sSeat.seat, (uint64_t)e->time_msec * 1000, DELTA.x, DELTA.y, wlr_relative_pointer_manager_v1_send_relative_motion(g_pCompositor->m_sWLRRelPointerMgr, g_pCompositor->m_sSeat.seat, (uint64_t)e->time_msec * 1000, DELTA.x, DELTA.y,
e->unaccel_dx, e->unaccel_dy); e->unaccel_dx, e->unaccel_dy);
wlr_cursor_move(g_pCompositor->m_sWLRCursor, &e->pointer->base, DELTA.x * *PSENS, DELTA.y * *PSENS); wlr_cursor_move(g_pCompositor->m_sWLRCursor, &e->pointer->base, DELTA.x * **PSENS, DELTA.y * **PSENS);
mouseMoveUnified(e->time_msec); mouseMoveUnified(e->time_msec);
@ -73,17 +73,17 @@ void CInputManager::sendMotionEventsToFocused() {
} }
void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
static auto* const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue; static auto* const PFOLLOWMOUSE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("input:follow_mouse");
static auto* const PMOUSEREFOCUS = &g_pConfigManager->getConfigValuePtr("input:mouse_refocus")->intValue; static auto* const PMOUSEREFOCUS = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("input:mouse_refocus");
static auto* const PMOUSEDPMS = &g_pConfigManager->getConfigValuePtr("misc:mouse_move_enables_dpms")->intValue; static auto* const PMOUSEDPMS = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:mouse_move_enables_dpms");
static auto* const PFOLLOWONDND = &g_pConfigManager->getConfigValuePtr("misc:always_follow_on_dnd")->intValue; static auto* const PFOLLOWONDND = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:always_follow_on_dnd");
static auto* const PFLOATBEHAVIOR = &g_pConfigManager->getConfigValuePtr("input:float_switch_override_focus")->intValue; static auto* const PFLOATBEHAVIOR = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("input:float_switch_override_focus");
static auto* const PMOUSEFOCUSMON = &g_pConfigManager->getConfigValuePtr("misc:mouse_move_focuses_monitor")->intValue; static auto* const PMOUSEFOCUSMON = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:mouse_move_focuses_monitor");
static auto* const PRESIZEONBORDER = &g_pConfigManager->getConfigValuePtr("general:resize_on_border")->intValue; static auto* const PRESIZEONBORDER = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:resize_on_border");
static auto* const PRESIZECURSORICON = &g_pConfigManager->getConfigValuePtr("general:hover_icon_on_border")->intValue; static auto* const PRESIZECURSORICON = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:hover_icon_on_border");
static auto* const PZOOMFACTOR = &g_pConfigManager->getConfigValuePtr("misc:cursor_zoom_factor")->floatValue; static auto* const PZOOMFACTOR = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("misc:cursor_zoom_factor");
const auto FOLLOWMOUSE = *PFOLLOWONDND && m_sDrag.drag ? 1 : *PFOLLOWMOUSE; const auto FOLLOWMOUSE = **PFOLLOWONDND && m_sDrag.drag ? 1 : **PFOLLOWMOUSE;
m_pFoundSurfaceToFocus = nullptr; m_pFoundSurfaceToFocus = nullptr;
m_pFoundLSToFocus = nullptr; m_pFoundLSToFocus = nullptr;
@ -97,7 +97,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
if (!g_pCompositor->m_bReadyToProcess || g_pCompositor->m_bIsShuttingDown || g_pCompositor->m_bUnsafeState) if (!g_pCompositor->m_bReadyToProcess || g_pCompositor->m_bIsShuttingDown || g_pCompositor->m_bUnsafeState)
return; return;
if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS) { if (!g_pCompositor->m_bDPMSStateON && **PMOUSEDPMS) {
// enable dpms // enable dpms
g_pKeybindManager->dpms("on"); g_pKeybindManager->dpms("on");
} }
@ -121,7 +121,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
if (PMONITOR == nullptr) if (PMONITOR == nullptr)
return; return;
if (*PZOOMFACTOR != 1.f) if (**PZOOMFACTOR != 1.f)
g_pHyprRenderer->damageMonitor(PMONITOR); g_pHyprRenderer->damageMonitor(PMONITOR);
if (!PMONITOR->solitaryClient && g_pHyprRenderer->shouldRenderCursor() && PMONITOR->output->software_cursor_locks > 0) if (!PMONITOR->solitaryClient && g_pHyprRenderer->shouldRenderCursor() && PMONITOR->output->software_cursor_locks > 0)
@ -220,7 +220,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
g_pLayoutManager->getCurrentLayout()->onMouseMove(getMouseCoordsInternal()); g_pLayoutManager->getCurrentLayout()->onMouseMove(getMouseCoordsInternal());
if (PMONITOR && PMONITOR != g_pCompositor->m_pLastMonitor && (*PMOUSEFOCUSMON || refocus)) if (PMONITOR && PMONITOR != g_pCompositor->m_pLastMonitor && (**PMOUSEFOCUSMON || refocus))
g_pCompositor->setActiveMonitor(PMONITOR); g_pCompositor->setActiveMonitor(PMONITOR);
if (g_pSessionLockManager->isSessionLocked()) { if (g_pSessionLockManager->isSessionLocked()) {
@ -320,7 +320,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
if (!foundSurface) { if (!foundSurface) {
if (!m_bEmptyFocusCursorSet) { if (!m_bEmptyFocusCursorSet) {
if (*PRESIZEONBORDER && *PRESIZECURSORICON && m_eBorderIconDirection != BORDERICON_NONE) { if (**PRESIZEONBORDER && **PRESIZECURSORICON && m_eBorderIconDirection != BORDERICON_NONE) {
m_eBorderIconDirection = BORDERICON_NONE; m_eBorderIconDirection = BORDERICON_NONE;
unsetCursorImage(); unsetCursorImage();
} }
@ -390,7 +390,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
if (pFoundWindow) { if (pFoundWindow) {
// change cursor icon if hovering over border // change cursor icon if hovering over border
if (*PRESIZEONBORDER && *PRESIZECURSORICON) { if (**PRESIZEONBORDER && **PRESIZECURSORICON) {
if (!pFoundWindow->m_bIsFullscreen && !pFoundWindow->hasPopupAt(mouseCoords)) { if (!pFoundWindow->m_bIsFullscreen && !pFoundWindow->hasPopupAt(mouseCoords)) {
setCursorIconOnBorder(pFoundWindow); setCursorIconOnBorder(pFoundWindow);
} else if (m_eBorderIconDirection != BORDERICON_NONE) { } else if (m_eBorderIconDirection != BORDERICON_NONE) {
@ -400,7 +400,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
if (FOLLOWMOUSE != 1 && !refocus) { if (FOLLOWMOUSE != 1 && !refocus) {
if (pFoundWindow != g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow && if (pFoundWindow != g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow &&
((pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR == 2) || (g_pCompositor->m_pLastWindow->m_bIsFloating != pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR != 0))) { ((pFoundWindow->m_bIsFloating && **PFLOATBEHAVIOR == 2) || (g_pCompositor->m_pLastWindow->m_bIsFloating != pFoundWindow->m_bIsFloating && **PFLOATBEHAVIOR != 0))) {
// enter if change floating style // enter if change floating style
if (FOLLOWMOUSE != 3 && allowKeyboardRefocus) if (FOLLOWMOUSE != 3 && allowKeyboardRefocus)
g_pCompositor->focusWindow(pFoundWindow, foundSurface); g_pCompositor->focusWindow(pFoundWindow, foundSurface);
@ -438,7 +438,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
m_bLastFocusOnLS = false; m_bLastFocusOnLS = false;
} else { } else {
if (*PRESIZEONBORDER && *PRESIZECURSORICON && m_eBorderIconDirection != BORDERICON_NONE) { if (**PRESIZEONBORDER && **PRESIZECURSORICON && m_eBorderIconDirection != BORDERICON_NONE) {
m_eBorderIconDirection = BORDERICON_NONE; m_eBorderIconDirection = BORDERICON_NONE;
unsetCursorImage(); unsetCursorImage();
} }
@ -605,15 +605,15 @@ void CInputManager::setClickMode(eClickBehaviorMode mode) {
void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) { void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) {
// notify the keybind manager // notify the keybind manager
static auto* const PPASSMOUSE = &g_pConfigManager->getConfigValuePtr("binds:pass_mouse_when_bound")->intValue; static auto* const PPASSMOUSE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("binds:pass_mouse_when_bound");
const auto PASS = g_pKeybindManager->onMouseEvent(e); const auto PASS = g_pKeybindManager->onMouseEvent(e);
static auto* const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue; static auto* const PFOLLOWMOUSE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("input:follow_mouse");
static auto* const PRESIZEONBORDER = &g_pConfigManager->getConfigValuePtr("general:resize_on_border")->intValue; static auto* const PRESIZEONBORDER = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:resize_on_border");
static auto* const PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue; static auto* const PBORDERSIZE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:border_size");
static auto* const PBORDERGRABEXTEND = &g_pConfigManager->getConfigValuePtr("general:extend_border_grab_area")->intValue; static auto* const PBORDERGRABEXTEND = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:extend_border_grab_area");
const auto BORDER_GRAB_AREA = *PRESIZEONBORDER ? *PBORDERSIZE + *PBORDERGRABEXTEND : 0; const auto BORDER_GRAB_AREA = **PRESIZEONBORDER ? **PBORDERSIZE + **PBORDERGRABEXTEND : 0;
if (!PASS && !*PPASSMOUSE) if (!PASS && !**PPASSMOUSE)
return; return;
const auto mouseCoords = g_pInputManager->getMouseCoordsInternal(); const auto mouseCoords = g_pInputManager->getMouseCoordsInternal();
@ -624,7 +624,7 @@ void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) {
// clicking on border triggers resize // clicking on border triggers resize
// TODO detect click on LS properly // TODO detect click on LS properly
if (*PRESIZEONBORDER && !m_bLastFocusOnLS && e->state == WLR_BUTTON_PRESSED) { if (**PRESIZEONBORDER && !m_bLastFocusOnLS && e->state == WLR_BUTTON_PRESSED) {
if (w && !w->m_bIsFullscreen) { if (w && !w->m_bIsFullscreen) {
const CBox real = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; const CBox real = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
const CBox grab = {real.x - BORDER_GRAB_AREA, real.y - BORDER_GRAB_AREA, real.width + 2 * BORDER_GRAB_AREA, real.height + 2 * BORDER_GRAB_AREA}; const CBox grab = {real.x - BORDER_GRAB_AREA, real.y - BORDER_GRAB_AREA, real.width + 2 * BORDER_GRAB_AREA, real.height + 2 * BORDER_GRAB_AREA};
@ -638,7 +638,7 @@ void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) {
switch (e->state) { switch (e->state) {
case WLR_BUTTON_PRESSED: case WLR_BUTTON_PRESSED:
if (*PFOLLOWMOUSE == 3) // don't refocus on full loose if (**PFOLLOWMOUSE == 3) // don't refocus on full loose
break; break;
if ((!g_pCompositor->m_sSeat.mouse || !g_pCompositor->m_sSeat.mouse->currentConstraint) /* No constraints */ if ((!g_pCompositor->m_sSeat.mouse || !g_pCompositor->m_sSeat.mouse->currentConstraint) /* No constraints */
@ -693,9 +693,9 @@ void CInputManager::processMouseDownKill(wlr_pointer_button_event* e) {
} }
void CInputManager::onMouseWheel(wlr_pointer_axis_event* e) { void CInputManager::onMouseWheel(wlr_pointer_axis_event* e) {
static auto* const PSCROLLFACTOR = &g_pConfigManager->getConfigValuePtr("input:touchpad:scroll_factor")->floatValue; static auto* const PSCROLLFACTOR = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("input:touchpad:scroll_factor");
auto factor = (*PSCROLLFACTOR <= 0.f || e->source != WLR_AXIS_SOURCE_FINGER ? 1.f : *PSCROLLFACTOR); auto factor = (**PSCROLLFACTOR <= 0.f || e->source != WLR_AXIS_SOURCE_FINGER ? 1.f : **PSCROLLFACTOR);
const auto EMAP = std::unordered_map<std::string, std::any>{{"event", e}}; const auto EMAP = std::unordered_map<std::string, std::any>{{"event", e}};
EMIT_HOOK_EVENT_CANCELLABLE("mouseAxis", EMAP); EMIT_HOOK_EVENT_CANCELLABLE("mouseAxis", EMAP);
@ -1182,8 +1182,8 @@ void CInputManager::onKeyboardKey(wlr_keyboard_key_event* e, SKeyboard* pKeyboar
const auto EMAP = std::unordered_map<std::string, std::any>{{"keyboard", pKeyboard}, {"event", e}}; const auto EMAP = std::unordered_map<std::string, std::any>{{"keyboard", pKeyboard}, {"event", e}};
EMIT_HOOK_EVENT_CANCELLABLE("keyPress", EMAP); EMIT_HOOK_EVENT_CANCELLABLE("keyPress", EMAP);
static auto* const PDPMS = &g_pConfigManager->getConfigValuePtr("misc:key_press_enables_dpms")->intValue; static auto* const PDPMS = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:key_press_enables_dpms");
if (*PDPMS && !g_pCompositor->m_bDPMSStateON) { if (**PDPMS && !g_pCompositor->m_bDPMSStateON) {
// enable dpms // enable dpms
g_pKeybindManager->dpms("on"); g_pKeybindManager->dpms("on");
} }
@ -1675,17 +1675,17 @@ void CInputManager::setCursorIconOnBorder(CWindow* w) {
return; return;
} }
static auto* const PROUNDING = &g_pConfigManager->getConfigValuePtr("decoration:rounding")->intValue; static auto* const PEXTENDBORDERGRAB = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:extend_border_grab_area");
static const auto* PEXTENDBORDERGRAB = &g_pConfigManager->getConfigValuePtr("general:extend_border_grab_area")->intValue;
const int BORDERSIZE = w->getRealBorderSize(); const int BORDERSIZE = w->getRealBorderSize();
const int ROUNDING = w->rounding();
// give a small leeway (10 px) for corner icon // give a small leeway (10 px) for corner icon
const auto CORNER = *PROUNDING + BORDERSIZE + 10; const auto CORNER = ROUNDING + BORDERSIZE + 10;
const auto mouseCoords = getMouseCoordsInternal(); const auto mouseCoords = getMouseCoordsInternal();
CBox box = w->getWindowMainSurfaceBox(); CBox box = w->getWindowMainSurfaceBox();
eBorderIconDirection direction = BORDERICON_NONE; eBorderIconDirection direction = BORDERICON_NONE;
CBox boxFullGrabInput = {box.x - *PEXTENDBORDERGRAB - BORDERSIZE, box.y - *PEXTENDBORDERGRAB - BORDERSIZE, box.width + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE), CBox boxFullGrabInput = {box.x - **PEXTENDBORDERGRAB - BORDERSIZE, box.y - **PEXTENDBORDERGRAB - BORDERSIZE, box.width + 2 * (**PEXTENDBORDERGRAB + BORDERSIZE),
box.height + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE)}; box.height + 2 * (**PEXTENDBORDERGRAB + BORDERSIZE)};
if (w->hasPopupAt(mouseCoords)) if (w->hasPopupAt(mouseCoords))
direction = BORDERICON_NONE; direction = BORDERICON_NONE;

View File

@ -2,11 +2,11 @@
#include "../../Compositor.hpp" #include "../../Compositor.hpp"
void CInputManager::onSwipeBegin(wlr_pointer_swipe_begin_event* e) { void CInputManager::onSwipeBegin(wlr_pointer_swipe_begin_event* e) {
static auto* const PSWIPE = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe")->intValue; static auto* const PSWIPE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe");
static auto* const PSWIPEFINGERS = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_fingers")->intValue; static auto* const PSWIPEFINGERS = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_fingers");
static auto* const PSWIPENEW = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_create_new")->intValue; static auto* const PSWIPENEW = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_create_new");
if (e->fingers != *PSWIPEFINGERS || *PSWIPE == 0 || g_pSessionLockManager->isSessionLocked()) if (e->fingers != **PSWIPEFINGERS || **PSWIPE == 0 || g_pSessionLockManager->isSessionLocked())
return; return;
int onMonitor = 0; int onMonitor = 0;
@ -16,7 +16,7 @@ void CInputManager::onSwipeBegin(wlr_pointer_swipe_begin_event* e) {
} }
} }
if (onMonitor < 2 && !*PSWIPENEW) if (onMonitor < 2 && !**PSWIPENEW)
return; // disallow swiping when there's 1 workspace on a monitor return; // disallow swiping when there's 1 workspace on a monitor
beginWorkspaceSwipe(); beginWorkspaceSwipe();
@ -44,20 +44,20 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
if (!m_sActiveSwipe.pWorkspaceBegin) if (!m_sActiveSwipe.pWorkspaceBegin)
return; // no valid swipe return; // no valid swipe
static auto* const PSWIPEPERC = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_cancel_ratio")->floatValue; static auto* const PSWIPEPERC = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_cancel_ratio");
static auto* const PSWIPEDIST = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_distance")->intValue; static auto* const PSWIPEDIST = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_distance");
static auto* const PSWIPEFORC = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_min_speed_to_force")->intValue; static auto* const PSWIPEFORC = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_min_speed_to_force");
static auto* const PSWIPENEW = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_create_new")->intValue; static auto* const PSWIPENEW = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_create_new");
static auto* const PSWIPENUMBER = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_numbered")->intValue; static auto* const PSWIPENUMBER = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_numbered");
static auto* const PSWIPEUSER = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_use_r")->intValue; static auto* const PSWIPEUSER = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_use_r");
static auto* const PWORKSPACEGAP = &g_pConfigManager->getConfigValuePtr("general:gaps_workspaces")->intValue; static auto* const PWORKSPACEGAP = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:gaps_workspaces");
const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" || const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" ||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle.starts_with("slidefadevert"); m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle.starts_with("slidefadevert");
// commit // commit
std::string wsname = ""; std::string wsname = "";
auto workspaceIDLeft = getWorkspaceIDFromString(*PSWIPENUMBER ? "-1" : (*PSWIPEUSER ? "r-1" : "m-1"), wsname); auto workspaceIDLeft = getWorkspaceIDFromString(**PSWIPENUMBER ? "-1" : (**PSWIPEUSER ? "r-1" : "m-1"), wsname);
auto workspaceIDRight = getWorkspaceIDFromString(*PSWIPENUMBER ? "+1" : (*PSWIPEUSER ? "r+1" : "m+1"), wsname); auto workspaceIDRight = getWorkspaceIDFromString(**PSWIPENUMBER ? "+1" : (**PSWIPEUSER ? "r+1" : "m+1"), wsname);
// If we've been swiping off the right end with PSWIPENEW enabled, there is // If we've been swiping off the right end with PSWIPENEW enabled, there is
// no workspace there yet, and we need to choose an ID for a new one now. // no workspace there yet, and we need to choose an ID for a new one now.
@ -68,7 +68,7 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
// be counterintuitive to swipe rightwards onto a new workspace and end up // be counterintuitive to swipe rightwards onto a new workspace and end up
// left of where we started. Instead, it's one more than the greatest // left of where we started. Instead, it's one more than the greatest
// workspace ID that currently exists. // workspace ID that currently exists.
if (workspaceIDRight <= m_sActiveSwipe.pWorkspaceBegin->m_iID && *PSWIPENEW) { if (workspaceIDRight <= m_sActiveSwipe.pWorkspaceBegin->m_iID && **PSWIPENEW) {
int maxWorkspace = 0; int maxWorkspace = 0;
for (const auto& ws : g_pCompositor->m_vWorkspaces) { for (const auto& ws : g_pCompositor->m_vWorkspaces) {
maxWorkspace = std::max(maxWorkspace, ws->m_iID); maxWorkspace = std::max(maxWorkspace, ws->m_iID);
@ -80,12 +80,12 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
auto PWORKSPACEL = g_pCompositor->getWorkspaceByID(workspaceIDLeft); // not guaranteed if PSWIPENUMBER auto PWORKSPACEL = g_pCompositor->getWorkspaceByID(workspaceIDLeft); // not guaranteed if PSWIPENUMBER
const auto RENDEROFFSETMIDDLE = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.vec(); const auto RENDEROFFSETMIDDLE = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.vec();
const auto XDISTANCE = m_sActiveSwipe.pMonitor->vecSize.x + *PWORKSPACEGAP; const auto XDISTANCE = m_sActiveSwipe.pMonitor->vecSize.x + **PWORKSPACEGAP;
const auto YDISTANCE = m_sActiveSwipe.pMonitor->vecSize.y + *PWORKSPACEGAP; const auto YDISTANCE = m_sActiveSwipe.pMonitor->vecSize.y + **PWORKSPACEGAP;
CWorkspace* pSwitchedTo = nullptr; CWorkspace* pSwitchedTo = nullptr;
if ((abs(m_sActiveSwipe.delta) < *PSWIPEDIST * *PSWIPEPERC && (*PSWIPEFORC == 0 || (*PSWIPEFORC != 0 && m_sActiveSwipe.avgSpeed < *PSWIPEFORC))) || if ((abs(m_sActiveSwipe.delta) < **PSWIPEDIST * **PSWIPEPERC && (**PSWIPEFORC == 0 || (**PSWIPEFORC != 0 && m_sActiveSwipe.avgSpeed < **PSWIPEFORC))) ||
abs(m_sActiveSwipe.delta) < 2) { abs(m_sActiveSwipe.delta) < 2) {
// revert // revert
if (abs(m_sActiveSwipe.delta) < 2) { if (abs(m_sActiveSwipe.delta) < 2) {
@ -100,16 +100,16 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
if (PWORKSPACEL) { if (PWORKSPACEL) {
if (VERTANIMS) if (VERTANIMS)
PWORKSPACEL->m_vRenderOffset = Vector2D({0, -YDISTANCE}); PWORKSPACEL->m_vRenderOffset = Vector2D{0, -YDISTANCE};
else else
PWORKSPACEL->m_vRenderOffset = Vector2D({-XDISTANCE, 0}); PWORKSPACEL->m_vRenderOffset = Vector2D{-XDISTANCE, 0};
} }
} else if (PWORKSPACER) { } else if (PWORKSPACER) {
// to right // to right
if (VERTANIMS) if (VERTANIMS)
PWORKSPACER->m_vRenderOffset = Vector2D({0, YDISTANCE}); PWORKSPACER->m_vRenderOffset = Vector2D{0, YDISTANCE};
else else
PWORKSPACER->m_vRenderOffset = Vector2D({XDISTANCE, 0}); PWORKSPACER->m_vRenderOffset = Vector2D{XDISTANCE, 0};
} }
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D(); m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D();
@ -194,40 +194,40 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
if (!m_sActiveSwipe.pWorkspaceBegin) if (!m_sActiveSwipe.pWorkspaceBegin)
return; return;
static auto* const PSWIPEDIST = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_distance")->intValue; static auto* const PSWIPEDIST = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_distance");
static auto* const PSWIPEINVR = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_invert")->intValue; static auto* const PSWIPEINVR = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_invert");
static auto* const PSWIPENEW = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_create_new")->intValue; static auto* const PSWIPENEW = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_create_new");
static auto* const PSWIPEDIRLOCK = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_direction_lock")->intValue; static auto* const PSWIPEDIRLOCK = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_direction_lock");
static auto* const PSWIPEDIRLOCKTHRESHOLD = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_direction_lock_threshold")->intValue; static auto* const PSWIPEDIRLOCKTHRESHOLD = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_direction_lock_threshold");
static auto* const PSWIPEFOREVER = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_forever")->intValue; static auto* const PSWIPEFOREVER = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_forever");
static auto* const PSWIPENUMBER = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_numbered")->intValue; static auto* const PSWIPENUMBER = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_numbered");
static auto* const PSWIPEUSER = &g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_use_r")->intValue; static auto* const PSWIPEUSER = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("gestures:workspace_swipe_use_r");
static auto* const PWORKSPACEGAP = &g_pConfigManager->getConfigValuePtr("general:gaps_workspaces")->intValue; static auto* const PWORKSPACEGAP = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:gaps_workspaces");
const auto XDISTANCE = m_sActiveSwipe.pMonitor->vecSize.x + *PWORKSPACEGAP; const auto XDISTANCE = m_sActiveSwipe.pMonitor->vecSize.x + **PWORKSPACEGAP;
const auto YDISTANCE = m_sActiveSwipe.pMonitor->vecSize.y + *PWORKSPACEGAP; const auto YDISTANCE = m_sActiveSwipe.pMonitor->vecSize.y + **PWORKSPACEGAP;
const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" || const bool VERTANIMS = m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle == "slidevert" ||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle.starts_with("slidefadevert"); m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.getConfig()->pValues->internalStyle.starts_with("slidefadevert");
m_sActiveSwipe.delta += VERTANIMS ? (*PSWIPEINVR ? -e->dy : e->dy) : (*PSWIPEINVR ? -e->dx : e->dx); m_sActiveSwipe.delta += VERTANIMS ? (**PSWIPEINVR ? -e->dy : e->dy) : (**PSWIPEINVR ? -e->dx : e->dx);
m_sActiveSwipe.avgSpeed = (m_sActiveSwipe.avgSpeed * m_sActiveSwipe.speedPoints + abs(e->dx)) / (m_sActiveSwipe.speedPoints + 1); m_sActiveSwipe.avgSpeed = (m_sActiveSwipe.avgSpeed * m_sActiveSwipe.speedPoints + abs(e->dx)) / (m_sActiveSwipe.speedPoints + 1);
m_sActiveSwipe.speedPoints++; m_sActiveSwipe.speedPoints++;
std::string wsname = ""; std::string wsname = "";
auto workspaceIDLeft = getWorkspaceIDFromString(*PSWIPENUMBER ? "-1" : (*PSWIPEUSER ? "r-1" : "m-1"), wsname); auto workspaceIDLeft = getWorkspaceIDFromString(**PSWIPENUMBER ? "-1" : (**PSWIPEUSER ? "r-1" : "m-1"), wsname);
auto workspaceIDRight = getWorkspaceIDFromString(*PSWIPENUMBER ? "+1" : (*PSWIPEUSER ? "r+1" : "m+1"), wsname); auto workspaceIDRight = getWorkspaceIDFromString(**PSWIPENUMBER ? "+1" : (**PSWIPEUSER ? "r+1" : "m+1"), wsname);
if ((workspaceIDLeft == WORKSPACE_INVALID || workspaceIDRight == WORKSPACE_INVALID || workspaceIDLeft == m_sActiveSwipe.pWorkspaceBegin->m_iID) && !*PSWIPENEW) { if ((workspaceIDLeft == WORKSPACE_INVALID || workspaceIDRight == WORKSPACE_INVALID || workspaceIDLeft == m_sActiveSwipe.pWorkspaceBegin->m_iID) && !**PSWIPENEW) {
m_sActiveSwipe.pWorkspaceBegin = nullptr; // invalidate the swipe m_sActiveSwipe.pWorkspaceBegin = nullptr; // invalidate the swipe
return; return;
} }
m_sActiveSwipe.pWorkspaceBegin->m_bForceRendering = true; m_sActiveSwipe.pWorkspaceBegin->m_bForceRendering = true;
m_sActiveSwipe.delta = std::clamp(m_sActiveSwipe.delta, (double)-*PSWIPEDIST, (double)*PSWIPEDIST); m_sActiveSwipe.delta = std::clamp(m_sActiveSwipe.delta, (double)-**PSWIPEDIST, (double)**PSWIPEDIST);
if ((m_sActiveSwipe.pWorkspaceBegin->m_iID == workspaceIDLeft && *PSWIPENEW && (m_sActiveSwipe.delta < 0)) || if ((m_sActiveSwipe.pWorkspaceBegin->m_iID == workspaceIDLeft && **PSWIPENEW && (m_sActiveSwipe.delta < 0)) ||
(m_sActiveSwipe.delta > 0 && g_pCompositor->getWindowsOnWorkspace(m_sActiveSwipe.pWorkspaceBegin->m_iID) == 0 && (m_sActiveSwipe.delta > 0 && g_pCompositor->getWindowsOnWorkspace(m_sActiveSwipe.pWorkspaceBegin->m_iID) == 0 &&
workspaceIDRight <= m_sActiveSwipe.pWorkspaceBegin->m_iID) || workspaceIDRight <= m_sActiveSwipe.pWorkspaceBegin->m_iID) ||
(m_sActiveSwipe.delta < 0 && m_sActiveSwipe.pWorkspaceBegin->m_iID <= workspaceIDLeft)) { (m_sActiveSwipe.delta < 0 && m_sActiveSwipe.pWorkspaceBegin->m_iID <= workspaceIDLeft)) {
@ -236,10 +236,10 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
return; return;
} }
if (*PSWIPEDIRLOCK) { if (**PSWIPEDIRLOCK) {
if (m_sActiveSwipe.initialDirection != 0 && m_sActiveSwipe.initialDirection != (m_sActiveSwipe.delta < 0 ? -1 : 1)) if (m_sActiveSwipe.initialDirection != 0 && m_sActiveSwipe.initialDirection != (m_sActiveSwipe.delta < 0 ? -1 : 1))
m_sActiveSwipe.delta = 0; m_sActiveSwipe.delta = 0;
else if (m_sActiveSwipe.initialDirection == 0 && abs(m_sActiveSwipe.delta) > *PSWIPEDIRLOCKTHRESHOLD) else if (m_sActiveSwipe.initialDirection == 0 && abs(m_sActiveSwipe.delta) > **PSWIPEDIRLOCKTHRESHOLD)
m_sActiveSwipe.initialDirection = m_sActiveSwipe.delta < 0 ? -1 : 1; m_sActiveSwipe.initialDirection = m_sActiveSwipe.delta < 0 ? -1 : 1;
} }
@ -247,13 +247,13 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceIDLeft); const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceIDLeft);
if (workspaceIDLeft > m_sActiveSwipe.pWorkspaceBegin->m_iID || !PWORKSPACE) { if (workspaceIDLeft > m_sActiveSwipe.pWorkspaceBegin->m_iID || !PWORKSPACE) {
if (*PSWIPENEW || *PSWIPENUMBER) { if (**PSWIPENEW || **PSWIPENUMBER) {
g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor); g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor);
if (VERTANIMS) if (VERTANIMS)
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE)); m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / **PSWIPEDIST) * YDISTANCE));
else else
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE, 0)); m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / **PSWIPEDIST) * XDISTANCE, 0));
g_pCompositor->updateWorkspaceWindowDecos(m_sActiveSwipe.pWorkspaceBegin->m_iID); g_pCompositor->updateWorkspaceWindowDecos(m_sActiveSwipe.pWorkspaceBegin->m_iID);
return; return;
@ -275,11 +275,11 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
} }
if (VERTANIMS) { if (VERTANIMS) {
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE - YDISTANCE)); PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / **PSWIPEDIST) * YDISTANCE - YDISTANCE));
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE)); m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / **PSWIPEDIST) * YDISTANCE));
} else { } else {
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE - XDISTANCE, 0)); PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / **PSWIPEDIST) * XDISTANCE - XDISTANCE, 0));
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE, 0)); m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / **PSWIPEDIST) * XDISTANCE, 0));
} }
g_pCompositor->updateWorkspaceWindowDecos(workspaceIDLeft); g_pCompositor->updateWorkspaceWindowDecos(workspaceIDLeft);
@ -287,13 +287,13 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceIDRight); const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceIDRight);
if (workspaceIDRight < m_sActiveSwipe.pWorkspaceBegin->m_iID || !PWORKSPACE) { if (workspaceIDRight < m_sActiveSwipe.pWorkspaceBegin->m_iID || !PWORKSPACE) {
if (*PSWIPENEW || *PSWIPENUMBER) { if (**PSWIPENEW || **PSWIPENUMBER) {
g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor); g_pHyprRenderer->damageMonitor(m_sActiveSwipe.pMonitor);
if (VERTANIMS) if (VERTANIMS)
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE)); m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / **PSWIPEDIST) * YDISTANCE));
else else
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE, 0)); m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / **PSWIPEDIST) * XDISTANCE, 0));
g_pCompositor->updateWorkspaceWindowDecos(m_sActiveSwipe.pWorkspaceBegin->m_iID); g_pCompositor->updateWorkspaceWindowDecos(m_sActiveSwipe.pWorkspaceBegin->m_iID);
return; return;
@ -315,11 +315,11 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
} }
if (VERTANIMS) { if (VERTANIMS) {
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE + YDISTANCE)); PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / **PSWIPEDIST) * YDISTANCE + YDISTANCE));
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / *PSWIPEDIST) * YDISTANCE)); m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0, ((-m_sActiveSwipe.delta) / **PSWIPEDIST) * YDISTANCE));
} else { } else {
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE + XDISTANCE, 0)); PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / **PSWIPEDIST) * XDISTANCE + XDISTANCE, 0));
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / *PSWIPEDIST) * XDISTANCE, 0)); m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((-m_sActiveSwipe.delta) / **PSWIPEDIST) * XDISTANCE, 0));
} }
g_pCompositor->updateWorkspaceWindowDecos(workspaceIDRight); g_pCompositor->updateWorkspaceWindowDecos(workspaceIDRight);
@ -329,8 +329,8 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
g_pCompositor->updateWorkspaceWindowDecos(m_sActiveSwipe.pWorkspaceBegin->m_iID); g_pCompositor->updateWorkspaceWindowDecos(m_sActiveSwipe.pWorkspaceBegin->m_iID);
if (*PSWIPEFOREVER) { if (**PSWIPEFOREVER) {
if (abs(m_sActiveSwipe.delta) >= *PSWIPEDIST) { if (abs(m_sActiveSwipe.delta) >= **PSWIPEDIST) {
onSwipeEnd(nullptr); onSwipeEnd(nullptr);
beginWorkspaceSwipe(); beginWorkspaceSwipe();
} }

View File

@ -11,6 +11,7 @@ executable('Hyprland', src,
dependency('wayland-client'), dependency('wayland-client'),
wlroots.get_variable('wlroots'), wlroots.get_variable('wlroots'),
dependency('cairo'), dependency('cairo'),
dependency('hyprlang', version: '>= 0.3.2'),
dependency('libdrm'), dependency('libdrm'),
dependency('egl'), dependency('egl'),
dependency('xkbcommon'), dependency('xkbcommon'),

View File

@ -147,7 +147,7 @@ APICALL bool HyprlandAPI::removeWindowDecoration(HANDLE handle, IHyprWindowDecor
return false; return false;
} }
APICALL bool HyprlandAPI::addConfigValue(HANDLE handle, const std::string& name, const SConfigValue& value) { APICALL bool HyprlandAPI::addConfigValue(HANDLE handle, const std::string& name, const Hyprlang::CConfigValue& value) {
auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle); auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle);
if (!g_pPluginSystem->m_bAllowConfigVars) if (!g_pPluginSystem->m_bAllowConfigVars)
@ -163,7 +163,7 @@ APICALL bool HyprlandAPI::addConfigValue(HANDLE handle, const std::string& name,
return true; return true;
} }
APICALL bool HyprlandAPI::addConfigKeyword(HANDLE handle, const std::string& name, std::function<void(const std::string& key, const std::string& val)> fn) { APICALL bool HyprlandAPI::addConfigKeyword(HANDLE handle, const std::string& name, Hyprlang::PCONFIGHANDLERFUNC fn, Hyprlang::SHandlerOptions opts) {
auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle); auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle);
if (!g_pPluginSystem->m_bAllowConfigVars) if (!g_pPluginSystem->m_bAllowConfigVars)
@ -172,17 +172,20 @@ APICALL bool HyprlandAPI::addConfigKeyword(HANDLE handle, const std::string& nam
if (!PLUGIN) if (!PLUGIN)
return false; return false;
g_pConfigManager->addPluginKeyword(handle, name, fn); g_pConfigManager->addPluginKeyword(handle, name, fn, opts);
return true; return true;
} }
APICALL SConfigValue* HyprlandAPI::getConfigValue(HANDLE handle, const std::string& name) { APICALL Hyprlang::CConfigValue* HyprlandAPI::getConfigValue(HANDLE handle, const std::string& name) {
auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle); auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle);
if (!PLUGIN) if (!PLUGIN)
return nullptr; return nullptr;
return g_pConfigManager->getConfigValuePtrSafe(name); if (name.starts_with("plugin:"))
return g_pConfigManager->getHyprlangConfigValuePtr(name.substr(7), "plugin");
return g_pConfigManager->getHyprlangConfigValuePtr(name);
} }
APICALL void* HyprlandAPI::getFunctionAddressFromSignature(HANDLE handle, const std::string& sig) { APICALL void* HyprlandAPI::getFunctionAddressFromSignature(HANDLE handle, const std::string& sig) {

View File

@ -112,7 +112,7 @@ namespace HyprlandAPI {
returns: true on success, false on fail returns: true on success, false on fail
*/ */
APICALL bool addConfigValue(HANDLE handle, const std::string& name, const SConfigValue& value); APICALL bool addConfigValue(HANDLE handle, const std::string& name, const Hyprlang::CConfigValue& value);
/* /*
Add a config keyword. Add a config keyword.
@ -120,15 +120,17 @@ namespace HyprlandAPI {
returns: true on success, false on fail returns: true on success, false on fail
*/ */
APICALL bool addConfigKeyword(HANDLE handle, const std::string& name, std::function<void(const std::string& key, const std::string& val)> fn); APICALL bool addConfigKeyword(HANDLE handle, const std::string& name, Hyprlang::PCONFIGHANDLERFUNC fn, Hyprlang::SHandlerOptions opts);
/* /*
Get a config value. Get a config value.
Please see the <hyprlang.hpp> header or https://hyprland.org/hyprlang/ for docs regarding Hyprlang types.
returns: a pointer to the config value struct, which is guaranteed to be valid for the life of this plugin, unless another `addConfigValue` is called afterwards. returns: a pointer to the config value struct, which is guaranteed to be valid for the life of this plugin, unless another `addConfigValue` is called afterwards.
nullptr on error. nullptr on error.
*/ */
APICALL SConfigValue* getConfigValue(HANDLE handle, const std::string& name); APICALL Hyprlang::CConfigValue* getConfigValue(HANDLE handle, const std::string& name);
/* /*
Register a static (pointer) callback to a selected event. Register a static (pointer) callback to a selected event.

View File

@ -112,7 +112,7 @@ void CXDGOutputProtocol::onManagerGetXDGOutput(wl_client* client, wl_resource* r
} }
void CXDGOutputProtocol::updateOutputDetails(SXDGOutput* pOutput) { void CXDGOutputProtocol::updateOutputDetails(SXDGOutput* pOutput) {
static auto* const PXWLFORCESCALEZERO = &g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling")->intValue; static auto* const PXWLFORCESCALEZERO = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("xwayland:force_zero_scaling");
if (!pOutput->resource->good() || !pOutput->monitor) if (!pOutput->resource->good() || !pOutput->monitor)
return; return;
@ -120,7 +120,7 @@ void CXDGOutputProtocol::updateOutputDetails(SXDGOutput* pOutput) {
const auto POS = pOutput->isXWayland ? pOutput->monitor->vecXWaylandPosition : pOutput->monitor->vecPosition; const auto POS = pOutput->isXWayland ? pOutput->monitor->vecXWaylandPosition : pOutput->monitor->vecPosition;
zxdg_output_v1_send_logical_position(pOutput->resource->resource(), POS.x, POS.y); zxdg_output_v1_send_logical_position(pOutput->resource->resource(), POS.x, POS.y);
if (*PXWLFORCESCALEZERO && pOutput->isXWayland) if (**PXWLFORCESCALEZERO && pOutput->isXWayland)
zxdg_output_v1_send_logical_size(pOutput->resource->resource(), pOutput->monitor->vecTransformedSize.x, pOutput->monitor->vecTransformedSize.y); zxdg_output_v1_send_logical_size(pOutput->resource->resource(), pOutput->monitor->vecTransformedSize.x, pOutput->monitor->vecTransformedSize.y);
else else
zxdg_output_v1_send_logical_size(pOutput->resource->resource(), pOutput->monitor->vecSize.x, pOutput->monitor->vecSize.y); zxdg_output_v1_send_logical_size(pOutput->resource->resource(), pOutput->monitor->vecSize.x, pOutput->monitor->vecSize.y);

View File

@ -120,18 +120,18 @@ GLuint CHyprOpenGLImpl::compileShader(const GLuint& type, std::string src, bool
bool CHyprOpenGLImpl::passRequiresIntrospection(CMonitor* pMonitor) { bool CHyprOpenGLImpl::passRequiresIntrospection(CMonitor* pMonitor) {
// passes requiring introspection are the ones that need to render blur. // passes requiring introspection are the ones that need to render blur.
static auto* const PBLUR = &g_pConfigManager->getConfigValuePtr("decoration:blur:enabled")->intValue; static auto* const PBLUR = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:enabled");
static auto* const PXRAY = &g_pConfigManager->getConfigValuePtr("decoration:blur:xray")->intValue; static auto* const PXRAY = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:xray");
static auto* const POPTIM = &g_pConfigManager->getConfigValuePtr("decoration:blur:new_optimizations")->intValue; static auto* const POPTIM = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:new_optimizations");
static auto* const PBLURSPECIAL = &g_pConfigManager->getConfigValuePtr("decoration:blur:special")->intValue; static auto* const PBLURSPECIAL = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:special");
if (m_RenderData.mouseZoomFactor != 1.0) if (m_RenderData.mouseZoomFactor != 1.0 || g_pHyprRenderer->m_bCrashingInProgress)
return true; return true;
if (!pMonitor->mirrors.empty()) if (!pMonitor->mirrors.empty())
return true; return true;
if (*PBLUR == 0) if (**PBLUR == 0)
return false; return false;
if (m_RenderData.pCurrentMonData->blurFBShouldRender) if (m_RenderData.pCurrentMonData->blurFBShouldRender)
@ -141,13 +141,13 @@ bool CHyprOpenGLImpl::passRequiresIntrospection(CMonitor* pMonitor) {
return false; return false;
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) { for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) {
const auto XRAYMODE = ls->xray == -1 ? *PXRAY : ls->xray; const auto XRAYMODE = ls->xray == -1 ? **PXRAY : ls->xray;
if (ls->forceBlur && !XRAYMODE) if (ls->forceBlur && !XRAYMODE)
return true; return true;
} }
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) { for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
const auto XRAYMODE = ls->xray == -1 ? *PXRAY : ls->xray; const auto XRAYMODE = ls->xray == -1 ? **PXRAY : ls->xray;
if (ls->forceBlur && !XRAYMODE) if (ls->forceBlur && !XRAYMODE)
return true; return true;
} }
@ -168,7 +168,7 @@ bool CHyprOpenGLImpl::passRequiresIntrospection(CMonitor* pMonitor) {
return false; return false;
for (auto& w : g_pCompositor->m_vWindows) { for (auto& w : g_pCompositor->m_vWindows) {
if (!w->m_bIsMapped || w->isHidden() || (!w->m_bIsFloating && *POPTIM && !g_pCompositor->isWorkspaceSpecial(w->m_iWorkspaceID))) if (!w->m_bIsMapped || w->isHidden() || (!w->m_bIsFloating && **POPTIM && !g_pCompositor->isWorkspaceSpecial(w->m_iWorkspaceID)))
continue; continue;
if (!g_pHyprRenderer->shouldRenderWindow(w.get())) if (!g_pHyprRenderer->shouldRenderWindow(w.get()))
@ -243,8 +243,9 @@ void CHyprOpenGLImpl::begin(CMonitor* pMonitor, CRegion* pDamage, CFramebuffer*
m_bFakeFrame = fb; m_bFakeFrame = fb;
if (m_bReloadScreenShader) { if (m_bReloadScreenShader) {
m_bReloadScreenShader = false; m_bReloadScreenShader = false;
applyScreenShader(g_pConfigManager->getString("decoration:screen_shader")); static auto* const PSHADER = (Hyprlang::STRING const*)g_pConfigManager->getConfigValuePtr("decoration:screen_shader");
applyScreenShader(*PSHADER);
} }
const auto PRBO = g_pHyprRenderer->getCurrentRBO(); const auto PRBO = g_pHyprRenderer->getCurrentRBO();
@ -274,7 +275,7 @@ void CHyprOpenGLImpl::begin(CMonitor* pMonitor, CRegion* pDamage, CFramebuffer*
} }
void CHyprOpenGLImpl::end() { void CHyprOpenGLImpl::end() {
static auto* const PZOOMRIGID = &g_pConfigManager->getConfigValuePtr("misc:cursor_zoom_rigid")->intValue; static auto* const PZOOMRIGID = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:cursor_zoom_rigid");
TRACY_GPU_ZONE("RenderEnd"); TRACY_GPU_ZONE("RenderEnd");
@ -294,7 +295,7 @@ void CHyprOpenGLImpl::end() {
(g_pInputManager->getMouseCoordsInternal() - m_RenderData.pMonitor->vecPosition) * m_RenderData.pMonitor->scale : (g_pInputManager->getMouseCoordsInternal() - m_RenderData.pMonitor->vecPosition) * m_RenderData.pMonitor->scale :
m_RenderData.pMonitor->vecTransformedSize / 2.f; m_RenderData.pMonitor->vecTransformedSize / 2.f;
monbox.translate(-ZOOMCENTER).scale(m_RenderData.mouseZoomFactor).translate(*PZOOMRIGID ? m_RenderData.pMonitor->vecTransformedSize / 2.0 : ZOOMCENTER); monbox.translate(-ZOOMCENTER).scale(m_RenderData.mouseZoomFactor).translate(**PZOOMRIGID ? m_RenderData.pMonitor->vecTransformedSize / 2.0 : ZOOMCENTER);
if (monbox.x > 0) if (monbox.x > 0)
monbox.x = 0; monbox.x = 0;
@ -313,7 +314,7 @@ void CHyprOpenGLImpl::end() {
blend(false); blend(false);
if (m_sFinalScreenShader.program < 1) if (m_sFinalScreenShader.program < 1 && !g_pHyprRenderer->m_bCrashingInProgress)
renderTexturePrimitive(m_RenderData.pCurrentMonData->offloadFB.m_cTex, &monbox); renderTexturePrimitive(m_RenderData.pCurrentMonData->offloadFB.m_cTex, &monbox);
else else
renderTexture(m_RenderData.pCurrentMonData->offloadFB.m_cTex, &monbox, 1.f); renderTexture(m_RenderData.pCurrentMonData->offloadFB.m_cTex, &monbox, 1.f);
@ -505,6 +506,8 @@ void CHyprOpenGLImpl::initShaders() {
void CHyprOpenGLImpl::applyScreenShader(const std::string& path) { void CHyprOpenGLImpl::applyScreenShader(const std::string& path) {
static auto* const PDT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:damage_tracking");
m_sFinalScreenShader.destroy(); m_sFinalScreenShader.destroy();
if (path == "" || path == STRVAL_EMPTY) if (path == "" || path == STRVAL_EMPTY)
@ -530,7 +533,7 @@ void CHyprOpenGLImpl::applyScreenShader(const std::string& path) {
m_sFinalScreenShader.tex = glGetUniformLocation(m_sFinalScreenShader.program, "tex"); m_sFinalScreenShader.tex = glGetUniformLocation(m_sFinalScreenShader.program, "tex");
m_sFinalScreenShader.time = glGetUniformLocation(m_sFinalScreenShader.program, "time"); m_sFinalScreenShader.time = glGetUniformLocation(m_sFinalScreenShader.program, "time");
m_sFinalScreenShader.wl_output = glGetUniformLocation(m_sFinalScreenShader.program, "wl_output"); m_sFinalScreenShader.wl_output = glGetUniformLocation(m_sFinalScreenShader.program, "wl_output");
if (m_sFinalScreenShader.time != -1 && g_pConfigManager->getInt("debug:damage_tracking") != 0 && !g_pHyprRenderer->m_bCrashingInProgress) { if (m_sFinalScreenShader.time != -1 && **PDT != 0 && !g_pHyprRenderer->m_bCrashingInProgress) {
// The screen shader uses the "time" uniform // The screen shader uses the "time" uniform
// Since the screen shader could change every frame, damage tracking *needs* to be disabled // Since the screen shader could change every frame, damage tracking *needs* to be disabled
g_pConfigManager->addParseError("Screen shader: Screen shader uses uniform 'time', which requires debug:damage_tracking to be switched off.\n" g_pConfigManager->addParseError("Screen shader: Screen shader uses uniform 'time', which requires debug:damage_tracking to be switched off.\n"
@ -754,7 +757,8 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, CBox*
CBox newBox = *pBox; CBox newBox = *pBox;
m_RenderData.renderModif.applyToBox(newBox); m_RenderData.renderModif.applyToBox(newBox);
static auto* const PDIMINACTIVE = &g_pConfigManager->getConfigValuePtr("decoration:dim_inactive")->intValue; static auto* const PDIMINACTIVE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:dim_inactive");
static auto* const PDT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:damage_tracking");
// get transform // get transform
const auto TRANSFORM = wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform); const auto TRANSFORM = wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform);
@ -814,7 +818,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, CBox*
#endif #endif
glUniform1i(shader->tex, 0); glUniform1i(shader->tex, 0);
if ((usingFinalShader && g_pConfigManager->getInt("debug:damage_tracking") == 0) || CRASHING) { if ((usingFinalShader && **PDT == 0) || CRASHING) {
glUniform1f(shader->time, m_tGlobalTimer.getSeconds()); glUniform1f(shader->time, m_tGlobalTimer.getSeconds());
} else if (usingFinalShader && shader->time != -1) { } else if (usingFinalShader && shader->time != -1) {
// Don't let time be unitialised // Don't let time be unitialised
@ -855,7 +859,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, CBox*
glUniform2f(shader->fullSize, FULLSIZE.x, FULLSIZE.y); glUniform2f(shader->fullSize, FULLSIZE.x, FULLSIZE.y);
glUniform1f(shader->radius, round); glUniform1f(shader->radius, round);
if (allowDim && m_pCurrentWindow && *PDIMINACTIVE) { if (allowDim && m_pCurrentWindow && **PDIMINACTIVE) {
glUniform1i(shader->applyTint, 1); glUniform1i(shader->applyTint, 1);
const auto DIM = m_pCurrentWindow->m_fDimPercent.fl(); const auto DIM = m_pCurrentWindow->m_fDimPercent.fl();
glUniform3f(shader->tint, 1.f - DIM, 1.f - DIM, 1.f - DIM); glUniform3f(shader->tint, 1.f - DIM, 1.f - DIM, 1.f - DIM);
@ -1039,16 +1043,16 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, CRegion* o
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix); wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
// get the config settings // get the config settings
static auto* const PBLURSIZE = &g_pConfigManager->getConfigValuePtr("decoration:blur:size")->intValue; static auto* const PBLURSIZE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:size");
static auto* const PBLURPASSES = &g_pConfigManager->getConfigValuePtr("decoration:blur:passes")->intValue; static auto* const PBLURPASSES = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:passes");
static auto* const PBLURVIBRANCY = &g_pConfigManager->getConfigValuePtr("decoration:blur:vibrancy")->floatValue; static auto* const PBLURVIBRANCY = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:vibrancy");
static auto* const PBLURVIBRANCYDARKNESS = &g_pConfigManager->getConfigValuePtr("decoration:blur:vibrancy_darkness")->floatValue; static auto* const PBLURVIBRANCYDARKNESS = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:vibrancy_darkness");
// prep damage // prep damage
CRegion damage{*originalDamage}; CRegion damage{*originalDamage};
wlr_region_transform(damage.pixman(), damage.pixman(), wlr_output_transform_invert(m_RenderData.pMonitor->transform), m_RenderData.pMonitor->vecTransformedSize.x, wlr_region_transform(damage.pixman(), damage.pixman(), wlr_output_transform_invert(m_RenderData.pMonitor->transform), m_RenderData.pMonitor->vecTransformedSize.x,
m_RenderData.pMonitor->vecTransformedSize.y); m_RenderData.pMonitor->vecTransformedSize.y);
wlr_region_expand(damage.pixman(), damage.pixman(), *PBLURPASSES > 10 ? pow(2, 15) : std::clamp(*PBLURSIZE, (int64_t)1, (int64_t)40) * pow(2, *PBLURPASSES)); wlr_region_expand(damage.pixman(), damage.pixman(), **PBLURPASSES > 10 ? pow(2, 15) : std::clamp(**PBLURSIZE, (int64_t)1, (int64_t)40) * pow(2, **PBLURPASSES));
// helper // helper
const auto PMIRRORFB = &m_RenderData.pCurrentMonData->mirrorFB; const auto PMIRRORFB = &m_RenderData.pCurrentMonData->mirrorFB;
@ -1059,8 +1063,8 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, CRegion* o
// Begin with base color adjustments - global brightness and contrast // Begin with base color adjustments - global brightness and contrast
// TODO: make this a part of the first pass maybe to save on a drawcall? // TODO: make this a part of the first pass maybe to save on a drawcall?
{ {
static auto* const PBLURCONTRAST = &g_pConfigManager->getConfigValuePtr("decoration:blur:contrast")->floatValue; static auto* const PBLURCONTRAST = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:contrast");
static auto* const PBLURBRIGHTNESS = &g_pConfigManager->getConfigValuePtr("decoration:blur:brightness")->floatValue; static auto* const PBLURBRIGHTNESS = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:brightness");
PMIRRORSWAPFB->bind(); PMIRRORSWAPFB->bind();
@ -1078,8 +1082,8 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, CRegion* o
wlr_matrix_transpose(glMatrix, glMatrix); wlr_matrix_transpose(glMatrix, glMatrix);
glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shBLURPREPARE.proj, 1, GL_FALSE, glMatrix); glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shBLURPREPARE.proj, 1, GL_FALSE, glMatrix);
#endif #endif
glUniform1f(m_RenderData.pCurrentMonData->m_shBLURPREPARE.contrast, *PBLURCONTRAST); glUniform1f(m_RenderData.pCurrentMonData->m_shBLURPREPARE.contrast, **PBLURCONTRAST);
glUniform1f(m_RenderData.pCurrentMonData->m_shBLURPREPARE.brightness, *PBLURBRIGHTNESS); glUniform1f(m_RenderData.pCurrentMonData->m_shBLURPREPARE.brightness, **PBLURBRIGHTNESS);
glUniform1i(m_RenderData.pCurrentMonData->m_shBLURPREPARE.tex, 0); glUniform1i(m_RenderData.pCurrentMonData->m_shBLURPREPARE.tex, 0);
glVertexAttribPointer(m_RenderData.pCurrentMonData->m_shBLURPREPARE.posAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts); glVertexAttribPointer(m_RenderData.pCurrentMonData->m_shBLURPREPARE.posAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts);
@ -1123,13 +1127,13 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, CRegion* o
wlr_matrix_transpose(glMatrix, glMatrix); wlr_matrix_transpose(glMatrix, glMatrix);
glUniformMatrix3fv(pShader->proj, 1, GL_FALSE, glMatrix); glUniformMatrix3fv(pShader->proj, 1, GL_FALSE, glMatrix);
#endif #endif
glUniform1f(pShader->radius, *PBLURSIZE * a); // this makes the blursize change with a glUniform1f(pShader->radius, **PBLURSIZE * a); // this makes the blursize change with a
if (pShader == &m_RenderData.pCurrentMonData->m_shBLUR1) { if (pShader == &m_RenderData.pCurrentMonData->m_shBLUR1) {
glUniform2f(m_RenderData.pCurrentMonData->m_shBLUR1.halfpixel, 0.5f / (m_RenderData.pMonitor->vecPixelSize.x / 2.f), glUniform2f(m_RenderData.pCurrentMonData->m_shBLUR1.halfpixel, 0.5f / (m_RenderData.pMonitor->vecPixelSize.x / 2.f),
0.5f / (m_RenderData.pMonitor->vecPixelSize.y / 2.f)); 0.5f / (m_RenderData.pMonitor->vecPixelSize.y / 2.f));
glUniform1i(m_RenderData.pCurrentMonData->m_shBLUR1.passes, *PBLURPASSES); glUniform1i(m_RenderData.pCurrentMonData->m_shBLUR1.passes, **PBLURPASSES);
glUniform1f(m_RenderData.pCurrentMonData->m_shBLUR1.vibrancy, *PBLURVIBRANCY); glUniform1f(m_RenderData.pCurrentMonData->m_shBLUR1.vibrancy, **PBLURVIBRANCY);
glUniform1f(m_RenderData.pCurrentMonData->m_shBLUR1.vibrancy_darkness, *PBLURVIBRANCYDARKNESS); glUniform1f(m_RenderData.pCurrentMonData->m_shBLUR1.vibrancy_darkness, **PBLURVIBRANCYDARKNESS);
} else } else
glUniform2f(m_RenderData.pCurrentMonData->m_shBLUR2.halfpixel, 0.5f / (m_RenderData.pMonitor->vecPixelSize.x * 2.f), glUniform2f(m_RenderData.pCurrentMonData->m_shBLUR2.halfpixel, 0.5f / (m_RenderData.pMonitor->vecPixelSize.x * 2.f),
0.5f / (m_RenderData.pMonitor->vecPixelSize.y * 2.f)); 0.5f / (m_RenderData.pMonitor->vecPixelSize.y * 2.f));
@ -1166,20 +1170,20 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, CRegion* o
CRegion tempDamage{damage}; CRegion tempDamage{damage};
// and draw // and draw
for (int i = 1; i <= *PBLURPASSES; ++i) { for (int i = 1; i <= **PBLURPASSES; ++i) {
wlr_region_scale(tempDamage.pixman(), damage.pixman(), 1.f / (1 << i)); wlr_region_scale(tempDamage.pixman(), damage.pixman(), 1.f / (1 << i));
drawPass(&m_RenderData.pCurrentMonData->m_shBLUR1, &tempDamage); // down drawPass(&m_RenderData.pCurrentMonData->m_shBLUR1, &tempDamage); // down
} }
for (int i = *PBLURPASSES - 1; i >= 0; --i) { for (int i = **PBLURPASSES - 1; i >= 0; --i) {
wlr_region_scale(tempDamage.pixman(), damage.pixman(), 1.f / (1 << i)); // when upsampling we make the region twice as big wlr_region_scale(tempDamage.pixman(), damage.pixman(), 1.f / (1 << i)); // when upsampling we make the region twice as big
drawPass(&m_RenderData.pCurrentMonData->m_shBLUR2, &tempDamage); // up drawPass(&m_RenderData.pCurrentMonData->m_shBLUR2, &tempDamage); // up
} }
// finalize the image // finalize the image
{ {
static auto* const PBLURNOISE = &g_pConfigManager->getConfigValuePtr("decoration:blur:noise")->floatValue; static auto* const PBLURNOISE = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:noise");
static auto* const PBLURBRIGHTNESS = &g_pConfigManager->getConfigValuePtr("decoration:blur:brightness")->floatValue; static auto* const PBLURBRIGHTNESS = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:brightness");
if (currentRenderToFB == PMIRRORFB) if (currentRenderToFB == PMIRRORFB)
PMIRRORSWAPFB->bind(); PMIRRORSWAPFB->bind();
@ -1200,8 +1204,8 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, CRegion* o
wlr_matrix_transpose(glMatrix, glMatrix); wlr_matrix_transpose(glMatrix, glMatrix);
glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shBLURFINISH.proj, 1, GL_FALSE, glMatrix); glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shBLURFINISH.proj, 1, GL_FALSE, glMatrix);
#endif #endif
glUniform1f(m_RenderData.pCurrentMonData->m_shBLURFINISH.noise, *PBLURNOISE); glUniform1f(m_RenderData.pCurrentMonData->m_shBLURFINISH.noise, **PBLURNOISE);
glUniform1f(m_RenderData.pCurrentMonData->m_shBLURFINISH.brightness, *PBLURBRIGHTNESS); glUniform1f(m_RenderData.pCurrentMonData->m_shBLURFINISH.brightness, **PBLURBRIGHTNESS);
glUniform1i(m_RenderData.pCurrentMonData->m_shBLURFINISH.tex, 0); glUniform1i(m_RenderData.pCurrentMonData->m_shBLURFINISH.tex, 0);
@ -1240,11 +1244,11 @@ void CHyprOpenGLImpl::markBlurDirtyForMonitor(CMonitor* pMonitor) {
} }
void CHyprOpenGLImpl::preRender(CMonitor* pMonitor) { void CHyprOpenGLImpl::preRender(CMonitor* pMonitor) {
static auto* const PBLURNEWOPTIMIZE = &g_pConfigManager->getConfigValuePtr("decoration:blur:new_optimizations")->intValue; static auto* const PBLURNEWOPTIMIZE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:new_optimizations");
static auto* const PBLURXRAY = &g_pConfigManager->getConfigValuePtr("decoration:blur:xray")->intValue; static auto* const PBLURXRAY = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:xray");
static auto* const PBLUR = &g_pConfigManager->getConfigValuePtr("decoration:blur:enabled")->intValue; static auto* const PBLUR = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:enabled");
if (!*PBLURNEWOPTIMIZE || !m_mMonitorRenderResources[pMonitor].blurFBDirty || !*PBLUR) if (!**PBLURNEWOPTIMIZE || !m_mMonitorRenderResources[pMonitor].blurFBDirty || !**PBLUR)
return; return;
// ignore if solitary present, nothing to blur // ignore if solitary present, nothing to blur
@ -1289,7 +1293,7 @@ void CHyprOpenGLImpl::preRender(CMonitor* pMonitor) {
bool hasWindows = false; bool hasWindows = false;
for (auto& w : g_pCompositor->m_vWindows) { for (auto& w : g_pCompositor->m_vWindows) {
if (w->m_iWorkspaceID == pMonitor->activeWorkspace && !w->isHidden() && w->m_bIsMapped && (!w->m_bIsFloating || *PBLURXRAY)) { if (w->m_iWorkspaceID == pMonitor->activeWorkspace && !w->isHidden() && w->m_bIsMapped && (!w->m_bIsFloating || **PBLURXRAY)) {
// check if window is valid // check if window is valid
if (!windowShouldBeBlurred(w.get())) if (!windowShouldBeBlurred(w.get()))
@ -1362,15 +1366,15 @@ void CHyprOpenGLImpl::preWindowPass() {
} }
bool CHyprOpenGLImpl::preBlurQueued() { bool CHyprOpenGLImpl::preBlurQueued() {
static auto* const PBLURNEWOPTIMIZE = &g_pConfigManager->getConfigValuePtr("decoration:blur:new_optimizations")->intValue; static auto* const PBLURNEWOPTIMIZE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:new_optimizations");
static auto* const PBLUR = &g_pConfigManager->getConfigValuePtr("decoration:blur:enabled")->intValue; static auto* const PBLUR = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:enabled");
return !(!m_RenderData.pCurrentMonData->blurFBDirty || !*PBLURNEWOPTIMIZE || !*PBLUR || !m_RenderData.pCurrentMonData->blurFBShouldRender); return !(!m_RenderData.pCurrentMonData->blurFBDirty || !**PBLURNEWOPTIMIZE || !**PBLUR || !m_RenderData.pCurrentMonData->blurFBShouldRender);
} }
bool CHyprOpenGLImpl::shouldUseNewBlurOptimizations(SLayerSurface* pLayer, CWindow* pWindow) { bool CHyprOpenGLImpl::shouldUseNewBlurOptimizations(SLayerSurface* pLayer, CWindow* pWindow) {
static auto* const PBLURNEWOPTIMIZE = &g_pConfigManager->getConfigValuePtr("decoration:blur:new_optimizations")->intValue; static auto* const PBLURNEWOPTIMIZE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:new_optimizations");
static auto* const PBLURXRAY = &g_pConfigManager->getConfigValuePtr("decoration:blur:xray")->intValue; static auto* const PBLURXRAY = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:xray");
if (!m_RenderData.pCurrentMonData->blurFB.m_cTex.m_iTexID) if (!m_RenderData.pCurrentMonData->blurFB.m_cTex.m_iTexID)
return false; return false;
@ -1381,7 +1385,7 @@ bool CHyprOpenGLImpl::shouldUseNewBlurOptimizations(SLayerSurface* pLayer, CWind
if (pLayer && pLayer->xray == 0) if (pLayer && pLayer->xray == 0)
return false; return false;
if ((*PBLURNEWOPTIMIZE && pWindow && !pWindow->m_bIsFloating && !g_pCompositor->isWorkspaceSpecial(pWindow->m_iWorkspaceID)) || *PBLURXRAY) if ((**PBLURNEWOPTIMIZE && pWindow && !pWindow->m_bIsFloating && !g_pCompositor->isWorkspaceSpecial(pWindow->m_iWorkspaceID)) || **PBLURXRAY)
return true; return true;
if ((pLayer && pLayer->xray == 1) || (pWindow && pWindow->m_sAdditionalConfigData.xray.toUnderlying() == 1)) if ((pLayer && pLayer->xray == 1) || (pWindow && pWindow->m_sAdditionalConfigData.xray.toUnderlying() == 1))
@ -1393,8 +1397,8 @@ bool CHyprOpenGLImpl::shouldUseNewBlurOptimizations(SLayerSurface* pLayer, CWind
void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, CBox* pBox, float a, wlr_surface* pSurface, int round, bool blockBlurOptimization, float blurA) { void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, CBox* pBox, float a, wlr_surface* pSurface, int round, bool blockBlurOptimization, float blurA) {
RASSERT(m_RenderData.pMonitor, "Tried to render texture with blur without begin()!"); RASSERT(m_RenderData.pMonitor, "Tried to render texture with blur without begin()!");
static auto* const PBLURENABLED = &g_pConfigManager->getConfigValuePtr("decoration:blur:enabled")->intValue; static auto* const PBLURENABLED = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:enabled");
static auto* const PNOBLUROVERSIZED = &g_pConfigManager->getConfigValuePtr("decoration:no_blur_on_oversized")->intValue; static auto* const PNOBLUROVERSIZED = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:no_blur_on_oversized");
TRACY_GPU_ZONE("RenderTextureWithBlur"); TRACY_GPU_ZONE("RenderTextureWithBlur");
@ -1405,7 +1409,7 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, CBox* pBox, flo
if (texDamage.empty()) if (texDamage.empty())
return; return;
if (*PBLURENABLED == 0 || (*PNOBLUROVERSIZED && m_RenderData.primarySurfaceUVTopLeft != Vector2D(-1, -1)) || if (**PBLURENABLED == 0 || (**PNOBLUROVERSIZED && m_RenderData.primarySurfaceUVTopLeft != Vector2D(-1, -1)) ||
(m_pCurrentWindow && (m_pCurrentWindow->m_sAdditionalConfigData.forceNoBlur || m_pCurrentWindow->m_sAdditionalConfigData.forceRGBX))) { (m_pCurrentWindow && (m_pCurrentWindow->m_sAdditionalConfigData.forceNoBlur || m_pCurrentWindow->m_sAdditionalConfigData.forceRGBX))) {
renderTexture(tex, pBox, a, round, false, true); renderTexture(tex, pBox, a, round, false, true);
return; return;
@ -1466,11 +1470,11 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, CBox* pBox, flo
// stencil done. Render everything. // stencil done. Render everything.
CBox MONITORBOX = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y}; CBox MONITORBOX = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
// render our great blurred FB // render our great blurred FB
static auto* const PBLURIGNOREOPACITY = &g_pConfigManager->getConfigValuePtr("decoration:blur:ignore_opacity")->intValue; static auto* const PBLURIGNOREOPACITY = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:ignore_opacity");
m_bEndFrame = true; // fix transformed m_bEndFrame = true; // fix transformed
const auto SAVEDRENDERMODIF = m_RenderData.renderModif; const auto SAVEDRENDERMODIF = m_RenderData.renderModif;
m_RenderData.renderModif = {}; // fix shit m_RenderData.renderModif = {}; // fix shit
renderTextureInternalWithDamage(POUTFB->m_cTex, &MONITORBOX, *PBLURIGNOREOPACITY ? blurA : a * blurA, &texDamage, 0, false, false, false); renderTextureInternalWithDamage(POUTFB->m_cTex, &MONITORBOX, **PBLURIGNOREOPACITY ? blurA : a * blurA, &texDamage, 0, false, false, false);
m_bEndFrame = false; m_bEndFrame = false;
m_RenderData.renderModif = SAVEDRENDERMODIF; m_RenderData.renderModif = SAVEDRENDERMODIF;
@ -1620,8 +1624,9 @@ void CHyprOpenGLImpl::makeRawWindowSnapshot(CWindow* pWindow, CFramebuffer* pFra
// will try to copy the bg to apply blur. // will try to copy the bg to apply blur.
// this isn't entirely correct, but like, oh well. // this isn't entirely correct, but like, oh well.
// small todo: maybe make this correct? :P // small todo: maybe make this correct? :P
const auto BLURVAL = g_pConfigManager->getInt("decoration:blur:enabled"); static auto* const PBLUR = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:enabled");
g_pConfigManager->setInt("decoration:blur:enabled", 0); const auto BLURVAL = **PBLUR;
**PBLUR = 0;
// TODO: how can we make this the size of the window? setting it to window's size makes the entire screen render with the wrong res forever more. odd. // TODO: how can we make this the size of the window? setting it to window's size makes the entire screen render with the wrong res forever more. odd.
glViewport(0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y); glViewport(0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y);
@ -1632,7 +1637,7 @@ void CHyprOpenGLImpl::makeRawWindowSnapshot(CWindow* pWindow, CFramebuffer* pFra
g_pHyprRenderer->renderWindow(pWindow, PMONITOR, &now, false, RENDER_PASS_ALL, true); g_pHyprRenderer->renderWindow(pWindow, PMONITOR, &now, false, RENDER_PASS_ALL, true);
g_pConfigManager->setInt("decoration:blur:enabled", BLURVAL); **PBLUR = BLURVAL;
g_pHyprRenderer->endRender(); g_pHyprRenderer->endRender();
} }
@ -1672,14 +1677,15 @@ void CHyprOpenGLImpl::makeWindowSnapshot(CWindow* pWindow) {
// will try to copy the bg to apply blur. // will try to copy the bg to apply blur.
// this isn't entirely correct, but like, oh well. // this isn't entirely correct, but like, oh well.
// small todo: maybe make this correct? :P // small todo: maybe make this correct? :P
const auto BLURVAL = g_pConfigManager->getInt("decoration:blur:enabled"); static auto* const PBLUR = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:enabled");
g_pConfigManager->setInt("decoration:blur:enabled", 0); const auto BLURVAL = **PBLUR;
**PBLUR = 0;
clear(CColor(0, 0, 0, 0)); // JIC clear(CColor(0, 0, 0, 0)); // JIC
g_pHyprRenderer->renderWindow(pWindow, PMONITOR, &now, !pWindow->m_bX11DoesntWantBorders, RENDER_PASS_ALL); g_pHyprRenderer->renderWindow(pWindow, PMONITOR, &now, !pWindow->m_bX11DoesntWantBorders, RENDER_PASS_ALL);
g_pConfigManager->setInt("decoration:blur:enabled", BLURVAL); **PBLUR = BLURVAL;
g_pHyprRenderer->endRender(); g_pHyprRenderer->endRender();
@ -1730,7 +1736,7 @@ void CHyprOpenGLImpl::renderSnapshot(CWindow** pWindow) {
RASSERT(m_RenderData.pMonitor, "Tried to render snapshot rect without begin()!"); RASSERT(m_RenderData.pMonitor, "Tried to render snapshot rect without begin()!");
const auto PWINDOW = *pWindow; const auto PWINDOW = *pWindow;
static auto* const PDIMAROUND = &g_pConfigManager->getConfigValuePtr("decoration:dim_around")->floatValue; static auto* const PDIMAROUND = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:dim_around");
auto it = m_mWindowFramebuffers.begin(); auto it = m_mWindowFramebuffers.begin();
for (; it != m_mWindowFramebuffers.end(); it++) { for (; it != m_mWindowFramebuffers.end(); it++) {
@ -1757,9 +1763,9 @@ void CHyprOpenGLImpl::renderSnapshot(CWindow** pWindow) {
CRegion fakeDamage{0, 0, PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y}; CRegion fakeDamage{0, 0, PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y};
if (*PDIMAROUND && (*pWindow)->m_sAdditionalConfigData.dimAround) { if (**PDIMAROUND && (*pWindow)->m_sAdditionalConfigData.dimAround) {
CBox monbox = {0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.y}; CBox monbox = {0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.y};
g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, *PDIMAROUND * PWINDOW->m_fAlpha.fl())); g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, **PDIMAROUND * PWINDOW->m_fAlpha.fl()));
g_pHyprRenderer->damageMonitor(PMONITOR); g_pHyprRenderer->damageMonitor(PMONITOR);
} }
@ -1812,9 +1818,9 @@ void CHyprOpenGLImpl::renderRoundedShadow(CBox* box, int round, int range, const
box = &newBox; box = &newBox;
static auto* const PSHADOWPOWER = &g_pConfigManager->getConfigValuePtr("decoration:shadow_render_power")->intValue; static auto* const PSHADOWPOWER = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:shadow_render_power");
const auto SHADOWPOWER = std::clamp((int)*PSHADOWPOWER, 1, 4); const auto SHADOWPOWER = std::clamp((int)**PSHADOWPOWER, 1, 4);
const auto col = color; const auto col = color;
@ -1926,15 +1932,15 @@ void CHyprOpenGLImpl::renderSplash(cairo_t* const CAIRO, cairo_surface_t* const
void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) { void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) {
RASSERT(m_RenderData.pMonitor, "Tried to createBGTex without begin()!"); RASSERT(m_RenderData.pMonitor, "Tried to createBGTex without begin()!");
static auto* const PRENDERTEX = &g_pConfigManager->getConfigValuePtr("misc:disable_hyprland_logo")->intValue; static auto* const PRENDERTEX = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:disable_hyprland_logo");
static auto* const PNOSPLASH = &g_pConfigManager->getConfigValuePtr("misc:disable_splash_rendering")->intValue; static auto* const PNOSPLASH = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:disable_splash_rendering");
static auto* const PFORCEWALLPAPER = &g_pConfigManager->getConfigValuePtr("misc:force_default_wallpaper")->intValue; static auto* const PFORCEWALLPAPER = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:force_default_wallpaper");
const auto FORCEWALLPAPER = std::clamp(*PFORCEWALLPAPER, static_cast<int64_t>(-1L), static_cast<int64_t>(2L)); const auto FORCEWALLPAPER = std::clamp(**PFORCEWALLPAPER, static_cast<int64_t>(-1L), static_cast<int64_t>(2L));
static std::string texPath = ""; static std::string texPath = "";
if (*PRENDERTEX) if (**PRENDERTEX)
return; return;
// release the last tex if exists // release the last tex if exists
@ -1956,7 +1962,7 @@ void CHyprOpenGLImpl::createBGTextureForMonitor(CMonitor* pMonitor) {
texPath += std::to_string(distribution(engine)); texPath += std::to_string(distribution(engine));
} else } else
texPath += std::to_string(std::clamp(*PFORCEWALLPAPER, (int64_t)0, (int64_t)2)); texPath += std::to_string(std::clamp(**PFORCEWALLPAPER, (int64_t)0, (int64_t)2));
texPath += ".png"; texPath += ".png";

View File

@ -48,8 +48,8 @@ CHyprRenderer::CHyprRenderer() {
} }
static void renderSurface(struct wlr_surface* surface, int x, int y, void* data) { static void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
static auto* const PBLURPOPUPS = &g_pConfigManager->getConfigValuePtr("decoration:blur:popups")->intValue; static auto* const PBLURPOPUPS = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:popups");
static auto* const PBLURPOPUPSIGNOREALPHA = &g_pConfigManager->getConfigValuePtr("decoration:blur:popups_ignorealpha")->floatValue; static auto* const PBLURPOPUPSIGNOREALPHA = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:popups_ignorealpha");
const auto TEXTURE = wlr_surface_get_texture(surface); const auto TEXTURE = wlr_surface_get_texture(surface);
const auto RDATA = (SRenderData*)data; const auto RDATA = (SRenderData*)data;
@ -148,11 +148,11 @@ static void renderSurface(struct wlr_surface* surface, int x, int y, void* data)
g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, rounding, true); g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, rounding, true);
} }
} else { } else {
if (RDATA->blur && RDATA->popup && *PBLURPOPUPS) { if (RDATA->blur && RDATA->popup && **PBLURPOPUPS) {
if (*PBLURPOPUPSIGNOREALPHA != 1.f) { if (**PBLURPOPUPSIGNOREALPHA != 1.f) {
g_pHyprOpenGL->m_RenderData.discardMode |= DISCARD_ALPHA; g_pHyprOpenGL->m_RenderData.discardMode |= DISCARD_ALPHA;
g_pHyprOpenGL->m_RenderData.discardOpacity = *PBLURPOPUPSIGNOREALPHA; g_pHyprOpenGL->m_RenderData.discardOpacity = **PBLURPOPUPSIGNOREALPHA;
} }
g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, surface, rounding, true); g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, surface, rounding, true);
@ -409,8 +409,8 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID); const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
const auto REALPOS = pWindow->m_vRealPosition.vec() + (pWindow->m_bPinned ? Vector2D{} : PWORKSPACE->m_vRenderOffset.vec()); const auto REALPOS = pWindow->m_vRealPosition.vec() + (pWindow->m_bPinned ? Vector2D{} : PWORKSPACE->m_vRenderOffset.vec());
static auto* const PDIMAROUND = &g_pConfigManager->getConfigValuePtr("decoration:dim_around")->floatValue; static auto* const PDIMAROUND = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:dim_around");
static auto* const PBLUR = &g_pConfigManager->getConfigValuePtr("decoration:blur:enabled")->intValue; static auto* const PBLUR = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:enabled");
SRenderData renderdata = {pMonitor, time}; SRenderData renderdata = {pMonitor, time};
CBox textureBox = {REALPOS.x, REALPOS.y, std::max(pWindow->m_vRealSize.vec().x, 5.0), std::max(pWindow->m_vRealSize.vec().y, 5.0)}; CBox textureBox = {REALPOS.x, REALPOS.y, std::max(pWindow->m_vRealSize.vec().x, 5.0), std::max(pWindow->m_vRealSize.vec().y, 5.0)};
@ -452,7 +452,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
if (*PDIMAROUND && pWindow->m_sAdditionalConfigData.dimAround && !m_bRenderingSnapshot && mode != RENDER_PASS_POPUP) { if (*PDIMAROUND && pWindow->m_sAdditionalConfigData.dimAround && !m_bRenderingSnapshot && mode != RENDER_PASS_POPUP) {
CBox monbox = {0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize.y}; CBox monbox = {0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecTransformedSize.y};
g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, *PDIMAROUND * renderdata.alpha * renderdata.fadeAlpha)); g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, **PDIMAROUND * renderdata.alpha * renderdata.fadeAlpha));
} }
// clip box for animated offsets // clip box for animated offsets
@ -521,11 +521,11 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
} }
} }
static auto* const PXWLUSENN = &g_pConfigManager->getConfigValuePtr("xwayland:use_nearest_neighbor")->intValue; static auto* const PXWLUSENN = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("xwayland:use_nearest_neighbor");
if ((pWindow->m_bIsX11 && *PXWLUSENN) || pWindow->m_sAdditionalConfigData.nearestNeighbor.toUnderlying()) if ((pWindow->m_bIsX11 && **PXWLUSENN) || pWindow->m_sAdditionalConfigData.nearestNeighbor.toUnderlying())
g_pHyprOpenGL->m_RenderData.useNearestNeighbor = true; g_pHyprOpenGL->m_RenderData.useNearestNeighbor = true;
if (pWindow->m_pWLSurface.small() && !pWindow->m_pWLSurface.m_bFillIgnoreSmall && renderdata.blur && *PBLUR) { if (pWindow->m_pWLSurface.small() && !pWindow->m_pWLSurface.m_bFillIgnoreSmall && renderdata.blur && **PBLUR) {
CBox wb = {renderdata.x - pMonitor->vecPosition.x, renderdata.y - pMonitor->vecPosition.y, renderdata.w, renderdata.h}; CBox wb = {renderdata.x - pMonitor->vecPosition.x, renderdata.y - pMonitor->vecPosition.y, renderdata.w, renderdata.h};
wb.scale(pMonitor->scale).round(); wb.scale(pMonitor->scale).round();
g_pHyprOpenGL->renderRectWithBlur(&wb, CColor(0, 0, 0, 0), renderdata.dontRound ? 0 : renderdata.rounding - 1, renderdata.fadeAlpha, g_pHyprOpenGL->renderRectWithBlur(&wb, CColor(0, 0, 0, 0), renderdata.dontRound ? 0 : renderdata.rounding - 1, renderdata.fadeAlpha,
@ -657,11 +657,11 @@ void CHyprRenderer::renderSessionLockSurface(SSessionLockSurface* pSurface, CMon
} }
void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, CWorkspace* pWorkspace, timespec* time, const Vector2D& translate, const float& scale) { void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, CWorkspace* pWorkspace, timespec* time, const Vector2D& translate, const float& scale) {
static auto* const PDIMSPECIAL = &g_pConfigManager->getConfigValuePtr("decoration:dim_special")->floatValue; static auto* const PDIMSPECIAL = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:dim_special");
static auto* const PBLURSPECIAL = &g_pConfigManager->getConfigValuePtr("decoration:blur:special")->intValue; static auto* const PBLURSPECIAL = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:special");
static auto* const PBLUR = &g_pConfigManager->getConfigValuePtr("decoration:blur:enabled")->intValue; static auto* const PBLUR = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:enabled");
static auto* const PRENDERTEX = &g_pConfigManager->getConfigValuePtr("misc:disable_hyprland_logo")->intValue; static auto* const PRENDERTEX = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:disable_hyprland_logo");
static auto* const PBACKGROUNDCOLOR = &g_pConfigManager->getConfigValuePtr("misc:background_color")->intValue; static auto* const PBACKGROUNDCOLOR = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:background_color");
SRenderModifData RENDERMODIFDATA; SRenderModifData RENDERMODIFDATA;
if (translate != Vector2D{0, 0}) if (translate != Vector2D{0, 0})
@ -699,8 +699,8 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, CWorkspace*
g_pHyprOpenGL->blend(false); g_pHyprOpenGL->blend(false);
if (!canSkipBackBufferClear(pMonitor)) { if (!canSkipBackBufferClear(pMonitor)) {
if (*PRENDERTEX /* inverted cfg flag */) if (**PRENDERTEX /* inverted cfg flag */)
g_pHyprOpenGL->clear(CColor(*PBACKGROUNDCOLOR)); g_pHyprOpenGL->clear(CColor(**PBACKGROUNDCOLOR));
else else
g_pHyprOpenGL->clearWithTex(); // will apply the hypr "wallpaper" g_pHyprOpenGL->clearWithTex(); // will apply the hypr "wallpaper"
} }
@ -736,12 +736,12 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, CWorkspace*
const auto SPECIALANIMPROGRS = ws->m_vRenderOffset.isBeingAnimated() ? ws->m_vRenderOffset.getCurveValue() : ws->m_fAlpha.getCurveValue(); const auto SPECIALANIMPROGRS = ws->m_vRenderOffset.isBeingAnimated() ? ws->m_vRenderOffset.getCurveValue() : ws->m_fAlpha.getCurveValue();
const bool ANIMOUT = !pMonitor->specialWorkspaceID; const bool ANIMOUT = !pMonitor->specialWorkspaceID;
if (*PDIMSPECIAL != 0.f) { if (**PDIMSPECIAL != 0.f) {
CBox monbox = {translate.x, translate.y, pMonitor->vecTransformedSize.x * scale, pMonitor->vecTransformedSize.y * scale}; CBox monbox = {translate.x, translate.y, pMonitor->vecTransformedSize.x * scale, pMonitor->vecTransformedSize.y * scale};
g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, *PDIMSPECIAL * (ANIMOUT ? (1.0 - SPECIALANIMPROGRS) : SPECIALANIMPROGRS))); g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, **PDIMSPECIAL * (ANIMOUT ? (1.0 - SPECIALANIMPROGRS) : SPECIALANIMPROGRS)));
} }
if (*PBLURSPECIAL && *PBLUR) { if (**PBLURSPECIAL && **PBLUR) {
CBox monbox = {translate.x, translate.y, pMonitor->vecTransformedSize.x * scale, pMonitor->vecTransformedSize.y * scale}; CBox monbox = {translate.x, translate.y, pMonitor->vecTransformedSize.x * scale, pMonitor->vecTransformedSize.y * scale};
g_pHyprOpenGL->renderRectWithBlur(&monbox, CColor(0, 0, 0, 0), 0, (ANIMOUT ? (1.0 - SPECIALANIMPROGRS) : SPECIALANIMPROGRS)); g_pHyprOpenGL->renderRectWithBlur(&monbox, CColor(0, 0, 0, 0), 0, (ANIMOUT ? (1.0 - SPECIALANIMPROGRS) : SPECIALANIMPROGRS));
} }
@ -943,23 +943,23 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
static std::chrono::high_resolution_clock::time_point renderStartOverlay = std::chrono::high_resolution_clock::now(); static std::chrono::high_resolution_clock::time_point renderStartOverlay = std::chrono::high_resolution_clock::now();
static std::chrono::high_resolution_clock::time_point endRenderOverlay = std::chrono::high_resolution_clock::now(); static std::chrono::high_resolution_clock::time_point endRenderOverlay = std::chrono::high_resolution_clock::now();
static auto* const PDEBUGOVERLAY = &g_pConfigManager->getConfigValuePtr("debug:overlay")->intValue; static auto* const PDEBUGOVERLAY = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:overlay");
static auto* const PDAMAGETRACKINGMODE = &g_pConfigManager->getConfigValuePtr("debug:damage_tracking")->intValue; static auto* const PDAMAGETRACKINGMODE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:damage_tracking");
static auto* const PDAMAGEBLINK = &g_pConfigManager->getConfigValuePtr("debug:damage_blink")->intValue; static auto* const PDAMAGEBLINK = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:damage_blink");
static auto* const PNODIRECTSCANOUT = &g_pConfigManager->getConfigValuePtr("misc:no_direct_scanout")->intValue; static auto* const PNODIRECTSCANOUT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:no_direct_scanout");
static auto* const PVFR = &g_pConfigManager->getConfigValuePtr("misc:vfr")->intValue; static auto* const PVFR = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:vfr");
static auto* const PZOOMFACTOR = &g_pConfigManager->getConfigValuePtr("misc:cursor_zoom_factor")->floatValue; static auto* const PZOOMFACTOR = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("misc:cursor_zoom_factor");
static auto* const PANIMENABLED = &g_pConfigManager->getConfigValuePtr("animations:enabled")->intValue; static auto* const PANIMENABLED = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("animations:enabled");
static auto* const PFIRSTLAUNCHANIM = &g_pConfigManager->getConfigValuePtr("animations:first_launch_animation")->intValue; static auto* const PFIRSTLAUNCHANIM = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("animations:first_launch_animation");
static auto* const PTEARINGENABLED = &g_pConfigManager->getConfigValuePtr("general:allow_tearing")->intValue; static auto* const PTEARINGENABLED = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:allow_tearing");
static int damageBlinkCleanup = 0; // because double-buffered static int damageBlinkCleanup = 0; // because double-buffered
if (!*PDAMAGEBLINK) if (!**PDAMAGEBLINK)
damageBlinkCleanup = 0; damageBlinkCleanup = 0;
static bool firstLaunch = true; static bool firstLaunch = true;
static bool firstLaunchAnimActive = *PFIRSTLAUNCHANIM; static bool firstLaunchAnimActive = **PFIRSTLAUNCHANIM;
float zoomInFactorFirstLaunch = 1.f; float zoomInFactorFirstLaunch = 1.f;
@ -969,7 +969,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
} }
if (m_tRenderTimer.getSeconds() < 1.5f && firstLaunchAnimActive) { // TODO: make the animation system more damage-flexible so that this can be migrated to there if (m_tRenderTimer.getSeconds() < 1.5f && firstLaunchAnimActive) { // TODO: make the animation system more damage-flexible so that this can be migrated to there
if (!*PANIMENABLED) { if (!**PANIMENABLED) {
zoomInFactorFirstLaunch = 1.f; zoomInFactorFirstLaunch = 1.f;
firstLaunchAnimActive = false; firstLaunchAnimActive = false;
} else { } else {
@ -982,18 +982,17 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
renderStart = std::chrono::high_resolution_clock::now(); renderStart = std::chrono::high_resolution_clock::now();
if (*PDEBUGOVERLAY == 1) { if (**PDEBUGOVERLAY == 1)
g_pDebugOverlay->frameData(pMonitor); g_pDebugOverlay->frameData(pMonitor);
}
if (pMonitor->framesToSkip > 0) { if (pMonitor->framesToSkip > 0) {
pMonitor->framesToSkip -= 1; pMonitor->framesToSkip -= 1;
if (!pMonitor->noFrameSchedule) if (!pMonitor->noFrameSchedule)
g_pCompositor->scheduleFrameForMonitor(pMonitor); g_pCompositor->scheduleFrameForMonitor(pMonitor);
else { else
Debug::log(LOG, "NoFrameSchedule hit for {}.", pMonitor->szName); Debug::log(LOG, "NoFrameSchedule hit for {}.", pMonitor->szName);
}
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(pMonitor->ID); g_pLayoutManager->getCurrentLayout()->recalculateMonitor(pMonitor->ID);
if (pMonitor->framesToSkip > 10) if (pMonitor->framesToSkip > 10)
@ -1003,7 +1002,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
// checks // // checks //
if (pMonitor->ID == m_pMostHzMonitor->ID || if (pMonitor->ID == m_pMostHzMonitor->ID ||
*PVFR == 1) { // unfortunately with VFR we don't have the guarantee mostHz is going to be updated all the time, so we have to ignore that **PVFR == 1) { // unfortunately with VFR we don't have the guarantee mostHz is going to be updated all the time, so we have to ignore that
g_pCompositor->sanityCheckWorkspaces(); g_pCompositor->sanityCheckWorkspaces();
g_pConfigManager->dispatchExecOnce(); // We exec-once when at least one monitor starts refreshing, meaning stuff has init'd g_pConfigManager->dispatchExecOnce(); // We exec-once when at least one monitor starts refreshing, meaning stuff has init'd
@ -1044,7 +1043,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
if (pMonitor->tearingState.nextRenderTorn) { if (pMonitor->tearingState.nextRenderTorn) {
pMonitor->tearingState.nextRenderTorn = false; pMonitor->tearingState.nextRenderTorn = false;
if (!*PTEARINGENABLED) { if (!**PTEARINGENABLED) {
Debug::log(WARN, "Tearing commit requested but the master switch general:allow_tearing is off, ignoring"); Debug::log(WARN, "Tearing commit requested but the master switch general:allow_tearing is off, ignoring");
return; return;
} }
@ -1063,7 +1062,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
shouldTear = true; shouldTear = true;
} }
if (!*PNODIRECTSCANOUT && !shouldTear) { if (!**PNODIRECTSCANOUT && !shouldTear) {
if (attemptDirectScanout(pMonitor)) { if (attemptDirectScanout(pMonitor)) {
return; return;
} else if (m_pLastScanout) { } else if (m_pLastScanout) {
@ -1085,10 +1084,10 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
// check the damage // check the damage
bool hasChanged = pMonitor->output->needs_frame || pixman_region32_not_empty(&pMonitor->damage.current); bool hasChanged = pMonitor->output->needs_frame || pixman_region32_not_empty(&pMonitor->damage.current);
if (!hasChanged && *PDAMAGETRACKINGMODE != DAMAGE_TRACKING_NONE && pMonitor->forceFullFrames == 0 && damageBlinkCleanup == 0) if (!hasChanged && **PDAMAGETRACKINGMODE != DAMAGE_TRACKING_NONE && pMonitor->forceFullFrames == 0 && damageBlinkCleanup == 0)
return; return;
if (*PDAMAGETRACKINGMODE == -1) { if (**PDAMAGETRACKINGMODE == -1) {
Debug::log(CRIT, "Damage tracking mode -1 ????"); Debug::log(CRIT, "Damage tracking mode -1 ????");
return; return;
} }
@ -1108,21 +1107,21 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
g_pCompositor->cleanupFadingOut(pMonitor->ID); g_pCompositor->cleanupFadingOut(pMonitor->ID);
// if we have no tracking or full tracking, invalidate the entire monitor // if we have no tracking or full tracking, invalidate the entire monitor
if (*PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || *PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR || pMonitor->forceFullFrames > 0 || damageBlinkCleanup > 0 || if (**PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || **PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR || pMonitor->forceFullFrames > 0 || damageBlinkCleanup > 0 ||
pMonitor->isMirror() /* why??? */) { pMonitor->isMirror() /* why??? */) {
damage = {0, 0, (int)pMonitor->vecTransformedSize.x * 10, (int)pMonitor->vecTransformedSize.y * 10}; damage = {0, 0, (int)pMonitor->vecTransformedSize.x * 10, (int)pMonitor->vecTransformedSize.y * 10};
pMonitor->lastFrameDamage = damage; pMonitor->lastFrameDamage = damage;
} else { } else {
static auto* const PBLURENABLED = &g_pConfigManager->getConfigValuePtr("decoration:blur:enabled")->intValue; static auto* const PBLURENABLED = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:enabled");
// if we use blur we need to expand the damage for proper blurring // if we use blur we need to expand the damage for proper blurring
if (*PBLURENABLED == 1) { if (**PBLURENABLED == 1) {
// TODO: can this be optimized? // TODO: can this be optimized?
static auto* const PBLURSIZE = &g_pConfigManager->getConfigValuePtr("decoration:blur:size")->intValue; static auto* const PBLURSIZE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:size");
static auto* const PBLURPASSES = &g_pConfigManager->getConfigValuePtr("decoration:blur:passes")->intValue; static auto* const PBLURPASSES = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:blur:passes");
const auto BLURRADIUS = const auto BLURRADIUS =
*PBLURPASSES > 10 ? pow(2, 15) : std::clamp(*PBLURSIZE, (int64_t)1, (int64_t)40) * pow(2, *PBLURPASSES); // is this 2^pass? I don't know but it works... I think. **PBLURPASSES > 10 ? pow(2, 15) : std::clamp(**PBLURSIZE, (int64_t)1, (int64_t)40) * pow(2, **PBLURPASSES); // is this 2^pass? I don't know but it works... I think.
// now, prep the damage, get the extended damage region // now, prep the damage, get the extended damage region
wlr_region_expand(damage.pixman(), damage.pixman(), BLURRADIUS); // expand for proper blurring wlr_region_expand(damage.pixman(), damage.pixman(), BLURRADIUS); // expand for proper blurring
@ -1147,7 +1146,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
TRACY_GPU_ZONE("Render"); TRACY_GPU_ZONE("Render");
if (pMonitor == g_pCompositor->getMonitorFromCursor()) if (pMonitor == g_pCompositor->getMonitorFromCursor())
g_pHyprOpenGL->m_RenderData.mouseZoomFactor = std::clamp(*PZOOMFACTOR, 1.f, INFINITY); g_pHyprOpenGL->m_RenderData.mouseZoomFactor = std::clamp(**PZOOMFACTOR, 1.f, INFINITY);
else else
g_pHyprOpenGL->m_RenderData.mouseZoomFactor = 1.f; g_pHyprOpenGL->m_RenderData.mouseZoomFactor = 1.f;
@ -1191,17 +1190,17 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
} }
// for drawing the debug overlay // for drawing the debug overlay
if (pMonitor == g_pCompositor->m_vMonitors.front().get() && *PDEBUGOVERLAY == 1) { if (pMonitor == g_pCompositor->m_vMonitors.front().get() && **PDEBUGOVERLAY == 1) {
renderStartOverlay = std::chrono::high_resolution_clock::now(); renderStartOverlay = std::chrono::high_resolution_clock::now();
g_pDebugOverlay->draw(); g_pDebugOverlay->draw();
endRenderOverlay = std::chrono::high_resolution_clock::now(); endRenderOverlay = std::chrono::high_resolution_clock::now();
} }
if (*PDAMAGEBLINK && damageBlinkCleanup == 0) { if (**PDAMAGEBLINK && damageBlinkCleanup == 0) {
CBox monrect = {0, 0, pMonitor->vecTransformedSize.x, pMonitor->vecTransformedSize.y}; CBox monrect = {0, 0, pMonitor->vecTransformedSize.x, pMonitor->vecTransformedSize.y};
g_pHyprOpenGL->renderRect(&monrect, CColor(1.0, 0.0, 1.0, 100.0 / 255.0), 0); g_pHyprOpenGL->renderRect(&monrect, CColor(1.0, 0.0, 1.0, 100.0 / 255.0), 0);
damageBlinkCleanup = 1; damageBlinkCleanup = 1;
} else if (*PDAMAGEBLINK) { } else if (**PDAMAGEBLINK) {
damageBlinkCleanup++; damageBlinkCleanup++;
if (damageBlinkCleanup > 3) if (damageBlinkCleanup > 3)
damageBlinkCleanup = 0; damageBlinkCleanup = 0;
@ -1216,7 +1215,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
if (renderCursor) { if (renderCursor) {
TRACY_GPU_ZONE("RenderCursor"); TRACY_GPU_ZONE("RenderCursor");
bool lockSoftware = pMonitor == g_pCompositor->getMonitorFromCursor() && *PZOOMFACTOR != 1.f; bool lockSoftware = pMonitor == g_pCompositor->getMonitorFromCursor() && **PZOOMFACTOR != 1.f;
if (lockSoftware) { if (lockSoftware) {
wlr_output_lock_software_cursors(pMonitor->output, true); wlr_output_lock_software_cursors(pMonitor->output, true);
@ -1238,10 +1237,10 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
const auto TRANSFORM = wlr_output_transform_invert(pMonitor->output->transform); const auto TRANSFORM = wlr_output_transform_invert(pMonitor->output->transform);
wlr_region_transform(frameDamage.pixman(), pMonitor->lastFrameDamage.pixman(), TRANSFORM, (int)pMonitor->vecTransformedSize.x, (int)pMonitor->vecTransformedSize.y); wlr_region_transform(frameDamage.pixman(), pMonitor->lastFrameDamage.pixman(), TRANSFORM, (int)pMonitor->vecTransformedSize.x, (int)pMonitor->vecTransformedSize.y);
if (*PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || *PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR) if (**PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || **PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR)
frameDamage.add(0, 0, (int)pMonitor->vecTransformedSize.x, (int)pMonitor->vecTransformedSize.y); frameDamage.add(0, 0, (int)pMonitor->vecTransformedSize.x, (int)pMonitor->vecTransformedSize.y);
if (*PDAMAGEBLINK) if (**PDAMAGEBLINK)
frameDamage.add(damage); frameDamage.add(damage);
g_pHyprRenderer->damageMirrorsWith(pMonitor, frameDamage); g_pHyprRenderer->damageMirrorsWith(pMonitor, frameDamage);
@ -1269,7 +1268,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
if (UNLOCK_SC) if (UNLOCK_SC)
wlr_output_lock_software_cursors(pMonitor->output, false); wlr_output_lock_software_cursors(pMonitor->output, false);
if (*PDAMAGEBLINK || *PVFR == 0 || pMonitor->pendingFrame) if (**PDAMAGEBLINK || **PVFR == 0 || pMonitor->pendingFrame)
g_pCompositor->scheduleFrameForMonitor(pMonitor); g_pCompositor->scheduleFrameForMonitor(pMonitor);
pMonitor->pendingFrame = false; pMonitor->pendingFrame = false;
@ -1277,7 +1276,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
const float µs = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - renderStart).count() / 1000.f; const float µs = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - renderStart).count() / 1000.f;
g_pDebugOverlay->renderData(pMonitor, µs); g_pDebugOverlay->renderData(pMonitor, µs);
if (*PDEBUGOVERLAY == 1) { if (**PDEBUGOVERLAY == 1) {
if (pMonitor == g_pCompositor->m_vMonitors.front().get()) { if (pMonitor == g_pCompositor->m_vMonitors.front().get()) {
const float µsNoOverlay = µs - std::chrono::duration_cast<std::chrono::nanoseconds>(endRenderOverlay - renderStartOverlay).count() / 1000.f; const float µsNoOverlay = µs - std::chrono::duration_cast<std::chrono::nanoseconds>(endRenderOverlay - renderStartOverlay).count() / 1000.f;
g_pDebugOverlay->renderDataNoOverlay(pMonitor, µsNoOverlay); g_pDebugOverlay->renderDataNoOverlay(pMonitor, µsNoOverlay);
@ -1346,7 +1345,7 @@ void CHyprRenderer::outputMgrApplyTest(wlr_output_configuration_v1* config, bool
if (!head->state.enabled) { if (!head->state.enabled) {
commandForCfg += "disabled"; commandForCfg += "disabled";
if (!test) if (!test)
g_pConfigManager->parseKeyword("monitor", commandForCfg, true); g_pConfigManager->parseKeyword("monitor", commandForCfg);
continue; continue;
} }
@ -1365,7 +1364,7 @@ void CHyprRenderer::outputMgrApplyTest(wlr_output_configuration_v1* config, bool
std::to_string((int)head->state.transform); std::to_string((int)head->state.transform);
if (!test) { if (!test) {
g_pConfigManager->parseKeyword("monitor", commandForCfg, true); g_pConfigManager->parseKeyword("monitor", commandForCfg);
wlr_output_state_set_adaptive_sync_enabled(PMONITOR->state.wlr(), head->state.adaptive_sync_enabled); wlr_output_state_set_adaptive_sync_enabled(PMONITOR->state.wlr(), head->state.adaptive_sync_enabled);
} }
@ -1619,9 +1618,9 @@ void CHyprRenderer::damageSurface(wlr_surface* pSurface, double x, double y, dou
m->addDamage(&damageBoxForEach); m->addDamage(&damageBoxForEach);
} }
static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue; static auto* const PLOGDAMAGE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:log_damage");
if (*PLOGDAMAGE) if (**PLOGDAMAGE)
Debug::log(LOG, "Damage: Surface (extents): xy: {}, {} wh: {}, {}", damageBox.pixman()->extents.x1, damageBox.pixman()->extents.y1, Debug::log(LOG, "Damage: Surface (extents): xy: {}, {} wh: {}, {}", damageBox.pixman()->extents.x1, damageBox.pixman()->extents.y1,
damageBox.pixman()->extents.x2 - damageBox.pixman()->extents.x1, damageBox.pixman()->extents.y2 - damageBox.pixman()->extents.y1); damageBox.pixman()->extents.x2 - damageBox.pixman()->extents.x1, damageBox.pixman()->extents.y2 - damageBox.pixman()->extents.y1);
} }
@ -1640,9 +1639,9 @@ void CHyprRenderer::damageWindow(CWindow* pWindow) {
for (auto& wd : pWindow->m_dWindowDecorations) for (auto& wd : pWindow->m_dWindowDecorations)
wd->damageEntire(); wd->damageEntire();
static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue; static auto* const PLOGDAMAGE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:log_damage");
if (*PLOGDAMAGE) if (**PLOGDAMAGE)
Debug::log(LOG, "Damage: Window ({}): xy: {}, {} wh: {}, {}", pWindow->m_szTitle, damageBox.x, damageBox.y, damageBox.width, damageBox.height); Debug::log(LOG, "Damage: Window ({}): xy: {}, {} wh: {}, {}", pWindow->m_szTitle, damageBox.x, damageBox.y, damageBox.width, damageBox.height);
} }
@ -1653,9 +1652,9 @@ void CHyprRenderer::damageMonitor(CMonitor* pMonitor) {
CBox damageBox = {0, 0, INT16_MAX, INT16_MAX}; CBox damageBox = {0, 0, INT16_MAX, INT16_MAX};
pMonitor->addDamage(&damageBox); pMonitor->addDamage(&damageBox);
static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue; static auto* const PLOGDAMAGE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:log_damage");
if (*PLOGDAMAGE) if (**PLOGDAMAGE)
Debug::log(LOG, "Damage: Monitor {}", pMonitor->szName); Debug::log(LOG, "Damage: Monitor {}", pMonitor->szName);
} }
@ -1672,9 +1671,9 @@ void CHyprRenderer::damageBox(CBox* pBox) {
m->addDamage(&damageBox); m->addDamage(&damageBox);
} }
static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue; static auto* const PLOGDAMAGE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:log_damage");
if (*PLOGDAMAGE) if (**PLOGDAMAGE)
Debug::log(LOG, "Damage: Box: xy: {}, {} wh: {}, {}", pBox->x, pBox->y, pBox->width, pBox->height); Debug::log(LOG, "Damage: Box: xy: {}, {} wh: {}, {}", pBox->x, pBox->y, pBox->width, pBox->height);
} }
@ -1730,7 +1729,7 @@ DAMAGETRACKINGMODES CHyprRenderer::damageTrackingModeFromStr(const std::string&
bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorRule, bool force) { bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorRule, bool force) {
static auto* const PDISABLESCALECHECKS = &g_pConfigManager->getConfigValuePtr("debug:disable_scale_checks")->intValue; static auto* const PDISABLESCALECHECKS = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:disable_scale_checks");
Debug::log(LOG, "Applying monitor rule for {}", pMonitor->szName); Debug::log(LOG, "Applying monitor rule for {}", pMonitor->szName);
@ -2007,7 +2006,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
pMonitor->vecPixelSize = pMonitor->vecSize; pMonitor->vecPixelSize = pMonitor->vecSize;
Vector2D logicalSize = pMonitor->vecPixelSize / pMonitor->scale; Vector2D logicalSize = pMonitor->vecPixelSize / pMonitor->scale;
if (!*PDISABLESCALECHECKS && (logicalSize.x != std::round(logicalSize.x) || logicalSize.y != std::round(logicalSize.y))) { if (!**PDISABLESCALECHECKS && (logicalSize.x != std::round(logicalSize.x) || logicalSize.y != std::round(logicalSize.y))) {
// invalid scale, will produce fractional pixels. // invalid scale, will produce fractional pixels.
// find the nearest valid. // find the nearest valid.
@ -2175,13 +2174,13 @@ void CHyprRenderer::setCursorFromName(const std::string& name, bool force) {
} }
void CHyprRenderer::ensureCursorRenderingMode() { void CHyprRenderer::ensureCursorRenderingMode() {
static auto* const PCURSORTIMEOUT = &g_pConfigManager->getConfigValuePtr("general:cursor_inactive_timeout")->intValue; static auto* const PCURSORTIMEOUT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:cursor_inactive_timeout");
static auto* const PHIDEONTOUCH = &g_pConfigManager->getConfigValuePtr("misc:hide_cursor_on_touch")->intValue; static auto* const PHIDEONTOUCH = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("misc:hide_cursor_on_touch");
const auto PASSEDCURSORSECONDS = g_pInputManager->m_tmrLastCursorMovement.getSeconds(); const auto PASSEDCURSORSECONDS = g_pInputManager->m_tmrLastCursorMovement.getSeconds();
if (*PCURSORTIMEOUT > 0 || *PHIDEONTOUCH) { if (**PCURSORTIMEOUT > 0 || **PHIDEONTOUCH) {
const bool HIDE = (*PCURSORTIMEOUT > 0 && *PCURSORTIMEOUT < PASSEDCURSORSECONDS) || (g_pInputManager->m_bLastInputTouch && *PHIDEONTOUCH); const bool HIDE = (**PCURSORTIMEOUT > 0 && **PCURSORTIMEOUT < PASSEDCURSORSECONDS) || (g_pInputManager->m_bLastInputTouch && **PHIDEONTOUCH);
if (HIDE && !m_bCursorHidden) { if (HIDE && !m_bCursorHidden) {
Debug::log(LOG, "Hiding the cursor (timeout)"); Debug::log(LOG, "Hiding the cursor (timeout)");
@ -2272,7 +2271,9 @@ void CHyprRenderer::initiateManualCrash() {
g_pHyprOpenGL->m_tGlobalTimer.reset(); g_pHyprOpenGL->m_tGlobalTimer.reset();
g_pConfigManager->setInt("debug:damage_tracking", 0); static auto* const PDT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("debug:damage_tracking");
**PDT = 0;
} }
void CHyprRenderer::setOccludedForMainWorkspace(CRegion& region, CWorkspace* pWorkspace) { void CHyprRenderer::setOccludedForMainWorkspace(CRegion& region, CWorkspace* pWorkspace) {
@ -2491,7 +2492,7 @@ bool CHyprRenderer::beginRender(CMonitor* pMonitor, CRegion& damage, eRenderMode
void CHyprRenderer::endRender() { void CHyprRenderer::endRender() {
const auto PMONITOR = g_pHyprOpenGL->m_RenderData.pMonitor; const auto PMONITOR = g_pHyprOpenGL->m_RenderData.pMonitor;
static auto* const PNVIDIAANTIFLICKER = &g_pConfigManager->getConfigValuePtr("opengl:nvidia_anti_flicker")->intValue; static auto* const PNVIDIAANTIFLICKER = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("opengl:nvidia_anti_flicker");
if (m_eRenderMode != RENDER_MODE_TO_BUFFER_READ_ONLY) if (m_eRenderMode != RENDER_MODE_TO_BUFFER_READ_ONLY)
g_pHyprOpenGL->end(); g_pHyprOpenGL->end();
@ -2504,7 +2505,7 @@ void CHyprRenderer::endRender() {
if (m_eRenderMode == RENDER_MODE_FULL_FAKE) if (m_eRenderMode == RENDER_MODE_FULL_FAKE)
return; return;
if (isNvidia() && *PNVIDIAANTIFLICKER) if (isNvidia() && **PNVIDIAANTIFLICKER)
glFinish(); glFinish();
else else
glFlush(); glFlush();

View File

@ -94,9 +94,9 @@ eDecorationLayer CHyprBorderDecoration::getDecorationLayer() {
} }
uint64_t CHyprBorderDecoration::getDecorationFlags() { uint64_t CHyprBorderDecoration::getDecorationFlags() {
static auto* const PPARTOFWINDOW = &g_pConfigManager->getConfigValuePtr("general:border_part_of_window")->intValue; static auto* const PPARTOFWINDOW = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("general:border_part_of_window");
return *PPARTOFWINDOW && !doesntWantBorders() ? DECORATION_PART_OF_MAIN_WINDOW : 0; return **PPARTOFWINDOW && !doesntWantBorders() ? DECORATION_PART_OF_MAIN_WINDOW : 0;
} }
std::string CHyprBorderDecoration::getDisplayName() { std::string CHyprBorderDecoration::getDisplayName() {

View File

@ -35,9 +35,9 @@ std::string CHyprDropShadowDecoration::getDisplayName() {
} }
void CHyprDropShadowDecoration::damageEntire() { void CHyprDropShadowDecoration::damageEntire() {
static auto* const PSHADOWS = &g_pConfigManager->getConfigValuePtr("decoration:drop_shadow")->intValue; static auto* const PSHADOWS = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:drop_shadow");
if (*PSHADOWS != 1) if (**PSHADOWS != 1)
return; // disabled return; // disabled
CBox dm = {m_vLastWindowPos.x - m_seExtents.topLeft.x, m_vLastWindowPos.y - m_seExtents.topLeft.y, m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x, CBox dm = {m_vLastWindowPos.x - m_seExtents.topLeft.x, m_vLastWindowPos.y - m_seExtents.topLeft.y, m_vLastWindowSize.x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x,
@ -70,13 +70,13 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D
if (m_pWindow->m_sAdditionalConfigData.forceNoShadow) if (m_pWindow->m_sAdditionalConfigData.forceNoShadow)
return; return;
static auto* const PSHADOWS = &g_pConfigManager->getConfigValuePtr("decoration:drop_shadow")->intValue; static auto* const PSHADOWS = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:drop_shadow");
static auto* const PSHADOWSIZE = &g_pConfigManager->getConfigValuePtr("decoration:shadow_range")->intValue; static auto* const PSHADOWSIZE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:shadow_range");
static auto* const PSHADOWIGNOREWINDOW = &g_pConfigManager->getConfigValuePtr("decoration:shadow_ignore_window")->intValue; static auto* const PSHADOWIGNOREWINDOW = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("decoration:shadow_ignore_window");
static auto* const PSHADOWSCALE = &g_pConfigManager->getConfigValuePtr("decoration:shadow_scale")->floatValue; static auto* const PSHADOWSCALE = (Hyprlang::FLOAT* const*)g_pConfigManager->getConfigValuePtr("decoration:shadow_scale");
static auto* const PSHADOWOFFSET = &g_pConfigManager->getConfigValuePtr("decoration:shadow_offset")->vecValue; static auto* const PSHADOWOFFSET = (Hyprlang::VEC2* const*)g_pConfigManager->getConfigValuePtr("decoration:shadow_offset");
if (*PSHADOWS != 1) if (**PSHADOWS != 1)
return; // disabled return; // disabled
const auto ROUNDINGBASE = m_pWindow->rounding(); const auto ROUNDINGBASE = m_pWindow->rounding();
@ -87,15 +87,15 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D
// draw the shadow // draw the shadow
CBox fullBox = m_bLastWindowBoxWithDecos; CBox fullBox = m_bLastWindowBoxWithDecos;
fullBox.translate(-pMonitor->vecPosition + WORKSPACEOFFSET); fullBox.translate(-pMonitor->vecPosition + WORKSPACEOFFSET);
fullBox.x -= *PSHADOWSIZE; fullBox.x -= **PSHADOWSIZE;
fullBox.y -= *PSHADOWSIZE; fullBox.y -= **PSHADOWSIZE;
fullBox.w += 2 * *PSHADOWSIZE; fullBox.w += 2 * **PSHADOWSIZE;
fullBox.h += 2 * *PSHADOWSIZE; fullBox.h += 2 * **PSHADOWSIZE;
const float SHADOWSCALE = std::clamp(*PSHADOWSCALE, 0.f, 1.f); const float SHADOWSCALE = std::clamp(**PSHADOWSCALE, 0.f, 1.f);
// scale the box in relation to the center of the box // scale the box in relation to the center of the box
fullBox.scaleFromCenter(SHADOWSCALE).translate(*PSHADOWOFFSET); fullBox.scaleFromCenter(SHADOWSCALE).translate(**PSHADOWOFFSET);
m_vLastWindowPos += WORKSPACEOFFSET; m_vLastWindowPos += WORKSPACEOFFSET;
m_seExtents = {{m_vLastWindowPos.x - fullBox.x - pMonitor->vecPosition.x + 2, m_vLastWindowPos.y - fullBox.y - pMonitor->vecPosition.y + 2}, m_seExtents = {{m_vLastWindowPos.x - fullBox.x - pMonitor->vecPosition.x + 2, m_vLastWindowPos.y - fullBox.y - pMonitor->vecPosition.y + 2},
@ -147,7 +147,7 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D
g_pHyprOpenGL->renderRect(&fullBox, CColor(0, 0, 0, 1), 0); g_pHyprOpenGL->renderRect(&fullBox, CColor(0, 0, 0, 1), 0);
// render white shadow with the alpha of the shadow color (otherwise we clear with alpha later and shit it to 2 bit) // render white shadow with the alpha of the shadow color (otherwise we clear with alpha later and shit it to 2 bit)
g_pHyprOpenGL->renderRoundedShadow(&fullBox, ROUNDING * pMonitor->scale, *PSHADOWSIZE * pMonitor->scale, CColor(1, 1, 1, m_pWindow->m_cRealShadowColor.col().a), a); g_pHyprOpenGL->renderRoundedShadow(&fullBox, ROUNDING * pMonitor->scale, **PSHADOWSIZE * pMonitor->scale, CColor(1, 1, 1, m_pWindow->m_cRealShadowColor.col().a), a);
// render black window box ("clip") // render black window box ("clip")
g_pHyprOpenGL->renderRect(&windowBox, CColor(0, 0, 0, 1.0), ROUNDING * pMonitor->scale); g_pHyprOpenGL->renderRect(&windowBox, CColor(0, 0, 0, 1.0), ROUNDING * pMonitor->scale);
@ -166,7 +166,7 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a, const Vector2D
g_pHyprOpenGL->m_RenderData.damage = saveDamage; g_pHyprOpenGL->m_RenderData.damage = saveDamage;
} else { } else {
g_pHyprOpenGL->renderRoundedShadow(&fullBox, ROUNDING * pMonitor->scale, *PSHADOWSIZE * pMonitor->scale, m_pWindow->m_cRealShadowColor.col(), a); g_pHyprOpenGL->renderRoundedShadow(&fullBox, ROUNDING * pMonitor->scale, **PSHADOWSIZE * pMonitor->scale, m_pWindow->m_cRealShadowColor.col(), a);
} }
if (m_seExtents != m_seReportedExtents) if (m_seExtents != m_seReportedExtents)

View File

@ -15,30 +15,31 @@ constexpr int BAR_TEXT_PAD = 2;
constexpr int BAR_HORIZONTAL_PADDING = 2; constexpr int BAR_HORIZONTAL_PADDING = 2;
CHyprGroupBarDecoration::CHyprGroupBarDecoration(CWindow* pWindow) : IHyprWindowDecoration(pWindow) { CHyprGroupBarDecoration::CHyprGroupBarDecoration(CWindow* pWindow) : IHyprWindowDecoration(pWindow) {
static auto* const PGRADIENTS = &g_pConfigManager->getConfigValuePtr("group:groupbar:enabled")->intValue; static auto* const PGRADIENTS = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:enabled");
static auto* const PENABLED = &g_pConfigManager->getConfigValuePtr("group:groupbar:gradients")->intValue; static auto* const PENABLED = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:gradients");
m_pWindow = pWindow; m_pWindow = pWindow;
if (m_tGradientActive.m_iTexID == 0 && *PENABLED && *PGRADIENTS) if (m_tGradientActive.m_iTexID == 0 && **PENABLED && **PGRADIENTS)
refreshGroupBarGradients(); refreshGroupBarGradients();
} }
CHyprGroupBarDecoration::~CHyprGroupBarDecoration() {} CHyprGroupBarDecoration::~CHyprGroupBarDecoration() {}
SDecorationPositioningInfo CHyprGroupBarDecoration::getPositioningInfo() { SDecorationPositioningInfo CHyprGroupBarDecoration::getPositioningInfo() {
static auto* const PHEIGHT = &g_pConfigManager->getConfigValuePtr("group:groupbar:height")->intValue; static auto* const PHEIGHT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:height");
static auto* const PENABLED = &g_pConfigManager->getConfigValuePtr("group:groupbar:enabled")->intValue; static auto* const PENABLED = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:enabled");
static auto* const PRENDERTITLES = &g_pConfigManager->getConfigValuePtr("group:groupbar:render_titles")->intValue; static auto* const PRENDERTITLES = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:render_titles");
static auto* const PGRADIENTS = &g_pConfigManager->getConfigValuePtr("group:groupbar:gradients")->intValue; static auto* const PGRADIENTS = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:gradients");
static auto* const PPRIORITY = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:priority");
SDecorationPositioningInfo info; SDecorationPositioningInfo info;
info.policy = DECORATION_POSITION_STICKY; info.policy = DECORATION_POSITION_STICKY;
info.edges = DECORATION_EDGE_TOP; info.edges = DECORATION_EDGE_TOP;
info.priority = g_pConfigManager->getConfigValuePtr("group:groupbar:priority")->intValue; info.priority = **PPRIORITY;
info.reserved = true; info.reserved = true;
if (*PENABLED && m_pWindow->m_sSpecialRenderData.decorate) if (**PENABLED && m_pWindow->m_sSpecialRenderData.decorate)
info.desiredExtents = {{0, BAR_PADDING_OUTER_VERT * 2 + BAR_INDICATOR_HEIGHT + (*PGRADIENTS || *PRENDERTITLES ? *PHEIGHT : 0) + 2}, {0, 0}}; info.desiredExtents = {{0, BAR_PADDING_OUTER_VERT * 2 + BAR_INDICATOR_HEIGHT + (**PGRADIENTS || **PRENDERTITLES ? **PHEIGHT : 0) + 2}, {0, 0}};
else else
info.desiredExtents = {{0, 0}, {0, 0}}; info.desiredExtents = {{0, 0}, {0, 0}};
@ -88,20 +89,20 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D&
// get how many bars we will draw // get how many bars we will draw
int barsToDraw = m_dwGroupMembers.size(); int barsToDraw = m_dwGroupMembers.size();
static auto* const PENABLED = &g_pConfigManager->getConfigValuePtr("group:groupbar:enabled")->intValue; static auto* const PENABLED = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:enabled");
static auto* const PRENDERTITLES = &g_pConfigManager->getConfigValuePtr("group:groupbar:render_titles")->intValue; static auto* const PRENDERTITLES = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:render_titles");
static auto* const PTITLEFONTSIZE = &g_pConfigManager->getConfigValuePtr("group:groupbar:font_size")->intValue; static auto* const PTITLEFONTSIZE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:font_size");
static auto* const PHEIGHT = &g_pConfigManager->getConfigValuePtr("group:groupbar:height")->intValue; static auto* const PHEIGHT = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:height");
static auto* const PGRADIENTS = &g_pConfigManager->getConfigValuePtr("group:groupbar:gradients")->intValue; static auto* const PGRADIENTS = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:gradients");
if (!*PENABLED || !m_pWindow->m_sSpecialRenderData.decorate) if (!**PENABLED || !m_pWindow->m_sSpecialRenderData.decorate)
return; return;
const auto ASSIGNEDBOX = assignedBoxGlobal(); const auto ASSIGNEDBOX = assignedBoxGlobal();
m_fBarWidth = (ASSIGNEDBOX.w - BAR_HORIZONTAL_PADDING * (barsToDraw - 1)) / barsToDraw; m_fBarWidth = (ASSIGNEDBOX.w - BAR_HORIZONTAL_PADDING * (barsToDraw - 1)) / barsToDraw;
const auto DESIREDHEIGHT = BAR_PADDING_OUTER_VERT * 2 + BAR_INDICATOR_HEIGHT + (*PGRADIENTS || *PRENDERTITLES ? *PHEIGHT : 0) + 2; const auto DESIREDHEIGHT = BAR_PADDING_OUTER_VERT * 2 + BAR_INDICATOR_HEIGHT + (**PGRADIENTS || **PRENDERTITLES ? **PHEIGHT : 0) + 2;
if (DESIREDHEIGHT != ASSIGNEDBOX.h) if (DESIREDHEIGHT != ASSIGNEDBOX.h)
g_pDecorationPositioner->repositionDeco(this); g_pDecorationPositioner->repositionDeco(this);
@ -116,17 +117,20 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D&
rect.scale(pMonitor->scale); rect.scale(pMonitor->scale);
static auto* const PGROUPCOLACTIVE = &g_pConfigManager->getConfigValuePtr("group:groupbar:col.active")->data; static auto* const PGROUPCOLACTIVE = (Hyprlang::CUSTOMTYPE* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:col.active");
static auto* const PGROUPCOLINACTIVE = &g_pConfigManager->getConfigValuePtr("group:groupbar:col.inactive")->data; static auto* const PGROUPCOLINACTIVE = (Hyprlang::CUSTOMTYPE* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:col.inactive");
static auto* const PGROUPCOLACTIVELOCKED = &g_pConfigManager->getConfigValuePtr("group:groupbar:col.locked_active")->data; static auto* const PGROUPCOLACTIVELOCKED = (Hyprlang::CUSTOMTYPE* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:col.locked_active");
static auto* const PGROUPCOLINACTIVELOCKED = &g_pConfigManager->getConfigValuePtr("group:groupbar:col.locked_inactive")->data; static auto* const PGROUPCOLINACTIVELOCKED = (Hyprlang::CUSTOMTYPE* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:col.locked_inactive");
auto* const GROUPCOLACTIVE = (CGradientValueData*)(*PGROUPCOLACTIVE)->getData();
auto* const GROUPCOLINACTIVE = (CGradientValueData*)(*PGROUPCOLINACTIVE)->getData();
auto* const GROUPCOLACTIVELOCKED = (CGradientValueData*)(*PGROUPCOLACTIVELOCKED)->getData();
auto* const GROUPCOLINACTIVELOCKED = (CGradientValueData*)(*PGROUPCOLINACTIVELOCKED)->getData();
const bool GROUPLOCKED = m_pWindow->getGroupHead()->m_sGroupData.locked; const bool GROUPLOCKED = m_pWindow->getGroupHead()->m_sGroupData.locked;
const auto* const PCOLACTIVE = GROUPLOCKED ? PGROUPCOLACTIVELOCKED : PGROUPCOLACTIVE; const auto* const PCOLACTIVE = GROUPLOCKED ? GROUPCOLACTIVELOCKED : GROUPCOLACTIVE;
const auto* const PCOLINACTIVE = GROUPLOCKED ? PGROUPCOLINACTIVELOCKED : PGROUPCOLINACTIVE; const auto* const PCOLINACTIVE = GROUPLOCKED ? GROUPCOLINACTIVELOCKED : GROUPCOLINACTIVE;
CColor color = CColor color = m_dwGroupMembers[i] == g_pCompositor->m_pLastWindow ? PCOLACTIVE->m_vColors[0] : PCOLINACTIVE->m_vColors[0];
m_dwGroupMembers[i] == g_pCompositor->m_pLastWindow ? ((CGradientValueData*)PCOLACTIVE->get())->m_vColors[0] : ((CGradientValueData*)PCOLINACTIVE->get())->m_vColors[0];
color.a *= a; color.a *= a;
g_pHyprOpenGL->renderRect(&rect, color); g_pHyprOpenGL->renderRect(&rect, color);
@ -141,17 +145,17 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D&
g_pHyprOpenGL->renderTexture(GRADIENTTEX, &rect, 1.0); g_pHyprOpenGL->renderTexture(GRADIENTTEX, &rect, 1.0);
} }
if (*PRENDERTITLES) { if (**PRENDERTITLES) {
CTitleTex* pTitleTex = textureFromTitle(m_dwGroupMembers[i]->m_szTitle); CTitleTex* pTitleTex = textureFromTitle(m_dwGroupMembers[i]->m_szTitle);
if (!pTitleTex) if (!pTitleTex)
pTitleTex = m_sTitleTexs.titleTexs pTitleTex = m_sTitleTexs.titleTexs
.emplace_back(std::make_unique<CTitleTex>(m_dwGroupMembers[i], .emplace_back(std::make_unique<CTitleTex>(m_dwGroupMembers[i],
Vector2D{m_fBarWidth * pMonitor->scale, (*PTITLEFONTSIZE + 2 * BAR_TEXT_PAD) * pMonitor->scale})) Vector2D{m_fBarWidth * pMonitor->scale, (**PTITLEFONTSIZE + 2 * BAR_TEXT_PAD) * pMonitor->scale}))
.get(); .get();
rect.y += (ASSIGNEDBOX.h / 2.0 - (*PTITLEFONTSIZE + 2 * BAR_TEXT_PAD) / 2.0) * pMonitor->scale; rect.y += (ASSIGNEDBOX.h / 2.0 - (**PTITLEFONTSIZE + 2 * BAR_TEXT_PAD) / 2.0) * pMonitor->scale;
rect.height = (*PTITLEFONTSIZE + 2 * BAR_TEXT_PAD) * pMonitor->scale; rect.height = (**PTITLEFONTSIZE + 2 * BAR_TEXT_PAD) * pMonitor->scale;
g_pHyprOpenGL->renderTexture(pTitleTex->tex, &rect, 1.f); g_pHyprOpenGL->renderTexture(pTitleTex->tex, &rect, 1.f);
} }
@ -159,7 +163,7 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D&
xoff += BAR_HORIZONTAL_PADDING + m_fBarWidth; xoff += BAR_HORIZONTAL_PADDING + m_fBarWidth;
} }
if (*PRENDERTITLES) if (**PRENDERTITLES)
invalidateTextures(); invalidateTextures();
} }
@ -183,11 +187,11 @@ CTitleTex::CTitleTex(CWindow* pWindow, const Vector2D& bufferSize) {
const auto CAIRO = cairo_create(CAIROSURFACE); const auto CAIRO = cairo_create(CAIROSURFACE);
const auto MONITORSCALE = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID)->scale; const auto MONITORSCALE = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID)->scale;
static auto* const PTITLEFONTFAMILY = &g_pConfigManager->getConfigValuePtr("group:groupbar:font_family")->strValue; static auto* const PTITLEFONTFAMILY = (Hyprlang::STRING const*)g_pConfigManager->getConfigValuePtr("group:groupbar:font_family");
static auto* const PTITLEFONTSIZE = &g_pConfigManager->getConfigValuePtr("group:groupbar:font_size")->intValue; static auto* const PTITLEFONTSIZE = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:font_size");
static auto* const PTEXTCOLOR = &g_pConfigManager->getConfigValuePtr("group:groupbar:text_color")->intValue; static auto* const PTEXTCOLOR = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:text_color");
const CColor COLOR = CColor(*PTEXTCOLOR); const CColor COLOR = CColor(**PTEXTCOLOR);
// clear the pixmap // clear the pixmap
cairo_save(CAIRO); cairo_save(CAIRO);
@ -199,8 +203,8 @@ CTitleTex::CTitleTex(CWindow* pWindow, const Vector2D& bufferSize) {
PangoLayout* layout = pango_cairo_create_layout(CAIRO); PangoLayout* layout = pango_cairo_create_layout(CAIRO);
pango_layout_set_text(layout, szContent.c_str(), -1); pango_layout_set_text(layout, szContent.c_str(), -1);
PangoFontDescription* fontDesc = pango_font_description_from_string(PTITLEFONTFAMILY->c_str()); PangoFontDescription* fontDesc = pango_font_description_from_string(*PTITLEFONTFAMILY);
pango_font_description_set_size(fontDesc, *PTITLEFONTSIZE * MONITORSCALE * PANGO_SCALE); pango_font_description_set_size(fontDesc, **PTITLEFONTSIZE * PANGO_SCALE);
pango_layout_set_font_description(layout, fontDesc); pango_layout_set_font_description(layout, fontDesc);
pango_font_description_free(fontDesc); pango_font_description_free(fontDesc);
@ -297,13 +301,17 @@ void renderGradientTo(CTexture& tex, CGradientValueData* grad) {
} }
void refreshGroupBarGradients() { void refreshGroupBarGradients() {
static auto* const PGRADIENTS = &g_pConfigManager->getConfigValuePtr("group:groupbar:enabled")->intValue; static auto* const PGRADIENTS = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:enabled");
static auto* const PENABLED = &g_pConfigManager->getConfigValuePtr("group:groupbar:gradients")->intValue; static auto* const PENABLED = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:gradients");
CGradientValueData* PGROUPCOLACTIVE = (CGradientValueData*)g_pConfigManager->getConfigValuePtr("group:groupbar:col.active")->data.get(); static auto* const PGROUPCOLACTIVE = (Hyprlang::CUSTOMTYPE* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:col.active");
CGradientValueData* PGROUPCOLINACTIVE = (CGradientValueData*)g_pConfigManager->getConfigValuePtr("group:groupbar:col.inactive")->data.get(); static auto* const PGROUPCOLINACTIVE = (Hyprlang::CUSTOMTYPE* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:col.inactive");
CGradientValueData* PGROUPCOLACTIVELOCKED = (CGradientValueData*)g_pConfigManager->getConfigValuePtr("group:groupbar:col.locked_active")->data.get(); static auto* const PGROUPCOLACTIVELOCKED = (Hyprlang::CUSTOMTYPE* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:col.locked_active");
CGradientValueData* PGROUPCOLINACTIVELOCKED = (CGradientValueData*)g_pConfigManager->getConfigValuePtr("group:groupbar:col.locked_inactive")->data.get(); static auto* const PGROUPCOLINACTIVELOCKED = (Hyprlang::CUSTOMTYPE* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:col.locked_inactive");
auto* const GROUPCOLACTIVE = (CGradientValueData*)(*PGROUPCOLACTIVE)->getData();
auto* const GROUPCOLINACTIVE = (CGradientValueData*)(*PGROUPCOLINACTIVE)->getData();
auto* const GROUPCOLACTIVELOCKED = (CGradientValueData*)(*PGROUPCOLACTIVELOCKED)->getData();
auto* const GROUPCOLINACTIVELOCKED = (CGradientValueData*)(*PGROUPCOLINACTIVELOCKED)->getData();
g_pHyprRenderer->makeEGLCurrent(); g_pHyprRenderer->makeEGLCurrent();
@ -314,13 +322,13 @@ void refreshGroupBarGradients() {
m_tGradientLockedInactive.destroyTexture(); m_tGradientLockedInactive.destroyTexture();
} }
if (!*PENABLED || !*PGRADIENTS) if (!**PENABLED || !**PGRADIENTS)
return; return;
renderGradientTo(m_tGradientActive, PGROUPCOLACTIVE); renderGradientTo(m_tGradientActive, GROUPCOLACTIVE);
renderGradientTo(m_tGradientInactive, PGROUPCOLINACTIVE); renderGradientTo(m_tGradientInactive, GROUPCOLINACTIVE);
renderGradientTo(m_tGradientLockedActive, PGROUPCOLACTIVELOCKED); renderGradientTo(m_tGradientLockedActive, GROUPCOLACTIVELOCKED);
renderGradientTo(m_tGradientLockedInactive, PGROUPCOLINACTIVELOCKED); renderGradientTo(m_tGradientLockedInactive, GROUPCOLINACTIVELOCKED);
} }
bool CHyprGroupBarDecoration::onBeginWindowDragOnDeco(const Vector2D& pos) { bool CHyprGroupBarDecoration::onBeginWindowDragOnDeco(const Vector2D& pos) {
@ -452,11 +460,10 @@ bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, wlr_point
} }
bool CHyprGroupBarDecoration::onScrollOnDeco(const Vector2D& pos, wlr_pointer_axis_event* e) { bool CHyprGroupBarDecoration::onScrollOnDeco(const Vector2D& pos, wlr_pointer_axis_event* e) {
static auto* const PGROUPBARSCROLLING = &g_pConfigManager->getConfigValuePtr("group:groupbar:scrolling")->intValue; static auto* const PGROUPBARSCROLLING = (Hyprlang::INT* const*)g_pConfigManager->getConfigValuePtr("group:groupbar:scrolling");
if (!*PGROUPBARSCROLLING || !m_pWindow->m_sGroupData.pNextWindow) { if (!**PGROUPBARSCROLLING || !m_pWindow->m_sGroupData.pNextWindow)
return false; return false;
}
if (e->delta > 0) if (e->delta > 0)
m_pWindow->setGroupCurrent(m_pWindow->m_sGroupData.pNextWindow); m_pWindow->setGroupCurrent(m_pWindow->m_sGroupData.pNextWindow);