all: chase hyprland

This commit is contained in:
Vaxry
2025-12-08 15:22:46 +00:00
parent fc76c5674a
commit e058ea23b8
13 changed files with 32 additions and 32 deletions

3
.gitignore vendored
View File

@ -37,3 +37,6 @@
# Nix
result
result-man
build/
.cache/

View File

@ -1,7 +1,7 @@
#include "borderDeco.hpp"
#include <hyprland/src/Compositor.hpp>
#include <hyprland/src/desktop/Window.hpp>
#include <hyprland/src/desktop/view/Window.hpp>
#include <hyprland/src/render/Renderer.hpp>
#include <hyprutils/memory/Casts.hpp>
using namespace Hyprutils::Memory;

View File

@ -4,7 +4,7 @@
#include <any>
#include <hyprland/src/Compositor.hpp>
#include <hyprland/src/desktop/Window.hpp>
#include <hyprland/src/desktop/view/Window.hpp>
#include <hyprland/src/config/ConfigManager.hpp>
#include <hyprland/src/render/Renderer.hpp>

View File

@ -4,7 +4,7 @@
#include <hyprland/src/Compositor.hpp>
#include <hyprland/src/desktop/state/FocusState.hpp>
#include <hyprland/src/desktop/Window.hpp>
#include <hyprland/src/desktop/view/Window.hpp>
#include <hyprland/src/config/ConfigManager.hpp>
#include <hyprland/src/xwayland/XSurface.hpp>
#include <hyprland/src/managers/SeatManager.hpp>
@ -21,7 +21,7 @@ inline CFunctionHook* g_pSurfaceSizeHook = nullptr;
inline CFunctionHook* g_pWLSurfaceDamageHook = nullptr;
typedef void (*origMotion)(CSeatManager*, uint32_t, const Vector2D&);
typedef void (*origSurfaceSize)(CXWaylandSurface*, const CBox&);
typedef CRegion (*origWLSurfaceDamage)(CWLSurface*);
typedef CRegion (*origWLSurfaceDamage)(Desktop::View::CWLSurface*);
// Do NOT change this function.
APICALL EXPORT std::string PLUGIN_API_VERSION() {
@ -83,24 +83,25 @@ void hkSetWindowSize(CXWaylandSurface* surface, const CBox& box) {
newBox.w = CONFIG->res.x;
newBox.h = CONFIG->res.y;
CWLSurface::fromResource(SURF)->m_fillIgnoreSmall = true;
Desktop::View::CWLSurface::fromResource(SURF)->m_fillIgnoreSmall = true;
}
(*(origSurfaceSize)g_pSurfaceSizeHook->m_original)(surface, newBox);
}
CRegion hkWLSurfaceDamage(CWLSurface* thisptr) {
CRegion hkWLSurfaceDamage(Desktop::View::CWLSurface* thisptr) {
const auto RG = (*(origWLSurfaceDamage)g_pWLSurfaceDamageHook->m_original)(thisptr);
if (thisptr->exists() && thisptr->getWindow()) {
const auto CONFIG = getAppConfig(thisptr->getWindow()->m_initialClass);
if (thisptr->exists() && Desktop::View::CWindow::fromView(thisptr->view())) {
const auto WINDOW = Desktop::View::CWindow::fromView(thisptr->view());
const auto CONFIG = getAppConfig(WINDOW->m_initialClass);
if (CONFIG) {
const auto PMONITOR = thisptr->getWindow()->m_monitor.lock();
const auto PMONITOR = WINDOW->m_monitor.lock();
if (PMONITOR)
g_pHyprRenderer->damageMonitor(PMONITOR);
else
g_pHyprRenderer->damageWindow(thisptr->getWindow());
g_pHyprRenderer->damageWindow(WINDOW);
}
}

View File

@ -2,7 +2,7 @@
#include <hyprland/src/Compositor.hpp>
#include <hyprland/src/desktop/state/FocusState.hpp>
#include <hyprland/src/desktop/Window.hpp>
#include <hyprland/src/desktop/view/Window.hpp>
#include <hyprland/src/helpers/MiscFunctions.hpp>
#include <hyprland/src/managers/SeatManager.hpp>
#include <hyprland/src/managers/input/InputManager.hpp>
@ -86,10 +86,10 @@ bool CHyprBar::inputIsValid() {
return false;
if (!m_pWindow->m_workspace || !m_pWindow->m_workspace->isVisible() || !g_pInputManager->m_exclusiveLSes.empty() ||
(g_pSeatManager->m_seatGrab && !g_pSeatManager->m_seatGrab->accepts(m_pWindow->m_wlSurface->resource())))
(g_pSeatManager->m_seatGrab && !g_pSeatManager->m_seatGrab->accepts(m_pWindow->wlSurface()->resource())))
return false;
const auto WINDOWATCURSOR = g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
const auto WINDOWATCURSOR = g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS | Desktop::View::ALLOW_FLOATING);
auto focusState = Desktop::focusState();
auto window = focusState->window();

View File

@ -4,7 +4,7 @@
#include <any>
#include <hyprland/src/Compositor.hpp>
#include <hyprland/src/desktop/Window.hpp>
#include <hyprland/src/desktop/view/Window.hpp>
#include <hyprland/src/config/ConfigManager.hpp>
#include <hyprland/src/render/Renderer.hpp>
#include <hyprland/src/desktop/rule/windowRule/WindowRuleEffectContainer.hpp>

View File

@ -4,7 +4,7 @@
#include <hyprland/src/Compositor.hpp>
#include <hyprland/src/desktop/state/FocusState.hpp>
#include <hyprland/src/desktop/Window.hpp>
#include <hyprland/src/desktop/view/Window.hpp>
#include <hyprland/src/config/ConfigManager.hpp>
#include <hyprland/src/desktop/DesktopTypes.hpp>
#include <hyprland/src/render/Renderer.hpp>

View File

@ -538,7 +538,7 @@ void CScrollingLayout::onWindowCreatedTiling(PHLWINDOW window, eDirection direct
auto droppingOn = Desktop::focusState()->window();
if (droppingOn == window)
droppingOn = g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), RESERVED_EXTENTS | INPUT_EXTENTS);
droppingOn = g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), Desktop::View::RESERVED_EXTENTS | Desktop::View::INPUT_EXTENTS);
SP<SScrollingWindowData> droppingData = droppingOn ? dataFor(droppingOn) : nullptr;
SP<SColumnData> droppingColumn = droppingData ? droppingData->column.lock() : nullptr;

