From aeeeace102c14ea0ab4df6840ee225e1b14ea970 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Thu, 4 Jan 2024 22:52:00 +0200 Subject: [PATCH 01/10] flake.lock: update --- flake.lock | 47 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 85a83ff8..1619129f 100644 --- a/flake.lock +++ b/flake.lock @@ -23,13 +23,47 @@ "type": "github" } }, + "hyprlang": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1704287638, + "narHash": "sha256-TuRXJGwtK440AXQNl5eiqmQqY4LZ/9+z/R7xC0ie3iA=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "6624f2bb66d4d27975766e81f77174adbe58ec97", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1703438236, - "narHash": "sha256-aqVBq1u09yFhL7bj1/xyUeJjzr92fXVvQSSEx6AdB1M=", + "lastModified": 1704194953, + "narHash": "sha256-RtDKd8Mynhe5CFnVT8s0/0yqtWFMM9LmCzXv/YKxnq4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5f64a12a728902226210bf01d25ec6cbb9d9265b", + "rev": "bd645e8668ec6612439a9ee7e71f7eac4099d4f6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1702645756, + "narHash": "sha256-qKI6OR3TYJYQB3Q8mAZ+DG4o/BR9ptcv9UnRV2hzljc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "40c3c94c241286dd2243ea34d3aef8a488f9e4d0", "type": "github" }, "original": { @@ -87,6 +121,7 @@ "hyprland-protocols": [ "hyprland-protocols" ], + "hyprlang": "hyprlang", "nixpkgs": [ "nixpkgs" ], @@ -95,11 +130,11 @@ ] }, "locked": { - "lastModified": 1703514399, - "narHash": "sha256-VRr5Xc4S/VPr/gU3fiOD3vSIL2+GJ+LUrmFTWTwnTz4=", + "lastModified": 1704400467, + "narHash": "sha256-IsEAKBCorRlN53FwFAMbyGLRsPVu/ZrWEJtCwykPds8=", "owner": "hyprwm", "repo": "xdg-desktop-portal-hyprland", - "rev": "0a318a7a217a6402b0b705837cd5b50b0e94b31b", + "rev": "1c802128f6cc3db29a8ef01552b1a22f894eeefd", "type": "github" }, "original": { From d3acf8da3be048647d19251dcceaed470c199cd2 Mon Sep 17 00:00:00 2001 From: vaxerski Date: Fri, 5 Jan 2024 12:40:13 +0100 Subject: [PATCH 02/10] CI: don't close stale issues --- .github/workflows/stale.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 8955517f..51f6b91e 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -25,3 +25,4 @@ jobs: stale-issue-label: 'stale' stale-pr-label: 'stale' operations-per-run: 40 + days-before-close: -1 From d8dbdc4a017e051b3dde2e93791e2495722bfa21 Mon Sep 17 00:00:00 2001 From: Naksu <53827613+naksudev@users.noreply.github.com> Date: Fri, 5 Jan 2024 12:45:49 +0100 Subject: [PATCH 03/10] main: Fix typo in std::cerr (#4359) --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 2edf3601..e1f43ad0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -85,7 +85,7 @@ int main(int argc, char** argv) { } if (!ignoreSudo && Init::isSudo()) { - std::cerr << "[ ERROR ] Hyprland was launched with superuser priveleges, but the privileges check is not omitted.\n"; + std::cerr << "[ ERROR ] Hyprland was launched with superuser privileges, but the privileges check is not omitted.\n"; std::cerr << " Hint: Use the --i-am-really-stupid flag to omit that check.\n"; return 1; From 7e033e48ace5406a9bc442f7d403f9ce3af193f3 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Fri, 5 Jan 2024 17:57:24 +0100 Subject: [PATCH 04/10] make: unbreak with non-GNU ln(1) after 78f9ba9fdd7e ln -s -r -f /usr/local/bin/Hyprland /usr/local/bin/hyprland ln: illegal option -- r usage: ln [-s [-F] | -L | -P] [-f | -i] [-hnv] source_file [target_file] ln [-s [-F] | -L | -P] [-f | -i] [-hnv] source_file ... target_dir link source_file target_file *** Error code 1 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ecfb30f1..e3224970 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ install: chmod 755 ${PREFIX}/bin/Hyprland chmod 755 ${PREFIX}/bin/hyprctl chmod 755 ${PREFIX}/bin/hyprpm - ln -s -r -f ${PREFIX}/bin/Hyprland ${PREFIX}/bin/hyprland + cd ${PREFIX}/bin && ln -sf Hyprland hyprland if [ ! -f ${PREFIX}/share/wayland-sessions/hyprland.desktop ]; then cp ./example/hyprland.desktop ${PREFIX}/share/wayland-sessions; fi mkdir -p ${PREFIX}/share/hyprland cp ./assets/wall_* ${PREFIX}/share/hyprland From 666ee61c13e67e3a6943cd96157d9fb0967e596a Mon Sep 17 00:00:00 2001 From: Epilepsy Gatherings <73647246+phonetic112@users.noreply.github.com> Date: Sun, 7 Jan 2024 06:06:33 -0500 Subject: [PATCH 05/10] input: leave special on focus (#4358) --- src/Compositor.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index af03e025..f3efad86 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -928,12 +928,13 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) { if (pWindow->m_bPinned) pWindow->m_iWorkspaceID = m_pLastMonitor->activeWorkspace; + const auto PMONITOR = getMonitorFromID(pWindow->m_iMonitorID); + if (!isWorkspaceVisible(pWindow->m_iWorkspaceID)) { + const auto PWORKSPACE = getWorkspaceByID(pWindow->m_iWorkspaceID); // This is to fix incorrect feedback on the focus history. - const auto PWORKSPACE = getWorkspaceByID(pWindow->m_iWorkspaceID); PWORKSPACE->m_pLastFocusedWindow = pWindow; PWORKSPACE->rememberPrevWorkspace(getWorkspaceByID(m_pLastMonitor->activeWorkspace)); - const auto PMONITOR = getMonitorFromID(PWORKSPACE->m_iMonitorID); PMONITOR->changeWorkspace(PWORKSPACE, false, true); // changeworkspace already calls focusWindow return; @@ -942,6 +943,9 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) { const auto PLASTWINDOW = m_pLastWindow; m_pLastWindow = pWindow; + if (PMONITOR->specialWorkspaceID && PMONITOR->specialWorkspaceID != pWindow->m_iWorkspaceID) + PMONITOR->setSpecialWorkspace(nullptr); + // we need to make the PLASTWINDOW not equal to m_pLastWindow so that RENDERDATA is correct for an unfocused window if (windowValidMapped(PLASTWINDOW)) { PLASTWINDOW->updateDynamicRules(); From 7904188de9ca631436484cde733ef871f518d962 Mon Sep 17 00:00:00 2001 From: vaxerski Date: Sun, 7 Jan 2024 14:04:25 +0100 Subject: [PATCH 06/10] input: allow focusSurface when locked if surfase is sessionLock --- src/Compositor.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index f3efad86..b98c714d 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -1019,10 +1019,8 @@ void CCompositor::focusSurface(wlr_surface* pSurface, CWindow* pWindowOwner) { if (m_sSeat.seat->keyboard_state.focused_surface == pSurface || (pWindowOwner && m_sSeat.seat->keyboard_state.focused_surface == pWindowOwner->m_pWLSurface.wlr())) return; // Don't focus when already focused on this. - if (g_pSessionLockManager->isSessionLocked()) { - wlr_seat_keyboard_clear_focus(m_sSeat.seat); - m_pLastFocus = nullptr; - } + if (g_pSessionLockManager->isSessionLocked() && !g_pSessionLockManager->isSurfaceSessionLock(pSurface)) + return; // Unfocus last surface if should if (m_pLastFocus && !pWindowOwner) From 9f2bde925bde09b4820a2cef369e9ddd930a746b Mon Sep 17 00:00:00 2001 From: vaxerski Date: Sun, 7 Jan 2024 18:15:51 +0100 Subject: [PATCH 07/10] hyprpm: handle failed compilations gracefully --- hyprpm/src/core/DataState.cpp | 11 +++++++++-- hyprpm/src/core/Manifest.hpp | 1 + hyprpm/src/core/Plugin.hpp | 3 ++- hyprpm/src/core/PluginManager.cpp | 17 ++++++++++++----- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/hyprpm/src/core/DataState.cpp b/hyprpm/src/core/DataState.cpp index d95f10bb..724c40ac 100644 --- a/hyprpm/src/core/DataState.cpp +++ b/hyprpm/src/core/DataState.cpp @@ -47,7 +47,8 @@ void DataState::addNewPluginRepo(const SPluginRepository& repo) { DATA.emplace(p.name, toml::table{ {"filename", p.name + ".so"}, - {"enabled", p.enabled} + {"enabled", p.enabled}, + {"failed", p.failed} }); } // clang-format on @@ -172,9 +173,10 @@ std::vector DataState::getAllRepositories() { continue; const auto ENABLED = STATE[key]["enabled"].value_or(false); + const auto FAILED = STATE[key]["failed"].value_or(false); const auto FILENAME = STATE[key]["filename"].value_or(""); - repo.plugins.push_back(SPlugin{std::string{key.str()}, FILENAME, ENABLED}); + repo.plugins.push_back(SPlugin{std::string{key.str()}, FILENAME, ENABLED, FAILED}); } repos.push_back(repo); @@ -201,6 +203,11 @@ bool DataState::setPluginEnabled(const std::string& name, bool enabled) { if (key.str() != name) continue; + const auto FAILED = STATE[key]["failed"].value_or(false); + + if (FAILED) + return false; + (*STATE[key].as_table()).insert_or_assign("enabled", enabled); std::ofstream state(entry.path().string() + "/state.toml", std::ios::trunc); diff --git a/hyprpm/src/core/Manifest.hpp b/hyprpm/src/core/Manifest.hpp index 63e1791f..55b4a7f0 100644 --- a/hyprpm/src/core/Manifest.hpp +++ b/hyprpm/src/core/Manifest.hpp @@ -19,6 +19,7 @@ class CManifest { std::vector authors; std::vector buildSteps; std::string output; + bool failed = false; }; struct { diff --git a/hyprpm/src/core/Plugin.hpp b/hyprpm/src/core/Plugin.hpp index 32c02a49..a69478d1 100644 --- a/hyprpm/src/core/Plugin.hpp +++ b/hyprpm/src/core/Plugin.hpp @@ -6,7 +6,8 @@ struct SPlugin { std::string name; std::string filename; - bool enabled; + bool enabled = false; + bool failed = false; }; struct SPluginRepository { diff --git a/hyprpm/src/core/PluginManager.cpp b/hyprpm/src/core/PluginManager.cpp index 3c091242..4cc93d4b 100644 --- a/hyprpm/src/core/PluginManager.cpp +++ b/hyprpm/src/core/PluginManager.cpp @@ -195,12 +195,14 @@ bool CPluginManager::addNewPluginRepo(const std::string& url) { } if (!std::filesystem::exists("/tmp/hyprpm/new/" + p.output)) { - std::cerr << "\n" << Colors::RED << "✖" << Colors::RESET << " Plugin " << p.name << " failed to build.\n"; + progress.printMessageAbove(std::string{Colors::RED} + "✖" + Colors::RESET + " Plugin " + p.name + " failed to build.\n"); if (m_bVerbose) std::cout << Colors::BLUE << "[v] " << Colors::RESET << "shell returned: " << out << "\n"; - return false; + p.failed = true; + + continue; } progress.printMessageAbove(std::string{Colors::GREEN} + "✔" + Colors::RESET + " built " + p.name + " into " + p.output); @@ -220,7 +222,7 @@ bool CPluginManager::addNewPluginRepo(const std::string& url) { repo.url = url; repo.hash = repohash; for (auto& p : pManifest->m_vPlugins) { - repo.plugins.push_back(SPlugin{p.name, "/tmp/hyprpm/new/" + p.output, false}); + repo.plugins.push_back(SPlugin{p.name, "/tmp/hyprpm/new/" + p.output, false, p.failed}); } DataState::addNewPluginRepo(repo); @@ -696,8 +698,13 @@ void CPluginManager::listAllPlugins() { std::cout << std::string{Colors::RESET} + " → Repository " + r.name + ":\n"; for (auto& p : r.plugins) { - std::cout << std::string{Colors::RESET} + " │ Plugin " + p.name + "\n └─ enabled: " << (p.enabled ? Colors::GREEN : Colors::RED) << (p.enabled ? "true" : "false") - << Colors::RESET << "\n"; + + std::cout << std::string{Colors::RESET} + " │ Plugin " + p.name; + + if (!p.failed) + std::cout << "\n └─ enabled: " << (p.enabled ? Colors::GREEN : Colors::RED) << (p.enabled ? "true" : "false") << Colors::RESET << "\n"; + else + std::cout << "\n └─ enabled: " << Colors::RED << "Plugin failed to build" << Colors::RESET << "\n"; } } } From 44ee9915e34910aac67ab60f1296eed8be8e7cea Mon Sep 17 00:00:00 2001 From: vaxerski Date: Sun, 7 Jan 2024 18:35:44 +0100 Subject: [PATCH 08/10] renderer: overhaul renderModifData --- src/helpers/Box.hpp | 2 ++ src/render/OpenGL.cpp | 38 ++++++++++++++++++++++++++++++-------- src/render/OpenGL.hpp | 13 +++++++++++-- src/render/Renderer.cpp | 16 ++++++++++------ 4 files changed, 53 insertions(+), 16 deletions(-) diff --git a/src/helpers/Box.hpp b/src/helpers/Box.hpp index 5cb7f17f..a1ed83be 100644 --- a/src/helpers/Box.hpp +++ b/src/helpers/Box.hpp @@ -73,6 +73,8 @@ class CBox { double height; }; + double rot = 0; /* rad, ccw */ + // bool operator==(const CBox& rhs) const { return x == rhs.x && y == rhs.y && w == rhs.w && h == rhs.h; diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index cb468932..c6d16dd8 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -637,7 +637,7 @@ void CHyprOpenGLImpl::renderRectWithDamage(CBox* box, const CColor& col, CRegion TRACY_GPU_ZONE("RenderRectWithDamage"); CBox newBox = *box; - newBox.scale(m_RenderData.renderModif.scale).translate(m_RenderData.renderModif.translate); + m_RenderData.renderModif.applyToBox(newBox); box = &newBox; @@ -723,7 +723,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, CBox* return; CBox newBox = *pBox; - newBox.scale(m_RenderData.renderModif.scale).translate(m_RenderData.renderModif.translate); + m_RenderData.renderModif.applyToBox(newBox); static auto* const PDIMINACTIVE = &g_pConfigManager->getConfigValuePtr("decoration:dim_inactive")->intValue; @@ -886,7 +886,7 @@ void CHyprOpenGLImpl::renderTexturePrimitive(const CTexture& tex, CBox* pBox) { return; CBox newBox = *pBox; - newBox.scale(m_RenderData.renderModif.scale).translate(m_RenderData.renderModif.translate); + m_RenderData.renderModif.applyToBox(newBox); // get transform const auto TRANSFORM = wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform); @@ -940,7 +940,7 @@ void CHyprOpenGLImpl::renderTextureMatte(const CTexture& tex, CBox* pBox, CFrame return; CBox newBox = *pBox; - newBox.scale(m_RenderData.renderModif.scale).translate(m_RenderData.renderModif.translate); + m_RenderData.renderModif.applyToBox(newBox); // get transform const auto TRANSFORM = wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform); @@ -1475,14 +1475,14 @@ void CHyprOpenGLImpl::renderBorder(CBox* box, const CGradientValueData& grad, in return; CBox newBox = *box; - newBox.scale(m_RenderData.renderModif.scale).translate(m_RenderData.renderModif.translate); + m_RenderData.renderModif.applyToBox(newBox); box = &newBox; if (borderSize < 1) return; - int scaledBorderSize = std::round(borderSize * m_RenderData.pMonitor->scale * m_RenderData.renderModif.scale); + int scaledBorderSize = std::round(borderSize * m_RenderData.pMonitor->scale); // adjust box box->x -= scaledBorderSize; @@ -1779,7 +1779,7 @@ void CHyprOpenGLImpl::renderRoundedShadow(CBox* box, int round, int range, const TRACY_GPU_ZONE("RenderShadow"); CBox newBox = *box; - newBox.scale(m_RenderData.renderModif.scale).translate(m_RenderData.renderModif.translate); + m_RenderData.renderModif.applyToBox(newBox); box = &newBox; @@ -2210,4 +2210,26 @@ const SGLPixelFormat* CHyprOpenGLImpl::getPixelFormatFromDRM(uint32_t drmFormat) } return nullptr; -} \ No newline at end of file +} + +void SRenderModifData::applyToBox(CBox& box) { + for (auto& [type, val] : modifs) { + try { + switch (type) { + case RMOD_TYPE_SCALE: box.scale(std::any_cast(val)); break; + case RMOD_TYPE_SCALECENTER: box.scaleFromCenter(std::any_cast(val)); break; + case RMOD_TYPE_TRANSLATE: box.translate(std::any_cast(val)); break; + case RMOD_TYPE_ROTATE: box.rot += std::any_cast(val); break; + case RMOD_TYPE_ROTATECENTER: { + const auto THETA = std::any_cast(val); + const double COS = std::cos(THETA); + const double SIN = std::sin(THETA); + box.rot += THETA; + const auto OLDPOS = box.pos(); + box.x = OLDPOS.x * COS - OLDPOS.y * SIN; + box.y = OLDPOS.y * COS + OLDPOS.x * SIN; + } + } + } catch (std::bad_any_cast& e) { Debug::log(ERR, "BUG THIS OR PLUGIN ERROR: caught a bad_any_cast in SRenderModifData::applyToBox!"); } + } +} diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp index cd52fe3e..ba27b608 100644 --- a/src/render/OpenGL.hpp +++ b/src/render/OpenGL.hpp @@ -36,8 +36,17 @@ enum eDiscardMode { }; struct SRenderModifData { - Vector2D translate = {}; - float scale = 1.f; + enum eRenderModifType { + RMOD_TYPE_SCALE, /* scale by a float */ + RMOD_TYPE_SCALECENTER, /* scale by a float from the center */ + RMOD_TYPE_TRANSLATE, /* translate by a Vector2D */ + RMOD_TYPE_ROTATE, /* rotate by a float in rad from top left */ + RMOD_TYPE_ROTATECENTER, /* rotate by a float in rad from center */ + }; + + std::vector> modifs; + + void applyToBox(CBox& box); }; struct SGLPixelFormat { diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 533215ce..16607739 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -653,13 +653,17 @@ void CHyprRenderer::renderSessionLockSurface(SSessionLockSurface* pSurface, CMon } 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 PBLURSPECIAL = &g_pConfigManager->getConfigValuePtr("decoration:blur:special")->intValue; - static auto* const PBLUR = &g_pConfigManager->getConfigValuePtr("decoration:blur:enabled")->intValue; - static auto* const PRENDERTEX = &g_pConfigManager->getConfigValuePtr("misc:disable_hyprland_logo")->intValue; - static auto* const PBACKGROUNDCOLOR = &g_pConfigManager->getConfigValuePtr("misc:background_color")->intValue; + static auto* const PDIMSPECIAL = &g_pConfigManager->getConfigValuePtr("decoration:dim_special")->floatValue; + static auto* const PBLURSPECIAL = &g_pConfigManager->getConfigValuePtr("decoration:blur:special")->intValue; + static auto* const PBLUR = &g_pConfigManager->getConfigValuePtr("decoration:blur:enabled")->intValue; + static auto* const PRENDERTEX = &g_pConfigManager->getConfigValuePtr("misc:disable_hyprland_logo")->intValue; + static auto* const PBACKGROUNDCOLOR = &g_pConfigManager->getConfigValuePtr("misc:background_color")->intValue; - const SRenderModifData RENDERMODIFDATA = {translate, scale}; + SRenderModifData RENDERMODIFDATA; + if (translate != Vector2D{0, 0}) + RENDERMODIFDATA.modifs.push_back({SRenderModifData::eRenderModifType::RMOD_TYPE_TRANSLATE, translate}); + if (scale != 1.f) + RENDERMODIFDATA.modifs.push_back({SRenderModifData::eRenderModifType::RMOD_TYPE_SCALE, scale}); if (!pMonitor) return; From f5b2fd2bc36b35850502640d18281350e953b70d Mon Sep 17 00:00:00 2001 From: vaxerski Date: Sun, 7 Jan 2024 18:37:02 +0100 Subject: [PATCH 09/10] opengl: add renderdata.forceIntrospection --- src/render/OpenGL.cpp | 10 ++++++---- src/render/OpenGL.hpp | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index c6d16dd8..ffc899fe 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -232,7 +232,8 @@ void CHyprOpenGLImpl::begin(CMonitor* pMonitor, CRegion* pDamage, CFramebuffer* const auto PRBO = g_pHyprRenderer->getCurrentRBO(); const bool FBPROPERSIZE = fb && fb->m_vSize == pMonitor->vecPixelSize; - if (!FBPROPERSIZE || m_sFinalScreenShader.program > 0 || (PRBO && pMonitor->vecPixelSize != PRBO->getFB()->m_vSize) || passRequiresIntrospection(pMonitor)) { + if (m_RenderData.forceIntrospection || !FBPROPERSIZE || m_sFinalScreenShader.program > 0 || (PRBO && pMonitor->vecPixelSize != PRBO->getFB()->m_vSize) || + passRequiresIntrospection(pMonitor)) { // we have to offload // bind the offload Hypr Framebuffer m_RenderData.pCurrentMonData->offloadFB.bind(); @@ -307,9 +308,10 @@ void CHyprOpenGLImpl::end() { } // reset our data - m_RenderData.pMonitor = nullptr; - m_RenderData.mouseZoomFactor = 1.f; - m_RenderData.mouseZoomUseMouse = true; + m_RenderData.pMonitor = nullptr; + m_RenderData.mouseZoomFactor = 1.f; + m_RenderData.mouseZoomUseMouse = true; + m_RenderData.forceIntrospection = false; } void CHyprOpenGLImpl::initShaders() { diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp index ba27b608..9fd6d197 100644 --- a/src/render/OpenGL.hpp +++ b/src/render/OpenGL.hpp @@ -108,6 +108,7 @@ struct SCurrentRenderData { float mouseZoomFactor = 1.f; bool mouseZoomUseMouse = true; // true by default bool useNearestNeighbor = false; + bool forceIntrospection = false; // cleaned in ::end() Vector2D primarySurfaceUVTopLeft = Vector2D(-1, -1); Vector2D primarySurfaceUVBottomRight = Vector2D(-1, -1); From d7d333d162da2d3fc852b2c7a3faa2709440cefa Mon Sep 17 00:00:00 2001 From: vaxerski Date: Sun, 7 Jan 2024 18:51:08 +0100 Subject: [PATCH 10/10] opengl: apply box rot to projections --- src/render/OpenGL.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index ffc899fe..2dd4ca0e 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -644,7 +644,7 @@ void CHyprOpenGLImpl::renderRectWithDamage(CBox* box, const CColor& col, CRegion box = &newBox; float matrix[9]; - wlr_matrix_project_box(matrix, box->pWlr(), wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), 0, + wlr_matrix_project_box(matrix, box->pWlr(), wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), newBox.rot, m_RenderData.pMonitor->projMatrix.data()); // TODO: write own, don't use WLR here float glMatrix[9]; @@ -732,7 +732,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, CBox* // get transform const auto TRANSFORM = wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform); float matrix[9]; - wlr_matrix_project_box(matrix, newBox.pWlr(), TRANSFORM, 0, m_RenderData.pMonitor->projMatrix.data()); + wlr_matrix_project_box(matrix, newBox.pWlr(), TRANSFORM, newBox.rot, m_RenderData.pMonitor->projMatrix.data()); float glMatrix[9]; wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix); @@ -893,7 +893,7 @@ void CHyprOpenGLImpl::renderTexturePrimitive(const CTexture& tex, CBox* pBox) { // get transform const auto TRANSFORM = wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform); float matrix[9]; - wlr_matrix_project_box(matrix, newBox.pWlr(), TRANSFORM, 0, m_RenderData.pMonitor->projMatrix.data()); + wlr_matrix_project_box(matrix, newBox.pWlr(), TRANSFORM, newBox.rot, m_RenderData.pMonitor->projMatrix.data()); float glMatrix[9]; wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix); @@ -947,7 +947,7 @@ void CHyprOpenGLImpl::renderTextureMatte(const CTexture& tex, CBox* pBox, CFrame // get transform const auto TRANSFORM = wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform); float matrix[9]; - wlr_matrix_project_box(matrix, newBox.pWlr(), TRANSFORM, 0, m_RenderData.pMonitor->projMatrix.data()); + wlr_matrix_project_box(matrix, newBox.pWlr(), TRANSFORM, newBox.rot, m_RenderData.pMonitor->projMatrix.data()); float glMatrix[9]; wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix); @@ -1495,7 +1495,7 @@ void CHyprOpenGLImpl::renderBorder(CBox* box, const CGradientValueData& grad, in round += round == 0 ? 0 : scaledBorderSize; float matrix[9]; - wlr_matrix_project_box(matrix, box->pWlr(), wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), 0, + wlr_matrix_project_box(matrix, box->pWlr(), wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), newBox.rot, m_RenderData.pMonitor->projMatrix.data()); // TODO: write own, don't use WLR here float glMatrix[9]; @@ -1792,7 +1792,7 @@ void CHyprOpenGLImpl::renderRoundedShadow(CBox* box, int round, int range, const const auto col = color; float matrix[9]; - wlr_matrix_project_box(matrix, box->pWlr(), wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), 0, + wlr_matrix_project_box(matrix, box->pWlr(), wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform), newBox.rot, m_RenderData.pMonitor->projMatrix.data()); // TODO: write own, don't use WLR here float glMatrix[9];