From f955e6d16d04041306596ddfd316198fd0ea4f9d Mon Sep 17 00:00:00 2001 From: Markus Volk Date: Mon, 28 Oct 2024 19:54:09 +0100 Subject: [PATCH] hyprspace: update --- ...02ea9bcec83f4ab45edfc02bf96533d04cdd.patch | 100 -------------- ...1708cd4393d455b6a528ee6fc759b9b0751a.patch | 129 ++++++++++++++++++ recipes-support/hyprland/hyprspace_git.bb | 4 +- 3 files changed, 131 insertions(+), 102 deletions(-) delete mode 100644 recipes-support/hyprland/hyprspace/b88502ea9bcec83f4ab45edfc02bf96533d04cdd.patch create mode 100644 recipes-support/hyprland/hyprspace/fb951708cd4393d455b6a528ee6fc759b9b0751a.patch diff --git a/recipes-support/hyprland/hyprspace/b88502ea9bcec83f4ab45edfc02bf96533d04cdd.patch b/recipes-support/hyprland/hyprspace/b88502ea9bcec83f4ab45edfc02bf96533d04cdd.patch deleted file mode 100644 index 78b80d8..0000000 --- a/recipes-support/hyprland/hyprspace/b88502ea9bcec83f4ab45edfc02bf96533d04cdd.patch +++ /dev/null @@ -1,100 +0,0 @@ -From b88502ea9bcec83f4ab45edfc02bf96533d04cdd Mon Sep 17 00:00:00 2001 -From: myamusashi -Date: Tue, 22 Oct 2024 18:13:23 +0700 -Subject: [PATCH] Changed CMonitor to PHLMONITOR - -Upstream-Status: Submitted [https://github.com/KZDKM/Hyprspace/pull/99] ---- - src/Globals.hpp | 4 ++-- - src/Overview.cpp | 2 +- - src/Overview.hpp | 2 +- - src/Render.cpp | 4 ++-- - src/main.cpp | 4 ++-- - 5 files changed, 8 insertions(+), 8 deletions(-) - -diff --git a/src/Globals.hpp b/src/Globals.hpp -index ef5f144..2fc8052 100644 ---- a/src/Globals.hpp -+++ b/src/Globals.hpp -@@ -9,9 +9,9 @@ inline HANDLE pHandle = NULL; - typedef SDispatchResult (*tMouseKeybind)(std::string); - extern void* pMouseKeybind; - --typedef void (*tRenderWindow)(void*, PHLWINDOW, CMonitor*, timespec*, bool, eRenderPassMode, bool, bool); -+typedef void (*tRenderWindow)(void*, PHLWINDOW, PHLMONITOR, timespec*, bool, eRenderPassMode, bool, bool); - extern void* pRenderWindow; --typedef void (*tRenderLayer)(void*, Hyprutils::Memory::CWeakPointer, CMonitor*, timespec*, bool); -+typedef void (*tRenderLayer)(void*, Hyprutils::Memory::CWeakPointer, PHLMONITOR, timespec*, bool); - extern void* pRenderLayer; - - namespace Config { -diff --git a/src/Overview.cpp b/src/Overview.cpp -index fb3d064..04f9a0d 100644 ---- a/src/Overview.cpp -+++ b/src/Overview.cpp -@@ -22,7 +22,7 @@ CHyprspaceWidget::CHyprspaceWidget(uint64_t inOwnerID) { - // TODO: implement deconstructor and delete widget on monitor unplug - CHyprspaceWidget::~CHyprspaceWidget() {} - --CMonitor* CHyprspaceWidget::getOwner() { -+PHLMONITOR CHyprspaceWidget::getOwner() { - return g_pCompositor->getMonitorFromID(ownerID); - } - -diff --git a/src/Overview.hpp b/src/Overview.hpp -index 8040528..0d92063 100644 ---- a/src/Overview.hpp -+++ b/src/Overview.hpp -@@ -43,7 +43,7 @@ class CHyprspaceWidget { - CHyprspaceWidget(uint64_t); - ~CHyprspaceWidget(); - -- CMonitor* getOwner(); -+ PHLMONITOR getOwner(); - bool isActive(); - - void show(); -diff --git a/src/Render.cpp b/src/Render.cpp -index 4103b0d..4a52e77 100644 ---- a/src/Render.cpp -+++ b/src/Render.cpp -@@ -1,7 +1,7 @@ - #include "Overview.hpp" - #include "Globals.hpp" - --void renderWindowStub(PHLWINDOW pWindow, CMonitor* pMonitor, PHLWORKSPACE pWorkspaceOverride, CBox rectOverride, timespec* time) { -+void renderWindowStub(PHLWINDOW pWindow, PHLMONITOR pMonitor, PHLWORKSPACE pWorkspaceOverride, CBox rectOverride, timespec* time) { - if (!pWindow || !pMonitor || !pWorkspaceOverride || !time) return; - - const auto oWorkspace = pWindow->m_pWorkspace; -@@ -50,7 +50,7 @@ void renderWindowStub(PHLWINDOW pWindow, CMonitor* pMonitor, PHLWORKSPACE pWorks - g_pHyprOpenGL->m_RenderData.renderModif.modifs.pop_back(); - } - --void renderLayerStub(Hyprutils::Memory::CWeakPointer pLayer, CMonitor* pMonitor, CBox rectOverride, timespec* time) { -+void renderLayerStub(Hyprutils::Memory::CWeakPointer pLayer, PHLMONITOR pMonitor, CBox rectOverride, timespec* time) { - if (!pLayer || !pMonitor || !time) return; - - if (!pLayer->mapped || pLayer->readyToDelete || !pLayer->layerSurface) return; -diff --git a/src/main.cpp b/src/main.cpp -index ec948d8..4df67c7 100644 ---- a/src/main.cpp -+++ b/src/main.cpp -@@ -74,7 +74,7 @@ APICALL EXPORT std::string PLUGIN_API_VERSION() { - return HYPRLAND_API_VERSION; - } - --std::shared_ptr getWidgetForMonitor(CMonitor* pMonitor) { -+std::shared_ptr getWidgetForMonitor(PHLMONITORREF pMonitor) { - for (auto& widget : g_overviewWidgets) { - if (!widget) continue; - if (!widget->getOwner()) continue; -@@ -405,7 +405,7 @@ void reloadConfig() { - void registerMonitors() { - // create a widget for each monitor - for (auto& m : g_pCompositor->m_vMonitors) { -- if (getWidgetForMonitor(m.get()) != nullptr) continue; -+ if (getWidgetForMonitor(m) != nullptr) continue; - CHyprspaceWidget* widget = new CHyprspaceWidget(m->ID); - g_overviewWidgets.emplace_back(widget); - } diff --git a/recipes-support/hyprland/hyprspace/fb951708cd4393d455b6a528ee6fc759b9b0751a.patch b/recipes-support/hyprland/hyprspace/fb951708cd4393d455b6a528ee6fc759b9b0751a.patch new file mode 100644 index 0000000..6dfa535 --- /dev/null +++ b/recipes-support/hyprland/hyprspace/fb951708cd4393d455b6a528ee6fc759b9b0751a.patch @@ -0,0 +1,129 @@ +From fb951708cd4393d455b6a528ee6fc759b9b0751a Mon Sep 17 00:00:00 2001 +From: myamusashi +Date: Mon, 28 Oct 2024 03:54:49 +0700 +Subject: [PATCH] Change monitoriD to pointer + +--- + src/Input.cpp | 4 ++-- + src/Layout.cpp | 6 +++--- + src/Overview.cpp | 4 ++-- + src/Render.cpp | 6 +++--- + src/main.cpp | 2 +- + 5 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/src/Input.cpp b/src/Input.cpp +index 1e66f59..ea7812a 100644 +--- a/src/Input.cpp ++++ b/src/Input.cpp +@@ -55,7 +55,7 @@ bool CHyprspaceWidget::buttonEvent(bool pressed, Vector2D coords) { + targetWindow->m_vRealPosition = targetPos; + } + if (Config::switchOnDrop) { +- g_pCompositor->getMonitorFromID(targetWorkspace->m_iMonitorID)->changeWorkspace(targetWorkspace->m_iID); ++ g_pCompositor->getMonitorFromID(targetWorkspace->m_pMonitor)->changeWorkspace(targetWorkspace->m_iID); + if (Config::exitOnSwitch && active) hide(); + } + updateLayout(); +@@ -65,7 +65,7 @@ bool CHyprspaceWidget::buttonEvent(bool pressed, Vector2D coords) { + if (targetWorkspace->m_bIsSpecialWorkspace) + getOwner()->activeSpecialWorkspaceID() == targetWorkspaceID ? getOwner()->setSpecialWorkspace(nullptr) : getOwner()->setSpecialWorkspace(targetWorkspaceID); + else { +- g_pCompositor->getMonitorFromID(targetWorkspace->m_iMonitorID)->changeWorkspace(targetWorkspace->m_iID); ++ g_pCompositor->getMonitorFromID(targetWorkspace->m_pMonitor)->changeWorkspace(targetWorkspace->m_iID); + } + if (Config::exitOnSwitch && active) hide(); + } +diff --git a/src/Layout.cpp b/src/Layout.cpp +index 35ba812..1356d0f 100644 +--- a/src/Layout.cpp ++++ b/src/Layout.cpp +@@ -26,7 +26,7 @@ void CHyprspaceWidget::updateLayout() { + const auto oActiveWorkspace = pMonitor->activeWorkspace; + + for (auto& ws : g_pCompositor->m_vWorkspaces) { // HACK: recalculate other workspaces without reserved area +- if (ws->m_iMonitorID == ownerID && ws->m_iID != oActiveWorkspace->m_iID) { ++ if (ws->m_pMonitor == ownerID && ws->m_iID != oActiveWorkspace->m_iID) { + pMonitor->activeWorkspace = ws; + const auto curRules = std::to_string(pMonitor->activeWorkspaceID()) + ", gapsin:" + PGAPSIN->toString() + ", gapsout:" + PGAPSOUT->toString(); + if (Config::overrideGaps) g_pConfigManager->handleWorkspaceRules("", curRules); +@@ -45,11 +45,11 @@ void CHyprspaceWidget::updateLayout() { + } + else { + for (auto& ws : g_pCompositor->m_vWorkspaces) { +- if (ws->m_iMonitorID == ownerID) { ++ if (ws->m_pMonitor == ownerID) { + const auto curRules = std::to_string(ws->m_iID) + ", gapsin:" + PGAPSIN->toString() + ", gapsout:" + PGAPSOUT->toString(); + if (Config::overrideGaps) g_pConfigManager->handleWorkspaceRules("", curRules); + g_pLayoutManager->getCurrentLayout()->recalculateMonitor(ownerID); + } + } + } +-} +\ No newline at end of file ++} +diff --git a/src/Overview.cpp b/src/Overview.cpp +index 04f9a0d..457a4ba 100644 +--- a/src/Overview.cpp ++++ b/src/Overview.cpp +@@ -33,7 +33,7 @@ void CHyprspaceWidget::show() { + if (prevFullscreen.empty()) { + // unfullscreen all windows + for (auto& ws : g_pCompositor->m_vWorkspaces) { +- if (ws->m_iMonitorID == ownerID) { ++ if (ws->m_pMonitor == ownerID) { + const auto w = g_pCompositor->getFullscreenWindowOnWorkspace(ws->m_iID); + if (w != nullptr && ws->m_efFullscreenMode != FSMODE_NONE) { + // use fakefullscreenstate to preserve client's internal state +@@ -41,7 +41,7 @@ void CHyprspaceWidget::show() { + if (ws->m_efFullscreenMode == FSMODE_FULLSCREEN) w->m_bWantsInitialFullscreen = true; + // we use the getWindowFromHandle function to prevent dangling pointers + prevFullscreen.emplace_back(std::make_tuple((uint32_t)(((uint64_t)w.get()) & 0xFFFFFFFF), ws->m_efFullscreenMode)); +- g_pCompositor->setWindowFullscreenState(w, sFullscreenState(FSMODE_NONE)); ++ g_pCompositor->setWindowFullscreenState(w, sFullscreenState{.internal = FSMODE_NONE, .client = FSMODE_NONE}); + } + } + } +diff --git a/src/Render.cpp b/src/Render.cpp +index 4a52e77..a99e53a 100644 +--- a/src/Render.cpp ++++ b/src/Render.cpp +@@ -5,7 +5,7 @@ void renderWindowStub(PHLWINDOW pWindow, PHLMONITOR pMonitor, PHLWORKSPACE pWork + if (!pWindow || !pMonitor || !pWorkspaceOverride || !time) return; + + const auto oWorkspace = pWindow->m_pWorkspace; +- const auto oFullscreen = pWindow->m_sFullscreenState; ++ const auto oFullscreen = pWindow->m_sFullscreenState = {.internal = FSMODE_NONE}; + const auto oRealPosition = pWindow->m_vRealPosition.value(); + const auto oSize = pWindow->m_vRealSize.value(); + const auto oUseNearestNeighbor = pWindow->m_sWindowData.nearestNeighbor; +@@ -24,7 +24,7 @@ void renderWindowStub(PHLWINDOW pWindow, PHLMONITOR pMonitor, PHLWORKSPACE pWork + g_pHyprOpenGL->m_RenderData.renderModif.modifs.push_back({SRenderModifData::eRenderModifType::RMOD_TYPE_SCALE, curScaling}); + g_pHyprOpenGL->m_RenderData.renderModif.enabled = true; + pWindow->m_pWorkspace = pWorkspaceOverride; +- pWindow->m_sFullscreenState = sFullscreenState(FSMODE_NONE); // FIXME: still do nothing, fullscreen requests not reject when overview active ++ pWindow->m_sFullscreenState = sFullscreenState{.internal = FSMODE_NONE}; // FIXME: still do nothing, fullscreen requests not reject when overview active + pWindow->m_sWindowData.nearestNeighbor = false; // FIX: this wont do, need to scale surface texture down properly so that windows arent shown as pixelated mess + pWindow->m_bIsFloating = false; // weird shit happened so hack fix + pWindow->m_bPinned = true; +@@ -138,7 +138,7 @@ void CHyprspaceWidget::draw() { + if (!ws) continue; + // normal workspaces start from 1, special workspaces ends on -2 + if (ws->m_iID < 1) continue; +- if (ws->m_iMonitorID == ownerID) { ++ if (ws->m_pMonitor == ownerID) { + workspaces.push_back(ws->m_iID); + if (highestID < ws->m_iID) highestID = ws->m_iID; + if (lowestID > ws->m_iID) lowestID = ws->m_iID; +diff --git a/src/main.cpp b/src/main.cpp +index 4df67c7..a276119 100644 +--- a/src/main.cpp ++++ b/src/main.cpp +@@ -158,7 +158,7 @@ void onWorkspaceChange(void* thisptr, SCallbackInfo& info, std::any args) { + const auto pWorkspace = std::any_cast(args); + if (!pWorkspace) return; + +- auto widget = getWidgetForMonitor(g_pCompositor->getMonitorFromID(pWorkspace->m_iMonitorID)); ++ auto widget = getWidgetForMonitor(g_pCompositor->getMonitorFromID(pWorkspace->m_pMonitor)); + if (widget != nullptr) + if (widget->isActive()) + widget->show(); diff --git a/recipes-support/hyprland/hyprspace_git.bb b/recipes-support/hyprland/hyprspace_git.bb index cdc9dd8..6c166cd 100644 --- a/recipes-support/hyprland/hyprspace_git.bb +++ b/recipes-support/hyprland/hyprspace_git.bb @@ -5,10 +5,10 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263" SRC_URI = " \ git://github.com/KZDKM/Hyprspace.git;protocol=https;branch=main \ - file://b88502ea9bcec83f4ab45edfc02bf96533d04cdd.patch \ + file://fb951708cd4393d455b6a528ee6fc759b9b0751a.patch \ " -SRCREV = "8f14fa2e10d24742d713f04c278bc7651037b74b" +SRCREV = "999af6e9f290458b6c4f93d6161988d472402c94" S = "${WORKDIR}/git" DEPENDS += " \