View File

@ -7,7 +7,7 @@
#define private public
#include <hyprland/src/Compositor.hpp>
#include <hyprland/src/desktop/Window.hpp>
#include <hyprland/src/desktop/DesktopTypes.hpp>
#include <hyprland/src/config/ConfigManager.hpp>
#include <hyprland/src/render/Renderer.hpp>
#include <hyprland/src/managers/KeybindManager.hpp>

View File

@ -4,7 +4,7 @@
#include <any>
#include <hyprland/src/Compositor.hpp>
#include <hyprland/src/desktop/Window.hpp>
#include <hyprland/src/desktop/DesktopTypes.hpp>
#include <hyprland/src/config/ConfigManager.hpp>
#include <hyprland/src/render/shaders/Shaders.hpp>
#include <hyprland/src/render/Renderer.hpp>

View File

@ -1,7 +1,7 @@
#include "trail.hpp"
#include <hyprland/src/Compositor.hpp>
#include <hyprland/src/desktop/Window.hpp>
#include <hyprland/src/desktop/view/Window.hpp>
#include <hyprland/src/render/Renderer.hpp>
#include <hyprutils/memory/Casts.hpp>
using namespace Hyprutils::Memory;

View File

@ -9,7 +9,7 @@
#define private public
#include <hyprland/src/Compositor.hpp>
#include <hyprland/src/desktop/Window.hpp>
#include <hyprland/src/desktop/view/Window.hpp>
#include <hyprland/src/config/ConfigManager.hpp>
#include <hyprland/src/render/Renderer.hpp>
#include <hyprland/src/managers/LayoutManager.hpp>
@ -27,7 +27,7 @@ APICALL EXPORT std::string PLUGIN_API_VERSION() {
// hooks
inline CFunctionHook* subsurfaceHook = nullptr;
inline CFunctionHook* commitHook = nullptr;
typedef void (*origCommitSubsurface)(CSubsurface* thisptr);
typedef void (*origCommitSubsurface)(Desktop::View::CSubsurface* thisptr);
typedef void (*origCommit)(void* owner, void* data);
std::vector<PHLWINDOWREF> bgWindows;
@ -132,8 +132,8 @@ void onRenderStage(eRenderStage stage) {
}
}
void onCommitSubsurface(CSubsurface* thisptr) {
const auto PWINDOW = thisptr->m_wlSurface->getWindow();
void onCommitSubsurface(Desktop::View::CSubsurface* thisptr) {
const auto PWINDOW = Desktop::View::CWindow::fromView(thisptr->wlSurface()->view());
if (!PWINDOW || std::find_if(bgWindows.begin(), bgWindows.end(), [PWINDOW](const auto& ref) { return ref.lock() == PWINDOW; }) == bgWindows.end()) {
((origCommitSubsurface)subsurfaceHook->m_original)(thisptr);
@ -151,7 +151,7 @@ void onCommitSubsurface(CSubsurface* thisptr) {
}
void onCommit(void* owner, void* data) {
const auto PWINDOW = ((CWindow*)owner)->m_self.lock();
const auto PWINDOW = ((Desktop::View::CWindow*)owner)->m_self.lock();
if (std::find_if(bgWindows.begin(), bgWindows.end(), [PWINDOW](const auto& ref) { return ref.lock() == PWINDOW; }) == bgWindows.end()) {
((origCommit)commitHook->m_original)(owner, data);
@ -203,16 +203,12 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
static auto P4 = HyprlandAPI::registerCallbackDynamic(PHANDLE, "configReloaded", [&](void* self, SCallbackInfo& info, std::any data) { onConfigReloaded(); });
// clang-format on
auto fns = HyprlandAPI::findFunctionsByName(PHANDLE, "onCommit");
auto fns = HyprlandAPI::findFunctionsByName(PHANDLE, "_ZN7Desktop4View11CSubsurface8onCommitEv");
if (fns.size() < 1)
throw std::runtime_error("hyprwinwrap: onCommit not found");
for (auto& fn : fns) {
if (!fn.demangled.contains("CSubsurface"))
continue;
subsurfaceHook = HyprlandAPI::createFunctionHook(PHANDLE, fn.address, (void*)&onCommitSubsurface);
}
subsurfaceHook = HyprlandAPI::createFunctionHook(PHANDLE, fns[0].address, (void*)&onCommitSubsurface);
fns = HyprlandAPI::findFunctionsByName(PHANDLE, "listener_commitWindow");
fns = HyprlandAPI::findFunctionsByName(PHANDLE, "_ZN7Desktop4View7CWindow12commitWindowEv");
if (fns.size() < 1)
throw std::runtime_error("hyprwinwrap: listener_commitWindow not found");
commitHook = HyprlandAPI::createFunctionHook(PHANDLE, fns[0].address, (void*)&onCommit);

View File

@ -8,7 +8,7 @@
#define private public
#include <hyprland/src/Compositor.hpp>
#include <hyprland/src/desktop/state/FocusState.hpp>
#include <hyprland/src/desktop/Window.hpp>
#include <hyprland/src/desktop/view/Window.hpp>
#include <hyprland/src/config/ConfigManager.hpp>
#include <hyprland/src/render/Renderer.hpp>
#include <hyprland/src/managers/KeybindManager.hpp>