windows: refactor class member vars (#10168)
This commit is contained in:
parent
c505eb55ff
commit
2118440488
43 changed files with 2124 additions and 2134 deletions
|
|
@ -51,7 +51,7 @@ void CANRManager::onTick() {
|
|||
PHLWINDOW firstWindow;
|
||||
int count = 0;
|
||||
for (const auto& w : g_pCompositor->m_windows) {
|
||||
if (!w->m_bIsMapped)
|
||||
if (!w->m_isMapped)
|
||||
continue;
|
||||
|
||||
if (!data->fitsWindow(w))
|
||||
|
|
@ -67,10 +67,10 @@ void CANRManager::onTick() {
|
|||
|
||||
if (data->missedResponses >= *PANRTHRESHOLD) {
|
||||
if (!data->isRunning() && !data->dialogSaidWait) {
|
||||
data->runDialog("Application Not Responding", firstWindow->m_szTitle, firstWindow->m_szClass, data->getPid());
|
||||
data->runDialog("Application Not Responding", firstWindow->m_title, firstWindow->m_class, data->getPid());
|
||||
|
||||
for (const auto& w : g_pCompositor->m_windows) {
|
||||
if (!w->m_bIsMapped)
|
||||
if (!w->m_isMapped)
|
||||
continue;
|
||||
|
||||
if (!data->fitsWindow(w))
|
||||
|
|
@ -133,10 +133,10 @@ bool CANRManager::isNotResponding(SP<CANRManager::SANRData> data) {
|
|||
|
||||
SP<CANRManager::SANRData> CANRManager::dataFor(PHLWINDOW pWindow) {
|
||||
auto it = m_data.end();
|
||||
if (pWindow->m_pXWaylandSurface)
|
||||
it = std::ranges::find_if(m_data, [&pWindow](const auto& data) { return data->xwaylandSurface && data->xwaylandSurface == pWindow->m_pXWaylandSurface; });
|
||||
else if (pWindow->m_pXDGSurface)
|
||||
it = std::ranges::find_if(m_data, [&pWindow](const auto& data) { return data->xdgBase && data->xdgBase == pWindow->m_pXDGSurface->owner; });
|
||||
if (pWindow->m_xwaylandSurface)
|
||||
it = std::ranges::find_if(m_data, [&pWindow](const auto& data) { return data->xwaylandSurface && data->xwaylandSurface == pWindow->m_xwaylandSurface; });
|
||||
else if (pWindow->m_xdgSurface)
|
||||
it = std::ranges::find_if(m_data, [&pWindow](const auto& data) { return data->xdgBase && data->xdgBase == pWindow->m_xdgSurface->owner; });
|
||||
return it == m_data.end() ? nullptr : *it;
|
||||
}
|
||||
|
||||
|
|
@ -150,8 +150,7 @@ SP<CANRManager::SANRData> CANRManager::dataFor(SP<CXWaylandSurface> pXwaylandSur
|
|||
return it == m_data.end() ? nullptr : *it;
|
||||
}
|
||||
|
||||
CANRManager::SANRData::SANRData(PHLWINDOW pWindow) :
|
||||
xwaylandSurface(pWindow->m_pXWaylandSurface), xdgBase(pWindow->m_pXDGSurface ? pWindow->m_pXDGSurface->owner : WP<CXDGWMBase>{}) {
|
||||
CANRManager::SANRData::SANRData(PHLWINDOW pWindow) : xwaylandSurface(pWindow->m_xwaylandSurface), xdgBase(pWindow->m_xdgSurface ? pWindow->m_xdgSurface->owner : WP<CXDGWMBase>{}) {
|
||||
;
|
||||
}
|
||||
|
||||
|
|
@ -199,10 +198,10 @@ void CANRManager::SANRData::killDialog() {
|
|||
}
|
||||
|
||||
bool CANRManager::SANRData::fitsWindow(PHLWINDOW pWindow) const {
|
||||
if (pWindow->m_pXWaylandSurface)
|
||||
return pWindow->m_pXWaylandSurface == xwaylandSurface;
|
||||
else if (pWindow->m_pXDGSurface)
|
||||
return pWindow->m_pXDGSurface->owner == xdgBase && xdgBase;
|
||||
if (pWindow->m_xwaylandSurface)
|
||||
return pWindow->m_xwaylandSurface == xwaylandSurface;
|
||||
else if (pWindow->m_xdgSurface)
|
||||
return pWindow->m_xdgSurface->owner == xdgBase && xdgBase;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,11 +94,11 @@ static void handleUpdate(CAnimatedVariable<VarType>& av, bool warp) {
|
|||
PDECO->damageEntire();
|
||||
}
|
||||
|
||||
PMONITOR = PWINDOW->m_pMonitor.lock();
|
||||
PMONITOR = PWINDOW->m_monitor.lock();
|
||||
if (!PMONITOR)
|
||||
return;
|
||||
|
||||
animationsDisabled = PWINDOW->m_sWindowData.noAnim.valueOr(animationsDisabled);
|
||||
animationsDisabled = PWINDOW->m_windowData.noAnim.valueOr(animationsDisabled);
|
||||
} else if (PWORKSPACE) {
|
||||
PMONITOR = PWORKSPACE->m_monitor.lock();
|
||||
if (!PMONITOR)
|
||||
|
|
@ -110,10 +110,10 @@ static void handleUpdate(CAnimatedVariable<VarType>& av, bool warp) {
|
|||
|
||||
// TODO: just make this into a damn callback already vax...
|
||||
for (auto const& w : g_pCompositor->m_windows) {
|
||||
if (!w->m_bIsMapped || w->isHidden() || w->m_pWorkspace != PWORKSPACE)
|
||||
if (!w->m_isMapped || w->isHidden() || w->m_workspace != PWORKSPACE)
|
||||
continue;
|
||||
|
||||
if (w->m_bIsFloating && !w->m_bPinned) {
|
||||
if (w->m_isFloating && !w->m_pinned) {
|
||||
// still doing the full damage hack for floating because sometimes when the window
|
||||
// goes through multiple monitors the last rendered frame is missing damage somehow??
|
||||
const CBox windowBoxNoOffset = w->getFullWindowBoundingBox();
|
||||
|
|
@ -128,7 +128,7 @@ static void handleUpdate(CAnimatedVariable<VarType>& av, bool warp) {
|
|||
|
||||
// damage any workspace window that is on any monitor
|
||||
for (auto const& w : g_pCompositor->m_windows) {
|
||||
if (!validMapped(w) || w->m_pWorkspace != PWORKSPACE || w->m_bPinned)
|
||||
if (!validMapped(w) || w->m_workspace != PWORKSPACE || w->m_pinned)
|
||||
continue;
|
||||
|
||||
g_pHyprRenderer->damageWindow(w);
|
||||
|
|
@ -164,13 +164,13 @@ static void handleUpdate(CAnimatedVariable<VarType>& av, bool warp) {
|
|||
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||
} else if (PWORKSPACE) {
|
||||
for (auto const& w : g_pCompositor->m_windows) {
|
||||
if (!validMapped(w) || w->m_pWorkspace != PWORKSPACE)
|
||||
if (!validMapped(w) || w->m_workspace != PWORKSPACE)
|
||||
continue;
|
||||
|
||||
w->updateWindowDecos();
|
||||
|
||||
// damage any workspace window that is on any monitor
|
||||
if (!w->m_bPinned)
|
||||
if (!w->m_pinned)
|
||||
g_pHyprRenderer->damageWindow(w);
|
||||
}
|
||||
} else if (PLAYER) {
|
||||
|
|
@ -281,25 +281,25 @@ void CHyprAnimationManager::onTicked() {
|
|||
//
|
||||
|
||||
void CHyprAnimationManager::animationPopin(PHLWINDOW pWindow, bool close, float minPerc) {
|
||||
const auto GOALPOS = pWindow->m_vRealPosition->goal();
|
||||
const auto GOALSIZE = pWindow->m_vRealSize->goal();
|
||||
const auto GOALPOS = pWindow->m_realPosition->goal();
|
||||
const auto GOALSIZE = pWindow->m_realSize->goal();
|
||||
|
||||
if (!close) {
|
||||
pWindow->m_vRealSize->setValue((GOALSIZE * minPerc).clamp({5, 5}, {GOALSIZE.x, GOALSIZE.y}));
|
||||
pWindow->m_vRealPosition->setValue(GOALPOS + GOALSIZE / 2.f - pWindow->m_vRealSize->value() / 2.f);
|
||||
pWindow->m_realSize->setValue((GOALSIZE * minPerc).clamp({5, 5}, {GOALSIZE.x, GOALSIZE.y}));
|
||||
pWindow->m_realPosition->setValue(GOALPOS + GOALSIZE / 2.f - pWindow->m_realSize->value() / 2.f);
|
||||
} else {
|
||||
*pWindow->m_vRealSize = (GOALSIZE * minPerc).clamp({5, 5}, {GOALSIZE.x, GOALSIZE.y});
|
||||
*pWindow->m_vRealPosition = GOALPOS + GOALSIZE / 2.f - pWindow->m_vRealSize->goal() / 2.f;
|
||||
*pWindow->m_realSize = (GOALSIZE * minPerc).clamp({5, 5}, {GOALSIZE.x, GOALSIZE.y});
|
||||
*pWindow->m_realPosition = GOALPOS + GOALSIZE / 2.f - pWindow->m_realSize->goal() / 2.f;
|
||||
}
|
||||
}
|
||||
|
||||
void CHyprAnimationManager::animationSlide(PHLWINDOW pWindow, std::string force, bool close) {
|
||||
pWindow->m_vRealSize->warp(false); // size we preserve in slide
|
||||
pWindow->m_realSize->warp(false); // size we preserve in slide
|
||||
|
||||
const auto GOALPOS = pWindow->m_vRealPosition->goal();
|
||||
const auto GOALSIZE = pWindow->m_vRealSize->goal();
|
||||
const auto GOALPOS = pWindow->m_realPosition->goal();
|
||||
const auto GOALSIZE = pWindow->m_realSize->goal();
|
||||
|
||||
const auto PMONITOR = pWindow->m_pMonitor.lock();
|
||||
const auto PMONITOR = pWindow->m_monitor.lock();
|
||||
|
||||
if (!PMONITOR)
|
||||
return; // unsafe state most likely
|
||||
|
|
@ -317,9 +317,9 @@ void CHyprAnimationManager::animationSlide(PHLWINDOW pWindow, std::string force,
|
|||
posOffset = Vector2D(GOALPOS.x, PMONITOR->vecPosition.y - GOALSIZE.y);
|
||||
|
||||
if (!close)
|
||||
pWindow->m_vRealPosition->setValue(posOffset);
|
||||
pWindow->m_realPosition->setValue(posOffset);
|
||||
else
|
||||
*pWindow->m_vRealPosition = posOffset;
|
||||
*pWindow->m_realPosition = posOffset;
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -327,10 +327,10 @@ void CHyprAnimationManager::animationSlide(PHLWINDOW pWindow, std::string force,
|
|||
const auto MIDPOINT = GOALPOS + GOALSIZE / 2.f;
|
||||
|
||||
// check sides it touches
|
||||
const bool DISPLAYLEFT = STICKS(pWindow->m_vPosition.x, PMONITOR->vecPosition.x + PMONITOR->vecReservedTopLeft.x);
|
||||
const bool DISPLAYRIGHT = STICKS(pWindow->m_vPosition.x + pWindow->m_vSize.x, PMONITOR->vecPosition.x + PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x);
|
||||
const bool DISPLAYTOP = STICKS(pWindow->m_vPosition.y, PMONITOR->vecPosition.y + PMONITOR->vecReservedTopLeft.y);
|
||||
const bool DISPLAYBOTTOM = STICKS(pWindow->m_vPosition.y + pWindow->m_vSize.y, PMONITOR->vecPosition.y + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y);
|
||||
const bool DISPLAYLEFT = STICKS(pWindow->m_position.x, PMONITOR->vecPosition.x + PMONITOR->vecReservedTopLeft.x);
|
||||
const bool DISPLAYRIGHT = STICKS(pWindow->m_position.x + pWindow->m_size.x, PMONITOR->vecPosition.x + PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x);
|
||||
const bool DISPLAYTOP = STICKS(pWindow->m_position.y, PMONITOR->vecPosition.y + PMONITOR->vecReservedTopLeft.y);
|
||||
const bool DISPLAYBOTTOM = STICKS(pWindow->m_position.y + pWindow->m_size.y, PMONITOR->vecPosition.y + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y);
|
||||
|
||||
if (DISPLAYBOTTOM && DISPLAYTOP) {
|
||||
if (DISPLAYLEFT && DISPLAYRIGHT) {
|
||||
|
|
@ -352,52 +352,52 @@ void CHyprAnimationManager::animationSlide(PHLWINDOW pWindow, std::string force,
|
|||
}
|
||||
|
||||
if (!close)
|
||||
pWindow->m_vRealPosition->setValue(posOffset);
|
||||
pWindow->m_realPosition->setValue(posOffset);
|
||||
else
|
||||
*pWindow->m_vRealPosition = posOffset;
|
||||
*pWindow->m_realPosition = posOffset;
|
||||
}
|
||||
|
||||
void CHyprAnimationManager::animationGnomed(PHLWINDOW pWindow, bool close) {
|
||||
const auto GOALPOS = pWindow->m_vRealPosition->goal();
|
||||
const auto GOALSIZE = pWindow->m_vRealSize->goal();
|
||||
const auto GOALPOS = pWindow->m_realPosition->goal();
|
||||
const auto GOALSIZE = pWindow->m_realSize->goal();
|
||||
|
||||
if (close) {
|
||||
*pWindow->m_vRealPosition = GOALPOS + Vector2D{0.F, GOALSIZE.y / 2.F};
|
||||
*pWindow->m_vRealSize = Vector2D{GOALSIZE.x, 0.F};
|
||||
*pWindow->m_realPosition = GOALPOS + Vector2D{0.F, GOALSIZE.y / 2.F};
|
||||
*pWindow->m_realSize = Vector2D{GOALSIZE.x, 0.F};
|
||||
} else {
|
||||
pWindow->m_vRealPosition->setValueAndWarp(GOALPOS + Vector2D{0.F, GOALSIZE.y / 2.F});
|
||||
pWindow->m_vRealSize->setValueAndWarp(Vector2D{GOALSIZE.x, 0.F});
|
||||
*pWindow->m_vRealPosition = GOALPOS;
|
||||
*pWindow->m_vRealSize = GOALSIZE;
|
||||
pWindow->m_realPosition->setValueAndWarp(GOALPOS + Vector2D{0.F, GOALSIZE.y / 2.F});
|
||||
pWindow->m_realSize->setValueAndWarp(Vector2D{GOALSIZE.x, 0.F});
|
||||
*pWindow->m_realPosition = GOALPOS;
|
||||
*pWindow->m_realSize = GOALSIZE;
|
||||
}
|
||||
}
|
||||
|
||||
void CHyprAnimationManager::onWindowPostCreateClose(PHLWINDOW pWindow, bool close) {
|
||||
if (!close) {
|
||||
pWindow->m_vRealPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsIn"));
|
||||
pWindow->m_vRealSize->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsIn"));
|
||||
pWindow->m_fAlpha->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeIn"));
|
||||
pWindow->m_realPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsIn"));
|
||||
pWindow->m_realSize->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsIn"));
|
||||
pWindow->m_alpha->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeIn"));
|
||||
} else {
|
||||
pWindow->m_vRealPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsOut"));
|
||||
pWindow->m_vRealSize->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsOut"));
|
||||
pWindow->m_fAlpha->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeOut"));
|
||||
pWindow->m_realPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsOut"));
|
||||
pWindow->m_realSize->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsOut"));
|
||||
pWindow->m_alpha->setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeOut"));
|
||||
}
|
||||
|
||||
std::string ANIMSTYLE = pWindow->m_vRealPosition->getStyle();
|
||||
std::string ANIMSTYLE = pWindow->m_realPosition->getStyle();
|
||||
transform(ANIMSTYLE.begin(), ANIMSTYLE.end(), ANIMSTYLE.begin(), ::tolower);
|
||||
|
||||
CVarList animList(ANIMSTYLE, 0, 's');
|
||||
|
||||
// if the window is not being animated, that means the layout set a fixed size for it, don't animate.
|
||||
if (!pWindow->m_vRealPosition->isBeingAnimated() && !pWindow->m_vRealSize->isBeingAnimated())
|
||||
if (!pWindow->m_realPosition->isBeingAnimated() && !pWindow->m_realSize->isBeingAnimated())
|
||||
return;
|
||||
|
||||
// if the animation is disabled and we are leaving, ignore the anim to prevent the snapshot being fucked
|
||||
if (!pWindow->m_vRealPosition->enabled())
|
||||
if (!pWindow->m_realPosition->enabled())
|
||||
return;
|
||||
|
||||
if (pWindow->m_sWindowData.animationStyle.hasValue()) {
|
||||
const auto STYLE = pWindow->m_sWindowData.animationStyle.value();
|
||||
if (pWindow->m_windowData.animationStyle.hasValue()) {
|
||||
const auto STYLE = pWindow->m_windowData.animationStyle.value();
|
||||
// the window has config'd special anim
|
||||
if (STYLE.starts_with("slide")) {
|
||||
CVarList animList2(STYLE, 0, 's');
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ static void updateRelativeCursorCoords() {
|
|||
return;
|
||||
|
||||
if (g_pCompositor->m_lastWindow)
|
||||
g_pCompositor->m_lastWindow->m_vRelativeCursorCoordsOnLastWarp = g_pInputManager->getMouseCoordsInternal() - g_pCompositor->m_lastWindow->m_vPosition;
|
||||
g_pCompositor->m_lastWindow->m_relativeCursorCoordsOnLastWarp = g_pInputManager->getMouseCoordsInternal() - g_pCompositor->m_lastWindow->m_position;
|
||||
}
|
||||
|
||||
bool CKeybindManager::tryMoveFocusToMonitor(PHLMONITOR monitor) {
|
||||
|
|
@ -389,21 +389,21 @@ void CKeybindManager::switchToWindow(PHLWINDOW PWINDOWTOCHANGETO, bool preserveF
|
|||
// remove constraints
|
||||
g_pInputManager->unconstrainMouse();
|
||||
|
||||
if (PLASTWINDOW && PLASTWINDOW->m_pWorkspace == PWINDOWTOCHANGETO->m_pWorkspace && PLASTWINDOW->isFullscreen()) {
|
||||
const auto PWORKSPACE = PLASTWINDOW->m_pWorkspace;
|
||||
if (PLASTWINDOW && PLASTWINDOW->m_workspace == PWINDOWTOCHANGETO->m_workspace && PLASTWINDOW->isFullscreen()) {
|
||||
const auto PWORKSPACE = PLASTWINDOW->m_workspace;
|
||||
const auto MODE = PWORKSPACE->m_fullscreenMode;
|
||||
|
||||
if (!PWINDOWTOCHANGETO->m_bPinned)
|
||||
if (!PWINDOWTOCHANGETO->m_pinned)
|
||||
g_pCompositor->setWindowFullscreenInternal(PLASTWINDOW, FSMODE_NONE);
|
||||
|
||||
g_pCompositor->focusWindow(PWINDOWTOCHANGETO, nullptr, preserveFocusHistory);
|
||||
|
||||
if (!PWINDOWTOCHANGETO->m_bPinned)
|
||||
if (!PWINDOWTOCHANGETO->m_pinned)
|
||||
g_pCompositor->setWindowFullscreenInternal(PWINDOWTOCHANGETO, MODE);
|
||||
|
||||
// warp the position + size animation, otherwise it looks weird.
|
||||
PWINDOWTOCHANGETO->m_vRealPosition->warp();
|
||||
PWINDOWTOCHANGETO->m_vRealSize->warp();
|
||||
PWINDOWTOCHANGETO->m_realPosition->warp();
|
||||
PWINDOWTOCHANGETO->m_realSize->warp();
|
||||
} else {
|
||||
updateRelativeCursorCoords();
|
||||
g_pCompositor->focusWindow(PWINDOWTOCHANGETO, nullptr, preserveFocusHistory);
|
||||
|
|
@ -416,9 +416,9 @@ void CKeybindManager::switchToWindow(PHLWINDOW PWINDOWTOCHANGETO, bool preserveF
|
|||
g_pInputManager->m_pForcedFocus.reset();
|
||||
}
|
||||
|
||||
if (PLASTWINDOW && PLASTWINDOW->m_pMonitor != PWINDOWTOCHANGETO->m_pMonitor) {
|
||||
if (PLASTWINDOW && PLASTWINDOW->m_monitor != PWINDOWTOCHANGETO->m_monitor) {
|
||||
// event
|
||||
const auto PNEWMON = PWINDOWTOCHANGETO->m_pMonitor.lock();
|
||||
const auto PNEWMON = PWINDOWTOCHANGETO->m_monitor.lock();
|
||||
|
||||
g_pCompositor->setActiveMonitor(PNEWMON);
|
||||
}
|
||||
|
|
@ -1133,33 +1133,33 @@ static SDispatchResult toggleActiveFloatingCore(std::string args, std::optional<
|
|||
if (!PWINDOW)
|
||||
return {.success = false, .error = "Window not found"};
|
||||
|
||||
if (floatState.has_value() && floatState == PWINDOW->m_bIsFloating)
|
||||
if (floatState.has_value() && floatState == PWINDOW->m_isFloating)
|
||||
return {};
|
||||
|
||||
// remove drag status
|
||||
if (!g_pInputManager->currentlyDraggedWindow.expired())
|
||||
g_pKeybindManager->changeMouseBindMode(MBIND_INVALID);
|
||||
|
||||
if (PWINDOW->m_sGroupData.pNextWindow.lock() && PWINDOW->m_sGroupData.pNextWindow.lock() != PWINDOW) {
|
||||
if (PWINDOW->m_groupData.pNextWindow.lock() && PWINDOW->m_groupData.pNextWindow.lock() != PWINDOW) {
|
||||
const auto PCURRENT = PWINDOW->getGroupCurrent();
|
||||
|
||||
PCURRENT->m_bIsFloating = !PCURRENT->m_bIsFloating;
|
||||
PCURRENT->m_isFloating = !PCURRENT->m_isFloating;
|
||||
g_pLayoutManager->getCurrentLayout()->changeWindowFloatingMode(PCURRENT);
|
||||
|
||||
PHLWINDOW curr = PCURRENT->m_sGroupData.pNextWindow.lock();
|
||||
PHLWINDOW curr = PCURRENT->m_groupData.pNextWindow.lock();
|
||||
while (curr != PCURRENT) {
|
||||
curr->m_bIsFloating = PCURRENT->m_bIsFloating;
|
||||
curr = curr->m_sGroupData.pNextWindow.lock();
|
||||
curr->m_isFloating = PCURRENT->m_isFloating;
|
||||
curr = curr->m_groupData.pNextWindow.lock();
|
||||
}
|
||||
} else {
|
||||
PWINDOW->m_bIsFloating = !PWINDOW->m_bIsFloating;
|
||||
PWINDOW->m_isFloating = !PWINDOW->m_isFloating;
|
||||
|
||||
g_pLayoutManager->getCurrentLayout()->changeWindowFloatingMode(PWINDOW);
|
||||
}
|
||||
|
||||
if (PWINDOW->m_pWorkspace) {
|
||||
PWINDOW->m_pWorkspace->updateWindows();
|
||||
PWINDOW->m_pWorkspace->updateWindowData();
|
||||
if (PWINDOW->m_workspace) {
|
||||
PWINDOW->m_workspace->updateWindows();
|
||||
PWINDOW->m_workspace->updateWindowData();
|
||||
}
|
||||
|
||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PWINDOW->monitorID());
|
||||
|
|
@ -1183,17 +1183,17 @@ SDispatchResult CKeybindManager::setActiveTiled(std::string args) {
|
|||
SDispatchResult CKeybindManager::centerWindow(std::string args) {
|
||||
const auto PWINDOW = g_pCompositor->m_lastWindow.lock();
|
||||
|
||||
if (!PWINDOW || !PWINDOW->m_bIsFloating || PWINDOW->isFullscreen())
|
||||
if (!PWINDOW || !PWINDOW->m_isFloating || PWINDOW->isFullscreen())
|
||||
return {.success = false, .error = "No floating window found"};
|
||||
|
||||
const auto PMONITOR = PWINDOW->m_pMonitor.lock();
|
||||
const auto PMONITOR = PWINDOW->m_monitor.lock();
|
||||
|
||||
auto RESERVEDOFFSET = Vector2D();
|
||||
if (args == "1")
|
||||
RESERVEDOFFSET = (PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight) / 2.f;
|
||||
|
||||
*PWINDOW->m_vRealPosition = PMONITOR->middle() - PWINDOW->m_vRealSize->goal() / 2.f + RESERVEDOFFSET;
|
||||
PWINDOW->m_vPosition = PWINDOW->m_vRealPosition->goal();
|
||||
*PWINDOW->m_realPosition = PMONITOR->middle() - PWINDOW->m_realSize->goal() / 2.f + RESERVEDOFFSET;
|
||||
PWINDOW->m_position = PWINDOW->m_realPosition->goal();
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
@ -1209,7 +1209,7 @@ SDispatchResult CKeybindManager::toggleActivePseudo(std::string args) {
|
|||
if (!PWINDOW)
|
||||
return {.success = false, .error = "Window not found"};
|
||||
|
||||
PWINDOW->m_bIsPseudotiled = !PWINDOW->m_bIsPseudotiled;
|
||||
PWINDOW->m_isPseudotiled = !PWINDOW->m_isPseudotiled;
|
||||
|
||||
if (!PWINDOW->isFullscreen())
|
||||
g_pLayoutManager->getCurrentLayout()->recalculateWindow(PWINDOW);
|
||||
|
|
@ -1362,7 +1362,7 @@ SDispatchResult CKeybindManager::fullscreenStateActive(std::string args) {
|
|||
if (!PWINDOW)
|
||||
return {.success = false, .error = "Window not found"};
|
||||
|
||||
PWINDOW->m_sWindowData.syncFullscreen = CWindowOverridableVar(false, PRIORITY_SET_PROP);
|
||||
PWINDOW->m_windowData.syncFullscreen = CWindowOverridableVar(false, PRIORITY_SET_PROP);
|
||||
|
||||
int internalMode, clientMode;
|
||||
try {
|
||||
|
|
@ -1372,19 +1372,19 @@ SDispatchResult CKeybindManager::fullscreenStateActive(std::string args) {
|
|||
clientMode = std::stoi(ARGS[1]);
|
||||
} catch (std::exception& e) { clientMode = -1; }
|
||||
|
||||
const SFullscreenState STATE = SFullscreenState{.internal = (internalMode != -1 ? (eFullscreenMode)internalMode : PWINDOW->m_sFullscreenState.internal),
|
||||
.client = (clientMode != -1 ? (eFullscreenMode)clientMode : PWINDOW->m_sFullscreenState.client)};
|
||||
const SFullscreenState STATE = SFullscreenState{.internal = (internalMode != -1 ? (eFullscreenMode)internalMode : PWINDOW->m_fullscreenState.internal),
|
||||
.client = (clientMode != -1 ? (eFullscreenMode)clientMode : PWINDOW->m_fullscreenState.client)};
|
||||
|
||||
if (internalMode != -1 && clientMode != -1 && PWINDOW->m_sFullscreenState.internal == STATE.internal && PWINDOW->m_sFullscreenState.client == STATE.client)
|
||||
if (internalMode != -1 && clientMode != -1 && PWINDOW->m_fullscreenState.internal == STATE.internal && PWINDOW->m_fullscreenState.client == STATE.client)
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = FSMODE_NONE, .client = FSMODE_NONE});
|
||||
else if (internalMode != -1 && clientMode == -1 && PWINDOW->m_sFullscreenState.internal == STATE.internal)
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = FSMODE_NONE, .client = PWINDOW->m_sFullscreenState.client});
|
||||
else if (internalMode == -1 && clientMode != -1 && PWINDOW->m_sFullscreenState.client == STATE.client)
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = PWINDOW->m_sFullscreenState.internal, .client = FSMODE_NONE});
|
||||
else if (internalMode != -1 && clientMode == -1 && PWINDOW->m_fullscreenState.internal == STATE.internal)
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = FSMODE_NONE, .client = PWINDOW->m_fullscreenState.client});
|
||||
else if (internalMode == -1 && clientMode != -1 && PWINDOW->m_fullscreenState.client == STATE.client)
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, SFullscreenState{.internal = PWINDOW->m_fullscreenState.internal, .client = FSMODE_NONE});
|
||||
else
|
||||
g_pCompositor->setWindowFullscreenState(PWINDOW, STATE);
|
||||
|
||||
PWINDOW->m_sWindowData.syncFullscreen = CWindowOverridableVar(PWINDOW->m_sFullscreenState.internal == PWINDOW->m_sFullscreenState.client, PRIORITY_SET_PROP);
|
||||
PWINDOW->m_windowData.syncFullscreen = CWindowOverridableVar(PWINDOW->m_fullscreenState.internal == PWINDOW->m_fullscreenState.client, PRIORITY_SET_PROP);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
@ -1416,7 +1416,7 @@ SDispatchResult CKeybindManager::moveActiveToWorkspace(std::string args) {
|
|||
|
||||
auto pWorkspace = g_pCompositor->getWorkspaceByID(WORKSPACEID);
|
||||
PHLMONITOR pMonitor = nullptr;
|
||||
const auto POLDWS = PWINDOW->m_pWorkspace;
|
||||
const auto POLDWS = PWINDOW->m_workspace;
|
||||
static auto PALLOWWORKSPACECYCLES = CConfigValue<Hyprlang::INT>("binds:allow_workspace_cycles");
|
||||
|
||||
updateRelativeCursorCoords();
|
||||
|
|
@ -1519,7 +1519,7 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) {
|
|||
g_pCompositor->getWindowInDirection(PLASTWINDOW, arg);
|
||||
|
||||
// Prioritize focus change within groups if the window is a part of it.
|
||||
if (*PGROUPCYCLE && PLASTWINDOW->m_sGroupData.pNextWindow) {
|
||||
if (*PGROUPCYCLE && PLASTWINDOW->m_groupData.pNextWindow) {
|
||||
auto isTheOnlyGroupOnWs = !PWINDOWTOCHANGETO && g_pCompositor->m_monitors.size() == 1;
|
||||
if (arg == 'l' && (PLASTWINDOW != PLASTWINDOW->getGroupHead() || isTheOnlyGroupOnWs)) {
|
||||
PLASTWINDOW->setGroupCurrent(PLASTWINDOW->getGroupPrevious());
|
||||
|
|
@ -1527,7 +1527,7 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) {
|
|||
}
|
||||
|
||||
else if (arg == 'r' && (PLASTWINDOW != PLASTWINDOW->getGroupTail() || isTheOnlyGroupOnWs)) {
|
||||
PLASTWINDOW->setGroupCurrent(PLASTWINDOW->m_sGroupData.pNextWindow.lock());
|
||||
PLASTWINDOW->setGroupCurrent(PLASTWINDOW->m_groupData.pNextWindow.lock());
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
|
@ -1549,15 +1549,15 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) {
|
|||
|
||||
Debug::log(LOG, "No monitor found in direction {}, getting the inverse edge", arg);
|
||||
|
||||
const auto PMONITOR = PLASTWINDOW->m_pMonitor.lock();
|
||||
const auto PMONITOR = PLASTWINDOW->m_monitor.lock();
|
||||
|
||||
if (!PMONITOR)
|
||||
return {.success = false, .error = "last window has no monitor?"};
|
||||
|
||||
if (arg == 'l' || arg == 'r') {
|
||||
if (STICKS(PLASTWINDOW->m_vPosition.x, PMONITOR->vecPosition.x) && STICKS(PLASTWINDOW->m_vSize.x, PMONITOR->vecSize.x))
|
||||
if (STICKS(PLASTWINDOW->m_position.x, PMONITOR->vecPosition.x) && STICKS(PLASTWINDOW->m_size.x, PMONITOR->vecSize.x))
|
||||
return {.success = false, .error = "move does not make sense, would return back"};
|
||||
} else if (STICKS(PLASTWINDOW->m_vPosition.y, PMONITOR->vecPosition.y) && STICKS(PLASTWINDOW->m_vSize.y, PMONITOR->vecSize.y))
|
||||
} else if (STICKS(PLASTWINDOW->m_position.y, PMONITOR->vecPosition.y) && STICKS(PLASTWINDOW->m_size.y, PMONITOR->vecSize.y))
|
||||
return {.success = false, .error = "move does not make sense, would return back"};
|
||||
|
||||
CBox box = PMONITOR->logicalBox();
|
||||
|
|
@ -1583,7 +1583,7 @@ SDispatchResult CKeybindManager::moveFocusTo(std::string args) {
|
|||
}
|
||||
|
||||
const auto PWINDOWCANDIDATE = g_pCompositor->getWindowInDirection(box, PMONITOR->activeSpecialWorkspace ? PMONITOR->activeSpecialWorkspace : PMONITOR->activeWorkspace, arg,
|
||||
PLASTWINDOW, PLASTWINDOW->m_bIsFloating);
|
||||
PLASTWINDOW, PLASTWINDOW->m_isFloating);
|
||||
if (PWINDOWCANDIDATE)
|
||||
switchToWindow(PWINDOWCANDIDATE);
|
||||
|
||||
|
|
@ -1675,21 +1675,21 @@ SDispatchResult CKeybindManager::moveActiveTo(std::string args) {
|
|||
if (PLASTWINDOW->isFullscreen())
|
||||
return {.success = false, .error = "Can't move fullscreen window"};
|
||||
|
||||
if (PLASTWINDOW->m_bIsFloating) {
|
||||
if (PLASTWINDOW->m_isFloating) {
|
||||
std::optional<float> vPosx, vPosy;
|
||||
const auto PMONITOR = PLASTWINDOW->m_pMonitor.lock();
|
||||
const auto PMONITOR = PLASTWINDOW->m_monitor.lock();
|
||||
const auto BORDERSIZE = PLASTWINDOW->getRealBorderSize();
|
||||
|
||||
switch (arg) {
|
||||
case 'l': vPosx = PMONITOR->vecReservedTopLeft.x + BORDERSIZE + PMONITOR->vecPosition.x; break;
|
||||
case 'r': vPosx = PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x - PLASTWINDOW->m_vRealSize->goal().x - BORDERSIZE + PMONITOR->vecPosition.x; break;
|
||||
case 'r': vPosx = PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x - PLASTWINDOW->m_realSize->goal().x - BORDERSIZE + PMONITOR->vecPosition.x; break;
|
||||
case 't':
|
||||
case 'u': vPosy = PMONITOR->vecReservedTopLeft.y + BORDERSIZE + PMONITOR->vecPosition.y; break;
|
||||
case 'b':
|
||||
case 'd': vPosy = PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PLASTWINDOW->m_vRealSize->goal().y - BORDERSIZE + PMONITOR->vecPosition.y; break;
|
||||
case 'd': vPosy = PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PLASTWINDOW->m_realSize->goal().y - BORDERSIZE + PMONITOR->vecPosition.y; break;
|
||||
}
|
||||
|
||||
*PLASTWINDOW->m_vRealPosition = Vector2D(vPosx.value_or(PLASTWINDOW->m_vRealPosition->goal().x), vPosy.value_or(PLASTWINDOW->m_vRealPosition->goal().y));
|
||||
*PLASTWINDOW->m_realPosition = Vector2D(vPosx.value_or(PLASTWINDOW->m_realPosition->goal().x), vPosy.value_or(PLASTWINDOW->m_realPosition->goal().y));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
@ -1732,7 +1732,7 @@ SDispatchResult CKeybindManager::toggleGroup(std::string args) {
|
|||
if (PWINDOW->isFullscreen())
|
||||
g_pCompositor->setWindowFullscreenInternal(PWINDOW, FSMODE_NONE);
|
||||
|
||||
if (PWINDOW->m_sGroupData.pNextWindow.expired())
|
||||
if (PWINDOW->m_groupData.pNextWindow.expired())
|
||||
PWINDOW->createGroup();
|
||||
else
|
||||
PWINDOW->destroyGroup();
|
||||
|
|
@ -1746,10 +1746,10 @@ SDispatchResult CKeybindManager::changeGroupActive(std::string args) {
|
|||
if (!PWINDOW)
|
||||
return {.success = false, .error = "Window not found"};
|
||||
|
||||
if (PWINDOW->m_sGroupData.pNextWindow.expired())
|
||||
if (PWINDOW->m_groupData.pNextWindow.expired())
|
||||
return {.success = false, .error = "No next window in group"};
|
||||
|
||||
if (PWINDOW->m_sGroupData.pNextWindow.lock() == PWINDOW)
|
||||
if (PWINDOW->m_groupData.pNextWindow.lock() == PWINDOW)
|
||||
return {.success = false, .error = "Only one window in group"};
|
||||
|
||||
if (isNumber(args, false)) {
|
||||
|
|
@ -1765,7 +1765,7 @@ SDispatchResult CKeybindManager::changeGroupActive(std::string args) {
|
|||
}
|
||||
|
||||
if (args != "b" && args != "prev") {
|
||||
PWINDOW->setGroupCurrent(PWINDOW->m_sGroupData.pNextWindow.lock());
|
||||
PWINDOW->setGroupCurrent(PWINDOW->m_groupData.pNextWindow.lock());
|
||||
} else {
|
||||
PWINDOW->setGroupCurrent(PWINDOW->getGroupPrevious());
|
||||
}
|
||||
|
|
@ -1780,7 +1780,7 @@ SDispatchResult CKeybindManager::toggleSplit(std::string args) {
|
|||
if (!header.pWindow)
|
||||
return {.success = false, .error = "Window not found"};
|
||||
|
||||
const auto PWORKSPACE = header.pWindow->m_pWorkspace;
|
||||
const auto PWORKSPACE = header.pWindow->m_workspace;
|
||||
|
||||
if (PWORKSPACE->m_hasFullscreenWindow)
|
||||
return {.success = false, .error = "Can't split windows that already split"};
|
||||
|
|
@ -1797,7 +1797,7 @@ SDispatchResult CKeybindManager::swapSplit(std::string args) {
|
|||
if (!header.pWindow)
|
||||
return {.success = false, .error = "Window not found"};
|
||||
|
||||
const auto PWORKSPACE = header.pWindow->m_pWorkspace;
|
||||
const auto PWORKSPACE = header.pWindow->m_workspace;
|
||||
|
||||
if (PWORKSPACE->m_hasFullscreenWindow)
|
||||
return {.success = false, .error = "Can't split windows that already split"};
|
||||
|
|
@ -1860,20 +1860,20 @@ SDispatchResult CKeybindManager::moveCursorToCorner(std::string arg) {
|
|||
switch (CORNER) {
|
||||
case 0:
|
||||
// bottom left
|
||||
g_pCompositor->warpCursorTo({PWINDOW->m_vRealPosition->value().x, PWINDOW->m_vRealPosition->value().y + PWINDOW->m_vRealSize->value().y}, true);
|
||||
g_pCompositor->warpCursorTo({PWINDOW->m_realPosition->value().x, PWINDOW->m_realPosition->value().y + PWINDOW->m_realSize->value().y}, true);
|
||||
break;
|
||||
case 1:
|
||||
// bottom right
|
||||
g_pCompositor->warpCursorTo(
|
||||
{PWINDOW->m_vRealPosition->value().x + PWINDOW->m_vRealSize->value().x, PWINDOW->m_vRealPosition->value().y + PWINDOW->m_vRealSize->value().y}, true);
|
||||
g_pCompositor->warpCursorTo({PWINDOW->m_realPosition->value().x + PWINDOW->m_realSize->value().x, PWINDOW->m_realPosition->value().y + PWINDOW->m_realSize->value().y},
|
||||
true);
|
||||
break;
|
||||
case 2:
|
||||
// top right
|
||||
g_pCompositor->warpCursorTo({PWINDOW->m_vRealPosition->value().x + PWINDOW->m_vRealSize->value().x, PWINDOW->m_vRealPosition->value().y}, true);
|
||||
g_pCompositor->warpCursorTo({PWINDOW->m_realPosition->value().x + PWINDOW->m_realSize->value().x, PWINDOW->m_realPosition->value().y}, true);
|
||||
break;
|
||||
case 3:
|
||||
// top left
|
||||
g_pCompositor->warpCursorTo({PWINDOW->m_vRealPosition->value().x, PWINDOW->m_vRealPosition->value().y}, true);
|
||||
g_pCompositor->warpCursorTo({PWINDOW->m_realPosition->value().x, PWINDOW->m_realPosition->value().y}, true);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -1923,10 +1923,10 @@ SDispatchResult CKeybindManager::workspaceOpt(std::string args) {
|
|||
|
||||
// apply
|
||||
for (auto const& w : g_pCompositor->m_windows) {
|
||||
if (!w->m_bIsMapped || w->m_pWorkspace != PWORKSPACE)
|
||||
if (!w->m_isMapped || w->m_workspace != PWORKSPACE)
|
||||
continue;
|
||||
|
||||
w->m_bIsPseudotiled = PWORKSPACE->m_defaultPseudo;
|
||||
w->m_isPseudotiled = PWORKSPACE->m_defaultPseudo;
|
||||
}
|
||||
} else if (args == "allfloat") {
|
||||
PWORKSPACE->m_defaultFloating = !PWORKSPACE->m_defaultFloating;
|
||||
|
|
@ -1936,21 +1936,21 @@ SDispatchResult CKeybindManager::workspaceOpt(std::string args) {
|
|||
std::vector<PHLWINDOW> ptrs(g_pCompositor->m_windows.begin(), g_pCompositor->m_windows.end());
|
||||
|
||||
for (auto const& w : ptrs) {
|
||||
if (!w->m_bIsMapped || w->m_pWorkspace != PWORKSPACE || w->isHidden())
|
||||
if (!w->m_isMapped || w->m_workspace != PWORKSPACE || w->isHidden())
|
||||
continue;
|
||||
|
||||
if (!w->m_bRequestsFloat && w->m_bIsFloating != PWORKSPACE->m_defaultFloating) {
|
||||
const auto SAVEDPOS = w->m_vRealPosition->goal();
|
||||
const auto SAVEDSIZE = w->m_vRealSize->goal();
|
||||
if (!w->m_requestsFloat && w->m_isFloating != PWORKSPACE->m_defaultFloating) {
|
||||
const auto SAVEDPOS = w->m_realPosition->goal();
|
||||
const auto SAVEDSIZE = w->m_realSize->goal();
|
||||
|
||||
w->m_bIsFloating = PWORKSPACE->m_defaultFloating;
|
||||
w->m_isFloating = PWORKSPACE->m_defaultFloating;
|
||||
g_pLayoutManager->getCurrentLayout()->changeWindowFloatingMode(w);
|
||||
|
||||
if (PWORKSPACE->m_defaultFloating) {
|
||||
w->m_vRealPosition->setValueAndWarp(SAVEDPOS);
|
||||
w->m_vRealSize->setValueAndWarp(SAVEDSIZE);
|
||||
*w->m_vRealSize = w->m_vRealSize->value() + Vector2D(4, 4);
|
||||
*w->m_vRealPosition = w->m_vRealPosition->value() - Vector2D(2, 2);
|
||||
w->m_realPosition->setValueAndWarp(SAVEDPOS);
|
||||
w->m_realSize->setValueAndWarp(SAVEDSIZE);
|
||||
*w->m_realSize = w->m_realSize->value() + Vector2D(4, 4);
|
||||
*w->m_realPosition = w->m_realPosition->value() - Vector2D(2, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2186,14 +2186,14 @@ SDispatchResult CKeybindManager::resizeActive(std::string args) {
|
|||
if (PLASTWINDOW->isFullscreen())
|
||||
return {.success = false, .error = "Window is fullscreen"};
|
||||
|
||||
const auto SIZ = g_pCompositor->parseWindowVectorArgsRelative(args, PLASTWINDOW->m_vRealSize->goal());
|
||||
const auto SIZ = g_pCompositor->parseWindowVectorArgsRelative(args, PLASTWINDOW->m_realSize->goal());
|
||||
|
||||
if (SIZ.x < 1 || SIZ.y < 1)
|
||||
return {.success = false, .error = "Invalid size provided"};
|
||||
|
||||
g_pLayoutManager->getCurrentLayout()->resizeActiveWindow(SIZ - PLASTWINDOW->m_vRealSize->goal());
|
||||
g_pLayoutManager->getCurrentLayout()->resizeActiveWindow(SIZ - PLASTWINDOW->m_realSize->goal());
|
||||
|
||||
if (PLASTWINDOW->m_vRealSize->goal().x > 1 && PLASTWINDOW->m_vRealSize->goal().y > 1)
|
||||
if (PLASTWINDOW->m_realSize->goal().x > 1 && PLASTWINDOW->m_realSize->goal().y > 1)
|
||||
PLASTWINDOW->setHidden(false);
|
||||
|
||||
return {};
|
||||
|
|
@ -2208,9 +2208,9 @@ SDispatchResult CKeybindManager::moveActive(std::string args) {
|
|||
if (PLASTWINDOW->isFullscreen())
|
||||
return {.success = false, .error = "Window is fullscreen"};
|
||||
|
||||
const auto POS = g_pCompositor->parseWindowVectorArgsRelative(args, PLASTWINDOW->m_vRealPosition->goal());
|
||||
const auto POS = g_pCompositor->parseWindowVectorArgsRelative(args, PLASTWINDOW->m_realPosition->goal());
|
||||
|
||||
g_pLayoutManager->getCurrentLayout()->moveActiveWindow(POS - PLASTWINDOW->m_vRealPosition->goal());
|
||||
g_pLayoutManager->getCurrentLayout()->moveActiveWindow(POS - PLASTWINDOW->m_realPosition->goal());
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
@ -2230,9 +2230,9 @@ SDispatchResult CKeybindManager::moveWindow(std::string args) {
|
|||
if (PWINDOW->isFullscreen())
|
||||
return {.success = false, .error = "Window is fullscreen"};
|
||||
|
||||
const auto POS = g_pCompositor->parseWindowVectorArgsRelative(MOVECMD, PWINDOW->m_vRealPosition->goal());
|
||||
const auto POS = g_pCompositor->parseWindowVectorArgsRelative(MOVECMD, PWINDOW->m_realPosition->goal());
|
||||
|
||||
g_pLayoutManager->getCurrentLayout()->moveActiveWindow(POS - PWINDOW->m_vRealPosition->goal(), PWINDOW);
|
||||
g_pLayoutManager->getCurrentLayout()->moveActiveWindow(POS - PWINDOW->m_realPosition->goal(), PWINDOW);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
@ -2252,14 +2252,14 @@ SDispatchResult CKeybindManager::resizeWindow(std::string args) {
|
|||
if (PWINDOW->isFullscreen())
|
||||
return {.success = false, .error = "Window is fullscreen"};
|
||||
|
||||
const auto SIZ = g_pCompositor->parseWindowVectorArgsRelative(MOVECMD, PWINDOW->m_vRealSize->goal());
|
||||
const auto SIZ = g_pCompositor->parseWindowVectorArgsRelative(MOVECMD, PWINDOW->m_realSize->goal());
|
||||
|
||||
if (SIZ.x < 1 || SIZ.y < 1)
|
||||
return {.success = false, .error = "Invalid size provided"};
|
||||
|
||||
g_pLayoutManager->getCurrentLayout()->resizeActiveWindow(SIZ - PWINDOW->m_vRealSize->goal(), CORNER_NONE, PWINDOW);
|
||||
g_pLayoutManager->getCurrentLayout()->resizeActiveWindow(SIZ - PWINDOW->m_realSize->goal(), CORNER_NONE, PWINDOW);
|
||||
|
||||
if (PWINDOW->m_vRealSize->goal().x > 1 && PWINDOW->m_vRealSize->goal().y > 1)
|
||||
if (PWINDOW->m_realSize->goal().x > 1 && PWINDOW->m_realSize->goal().y > 1)
|
||||
PWINDOW->setHidden(false);
|
||||
|
||||
return {};
|
||||
|
|
@ -2303,9 +2303,9 @@ SDispatchResult CKeybindManager::focusWindow(std::string regexp) {
|
|||
if (!PWINDOW)
|
||||
return {.success = false, .error = "No such window found"};
|
||||
|
||||
Debug::log(LOG, "Focusing to window name: {}", PWINDOW->m_szTitle);
|
||||
Debug::log(LOG, "Focusing to window name: {}", PWINDOW->m_title);
|
||||
|
||||
const auto PWORKSPACE = PWINDOW->m_pWorkspace;
|
||||
const auto PWORKSPACE = PWINDOW->m_workspace;
|
||||
if (!PWORKSPACE) {
|
||||
Debug::log(ERR, "BUG THIS: null workspace in focusWindow");
|
||||
return {.success = false, .error = "BUG THIS: null workspace in focusWindow"};
|
||||
|
|
@ -2313,8 +2313,8 @@ SDispatchResult CKeybindManager::focusWindow(std::string regexp) {
|
|||
|
||||
updateRelativeCursorCoords();
|
||||
|
||||
if (g_pCompositor->m_lastMonitor && g_pCompositor->m_lastMonitor->activeWorkspace != PWINDOW->m_pWorkspace &&
|
||||
g_pCompositor->m_lastMonitor->activeSpecialWorkspace != PWINDOW->m_pWorkspace) {
|
||||
if (g_pCompositor->m_lastMonitor && g_pCompositor->m_lastMonitor->activeWorkspace != PWINDOW->m_workspace &&
|
||||
g_pCompositor->m_lastMonitor->activeSpecialWorkspace != PWINDOW->m_workspace) {
|
||||
Debug::log(LOG, "Fake executing workspace to move focus");
|
||||
changeworkspace(PWORKSPACE->getConfigName());
|
||||
}
|
||||
|
|
@ -2323,26 +2323,26 @@ SDispatchResult CKeybindManager::focusWindow(std::string regexp) {
|
|||
const auto FSWINDOW = PWORKSPACE->getFullscreenWindow();
|
||||
const auto FSMODE = PWORKSPACE->m_fullscreenMode;
|
||||
|
||||
if (PWINDOW->m_bIsFloating) {
|
||||
if (PWINDOW->m_isFloating) {
|
||||
// don't make floating implicitly fs
|
||||
if (!PWINDOW->m_bCreatedOverFullscreen) {
|
||||
if (!PWINDOW->m_createdOverFullscreen) {
|
||||
g_pCompositor->changeWindowZOrder(PWINDOW, true);
|
||||
g_pCompositor->updateFullscreenFadeOnWorkspace(PWORKSPACE);
|
||||
}
|
||||
|
||||
g_pCompositor->focusWindow(PWINDOW);
|
||||
} else {
|
||||
if (FSWINDOW != PWINDOW && !PWINDOW->m_bPinned)
|
||||
if (FSWINDOW != PWINDOW && !PWINDOW->m_pinned)
|
||||
g_pCompositor->setWindowFullscreenClient(FSWINDOW, FSMODE_NONE);
|
||||
|
||||
g_pCompositor->focusWindow(PWINDOW);
|
||||
|
||||
if (FSWINDOW != PWINDOW && !PWINDOW->m_bPinned)
|
||||
if (FSWINDOW != PWINDOW && !PWINDOW->m_pinned)
|
||||
g_pCompositor->setWindowFullscreenClient(PWINDOW, FSMODE);
|
||||
|
||||
// warp the position + size animation, otherwise it looks weird.
|
||||
PWINDOW->m_vRealPosition->warp();
|
||||
PWINDOW->m_vRealSize->warp();
|
||||
PWINDOW->m_realPosition->warp();
|
||||
PWINDOW->m_realSize->warp();
|
||||
}
|
||||
} else
|
||||
g_pCompositor->focusWindow(PWINDOW);
|
||||
|
|
@ -2365,7 +2365,7 @@ SDispatchResult CKeybindManager::tagWindow(std::string args) {
|
|||
|
||||
if (PWINDOW && PWINDOW->m_tags.applyTag(vars[0])) {
|
||||
PWINDOW->updateDynamicRules();
|
||||
g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW->m_pSelf.lock());
|
||||
g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW->m_self.lock());
|
||||
}
|
||||
|
||||
return {};
|
||||
|
|
@ -2374,19 +2374,19 @@ SDispatchResult CKeybindManager::tagWindow(std::string args) {
|
|||
SDispatchResult CKeybindManager::toggleSwallow(std::string args) {
|
||||
PHLWINDOWREF pWindow = g_pCompositor->m_lastWindow;
|
||||
|
||||
if (!valid(pWindow) || !valid(pWindow->m_pSwallowed))
|
||||
if (!valid(pWindow) || !valid(pWindow->m_swallowed))
|
||||
return {};
|
||||
|
||||
if (pWindow->m_pSwallowed->m_bCurrentlySwallowed) {
|
||||
if (pWindow->m_swallowed->m_currentlySwallowed) {
|
||||
// Unswallow
|
||||
pWindow->m_pSwallowed->m_bCurrentlySwallowed = false;
|
||||
pWindow->m_pSwallowed->setHidden(false);
|
||||
g_pLayoutManager->getCurrentLayout()->onWindowCreated(pWindow->m_pSwallowed.lock());
|
||||
pWindow->m_swallowed->m_currentlySwallowed = false;
|
||||
pWindow->m_swallowed->setHidden(false);
|
||||
g_pLayoutManager->getCurrentLayout()->onWindowCreated(pWindow->m_swallowed.lock());
|
||||
} else {
|
||||
// Reswallow
|
||||
pWindow->m_pSwallowed->m_bCurrentlySwallowed = true;
|
||||
pWindow->m_pSwallowed->setHidden(true);
|
||||
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow->m_pSwallowed.lock());
|
||||
pWindow->m_swallowed->m_currentlySwallowed = true;
|
||||
pWindow->m_swallowed->setHidden(true);
|
||||
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow->m_swallowed.lock());
|
||||
}
|
||||
|
||||
return {};
|
||||
|
|
@ -2430,16 +2430,16 @@ SDispatchResult CKeybindManager::pass(std::string regexp) {
|
|||
return {.success = false, .error = "No kb in pass?"};
|
||||
}
|
||||
|
||||
const auto XWTOXW = PWINDOW->m_bIsX11 && g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_bIsX11;
|
||||
const auto XWTOXW = PWINDOW->m_isX11 && g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_isX11;
|
||||
const auto LASTMOUSESURF = g_pSeatManager->state.pointerFocus.lock();
|
||||
const auto LASTKBSURF = g_pSeatManager->state.keyboardFocus.lock();
|
||||
|
||||
// pass all mf shit
|
||||
if (!XWTOXW) {
|
||||
if (g_pKeybindManager->m_uLastCode != 0)
|
||||
g_pSeatManager->setKeyboardFocus(PWINDOW->m_pWLSurface->resource());
|
||||
g_pSeatManager->setKeyboardFocus(PWINDOW->m_wlSurface->resource());
|
||||
else
|
||||
g_pSeatManager->setPointerFocus(PWINDOW->m_pWLSurface->resource(), {1, 1});
|
||||
g_pSeatManager->setPointerFocus(PWINDOW->m_wlSurface->resource(), {1, 1});
|
||||
}
|
||||
|
||||
g_pSeatManager->sendKeyboardMods(g_pInputManager->accumulateModsFromAllKBs(), 0, 0, 0);
|
||||
|
|
@ -2471,7 +2471,7 @@ SDispatchResult CKeybindManager::pass(std::string regexp) {
|
|||
// Massive hack:
|
||||
// this will make g_pSeatManager NOT send the leave event to XWayland apps, provided we are not on an XWayland window already.
|
||||
// please kill me
|
||||
if (PWINDOW->m_bIsX11) {
|
||||
if (PWINDOW->m_isX11) {
|
||||
if (g_pKeybindManager->m_uLastCode != 0) {
|
||||
g_pSeatManager->state.keyboardFocus.reset();
|
||||
g_pSeatManager->state.keyboardFocusResource.reset();
|
||||
|
|
@ -2481,7 +2481,7 @@ SDispatchResult CKeybindManager::pass(std::string regexp) {
|
|||
}
|
||||
}
|
||||
|
||||
const auto SL = PWINDOW->m_vRealPosition->goal() - g_pInputManager->getMouseCoordsInternal();
|
||||
const auto SL = PWINDOW->m_realPosition->goal() - g_pInputManager->getMouseCoordsInternal();
|
||||
|
||||
if (g_pKeybindManager->m_uLastCode != 0)
|
||||
g_pSeatManager->setKeyboardFocus(LASTKBSURF);
|
||||
|
|
@ -2585,17 +2585,17 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
|
|||
}
|
||||
|
||||
if (!isMouse)
|
||||
g_pSeatManager->setKeyboardFocus(PWINDOW->m_pWLSurface->resource());
|
||||
g_pSeatManager->setKeyboardFocus(PWINDOW->m_wlSurface->resource());
|
||||
else
|
||||
g_pSeatManager->setPointerFocus(PWINDOW->m_pWLSurface->resource(), {1, 1});
|
||||
g_pSeatManager->setPointerFocus(PWINDOW->m_wlSurface->resource(), {1, 1});
|
||||
}
|
||||
|
||||
//copied the rest from pass and modified it
|
||||
// if wl -> xwl, activate destination
|
||||
if (PWINDOW && PWINDOW->m_bIsX11 && g_pCompositor->m_lastWindow && !g_pCompositor->m_lastWindow->m_bIsX11)
|
||||
g_pXWaylandManager->activateSurface(PWINDOW->m_pWLSurface->resource(), true);
|
||||
if (PWINDOW && PWINDOW->m_isX11 && g_pCompositor->m_lastWindow && !g_pCompositor->m_lastWindow->m_isX11)
|
||||
g_pXWaylandManager->activateSurface(PWINDOW->m_wlSurface->resource(), true);
|
||||
// if xwl -> xwl, send to current. Timing issues make this not work.
|
||||
if (PWINDOW && PWINDOW->m_bIsX11 && g_pCompositor->m_lastWindow && g_pCompositor->m_lastWindow->m_bIsX11)
|
||||
if (PWINDOW && PWINDOW->m_isX11 && g_pCompositor->m_lastWindow && g_pCompositor->m_lastWindow->m_isX11)
|
||||
PWINDOW = nullptr;
|
||||
|
||||
g_pSeatManager->sendKeyboardMods(MOD, 0, 0, 0);
|
||||
|
|
@ -2626,7 +2626,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
|
|||
if (!PWINDOW)
|
||||
return {};
|
||||
|
||||
if (PWINDOW->m_bIsX11) { //xwayland hack, see pass
|
||||
if (PWINDOW->m_isX11) { //xwayland hack, see pass
|
||||
if (!isMouse) {
|
||||
g_pSeatManager->state.keyboardFocus.reset();
|
||||
g_pSeatManager->state.keyboardFocusResource.reset();
|
||||
|
|
@ -2636,7 +2636,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
|
|||
}
|
||||
}
|
||||
|
||||
const auto SL = PWINDOW->m_vRealPosition->goal() - g_pInputManager->getMouseCoordsInternal();
|
||||
const auto SL = PWINDOW->m_realPosition->goal() - g_pInputManager->getMouseCoordsInternal();
|
||||
|
||||
if (!isMouse)
|
||||
g_pSeatManager->setKeyboardFocus(LASTSURFACE);
|
||||
|
|
@ -2704,8 +2704,8 @@ SDispatchResult CKeybindManager::swapnext(std::string arg) {
|
|||
const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock();
|
||||
|
||||
const auto PLASTCYCLED =
|
||||
validMapped(g_pCompositor->m_lastWindow->m_pLastCycledWindow) && g_pCompositor->m_lastWindow->m_pLastCycledWindow->m_pWorkspace == PLASTWINDOW->m_pWorkspace ?
|
||||
g_pCompositor->m_lastWindow->m_pLastCycledWindow.lock() :
|
||||
validMapped(g_pCompositor->m_lastWindow->m_lastCycledWindow) && g_pCompositor->m_lastWindow->m_lastCycledWindow->m_workspace == PLASTWINDOW->m_workspace ?
|
||||
g_pCompositor->m_lastWindow->m_lastCycledWindow.lock() :
|
||||
nullptr;
|
||||
|
||||
const bool NEED_PREV = arg == "last" || arg == "l" || arg == "prev" || arg == "p";
|
||||
|
|
@ -2717,7 +2717,7 @@ SDispatchResult CKeybindManager::swapnext(std::string arg) {
|
|||
|
||||
g_pLayoutManager->getCurrentLayout()->switchWindows(PLASTWINDOW, toSwap);
|
||||
|
||||
PLASTWINDOW->m_pLastCycledWindow = toSwap;
|
||||
PLASTWINDOW->m_lastCycledWindow = toSwap;
|
||||
|
||||
g_pCompositor->focusWindow(PLASTWINDOW);
|
||||
|
||||
|
|
@ -2756,28 +2756,28 @@ SDispatchResult CKeybindManager::pinActive(std::string args) {
|
|||
return {.success = false, .error = "pin: window not found"};
|
||||
}
|
||||
|
||||
if (!PWINDOW->m_bIsFloating || PWINDOW->isFullscreen())
|
||||
if (!PWINDOW->m_isFloating || PWINDOW->isFullscreen())
|
||||
return {.success = false, .error = "Window does not qualify to be pinned"};
|
||||
|
||||
PWINDOW->m_bPinned = !PWINDOW->m_bPinned;
|
||||
PWINDOW->m_pinned = !PWINDOW->m_pinned;
|
||||
|
||||
const auto PMONITOR = PWINDOW->m_pMonitor.lock();
|
||||
const auto PMONITOR = PWINDOW->m_monitor.lock();
|
||||
|
||||
if (!PMONITOR) {
|
||||
Debug::log(ERR, "pin: monitor not found");
|
||||
return {.success = false, .error = "pin: window not found"};
|
||||
}
|
||||
|
||||
PWINDOW->m_pWorkspace = PMONITOR->activeWorkspace;
|
||||
PWINDOW->m_workspace = PMONITOR->activeWorkspace;
|
||||
|
||||
PWINDOW->updateDynamicRules();
|
||||
g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW);
|
||||
|
||||
const auto PWORKSPACE = PWINDOW->m_pWorkspace;
|
||||
const auto PWORKSPACE = PWINDOW->m_workspace;
|
||||
|
||||
PWORKSPACE->m_lastFocusedWindow = g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), RESERVED_EXTENTS | INPUT_EXTENTS);
|
||||
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"pin", std::format("{:x},{}", (uintptr_t)PWINDOW.get(), (int)PWINDOW->m_bPinned)});
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"pin", std::format("{:x},{}", (uintptr_t)PWINDOW.get(), (int)PWINDOW->m_pinned)});
|
||||
EMIT_HOOK_EVENT("pin", PWINDOW);
|
||||
|
||||
return {};
|
||||
|
|
@ -2836,7 +2836,7 @@ SDispatchResult CKeybindManager::changeMouseBindMode(const eMouseBindMode MODE)
|
|||
}
|
||||
|
||||
SDispatchResult CKeybindManager::bringActiveToTop(std::string args) {
|
||||
if (g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_bIsFloating)
|
||||
if (g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_isFloating)
|
||||
g_pCompositor->changeWindowZOrder(g_pCompositor->m_lastWindow.lock(), true);
|
||||
|
||||
return {};
|
||||
|
|
@ -2847,7 +2847,7 @@ SDispatchResult CKeybindManager::alterZOrder(std::string args) {
|
|||
const auto POSITION = args.substr(0, args.find_first_of(','));
|
||||
auto PWINDOW = g_pCompositor->getWindowByRegex(WINDOWREGEX);
|
||||
|
||||
if (!PWINDOW && g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_bIsFloating)
|
||||
if (!PWINDOW && g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_isFloating)
|
||||
PWINDOW = g_pCompositor->m_lastWindow.lock();
|
||||
|
||||
if (!PWINDOW) {
|
||||
|
|
@ -2889,17 +2889,17 @@ SDispatchResult CKeybindManager::lockActiveGroup(std::string args) {
|
|||
if (!PWINDOW)
|
||||
return {.success = false, .error = "No window found"};
|
||||
|
||||
if (!PWINDOW->m_sGroupData.pNextWindow.lock())
|
||||
if (!PWINDOW->m_groupData.pNextWindow.lock())
|
||||
return {.success = false, .error = "Not a group"};
|
||||
|
||||
const auto PHEAD = PWINDOW->getGroupHead();
|
||||
|
||||
if (args == "lock")
|
||||
PHEAD->m_sGroupData.locked = true;
|
||||
PHEAD->m_groupData.locked = true;
|
||||
else if (args == "toggle")
|
||||
PHEAD->m_sGroupData.locked = !PHEAD->m_sGroupData.locked;
|
||||
PHEAD->m_groupData.locked = !PHEAD->m_groupData.locked;
|
||||
else
|
||||
PHEAD->m_sGroupData.locked = false;
|
||||
PHEAD->m_groupData.locked = false;
|
||||
|
||||
g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW);
|
||||
|
||||
|
|
@ -2907,16 +2907,16 @@ SDispatchResult CKeybindManager::lockActiveGroup(std::string args) {
|
|||
}
|
||||
|
||||
void CKeybindManager::moveWindowIntoGroup(PHLWINDOW pWindow, PHLWINDOW pWindowInDirection) {
|
||||
if (pWindow->m_sGroupData.deny)
|
||||
if (pWindow->m_groupData.deny)
|
||||
return;
|
||||
|
||||
updateRelativeCursorCoords();
|
||||
|
||||
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow); // This removes groupped property!
|
||||
|
||||
if (pWindow->m_pMonitor != pWindowInDirection->m_pMonitor) {
|
||||
pWindow->moveToWorkspace(pWindowInDirection->m_pWorkspace);
|
||||
pWindow->m_pMonitor = pWindowInDirection->m_pMonitor;
|
||||
if (pWindow->m_monitor != pWindowInDirection->m_monitor) {
|
||||
pWindow->moveToWorkspace(pWindowInDirection->m_workspace);
|
||||
pWindow->m_monitor = pWindowInDirection->m_monitor;
|
||||
}
|
||||
|
||||
static auto USECURRPOS = CConfigValue<Hyprlang::INT>("group:insert_after_current");
|
||||
|
|
@ -2951,7 +2951,7 @@ void CKeybindManager::moveWindowOutOfGroup(PHLWINDOW pWindow, const std::string&
|
|||
|
||||
updateRelativeCursorCoords();
|
||||
|
||||
if (pWindow->m_sGroupData.pNextWindow.lock() == pWindow) {
|
||||
if (pWindow->m_groupData.pNextWindow.lock() == pWindow) {
|
||||
pWindow->destroyGroup();
|
||||
} else {
|
||||
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow);
|
||||
|
|
@ -2990,16 +2990,16 @@ SDispatchResult CKeybindManager::moveIntoGroup(std::string args) {
|
|||
|
||||
const auto PWINDOW = g_pCompositor->m_lastWindow.lock();
|
||||
|
||||
if (!PWINDOW || PWINDOW->m_sGroupData.deny)
|
||||
if (!PWINDOW || PWINDOW->m_groupData.deny)
|
||||
return {};
|
||||
|
||||
auto PWINDOWINDIR = g_pCompositor->getWindowInDirection(PWINDOW, arg);
|
||||
|
||||
if (!PWINDOWINDIR || !PWINDOWINDIR->m_sGroupData.pNextWindow.lock())
|
||||
if (!PWINDOWINDIR || !PWINDOWINDIR->m_groupData.pNextWindow.lock())
|
||||
return {};
|
||||
|
||||
// Do not move window into locked group if binds:ignore_group_lock is false
|
||||
if (!*PIGNOREGROUPLOCK && (PWINDOWINDIR->getGroupHead()->m_sGroupData.locked || (PWINDOW->m_sGroupData.pNextWindow.lock() && PWINDOW->getGroupHead()->m_sGroupData.locked)))
|
||||
if (!*PIGNOREGROUPLOCK && (PWINDOWINDIR->getGroupHead()->m_groupData.locked || (PWINDOW->m_groupData.pNextWindow.lock() && PWINDOW->getGroupHead()->m_groupData.locked)))
|
||||
return {};
|
||||
|
||||
moveWindowIntoGroup(PWINDOW, PWINDOWINDIR);
|
||||
|
|
@ -3023,7 +3023,7 @@ SDispatchResult CKeybindManager::moveOutOfGroup(std::string args) {
|
|||
if (!PWINDOW)
|
||||
return {.success = false, .error = "No window found"};
|
||||
|
||||
if (!PWINDOW->m_sGroupData.pNextWindow.lock())
|
||||
if (!PWINDOW->m_groupData.pNextWindow.lock())
|
||||
return {.success = false, .error = "Window not in a group"};
|
||||
|
||||
moveWindowOutOfGroup(PWINDOW);
|
||||
|
|
@ -3055,21 +3055,21 @@ SDispatchResult CKeybindManager::moveWindowOrGroup(std::string args) {
|
|||
|
||||
const auto PWINDOWINDIR = g_pCompositor->getWindowInDirection(PWINDOW, arg);
|
||||
|
||||
const bool ISWINDOWGROUP = PWINDOW->m_sGroupData.pNextWindow;
|
||||
const bool ISWINDOWGROUPLOCKED = ISWINDOWGROUP && PWINDOW->getGroupHead()->m_sGroupData.locked;
|
||||
const bool ISWINDOWGROUPSINGLE = ISWINDOWGROUP && PWINDOW->m_sGroupData.pNextWindow.lock() == PWINDOW;
|
||||
const bool ISWINDOWGROUP = PWINDOW->m_groupData.pNextWindow;
|
||||
const bool ISWINDOWGROUPLOCKED = ISWINDOWGROUP && PWINDOW->getGroupHead()->m_groupData.locked;
|
||||
const bool ISWINDOWGROUPSINGLE = ISWINDOWGROUP && PWINDOW->m_groupData.pNextWindow.lock() == PWINDOW;
|
||||
|
||||
updateRelativeCursorCoords();
|
||||
|
||||
// note: PWINDOWINDIR is not null implies !PWINDOW->m_bIsFloating
|
||||
if (PWINDOWINDIR && PWINDOWINDIR->m_sGroupData.pNextWindow) { // target is group
|
||||
if (!*PIGNOREGROUPLOCK && (PWINDOWINDIR->getGroupHead()->m_sGroupData.locked || ISWINDOWGROUPLOCKED || PWINDOW->m_sGroupData.deny)) {
|
||||
// note: PWINDOWINDIR is not null implies !PWINDOW->m_isFloating
|
||||
if (PWINDOWINDIR && PWINDOWINDIR->m_groupData.pNextWindow) { // target is group
|
||||
if (!*PIGNOREGROUPLOCK && (PWINDOWINDIR->getGroupHead()->m_groupData.locked || ISWINDOWGROUPLOCKED || PWINDOW->m_groupData.deny)) {
|
||||
g_pLayoutManager->getCurrentLayout()->moveWindowTo(PWINDOW, args);
|
||||
PWINDOW->warpCursor();
|
||||
} else
|
||||
moveWindowIntoGroup(PWINDOW, PWINDOWINDIR);
|
||||
} else if (PWINDOWINDIR) { // target is regular window
|
||||
if ((!*PIGNOREGROUPLOCK && ISWINDOWGROUPLOCKED) || !ISWINDOWGROUP || (ISWINDOWGROUPSINGLE && PWINDOW->m_eGroupRules & GROUP_SET_ALWAYS)) {
|
||||
if ((!*PIGNOREGROUPLOCK && ISWINDOWGROUPLOCKED) || !ISWINDOWGROUP || (ISWINDOWGROUPSINGLE && PWINDOW->m_groupRules & GROUP_SET_ALWAYS)) {
|
||||
g_pLayoutManager->getCurrentLayout()->moveWindowTo(PWINDOW, args);
|
||||
PWINDOW->warpCursor();
|
||||
} else
|
||||
|
|
@ -3101,13 +3101,13 @@ SDispatchResult CKeybindManager::setIgnoreGroupLock(std::string args) {
|
|||
|
||||
SDispatchResult CKeybindManager::denyWindowFromGroup(std::string args) {
|
||||
const auto PWINDOW = g_pCompositor->m_lastWindow.lock();
|
||||
if (!PWINDOW || (PWINDOW && PWINDOW->m_sGroupData.pNextWindow.lock()))
|
||||
if (!PWINDOW || (PWINDOW && PWINDOW->m_groupData.pNextWindow.lock()))
|
||||
return {};
|
||||
|
||||
if (args == "toggle")
|
||||
PWINDOW->m_sGroupData.deny = !PWINDOW->m_sGroupData.deny;
|
||||
PWINDOW->m_groupData.deny = !PWINDOW->m_groupData.deny;
|
||||
else
|
||||
PWINDOW->m_sGroupData.deny = args == "on";
|
||||
PWINDOW->m_groupData.deny = args == "on";
|
||||
|
||||
g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW);
|
||||
|
||||
|
|
@ -3137,14 +3137,14 @@ SDispatchResult CKeybindManager::moveGroupWindow(std::string args) {
|
|||
if (!PLASTWINDOW)
|
||||
return {.success = false, .error = "No window found"};
|
||||
|
||||
if (!PLASTWINDOW->m_sGroupData.pNextWindow.lock())
|
||||
if (!PLASTWINDOW->m_groupData.pNextWindow.lock())
|
||||
return {.success = false, .error = "Window not in a group"};
|
||||
|
||||
if ((!BACK && PLASTWINDOW->m_sGroupData.pNextWindow->m_sGroupData.head) || (BACK && PLASTWINDOW->m_sGroupData.head)) {
|
||||
std::swap(PLASTWINDOW->m_sGroupData.head, PLASTWINDOW->m_sGroupData.pNextWindow->m_sGroupData.head);
|
||||
std::swap(PLASTWINDOW->m_sGroupData.locked, PLASTWINDOW->m_sGroupData.pNextWindow->m_sGroupData.locked);
|
||||
if ((!BACK && PLASTWINDOW->m_groupData.pNextWindow->m_groupData.head) || (BACK && PLASTWINDOW->m_groupData.head)) {
|
||||
std::swap(PLASTWINDOW->m_groupData.head, PLASTWINDOW->m_groupData.pNextWindow->m_groupData.head);
|
||||
std::swap(PLASTWINDOW->m_groupData.locked, PLASTWINDOW->m_groupData.pNextWindow->m_groupData.locked);
|
||||
} else
|
||||
PLASTWINDOW->switchWithWindowInGroup(BACK ? PLASTWINDOW->getGroupPrevious() : PLASTWINDOW->m_sGroupData.pNextWindow.lock());
|
||||
PLASTWINDOW->switchWithWindowInGroup(BACK ? PLASTWINDOW->getGroupPrevious() : PLASTWINDOW->m_groupData.pNextWindow.lock());
|
||||
|
||||
PLASTWINDOW->updateWindowDecos();
|
||||
|
||||
|
|
@ -3174,36 +3174,36 @@ SDispatchResult CKeybindManager::setProp(std::string args) {
|
|||
const auto PROP = vars[1];
|
||||
const auto VAL = vars[2];
|
||||
|
||||
bool noFocus = PWINDOW->m_sWindowData.noFocus.valueOrDefault();
|
||||
bool noFocus = PWINDOW->m_windowData.noFocus.valueOrDefault();
|
||||
|
||||
try {
|
||||
if (PROP == "animationstyle") {
|
||||
PWINDOW->m_sWindowData.animationStyle = CWindowOverridableVar(VAL, PRIORITY_SET_PROP);
|
||||
PWINDOW->m_windowData.animationStyle = CWindowOverridableVar(VAL, PRIORITY_SET_PROP);
|
||||
} else if (PROP == "maxsize") {
|
||||
PWINDOW->m_sWindowData.maxSize = CWindowOverridableVar(configStringToVector2D(VAL), PRIORITY_SET_PROP);
|
||||
PWINDOW->clampWindowSize(std::nullopt, PWINDOW->m_sWindowData.maxSize.value());
|
||||
PWINDOW->m_windowData.maxSize = CWindowOverridableVar(configStringToVector2D(VAL), PRIORITY_SET_PROP);
|
||||
PWINDOW->clampWindowSize(std::nullopt, PWINDOW->m_windowData.maxSize.value());
|
||||
PWINDOW->setHidden(false);
|
||||
} else if (PROP == "minsize") {
|
||||
PWINDOW->m_sWindowData.minSize = CWindowOverridableVar(configStringToVector2D(VAL), PRIORITY_SET_PROP);
|
||||
PWINDOW->clampWindowSize(PWINDOW->m_sWindowData.minSize.value(), std::nullopt);
|
||||
PWINDOW->m_windowData.minSize = CWindowOverridableVar(configStringToVector2D(VAL), PRIORITY_SET_PROP);
|
||||
PWINDOW->clampWindowSize(PWINDOW->m_windowData.minSize.value(), std::nullopt);
|
||||
PWINDOW->setHidden(false);
|
||||
} else if (PROP == "alpha") {
|
||||
PWINDOW->m_sWindowData.alpha = CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alpha.valueOrDefault().m_bOverride}, PRIORITY_SET_PROP);
|
||||
PWINDOW->m_windowData.alpha = CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_windowData.alpha.valueOrDefault().override}, PRIORITY_SET_PROP);
|
||||
} else if (PROP == "alphainactive") {
|
||||
PWINDOW->m_sWindowData.alphaInactive =
|
||||
CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alphaInactive.valueOrDefault().m_bOverride}, PRIORITY_SET_PROP);
|
||||
PWINDOW->m_windowData.alphaInactive =
|
||||
CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_windowData.alphaInactive.valueOrDefault().override}, PRIORITY_SET_PROP);
|
||||
} else if (PROP == "alphafullscreen") {
|
||||
PWINDOW->m_sWindowData.alphaFullscreen =
|
||||
CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_sWindowData.alphaFullscreen.valueOrDefault().m_bOverride}, PRIORITY_SET_PROP);
|
||||
PWINDOW->m_windowData.alphaFullscreen =
|
||||
CWindowOverridableVar(SAlphaValue{std::stof(VAL), PWINDOW->m_windowData.alphaFullscreen.valueOrDefault().override}, PRIORITY_SET_PROP);
|
||||
} else if (PROP == "alphaoverride") {
|
||||
PWINDOW->m_sWindowData.alpha =
|
||||
CWindowOverridableVar(SAlphaValue{PWINDOW->m_sWindowData.alpha.valueOrDefault().m_fAlpha, (bool)configStringToInt(VAL).value_or(0)}, PRIORITY_SET_PROP);
|
||||
PWINDOW->m_windowData.alpha =
|
||||
CWindowOverridableVar(SAlphaValue{PWINDOW->m_windowData.alpha.valueOrDefault().alpha, (bool)configStringToInt(VAL).value_or(0)}, PRIORITY_SET_PROP);
|
||||
} else if (PROP == "alphainactiveoverride") {
|
||||
PWINDOW->m_sWindowData.alphaInactive =
|
||||
CWindowOverridableVar(SAlphaValue{PWINDOW->m_sWindowData.alphaInactive.valueOrDefault().m_fAlpha, (bool)configStringToInt(VAL).value_or(0)}, PRIORITY_SET_PROP);
|
||||
PWINDOW->m_windowData.alphaInactive =
|
||||
CWindowOverridableVar(SAlphaValue{PWINDOW->m_windowData.alphaInactive.valueOrDefault().alpha, (bool)configStringToInt(VAL).value_or(0)}, PRIORITY_SET_PROP);
|
||||
} else if (PROP == "alphafullscreenoverride") {
|
||||
PWINDOW->m_sWindowData.alphaFullscreen =
|
||||
CWindowOverridableVar(SAlphaValue{PWINDOW->m_sWindowData.alphaFullscreen.valueOrDefault().m_fAlpha, (bool)configStringToInt(VAL).value_or(0)}, PRIORITY_SET_PROP);
|
||||
PWINDOW->m_windowData.alphaFullscreen =
|
||||
CWindowOverridableVar(SAlphaValue{PWINDOW->m_windowData.alphaFullscreen.valueOrDefault().alpha, (bool)configStringToInt(VAL).value_or(0)}, PRIORITY_SET_PROP);
|
||||
} else if (PROP == "activebordercolor" || PROP == "inactivebordercolor") {
|
||||
CGradientValueData colorData = {};
|
||||
if (vars.size() > 4) {
|
||||
|
|
@ -3226,9 +3226,9 @@ SDispatchResult CKeybindManager::setProp(std::string args) {
|
|||
colorData.updateColorsOk();
|
||||
|
||||
if (PROP == "activebordercolor")
|
||||
PWINDOW->m_sWindowData.activeBorderColor = CWindowOverridableVar(colorData, PRIORITY_SET_PROP);
|
||||
PWINDOW->m_windowData.activeBorderColor = CWindowOverridableVar(colorData, PRIORITY_SET_PROP);
|
||||
else
|
||||
PWINDOW->m_sWindowData.inactiveBorderColor = CWindowOverridableVar(colorData, PRIORITY_SET_PROP);
|
||||
PWINDOW->m_windowData.inactiveBorderColor = CWindowOverridableVar(colorData, PRIORITY_SET_PROP);
|
||||
} else if (auto search = NWindowProperties::boolWindowProperties.find(PROP); search != NWindowProperties::boolWindowProperties.end()) {
|
||||
auto pWindowDataElement = search->second(PWINDOW);
|
||||
if (VAL == "toggle")
|
||||
|
|
@ -3261,7 +3261,7 @@ SDispatchResult CKeybindManager::setProp(std::string args) {
|
|||
|
||||
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
|
||||
|
||||
if (!(PWINDOW->m_sWindowData.noFocus.valueOrDefault() == noFocus)) {
|
||||
if (!(PWINDOW->m_windowData.noFocus.valueOrDefault() == noFocus)) {
|
||||
g_pCompositor->focusWindow(nullptr);
|
||||
g_pCompositor->focusWindow(PWINDOW);
|
||||
g_pCompositor->focusWindow(PLASTWINDOW);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ CHyprXWaylandManager::~CHyprXWaylandManager() {
|
|||
}
|
||||
|
||||
SP<CWLSurfaceResource> CHyprXWaylandManager::getWindowSurface(PHLWINDOW pWindow) {
|
||||
return pWindow ? pWindow->m_pWLSurface->resource() : nullptr;
|
||||
return pWindow ? pWindow->m_wlSurface->resource() : nullptr;
|
||||
}
|
||||
|
||||
void CHyprXWaylandManager::activateSurface(SP<CWLSurfaceResource> pSurface, bool activate) {
|
||||
|
|
@ -40,41 +40,41 @@ void CHyprXWaylandManager::activateSurface(SP<CWLSurfaceResource> pSurface, bool
|
|||
return;
|
||||
}
|
||||
|
||||
if (PWINDOW->m_bIsX11) {
|
||||
if (PWINDOW->m_pXWaylandSurface) {
|
||||
if (PWINDOW->m_isX11) {
|
||||
if (PWINDOW->m_xwaylandSurface) {
|
||||
if (activate) {
|
||||
PWINDOW->m_pXWaylandSurface->setMinimized(false);
|
||||
PWINDOW->m_pXWaylandSurface->restackToTop();
|
||||
PWINDOW->m_xwaylandSurface->setMinimized(false);
|
||||
PWINDOW->m_xwaylandSurface->restackToTop();
|
||||
}
|
||||
PWINDOW->m_pXWaylandSurface->activate(activate);
|
||||
PWINDOW->m_xwaylandSurface->activate(activate);
|
||||
}
|
||||
} else if (PWINDOW->m_pXDGSurface && PWINDOW->m_pXDGSurface->toplevel)
|
||||
PWINDOW->m_pXDGSurface->toplevel->setActive(activate);
|
||||
} else if (PWINDOW->m_xdgSurface && PWINDOW->m_xdgSurface->toplevel)
|
||||
PWINDOW->m_xdgSurface->toplevel->setActive(activate);
|
||||
}
|
||||
|
||||
void CHyprXWaylandManager::activateWindow(PHLWINDOW pWindow, bool activate) {
|
||||
if (pWindow->m_bIsX11) {
|
||||
if (pWindow->m_isX11) {
|
||||
|
||||
if (activate) {
|
||||
pWindow->sendWindowSize(true); // update xwayland output pos
|
||||
pWindow->m_pXWaylandSurface->setMinimized(false);
|
||||
pWindow->m_xwaylandSurface->setMinimized(false);
|
||||
|
||||
if (!pWindow->isX11OverrideRedirect())
|
||||
pWindow->m_pXWaylandSurface->restackToTop();
|
||||
pWindow->m_xwaylandSurface->restackToTop();
|
||||
}
|
||||
|
||||
pWindow->m_pXWaylandSurface->activate(activate);
|
||||
pWindow->m_xwaylandSurface->activate(activate);
|
||||
|
||||
} else if (pWindow->m_pXDGSurface && pWindow->m_pXDGSurface->toplevel)
|
||||
pWindow->m_pXDGSurface->toplevel->setActive(activate);
|
||||
} else if (pWindow->m_xdgSurface && pWindow->m_xdgSurface->toplevel)
|
||||
pWindow->m_xdgSurface->toplevel->setActive(activate);
|
||||
|
||||
if (activate) {
|
||||
g_pCompositor->m_lastFocus = getWindowSurface(pWindow);
|
||||
g_pCompositor->m_lastWindow = pWindow;
|
||||
}
|
||||
|
||||
if (!pWindow->m_bPinned)
|
||||
pWindow->m_pWorkspace->m_lastFocusedWindow = pWindow;
|
||||
if (!pWindow->m_pinned)
|
||||
pWindow->m_workspace->m_lastFocusedWindow = pWindow;
|
||||
}
|
||||
|
||||
CBox CHyprXWaylandManager::getGeometryForWindow(PHLWINDOW pWindow) {
|
||||
|
|
@ -83,52 +83,52 @@ CBox CHyprXWaylandManager::getGeometryForWindow(PHLWINDOW pWindow) {
|
|||
|
||||
CBox box;
|
||||
|
||||
if (pWindow->m_bIsX11)
|
||||
box = pWindow->m_pXWaylandSurface->geometry;
|
||||
else if (pWindow->m_pXDGSurface)
|
||||
box = pWindow->m_pXDGSurface->current.geometry;
|
||||
if (pWindow->m_isX11)
|
||||
box = pWindow->m_xwaylandSurface->geometry;
|
||||
else if (pWindow->m_xdgSurface)
|
||||
box = pWindow->m_xdgSurface->current.geometry;
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
void CHyprXWaylandManager::sendCloseWindow(PHLWINDOW pWindow) {
|
||||
if (pWindow->m_bIsX11)
|
||||
pWindow->m_pXWaylandSurface->close();
|
||||
else if (pWindow->m_pXDGSurface && pWindow->m_pXDGSurface->toplevel)
|
||||
pWindow->m_pXDGSurface->toplevel->close();
|
||||
if (pWindow->m_isX11)
|
||||
pWindow->m_xwaylandSurface->close();
|
||||
else if (pWindow->m_xdgSurface && pWindow->m_xdgSurface->toplevel)
|
||||
pWindow->m_xdgSurface->toplevel->close();
|
||||
}
|
||||
|
||||
bool CHyprXWaylandManager::shouldBeFloated(PHLWINDOW pWindow, bool pending) {
|
||||
if (pWindow->m_bIsX11) {
|
||||
for (const auto& a : pWindow->m_pXWaylandSurface->atoms)
|
||||
if (pWindow->m_isX11) {
|
||||
for (const auto& a : pWindow->m_xwaylandSurface->atoms)
|
||||
if (a == HYPRATOMS["_NET_WM_WINDOW_TYPE_DIALOG"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_SPLASH"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLBAR"] ||
|
||||
a == HYPRATOMS["_NET_WM_WINDOW_TYPE_UTILITY"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLTIP"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_POPUP_MENU"] ||
|
||||
a == HYPRATOMS["_NET_WM_WINDOW_TYPE_DOCK"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"] ||
|
||||
a == HYPRATOMS["_KDE_NET_WM_WINDOW_TYPE_OVERRIDE"]) {
|
||||
|
||||
if (a == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"])
|
||||
pWindow->m_bX11ShouldntFocus = true;
|
||||
pWindow->m_X11ShouldntFocus = true;
|
||||
|
||||
if (a != HYPRATOMS["_NET_WM_WINDOW_TYPE_DIALOG"])
|
||||
pWindow->m_bNoInitialFocus = true;
|
||||
pWindow->m_noInitialFocus = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (pWindow->isModal() || pWindow->m_pXWaylandSurface->transient ||
|
||||
(pWindow->m_pXWaylandSurface->role.contains("task_dialog") || pWindow->m_pXWaylandSurface->role.contains("pop-up")) || pWindow->m_pXWaylandSurface->overrideRedirect)
|
||||
if (pWindow->isModal() || pWindow->m_xwaylandSurface->transient ||
|
||||
(pWindow->m_xwaylandSurface->role.contains("task_dialog") || pWindow->m_xwaylandSurface->role.contains("pop-up")) || pWindow->m_xwaylandSurface->overrideRedirect)
|
||||
return true;
|
||||
|
||||
const auto SIZEHINTS = pWindow->m_pXWaylandSurface->sizeHints.get();
|
||||
if (pWindow->m_pXWaylandSurface->transient || pWindow->m_pXWaylandSurface->parent ||
|
||||
const auto SIZEHINTS = pWindow->m_xwaylandSurface->sizeHints.get();
|
||||
if (pWindow->m_xwaylandSurface->transient || pWindow->m_xwaylandSurface->parent ||
|
||||
(SIZEHINTS && (SIZEHINTS->min_width == SIZEHINTS->max_width) && (SIZEHINTS->min_height == SIZEHINTS->max_height)))
|
||||
return true;
|
||||
} else {
|
||||
if (!pWindow->m_pXDGSurface || !pWindow->m_pXDGSurface->toplevel)
|
||||
if (!pWindow->m_xdgSurface || !pWindow->m_xdgSurface->toplevel)
|
||||
return false;
|
||||
|
||||
const auto PSTATE = pending ? &pWindow->m_pXDGSurface->toplevel->pending : &pWindow->m_pXDGSurface->toplevel->current;
|
||||
if (pWindow->m_pXDGSurface->toplevel->parent ||
|
||||
const auto PSTATE = pending ? &pWindow->m_xdgSurface->toplevel->pending : &pWindow->m_xdgSurface->toplevel->current;
|
||||
if (pWindow->m_xdgSurface->toplevel->parent ||
|
||||
(PSTATE->minSize.x != 0 && PSTATE->minSize.y != 0 && (PSTATE->minSize.x == PSTATE->maxSize.x || PSTATE->minSize.y == PSTATE->maxSize.y)))
|
||||
return true;
|
||||
}
|
||||
|
|
@ -137,31 +137,31 @@ bool CHyprXWaylandManager::shouldBeFloated(PHLWINDOW pWindow, bool pending) {
|
|||
}
|
||||
|
||||
void CHyprXWaylandManager::checkBorders(PHLWINDOW pWindow) {
|
||||
if (!pWindow->m_bIsX11)
|
||||
if (!pWindow->m_isX11)
|
||||
return;
|
||||
|
||||
for (auto const& a : pWindow->m_pXWaylandSurface->atoms) {
|
||||
for (auto const& a : pWindow->m_xwaylandSurface->atoms) {
|
||||
if (a == HYPRATOMS["_NET_WM_WINDOW_TYPE_POPUP_MENU"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_NOTIFICATION"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] ||
|
||||
a == HYPRATOMS["_NET_WM_WINDOW_TYPE_COMBO"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_SPLASH"] ||
|
||||
a == HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLTIP"]) {
|
||||
|
||||
pWindow->m_bX11DoesntWantBorders = true;
|
||||
pWindow->m_X11DoesntWantBorders = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (pWindow->isX11OverrideRedirect())
|
||||
pWindow->m_bX11DoesntWantBorders = true;
|
||||
pWindow->m_X11DoesntWantBorders = true;
|
||||
}
|
||||
|
||||
void CHyprXWaylandManager::setWindowFullscreen(PHLWINDOW pWindow, bool fullscreen) {
|
||||
if (!pWindow)
|
||||
return;
|
||||
|
||||
if (pWindow->m_bIsX11)
|
||||
pWindow->m_pXWaylandSurface->setFullscreen(fullscreen);
|
||||
else if (pWindow->m_pXDGSurface && pWindow->m_pXDGSurface->toplevel)
|
||||
pWindow->m_pXDGSurface->toplevel->setFullscreen(fullscreen);
|
||||
if (pWindow->m_isX11)
|
||||
pWindow->m_xwaylandSurface->setFullscreen(fullscreen);
|
||||
else if (pWindow->m_xdgSurface && pWindow->m_xdgSurface->toplevel)
|
||||
pWindow->m_xdgSurface->toplevel->setFullscreen(fullscreen);
|
||||
}
|
||||
|
||||
Vector2D CHyprXWaylandManager::waylandToXWaylandCoords(const Vector2D& coord) {
|
||||
|
|
|
|||
|
|
@ -61,13 +61,13 @@ void CInputManager::recheckIdleInhibitorStatus() {
|
|||
}
|
||||
|
||||
bool CInputManager::isWindowInhibiting(const PHLWINDOW& w, bool onlyHl) {
|
||||
if (w->m_eIdleInhibitMode == IDLEINHIBIT_ALWAYS)
|
||||
if (w->m_idleInhibitMode == IDLEINHIBIT_ALWAYS)
|
||||
return true;
|
||||
|
||||
if (w->m_eIdleInhibitMode == IDLEINHIBIT_FOCUS && g_pCompositor->isWindowActive(w))
|
||||
if (w->m_idleInhibitMode == IDLEINHIBIT_FOCUS && g_pCompositor->isWindowActive(w))
|
||||
return true;
|
||||
|
||||
if (w->m_eIdleInhibitMode == IDLEINHIBIT_FULLSCREEN && w->isFullscreen() && w->m_pWorkspace && w->m_pWorkspace->isVisible())
|
||||
if (w->m_idleInhibitMode == IDLEINHIBIT_FULLSCREEN && w->isFullscreen() && w->m_workspace && w->m_workspace->isVisible())
|
||||
return true;
|
||||
|
||||
if (onlyHl)
|
||||
|
|
@ -78,7 +78,7 @@ bool CInputManager::isWindowInhibiting(const PHLWINDOW& w, bool onlyHl) {
|
|||
continue;
|
||||
|
||||
bool isInhibiting = false;
|
||||
w->m_pWLSurface->resource()->breadthfirst(
|
||||
w->m_wlSurface->resource()->breadthfirst(
|
||||
[&ii](SP<CWLSurfaceResource> surf, const Vector2D& pos, void* data) {
|
||||
if (ii->inhibitor->surface != surf)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ void CInputManager::sendMotionEventsToFocused() {
|
|||
const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_lastFocus.lock());
|
||||
const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_lastFocus.lock());
|
||||
|
||||
const auto LOCAL = getMouseCoordsInternal() - (PWINDOW ? PWINDOW->m_vRealPosition->goal() : (PLS ? Vector2D{PLS->m_geometry.x, PLS->m_geometry.y} : Vector2D{}));
|
||||
const auto LOCAL = getMouseCoordsInternal() - (PWINDOW ? PWINDOW->m_realPosition->goal() : (PLS ? Vector2D{PLS->m_geometry.x, PLS->m_geometry.y} : Vector2D{}));
|
||||
|
||||
m_bEmptyFocusCursorSet = false;
|
||||
|
||||
|
|
@ -233,7 +233,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
|
|||
const auto RG = CONSTRAINT->logicConstraintRegion();
|
||||
const auto CLOSEST = RG.closestPoint(mouseCoords);
|
||||
const auto BOX = SURF->getSurfaceBoxGlobal();
|
||||
const auto CLOSESTLOCAL = (CLOSEST - (BOX.has_value() ? BOX->pos() : Vector2D{})) * (SURF->getWindow() ? SURF->getWindow()->m_fX11SurfaceScaledBy : 1.0);
|
||||
const auto CLOSESTLOCAL = (CLOSEST - (BOX.has_value() ? BOX->pos() : Vector2D{})) * (SURF->getWindow() ? SURF->getWindow()->m_X11SurfaceScaledBy : 1.0);
|
||||
|
||||
g_pCompositor->warpCursorTo(CLOSEST, true);
|
||||
g_pSeatManager->sendPointerMotion(time, CLOSESTLOCAL);
|
||||
|
|
@ -283,8 +283,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
|
|||
|
||||
if (forcedFocus) {
|
||||
pFoundWindow = forcedFocus;
|
||||
surfacePos = pFoundWindow->m_vRealPosition->value();
|
||||
foundSurface = pFoundWindow->m_pWLSurface->resource();
|
||||
surfacePos = pFoundWindow->m_realPosition->value();
|
||||
foundSurface = pFoundWindow->m_wlSurface->resource();
|
||||
}
|
||||
|
||||
// if we are holding a pointer button,
|
||||
|
|
@ -363,16 +363,16 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
|
|||
}
|
||||
|
||||
if (PWINDOWIDEAL &&
|
||||
((PWINDOWIDEAL->m_bIsFloating && PWINDOWIDEAL->m_bCreatedOverFullscreen) /* floating over fullscreen */
|
||||
|| (PMONITOR->activeSpecialWorkspace == PWINDOWIDEAL->m_pWorkspace) /* on an open special workspace */))
|
||||
((PWINDOWIDEAL->m_isFloating && PWINDOWIDEAL->m_createdOverFullscreen) /* floating over fullscreen */
|
||||
|| (PMONITOR->activeSpecialWorkspace == PWINDOWIDEAL->m_workspace) /* on an open special workspace */))
|
||||
pFoundWindow = PWINDOWIDEAL;
|
||||
|
||||
if (!pFoundWindow->m_bIsX11) {
|
||||
if (!pFoundWindow->m_isX11) {
|
||||
foundSurface = g_pCompositor->vectorWindowToSurface(mouseCoords, pFoundWindow, surfaceCoords);
|
||||
surfacePos = Vector2D(-1337, -1337);
|
||||
} else {
|
||||
foundSurface = pFoundWindow->m_pWLSurface->resource();
|
||||
surfacePos = pFoundWindow->m_vRealPosition->value();
|
||||
foundSurface = pFoundWindow->m_wlSurface->resource();
|
||||
surfacePos = pFoundWindow->m_realPosition->value();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -398,7 +398,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
|
|||
if (pFoundWindow != PWINDOWIDEAL)
|
||||
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
||||
|
||||
if (!(pFoundWindow && pFoundWindow->m_bIsFloating && pFoundWindow->m_bCreatedOverFullscreen))
|
||||
if (!(pFoundWindow && pFoundWindow->m_isFloating && pFoundWindow->m_createdOverFullscreen))
|
||||
pFoundWindow = PWORKSPACE->getFullscreenWindow();
|
||||
}
|
||||
}
|
||||
|
|
@ -410,15 +410,15 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
|
|||
}
|
||||
|
||||
if (pFoundWindow) {
|
||||
if (!pFoundWindow->m_bIsX11) {
|
||||
if (!pFoundWindow->m_isX11) {
|
||||
foundSurface = g_pCompositor->vectorWindowToSurface(mouseCoords, pFoundWindow, surfaceCoords);
|
||||
if (!foundSurface) {
|
||||
foundSurface = pFoundWindow->m_pWLSurface->resource();
|
||||
surfacePos = pFoundWindow->m_vRealPosition->value();
|
||||
foundSurface = pFoundWindow->m_wlSurface->resource();
|
||||
surfacePos = pFoundWindow->m_realPosition->value();
|
||||
}
|
||||
} else {
|
||||
foundSurface = pFoundWindow->m_pWLSurface->resource();
|
||||
surfacePos = pFoundWindow->m_vRealPosition->value();
|
||||
foundSurface = pFoundWindow->m_wlSurface->resource();
|
||||
surfacePos = pFoundWindow->m_realPosition->value();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -483,15 +483,15 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
|
|||
|
||||
Vector2D surfaceLocal = surfacePos == Vector2D(-1337, -1337) ? surfaceCoords : mouseCoords - surfacePos;
|
||||
|
||||
if (pFoundWindow && !pFoundWindow->m_bIsX11 && surfacePos != Vector2D(-1337, -1337)) {
|
||||
if (pFoundWindow && !pFoundWindow->m_isX11 && surfacePos != Vector2D(-1337, -1337)) {
|
||||
// calc for oversized windows... fucking bullshit.
|
||||
CBox geom = pFoundWindow->m_pXDGSurface->current.geometry;
|
||||
CBox geom = pFoundWindow->m_xdgSurface->current.geometry;
|
||||
|
||||
surfaceLocal = mouseCoords - surfacePos + geom.pos();
|
||||
}
|
||||
|
||||
if (pFoundWindow && pFoundWindow->m_bIsX11) // for x11 force scale zero
|
||||
surfaceLocal = surfaceLocal * pFoundWindow->m_fX11SurfaceScaledBy;
|
||||
if (pFoundWindow && pFoundWindow->m_isX11) // for x11 force scale zero
|
||||
surfaceLocal = surfaceLocal * pFoundWindow->m_X11SurfaceScaledBy;
|
||||
|
||||
bool allowKeyboardRefocus = true;
|
||||
|
||||
|
|
@ -514,7 +514,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (pFoundWindow && foundSurface == pFoundWindow->m_pWLSurface->resource() && !m_bCursorImageOverridden) {
|
||||
if (pFoundWindow && foundSurface == pFoundWindow->m_wlSurface->resource() && !m_bCursorImageOverridden) {
|
||||
const auto BOX = pFoundWindow->getWindowMainSurfaceBox();
|
||||
if (!VECINRECT(mouseCoords, BOX.x, BOX.y, BOX.x + BOX.width, BOX.y + BOX.height))
|
||||
setCursorImageOverride("left_ptr");
|
||||
|
|
@ -534,7 +534,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
|
|||
|
||||
if (FOLLOWMOUSE != 1 && !refocus) {
|
||||
if (pFoundWindow != g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow.lock() &&
|
||||
((pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR == 2) || (g_pCompositor->m_lastWindow->m_bIsFloating != pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR != 0))) {
|
||||
((pFoundWindow->m_isFloating && *PFLOATBEHAVIOR == 2) || (g_pCompositor->m_lastWindow->m_isFloating != pFoundWindow->m_isFloating && *PFLOATBEHAVIOR != 0))) {
|
||||
// enter if change floating style
|
||||
if (FOLLOWMOUSE != 3 && allowKeyboardRefocus)
|
||||
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
||||
|
|
@ -562,7 +562,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
|
|||
// Temp fix until that's figured out. Otherwise spams windowrule lookups and other shit.
|
||||
if (m_pLastMouseFocus.lock() != pFoundWindow || g_pCompositor->m_lastWindow.lock() != pFoundWindow) {
|
||||
if (m_fMousePosDelta > *PFOLLOWMOUSETHRESHOLD || refocus) {
|
||||
const bool hasNoFollowMouse = pFoundWindow && pFoundWindow->m_sWindowData.noFollowMouse.valueOrDefault();
|
||||
const bool hasNoFollowMouse = pFoundWindow && pFoundWindow->m_windowData.noFollowMouse.valueOrDefault();
|
||||
|
||||
if (refocus || !hasNoFollowMouse)
|
||||
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
||||
|
|
@ -746,7 +746,7 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) {
|
|||
// TODO detect click on LS properly
|
||||
if (*PRESIZEONBORDER && !m_bLastFocusOnLS && e.state == WL_POINTER_BUTTON_STATE_PRESSED && (!w || !w->isX11OverrideRedirect())) {
|
||||
if (w && !w->isFullscreen()) {
|
||||
const CBox real = {w->m_vRealPosition->value().x, w->m_vRealPosition->value().y, w->m_vRealSize->value().x, w->m_vRealSize->value().y};
|
||||
const CBox real = {w->m_realPosition->value().x, w->m_realPosition->value().y, w->m_realSize->value().x, w->m_realSize->value().y};
|
||||
const CBox grab = {real.x - BORDER_GRAB_AREA, real.y - BORDER_GRAB_AREA, real.width + 2 * BORDER_GRAB_AREA, real.height + 2 * BORDER_GRAB_AREA};
|
||||
|
||||
if ((grab.containsPoint(mouseCoords) && (!real.containsPoint(mouseCoords) || w->isInCurvedCorner(mouseCoords.x, mouseCoords.y))) && !w->hasPopupAt(mouseCoords)) {
|
||||
|
|
@ -1482,7 +1482,7 @@ bool CInputManager::refocusLastWindow(PHLMONITOR pMonitor) {
|
|||
foundSurface = nullptr;
|
||||
}
|
||||
|
||||
if (!foundSurface && g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_pWorkspace && g_pCompositor->m_lastWindow->m_pWorkspace->isVisibleNotCovered()) {
|
||||
if (!foundSurface && g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_workspace && g_pCompositor->m_lastWindow->m_workspace->isVisibleNotCovered()) {
|
||||
// then the last focused window if we're on the same workspace as it
|
||||
const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock();
|
||||
g_pCompositor->focusWindow(PLASTWINDOW);
|
||||
|
|
@ -1779,7 +1779,7 @@ void CInputManager::setCursorIconOnBorder(PHLWINDOW w) {
|
|||
}
|
||||
|
||||
// ignore X11 OR windows, they shouldn't be touched
|
||||
if (w->m_bIsX11 && w->isX11OverrideRedirect())
|
||||
if (w->m_isX11 && w->isX11OverrideRedirect())
|
||||
return;
|
||||
|
||||
static auto PEXTENDBORDERGRAB = CConfigValue<Hyprlang::INT>("general:extend_border_grab_area");
|
||||
|
|
@ -1802,7 +1802,7 @@ void CInputManager::setCursorIconOnBorder(PHLWINDOW w) {
|
|||
|
||||
bool onDeco = false;
|
||||
|
||||
for (auto const& wd : w->m_dWindowDecorations) {
|
||||
for (auto const& wd : w->m_windowDecorations) {
|
||||
if (!(wd->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT))
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -69,12 +69,12 @@ static void refocusTablet(SP<CTablet> tab, SP<CTabletTool> tool, bool motion = f
|
|||
|
||||
// yes, this technically ignores any regions set by the app. Too bad!
|
||||
if (LASTHLSURFACE->getWindow())
|
||||
local = tool->absolutePos * LASTHLSURFACE->getWindow()->m_vRealSize->goal();
|
||||
local = tool->absolutePos * LASTHLSURFACE->getWindow()->m_realSize->goal();
|
||||
else
|
||||
local = tool->absolutePos * BOX->size();
|
||||
|
||||
if (LASTHLSURFACE->getWindow() && LASTHLSURFACE->getWindow()->m_bIsX11)
|
||||
local = local * LASTHLSURFACE->getWindow()->m_fX11SurfaceScaledBy;
|
||||
if (LASTHLSURFACE->getWindow() && LASTHLSURFACE->getWindow()->m_isX11)
|
||||
local = local * LASTHLSURFACE->getWindow()->m_X11SurfaceScaledBy;
|
||||
|
||||
PROTO::tablet->motion(tool, local);
|
||||
return;
|
||||
|
|
@ -82,8 +82,8 @@ static void refocusTablet(SP<CTablet> tab, SP<CTabletTool> tool, bool motion = f
|
|||
|
||||
auto local = CURSORPOS - BOX->pos();
|
||||
|
||||
if (LASTHLSURFACE->getWindow() && LASTHLSURFACE->getWindow()->m_bIsX11)
|
||||
local = local * LASTHLSURFACE->getWindow()->m_fX11SurfaceScaledBy;
|
||||
if (LASTHLSURFACE->getWindow() && LASTHLSURFACE->getWindow()->m_isX11)
|
||||
local = local * LASTHLSURFACE->getWindow()->m_X11SurfaceScaledBy;
|
||||
|
||||
PROTO::tablet->motion(tool, local);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,9 +80,9 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) {
|
|||
local = g_pInputManager->getMouseCoordsInternal() - PMONITOR->vecPosition;
|
||||
m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local;
|
||||
} else if (!m_sTouchData.touchFocusWindow.expired()) {
|
||||
if (m_sTouchData.touchFocusWindow->m_bIsX11) {
|
||||
local = (g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusWindow->m_vRealPosition->goal()) * m_sTouchData.touchFocusWindow->m_fX11SurfaceScaledBy;
|
||||
m_sTouchData.touchSurfaceOrigin = m_sTouchData.touchFocusWindow->m_vRealPosition->goal();
|
||||
if (m_sTouchData.touchFocusWindow->m_isX11) {
|
||||
local = (g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusWindow->m_realPosition->goal()) * m_sTouchData.touchFocusWindow->m_X11SurfaceScaledBy;
|
||||
m_sTouchData.touchSurfaceOrigin = m_sTouchData.touchFocusWindow->m_realPosition->goal();
|
||||
} else {
|
||||
g_pCompositor->vectorWindowToSurface(g_pInputManager->getMouseCoordsInternal(), m_sTouchData.touchFocusWindow.lock(), local);
|
||||
m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local;
|
||||
|
|
@ -148,13 +148,13 @@ void CInputManager::onTouchMove(ITouch::SMotionEvent e) {
|
|||
auto local = g_pInputManager->getMouseCoordsInternal() - PMONITOR->vecPosition;
|
||||
g_pSeatManager->sendTouchMotion(e.timeMs, e.touchID, local);
|
||||
} else if (validMapped(m_sTouchData.touchFocusWindow)) {
|
||||
const auto PMONITOR = m_sTouchData.touchFocusWindow->m_pMonitor.lock();
|
||||
const auto PMONITOR = m_sTouchData.touchFocusWindow->m_monitor.lock();
|
||||
|
||||
g_pCompositor->warpCursorTo({PMONITOR->vecPosition.x + e.pos.x * PMONITOR->vecSize.x, PMONITOR->vecPosition.y + e.pos.y * PMONITOR->vecSize.y}, true);
|
||||
|
||||
auto local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchSurfaceOrigin;
|
||||
if (m_sTouchData.touchFocusWindow->m_bIsX11)
|
||||
local = local * m_sTouchData.touchFocusWindow->m_fX11SurfaceScaledBy;
|
||||
if (m_sTouchData.touchFocusWindow->m_isX11)
|
||||
local = local * m_sTouchData.touchFocusWindow->m_X11SurfaceScaledBy;
|
||||
|
||||
g_pSeatManager->sendTouchMotion(e.timeMs, e.touchID, local);
|
||||
} else if (!m_sTouchData.touchFocusLS.expired()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue