all: chase hyprland

This commit is contained in:
Vaxry 2024-04-22 15:57:18 +01:00
parent 9971fec974
commit be8f8d81ef
9 changed files with 51 additions and 54 deletions

View file

@ -43,7 +43,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
HyprlandAPI::reloadConfig(); HyprlandAPI::reloadConfig();
HyprlandAPI::registerCallbackDynamic(PHANDLE, "openWindow", [&](void* self, SCallbackInfo& info, std::any data) { onNewWindow(self, data); }); static auto P = HyprlandAPI::registerCallbackDynamic(PHANDLE, "openWindow", [&](void* self, SCallbackInfo& info, std::any data) { onNewWindow(self, data); });
// add deco to existing windows // add deco to existing windows
for (auto& w : g_pCompositor->m_vWindows) { for (auto& w : g_pCompositor->m_vWindows) {

View file

@ -55,8 +55,8 @@ class CHyprBar : public IHyprWindowDecoration {
void onMouseMove(Vector2D coords); void onMouseMove(Vector2D coords);
CBox assignedBoxGlobal(); CBox assignedBoxGlobal();
HOOK_CALLBACK_FN* m_pMouseButtonCallback; std::shared_ptr<HOOK_CALLBACK_FN> m_pMouseButtonCallback;
HOOK_CALLBACK_FN* m_pMouseMoveCallback; std::shared_ptr<HOOK_CALLBACK_FN> m_pMouseMoveCallback;
std::string m_szLastTitle; std::string m_szLastTitle;

View file

@ -86,8 +86,8 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
g_pGlobalState = std::make_unique<SGlobalState>(); g_pGlobalState = std::make_unique<SGlobalState>();
HyprlandAPI::registerCallbackDynamic(PHANDLE, "openWindow", [&](void* self, SCallbackInfo& info, std::any data) { onNewWindow(self, data); }); static auto P = HyprlandAPI::registerCallbackDynamic(PHANDLE, "openWindow", [&](void* self, SCallbackInfo& info, std::any data) { onNewWindow(self, data); });
HyprlandAPI::registerCallbackDynamic(PHANDLE, "closeWindow", [&](void* self, SCallbackInfo& info, std::any data) { onCloseWindow(self, data); }); static auto P2 = HyprlandAPI::registerCallbackDynamic(PHANDLE, "closeWindow", [&](void* self, SCallbackInfo& info, std::any data) { onCloseWindow(self, data); });
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_color", Hyprlang::INT{configStringToInt("rgba(33333388)")}); HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_color", Hyprlang::INT{configStringToInt("rgba(33333388)")});
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_height", Hyprlang::INT{15}); HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_height", Hyprlang::INT{15});

View file

@ -138,8 +138,7 @@ static void onExpoDispatcher(std::string arg) {
} }
static void failNotif(const std::string& reason) { static void failNotif(const std::string& reason) {
HyprlandAPI::addNotification(PHANDLE, "[hyprexpo] Failure in initialization: " + reason, HyprlandAPI::addNotification(PHANDLE, "[hyprexpo] Failure in initialization: " + reason, CColor{1.0, 0.2, 0.2, 1.0}, 5000);
CColor{1.0, 0.2, 0.2, 1.0}, 5000);
} }
APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
@ -185,15 +184,15 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
throw std::runtime_error("[he] Failed initializing hooks"); throw std::runtime_error("[he] Failed initializing hooks");
} }
HyprlandAPI::registerCallbackDynamic(PHANDLE, "preRender", [](void* self, SCallbackInfo& info, std::any param) { static auto P = HyprlandAPI::registerCallbackDynamic(PHANDLE, "preRender", [](void* self, SCallbackInfo& info, std::any param) {
if (!g_pOverview) if (!g_pOverview)
return; return;
g_pOverview->onPreRender(); g_pOverview->onPreRender();
}); });
HyprlandAPI::registerCallbackDynamic(PHANDLE, "swipeBegin", [](void* self, SCallbackInfo& info, std::any data) { swipeBegin(self, info, data); }); static auto P2 = HyprlandAPI::registerCallbackDynamic(PHANDLE, "swipeBegin", [](void* self, SCallbackInfo& info, std::any data) { swipeBegin(self, info, data); });
HyprlandAPI::registerCallbackDynamic(PHANDLE, "swipeEnd", [](void* self, SCallbackInfo& info, std::any data) { swipeEnd(self, info, data); }); static auto P3 = HyprlandAPI::registerCallbackDynamic(PHANDLE, "swipeEnd", [](void* self, SCallbackInfo& info, std::any data) { swipeEnd(self, info, data); });
HyprlandAPI::registerCallbackDynamic(PHANDLE, "swipeUpdate", [](void* self, SCallbackInfo& info, std::any data) { swipeUpdate(self, info, data); }); static auto P4 = HyprlandAPI::registerCallbackDynamic(PHANDLE, "swipeUpdate", [](void* self, SCallbackInfo& info, std::any data) { swipeUpdate(self, info, data); });
HyprlandAPI::addDispatcher(PHANDLE, "hyprexpo:expo", onExpoDispatcher); HyprlandAPI::addDispatcher(PHANDLE, "hyprexpo:expo", onExpoDispatcher);

View file

@ -17,10 +17,6 @@ static void removeOverview(void*) {
COverview::~COverview() { COverview::~COverview() {
g_pHyprRenderer->makeEGLCurrent(); g_pHyprRenderer->makeEGLCurrent();
images.clear(); // otherwise we get a vram leak images.clear(); // otherwise we get a vram leak
g_pHookSystem->unhook(touchUpHook);
g_pHookSystem->unhook(touchMoveHook);
g_pHookSystem->unhook(mouseButtonHook);
g_pHookSystem->unhook(mouseMoveHook);
g_pInputManager->unsetCursorImage(); g_pInputManager->unsetCursorImage();
g_pHyprOpenGL->markBlurDirtyForMonitor(pMonitor); g_pHyprOpenGL->markBlurDirtyForMonitor(pMonitor);
} }

View file

@ -68,10 +68,10 @@ class COverview {
bool closing = false; bool closing = false;
HOOK_CALLBACK_FN* mouseMoveHook = nullptr; std::shared_ptr<HOOK_CALLBACK_FN> mouseMoveHook;
HOOK_CALLBACK_FN* mouseButtonHook = nullptr; std::shared_ptr<HOOK_CALLBACK_FN> mouseButtonHook;
HOOK_CALLBACK_FN* touchMoveHook = nullptr; std::shared_ptr<HOOK_CALLBACK_FN> touchMoveHook;
HOOK_CALLBACK_FN* touchUpHook = nullptr; std::shared_ptr<HOOK_CALLBACK_FN> touchUpHook;
bool swipe = false; bool swipe = false;
bool swipeWasCommenced = false; bool swipeWasCommenced = false;

View file

@ -31,12 +31,12 @@ CTrail::CTrail(CWindow* pWindow) : IHyprWindowDecoration(pWindow), m_pWindow(pWi
m_vLastWindowPos = pWindow->m_vRealPosition.value(); m_vLastWindowPos = pWindow->m_vRealPosition.value();
m_vLastWindowSize = pWindow->m_vRealSize.value(); m_vLastWindowSize = pWindow->m_vRealSize.value();
pTickCb = g_pHookSystem->hookDynamic("trailTick", [this](void* self, SCallbackInfo& info, std::any data) { this->onTick(); }); pTickCb = HyprlandAPI::registerCallbackDynamic(PHANDLE, "trailTick", [this](void* self, SCallbackInfo& info, std::any data) { this->onTick(); });
} }
CTrail::~CTrail() { CTrail::~CTrail() {
damageEntire(); damageEntire();
g_pHookSystem->unhook(pTickCb); HyprlandAPI::unregisterCallback(PHANDLE, pTickCb);
} }
SDecorationPositioningInfo CTrail::getPositioningInfo() { SDecorationPositioningInfo CTrail::getPositioningInfo() {

View file

@ -46,7 +46,7 @@ class CTrail : public IHyprWindowDecoration {
virtual void damageEntire(); virtual void damageEntire();
private: private:
HOOK_CALLBACK_FN* pTickCb = nullptr; std::shared_ptr<HOOK_CALLBACK_FN> pTickCb;
void onTick(); void onTick();
std::deque<std::pair<box, std::chrono::system_clock::time_point>> m_dLastGeoms; std::deque<std::pair<box, std::chrono::system_clock::time_point>> m_dLastGeoms;

View file

@ -138,10 +138,12 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
throw std::runtime_error("[hww] Version mismatch"); throw std::runtime_error("[hww] Version mismatch");
} }
HyprlandAPI::registerCallbackDynamic(PHANDLE, "openWindow", [&](void* self, SCallbackInfo& info, std::any data) { onNewWindow(std::any_cast<CWindow*>(data)); }); // clang-format off
HyprlandAPI::registerCallbackDynamic(PHANDLE, "closeWindow", [&](void* self, SCallbackInfo& info, std::any data) { onCloseWindow(std::any_cast<CWindow*>(data)); }); static auto P = HyprlandAPI::registerCallbackDynamic(PHANDLE, "openWindow", [&](void* self, SCallbackInfo& info, std::any data) { onNewWindow(std::any_cast<CWindow*>(data)); });
HyprlandAPI::registerCallbackDynamic(PHANDLE, "render", [&](void* self, SCallbackInfo& info, std::any data) { onRenderStage(std::any_cast<eRenderStage>(data)); }); static auto P2 = HyprlandAPI::registerCallbackDynamic(PHANDLE, "closeWindow", [&](void* self, SCallbackInfo& info, std::any data) { onCloseWindow(std::any_cast<CWindow*>(data)); });
HyprlandAPI::registerCallbackDynamic(PHANDLE, "configReloaded", [&](void* self, SCallbackInfo& info, std::any data) { onConfigReloaded(); }); static auto P3 = HyprlandAPI::registerCallbackDynamic(PHANDLE, "render", [&](void* self, SCallbackInfo& info, std::any data) { onRenderStage(std::any_cast<eRenderStage>(data)); });
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, "onCommit");
if (fns.size() < 1) if (fns.size() < 1)