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();