mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 12:46:00 +01:00
internal: Window storage rework - part 1 (#5762)
* Window storage rework - part 1 * format * remove useless include * fix pch * format * fix crash in dwindle * fix vram leak * prefer .expired() for bool checks
This commit is contained in:
parent
25aec3ac8c
commit
bca7804bb6
72 changed files with 1416 additions and 1346 deletions
|
@ -362,8 +362,8 @@ void CCompositor::cleanup() {
|
||||||
// still in a normal working state.
|
// still in a normal working state.
|
||||||
g_pPluginSystem->unloadAllPlugins();
|
g_pPluginSystem->unloadAllPlugins();
|
||||||
|
|
||||||
m_pLastFocus = nullptr;
|
m_pLastFocus = nullptr;
|
||||||
m_pLastWindow = nullptr;
|
m_pLastWindow.reset();
|
||||||
|
|
||||||
// end threads
|
// end threads
|
||||||
g_pEventManager->m_tThread = std::thread();
|
g_pEventManager->m_tThread = std::thread();
|
||||||
|
@ -662,29 +662,15 @@ CMonitor* CCompositor::getMonitorFromVector(const Vector2D& point) {
|
||||||
return getMonitorFromOutput(OUTPUT);
|
return getMonitorFromOutput(OUTPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::removeWindowFromVectorSafe(CWindow* pWindow) {
|
void CCompositor::removeWindowFromVectorSafe(PHLWINDOW pWindow) {
|
||||||
if (windowExists(pWindow) && !pWindow->m_bFadingOut) {
|
if (!pWindow->m_bFadingOut) {
|
||||||
EMIT_HOOK_EVENT("destroyWindow", pWindow);
|
EMIT_HOOK_EVENT("destroyWindow", pWindow);
|
||||||
|
|
||||||
std::erase_if(m_vWindows, [&](std::unique_ptr<CWindow>& el) { return el.get() == pWindow; });
|
std::erase_if(m_vWindows, [&](SP<CWindow>& el) { return el == pWindow; });
|
||||||
std::erase_if(m_vWindowsFadingOut, [&](CWindow* el) { return el == pWindow; });
|
std::erase_if(m_vWindowsFadingOut, [&](PHLWINDOWREF el) { return el.lock() == pWindow; });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCompositor::windowExists(CWindow* pWindow) {
|
|
||||||
for (auto& w : m_vWindows) {
|
|
||||||
if (w.get() == pWindow)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: this is here only temporarily,
|
|
||||||
// remove this func altogether if no reports
|
|
||||||
// of this being hit.
|
|
||||||
RASSERT(!pWindow, "windowExists: attempted UAF");
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CCompositor::monitorExists(CMonitor* pMonitor) {
|
bool CCompositor::monitorExists(CMonitor* pMonitor) {
|
||||||
for (auto& m : m_vRealMonitors) {
|
for (auto& m : m_vRealMonitors) {
|
||||||
if (m.get() == pMonitor)
|
if (m.get() == pMonitor)
|
||||||
|
@ -694,7 +680,7 @@ bool CCompositor::monitorExists(CMonitor* pMonitor) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t properties, CWindow* pIgnoreWindow) {
|
PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t properties, PHLWINDOW pIgnoreWindow) {
|
||||||
const auto PMONITOR = getMonitorFromVector(pos);
|
const auto PMONITOR = getMonitorFromVector(pos);
|
||||||
static auto PRESIZEONBORDER = CConfigValue<Hyprlang::INT>("general:resize_on_border");
|
static auto PRESIZEONBORDER = CConfigValue<Hyprlang::INT>("general:resize_on_border");
|
||||||
static auto PBORDERSIZE = CConfigValue<Hyprlang::INT>("general:border_size");
|
static auto PBORDERSIZE = CConfigValue<Hyprlang::INT>("general:border_size");
|
||||||
|
@ -707,21 +693,20 @@ CWindow* CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t propert
|
||||||
for (auto& w : m_vWindows | std::views::reverse) {
|
for (auto& w : m_vWindows | std::views::reverse) {
|
||||||
const auto BB = w->getWindowBoxUnified(properties);
|
const auto BB = w->getWindowBoxUnified(properties);
|
||||||
CBox box = {BB.x - BORDER_GRAB_AREA, BB.y - BORDER_GRAB_AREA, BB.width + 2 * BORDER_GRAB_AREA, BB.height + 2 * BORDER_GRAB_AREA};
|
CBox box = {BB.x - BORDER_GRAB_AREA, BB.y - BORDER_GRAB_AREA, BB.width + 2 * BORDER_GRAB_AREA, BB.height + 2 * BORDER_GRAB_AREA};
|
||||||
if (w->m_bIsFloating && w->m_bIsMapped && !w->isHidden() && !w->m_bX11ShouldntFocus && w->m_bPinned && !w->m_sAdditionalConfigData.noFocus &&
|
if (w->m_bIsFloating && w->m_bIsMapped && !w->isHidden() && !w->m_bX11ShouldntFocus && w->m_bPinned && !w->m_sAdditionalConfigData.noFocus && w != pIgnoreWindow) {
|
||||||
w.get() != pIgnoreWindow) {
|
|
||||||
if (box.containsPoint({m_sWLRCursor->x, m_sWLRCursor->y}))
|
if (box.containsPoint({m_sWLRCursor->x, m_sWLRCursor->y}))
|
||||||
return w.get();
|
return w;
|
||||||
|
|
||||||
if (!w->m_bIsX11) {
|
if (!w->m_bIsX11) {
|
||||||
if (w->hasPopupAt(pos))
|
if (w->hasPopupAt(pos))
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto windowForWorkspace = [&](bool special) -> CWindow* {
|
auto windowForWorkspace = [&](bool special) -> PHLWINDOW {
|
||||||
auto floating = [&](bool aboveFullscreen) -> CWindow* {
|
auto floating = [&](bool aboveFullscreen) -> PHLWINDOW {
|
||||||
for (auto& w : m_vWindows | std::views::reverse) {
|
for (auto& w : m_vWindows | std::views::reverse) {
|
||||||
|
|
||||||
if (special && !w->onSpecialWorkspace()) // because special floating may creep up into regular
|
if (special && !w->onSpecialWorkspace()) // because special floating may creep up into regular
|
||||||
|
@ -738,7 +723,7 @@ CWindow* CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t propert
|
||||||
|
|
||||||
CBox box = {BB.x - BORDER_GRAB_AREA, BB.y - BORDER_GRAB_AREA, BB.width + 2 * BORDER_GRAB_AREA, BB.height + 2 * BORDER_GRAB_AREA};
|
CBox box = {BB.x - BORDER_GRAB_AREA, BB.y - BORDER_GRAB_AREA, BB.width + 2 * BORDER_GRAB_AREA, BB.height + 2 * BORDER_GRAB_AREA};
|
||||||
if (w->m_bIsFloating && w->m_bIsMapped && isWorkspaceVisible(w->m_pWorkspace) && !w->isHidden() && !w->m_bPinned && !w->m_sAdditionalConfigData.noFocus &&
|
if (w->m_bIsFloating && w->m_bIsMapped && isWorkspaceVisible(w->m_pWorkspace) && !w->isHidden() && !w->m_bPinned && !w->m_sAdditionalConfigData.noFocus &&
|
||||||
w.get() != pIgnoreWindow && (!aboveFullscreen || w->m_bCreatedOverFullscreen)) {
|
w != pIgnoreWindow && (!aboveFullscreen || w->m_bCreatedOverFullscreen)) {
|
||||||
// OR windows should add focus to parent
|
// OR windows should add focus to parent
|
||||||
if (w->m_bX11ShouldntFocus && w->m_iX11Type != 2)
|
if (w->m_bX11ShouldntFocus && w->m_iX11Type != 2)
|
||||||
continue;
|
continue;
|
||||||
|
@ -747,16 +732,16 @@ CWindow* CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t propert
|
||||||
|
|
||||||
if (w->m_bIsX11 && w->m_iX11Type == 2 && !wlr_xwayland_or_surface_wants_focus(w->m_uSurface.xwayland)) {
|
if (w->m_bIsX11 && w->m_iX11Type == 2 && !wlr_xwayland_or_surface_wants_focus(w->m_uSurface.xwayland)) {
|
||||||
// Override Redirect
|
// Override Redirect
|
||||||
return g_pCompositor->m_pLastWindow; // we kinda trick everything here.
|
return g_pCompositor->m_pLastWindow.lock(); // we kinda trick everything here.
|
||||||
// TODO: this is wrong, we should focus the parent, but idk how to get it considering it's nullptr in most cases.
|
// TODO: this is wrong, we should focus the parent, but idk how to get it considering it's nullptr in most cases.
|
||||||
}
|
}
|
||||||
|
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!w->m_bIsX11) {
|
if (!w->m_bIsX11) {
|
||||||
if (w->hasPopupAt(pos))
|
if (w->hasPopupAt(pos))
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -790,9 +775,9 @@ CWindow* CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t propert
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!w->m_bIsX11 && !w->m_bIsFloating && w->m_bIsMapped && w->workspaceID() == WORKSPACEID && !w->isHidden() && !w->m_bX11ShouldntFocus &&
|
if (!w->m_bIsX11 && !w->m_bIsFloating && w->m_bIsMapped && w->workspaceID() == WORKSPACEID && !w->isHidden() && !w->m_bX11ShouldntFocus &&
|
||||||
!w->m_sAdditionalConfigData.noFocus && w.get() != pIgnoreWindow) {
|
!w->m_sAdditionalConfigData.noFocus && w != pIgnoreWindow) {
|
||||||
if (w->hasPopupAt(pos))
|
if (w->hasPopupAt(pos))
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -802,8 +787,8 @@ CWindow* CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t propert
|
||||||
|
|
||||||
CBox box = (properties & USE_PROP_TILED) ? w->getWindowBoxUnified(properties) : CBox{w->m_vPosition, w->m_vSize};
|
CBox box = (properties & USE_PROP_TILED) ? w->getWindowBoxUnified(properties) : CBox{w->m_vPosition, w->m_vSize};
|
||||||
if (!w->m_bIsFloating && w->m_bIsMapped && box.containsPoint(pos) && w->workspaceID() == WORKSPACEID && !w->isHidden() && !w->m_bX11ShouldntFocus &&
|
if (!w->m_bIsFloating && w->m_bIsMapped && box.containsPoint(pos) && w->workspaceID() == WORKSPACEID && !w->isHidden() && !w->m_bX11ShouldntFocus &&
|
||||||
!w->m_sAdditionalConfigData.noFocus && w.get() != pIgnoreWindow)
|
!w->m_sAdditionalConfigData.noFocus && w != pIgnoreWindow)
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -823,9 +808,9 @@ CWindow* CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t propert
|
||||||
return windowForWorkspace(false);
|
return windowForWorkspace(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_surface* CCompositor::vectorWindowToSurface(const Vector2D& pos, CWindow* pWindow, Vector2D& sl) {
|
wlr_surface* CCompositor::vectorWindowToSurface(const Vector2D& pos, PHLWINDOW pWindow, Vector2D& sl) {
|
||||||
|
|
||||||
if (!windowValidMapped(pWindow))
|
if (!validMapped(pWindow))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
RASSERT(!pWindow->m_bIsX11, "Cannot call vectorWindowToSurface on an X11 window!");
|
RASSERT(!pWindow->m_bIsX11, "Cannot call vectorWindowToSurface on an X11 window!");
|
||||||
|
@ -857,8 +842,8 @@ wlr_surface* CCompositor::vectorWindowToSurface(const Vector2D& pos, CWindow* pW
|
||||||
return PSURFACE->surface;
|
return PSURFACE->surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D CCompositor::vectorToSurfaceLocal(const Vector2D& vec, CWindow* pWindow, wlr_surface* pSurface) {
|
Vector2D CCompositor::vectorToSurfaceLocal(const Vector2D& vec, PHLWINDOW pWindow, wlr_surface* pSurface) {
|
||||||
if (!windowValidMapped(pWindow))
|
if (!validMapped(pWindow))
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
if (pWindow->m_bIsX11)
|
if (pWindow->m_bIsX11)
|
||||||
|
@ -909,7 +894,7 @@ CMonitor* CCompositor::getRealMonitorFromOutput(wlr_output* out) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
|
void CCompositor::focusWindow(PHLWINDOW pWindow, wlr_surface* pSurface) {
|
||||||
|
|
||||||
static auto PFOLLOWMOUSE = CConfigValue<Hyprlang::INT>("input:follow_mouse");
|
static auto PFOLLOWMOUSE = CConfigValue<Hyprlang::INT>("input:follow_mouse");
|
||||||
static auto PSPECIALFALLTHROUGH = CConfigValue<Hyprlang::INT>("input:special_fallthrough");
|
static auto PSPECIALFALLTHROUGH = CConfigValue<Hyprlang::INT>("input:special_fallthrough");
|
||||||
|
@ -929,15 +914,15 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
|
||||||
|
|
||||||
g_pLayoutManager->getCurrentLayout()->bringWindowToTop(pWindow);
|
g_pLayoutManager->getCurrentLayout()->bringWindowToTop(pWindow);
|
||||||
|
|
||||||
if (!pWindow || !windowValidMapped(pWindow)) {
|
if (!pWindow || !validMapped(pWindow)) {
|
||||||
|
|
||||||
if (!m_pLastWindow && !pWindow)
|
if (m_pLastWindow.expired() && !pWindow)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto PLASTWINDOW = m_pLastWindow;
|
const auto PLASTWINDOW = m_pLastWindow.lock();
|
||||||
m_pLastWindow = nullptr;
|
m_pLastWindow.reset();
|
||||||
|
|
||||||
if (windowValidMapped(PLASTWINDOW)) {
|
if (PLASTWINDOW && PLASTWINDOW->m_bIsMapped) {
|
||||||
updateWindowAnimatedDecorationValues(PLASTWINDOW);
|
updateWindowAnimatedDecorationValues(PLASTWINDOW);
|
||||||
|
|
||||||
g_pXWaylandManager->activateWindow(PLASTWINDOW, false);
|
g_pXWaylandManager->activateWindow(PLASTWINDOW, false);
|
||||||
|
@ -948,7 +933,7 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", ","});
|
g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", ","});
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", ","});
|
g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", ","});
|
||||||
|
|
||||||
EMIT_HOOK_EVENT("activeWindow", (CWindow*)nullptr);
|
EMIT_HOOK_EVENT("activeWindow", (PHLWINDOW) nullptr);
|
||||||
|
|
||||||
g_pLayoutManager->getCurrentLayout()->onWindowFocusChange(nullptr);
|
g_pLayoutManager->getCurrentLayout()->onWindowFocusChange(nullptr);
|
||||||
|
|
||||||
|
@ -963,7 +948,7 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pLastWindow == pWindow && m_sSeat.seat->keyboard_state.focused_surface == pSurface)
|
if (m_pLastWindow.lock() == pWindow && m_sSeat.seat->keyboard_state.focused_surface == pSurface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pWindow->m_bPinned)
|
if (pWindow->m_bPinned)
|
||||||
|
@ -984,7 +969,7 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto PLASTWINDOW = m_pLastWindow;
|
const auto PLASTWINDOW = m_pLastWindow.lock();
|
||||||
m_pLastWindow = pWindow;
|
m_pLastWindow = pWindow;
|
||||||
|
|
||||||
/* If special fallthrough is enabled, this behavior will be disabled, as I have no better idea of nicely tracking which
|
/* If special fallthrough is enabled, this behavior will be disabled, as I have no better idea of nicely tracking which
|
||||||
|
@ -993,7 +978,7 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
|
||||||
PMONITOR->setSpecialWorkspace(nullptr);
|
PMONITOR->setSpecialWorkspace(nullptr);
|
||||||
|
|
||||||
// we need to make the PLASTWINDOW not equal to m_pLastWindow so that RENDERDATA is correct for an unfocused window
|
// we need to make the PLASTWINDOW not equal to m_pLastWindow so that RENDERDATA is correct for an unfocused window
|
||||||
if (windowValidMapped(PLASTWINDOW)) {
|
if (PLASTWINDOW && PLASTWINDOW->m_bIsMapped) {
|
||||||
PLASTWINDOW->updateDynamicRules();
|
PLASTWINDOW->updateDynamicRules();
|
||||||
|
|
||||||
updateWindowAnimatedDecorationValues(PLASTWINDOW);
|
updateWindowAnimatedDecorationValues(PLASTWINDOW);
|
||||||
|
@ -1019,7 +1004,7 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
|
||||||
|
|
||||||
// Send an event
|
// Send an event
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", g_pXWaylandManager->getAppIDClass(pWindow) + "," + pWindow->m_szTitle});
|
g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", g_pXWaylandManager->getAppIDClass(pWindow) + "," + pWindow->m_szTitle});
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", std::format("{:x}", (uintptr_t)pWindow)});
|
g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", std::format("{:x}", (uintptr_t)pWindow.get())});
|
||||||
|
|
||||||
EMIT_HOOK_EVENT("activeWindow", pWindow);
|
EMIT_HOOK_EVENT("activeWindow", pWindow);
|
||||||
|
|
||||||
|
@ -1028,7 +1013,7 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
|
||||||
g_pInputManager->recheckIdleInhibitorStatus();
|
g_pInputManager->recheckIdleInhibitorStatus();
|
||||||
|
|
||||||
// move to front of the window history
|
// move to front of the window history
|
||||||
const auto HISTORYPIVOT = std::find_if(m_vWindowFocusHistory.begin(), m_vWindowFocusHistory.end(), [&](const auto& other) { return other == pWindow; });
|
const auto HISTORYPIVOT = std::find_if(m_vWindowFocusHistory.begin(), m_vWindowFocusHistory.end(), [&](const auto& other) { return other.lock() == pWindow; });
|
||||||
if (HISTORYPIVOT == m_vWindowFocusHistory.end()) {
|
if (HISTORYPIVOT == m_vWindowFocusHistory.end()) {
|
||||||
Debug::log(ERR, "BUG THIS: {} has no pivot in history", pWindow);
|
Debug::log(ERR, "BUG THIS: {} has no pivot in history", pWindow);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1039,7 +1024,7 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) {
|
||||||
g_pInputManager->sendMotionEventsToFocused();
|
g_pInputManager->sendMotionEventsToFocused();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::focusSurface(wlr_surface* pSurface, CWindow* pWindowOwner) {
|
void CCompositor::focusSurface(wlr_surface* pSurface, PHLWINDOW pWindowOwner) {
|
||||||
|
|
||||||
if (m_sSeat.seat->keyboard_state.focused_surface == pSurface || (pWindowOwner && m_sSeat.seat->keyboard_state.focused_surface == pWindowOwner->m_pWLSurface.wlr()))
|
if (m_sSeat.seat->keyboard_state.focused_surface == pSurface || (pWindowOwner && m_sSeat.seat->keyboard_state.focused_surface == pWindowOwner->m_pWLSurface.wlr()))
|
||||||
return; // Don't focus when already focused on this.
|
return; // Don't focus when already focused on this.
|
||||||
|
@ -1094,22 +1079,6 @@ void CCompositor::focusSurface(wlr_surface* pSurface, CWindow* pWindowOwner) {
|
||||||
SURF->constraint()->activate();
|
SURF->constraint()->activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCompositor::windowValidMapped(CWindow* pWindow) {
|
|
||||||
if (!pWindow)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!windowExists(pWindow))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!pWindow->m_bIsMapped)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (pWindow->isHidden())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
wlr_surface* CCompositor::vectorToLayerPopupSurface(const Vector2D& pos, CMonitor* monitor, Vector2D* sCoords, SLayerSurface** ppLayerSurfaceFound) {
|
wlr_surface* CCompositor::vectorToLayerPopupSurface(const Vector2D& pos, CMonitor* monitor, Vector2D* sCoords, SLayerSurface** ppLayerSurfaceFound) {
|
||||||
for (auto& lsl : monitor->m_aLayerSurfaceLayers | std::views::reverse) {
|
for (auto& lsl : monitor->m_aLayerSurfaceLayers | std::views::reverse) {
|
||||||
for (auto& ls : lsl | std::views::reverse) {
|
for (auto& ls : lsl | std::views::reverse) {
|
||||||
|
@ -1151,32 +1120,32 @@ wlr_surface* CCompositor::vectorToLayerSurface(const Vector2D& pos, std::vector<
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CCompositor::getWindowFromSurface(wlr_surface* pSurface) {
|
PHLWINDOW CCompositor::getWindowFromSurface(wlr_surface* pSurface) {
|
||||||
for (auto& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (!w->m_bIsMapped || w->m_bFadingOut)
|
if (!w->m_bIsMapped || w->m_bFadingOut)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w->m_pWLSurface.wlr() == pSurface)
|
if (w->m_pWLSurface.wlr() == pSurface)
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CCompositor::getWindowFromHandle(uint32_t handle) {
|
PHLWINDOW CCompositor::getWindowFromHandle(uint32_t handle) {
|
||||||
for (auto& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if ((uint32_t)(((uint64_t)w.get()) & 0xFFFFFFFF) == handle) {
|
if ((uint32_t)(((uint64_t)w.get()) & 0xFFFFFFFF) == handle) {
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CCompositor::getFullscreenWindowOnWorkspace(const int& ID) {
|
PHLWINDOW CCompositor::getFullscreenWindowOnWorkspace(const int& ID) {
|
||||||
for (auto& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->workspaceID() == ID && w->m_bIsFullscreen)
|
if (w->workspaceID() == ID && w->m_bIsFullscreen)
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -1241,10 +1210,10 @@ int CCompositor::getGroupsOnWorkspace(const int& id, std::optional<bool> onlyTil
|
||||||
return no;
|
return no;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CCompositor::getUrgentWindow() {
|
PHLWINDOW CCompositor::getUrgentWindow() {
|
||||||
for (auto& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->m_bIsMapped && w->m_bIsUrgent)
|
if (w->m_bIsMapped && w->m_bIsUrgent)
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -1259,16 +1228,16 @@ bool CCompositor::hasUrgentWindowOnWorkspace(const int& id) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CCompositor::getFirstWindowOnWorkspace(const int& id) {
|
PHLWINDOW CCompositor::getFirstWindowOnWorkspace(const int& id) {
|
||||||
for (auto& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->workspaceID() == id && w->m_bIsMapped && !w->isHidden())
|
if (w->workspaceID() == id && w->m_bIsMapped && !w->isHidden())
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CCompositor::getTopLeftWindowOnWorkspace(const int& id) {
|
PHLWINDOW CCompositor::getTopLeftWindowOnWorkspace(const int& id) {
|
||||||
const auto PWORKSPACE = getWorkspaceByID(id);
|
const auto PWORKSPACE = getWorkspaceByID(id);
|
||||||
|
|
||||||
if (!PWORKSPACE)
|
if (!PWORKSPACE)
|
||||||
|
@ -1283,7 +1252,7 @@ CWindow* CCompositor::getTopLeftWindowOnWorkspace(const int& id) {
|
||||||
const auto WINDOWIDEALBB = w->getWindowIdealBoundingBoxIgnoreReserved();
|
const auto WINDOWIDEALBB = w->getWindowIdealBoundingBoxIgnoreReserved();
|
||||||
|
|
||||||
if (WINDOWIDEALBB.x <= PMONITOR->vecPosition.x + 1 && WINDOWIDEALBB.y <= PMONITOR->vecPosition.y + 1)
|
if (WINDOWIDEALBB.x <= PMONITOR->vecPosition.x + 1 && WINDOWIDEALBB.y <= PMONITOR->vecPosition.y + 1)
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -1309,8 +1278,8 @@ bool CCompositor::doesSeatAcceptInput(wlr_surface* surface) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCompositor::isWindowActive(CWindow* pWindow) {
|
bool CCompositor::isWindowActive(PHLWINDOW pWindow) {
|
||||||
if (!m_pLastWindow && !m_pLastFocus)
|
if (m_pLastWindow.expired() && !m_pLastFocus)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!pWindow->m_bIsMapped)
|
if (!pWindow->m_bIsMapped)
|
||||||
|
@ -1318,24 +1287,24 @@ bool CCompositor::isWindowActive(CWindow* pWindow) {
|
||||||
|
|
||||||
const auto PSURFACE = pWindow->m_pWLSurface.wlr();
|
const auto PSURFACE = pWindow->m_pWLSurface.wlr();
|
||||||
|
|
||||||
return PSURFACE == m_pLastFocus || pWindow == m_pLastWindow;
|
return PSURFACE == m_pLastFocus || pWindow == m_pLastWindow.lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::changeWindowZOrder(CWindow* pWindow, bool top) {
|
void CCompositor::changeWindowZOrder(PHLWINDOW pWindow, bool top) {
|
||||||
if (!windowValidMapped(pWindow))
|
if (!validMapped(pWindow))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto moveToZ = [&](CWindow* pw, bool top) -> void {
|
auto moveToZ = [&](PHLWINDOW pw, bool top) -> void {
|
||||||
if (top) {
|
if (top) {
|
||||||
for (auto it = m_vWindows.begin(); it != m_vWindows.end(); ++it) {
|
for (auto it = m_vWindows.begin(); it != m_vWindows.end(); ++it) {
|
||||||
if (it->get() == pw) {
|
if (*it == pw) {
|
||||||
std::rotate(it, it + 1, m_vWindows.end());
|
std::rotate(it, it + 1, m_vWindows.end());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (auto it = m_vWindows.rbegin(); it != m_vWindows.rend(); ++it) {
|
for (auto it = m_vWindows.rbegin(); it != m_vWindows.rend(); ++it) {
|
||||||
if (it->get() == pw) {
|
if (*it == pw) {
|
||||||
std::rotate(it, it + 1, m_vWindows.rend());
|
std::rotate(it, it + 1, m_vWindows.rend());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1355,9 +1324,9 @@ void CCompositor::changeWindowZOrder(CWindow* pWindow, bool top) {
|
||||||
} else {
|
} else {
|
||||||
// move X11 window stack
|
// move X11 window stack
|
||||||
|
|
||||||
std::deque<CWindow*> toMove;
|
std::deque<PHLWINDOW> toMove;
|
||||||
|
|
||||||
auto x11Stack = [&](CWindow* pw, bool top, auto&& x11Stack) -> void {
|
auto x11Stack = [&](PHLWINDOW pw, bool top, auto&& x11Stack) -> void {
|
||||||
if (top)
|
if (top)
|
||||||
toMove.emplace_back(pw);
|
toMove.emplace_back(pw);
|
||||||
else
|
else
|
||||||
|
@ -1365,7 +1334,7 @@ void CCompositor::changeWindowZOrder(CWindow* pWindow, bool top) {
|
||||||
|
|
||||||
for (auto& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsX11 && w->X11TransientFor() == pw) {
|
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsX11 && w->X11TransientFor() == pw) {
|
||||||
x11Stack(w.get(), top, x11Stack);
|
x11Stack(w, top, x11Stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1379,7 +1348,9 @@ void CCompositor::changeWindowZOrder(CWindow* pWindow, bool top) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::cleanupFadingOut(const int& monid) {
|
void CCompositor::cleanupFadingOut(const int& monid) {
|
||||||
for (auto& w : m_vWindowsFadingOut) {
|
for (auto& ww : m_vWindowsFadingOut) {
|
||||||
|
|
||||||
|
const auto w = ww.lock();
|
||||||
|
|
||||||
if (w->m_iMonitorID != (long unsigned int)monid)
|
if (w->m_iMonitorID != (long unsigned int)monid)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1462,8 +1433,8 @@ void CCompositor::addToFadingOutSafe(SLayerSurface* pLS) {
|
||||||
m_vSurfacesFadingOut.emplace_back(pLS);
|
m_vSurfacesFadingOut.emplace_back(pLS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::addToFadingOutSafe(CWindow* pWindow) {
|
void CCompositor::addToFadingOutSafe(PHLWINDOW pWindow) {
|
||||||
const auto FOUND = std::find_if(m_vWindowsFadingOut.begin(), m_vWindowsFadingOut.end(), [&](CWindow* other) { return other == pWindow; });
|
const auto FOUND = std::find_if(m_vWindowsFadingOut.begin(), m_vWindowsFadingOut.end(), [&](PHLWINDOWREF& other) { return other.lock() == pWindow; });
|
||||||
|
|
||||||
if (FOUND != m_vWindowsFadingOut.end())
|
if (FOUND != m_vWindowsFadingOut.end())
|
||||||
return; // if it's already added, don't add it.
|
return; // if it's already added, don't add it.
|
||||||
|
@ -1471,7 +1442,7 @@ void CCompositor::addToFadingOutSafe(CWindow* pWindow) {
|
||||||
m_vWindowsFadingOut.emplace_back(pWindow);
|
m_vWindowsFadingOut.emplace_back(pWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CCompositor::getWindowInDirection(CWindow* pWindow, char dir) {
|
PHLWINDOW CCompositor::getWindowInDirection(PHLWINDOW pWindow, char dir) {
|
||||||
|
|
||||||
if (!isDirection(dir))
|
if (!isDirection(dir))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -1492,13 +1463,13 @@ CWindow* CCompositor::getWindowInDirection(CWindow* pWindow, char dir) {
|
||||||
|
|
||||||
const auto PWORKSPACE = pWindow->m_pWorkspace;
|
const auto PWORKSPACE = pWindow->m_pWorkspace;
|
||||||
auto leaderValue = -1;
|
auto leaderValue = -1;
|
||||||
CWindow* leaderWindow = nullptr;
|
PHLWINDOW leaderWindow = nullptr;
|
||||||
|
|
||||||
if (!pWindow->m_bIsFloating) {
|
if (!pWindow->m_bIsFloating) {
|
||||||
|
|
||||||
// for tiled windows, we calc edges
|
// for tiled windows, we calc edges
|
||||||
for (auto& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w.get() == pWindow || !w->m_bIsMapped || w->isHidden() || (!w->m_bIsFullscreen && w->m_bIsFloating) || !isWorkspaceVisible(w->m_pWorkspace))
|
if (w == pWindow || !w->m_bIsMapped || w->isHidden() || (!w->m_bIsFullscreen && w->m_bIsFloating) || !isWorkspaceVisible(w->m_pWorkspace))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pWindow->m_iMonitorID == w->m_iMonitorID && pWindow->m_pWorkspace != w->m_pWorkspace)
|
if (pWindow->m_iMonitorID == w->m_iMonitorID && pWindow->m_pWorkspace != w->m_pWorkspace)
|
||||||
|
@ -1545,7 +1516,7 @@ CWindow* CCompositor::getWindowInDirection(CWindow* pWindow, char dir) {
|
||||||
// get idx
|
// get idx
|
||||||
int windowIDX = -1;
|
int windowIDX = -1;
|
||||||
for (size_t i = 0; i < g_pCompositor->m_vWindowFocusHistory.size(); ++i) {
|
for (size_t i = 0; i < g_pCompositor->m_vWindowFocusHistory.size(); ++i) {
|
||||||
if (g_pCompositor->m_vWindowFocusHistory[i] == w.get()) {
|
if (g_pCompositor->m_vWindowFocusHistory[i].lock() == w) {
|
||||||
windowIDX = i;
|
windowIDX = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1555,13 +1526,13 @@ CWindow* CCompositor::getWindowInDirection(CWindow* pWindow, char dir) {
|
||||||
|
|
||||||
if (windowIDX > leaderValue) {
|
if (windowIDX > leaderValue) {
|
||||||
leaderValue = windowIDX;
|
leaderValue = windowIDX;
|
||||||
leaderWindow = w.get();
|
leaderWindow = w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else /* length */ {
|
} else /* length */ {
|
||||||
if (intersectLength > leaderValue) {
|
if (intersectLength > leaderValue) {
|
||||||
leaderValue = intersectLength;
|
leaderValue = intersectLength;
|
||||||
leaderWindow = w.get();
|
leaderWindow = w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1587,7 +1558,7 @@ CWindow* CCompositor::getWindowInDirection(CWindow* pWindow, char dir) {
|
||||||
constexpr float THRESHOLD = 0.3 * M_PI;
|
constexpr float THRESHOLD = 0.3 * M_PI;
|
||||||
|
|
||||||
for (auto& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w.get() == pWindow || !w->m_bIsMapped || w->isHidden() || (!w->m_bIsFullscreen && !w->m_bIsFloating) || !isWorkspaceVisible(w->m_pWorkspace))
|
if (w == pWindow || !w->m_bIsMapped || w->isHidden() || (!w->m_bIsFullscreen && !w->m_bIsFloating) || !isWorkspaceVisible(w->m_pWorkspace))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pWindow->m_iMonitorID == w->m_iMonitorID && pWindow->m_pWorkspace != w->m_pWorkspace)
|
if (pWindow->m_iMonitorID == w->m_iMonitorID && pWindow->m_pWorkspace != w->m_pWorkspace)
|
||||||
|
@ -1605,7 +1576,7 @@ CWindow* CCompositor::getWindowInDirection(CWindow* pWindow, char dir) {
|
||||||
if ((bestAngleAbs < THRESHOLD && DIST < leaderValue && ANGLE < THRESHOLD) || (ANGLE < bestAngleAbs && bestAngleAbs > THRESHOLD) || leaderValue == -1) {
|
if ((bestAngleAbs < THRESHOLD && DIST < leaderValue && ANGLE < THRESHOLD) || (ANGLE < bestAngleAbs && bestAngleAbs > THRESHOLD) || leaderValue == -1) {
|
||||||
leaderValue = DIST;
|
leaderValue = DIST;
|
||||||
bestAngleAbs = ANGLE;
|
bestAngleAbs = ANGLE;
|
||||||
leaderWindow = w.get();
|
leaderWindow = w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1619,13 +1590,13 @@ CWindow* CCompositor::getWindowInDirection(CWindow* pWindow, char dir) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CCompositor::getNextWindowOnWorkspace(CWindow* pWindow, bool focusableOnly, std::optional<bool> floating) {
|
PHLWINDOW CCompositor::getNextWindowOnWorkspace(PHLWINDOW pWindow, bool focusableOnly, std::optional<bool> floating) {
|
||||||
bool gotToWindow = false;
|
bool gotToWindow = false;
|
||||||
for (auto& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w.get() != pWindow && !gotToWindow)
|
if (w != pWindow && !gotToWindow)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w.get() == pWindow) {
|
if (w == pWindow) {
|
||||||
gotToWindow = true;
|
gotToWindow = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1634,27 +1605,27 @@ CWindow* CCompositor::getNextWindowOnWorkspace(CWindow* pWindow, bool focusableO
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w->m_pWorkspace == pWindow->m_pWorkspace && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sAdditionalConfigData.noFocus))
|
if (w->m_pWorkspace == pWindow->m_pWorkspace && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sAdditionalConfigData.noFocus))
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (floating.has_value() && w->m_bIsFloating != floating.value())
|
if (floating.has_value() && w->m_bIsFloating != floating.value())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w.get() != pWindow && w->m_pWorkspace == pWindow->m_pWorkspace && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sAdditionalConfigData.noFocus))
|
if (w != pWindow && w->m_pWorkspace == pWindow->m_pWorkspace && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sAdditionalConfigData.noFocus))
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CCompositor::getPrevWindowOnWorkspace(CWindow* pWindow, bool focusableOnly, std::optional<bool> floating) {
|
PHLWINDOW CCompositor::getPrevWindowOnWorkspace(PHLWINDOW pWindow, bool focusableOnly, std::optional<bool> floating) {
|
||||||
bool gotToWindow = false;
|
bool gotToWindow = false;
|
||||||
for (auto& w : m_vWindows | std::views::reverse) {
|
for (auto& w : m_vWindows | std::views::reverse) {
|
||||||
if (w.get() != pWindow && !gotToWindow)
|
if (w != pWindow && !gotToWindow)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w.get() == pWindow) {
|
if (w == pWindow) {
|
||||||
gotToWindow = true;
|
gotToWindow = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1663,15 +1634,15 @@ CWindow* CCompositor::getPrevWindowOnWorkspace(CWindow* pWindow, bool focusableO
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w->m_pWorkspace == pWindow->m_pWorkspace && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sAdditionalConfigData.noFocus))
|
if (w->m_pWorkspace == pWindow->m_pWorkspace && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sAdditionalConfigData.noFocus))
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& w : m_vWindows | std::views::reverse) {
|
for (auto& w : m_vWindows | std::views::reverse) {
|
||||||
if (floating.has_value() && w->m_bIsFloating != floating.value())
|
if (floating.has_value() && w->m_bIsFloating != floating.value())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w.get() != pWindow && w->m_pWorkspace == pWindow->m_pWorkspace && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sAdditionalConfigData.noFocus))
|
if (w != pWindow && w->m_pWorkspace == pWindow->m_pWorkspace && w->m_bIsMapped && !w->isHidden() && (!focusableOnly || !w->m_sAdditionalConfigData.noFocus))
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -1805,7 +1776,7 @@ void CCompositor::updateAllWindowsAnimatedDecorationValues() {
|
||||||
if (!w->m_bIsMapped)
|
if (!w->m_bIsMapped)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
updateWindowAnimatedDecorationValues(w.get());
|
updateWindowAnimatedDecorationValues(w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1818,7 +1789,7 @@ void CCompositor::updateWorkspaceWindows(const int64_t& id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::updateWindowAnimatedDecorationValues(CWindow* pWindow) {
|
void CCompositor::updateWindowAnimatedDecorationValues(PHLWINDOW pWindow) {
|
||||||
// optimization
|
// optimization
|
||||||
static auto PACTIVECOL = CConfigValue<Hyprlang::CUSTOMTYPE>("general:col.active_border");
|
static auto PACTIVECOL = CConfigValue<Hyprlang::CUSTOMTYPE>("general:col.active_border");
|
||||||
static auto PINACTIVECOL = CConfigValue<Hyprlang::CUSTOMTYPE>("general:col.inactive_border");
|
static auto PINACTIVECOL = CConfigValue<Hyprlang::CUSTOMTYPE>("general:col.inactive_border");
|
||||||
|
@ -1860,15 +1831,15 @@ void CCompositor::updateWindowAnimatedDecorationValues(CWindow* pWindow) {
|
||||||
if (RENDERDATA.isBorderGradient)
|
if (RENDERDATA.isBorderGradient)
|
||||||
setBorderColor(*RENDERDATA.borderGradient);
|
setBorderColor(*RENDERDATA.borderGradient);
|
||||||
else {
|
else {
|
||||||
const bool GROUPLOCKED = pWindow->m_sGroupData.pNextWindow ? pWindow->getGroupHead()->m_sGroupData.locked : false;
|
const bool GROUPLOCKED = pWindow->m_sGroupData.pNextWindow.lock() ? pWindow->getGroupHead()->m_sGroupData.locked : false;
|
||||||
if (pWindow == m_pLastWindow) {
|
if (pWindow == m_pLastWindow.lock()) {
|
||||||
const auto* const ACTIVECOLOR =
|
const auto* const ACTIVECOLOR =
|
||||||
!pWindow->m_sGroupData.pNextWindow ? (!pWindow->m_sGroupData.deny ? ACTIVECOL : NOGROUPACTIVECOL) : (GROUPLOCKED ? GROUPACTIVELOCKEDCOL : GROUPACTIVECOL);
|
!pWindow->m_sGroupData.pNextWindow.lock() ? (!pWindow->m_sGroupData.deny ? ACTIVECOL : NOGROUPACTIVECOL) : (GROUPLOCKED ? GROUPACTIVELOCKEDCOL : GROUPACTIVECOL);
|
||||||
setBorderColor(pWindow->m_sSpecialRenderData.activeBorderColor.toUnderlying().m_vColors.empty() ? *ACTIVECOLOR :
|
setBorderColor(pWindow->m_sSpecialRenderData.activeBorderColor.toUnderlying().m_vColors.empty() ? *ACTIVECOLOR :
|
||||||
pWindow->m_sSpecialRenderData.activeBorderColor.toUnderlying());
|
pWindow->m_sSpecialRenderData.activeBorderColor.toUnderlying());
|
||||||
} else {
|
} else {
|
||||||
const auto* const INACTIVECOLOR =
|
const auto* const INACTIVECOLOR = !pWindow->m_sGroupData.pNextWindow.lock() ? (!pWindow->m_sGroupData.deny ? INACTIVECOL : NOGROUPINACTIVECOL) :
|
||||||
!pWindow->m_sGroupData.pNextWindow ? (!pWindow->m_sGroupData.deny ? INACTIVECOL : NOGROUPINACTIVECOL) : (GROUPLOCKED ? GROUPINACTIVELOCKEDCOL : GROUPINACTIVECOL);
|
(GROUPLOCKED ? GROUPINACTIVELOCKEDCOL : GROUPINACTIVECOL);
|
||||||
setBorderColor(pWindow->m_sSpecialRenderData.inactiveBorderColor.toUnderlying().m_vColors.empty() ? *INACTIVECOLOR :
|
setBorderColor(pWindow->m_sSpecialRenderData.inactiveBorderColor.toUnderlying().m_vColors.empty() ? *INACTIVECOLOR :
|
||||||
pWindow->m_sSpecialRenderData.inactiveBorderColor.toUnderlying());
|
pWindow->m_sSpecialRenderData.inactiveBorderColor.toUnderlying());
|
||||||
}
|
}
|
||||||
|
@ -1886,7 +1857,7 @@ void CCompositor::updateWindowAnimatedDecorationValues(CWindow* pWindow) {
|
||||||
pWindow->m_sSpecialRenderData.alphaFullscreen.toUnderlying() * *PFULLSCREENALPHA) :
|
pWindow->m_sSpecialRenderData.alphaFullscreen.toUnderlying() * *PFULLSCREENALPHA) :
|
||||||
*PFULLSCREENALPHA;
|
*PFULLSCREENALPHA;
|
||||||
} else {
|
} else {
|
||||||
if (pWindow == m_pLastWindow)
|
if (pWindow == m_pLastWindow.lock())
|
||||||
pWindow->m_fActiveInactiveAlpha = pWindow->m_sSpecialRenderData.alphaOverride.toUnderlying() ? pWindow->m_sSpecialRenderData.alpha.toUnderlying() :
|
pWindow->m_fActiveInactiveAlpha = pWindow->m_sSpecialRenderData.alphaOverride.toUnderlying() ? pWindow->m_sSpecialRenderData.alpha.toUnderlying() :
|
||||||
pWindow->m_sSpecialRenderData.alpha.toUnderlying() * *PACTIVEALPHA;
|
pWindow->m_sSpecialRenderData.alpha.toUnderlying() * *PACTIVEALPHA;
|
||||||
else
|
else
|
||||||
|
@ -1897,7 +1868,7 @@ void CCompositor::updateWindowAnimatedDecorationValues(CWindow* pWindow) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// dim
|
// dim
|
||||||
if (pWindow == m_pLastWindow || pWindow->m_sAdditionalConfigData.forceNoDim || !*PDIMENABLED) {
|
if (pWindow == m_pLastWindow.lock() || pWindow->m_sAdditionalConfigData.forceNoDim || !*PDIMENABLED) {
|
||||||
pWindow->m_fDimPercent = 0;
|
pWindow->m_fDimPercent = 0;
|
||||||
} else {
|
} else {
|
||||||
pWindow->m_fDimPercent = *PDIMSTRENGTH;
|
pWindow->m_fDimPercent = *PDIMSTRENGTH;
|
||||||
|
@ -1905,7 +1876,7 @@ void CCompositor::updateWindowAnimatedDecorationValues(CWindow* pWindow) {
|
||||||
|
|
||||||
// shadow
|
// shadow
|
||||||
if (pWindow->m_iX11Type != 2 && !pWindow->m_bX11DoesntWantBorders) {
|
if (pWindow->m_iX11Type != 2 && !pWindow->m_bX11DoesntWantBorders) {
|
||||||
if (pWindow == m_pLastWindow) {
|
if (pWindow == m_pLastWindow.lock()) {
|
||||||
pWindow->m_cRealShadowColor = CColor(*PSHADOWCOL);
|
pWindow->m_cRealShadowColor = CColor(*PSHADOWCOL);
|
||||||
} else {
|
} else {
|
||||||
pWindow->m_cRealShadowColor = CColor(*PSHADOWCOLINACTIVE != INT_MAX ? *PSHADOWCOLINACTIVE : *PSHADOWCOL);
|
pWindow->m_cRealShadowColor = CColor(*PSHADOWCOLINACTIVE != INT_MAX ? *PSHADOWCOLINACTIVE : *PSHADOWCOL);
|
||||||
|
@ -2252,8 +2223,8 @@ void CCompositor::updateFullscreenFadeOnWorkspace(PHLWORKSPACE pWorkspace) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::setWindowFullscreen(CWindow* pWindow, bool on, eFullscreenMode mode) {
|
void CCompositor::setWindowFullscreen(PHLWINDOW pWindow, bool on, eFullscreenMode mode) {
|
||||||
if (!windowValidMapped(pWindow) || g_pCompositor->m_bUnsafeState)
|
if (!validMapped(pWindow) || g_pCompositor->m_bUnsafeState)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pWindow->m_bPinned) {
|
if (pWindow->m_bPinned) {
|
||||||
|
@ -2302,7 +2273,7 @@ void CCompositor::setWindowFullscreen(CWindow* pWindow, bool on, eFullscreenMode
|
||||||
g_pConfigManager->ensureVRR(PMONITOR);
|
g_pConfigManager->ensureVRR(PMONITOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CCompositor::getX11Parent(CWindow* pWindow) {
|
PHLWINDOW CCompositor::getX11Parent(PHLWINDOW pWindow) {
|
||||||
if (!pWindow->m_bIsX11)
|
if (!pWindow->m_bIsX11)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
@ -2311,7 +2282,7 @@ CWindow* CCompositor::getX11Parent(CWindow* pWindow) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w->m_uSurface.xwayland == pWindow->m_uSurface.xwayland->parent)
|
if (w->m_uSurface.xwayland == pWindow->m_uSurface.xwayland->parent)
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -2351,9 +2322,9 @@ void CCompositor::scheduleFrameForMonitor(CMonitor* pMonitor) {
|
||||||
wlr_output_schedule_frame(pMonitor->output);
|
wlr_output_schedule_frame(pMonitor->output);
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CCompositor::getWindowByRegex(const std::string& regexp) {
|
PHLWINDOW CCompositor::getWindowByRegex(const std::string& regexp) {
|
||||||
if (regexp.starts_with("active"))
|
if (regexp.starts_with("active"))
|
||||||
return m_pLastWindow;
|
return m_pLastWindow.lock();
|
||||||
|
|
||||||
eFocusWindowMode mode = MODE_CLASS_REGEX;
|
eFocusWindowMode mode = MODE_CLASS_REGEX;
|
||||||
|
|
||||||
|
@ -2378,28 +2349,28 @@ CWindow* CCompositor::getWindowByRegex(const std::string& regexp) {
|
||||||
matchCheck = regexp.substr(4);
|
matchCheck = regexp.substr(4);
|
||||||
} else if (regexp.starts_with("floating") || regexp.starts_with("tiled")) {
|
} else if (regexp.starts_with("floating") || regexp.starts_with("tiled")) {
|
||||||
// first floating on the current ws
|
// first floating on the current ws
|
||||||
if (!m_pLastWindow)
|
if (!valid(m_pLastWindow))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
const bool FLOAT = regexp.starts_with("floating");
|
const bool FLOAT = regexp.starts_with("floating");
|
||||||
|
|
||||||
for (auto& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (!w->m_bIsMapped || w->m_bIsFloating != FLOAT || w->m_pWorkspace != m_pLastWindow->m_pWorkspace || w->isHidden())
|
if (!w->m_bIsMapped || w->m_bIsFloating != FLOAT || w->m_pWorkspace != m_pLastWindow.lock()->m_pWorkspace || w->isHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!w->m_bIsMapped || (w->isHidden() && !g_pLayoutManager->getCurrentLayout()->isWindowReachable(w.get())))
|
if (!w->m_bIsMapped || (w->isHidden() && !g_pLayoutManager->getCurrentLayout()->isWindowReachable(w)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case MODE_CLASS_REGEX: {
|
case MODE_CLASS_REGEX: {
|
||||||
const auto windowClass = g_pXWaylandManager->getAppIDClass(w.get());
|
const auto windowClass = g_pXWaylandManager->getAppIDClass(w);
|
||||||
if (!std::regex_search(windowClass, regexCheck))
|
if (!std::regex_search(windowClass, regexCheck))
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
|
@ -2411,7 +2382,7 @@ CWindow* CCompositor::getWindowByRegex(const std::string& regexp) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MODE_TITLE_REGEX: {
|
case MODE_TITLE_REGEX: {
|
||||||
const auto windowTitle = g_pXWaylandManager->getTitle(w.get());
|
const auto windowTitle = g_pXWaylandManager->getTitle(w);
|
||||||
if (!std::regex_search(windowTitle, regexCheck))
|
if (!std::regex_search(windowTitle, regexCheck))
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
|
@ -2437,7 +2408,7 @@ CWindow* CCompositor::getWindowByRegex(const std::string& regexp) {
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -2476,8 +2447,8 @@ SLayerSurface* CCompositor::getLayerSurfaceFromWlr(wlr_layer_surface_v1* pLS) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::closeWindow(CWindow* pWindow) {
|
void CCompositor::closeWindow(PHLWINDOW pWindow) {
|
||||||
if (pWindow && windowValidMapped(pWindow)) {
|
if (pWindow && validMapped(pWindow)) {
|
||||||
g_pXWaylandManager->sendCloseWindow(pWindow);
|
g_pXWaylandManager->sendCloseWindow(pWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2565,7 +2536,7 @@ Vector2D CCompositor::parseWindowVectorArgsRelative(const std::string& args, con
|
||||||
void CCompositor::forceReportSizesToWindowsOnWorkspace(const int& wid) {
|
void CCompositor::forceReportSizesToWindowsOnWorkspace(const int& wid) {
|
||||||
for (auto& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->workspaceID() == wid && w->m_bIsMapped && !w->isHidden()) {
|
if (w->workspaceID() == wid && w->m_bIsMapped && !w->isHidden()) {
|
||||||
g_pXWaylandManager->setWindowSize(w.get(), w->m_vRealSize.value(), true);
|
g_pXWaylandManager->setWindowSize(w, w->m_vRealSize.value(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2638,7 +2609,7 @@ void CCompositor::performUserChecks() {
|
||||||
; // intentional
|
; // intentional
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::moveWindowToWorkspaceSafe(CWindow* pWindow, PHLWORKSPACE pWorkspace) {
|
void CCompositor::moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWorkspace) {
|
||||||
if (!pWindow || !pWorkspace)
|
if (!pWindow || !pWorkspace)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -2672,12 +2643,12 @@ void CCompositor::moveWindowToWorkspaceSafe(CWindow* pWindow, PHLWORKSPACE pWork
|
||||||
pWindow->updateDynamicRules();
|
pWindow->updateDynamicRules();
|
||||||
pWindow->uncacheWindowDecos();
|
pWindow->uncacheWindowDecos();
|
||||||
|
|
||||||
if (pWindow->m_sGroupData.pNextWindow) {
|
if (!pWindow->m_sGroupData.pNextWindow.expired()) {
|
||||||
CWindow* next = pWindow->m_sGroupData.pNextWindow;
|
PHLWINDOW next = pWindow->m_sGroupData.pNextWindow.lock();
|
||||||
while (next != pWindow) {
|
while (next != pWindow) {
|
||||||
next->moveToWorkspace(pWorkspace);
|
next->moveToWorkspace(pWorkspace);
|
||||||
next->updateToplevel();
|
next->updateToplevel();
|
||||||
next = next->m_sGroupData.pNextWindow;
|
next = next->m_sGroupData.pNextWindow.lock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2688,7 +2659,7 @@ void CCompositor::moveWindowToWorkspaceSafe(CWindow* pWindow, PHLWORKSPACE pWork
|
||||||
g_pCompositor->updateWorkspaceWindows(pWindow->workspaceID());
|
g_pCompositor->updateWorkspaceWindows(pWindow->workspaceID());
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CCompositor::getForceFocus() {
|
PHLWINDOW CCompositor::getForceFocus() {
|
||||||
for (auto& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (!w->m_bIsMapped || w->isHidden() || !isWorkspaceVisible(w->m_pWorkspace))
|
if (!w->m_bIsMapped || w->isHidden() || !isWorkspaceVisible(w->m_pWorkspace))
|
||||||
continue;
|
continue;
|
||||||
|
@ -2696,7 +2667,7 @@ CWindow* CCompositor::getForceFocus() {
|
||||||
if (!w->m_bStayFocused)
|
if (!w->m_bStayFocused)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -2875,3 +2846,14 @@ void CCompositor::updateSuspendedStates() {
|
||||||
w->setSuspended(w->isHidden() || !isWorkspaceVisible(w->m_pWorkspace));
|
w->setSuspended(w->isHidden() || !isWorkspaceVisible(w->m_pWorkspace));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PHLWINDOW CCompositor::windowForCPointer(CWindow* pWindow) {
|
||||||
|
for (auto& w : m_vWindows) {
|
||||||
|
if (w.get() != pWindow)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
|
@ -78,11 +78,11 @@ class CCompositor {
|
||||||
std::string m_szInstanceSignature = "";
|
std::string m_szInstanceSignature = "";
|
||||||
std::string m_szCurrentSplash = "error";
|
std::string m_szCurrentSplash = "error";
|
||||||
|
|
||||||
std::vector<std::shared_ptr<CMonitor>> m_vMonitors;
|
std::vector<SP<CMonitor>> m_vMonitors;
|
||||||
std::vector<std::shared_ptr<CMonitor>> m_vRealMonitors; // for all monitors, even those turned off
|
std::vector<SP<CMonitor>> m_vRealMonitors; // for all monitors, even those turned off
|
||||||
std::vector<std::unique_ptr<CWindow>> m_vWindows;
|
std::vector<PHLWINDOW> m_vWindows;
|
||||||
std::vector<PHLWORKSPACE> m_vWorkspaces;
|
std::vector<PHLWORKSPACE> m_vWorkspaces;
|
||||||
std::vector<CWindow*> m_vWindowsFadingOut;
|
std::vector<PHLWINDOWREF> m_vWindowsFadingOut;
|
||||||
std::vector<SLayerSurface*> m_vSurfacesFadingOut;
|
std::vector<SLayerSurface*> m_vSurfacesFadingOut;
|
||||||
|
|
||||||
std::unordered_map<std::string, uint64_t> m_mMonitorIDMap;
|
std::unordered_map<std::string, uint64_t> m_mMonitorIDMap;
|
||||||
|
@ -93,11 +93,11 @@ class CCompositor {
|
||||||
void createLockFile();
|
void createLockFile();
|
||||||
void removeLockFile();
|
void removeLockFile();
|
||||||
|
|
||||||
wlr_surface* m_pLastFocus = nullptr;
|
wlr_surface* m_pLastFocus = nullptr;
|
||||||
CWindow* m_pLastWindow = nullptr;
|
PHLWINDOWREF m_pLastWindow;
|
||||||
CMonitor* m_pLastMonitor = nullptr;
|
CMonitor* m_pLastMonitor = nullptr;
|
||||||
|
|
||||||
std::vector<CWindow*> m_vWindowFocusHistory; // first element is the most recently focused.
|
std::vector<PHLWINDOWREF> m_vWindowFocusHistory; // first element is the most recently focused.
|
||||||
|
|
||||||
SSeat m_sSeat;
|
SSeat m_sSeat;
|
||||||
|
|
||||||
|
@ -117,21 +117,19 @@ class CCompositor {
|
||||||
CMonitor* getMonitorFromDesc(const std::string&);
|
CMonitor* getMonitorFromDesc(const std::string&);
|
||||||
CMonitor* getMonitorFromCursor();
|
CMonitor* getMonitorFromCursor();
|
||||||
CMonitor* getMonitorFromVector(const Vector2D&);
|
CMonitor* getMonitorFromVector(const Vector2D&);
|
||||||
void removeWindowFromVectorSafe(CWindow*);
|
void removeWindowFromVectorSafe(PHLWINDOW);
|
||||||
void focusWindow(CWindow*, wlr_surface* pSurface = nullptr);
|
void focusWindow(PHLWINDOW, wlr_surface* pSurface = nullptr);
|
||||||
void focusSurface(wlr_surface*, CWindow* pWindowOwner = nullptr);
|
void focusSurface(wlr_surface*, PHLWINDOW pWindowOwner = nullptr);
|
||||||
bool windowExists(CWindow*);
|
|
||||||
bool windowValidMapped(CWindow*);
|
|
||||||
bool monitorExists(CMonitor*);
|
bool monitorExists(CMonitor*);
|
||||||
CWindow* vectorToWindowUnified(const Vector2D&, uint8_t properties, CWindow* pIgnoreWindow = nullptr);
|
PHLWINDOW vectorToWindowUnified(const Vector2D&, uint8_t properties, PHLWINDOW pIgnoreWindow = nullptr);
|
||||||
wlr_surface* vectorToLayerSurface(const Vector2D&, std::vector<std::unique_ptr<SLayerSurface>>*, Vector2D*, SLayerSurface**);
|
wlr_surface* vectorToLayerSurface(const Vector2D&, std::vector<std::unique_ptr<SLayerSurface>>*, Vector2D*, SLayerSurface**);
|
||||||
wlr_surface* vectorToLayerPopupSurface(const Vector2D&, CMonitor* monitor, Vector2D*, SLayerSurface**);
|
wlr_surface* vectorToLayerPopupSurface(const Vector2D&, CMonitor* monitor, Vector2D*, SLayerSurface**);
|
||||||
wlr_surface* vectorWindowToSurface(const Vector2D&, CWindow*, Vector2D& sl);
|
wlr_surface* vectorWindowToSurface(const Vector2D&, PHLWINDOW, Vector2D& sl);
|
||||||
Vector2D vectorToSurfaceLocal(const Vector2D&, CWindow*, wlr_surface*);
|
Vector2D vectorToSurfaceLocal(const Vector2D&, PHLWINDOW, wlr_surface*);
|
||||||
CMonitor* getMonitorFromOutput(wlr_output*);
|
CMonitor* getMonitorFromOutput(wlr_output*);
|
||||||
CMonitor* getRealMonitorFromOutput(wlr_output*);
|
CMonitor* getRealMonitorFromOutput(wlr_output*);
|
||||||
CWindow* getWindowFromSurface(wlr_surface*);
|
PHLWINDOW getWindowFromSurface(wlr_surface*);
|
||||||
CWindow* getWindowFromHandle(uint32_t);
|
PHLWINDOW getWindowFromHandle(uint32_t);
|
||||||
bool isWorkspaceVisible(PHLWORKSPACE);
|
bool isWorkspaceVisible(PHLWORKSPACE);
|
||||||
PHLWORKSPACE getWorkspaceByID(const int&);
|
PHLWORKSPACE getWorkspaceByID(const int&);
|
||||||
PHLWORKSPACE getWorkspaceByName(const std::string&);
|
PHLWORKSPACE getWorkspaceByName(const std::string&);
|
||||||
|
@ -141,18 +139,18 @@ class CCompositor {
|
||||||
void updateWorkspaceSpecialRenderData(const int&);
|
void updateWorkspaceSpecialRenderData(const int&);
|
||||||
int getWindowsOnWorkspace(const int& id, std::optional<bool> onlyTiled = {}, std::optional<bool> onlyVisible = {});
|
int getWindowsOnWorkspace(const int& id, std::optional<bool> onlyTiled = {}, std::optional<bool> onlyVisible = {});
|
||||||
int getGroupsOnWorkspace(const int& id, std::optional<bool> onlyTiled = {}, std::optional<bool> onlyVisible = {});
|
int getGroupsOnWorkspace(const int& id, std::optional<bool> onlyTiled = {}, std::optional<bool> onlyVisible = {});
|
||||||
CWindow* getUrgentWindow();
|
PHLWINDOW getUrgentWindow();
|
||||||
bool hasUrgentWindowOnWorkspace(const int&);
|
bool hasUrgentWindowOnWorkspace(const int&);
|
||||||
CWindow* getFirstWindowOnWorkspace(const int&);
|
PHLWINDOW getFirstWindowOnWorkspace(const int&);
|
||||||
CWindow* getTopLeftWindowOnWorkspace(const int&);
|
PHLWINDOW getTopLeftWindowOnWorkspace(const int&);
|
||||||
CWindow* getFullscreenWindowOnWorkspace(const int&);
|
PHLWINDOW getFullscreenWindowOnWorkspace(const int&);
|
||||||
bool doesSeatAcceptInput(wlr_surface*);
|
bool doesSeatAcceptInput(wlr_surface*);
|
||||||
bool isWindowActive(CWindow*);
|
bool isWindowActive(PHLWINDOW);
|
||||||
void changeWindowZOrder(CWindow*, bool);
|
void changeWindowZOrder(PHLWINDOW, bool);
|
||||||
void cleanupFadingOut(const int& monid);
|
void cleanupFadingOut(const int& monid);
|
||||||
CWindow* getWindowInDirection(CWindow*, char);
|
PHLWINDOW getWindowInDirection(PHLWINDOW, char);
|
||||||
CWindow* getNextWindowOnWorkspace(CWindow*, bool focusableOnly = false, std::optional<bool> floating = {});
|
PHLWINDOW getNextWindowOnWorkspace(PHLWINDOW, bool focusableOnly = false, std::optional<bool> floating = {});
|
||||||
CWindow* getPrevWindowOnWorkspace(CWindow*, bool focusableOnly = false, std::optional<bool> floating = {});
|
PHLWINDOW getPrevWindowOnWorkspace(PHLWINDOW, bool focusableOnly = false, std::optional<bool> floating = {});
|
||||||
int getNextAvailableNamedWorkspace();
|
int getNextAvailableNamedWorkspace();
|
||||||
bool isPointOnAnyMonitor(const Vector2D&);
|
bool isPointOnAnyMonitor(const Vector2D&);
|
||||||
bool isPointOnReservedArea(const Vector2D& point, const CMonitor* monitor = nullptr);
|
bool isPointOnReservedArea(const Vector2D& point, const CMonitor* monitor = nullptr);
|
||||||
|
@ -160,23 +158,23 @@ class CCompositor {
|
||||||
CMonitor* getMonitorInDirection(CMonitor*, const char&);
|
CMonitor* getMonitorInDirection(CMonitor*, const char&);
|
||||||
void updateAllWindowsAnimatedDecorationValues();
|
void updateAllWindowsAnimatedDecorationValues();
|
||||||
void updateWorkspaceWindows(const int64_t& id);
|
void updateWorkspaceWindows(const int64_t& id);
|
||||||
void updateWindowAnimatedDecorationValues(CWindow*);
|
void updateWindowAnimatedDecorationValues(PHLWINDOW);
|
||||||
int getNextAvailableMonitorID(std::string const& name);
|
int getNextAvailableMonitorID(std::string const& name);
|
||||||
void moveWorkspaceToMonitor(PHLWORKSPACE, CMonitor*, bool noWarpCursor = false);
|
void moveWorkspaceToMonitor(PHLWORKSPACE, CMonitor*, bool noWarpCursor = false);
|
||||||
void swapActiveWorkspaces(CMonitor*, CMonitor*);
|
void swapActiveWorkspaces(CMonitor*, CMonitor*);
|
||||||
CMonitor* getMonitorFromString(const std::string&);
|
CMonitor* getMonitorFromString(const std::string&);
|
||||||
bool workspaceIDOutOfBounds(const int64_t&);
|
bool workspaceIDOutOfBounds(const int64_t&);
|
||||||
void setWindowFullscreen(CWindow*, bool, eFullscreenMode mode = FULLSCREEN_INVALID);
|
void setWindowFullscreen(PHLWINDOW, bool, eFullscreenMode mode = FULLSCREEN_INVALID);
|
||||||
void updateFullscreenFadeOnWorkspace(PHLWORKSPACE);
|
void updateFullscreenFadeOnWorkspace(PHLWORKSPACE);
|
||||||
CWindow* getX11Parent(CWindow*);
|
PHLWINDOW getX11Parent(PHLWINDOW);
|
||||||
void scheduleFrameForMonitor(CMonitor*);
|
void scheduleFrameForMonitor(CMonitor*);
|
||||||
void addToFadingOutSafe(SLayerSurface*);
|
void addToFadingOutSafe(SLayerSurface*);
|
||||||
void addToFadingOutSafe(CWindow*);
|
void addToFadingOutSafe(PHLWINDOW);
|
||||||
CWindow* getWindowByRegex(const std::string&);
|
PHLWINDOW getWindowByRegex(const std::string&);
|
||||||
void warpCursorTo(const Vector2D&, bool force = false);
|
void warpCursorTo(const Vector2D&, bool force = false);
|
||||||
SLayerSurface* getLayerSurfaceFromWlr(wlr_layer_surface_v1*);
|
SLayerSurface* getLayerSurfaceFromWlr(wlr_layer_surface_v1*);
|
||||||
SLayerSurface* getLayerSurfaceFromSurface(wlr_surface*);
|
SLayerSurface* getLayerSurfaceFromSurface(wlr_surface*);
|
||||||
void closeWindow(CWindow*);
|
void closeWindow(PHLWINDOW);
|
||||||
Vector2D parseWindowVectorArgsRelative(const std::string&, const Vector2D&);
|
Vector2D parseWindowVectorArgsRelative(const std::string&, const Vector2D&);
|
||||||
void forceReportSizesToWindowsOnWorkspace(const int&);
|
void forceReportSizesToWindowsOnWorkspace(const int&);
|
||||||
PHLWORKSPACE createNewWorkspace(const int&, const int&, const std::string& name = ""); // will be deleted next frame if left empty and unfocused!
|
PHLWORKSPACE createNewWorkspace(const int&, const int&, const std::string& name = ""); // will be deleted next frame if left empty and unfocused!
|
||||||
|
@ -185,8 +183,8 @@ class CCompositor {
|
||||||
bool isWorkspaceSpecial(const int&);
|
bool isWorkspaceSpecial(const int&);
|
||||||
int getNewSpecialID();
|
int getNewSpecialID();
|
||||||
void performUserChecks();
|
void performUserChecks();
|
||||||
void moveWindowToWorkspaceSafe(CWindow* pWindow, PHLWORKSPACE pWorkspace);
|
void moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWorkspace);
|
||||||
CWindow* getForceFocus();
|
PHLWINDOW getForceFocus();
|
||||||
void notifyIdleActivity();
|
void notifyIdleActivity();
|
||||||
void setIdleActivityInhibit(bool inhibit);
|
void setIdleActivityInhibit(bool inhibit);
|
||||||
void arrangeMonitors();
|
void arrangeMonitors();
|
||||||
|
@ -195,6 +193,7 @@ class CCompositor {
|
||||||
void setPreferredScaleForSurface(wlr_surface* pSurface, double scale);
|
void setPreferredScaleForSurface(wlr_surface* pSurface, double scale);
|
||||||
void setPreferredTransformForSurface(wlr_surface* pSurface, wl_output_transform transform);
|
void setPreferredTransformForSurface(wlr_surface* pSurface, wl_output_transform transform);
|
||||||
void updateSuspendedStates();
|
void updateSuspendedStates();
|
||||||
|
PHLWINDOW windowForCPointer(CWindow*);
|
||||||
|
|
||||||
std::string explicitConfigPath;
|
std::string explicitConfigPath;
|
||||||
|
|
||||||
|
|
|
@ -1018,8 +1018,8 @@ SWorkspaceRule CConfigManager::mergeWorkspaceRules(const SWorkspaceRule& rule1,
|
||||||
return mergedRule;
|
return mergedRule;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<SWindowRule> CConfigManager::getMatchingRules(CWindow* pWindow, bool dynamic, bool shadowExec) {
|
std::vector<SWindowRule> CConfigManager::getMatchingRules(PHLWINDOW pWindow, bool dynamic, bool shadowExec) {
|
||||||
if (!g_pCompositor->windowExists(pWindow))
|
if (!valid(pWindow))
|
||||||
return std::vector<SWindowRule>();
|
return std::vector<SWindowRule>();
|
||||||
|
|
||||||
std::vector<SWindowRule> returns;
|
std::vector<SWindowRule> returns;
|
||||||
|
@ -1104,7 +1104,7 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(CWindow* pWindow, bool
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rule.bFocus != -1) {
|
if (rule.bFocus != -1) {
|
||||||
if (rule.bFocus != (g_pCompositor->m_pLastWindow == pWindow))
|
if (rule.bFocus != (g_pCompositor->m_pLastWindow.lock() == pWindow))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ class CConfigManager {
|
||||||
std::string getBoundMonitorStringForWS(const std::string&);
|
std::string getBoundMonitorStringForWS(const std::string&);
|
||||||
const std::deque<SWorkspaceRule>& getAllWorkspaceRules();
|
const std::deque<SWorkspaceRule>& getAllWorkspaceRules();
|
||||||
|
|
||||||
std::vector<SWindowRule> getMatchingRules(CWindow*, bool dynamic = true, bool shadowExec = false);
|
std::vector<SWindowRule> getMatchingRules(PHLWINDOW, bool dynamic = true, bool shadowExec = false);
|
||||||
std::vector<SLayerRule> getMatchingRules(SLayerSurface*);
|
std::vector<SLayerRule> getMatchingRules(SLayerSurface*);
|
||||||
|
|
||||||
std::unordered_map<std::string, SMonitorAdditionalReservedArea> m_mAdditionalReservedAreas;
|
std::unordered_map<std::string, SMonitorAdditionalReservedArea> m_mAdditionalReservedAreas;
|
||||||
|
|
|
@ -141,21 +141,21 @@ std::string monitorsRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string getGroupedData(CWindow* w, eHyprCtlOutputFormat format) {
|
static std::string getGroupedData(PHLWINDOW w, eHyprCtlOutputFormat format) {
|
||||||
const bool isJson = format == eHyprCtlOutputFormat::FORMAT_JSON;
|
const bool isJson = format == eHyprCtlOutputFormat::FORMAT_JSON;
|
||||||
if (!w->m_sGroupData.pNextWindow)
|
if (w->m_sGroupData.pNextWindow.expired())
|
||||||
return isJson ? "" : "0";
|
return isJson ? "" : "0";
|
||||||
|
|
||||||
std::ostringstream result;
|
std::ostringstream result;
|
||||||
|
|
||||||
CWindow* head = w->getGroupHead();
|
PHLWINDOW head = w->getGroupHead();
|
||||||
CWindow* curr = head;
|
PHLWINDOW curr = head;
|
||||||
while (true) {
|
while (true) {
|
||||||
if (isJson)
|
if (isJson)
|
||||||
result << std::format("\"0x{:x}\"", (uintptr_t)curr);
|
result << std::format("\"0x{:x}\"", (uintptr_t)curr.get());
|
||||||
else
|
else
|
||||||
result << std::format("{:x}", (uintptr_t)curr);
|
result << std::format("{:x}", (uintptr_t)curr.get());
|
||||||
curr = curr->m_sGroupData.pNextWindow;
|
curr = curr->m_sGroupData.pNextWindow.lock();
|
||||||
// We've wrapped around to the start, break out without trailing comma
|
// We've wrapped around to the start, break out without trailing comma
|
||||||
if (curr == head)
|
if (curr == head)
|
||||||
break;
|
break;
|
||||||
|
@ -165,10 +165,10 @@ static std::string getGroupedData(CWindow* w, eHyprCtlOutputFormat format) {
|
||||||
return result.str();
|
return result.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string getWindowData(CWindow* w, eHyprCtlOutputFormat format) {
|
static std::string getWindowData(PHLWINDOW w, eHyprCtlOutputFormat format) {
|
||||||
auto getFocusHistoryID = [](CWindow* wnd) -> int {
|
auto getFocusHistoryID = [](PHLWINDOW wnd) -> int {
|
||||||
for (size_t i = 0; i < g_pCompositor->m_vWindowFocusHistory.size(); ++i) {
|
for (size_t i = 0; i < g_pCompositor->m_vWindowFocusHistory.size(); ++i) {
|
||||||
if (g_pCompositor->m_vWindowFocusHistory[i] == wnd)
|
if (g_pCompositor->m_vWindowFocusHistory[i].lock() == wnd)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -202,24 +202,24 @@ static std::string getWindowData(CWindow* w, eHyprCtlOutputFormat format) {
|
||||||
"swallowing": "0x{:x}",
|
"swallowing": "0x{:x}",
|
||||||
"focusHistoryID": {}
|
"focusHistoryID": {}
|
||||||
}},)#",
|
}},)#",
|
||||||
(uintptr_t)w, (w->m_bIsMapped ? "true" : "false"), (w->isHidden() ? "true" : "false"), (int)w->m_vRealPosition.goal().x, (int)w->m_vRealPosition.goal().y,
|
(uintptr_t)w.get(), (w->m_bIsMapped ? "true" : "false"), (w->isHidden() ? "true" : "false"), (int)w->m_vRealPosition.goal().x, (int)w->m_vRealPosition.goal().y,
|
||||||
(int)w->m_vRealSize.goal().x, (int)w->m_vRealSize.goal().y, w->m_pWorkspace ? w->workspaceID() : WORKSPACE_INVALID,
|
(int)w->m_vRealSize.goal().x, (int)w->m_vRealSize.goal().y, w->m_pWorkspace ? w->workspaceID() : WORKSPACE_INVALID,
|
||||||
escapeJSONStrings(!w->m_pWorkspace ? "" : w->m_pWorkspace->m_szName), ((int)w->m_bIsFloating == 1 ? "true" : "false"), (int64_t)w->m_iMonitorID,
|
escapeJSONStrings(!w->m_pWorkspace ? "" : w->m_pWorkspace->m_szName), ((int)w->m_bIsFloating == 1 ? "true" : "false"), (int64_t)w->m_iMonitorID,
|
||||||
escapeJSONStrings(g_pXWaylandManager->getAppIDClass(w)), escapeJSONStrings(g_pXWaylandManager->getTitle(w)), escapeJSONStrings(w->m_szInitialClass),
|
escapeJSONStrings(g_pXWaylandManager->getAppIDClass(w)), escapeJSONStrings(g_pXWaylandManager->getTitle(w)), escapeJSONStrings(w->m_szInitialClass),
|
||||||
escapeJSONStrings(w->m_szInitialTitle), w->getPID(), ((int)w->m_bIsX11 == 1 ? "true" : "false"), (w->m_bPinned ? "true" : "false"),
|
escapeJSONStrings(w->m_szInitialTitle), w->getPID(), ((int)w->m_bIsX11 == 1 ? "true" : "false"), (w->m_bPinned ? "true" : "false"),
|
||||||
(w->m_bIsFullscreen ? "true" : "false"), (w->m_bIsFullscreen ? (w->m_pWorkspace ? (int)w->m_pWorkspace->m_efFullscreenMode : 0) : 0),
|
(w->m_bIsFullscreen ? "true" : "false"), (w->m_bIsFullscreen ? (w->m_pWorkspace ? (int)w->m_pWorkspace->m_efFullscreenMode : 0) : 0),
|
||||||
w->m_bFakeFullscreenState ? "true" : "false", getGroupedData(w, format), (uintptr_t)w->m_pSwallowed, getFocusHistoryID(w));
|
w->m_bFakeFullscreenState ? "true" : "false", getGroupedData(w, format), (uintptr_t)w->m_pSwallowed.lock().get(), getFocusHistoryID(w));
|
||||||
} else {
|
} else {
|
||||||
return std::format("Window {:x} -> {}:\n\tmapped: {}\n\thidden: {}\n\tat: {},{}\n\tsize: {},{}\n\tworkspace: {} ({})\n\tfloating: {}\n\tmonitor: {}\n\tclass: {}\n\ttitle: "
|
return std::format("Window {:x} -> {}:\n\tmapped: {}\n\thidden: {}\n\tat: {},{}\n\tsize: {},{}\n\tworkspace: {} ({})\n\tfloating: {}\n\tmonitor: {}\n\tclass: {}\n\ttitle: "
|
||||||
"{}\n\tinitialClass: {}\n\tinitialTitle: {}\n\tpid: "
|
"{}\n\tinitialClass: {}\n\tinitialTitle: {}\n\tpid: "
|
||||||
"{}\n\txwayland: {}\n\tpinned: "
|
"{}\n\txwayland: {}\n\tpinned: "
|
||||||
"{}\n\tfullscreen: {}\n\tfullscreenmode: {}\n\tfakefullscreen: {}\n\tgrouped: {}\n\tswallowing: {:x}\n\tfocusHistoryID: {}\n\n",
|
"{}\n\tfullscreen: {}\n\tfullscreenmode: {}\n\tfakefullscreen: {}\n\tgrouped: {}\n\tswallowing: {:x}\n\tfocusHistoryID: {}\n\n",
|
||||||
(uintptr_t)w, w->m_szTitle, (int)w->m_bIsMapped, (int)w->isHidden(), (int)w->m_vRealPosition.goal().x, (int)w->m_vRealPosition.goal().y,
|
(uintptr_t)w.get(), w->m_szTitle, (int)w->m_bIsMapped, (int)w->isHidden(), (int)w->m_vRealPosition.goal().x, (int)w->m_vRealPosition.goal().y,
|
||||||
(int)w->m_vRealSize.goal().x, (int)w->m_vRealSize.goal().y, w->m_pWorkspace ? w->workspaceID() : WORKSPACE_INVALID,
|
(int)w->m_vRealSize.goal().x, (int)w->m_vRealSize.goal().y, w->m_pWorkspace ? w->workspaceID() : WORKSPACE_INVALID,
|
||||||
(!w->m_pWorkspace ? "" : w->m_pWorkspace->m_szName), (int)w->m_bIsFloating, (int64_t)w->m_iMonitorID, g_pXWaylandManager->getAppIDClass(w),
|
(!w->m_pWorkspace ? "" : w->m_pWorkspace->m_szName), (int)w->m_bIsFloating, (int64_t)w->m_iMonitorID, g_pXWaylandManager->getAppIDClass(w),
|
||||||
g_pXWaylandManager->getTitle(w), w->m_szInitialClass, w->m_szInitialTitle, w->getPID(), (int)w->m_bIsX11, (int)w->m_bPinned, (int)w->m_bIsFullscreen,
|
g_pXWaylandManager->getTitle(w), w->m_szInitialClass, w->m_szInitialTitle, w->getPID(), (int)w->m_bIsX11, (int)w->m_bPinned, (int)w->m_bIsFullscreen,
|
||||||
(w->m_bIsFullscreen ? (w->m_pWorkspace ? w->m_pWorkspace->m_efFullscreenMode : 0) : 0), (int)w->m_bFakeFullscreenState, getGroupedData(w, format),
|
(w->m_bIsFullscreen ? (w->m_pWorkspace ? w->m_pWorkspace->m_efFullscreenMode : 0) : 0), (int)w->m_bFakeFullscreenState, getGroupedData(w, format),
|
||||||
(uintptr_t)w->m_pSwallowed, getFocusHistoryID(w));
|
(uintptr_t)w->m_pSwallowed.lock().get(), getFocusHistoryID(w));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ std::string clientsRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
if (!w->m_bIsMapped && !g_pHyprCtl->m_sCurrentRequestParams.all)
|
if (!w->m_bIsMapped && !g_pHyprCtl->m_sCurrentRequestParams.all)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
result += getWindowData(w.get(), format);
|
result += getWindowData(w, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
trimTrailingComma(result);
|
trimTrailingComma(result);
|
||||||
|
@ -243,7 +243,7 @@ std::string clientsRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
if (!w->m_bIsMapped && !g_pHyprCtl->m_sCurrentRequestParams.all)
|
if (!w->m_bIsMapped && !g_pHyprCtl->m_sCurrentRequestParams.all)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
result += getWindowData(w.get(), format);
|
result += getWindowData(w, format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -265,11 +265,11 @@ static std::string getWorkspaceData(PHLWORKSPACE w, eHyprCtlOutputFormat format)
|
||||||
}})#",
|
}})#",
|
||||||
w->m_iID, escapeJSONStrings(w->m_szName), escapeJSONStrings(PMONITOR ? PMONITOR->szName : "?"),
|
w->m_iID, escapeJSONStrings(w->m_szName), escapeJSONStrings(PMONITOR ? PMONITOR->szName : "?"),
|
||||||
escapeJSONStrings(PMONITOR ? std::to_string(PMONITOR->ID) : "null"), g_pCompositor->getWindowsOnWorkspace(w->m_iID),
|
escapeJSONStrings(PMONITOR ? std::to_string(PMONITOR->ID) : "null"), g_pCompositor->getWindowsOnWorkspace(w->m_iID),
|
||||||
((int)w->m_bHasFullscreenWindow == 1 ? "true" : "false"), (uintptr_t)PLASTW, PLASTW ? escapeJSONStrings(PLASTW->m_szTitle) : "");
|
((int)w->m_bHasFullscreenWindow == 1 ? "true" : "false"), (uintptr_t)PLASTW.get(), PLASTW ? escapeJSONStrings(PLASTW->m_szTitle) : "");
|
||||||
} else {
|
} else {
|
||||||
return std::format("workspace ID {} ({}) on monitor {}:\n\tmonitorID: {}\n\twindows: {}\n\thasfullscreen: {}\n\tlastwindow: 0x{:x}\n\tlastwindowtitle: {}\n\n", w->m_iID,
|
return std::format("workspace ID {} ({}) on monitor {}:\n\tmonitorID: {}\n\twindows: {}\n\thasfullscreen: {}\n\tlastwindow: 0x{:x}\n\tlastwindowtitle: {}\n\n", w->m_iID,
|
||||||
w->m_szName, PMONITOR ? PMONITOR->szName : "?", PMONITOR ? std::to_string(PMONITOR->ID) : "null", g_pCompositor->getWindowsOnWorkspace(w->m_iID),
|
w->m_szName, PMONITOR ? PMONITOR->szName : "?", PMONITOR ? std::to_string(PMONITOR->ID) : "null", g_pCompositor->getWindowsOnWorkspace(w->m_iID),
|
||||||
(int)w->m_bHasFullscreenWindow, (uintptr_t)PLASTW, PLASTW ? PLASTW->m_szTitle : "");
|
(int)w->m_bHasFullscreenWindow, (uintptr_t)PLASTW.get(), PLASTW ? PLASTW->m_szTitle : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,9 +374,9 @@ std::string workspaceRulesRequest(eHyprCtlOutputFormat format, std::string reque
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string activeWindowRequest(eHyprCtlOutputFormat format, std::string request) {
|
std::string activeWindowRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
const auto PWINDOW = g_pCompositor->m_pLastWindow;
|
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!g_pCompositor->windowValidMapped(PWINDOW))
|
if (!validMapped(PWINDOW))
|
||||||
return format == eHyprCtlOutputFormat::FORMAT_JSON ? "{}" : "Invalid";
|
return format == eHyprCtlOutputFormat::FORMAT_JSON ? "{}" : "Invalid";
|
||||||
|
|
||||||
auto result = getWindowData(PWINDOW, format);
|
auto result = getWindowData(PWINDOW, format);
|
||||||
|
@ -1142,7 +1142,7 @@ std::string dispatchSetProp(eHyprCtlOutputFormat format, std::string request) {
|
||||||
if (vars.size() < 4)
|
if (vars.size() < 4)
|
||||||
return "not enough args";
|
return "not enough args";
|
||||||
|
|
||||||
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow;
|
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
const auto PWINDOW = g_pCompositor->getWindowByRegex(vars[1]);
|
const auto PWINDOW = g_pCompositor->getWindowByRegex(vars[1]);
|
||||||
|
|
||||||
if (!PWINDOW)
|
if (!PWINDOW)
|
||||||
|
|
|
@ -3,3 +3,10 @@
|
||||||
#include "helpers/WLListener.hpp"
|
#include "helpers/WLListener.hpp"
|
||||||
#include "helpers/Color.hpp"
|
#include "helpers/Color.hpp"
|
||||||
#include "macros.hpp"
|
#include "macros.hpp"
|
||||||
|
|
||||||
|
class CWindow;
|
||||||
|
|
||||||
|
/* Shared pointer to a window */
|
||||||
|
typedef SP<CWindow> PHLWINDOW;
|
||||||
|
/* Weak pointer to a window */
|
||||||
|
typedef WP<CWindow> PHLWINDOWREF;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "../config/ConfigValue.hpp"
|
#include "../config/ConfigValue.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
|
|
||||||
CPopup::CPopup(CWindow* pOwner) : m_pWindowOwner(pOwner) {
|
CPopup::CPopup(PHLWINDOW pOwner) : m_pWindowOwner(pOwner) {
|
||||||
initAllSignals();
|
initAllSignals();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,8 +69,8 @@ static void onRepositionPopup(void* owner, void* data) {
|
||||||
void CPopup::initAllSignals() {
|
void CPopup::initAllSignals() {
|
||||||
|
|
||||||
if (!m_pWLR) {
|
if (!m_pWLR) {
|
||||||
if (m_pWindowOwner)
|
if (!m_pWindowOwner.expired())
|
||||||
hyprListener_newPopup.initCallback(&m_pWindowOwner->m_uSurface.xdg->events.new_popup, ::onNewPopup, this, "CPopup Head");
|
hyprListener_newPopup.initCallback(&m_pWindowOwner.lock()->m_uSurface.xdg->events.new_popup, ::onNewPopup, this, "CPopup Head");
|
||||||
else if (m_pLayerOwner)
|
else if (m_pLayerOwner)
|
||||||
hyprListener_newPopup.initCallback(&m_pLayerOwner->layerSurface->events.new_popup, ::onNewPopup, this, "CPopup Head");
|
hyprListener_newPopup.initCallback(&m_pLayerOwner->layerSurface->events.new_popup, ::onNewPopup, this, "CPopup Head");
|
||||||
else
|
else
|
||||||
|
@ -146,12 +146,12 @@ void CPopup::onCommit(bool ignoreSiblings) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pWindowOwner && (!m_pWindowOwner->m_bIsMapped || !m_pWindowOwner->m_pWorkspace->m_bVisible)) {
|
if (!m_pWindowOwner.expired() && (!m_pWindowOwner.lock()->m_bIsMapped || !m_pWindowOwner.lock()->m_pWorkspace->m_bVisible)) {
|
||||||
m_vLastSize = {m_pWLR->base->current.geometry.width, m_pWLR->base->current.geometry.height};
|
m_vLastSize = {m_pWLR->base->current.geometry.width, m_pWLR->base->current.geometry.height};
|
||||||
|
|
||||||
static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
|
static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
|
||||||
if (*PLOGDAMAGE)
|
if (*PLOGDAMAGE)
|
||||||
Debug::log(LOG, "Refusing to commit damage from a subsurface of {} because it's invisible.", m_pWindowOwner);
|
Debug::log(LOG, "Refusing to commit damage from a subsurface of {} because it's invisible.", m_pWindowOwner.lock());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,8 +230,8 @@ Vector2D CPopup::localToGlobal(const Vector2D& rel) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D CPopup::t1ParentCoords() {
|
Vector2D CPopup::t1ParentCoords() {
|
||||||
if (m_pWindowOwner)
|
if (!m_pWindowOwner.expired())
|
||||||
return m_pWindowOwner->m_vRealPosition.value();
|
return m_pWindowOwner.lock()->m_vRealPosition.value();
|
||||||
if (m_pLayerOwner)
|
if (m_pLayerOwner)
|
||||||
return m_pLayerOwner->realPosition.value();
|
return m_pLayerOwner->realPosition.value();
|
||||||
|
|
||||||
|
@ -260,8 +260,8 @@ Vector2D CPopup::size() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPopup::sendScale() {
|
void CPopup::sendScale() {
|
||||||
if (m_pWindowOwner)
|
if (!m_pWindowOwner.expired())
|
||||||
g_pCompositor->setPreferredScaleForSurface(m_sWLSurface.wlr(), m_pWindowOwner->m_pWLSurface.m_fLastScale);
|
g_pCompositor->setPreferredScaleForSurface(m_sWLSurface.wlr(), m_pWindowOwner.lock()->m_pWLSurface.m_fLastScale);
|
||||||
else if (m_pLayerOwner)
|
else if (m_pLayerOwner)
|
||||||
g_pCompositor->setPreferredScaleForSurface(m_sWLSurface.wlr(), m_pLayerOwner->surface.m_fLastScale);
|
g_pCompositor->setPreferredScaleForSurface(m_sWLSurface.wlr(), m_pLayerOwner->surface.m_fLastScale);
|
||||||
else
|
else
|
||||||
|
|
|
@ -9,7 +9,7 @@ struct SLayerSurface;
|
||||||
class CPopup {
|
class CPopup {
|
||||||
public:
|
public:
|
||||||
// dummy head nodes
|
// dummy head nodes
|
||||||
CPopup(CWindow* pOwner);
|
CPopup(PHLWINDOW pOwner);
|
||||||
CPopup(SLayerSurface* pOwner);
|
CPopup(SLayerSurface* pOwner);
|
||||||
|
|
||||||
// real nodes
|
// real nodes
|
||||||
|
@ -35,8 +35,8 @@ class CPopup {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// T1 owners, each popup has to have one of these
|
// T1 owners, each popup has to have one of these
|
||||||
CWindow* m_pWindowOwner = nullptr;
|
PHLWINDOWREF m_pWindowOwner;
|
||||||
SLayerSurface* m_pLayerOwner = nullptr;
|
SLayerSurface* m_pLayerOwner = nullptr;
|
||||||
|
|
||||||
// T2 owners
|
// T2 owners
|
||||||
CPopup* m_pParent = nullptr;
|
CPopup* m_pParent = nullptr;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
static void onNewSubsurface(void* owner, void* data);
|
static void onNewSubsurface(void* owner, void* data);
|
||||||
|
|
||||||
CSubsurface::CSubsurface(CWindow* pOwner) : m_pWindowParent(pOwner) {
|
CSubsurface::CSubsurface(PHLWINDOW pOwner) : m_pWindowParent(pOwner) {
|
||||||
initSignals();
|
initSignals();
|
||||||
initExistingSubsurfaces(pOwner->m_pWLSurface.wlr());
|
initExistingSubsurfaces(pOwner->m_pWLSurface.wlr());
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ CSubsurface::CSubsurface(CPopup* pOwner) : m_pPopupParent(pOwner) {
|
||||||
initExistingSubsurfaces(pOwner->m_sWLSurface.wlr());
|
initExistingSubsurfaces(pOwner->m_sWLSurface.wlr());
|
||||||
}
|
}
|
||||||
|
|
||||||
CSubsurface::CSubsurface(wlr_subsurface* pSubsurface, CWindow* pOwner) : m_pSubsurface(pSubsurface), m_pWindowParent(pOwner) {
|
CSubsurface::CSubsurface(wlr_subsurface* pSubsurface, PHLWINDOW pOwner) : m_pSubsurface(pSubsurface), m_pWindowParent(pOwner) {
|
||||||
m_sWLSurface.assign(pSubsurface->surface, this);
|
m_sWLSurface.assign(pSubsurface->surface, this);
|
||||||
initSignals();
|
initSignals();
|
||||||
initExistingSubsurfaces(pSubsurface->surface);
|
initExistingSubsurfaces(pSubsurface->surface);
|
||||||
|
@ -73,8 +73,8 @@ void CSubsurface::initSignals() {
|
||||||
hyprListener_mapSubsurface.initCallback(&m_pSubsurface->surface->events.map, &onMapSubsurface, this, "CSubsurface");
|
hyprListener_mapSubsurface.initCallback(&m_pSubsurface->surface->events.map, &onMapSubsurface, this, "CSubsurface");
|
||||||
hyprListener_unmapSubsurface.initCallback(&m_pSubsurface->surface->events.unmap, &onUnmapSubsurface, this, "CSubsurface");
|
hyprListener_unmapSubsurface.initCallback(&m_pSubsurface->surface->events.unmap, &onUnmapSubsurface, this, "CSubsurface");
|
||||||
} else {
|
} else {
|
||||||
if (m_pWindowParent)
|
if (!m_pWindowParent.expired())
|
||||||
hyprListener_newSubsurface.initCallback(&m_pWindowParent->m_pWLSurface.wlr()->events.new_subsurface, &::onNewSubsurface, this, "CSubsurface Head");
|
hyprListener_newSubsurface.initCallback(&m_pWindowParent.lock()->m_pWLSurface.wlr()->events.new_subsurface, &::onNewSubsurface, this, "CSubsurface Head");
|
||||||
else if (m_pPopupParent)
|
else if (m_pPopupParent)
|
||||||
hyprListener_newSubsurface.initCallback(&m_pPopupParent->m_sWLSurface.wlr()->events.new_subsurface, &::onNewSubsurface, this, "CSubsurface Head");
|
hyprListener_newSubsurface.initCallback(&m_pPopupParent->m_sWLSurface.wlr()->events.new_subsurface, &::onNewSubsurface, this, "CSubsurface Head");
|
||||||
else
|
else
|
||||||
|
@ -86,7 +86,7 @@ void CSubsurface::checkSiblingDamage() {
|
||||||
if (!m_pParent)
|
if (!m_pParent)
|
||||||
return; // ??????????
|
return; // ??????????
|
||||||
|
|
||||||
const double SCALE = m_pWindowParent && m_pWindowParent->m_bIsX11 ? 1.0 / m_pWindowParent->m_fX11SurfaceScaledBy : 1.0;
|
const double SCALE = m_pWindowParent.lock() && m_pWindowParent.lock()->m_bIsX11 ? 1.0 / m_pWindowParent.lock()->m_fX11SurfaceScaledBy : 1.0;
|
||||||
|
|
||||||
for (auto& n : m_pParent->m_vChildren) {
|
for (auto& n : m_pParent->m_vChildren) {
|
||||||
if (n.get() == this)
|
if (n.get() == this)
|
||||||
|
@ -106,12 +106,12 @@ void CSubsurface::recheckDamageForSubsurfaces() {
|
||||||
|
|
||||||
void CSubsurface::onCommit() {
|
void CSubsurface::onCommit() {
|
||||||
// no damaging if it's not visible
|
// no damaging if it's not visible
|
||||||
if (m_pWindowParent && (!m_pWindowParent->m_bIsMapped || !m_pWindowParent->m_pWorkspace->m_bVisible)) {
|
if (!m_pWindowParent.expired() && (!m_pWindowParent.lock()->m_bIsMapped || !m_pWindowParent.lock()->m_pWorkspace->m_bVisible)) {
|
||||||
m_vLastSize = Vector2D{m_sWLSurface.wlr()->current.width, m_sWLSurface.wlr()->current.height};
|
m_vLastSize = Vector2D{m_sWLSurface.wlr()->current.width, m_sWLSurface.wlr()->current.height};
|
||||||
|
|
||||||
static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
|
static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
|
||||||
if (*PLOGDAMAGE)
|
if (*PLOGDAMAGE)
|
||||||
Debug::log(LOG, "Refusing to commit damage from a subsurface of {} because it's invisible.", m_pWindowParent);
|
Debug::log(LOG, "Refusing to commit damage from a subsurface of {} because it's invisible.", m_pWindowParent.lock());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,8 +121,8 @@ void CSubsurface::onCommit() {
|
||||||
|
|
||||||
if (m_pPopupParent)
|
if (m_pPopupParent)
|
||||||
m_pPopupParent->recheckTree();
|
m_pPopupParent->recheckTree();
|
||||||
if (m_pWindowParent) // I hate you firefox why are you doing this
|
if (!m_pWindowParent.expired()) // I hate you firefox why are you doing this
|
||||||
m_pWindowParent->m_pPopupHead->recheckTree();
|
m_pWindowParent.lock()->m_pPopupHead->recheckTree();
|
||||||
|
|
||||||
// I do not think this is correct, but it solves a lot of issues with some apps (e.g. firefox)
|
// I do not think this is correct, but it solves a lot of issues with some apps (e.g. firefox)
|
||||||
checkSiblingDamage();
|
checkSiblingDamage();
|
||||||
|
@ -152,8 +152,8 @@ void CSubsurface::onDestroy() {
|
||||||
void CSubsurface::onNewSubsurface(wlr_subsurface* pSubsurface) {
|
void CSubsurface::onNewSubsurface(wlr_subsurface* pSubsurface) {
|
||||||
CSubsurface* PSUBSURFACE = nullptr;
|
CSubsurface* PSUBSURFACE = nullptr;
|
||||||
|
|
||||||
if (m_pWindowParent)
|
if (!m_pWindowParent.expired())
|
||||||
PSUBSURFACE = m_vChildren.emplace_back(std::make_unique<CSubsurface>(pSubsurface, m_pWindowParent)).get();
|
PSUBSURFACE = m_vChildren.emplace_back(std::make_unique<CSubsurface>(pSubsurface, m_pWindowParent.lock())).get();
|
||||||
else if (m_pPopupParent)
|
else if (m_pPopupParent)
|
||||||
PSUBSURFACE = m_vChildren.emplace_back(std::make_unique<CSubsurface>(pSubsurface, m_pPopupParent)).get();
|
PSUBSURFACE = m_vChildren.emplace_back(std::make_unique<CSubsurface>(pSubsurface, m_pPopupParent)).get();
|
||||||
PSUBSURFACE->m_pParent = this;
|
PSUBSURFACE->m_pParent = this;
|
||||||
|
@ -169,8 +169,8 @@ void CSubsurface::onMap() {
|
||||||
box.expand(4);
|
box.expand(4);
|
||||||
g_pHyprRenderer->damageBox(&box);
|
g_pHyprRenderer->damageBox(&box);
|
||||||
|
|
||||||
if (m_pWindowParent)
|
if (!m_pWindowParent.expired())
|
||||||
m_pWindowParent->updateSurfaceScaleTransformDetails();
|
m_pWindowParent.lock()->updateSurfaceScaleTransformDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSubsurface::onUnmap() {
|
void CSubsurface::onUnmap() {
|
||||||
|
@ -206,8 +206,8 @@ Vector2D CSubsurface::coordsRelativeToParent() {
|
||||||
Vector2D CSubsurface::coordsGlobal() {
|
Vector2D CSubsurface::coordsGlobal() {
|
||||||
Vector2D coords = coordsRelativeToParent();
|
Vector2D coords = coordsRelativeToParent();
|
||||||
|
|
||||||
if (m_pWindowParent)
|
if (!m_pWindowParent.expired())
|
||||||
coords += m_pWindowParent->m_vRealPosition.value();
|
coords += m_pWindowParent.lock()->m_vRealPosition.value();
|
||||||
else if (m_pPopupParent)
|
else if (m_pPopupParent)
|
||||||
coords += m_pPopupParent->coordsGlobal();
|
coords += m_pPopupParent->coordsGlobal();
|
||||||
|
|
||||||
|
|
|
@ -4,17 +4,16 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "WLSurface.hpp"
|
#include "WLSurface.hpp"
|
||||||
|
|
||||||
class CWindow;
|
|
||||||
class CPopup;
|
class CPopup;
|
||||||
|
|
||||||
class CSubsurface {
|
class CSubsurface {
|
||||||
public:
|
public:
|
||||||
// root dummy nodes
|
// root dummy nodes
|
||||||
CSubsurface(CWindow* pOwner);
|
CSubsurface(PHLWINDOW pOwner);
|
||||||
CSubsurface(CPopup* pOwner);
|
CSubsurface(CPopup* pOwner);
|
||||||
|
|
||||||
// real nodes
|
// real nodes
|
||||||
CSubsurface(wlr_subsurface* pSubsurface, CWindow* pOwner);
|
CSubsurface(wlr_subsurface* pSubsurface, PHLWINDOW pOwner);
|
||||||
CSubsurface(wlr_subsurface* pSubsurface, CPopup* pOwner);
|
CSubsurface(wlr_subsurface* pSubsurface, CPopup* pOwner);
|
||||||
|
|
||||||
~CSubsurface();
|
~CSubsurface();
|
||||||
|
@ -46,8 +45,8 @@ class CSubsurface {
|
||||||
// if nullptr, means it's a dummy node
|
// if nullptr, means it's a dummy node
|
||||||
CSubsurface* m_pParent = nullptr;
|
CSubsurface* m_pParent = nullptr;
|
||||||
|
|
||||||
CWindow* m_pWindowParent = nullptr;
|
PHLWINDOWREF m_pWindowParent;
|
||||||
CPopup* m_pPopupParent = nullptr;
|
CPopup* m_pPopupParent = nullptr;
|
||||||
|
|
||||||
std::vector<std::unique_ptr<CSubsurface>> m_vChildren;
|
std::vector<std::unique_ptr<CSubsurface>> m_vChildren;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ void CWLSurface::assign(wlr_surface* pSurface) {
|
||||||
m_bInert = false;
|
m_bInert = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWLSurface::assign(wlr_surface* pSurface, CWindow* pOwner) {
|
void CWLSurface::assign(wlr_surface* pSurface, PHLWINDOW pOwner) {
|
||||||
m_pWindowOwner = pOwner;
|
m_pWindowOwner = pOwner;
|
||||||
m_pWLRSurface = pSurface;
|
m_pWLRSurface = pSurface;
|
||||||
init();
|
init();
|
||||||
|
@ -52,20 +52,22 @@ wlr_surface* CWLSurface::wlr() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWLSurface::small() const {
|
bool CWLSurface::small() const {
|
||||||
if (!m_pWindowOwner || !exists())
|
if (!validMapped(m_pWindowOwner) || !exists())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return m_pWindowOwner->m_vReportedSize.x > m_pWLRSurface->current.buffer_width + 1 || m_pWindowOwner->m_vReportedSize.y > m_pWLRSurface->current.buffer_height + 1;
|
const auto O = m_pWindowOwner.lock();
|
||||||
|
|
||||||
|
return O->m_vReportedSize.x > m_pWLRSurface->current.buffer_width + 1 || O->m_vReportedSize.y > m_pWLRSurface->current.buffer_height + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D CWLSurface::correctSmallVec() const {
|
Vector2D CWLSurface::correctSmallVec() const {
|
||||||
if (!m_pWindowOwner || !exists() || !small() || m_bFillIgnoreSmall)
|
if (!validMapped(m_pWindowOwner) || !exists() || !small() || m_bFillIgnoreSmall)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
const auto SIZE = getViewporterCorrectedSize();
|
const auto SIZE = getViewporterCorrectedSize();
|
||||||
|
const auto O = m_pWindowOwner.lock();
|
||||||
|
|
||||||
return Vector2D{(m_pWindowOwner->m_vReportedSize.x - SIZE.x) / 2, (m_pWindowOwner->m_vReportedSize.y - SIZE.y) / 2}.clamp({}, {INFINITY, INFINITY}) *
|
return Vector2D{(O->m_vReportedSize.x - SIZE.x) / 2, (O->m_vReportedSize.y - SIZE.y) / 2}.clamp({}, {INFINITY, INFINITY}) * (O->m_vRealSize.value() / O->m_vReportedSize);
|
||||||
(m_pWindowOwner->m_vRealSize.value() / m_pWindowOwner->m_vReportedSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D CWLSurface::getViewporterCorrectedSize() const {
|
Vector2D CWLSurface::getViewporterCorrectedSize() const {
|
||||||
|
@ -110,11 +112,11 @@ void CWLSurface::destroy() {
|
||||||
hyprListener_destroy.removeCallback();
|
hyprListener_destroy.removeCallback();
|
||||||
hyprListener_commit.removeCallback();
|
hyprListener_commit.removeCallback();
|
||||||
m_pWLRSurface->data = nullptr;
|
m_pWLRSurface->data = nullptr;
|
||||||
m_pWindowOwner = nullptr;
|
m_pWindowOwner.reset();
|
||||||
m_pLayerOwner = nullptr;
|
m_pLayerOwner = nullptr;
|
||||||
m_pPopupOwner = nullptr;
|
m_pPopupOwner = nullptr;
|
||||||
m_pSubsurfaceOwner = nullptr;
|
m_pSubsurfaceOwner = nullptr;
|
||||||
m_bInert = true;
|
m_bInert = true;
|
||||||
|
|
||||||
if (g_pCompositor && g_pCompositor->m_pLastFocus == m_pWLRSurface)
|
if (g_pCompositor && g_pCompositor->m_pLastFocus == m_pWLRSurface)
|
||||||
g_pCompositor->m_pLastFocus = nullptr;
|
g_pCompositor->m_pLastFocus = nullptr;
|
||||||
|
@ -148,8 +150,8 @@ void CWLSurface::init() {
|
||||||
Debug::log(LOG, "CWLSurface {:x} called init()", (uintptr_t)this);
|
Debug::log(LOG, "CWLSurface {:x} called init()", (uintptr_t)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CWLSurface::getWindow() {
|
PHLWINDOW CWLSurface::getWindow() {
|
||||||
return m_pWindowOwner;
|
return m_pWindowOwner.lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
SLayerSurface* CWLSurface::getLayer() {
|
SLayerSurface* CWLSurface::getLayer() {
|
||||||
|
@ -165,15 +167,15 @@ CSubsurface* CWLSurface::getSubsurface() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWLSurface::desktopComponent() {
|
bool CWLSurface::desktopComponent() {
|
||||||
return m_pLayerOwner || m_pWindowOwner || m_pSubsurfaceOwner || m_pPopupOwner;
|
return m_pLayerOwner || !m_pWindowOwner.expired() || m_pSubsurfaceOwner || m_pPopupOwner;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<CBox> CWLSurface::getSurfaceBoxGlobal() {
|
std::optional<CBox> CWLSurface::getSurfaceBoxGlobal() {
|
||||||
if (!desktopComponent())
|
if (!desktopComponent())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
if (m_pWindowOwner)
|
if (!m_pWindowOwner.expired())
|
||||||
return m_pWindowOwner->getWindowMainSurfaceBox();
|
return m_pWindowOwner.lock()->getWindowMainSurfaceBox();
|
||||||
if (m_pLayerOwner)
|
if (m_pLayerOwner)
|
||||||
return m_pLayerOwner->geometry;
|
return m_pLayerOwner->geometry;
|
||||||
if (m_pPopupOwner)
|
if (m_pPopupOwner)
|
||||||
|
|
|
@ -17,7 +17,7 @@ class CWLSurface {
|
||||||
|
|
||||||
// anonymous surfaces are non-desktop components, e.g. a cursor surface or a DnD
|
// anonymous surfaces are non-desktop components, e.g. a cursor surface or a DnD
|
||||||
void assign(wlr_surface* pSurface);
|
void assign(wlr_surface* pSurface);
|
||||||
void assign(wlr_surface* pSurface, CWindow* pOwner);
|
void assign(wlr_surface* pSurface, PHLWINDOW pOwner);
|
||||||
void assign(wlr_surface* pSurface, SLayerSurface* pOwner);
|
void assign(wlr_surface* pSurface, SLayerSurface* pOwner);
|
||||||
void assign(wlr_surface* pSurface, CSubsurface* pOwner);
|
void assign(wlr_surface* pSurface, CSubsurface* pOwner);
|
||||||
void assign(wlr_surface* pSurface, CPopup* pOwner);
|
void assign(wlr_surface* pSurface, CPopup* pOwner);
|
||||||
|
@ -37,7 +37,7 @@ class CWLSurface {
|
||||||
void onCommit();
|
void onCommit();
|
||||||
|
|
||||||
// getters for owners.
|
// getters for owners.
|
||||||
CWindow* getWindow();
|
PHLWINDOW getWindow();
|
||||||
SLayerSurface* getLayer();
|
SLayerSurface* getLayer();
|
||||||
CPopup* getPopup();
|
CPopup* getPopup();
|
||||||
CSubsurface* getSubsurface();
|
CSubsurface* getSubsurface();
|
||||||
|
@ -94,7 +94,7 @@ class CWLSurface {
|
||||||
|
|
||||||
wlr_surface* m_pWLRSurface = nullptr;
|
wlr_surface* m_pWLRSurface = nullptr;
|
||||||
|
|
||||||
CWindow* m_pWindowOwner = nullptr;
|
PHLWINDOWREF m_pWindowOwner;
|
||||||
SLayerSurface* m_pLayerOwner = nullptr;
|
SLayerSurface* m_pLayerOwner = nullptr;
|
||||||
CPopup* m_pPopupOwner = nullptr;
|
CPopup* m_pPopupOwner = nullptr;
|
||||||
CSubsurface* m_pSubsurfaceOwner = nullptr;
|
CSubsurface* m_pSubsurfaceOwner = nullptr;
|
||||||
|
|
|
@ -7,24 +7,34 @@
|
||||||
#include <any>
|
#include <any>
|
||||||
#include "../managers/TokenManager.hpp"
|
#include "../managers/TokenManager.hpp"
|
||||||
|
|
||||||
CWindow::CWindow() {
|
PHLWINDOW CWindow::create() {
|
||||||
m_vRealPosition.create(g_pConfigManager->getAnimationPropertyConfig("windowsIn"), this, AVARDAMAGE_ENTIRE);
|
PHLWINDOW pWindow = std::shared_ptr<CWindow>(new CWindow);
|
||||||
m_vRealSize.create(g_pConfigManager->getAnimationPropertyConfig("windowsIn"), this, AVARDAMAGE_ENTIRE);
|
|
||||||
m_fBorderFadeAnimationProgress.create(g_pConfigManager->getAnimationPropertyConfig("border"), this, AVARDAMAGE_BORDER);
|
|
||||||
m_fBorderAngleAnimationProgress.create(g_pConfigManager->getAnimationPropertyConfig("borderangle"), this, AVARDAMAGE_BORDER);
|
|
||||||
m_fAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeIn"), this, AVARDAMAGE_ENTIRE);
|
|
||||||
m_fActiveInactiveAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"), this, AVARDAMAGE_ENTIRE);
|
|
||||||
m_cRealShadowColor.create(g_pConfigManager->getAnimationPropertyConfig("fadeShadow"), this, AVARDAMAGE_SHADOW);
|
|
||||||
m_fDimPercent.create(g_pConfigManager->getAnimationPropertyConfig("fadeDim"), this, AVARDAMAGE_ENTIRE);
|
|
||||||
|
|
||||||
addWindowDeco(std::make_unique<CHyprDropShadowDecoration>(this));
|
pWindow->m_pSelf = pWindow;
|
||||||
addWindowDeco(std::make_unique<CHyprBorderDecoration>(this));
|
|
||||||
|
pWindow->m_vRealPosition.create(g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||||
|
pWindow->m_vRealSize.create(g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||||
|
pWindow->m_fBorderFadeAnimationProgress.create(g_pConfigManager->getAnimationPropertyConfig("border"), pWindow, AVARDAMAGE_BORDER);
|
||||||
|
pWindow->m_fBorderAngleAnimationProgress.create(g_pConfigManager->getAnimationPropertyConfig("borderangle"), pWindow, AVARDAMAGE_BORDER);
|
||||||
|
pWindow->m_fAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||||
|
pWindow->m_fActiveInactiveAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"), pWindow, AVARDAMAGE_ENTIRE);
|
||||||
|
pWindow->m_cRealShadowColor.create(g_pConfigManager->getAnimationPropertyConfig("fadeShadow"), pWindow, AVARDAMAGE_SHADOW);
|
||||||
|
pWindow->m_fDimPercent.create(g_pConfigManager->getAnimationPropertyConfig("fadeDim"), pWindow, AVARDAMAGE_ENTIRE);
|
||||||
|
|
||||||
|
pWindow->addWindowDeco(std::make_unique<CHyprDropShadowDecoration>(pWindow));
|
||||||
|
pWindow->addWindowDeco(std::make_unique<CHyprBorderDecoration>(pWindow));
|
||||||
|
|
||||||
|
return pWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
CWindow::CWindow() {
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow::~CWindow() {
|
CWindow::~CWindow() {
|
||||||
if (g_pCompositor->isWindowActive(this)) {
|
if (g_pCompositor->m_pLastWindow.lock().get() == this) {
|
||||||
g_pCompositor->m_pLastFocus = nullptr;
|
g_pCompositor->m_pLastFocus = nullptr;
|
||||||
g_pCompositor->m_pLastWindow = nullptr;
|
g_pCompositor->m_pLastWindow.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
events.destroy.emit();
|
events.destroy.emit();
|
||||||
|
@ -33,7 +43,7 @@ CWindow::~CWindow() {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_pHyprRenderer->makeEGLCurrent();
|
g_pHyprRenderer->makeEGLCurrent();
|
||||||
std::erase_if(g_pHyprOpenGL->m_mWindowFramebuffers, [&](const auto& other) { return other.first == this; });
|
std::erase_if(g_pHyprOpenGL->m_mWindowFramebuffers, [&](const auto& other) { return !other.first.lock() || other.first.lock().get() == this; });
|
||||||
}
|
}
|
||||||
|
|
||||||
SWindowDecorationExtents CWindow::getFullWindowExtents() {
|
SWindowDecorationExtents CWindow::getFullWindowExtents() {
|
||||||
|
@ -50,7 +60,7 @@ SWindowDecorationExtents CWindow::getFullWindowExtents() {
|
||||||
|
|
||||||
SWindowDecorationExtents maxExtents = {{BORDERSIZE + 2, BORDERSIZE + 2}, {BORDERSIZE + 2, BORDERSIZE + 2}};
|
SWindowDecorationExtents maxExtents = {{BORDERSIZE + 2, BORDERSIZE + 2}, {BORDERSIZE + 2, BORDERSIZE + 2}};
|
||||||
|
|
||||||
const auto EXTENTS = g_pDecorationPositioner->getWindowDecorationExtents(this);
|
const auto EXTENTS = g_pDecorationPositioner->getWindowDecorationExtents(m_pSelf.lock());
|
||||||
|
|
||||||
if (EXTENTS.topLeft.x > maxExtents.topLeft.x)
|
if (EXTENTS.topLeft.x > maxExtents.topLeft.x)
|
||||||
maxExtents.topLeft.x = EXTENTS.topLeft.x;
|
maxExtents.topLeft.x = EXTENTS.topLeft.x;
|
||||||
|
@ -153,11 +163,11 @@ CBox CWindow::getWindowBoxUnified(uint64_t properties) {
|
||||||
|
|
||||||
SWindowDecorationExtents EXTENTS = {{0, 0}, {0, 0}};
|
SWindowDecorationExtents EXTENTS = {{0, 0}, {0, 0}};
|
||||||
if (properties & RESERVED_EXTENTS)
|
if (properties & RESERVED_EXTENTS)
|
||||||
EXTENTS.addExtents(g_pDecorationPositioner->getWindowDecorationReserved(this));
|
EXTENTS.addExtents(g_pDecorationPositioner->getWindowDecorationReserved(m_pSelf.lock()));
|
||||||
if (properties & INPUT_EXTENTS)
|
if (properties & INPUT_EXTENTS)
|
||||||
EXTENTS.addExtents(g_pDecorationPositioner->getWindowDecorationExtents(this, true));
|
EXTENTS.addExtents(g_pDecorationPositioner->getWindowDecorationExtents(m_pSelf.lock(), true));
|
||||||
if (properties & FULL_EXTENTS)
|
if (properties & FULL_EXTENTS)
|
||||||
EXTENTS.addExtents(g_pDecorationPositioner->getWindowDecorationExtents(this, false));
|
EXTENTS.addExtents(g_pDecorationPositioner->getWindowDecorationExtents(m_pSelf.lock(), false));
|
||||||
|
|
||||||
CBox box = {m_vRealPosition.value().x, m_vRealPosition.value().y, m_vRealSize.value().x, m_vRealSize.value().y};
|
CBox box = {m_vRealPosition.value().x, m_vRealPosition.value().y, m_vRealSize.value().x, m_vRealSize.value().y};
|
||||||
box.addExtents(EXTENTS);
|
box.addExtents(EXTENTS);
|
||||||
|
@ -170,7 +180,7 @@ CBox CWindow::getWindowMainSurfaceBox() {
|
||||||
}
|
}
|
||||||
|
|
||||||
SWindowDecorationExtents CWindow::getFullWindowReservedArea() {
|
SWindowDecorationExtents CWindow::getFullWindowReservedArea() {
|
||||||
return g_pDecorationPositioner->getWindowDecorationReserved(this);
|
return g_pDecorationPositioner->getWindowDecorationReserved(m_pSelf.lock());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWindow::updateWindowDecos() {
|
void CWindow::updateWindowDecos() {
|
||||||
|
@ -191,10 +201,10 @@ void CWindow::updateWindowDecos() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pDecorationPositioner->onWindowUpdate(this);
|
g_pDecorationPositioner->onWindowUpdate(m_pSelf.lock());
|
||||||
|
|
||||||
if (recalc)
|
if (recalc)
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateWindow(this);
|
g_pLayoutManager->getCurrentLayout()->recalculateWindow(m_pSelf.lock());
|
||||||
|
|
||||||
m_vDecosToRemove.clear();
|
m_vDecosToRemove.clear();
|
||||||
|
|
||||||
|
@ -206,22 +216,22 @@ void CWindow::updateWindowDecos() {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& wd : decos) {
|
for (auto& wd : decos) {
|
||||||
wd->updateWindow(this);
|
wd->updateWindow(m_pSelf.lock());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWindow::addWindowDeco(std::unique_ptr<IHyprWindowDecoration> deco) {
|
void CWindow::addWindowDeco(std::unique_ptr<IHyprWindowDecoration> deco) {
|
||||||
m_dWindowDecorations.emplace_back(std::move(deco));
|
m_dWindowDecorations.emplace_back(std::move(deco));
|
||||||
g_pDecorationPositioner->forceRecalcFor(this);
|
g_pDecorationPositioner->forceRecalcFor(m_pSelf.lock());
|
||||||
updateWindowDecos();
|
updateWindowDecos();
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateWindow(this);
|
g_pLayoutManager->getCurrentLayout()->recalculateWindow(m_pSelf.lock());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWindow::removeWindowDeco(IHyprWindowDecoration* deco) {
|
void CWindow::removeWindowDeco(IHyprWindowDecoration* deco) {
|
||||||
m_vDecosToRemove.push_back(deco);
|
m_vDecosToRemove.push_back(deco);
|
||||||
g_pDecorationPositioner->forceRecalcFor(this);
|
g_pDecorationPositioner->forceRecalcFor(m_pSelf.lock());
|
||||||
updateWindowDecos();
|
updateWindowDecos();
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateWindow(this);
|
g_pLayoutManager->getCurrentLayout()->recalculateWindow(m_pSelf.lock());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWindow::uncacheWindowDecos() {
|
void CWindow::uncacheWindowDecos() {
|
||||||
|
@ -335,7 +345,7 @@ void CWindow::moveToWorkspace(PHLWORKSPACE pWorkspace) {
|
||||||
if (*PINITIALWSTRACKING == 2) {
|
if (*PINITIALWSTRACKING == 2) {
|
||||||
// persistent
|
// persistent
|
||||||
SInitialWorkspaceToken token = std::any_cast<SInitialWorkspaceToken>(TOKEN->data);
|
SInitialWorkspaceToken token = std::any_cast<SInitialWorkspaceToken>(TOKEN->data);
|
||||||
if (token.primaryOwner == this) {
|
if (token.primaryOwner.lock().get() == this) {
|
||||||
token.workspace = pWorkspace->getConfigName();
|
token.workspace = pWorkspace->getConfigName();
|
||||||
TOKEN->data = token;
|
TOKEN->data = token;
|
||||||
}
|
}
|
||||||
|
@ -364,16 +374,16 @@ void CWindow::moveToWorkspace(PHLWORKSPACE pWorkspace) {
|
||||||
if (valid(pWorkspace)) {
|
if (valid(pWorkspace)) {
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"movewindow", std::format("{:x},{}", (uintptr_t)this, pWorkspace->m_szName)});
|
g_pEventManager->postEvent(SHyprIPCEvent{"movewindow", std::format("{:x},{}", (uintptr_t)this, pWorkspace->m_szName)});
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"movewindowv2", std::format("{:x},{},{}", (uintptr_t)this, pWorkspace->m_iID, pWorkspace->m_szName)});
|
g_pEventManager->postEvent(SHyprIPCEvent{"movewindowv2", std::format("{:x},{},{}", (uintptr_t)this, pWorkspace->m_iID, pWorkspace->m_szName)});
|
||||||
EMIT_HOOK_EVENT("moveWindow", (std::vector<std::any>{this, pWorkspace}));
|
EMIT_HOOK_EVENT("moveWindow", (std::vector<std::any>{m_pSelf.lock(), pWorkspace}));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pSwallowed) {
|
if (const auto SWALLOWED = m_pSwallowed.lock()) {
|
||||||
m_pSwallowed->moveToWorkspace(pWorkspace);
|
SWALLOWED->moveToWorkspace(pWorkspace);
|
||||||
m_pSwallowed->m_iMonitorID = m_iMonitorID;
|
SWALLOWED->m_iMonitorID = m_iMonitorID;
|
||||||
}
|
}
|
||||||
|
|
||||||
// update xwayland coords
|
// update xwayland coords
|
||||||
g_pXWaylandManager->setWindowSize(this, m_vRealSize.value());
|
g_pXWaylandManager->setWindowSize(m_pSelf.lock(), m_vRealSize.value());
|
||||||
|
|
||||||
if (OLDWORKSPACE && g_pCompositor->isWorkspaceSpecial(OLDWORKSPACE->m_iID) && g_pCompositor->getWindowsOnWorkspace(OLDWORKSPACE->m_iID) == 0 && *PCLOSEONLASTSPECIAL) {
|
if (OLDWORKSPACE && g_pCompositor->isWorkspaceSpecial(OLDWORKSPACE->m_iID) && g_pCompositor->getWindowsOnWorkspace(OLDWORKSPACE->m_iID) == 0 && *PCLOSEONLASTSPECIAL) {
|
||||||
if (const auto PMONITOR = g_pCompositor->getMonitorFromID(OLDWORKSPACE->m_iMonitorID); PMONITOR)
|
if (const auto PMONITOR = g_pCompositor->getMonitorFromID(OLDWORKSPACE->m_iMonitorID); PMONITOR)
|
||||||
|
@ -381,7 +391,7 @@ void CWindow::moveToWorkspace(PHLWORKSPACE pWorkspace) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CWindow::X11TransientFor() {
|
PHLWINDOW CWindow::X11TransientFor() {
|
||||||
if (!m_bIsX11)
|
if (!m_bIsX11)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
@ -390,11 +400,11 @@ CWindow* CWindow::X11TransientFor() {
|
||||||
|
|
||||||
auto PPARENT = g_pCompositor->getWindowFromSurface(m_uSurface.xwayland->parent->surface);
|
auto PPARENT = g_pCompositor->getWindowFromSurface(m_uSurface.xwayland->parent->surface);
|
||||||
|
|
||||||
while (g_pCompositor->windowValidMapped(PPARENT) && PPARENT->m_uSurface.xwayland->parent) {
|
while (validMapped(PPARENT) && PPARENT->m_uSurface.xwayland->parent) {
|
||||||
PPARENT = g_pCompositor->getWindowFromSurface(PPARENT->m_uSurface.xwayland->parent->surface);
|
PPARENT = g_pCompositor->getWindowFromSurface(PPARENT->m_uSurface.xwayland->parent->surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_pCompositor->windowValidMapped(PPARENT))
|
if (!validMapped(PPARENT))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return PPARENT;
|
return PPARENT;
|
||||||
|
@ -416,10 +426,10 @@ void unregisterVar(void* ptr) {
|
||||||
void CWindow::onUnmap() {
|
void CWindow::onUnmap() {
|
||||||
static auto PCLOSEONLASTSPECIAL = CConfigValue<Hyprlang::INT>("misc:close_special_on_empty");
|
static auto PCLOSEONLASTSPECIAL = CConfigValue<Hyprlang::INT>("misc:close_special_on_empty");
|
||||||
|
|
||||||
if (g_pCompositor->m_pLastWindow == this)
|
if (g_pCompositor->m_pLastWindow.lock().get() == this)
|
||||||
g_pCompositor->m_pLastWindow = nullptr;
|
g_pCompositor->m_pLastWindow.reset();
|
||||||
if (g_pInputManager->currentlyDraggedWindow == this)
|
if (g_pInputManager->currentlyDraggedWindow.lock().get() == this)
|
||||||
g_pInputManager->currentlyDraggedWindow = nullptr;
|
g_pInputManager->currentlyDraggedWindow.reset();
|
||||||
|
|
||||||
static auto PINITIALWSTRACKING = CConfigValue<Hyprlang::INT>("misc:initial_workspace_tracking");
|
static auto PINITIALWSTRACKING = CConfigValue<Hyprlang::INT>("misc:initial_workspace_tracking");
|
||||||
|
|
||||||
|
@ -429,7 +439,7 @@ void CWindow::onUnmap() {
|
||||||
if (*PINITIALWSTRACKING == 2) {
|
if (*PINITIALWSTRACKING == 2) {
|
||||||
// persistent token, but the first window got removed so the token is gone
|
// persistent token, but the first window got removed so the token is gone
|
||||||
SInitialWorkspaceToken token = std::any_cast<SInitialWorkspaceToken>(TOKEN->data);
|
SInitialWorkspaceToken token = std::any_cast<SInitialWorkspaceToken>(TOKEN->data);
|
||||||
if (token.primaryOwner == this)
|
if (token.primaryOwner.lock().get() == this)
|
||||||
g_pTokenManager->removeToken(TOKEN);
|
g_pTokenManager->removeToken(TOKEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -448,7 +458,7 @@ void CWindow::onUnmap() {
|
||||||
|
|
||||||
m_vRealSize.setCallbackOnBegin(nullptr);
|
m_vRealSize.setCallbackOnBegin(nullptr);
|
||||||
|
|
||||||
std::erase_if(g_pCompositor->m_vWindowFocusHistory, [&](const auto& other) { return other == this; });
|
std::erase_if(g_pCompositor->m_vWindowFocusHistory, [&](const auto& other) { return other.expired() || other.lock().get() == this; });
|
||||||
|
|
||||||
hyprListener_unmapWindow.removeCallback();
|
hyprListener_unmapWindow.removeCallback();
|
||||||
|
|
||||||
|
@ -460,8 +470,8 @@ void CWindow::onUnmap() {
|
||||||
|
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
||||||
|
|
||||||
if (PMONITOR && PMONITOR->solitaryClient == this)
|
if (PMONITOR && PMONITOR->solitaryClient.lock().get() == this)
|
||||||
PMONITOR->solitaryClient = nullptr;
|
PMONITOR->solitaryClient.reset();
|
||||||
|
|
||||||
g_pCompositor->updateWorkspaceWindows(workspaceID());
|
g_pCompositor->updateWorkspaceWindows(workspaceID());
|
||||||
g_pCompositor->updateWorkspaceSpecialRenderData(workspaceID());
|
g_pCompositor->updateWorkspaceSpecialRenderData(workspaceID());
|
||||||
|
@ -502,7 +512,7 @@ void CWindow::onMap() {
|
||||||
m_fBorderAngleAnimationProgress.setValueAndWarp(0.f);
|
m_fBorderAngleAnimationProgress.setValueAndWarp(0.f);
|
||||||
m_fBorderAngleAnimationProgress = 1.f;
|
m_fBorderAngleAnimationProgress = 1.f;
|
||||||
|
|
||||||
g_pCompositor->m_vWindowFocusHistory.push_back(this);
|
g_pCompositor->m_vWindowFocusHistory.push_back(m_pSelf);
|
||||||
|
|
||||||
hyprListener_unmapWindow.initCallback(m_bIsX11 ? &m_uSurface.xwayland->surface->events.unmap : &m_uSurface.xdg->surface->events.unmap, &Events::listener_unmapWindow, this,
|
hyprListener_unmapWindow.initCallback(m_bIsX11 ? &m_uSurface.xwayland->surface->events.unmap : &m_uSurface.xdg->surface->events.unmap, &Events::listener_unmapWindow, this,
|
||||||
"CWindow");
|
"CWindow");
|
||||||
|
@ -513,8 +523,8 @@ void CWindow::onMap() {
|
||||||
if (m_bIsX11)
|
if (m_bIsX11)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_pSubsurfaceHead = std::make_unique<CSubsurface>(this);
|
m_pSubsurfaceHead = std::make_unique<CSubsurface>(m_pSelf.lock());
|
||||||
m_pPopupHead = std::make_unique<CPopup>(this);
|
m_pPopupHead = std::make_unique<CPopup>(m_pSelf.lock());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWindow::onBorderAngleAnimEnd(void* ptr) {
|
void CWindow::onBorderAngleAnimEnd(void* ptr) {
|
||||||
|
@ -536,8 +546,8 @@ void CWindow::onBorderAngleAnimEnd(void* ptr) {
|
||||||
void CWindow::setHidden(bool hidden) {
|
void CWindow::setHidden(bool hidden) {
|
||||||
m_bHidden = hidden;
|
m_bHidden = hidden;
|
||||||
|
|
||||||
if (hidden && g_pCompositor->m_pLastWindow == this) {
|
if (hidden && g_pCompositor->m_pLastWindow.lock().get() == this) {
|
||||||
g_pCompositor->m_pLastWindow = nullptr;
|
g_pCompositor->m_pLastWindow.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
setSuspended(hidden);
|
setSuspended(hidden);
|
||||||
|
@ -696,7 +706,7 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
|
||||||
m_sAdditionalConfigData.maxSize = VEC;
|
m_sAdditionalConfigData.maxSize = VEC;
|
||||||
m_vRealSize = Vector2D(std::min((double)m_sAdditionalConfigData.maxSize.toUnderlying().x, m_vRealSize.goal().x),
|
m_vRealSize = Vector2D(std::min((double)m_sAdditionalConfigData.maxSize.toUnderlying().x, m_vRealSize.goal().x),
|
||||||
std::min((double)m_sAdditionalConfigData.maxSize.toUnderlying().y, m_vRealSize.goal().y));
|
std::min((double)m_sAdditionalConfigData.maxSize.toUnderlying().y, m_vRealSize.goal().y));
|
||||||
g_pXWaylandManager->setWindowSize(this, m_vRealSize.goal());
|
g_pXWaylandManager->setWindowSize(m_pSelf.lock(), m_vRealSize.goal());
|
||||||
setHidden(false);
|
setHidden(false);
|
||||||
} catch (std::exception& e) { Debug::log(ERR, "maxsize rule \"{}\" failed with: {}", r.szRule, e.what()); }
|
} catch (std::exception& e) { Debug::log(ERR, "maxsize rule \"{}\" failed with: {}", r.szRule, e.what()); }
|
||||||
} else if (r.szRule.starts_with("minsize")) {
|
} else if (r.szRule.starts_with("minsize")) {
|
||||||
|
@ -712,7 +722,7 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
|
||||||
m_sAdditionalConfigData.minSize = VEC;
|
m_sAdditionalConfigData.minSize = VEC;
|
||||||
m_vRealSize = Vector2D(std::max((double)m_sAdditionalConfigData.minSize.toUnderlying().x, m_vRealSize.goal().x),
|
m_vRealSize = Vector2D(std::max((double)m_sAdditionalConfigData.minSize.toUnderlying().x, m_vRealSize.goal().x),
|
||||||
std::max((double)m_sAdditionalConfigData.minSize.toUnderlying().y, m_vRealSize.goal().y));
|
std::max((double)m_sAdditionalConfigData.minSize.toUnderlying().y, m_vRealSize.goal().y));
|
||||||
g_pXWaylandManager->setWindowSize(this, m_vRealSize.goal());
|
g_pXWaylandManager->setWindowSize(m_pSelf.lock(), m_vRealSize.goal());
|
||||||
setHidden(false);
|
setHidden(false);
|
||||||
} catch (std::exception& e) { Debug::log(ERR, "minsize rule \"{}\" failed with: {}", r.szRule, e.what()); }
|
} catch (std::exception& e) { Debug::log(ERR, "minsize rule \"{}\" failed with: {}", r.szRule, e.what()); }
|
||||||
}
|
}
|
||||||
|
@ -743,7 +753,7 @@ void CWindow::updateDynamicRules() {
|
||||||
m_sAdditionalConfigData.nearestNeighbor = false;
|
m_sAdditionalConfigData.nearestNeighbor = false;
|
||||||
m_eIdleInhibitMode = IDLEINHIBIT_NONE;
|
m_eIdleInhibitMode = IDLEINHIBIT_NONE;
|
||||||
|
|
||||||
const auto WINDOWRULES = g_pConfigManager->getMatchingRules(this);
|
const auto WINDOWRULES = g_pConfigManager->getMatchingRules(m_pSelf.lock());
|
||||||
for (auto& r : WINDOWRULES) {
|
for (auto& r : WINDOWRULES) {
|
||||||
applyDynamicRule(r);
|
applyDynamicRule(r);
|
||||||
}
|
}
|
||||||
|
@ -807,7 +817,7 @@ void CWindow::applyGroupRules() {
|
||||||
if ((m_eGroupRules & GROUP_SET && m_bFirstMap) || m_eGroupRules & GROUP_SET_ALWAYS)
|
if ((m_eGroupRules & GROUP_SET && m_bFirstMap) || m_eGroupRules & GROUP_SET_ALWAYS)
|
||||||
createGroup();
|
createGroup();
|
||||||
|
|
||||||
if (m_sGroupData.pNextWindow && ((m_eGroupRules & GROUP_LOCK && m_bFirstMap) || m_eGroupRules & GROUP_LOCK_ALWAYS))
|
if (m_sGroupData.pNextWindow.lock() && ((m_eGroupRules & GROUP_LOCK && m_bFirstMap) || m_eGroupRules & GROUP_LOCK_ALWAYS))
|
||||||
getGroupHead()->m_sGroupData.locked = true;
|
getGroupHead()->m_sGroupData.locked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -817,13 +827,13 @@ void CWindow::createGroup() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_sGroupData.pNextWindow) {
|
if (m_sGroupData.pNextWindow.expired()) {
|
||||||
m_sGroupData.pNextWindow = this;
|
m_sGroupData.pNextWindow = m_pSelf;
|
||||||
m_sGroupData.head = true;
|
m_sGroupData.head = true;
|
||||||
m_sGroupData.locked = false;
|
m_sGroupData.locked = false;
|
||||||
m_sGroupData.deny = false;
|
m_sGroupData.deny = false;
|
||||||
|
|
||||||
addWindowDeco(std::make_unique<CHyprGroupBarDecoration>(this));
|
addWindowDeco(std::make_unique<CHyprGroupBarDecoration>(m_pSelf.lock()));
|
||||||
|
|
||||||
g_pCompositor->updateWorkspaceWindows(workspaceID());
|
g_pCompositor->updateWorkspaceWindows(workspaceID());
|
||||||
g_pCompositor->updateWorkspaceSpecialRenderData(workspaceID());
|
g_pCompositor->updateWorkspaceSpecialRenderData(workspaceID());
|
||||||
|
@ -833,13 +843,13 @@ void CWindow::createGroup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWindow::destroyGroup() {
|
void CWindow::destroyGroup() {
|
||||||
if (m_sGroupData.pNextWindow == this) {
|
if (m_sGroupData.pNextWindow.lock().get() == this) {
|
||||||
if (m_eGroupRules & GROUP_SET_ALWAYS) {
|
if (m_eGroupRules & GROUP_SET_ALWAYS) {
|
||||||
Debug::log(LOG, "destoryGroup: window:{:x},title:{} has rule [group set always], ignored", (uintptr_t)this, this->m_szTitle);
|
Debug::log(LOG, "destoryGroup: window:{:x},title:{} has rule [group set always], ignored", (uintptr_t)this, this->m_szTitle);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_sGroupData.pNextWindow = nullptr;
|
m_sGroupData.pNextWindow.reset();
|
||||||
m_sGroupData.head = false;
|
m_sGroupData.head = false;
|
||||||
updateWindowDecos();
|
updateWindowDecos();
|
||||||
g_pCompositor->updateWorkspaceWindows(workspaceID());
|
g_pCompositor->updateWorkspaceWindows(workspaceID());
|
||||||
g_pCompositor->updateWorkspaceSpecialRenderData(workspaceID());
|
g_pCompositor->updateWorkspaceSpecialRenderData(workspaceID());
|
||||||
|
@ -848,15 +858,15 @@ void CWindow::destroyGroup() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* curr = this;
|
PHLWINDOW curr = m_pSelf.lock();
|
||||||
std::vector<CWindow*> members;
|
std::vector<PHLWINDOW> members;
|
||||||
do {
|
do {
|
||||||
const auto PLASTWIN = curr;
|
const auto PLASTWIN = curr;
|
||||||
curr = curr->m_sGroupData.pNextWindow;
|
curr = curr->m_sGroupData.pNextWindow.lock();
|
||||||
PLASTWIN->m_sGroupData.pNextWindow = nullptr;
|
PLASTWIN->m_sGroupData.pNextWindow.reset();
|
||||||
curr->setHidden(false);
|
curr->setHidden(false);
|
||||||
members.push_back(curr);
|
members.push_back(curr);
|
||||||
} while (curr != this);
|
} while (curr.get() != this);
|
||||||
|
|
||||||
for (auto& w : members) {
|
for (auto& w : members) {
|
||||||
if (w->m_sGroupData.head)
|
if (w->m_sGroupData.head)
|
||||||
|
@ -878,69 +888,69 @@ void CWindow::destroyGroup() {
|
||||||
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
|
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CWindow::getGroupHead() {
|
PHLWINDOW CWindow::getGroupHead() {
|
||||||
CWindow* curr = this;
|
PHLWINDOW curr = m_pSelf.lock();
|
||||||
while (!curr->m_sGroupData.head)
|
while (!curr->m_sGroupData.head)
|
||||||
curr = curr->m_sGroupData.pNextWindow;
|
curr = curr->m_sGroupData.pNextWindow.lock();
|
||||||
return curr;
|
return curr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CWindow::getGroupTail() {
|
PHLWINDOW CWindow::getGroupTail() {
|
||||||
CWindow* curr = this;
|
PHLWINDOW curr = m_pSelf.lock();
|
||||||
while (!curr->m_sGroupData.pNextWindow->m_sGroupData.head)
|
while (!curr->m_sGroupData.pNextWindow.lock()->m_sGroupData.head)
|
||||||
curr = curr->m_sGroupData.pNextWindow;
|
curr = curr->m_sGroupData.pNextWindow.lock();
|
||||||
return curr;
|
return curr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CWindow::getGroupCurrent() {
|
PHLWINDOW CWindow::getGroupCurrent() {
|
||||||
CWindow* curr = this;
|
PHLWINDOW curr = m_pSelf.lock();
|
||||||
while (curr->isHidden())
|
while (curr->isHidden())
|
||||||
curr = curr->m_sGroupData.pNextWindow;
|
curr = curr->m_sGroupData.pNextWindow.lock();
|
||||||
return curr;
|
return curr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CWindow::getGroupSize() {
|
int CWindow::getGroupSize() {
|
||||||
int size = 1;
|
int size = 1;
|
||||||
CWindow* curr = this;
|
PHLWINDOW curr = m_pSelf.lock();
|
||||||
while (curr->m_sGroupData.pNextWindow != this) {
|
while (curr->m_sGroupData.pNextWindow.lock().get() != this) {
|
||||||
curr = curr->m_sGroupData.pNextWindow;
|
curr = curr->m_sGroupData.pNextWindow.lock();
|
||||||
size++;
|
size++;
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWindow::canBeGroupedInto(CWindow* pWindow) {
|
bool CWindow::canBeGroupedInto(PHLWINDOW pWindow) {
|
||||||
return !g_pKeybindManager->m_bGroupsLocked // global group lock disengaged
|
return !g_pKeybindManager->m_bGroupsLocked // global group lock disengaged
|
||||||
&& ((m_eGroupRules & GROUP_INVADE && m_bFirstMap) // window ignore local group locks, or
|
&& ((m_eGroupRules & GROUP_INVADE && m_bFirstMap) // window ignore local group locks, or
|
||||||
|| (!pWindow->getGroupHead()->m_sGroupData.locked // target unlocked
|
|| (!pWindow->getGroupHead()->m_sGroupData.locked // target unlocked
|
||||||
&& !(m_sGroupData.pNextWindow && getGroupHead()->m_sGroupData.locked))) // source unlocked or isn't group
|
&& !(m_sGroupData.pNextWindow.lock() && getGroupHead()->m_sGroupData.locked))) // source unlocked or isn't group
|
||||||
&& !m_sGroupData.deny // source is not denied entry
|
&& !m_sGroupData.deny // source is not denied entry
|
||||||
&& !(m_eGroupRules & GROUP_BARRED && m_bFirstMap); // group rule doesn't prevent adding window
|
&& !(m_eGroupRules & GROUP_BARRED && m_bFirstMap); // group rule doesn't prevent adding window
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CWindow::getGroupWindowByIndex(int index) {
|
PHLWINDOW CWindow::getGroupWindowByIndex(int index) {
|
||||||
const int SIZE = getGroupSize();
|
const int SIZE = getGroupSize();
|
||||||
index = ((index % SIZE) + SIZE) % SIZE;
|
index = ((index % SIZE) + SIZE) % SIZE;
|
||||||
CWindow* curr = getGroupHead();
|
PHLWINDOW curr = getGroupHead();
|
||||||
while (index > 0) {
|
while (index > 0) {
|
||||||
curr = curr->m_sGroupData.pNextWindow;
|
curr = curr->m_sGroupData.pNextWindow.lock();
|
||||||
index--;
|
index--;
|
||||||
}
|
}
|
||||||
return curr;
|
return curr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWindow::setGroupCurrent(CWindow* pWindow) {
|
void CWindow::setGroupCurrent(PHLWINDOW pWindow) {
|
||||||
CWindow* curr = this->m_sGroupData.pNextWindow;
|
PHLWINDOW curr = m_sGroupData.pNextWindow.lock();
|
||||||
bool isMember = false;
|
bool isMember = false;
|
||||||
while (curr != this) {
|
while (curr.get() != this) {
|
||||||
if (curr == pWindow) {
|
if (curr == pWindow) {
|
||||||
isMember = true;
|
isMember = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
curr = curr->m_sGroupData.pNextWindow;
|
curr = curr->m_sGroupData.pNextWindow.lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isMember && pWindow != this)
|
if (!isMember && pWindow.get() != this)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto PCURRENT = getGroupCurrent();
|
const auto PCURRENT = getGroupCurrent();
|
||||||
|
@ -950,7 +960,7 @@ void CWindow::setGroupCurrent(CWindow* pWindow) {
|
||||||
const auto PWINDOWSIZE = PCURRENT->m_vRealSize.goal();
|
const auto PWINDOWSIZE = PCURRENT->m_vRealSize.goal();
|
||||||
const auto PWINDOWPOS = PCURRENT->m_vRealPosition.goal();
|
const auto PWINDOWPOS = PCURRENT->m_vRealPosition.goal();
|
||||||
|
|
||||||
const auto CURRENTISFOCUS = PCURRENT == g_pCompositor->m_pLastWindow;
|
const auto CURRENTISFOCUS = PCURRENT == g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (FULLSCREEN)
|
if (FULLSCREEN)
|
||||||
g_pCompositor->setWindowFullscreen(PCURRENT, false, WORKSPACE->m_efFullscreenMode);
|
g_pCompositor->setWindowFullscreen(PCURRENT, false, WORKSPACE->m_efFullscreenMode);
|
||||||
|
@ -978,14 +988,14 @@ void CWindow::setGroupCurrent(CWindow* pWindow) {
|
||||||
pWindow->updateWindowDecos();
|
pWindow->updateWindowDecos();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWindow::insertWindowToGroup(CWindow* pWindow) {
|
void CWindow::insertWindowToGroup(PHLWINDOW pWindow) {
|
||||||
const auto BEGINAT = this;
|
const auto BEGINAT = m_pSelf.lock();
|
||||||
const auto ENDAT = m_sGroupData.pNextWindow;
|
const auto ENDAT = m_sGroupData.pNextWindow.lock();
|
||||||
|
|
||||||
if (!pWindow->getDecorationByType(DECORATION_GROUPBAR))
|
if (!pWindow->getDecorationByType(DECORATION_GROUPBAR))
|
||||||
pWindow->addWindowDeco(std::make_unique<CHyprGroupBarDecoration>(pWindow));
|
pWindow->addWindowDeco(std::make_unique<CHyprGroupBarDecoration>(pWindow));
|
||||||
|
|
||||||
if (!pWindow->m_sGroupData.pNextWindow) {
|
if (!pWindow->m_sGroupData.pNextWindow.lock()) {
|
||||||
BEGINAT->m_sGroupData.pNextWindow = pWindow;
|
BEGINAT->m_sGroupData.pNextWindow = pWindow;
|
||||||
pWindow->m_sGroupData.pNextWindow = ENDAT;
|
pWindow->m_sGroupData.pNextWindow = ENDAT;
|
||||||
pWindow->m_sGroupData.head = false;
|
pWindow->m_sGroupData.head = false;
|
||||||
|
@ -1000,26 +1010,26 @@ void CWindow::insertWindowToGroup(CWindow* pWindow) {
|
||||||
STAIL->m_sGroupData.pNextWindow = ENDAT;
|
STAIL->m_sGroupData.pNextWindow = ENDAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CWindow::getGroupPrevious() {
|
PHLWINDOW CWindow::getGroupPrevious() {
|
||||||
CWindow* curr = m_sGroupData.pNextWindow;
|
PHLWINDOW curr = m_sGroupData.pNextWindow.lock();
|
||||||
|
|
||||||
while (curr != this && curr->m_sGroupData.pNextWindow != this)
|
while (curr != m_pSelf.lock() && curr->m_sGroupData.pNextWindow.lock().get() != this)
|
||||||
curr = curr->m_sGroupData.pNextWindow;
|
curr = curr->m_sGroupData.pNextWindow.lock();
|
||||||
|
|
||||||
return curr;
|
return curr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWindow::switchWithWindowInGroup(CWindow* pWindow) {
|
void CWindow::switchWithWindowInGroup(PHLWINDOW pWindow) {
|
||||||
if (!m_sGroupData.pNextWindow || !pWindow->m_sGroupData.pNextWindow)
|
if (!m_sGroupData.pNextWindow.lock() || !pWindow->m_sGroupData.pNextWindow.lock())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_sGroupData.pNextWindow == pWindow) { // A -> this -> pWindow -> B >> A -> pWindow -> this -> B
|
if (m_sGroupData.pNextWindow.lock() == pWindow) { // A -> this -> pWindow -> B >> A -> pWindow -> this -> B
|
||||||
getGroupPrevious()->m_sGroupData.pNextWindow = pWindow;
|
getGroupPrevious()->m_sGroupData.pNextWindow = pWindow;
|
||||||
m_sGroupData.pNextWindow = pWindow->m_sGroupData.pNextWindow;
|
m_sGroupData.pNextWindow = pWindow->m_sGroupData.pNextWindow;
|
||||||
pWindow->m_sGroupData.pNextWindow = this;
|
pWindow->m_sGroupData.pNextWindow = m_pSelf;
|
||||||
|
|
||||||
} else if (pWindow->m_sGroupData.pNextWindow == this) { // A -> pWindow -> this -> B >> A -> this -> pWindow -> B
|
} else if (pWindow->m_sGroupData.pNextWindow.lock().get() == this) { // A -> pWindow -> this -> B >> A -> this -> pWindow -> B
|
||||||
pWindow->getGroupPrevious()->m_sGroupData.pNextWindow = this;
|
pWindow->getGroupPrevious()->m_sGroupData.pNextWindow = m_pSelf;
|
||||||
pWindow->m_sGroupData.pNextWindow = m_sGroupData.pNextWindow;
|
pWindow->m_sGroupData.pNextWindow = m_sGroupData.pNextWindow;
|
||||||
m_sGroupData.pNextWindow = pWindow;
|
m_sGroupData.pNextWindow = pWindow;
|
||||||
|
|
||||||
|
@ -1033,21 +1043,21 @@ void CWindow::switchWithWindowInGroup(CWindow* pWindow) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWindow::updateGroupOutputs() {
|
void CWindow::updateGroupOutputs() {
|
||||||
if (!m_sGroupData.pNextWindow)
|
if (m_sGroupData.pNextWindow.expired())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CWindow* curr = m_sGroupData.pNextWindow;
|
PHLWINDOW curr = m_sGroupData.pNextWindow.lock();
|
||||||
|
|
||||||
const auto WS = m_pWorkspace;
|
const auto WS = m_pWorkspace;
|
||||||
|
|
||||||
while (curr != this) {
|
while (curr.get() != this) {
|
||||||
curr->m_iMonitorID = m_iMonitorID;
|
curr->m_iMonitorID = m_iMonitorID;
|
||||||
curr->moveToWorkspace(WS);
|
curr->moveToWorkspace(WS);
|
||||||
|
|
||||||
curr->m_vRealPosition = m_vRealPosition.goal();
|
curr->m_vRealPosition = m_vRealPosition.goal();
|
||||||
curr->m_vRealSize = m_vRealSize.goal();
|
curr->m_vRealSize = m_vRealSize.goal();
|
||||||
|
|
||||||
curr = curr->m_sGroupData.pNextWindow;
|
curr = curr->m_sGroupData.pNextWindow.lock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1258,7 +1268,7 @@ void CWindow::activate() {
|
||||||
static auto PFOCUSONACTIVATE = CConfigValue<Hyprlang::INT>("misc:focus_on_activate");
|
static auto PFOCUSONACTIVATE = CConfigValue<Hyprlang::INT>("misc:focus_on_activate");
|
||||||
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"urgent", std::format("{:x}", (uintptr_t)this)});
|
g_pEventManager->postEvent(SHyprIPCEvent{"urgent", std::format("{:x}", (uintptr_t)this)});
|
||||||
EMIT_HOOK_EVENT("urgent", this);
|
EMIT_HOOK_EVENT("urgent", m_pSelf.lock());
|
||||||
|
|
||||||
m_bIsUrgent = true;
|
m_bIsUrgent = true;
|
||||||
|
|
||||||
|
@ -1266,8 +1276,8 @@ void CWindow::activate() {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_bIsFloating)
|
if (m_bIsFloating)
|
||||||
g_pCompositor->changeWindowZOrder(this, true);
|
g_pCompositor->changeWindowZOrder(m_pSelf.lock(), true);
|
||||||
|
|
||||||
g_pCompositor->focusWindow(this);
|
g_pCompositor->focusWindow(m_pSelf.lock());
|
||||||
g_pCompositor->warpCursorTo(middle());
|
g_pCompositor->warpCursorTo(middle());
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
#include "DesktopTypes.hpp"
|
#include "DesktopTypes.hpp"
|
||||||
#include "../helpers/signal/Signal.hpp"
|
#include "../helpers/signal/Signal.hpp"
|
||||||
|
|
||||||
class CWindow;
|
|
||||||
|
|
||||||
enum eIdleInhibitMode {
|
enum eIdleInhibitMode {
|
||||||
IDLEINHIBIT_NONE = 0,
|
IDLEINHIBIT_NONE = 0,
|
||||||
IDLEINHIBIT_ALWAYS,
|
IDLEINHIBIT_ALWAYS,
|
||||||
|
@ -191,13 +189,18 @@ struct SWindowRule {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SInitialWorkspaceToken {
|
struct SInitialWorkspaceToken {
|
||||||
CWindow* primaryOwner = nullptr;
|
PHLWINDOWREF primaryOwner;
|
||||||
std::string workspace;
|
std::string workspace;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CWindow {
|
class CWindow {
|
||||||
public:
|
public:
|
||||||
|
static PHLWINDOW create();
|
||||||
|
|
||||||
|
private:
|
||||||
CWindow();
|
CWindow();
|
||||||
|
|
||||||
|
public:
|
||||||
~CWindow();
|
~CWindow();
|
||||||
|
|
||||||
DYNLISTENER(commitWindow);
|
DYNLISTENER(commitWindow);
|
||||||
|
@ -279,13 +282,13 @@ class CWindow {
|
||||||
bool m_bCreatedOverFullscreen = false;
|
bool m_bCreatedOverFullscreen = false;
|
||||||
|
|
||||||
// XWayland stuff
|
// XWayland stuff
|
||||||
bool m_bIsX11 = false;
|
bool m_bIsX11 = false;
|
||||||
CWindow* m_pX11Parent = nullptr;
|
PHLWINDOWREF m_pX11Parent;
|
||||||
uint64_t m_iX11Type = 0;
|
uint64_t m_iX11Type = 0;
|
||||||
bool m_bIsModal = false;
|
bool m_bIsModal = false;
|
||||||
bool m_bX11DoesntWantBorders = false;
|
bool m_bX11DoesntWantBorders = false;
|
||||||
bool m_bX11ShouldntFocus = false;
|
bool m_bX11ShouldntFocus = false;
|
||||||
float m_fX11SurfaceScaledBy = 1.f;
|
float m_fX11SurfaceScaledBy = 1.f;
|
||||||
//
|
//
|
||||||
|
|
||||||
// For nofocus
|
// For nofocus
|
||||||
|
@ -326,7 +329,7 @@ class CWindow {
|
||||||
bool m_bFakeFullscreenState = false;
|
bool m_bFakeFullscreenState = false;
|
||||||
|
|
||||||
// for proper cycling. While cycling we can't just move the pointers, so we need to keep track of the last cycled window.
|
// for proper cycling. While cycling we can't just move the pointers, so we need to keep track of the last cycled window.
|
||||||
CWindow* m_pLastCycledWindow = nullptr;
|
PHLWINDOWREF m_pLastCycledWindow;
|
||||||
|
|
||||||
// Window decorations
|
// Window decorations
|
||||||
std::deque<std::unique_ptr<IHyprWindowDecoration>> m_dWindowDecorations;
|
std::deque<std::unique_ptr<IHyprWindowDecoration>> m_dWindowDecorations;
|
||||||
|
@ -349,7 +352,7 @@ class CWindow {
|
||||||
CAnimatedVariable<float> m_fDimPercent;
|
CAnimatedVariable<float> m_fDimPercent;
|
||||||
|
|
||||||
// swallowing
|
// swallowing
|
||||||
CWindow* m_pSwallowed = nullptr;
|
PHLWINDOWREF m_pSwallowed;
|
||||||
|
|
||||||
// focus stuff
|
// focus stuff
|
||||||
bool m_bStayFocused = false;
|
bool m_bStayFocused = false;
|
||||||
|
@ -366,10 +369,10 @@ class CWindow {
|
||||||
|
|
||||||
// for groups
|
// for groups
|
||||||
struct SGroupData {
|
struct SGroupData {
|
||||||
CWindow* pNextWindow = nullptr; // nullptr means no grouping. Self means single group.
|
PHLWINDOWREF pNextWindow; // nullptr means no grouping. Self means single group.
|
||||||
bool head = false;
|
bool head = false;
|
||||||
bool locked = false; // per group lock
|
bool locked = false; // per group lock
|
||||||
bool deny = false; // deny window from enter a group or made a group
|
bool deny = false; // deny window from enter a group or made a group
|
||||||
} m_sGroupData;
|
} m_sGroupData;
|
||||||
uint16_t m_eGroupRules = GROUP_NONE;
|
uint16_t m_eGroupRules = GROUP_NONE;
|
||||||
|
|
||||||
|
@ -398,7 +401,7 @@ class CWindow {
|
||||||
void updateToplevel();
|
void updateToplevel();
|
||||||
void updateSurfaceScaleTransformDetails();
|
void updateSurfaceScaleTransformDetails();
|
||||||
void moveToWorkspace(PHLWORKSPACE);
|
void moveToWorkspace(PHLWORKSPACE);
|
||||||
CWindow* X11TransientFor();
|
PHLWINDOW X11TransientFor();
|
||||||
void onUnmap();
|
void onUnmap();
|
||||||
void onMap();
|
void onMap();
|
||||||
void setHidden(bool hidden);
|
void setHidden(bool hidden);
|
||||||
|
@ -429,23 +432,26 @@ class CWindow {
|
||||||
void applyGroupRules();
|
void applyGroupRules();
|
||||||
void createGroup();
|
void createGroup();
|
||||||
void destroyGroup();
|
void destroyGroup();
|
||||||
CWindow* getGroupHead();
|
PHLWINDOW getGroupHead();
|
||||||
CWindow* getGroupTail();
|
PHLWINDOW getGroupTail();
|
||||||
CWindow* getGroupCurrent();
|
PHLWINDOW getGroupCurrent();
|
||||||
CWindow* getGroupPrevious();
|
PHLWINDOW getGroupPrevious();
|
||||||
CWindow* getGroupWindowByIndex(int);
|
PHLWINDOW getGroupWindowByIndex(int);
|
||||||
int getGroupSize();
|
int getGroupSize();
|
||||||
bool canBeGroupedInto(CWindow* pWindow);
|
bool canBeGroupedInto(PHLWINDOW pWindow);
|
||||||
void setGroupCurrent(CWindow* pWindow);
|
void setGroupCurrent(PHLWINDOW pWindow);
|
||||||
void insertWindowToGroup(CWindow* pWindow);
|
void insertWindowToGroup(PHLWINDOW pWindow);
|
||||||
void updateGroupOutputs();
|
void updateGroupOutputs();
|
||||||
void switchWithWindowInGroup(CWindow* pWindow);
|
void switchWithWindowInGroup(PHLWINDOW pWindow);
|
||||||
void setAnimationsToMove();
|
void setAnimationsToMove();
|
||||||
void onWorkspaceAnimUpdate();
|
void onWorkspaceAnimUpdate();
|
||||||
|
|
||||||
//
|
//
|
||||||
std::unordered_map<std::string, std::string> getEnv();
|
std::unordered_map<std::string, std::string> getEnv();
|
||||||
|
|
||||||
|
//
|
||||||
|
PHLWINDOWREF m_pSelf;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// For hidden windows and stuff
|
// For hidden windows and stuff
|
||||||
bool m_bHidden = false;
|
bool m_bHidden = false;
|
||||||
|
@ -453,6 +459,26 @@ class CWindow {
|
||||||
int m_iLastWorkspace = WORKSPACE_INVALID;
|
int m_iLastWorkspace = WORKSPACE_INVALID;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline bool valid(PHLWINDOW w) {
|
||||||
|
return w.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool valid(PHLWINDOWREF w) {
|
||||||
|
return w.lock().get();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool validMapped(PHLWINDOW w) {
|
||||||
|
if (!valid(w))
|
||||||
|
return false;
|
||||||
|
return w->m_bIsMapped;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool validMapped(PHLWINDOWREF w) {
|
||||||
|
if (!valid(w))
|
||||||
|
return false;
|
||||||
|
return w.lock()->m_bIsMapped;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
format specification
|
format specification
|
||||||
- 'x', only address, equivalent of (uintpr_t)CWindow*
|
- 'x', only address, equivalent of (uintpr_t)CWindow*
|
||||||
|
@ -462,7 +488,7 @@ class CWindow {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template <typename CharT>
|
template <typename CharT>
|
||||||
struct std::formatter<CWindow*, CharT> : std::formatter<CharT> {
|
struct std::formatter<PHLWINDOW, CharT> : std::formatter<CharT> {
|
||||||
bool formatAddressOnly = false;
|
bool formatAddressOnly = false;
|
||||||
bool formatWorkspace = false;
|
bool formatWorkspace = false;
|
||||||
bool formatMonitor = false;
|
bool formatMonitor = false;
|
||||||
|
@ -472,18 +498,18 @@ struct std::formatter<CWindow*, CharT> : std::formatter<CharT> {
|
||||||
FORMAT_FLAG('m', formatMonitor) //
|
FORMAT_FLAG('m', formatMonitor) //
|
||||||
FORMAT_FLAG('w', formatWorkspace) //
|
FORMAT_FLAG('w', formatWorkspace) //
|
||||||
FORMAT_FLAG('c', formatClass),
|
FORMAT_FLAG('c', formatClass),
|
||||||
CWindow*)
|
PHLWINDOW)
|
||||||
|
|
||||||
template <typename FormatContext>
|
template <typename FormatContext>
|
||||||
auto format(CWindow* const& w, FormatContext& ctx) const {
|
auto format(PHLWINDOW const& w, FormatContext& ctx) const {
|
||||||
auto&& out = ctx.out();
|
auto&& out = ctx.out();
|
||||||
if (formatAddressOnly)
|
if (formatAddressOnly)
|
||||||
return std::format_to(out, "{:x}", (uintptr_t)w);
|
return std::format_to(out, "{:x}", (uintptr_t)w.get());
|
||||||
if (!w)
|
if (!w)
|
||||||
return std::format_to(out, "[Window nullptr]");
|
return std::format_to(out, "[Window nullptr]");
|
||||||
|
|
||||||
std::format_to(out, "[");
|
std::format_to(out, "[");
|
||||||
std::format_to(out, "Window {:x}: title: \"{}\"", (uintptr_t)w, w->m_szTitle);
|
std::format_to(out, "Window {:x}: title: \"{}\"", (uintptr_t)w.get(), w->m_szTitle);
|
||||||
if (formatWorkspace)
|
if (formatWorkspace)
|
||||||
std::format_to(out, ", workspace: {}", w->m_pWorkspace ? w->workspaceID() : WORKSPACE_INVALID);
|
std::format_to(out, ", workspace: {}", w->m_pWorkspace ? w->workspaceID() : WORKSPACE_INVALID);
|
||||||
if (formatMonitor)
|
if (formatMonitor)
|
||||||
|
|
|
@ -33,10 +33,10 @@ void CWorkspace::init(PHLWORKSPACE self) {
|
||||||
m_szName = RULEFORTHIS.defaultName.value();
|
m_szName = RULEFORTHIS.defaultName.value();
|
||||||
|
|
||||||
m_pFocusedWindowHook = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any param) {
|
m_pFocusedWindowHook = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any param) {
|
||||||
const auto PWINDOW = std::any_cast<CWindow*>(param);
|
const auto PWINDOW = std::any_cast<PHLWINDOW>(param);
|
||||||
|
|
||||||
if (PWINDOW == m_pLastFocusedWindow)
|
if (PWINDOW == m_pLastFocusedWindow.lock())
|
||||||
m_pLastFocusedWindow = nullptr;
|
m_pLastFocusedWindow.reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
m_bInert = false;
|
m_bInert = false;
|
||||||
|
@ -75,7 +75,7 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
||||||
// set floating windows offset callbacks
|
// set floating windows offset callbacks
|
||||||
m_vRenderOffset.setUpdateCallback([&](void*) {
|
m_vRenderOffset.setUpdateCallback([&](void*) {
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!g_pCompositor->windowValidMapped(w.get()) || w->workspaceID() != m_iID)
|
if (!validMapped(w) || w->workspaceID() != m_iID)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
w->onWorkspaceAnimUpdate();
|
w->onWorkspaceAnimUpdate();
|
||||||
|
@ -182,11 +182,11 @@ void CWorkspace::moveToMonitor(const int& id) {
|
||||||
; // empty until https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/40
|
; // empty until https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/40
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CWorkspace::getLastFocusedWindow() {
|
PHLWINDOW CWorkspace::getLastFocusedWindow() {
|
||||||
if (!g_pCompositor->windowValidMapped(m_pLastFocusedWindow) || m_pLastFocusedWindow->workspaceID() != m_iID)
|
if (!validMapped(m_pLastFocusedWindow) || m_pLastFocusedWindow.lock()->workspaceID() != m_iID)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return m_pLastFocusedWindow;
|
return m_pLastFocusedWindow.lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorkspace::rememberPrevWorkspace(const PHLWORKSPACE& prev) {
|
void CWorkspace::rememberPrevWorkspace(const PHLWORKSPACE& prev) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ class CWorkspace {
|
||||||
bool m_bIsSpecialWorkspace = false;
|
bool m_bIsSpecialWorkspace = false;
|
||||||
|
|
||||||
// last window
|
// last window
|
||||||
CWindow* m_pLastFocusedWindow = nullptr;
|
PHLWINDOWREF m_pLastFocusedWindow;
|
||||||
|
|
||||||
// user-set
|
// user-set
|
||||||
bool m_bDefaultFloating = false;
|
bool m_bDefaultFloating = false;
|
||||||
|
@ -68,7 +68,7 @@ class CWorkspace {
|
||||||
|
|
||||||
void moveToMonitor(const int&);
|
void moveToMonitor(const int&);
|
||||||
|
|
||||||
CWindow* getLastFocusedWindow();
|
PHLWINDOW getLastFocusedWindow();
|
||||||
void rememberPrevWorkspace(const PHLWORKSPACE& prevWorkspace);
|
void rememberPrevWorkspace(const PHLWORKSPACE& prevWorkspace);
|
||||||
|
|
||||||
std::string getConfigName();
|
std::string getConfigName();
|
||||||
|
|
|
@ -237,9 +237,9 @@ void Events::listener_unmapLayerSurface(void* owner, void* data) {
|
||||||
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
|
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
|
||||||
&surfaceCoords, &pFoundLayerSurface);
|
&surfaceCoords, &pFoundLayerSurface);
|
||||||
|
|
||||||
if (!foundSurface && g_pCompositor->m_pLastWindow && g_pCompositor->isWorkspaceVisible(g_pCompositor->m_pLastWindow->m_pWorkspace)) {
|
if (!foundSurface && g_pCompositor->m_pLastWindow.lock() && g_pCompositor->isWorkspaceVisible(g_pCompositor->m_pLastWindow.lock()->m_pWorkspace)) {
|
||||||
// if there isn't any, focus the last window
|
// if there isn't any, focus the last window
|
||||||
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow;
|
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
g_pCompositor->focusWindow(nullptr);
|
g_pCompositor->focusWindow(nullptr);
|
||||||
g_pCompositor->focusWindow(PLASTWINDOW);
|
g_pCompositor->focusWindow(PLASTWINDOW);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -141,7 +141,8 @@ void Events::listener_destroyDrag(void* owner, void* data) {
|
||||||
g_pInputManager->m_sDrag.dragIcon = nullptr;
|
g_pInputManager->m_sDrag.dragIcon = nullptr;
|
||||||
g_pInputManager->m_sDrag.hyprListener_destroy.removeCallback();
|
g_pInputManager->m_sDrag.hyprListener_destroy.removeCallback();
|
||||||
|
|
||||||
g_pCompositor->focusWindow(g_pCompositor->m_pLastWindow, g_pCompositor->m_pLastWindow ? g_pXWaylandManager->getWindowSurface(g_pCompositor->m_pLastWindow) : nullptr);
|
g_pCompositor->focusWindow(g_pCompositor->m_pLastWindow.lock(),
|
||||||
|
g_pCompositor->m_pLastWindow.lock() ? g_pXWaylandManager->getWindowSurface(g_pCompositor->m_pLastWindow.lock()) : nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_mapDragIcon(void* owner, void* data) {
|
void Events::listener_mapDragIcon(void* owner, void* data) {
|
||||||
|
|
|
@ -146,7 +146,7 @@ void Events::listener_monitorFrame(void* owner, void* data) {
|
||||||
|
|
||||||
PMONITOR->tearingState.busy = false;
|
PMONITOR->tearingState.busy = false;
|
||||||
|
|
||||||
if (PMONITOR->tearingState.activelyTearing && PMONITOR->solitaryClient /* can be invalidated by a recheck */) {
|
if (PMONITOR->tearingState.activelyTearing && PMONITOR->solitaryClient.lock() /* can be invalidated by a recheck */) {
|
||||||
|
|
||||||
if (!PMONITOR->tearingState.frameScheduledWhileBusy)
|
if (!PMONITOR->tearingState.frameScheduledWhileBusy)
|
||||||
return; // we did not schedule a frame yet to be displayed, but we are tearing. Why render?
|
return; // we did not schedule a frame yet to be displayed, but we are tearing. Why render?
|
||||||
|
|
|
@ -43,7 +43,7 @@ void setAnimToMove(void* data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_mapWindow(void* owner, void* data) {
|
void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
CWindow* PWINDOW = (CWindow*)owner;
|
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
|
||||||
|
|
||||||
static auto PINACTIVEALPHA = CConfigValue<Hyprlang::FLOAT>("decoration:inactive_opacity");
|
static auto PINACTIVEALPHA = CConfigValue<Hyprlang::FLOAT>("decoration:inactive_opacity");
|
||||||
static auto PACTIVEALPHA = CConfigValue<Hyprlang::FLOAT>("decoration:active_opacity");
|
static auto PACTIVEALPHA = CConfigValue<Hyprlang::FLOAT>("decoration:active_opacity");
|
||||||
|
@ -95,7 +95,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
if (*PINITIALWSTRACKING == 1) // one-shot token
|
if (*PINITIALWSTRACKING == 1) // one-shot token
|
||||||
g_pTokenManager->removeToken(TOKEN);
|
g_pTokenManager->removeToken(TOKEN);
|
||||||
else if (*PINITIALWSTRACKING == 2) { // persistent
|
else if (*PINITIALWSTRACKING == 2) { // persistent
|
||||||
if (!WS.primaryOwner) {
|
if (WS.primaryOwner.expired()) {
|
||||||
WS.primaryOwner = PWINDOW;
|
WS.primaryOwner = PWINDOW;
|
||||||
TOKEN->data = WS;
|
TOKEN->data = WS;
|
||||||
}
|
}
|
||||||
|
@ -462,7 +462,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize.goal() - Vector2D(10, 10);
|
PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize.goal() - Vector2D(10, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto PFOCUSEDWINDOWPREV = g_pCompositor->m_pLastWindow;
|
const auto PFOCUSEDWINDOWPREV = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (PWINDOW->m_sAdditionalConfigData.forceAllowsInput) {
|
if (PWINDOW->m_sAdditionalConfigData.forceAllowsInput) {
|
||||||
PWINDOW->m_sAdditionalConfigData.noFocus = false;
|
PWINDOW->m_sAdditionalConfigData.noFocus = false;
|
||||||
|
@ -499,28 +499,30 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PWINDOW->m_bIsX11) {
|
if (!PWINDOW->m_bIsX11) {
|
||||||
PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.set_title, &Events::listener_setTitleWindow, PWINDOW, "XDG Window Late");
|
PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.set_title, &Events::listener_setTitleWindow, PWINDOW.get(), "XDG Window Late");
|
||||||
PWINDOW->hyprListener_requestMaximize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_maximize, &Events::listener_requestMaximize, PWINDOW,
|
PWINDOW->hyprListener_requestMaximize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_maximize, &Events::listener_requestMaximize, PWINDOW.get(),
|
||||||
"XDG Window Late");
|
"XDG Window Late");
|
||||||
PWINDOW->hyprListener_requestMinimize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_minimize, &Events::listener_requestMinimize, PWINDOW,
|
PWINDOW->hyprListener_requestMinimize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_minimize, &Events::listener_requestMinimize, PWINDOW.get(),
|
||||||
"XDG Window Late");
|
"XDG Window Late");
|
||||||
PWINDOW->hyprListener_requestMove.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_move, &Events::listener_requestMove, PWINDOW, "XDG Window Late");
|
PWINDOW->hyprListener_requestMove.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_move, &Events::listener_requestMove, PWINDOW.get(), "XDG Window Late");
|
||||||
PWINDOW->hyprListener_requestResize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_resize, &Events::listener_requestResize, PWINDOW, "XDG Window Late");
|
PWINDOW->hyprListener_requestResize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_resize, &Events::listener_requestResize, PWINDOW.get(),
|
||||||
PWINDOW->hyprListener_fullscreenWindow.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_fullscreen, &Events::listener_fullscreenWindow, PWINDOW,
|
"XDG Window Late");
|
||||||
|
PWINDOW->hyprListener_fullscreenWindow.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_fullscreen, &Events::listener_fullscreenWindow, PWINDOW.get(),
|
||||||
"XDG Window Late");
|
"XDG Window Late");
|
||||||
PWINDOW->hyprListener_ackConfigure.initCallback(&PWINDOW->m_uSurface.xdg->events.ack_configure, &Events::listener_ackConfigure, PWINDOW, "XDG Window Late");
|
PWINDOW->hyprListener_ackConfigure.initCallback(&PWINDOW->m_uSurface.xdg->events.ack_configure, &Events::listener_ackConfigure, PWINDOW.get(), "XDG Window Late");
|
||||||
} else {
|
} else {
|
||||||
PWINDOW->hyprListener_fullscreenWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_fullscreen, &Events::listener_fullscreenWindow, PWINDOW,
|
PWINDOW->hyprListener_fullscreenWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_fullscreen, &Events::listener_fullscreenWindow, PWINDOW.get(),
|
||||||
"XWayland Window Late");
|
"XWayland Window Late");
|
||||||
PWINDOW->hyprListener_activateX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_activate, &Events::listener_activateX11, PWINDOW, "XWayland Window Late");
|
PWINDOW->hyprListener_activateX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_activate, &Events::listener_activateX11, PWINDOW.get(),
|
||||||
PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_title, &Events::listener_setTitleWindow, PWINDOW, "XWayland Window Late");
|
"XWayland Window Late");
|
||||||
PWINDOW->hyprListener_requestMinimize.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_minimize, &Events::listener_requestMinimize, PWINDOW,
|
PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_title, &Events::listener_setTitleWindow, PWINDOW.get(), "XWayland Window Late");
|
||||||
|
PWINDOW->hyprListener_requestMinimize.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_minimize, &Events::listener_requestMinimize, PWINDOW.get(),
|
||||||
"Xwayland Window Late");
|
"Xwayland Window Late");
|
||||||
PWINDOW->hyprListener_requestMaximize.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_maximize, &Events::listener_requestMaximize, PWINDOW,
|
PWINDOW->hyprListener_requestMaximize.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_maximize, &Events::listener_requestMaximize, PWINDOW.get(),
|
||||||
"Xwayland Window Late");
|
"Xwayland Window Late");
|
||||||
|
|
||||||
if (PWINDOW->m_iX11Type == 2)
|
if (PWINDOW->m_iX11Type == 2)
|
||||||
PWINDOW->hyprListener_setGeometryX11U.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_geometry, &Events::listener_unmanagedSetGeometry, PWINDOW,
|
PWINDOW->hyprListener_setGeometryX11U.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_geometry, &Events::listener_unmanagedSetGeometry, PWINDOW.get(),
|
||||||
"XWayland Window Late");
|
"XWayland Window Late");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -550,7 +552,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
PWINDOW->updateToplevel();
|
PWINDOW->updateToplevel();
|
||||||
|
|
||||||
if (workspaceSilent) {
|
if (workspaceSilent) {
|
||||||
if (g_pCompositor->windowValidMapped(PFOCUSEDWINDOWPREV)) {
|
if (validMapped(PFOCUSEDWINDOWPREV)) {
|
||||||
g_pCompositor->focusWindow(PFOCUSEDWINDOWPREV);
|
g_pCompositor->focusWindow(PFOCUSEDWINDOWPREV);
|
||||||
PFOCUSEDWINDOWPREV->updateWindowDecos(); // need to for some reason i cba to find out why
|
PFOCUSEDWINDOWPREV->updateWindowDecos(); // need to for some reason i cba to find out why
|
||||||
} else if (!PFOCUSEDWINDOWPREV)
|
} else if (!PFOCUSEDWINDOWPREV)
|
||||||
|
@ -579,14 +581,14 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
|
|
||||||
if (ppid) {
|
if (ppid) {
|
||||||
// get window by pid
|
// get window by pid
|
||||||
std::vector<CWindow*> found;
|
std::vector<PHLWINDOW> found;
|
||||||
CWindow* finalFound = nullptr;
|
PHLWINDOW finalFound;
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!w->m_bIsMapped || w->isHidden())
|
if (!w->m_bIsMapped || w->isHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w->getPID() == ppid) {
|
if (w->getPID() == ppid) {
|
||||||
found.push_back(w.get());
|
found.push_back(w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -670,7 +672,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_unmapWindow(void* owner, void* data) {
|
void Events::listener_unmapWindow(void* owner, void* data) {
|
||||||
CWindow* PWINDOW = (CWindow*)owner;
|
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
|
||||||
|
|
||||||
Debug::log(LOG, "{:c} unmapped", PWINDOW);
|
Debug::log(LOG, "{:c} unmapped", PWINDOW);
|
||||||
|
|
||||||
|
@ -718,18 +720,18 @@ void Events::listener_unmapWindow(void* owner, void* data) {
|
||||||
g_pHyprOpenGL->makeWindowSnapshot(PWINDOW);
|
g_pHyprOpenGL->makeWindowSnapshot(PWINDOW);
|
||||||
|
|
||||||
// swallowing
|
// swallowing
|
||||||
if (PWINDOW->m_pSwallowed && g_pCompositor->windowExists(PWINDOW->m_pSwallowed)) {
|
if (valid(PWINDOW->m_pSwallowed)) {
|
||||||
PWINDOW->m_pSwallowed->setHidden(false);
|
PWINDOW->m_pSwallowed.lock()->setHidden(false);
|
||||||
g_pLayoutManager->getCurrentLayout()->onWindowCreated(PWINDOW->m_pSwallowed);
|
g_pLayoutManager->getCurrentLayout()->onWindowCreated(PWINDOW->m_pSwallowed.lock());
|
||||||
PWINDOW->m_pSwallowed = nullptr;
|
PWINDOW->m_pSwallowed.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wasLastWindow = false;
|
bool wasLastWindow = false;
|
||||||
|
|
||||||
if (PWINDOW == g_pCompositor->m_pLastWindow) {
|
if (PWINDOW == g_pCompositor->m_pLastWindow.lock()) {
|
||||||
wasLastWindow = true;
|
wasLastWindow = true;
|
||||||
g_pCompositor->m_pLastWindow = nullptr;
|
g_pCompositor->m_pLastWindow.reset();
|
||||||
g_pCompositor->m_pLastFocus = nullptr;
|
g_pCompositor->m_pLastFocus = nullptr;
|
||||||
|
|
||||||
g_pInputManager->releaseAllMouseButtons();
|
g_pInputManager->releaseAllMouseButtons();
|
||||||
}
|
}
|
||||||
|
@ -751,7 +753,7 @@ void Events::listener_unmapWindow(void* owner, void* data) {
|
||||||
|
|
||||||
Debug::log(LOG, "On closed window, new focused candidate is {}", PWINDOWCANDIDATE);
|
Debug::log(LOG, "On closed window, new focused candidate is {}", PWINDOWCANDIDATE);
|
||||||
|
|
||||||
if (PWINDOWCANDIDATE != g_pCompositor->m_pLastWindow && PWINDOWCANDIDATE)
|
if (PWINDOWCANDIDATE != g_pCompositor->m_pLastWindow.lock() && PWINDOWCANDIDATE)
|
||||||
g_pCompositor->focusWindow(PWINDOWCANDIDATE);
|
g_pCompositor->focusWindow(PWINDOWCANDIDATE);
|
||||||
|
|
||||||
if (!PWINDOWCANDIDATE && g_pCompositor->getWindowsOnWorkspace(PWINDOW->workspaceID()) == 0)
|
if (!PWINDOWCANDIDATE && g_pCompositor->getWindowsOnWorkspace(PWINDOW->workspaceID()) == 0)
|
||||||
|
@ -760,10 +762,10 @@ void Events::listener_unmapWindow(void* owner, void* data) {
|
||||||
g_pInputManager->sendMotionEventsToFocused();
|
g_pInputManager->sendMotionEventsToFocused();
|
||||||
|
|
||||||
// CWindow::onUnmap will remove this window's active status, but we can't really do it above.
|
// CWindow::onUnmap will remove this window's active status, but we can't really do it above.
|
||||||
if (PWINDOW == g_pCompositor->m_pLastWindow || !g_pCompositor->m_pLastWindow) {
|
if (PWINDOW == g_pCompositor->m_pLastWindow.lock() || !g_pCompositor->m_pLastWindow.lock()) {
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", ","});
|
g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", ","});
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", ","});
|
g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", ","});
|
||||||
EMIT_HOOK_EVENT("activeWindow", (CWindow*)nullptr);
|
EMIT_HOOK_EVENT("activeWindow", (PHLWINDOW) nullptr);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Debug::log(LOG, "Unmapped was not focused, ignoring a refocus.");
|
Debug::log(LOG, "Unmapped was not focused, ignoring a refocus.");
|
||||||
|
@ -793,7 +795,7 @@ void Events::listener_unmapWindow(void* owner, void* data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_ackConfigure(void* owner, void* data) {
|
void Events::listener_ackConfigure(void* owner, void* data) {
|
||||||
CWindow* PWINDOW = (CWindow*)owner;
|
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
|
||||||
const auto E = (wlr_xdg_surface_configure*)data;
|
const auto E = (wlr_xdg_surface_configure*)data;
|
||||||
|
|
||||||
// find last matching serial
|
// find last matching serial
|
||||||
|
@ -807,7 +809,7 @@ void Events::listener_ackConfigure(void* owner, void* data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_commitWindow(void* owner, void* data) {
|
void Events::listener_commitWindow(void* owner, void* data) {
|
||||||
CWindow* PWINDOW = (CWindow*)owner;
|
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
|
||||||
|
|
||||||
if (!PWINDOW->m_bIsX11 && PWINDOW->m_uSurface.xdg->initial_commit) {
|
if (!PWINDOW->m_bIsX11 && PWINDOW->m_uSurface.xdg->initial_commit) {
|
||||||
Vector2D predSize = g_pLayoutManager->getCurrentLayout()->predictSizeForNewWindow(PWINDOW);
|
Vector2D predSize = g_pLayoutManager->getCurrentLayout()->predictSizeForNewWindow(PWINDOW);
|
||||||
|
@ -867,7 +869,7 @@ void Events::listener_commitWindow(void* owner, void* data) {
|
||||||
|
|
||||||
// tearing: if solitary, redraw it. This still might be a single surface window
|
// tearing: if solitary, redraw it. This still might be a single surface window
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
|
||||||
if (PMONITOR && PMONITOR->solitaryClient == PWINDOW && PWINDOW->canBeTorn() && PMONITOR->tearingState.canTear &&
|
if (PMONITOR && PMONITOR->solitaryClient.lock() == PWINDOW && PWINDOW->canBeTorn() && PMONITOR->tearingState.canTear &&
|
||||||
PWINDOW->m_pWLSurface.wlr()->current.committed & WLR_SURFACE_STATE_BUFFER) {
|
PWINDOW->m_pWLSurface.wlr()->current.committed & WLR_SURFACE_STATE_BUFFER) {
|
||||||
CRegion damageBox{&PWINDOW->m_pWLSurface.wlr()->buffer_damage};
|
CRegion damageBox{&PWINDOW->m_pWLSurface.wlr()->buffer_damage};
|
||||||
|
|
||||||
|
@ -883,16 +885,16 @@ void Events::listener_commitWindow(void* owner, void* data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_destroyWindow(void* owner, void* data) {
|
void Events::listener_destroyWindow(void* owner, void* data) {
|
||||||
CWindow* PWINDOW = (CWindow*)owner;
|
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
|
||||||
|
|
||||||
Debug::log(LOG, "{:c} destroyed, queueing.", PWINDOW);
|
Debug::log(LOG, "{:c} destroyed, queueing.", PWINDOW);
|
||||||
|
|
||||||
if (PWINDOW->m_bIsX11)
|
if (PWINDOW->m_bIsX11)
|
||||||
Debug::log(LOG, "XWayland class raw: {}", PWINDOW->m_uSurface.xwayland->_class ? PWINDOW->m_uSurface.xwayland->_class : "null");
|
Debug::log(LOG, "XWayland class raw: {}", PWINDOW->m_uSurface.xwayland->_class ? PWINDOW->m_uSurface.xwayland->_class : "null");
|
||||||
|
|
||||||
if (PWINDOW == g_pCompositor->m_pLastWindow) {
|
if (PWINDOW == g_pCompositor->m_pLastWindow.lock()) {
|
||||||
g_pCompositor->m_pLastWindow = nullptr;
|
g_pCompositor->m_pLastWindow.reset();
|
||||||
g_pCompositor->m_pLastFocus = nullptr;
|
g_pCompositor->m_pLastFocus = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
PWINDOW->m_pWLSurface.unassign();
|
PWINDOW->m_pWLSurface.unassign();
|
||||||
|
@ -919,9 +921,9 @@ void Events::listener_destroyWindow(void* owner, void* data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_setTitleWindow(void* owner, void* data) {
|
void Events::listener_setTitleWindow(void* owner, void* data) {
|
||||||
CWindow* PWINDOW = (CWindow*)owner;
|
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
|
||||||
|
|
||||||
if (!g_pCompositor->windowValidMapped(PWINDOW))
|
if (!validMapped(PWINDOW))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto NEWTITLE = g_pXWaylandManager->getTitle(PWINDOW);
|
const auto NEWTITLE = g_pXWaylandManager->getTitle(PWINDOW);
|
||||||
|
@ -930,12 +932,12 @@ void Events::listener_setTitleWindow(void* owner, void* data) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PWINDOW->m_szTitle = NEWTITLE;
|
PWINDOW->m_szTitle = NEWTITLE;
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"windowtitle", std::format("{:x}", (uintptr_t)PWINDOW)});
|
g_pEventManager->postEvent(SHyprIPCEvent{"windowtitle", std::format("{:x}", (uintptr_t)PWINDOW.get())});
|
||||||
EMIT_HOOK_EVENT("windowTitle", PWINDOW);
|
EMIT_HOOK_EVENT("windowTitle", PWINDOW);
|
||||||
|
|
||||||
if (PWINDOW == g_pCompositor->m_pLastWindow) { // if it's the active, let's post an event to update others
|
if (PWINDOW == g_pCompositor->m_pLastWindow.lock()) { // if it's the active, let's post an event to update others
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", g_pXWaylandManager->getAppIDClass(PWINDOW) + "," + PWINDOW->m_szTitle});
|
g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", g_pXWaylandManager->getAppIDClass(PWINDOW) + "," + PWINDOW->m_szTitle});
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", std::format("{:x}", (uintptr_t)PWINDOW)});
|
g_pEventManager->postEvent(SHyprIPCEvent{"activewindowv2", std::format("{:x}", (uintptr_t)PWINDOW.get())});
|
||||||
EMIT_HOOK_EVENT("activeWindow", PWINDOW);
|
EMIT_HOOK_EVENT("activeWindow", PWINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -947,7 +949,7 @@ void Events::listener_setTitleWindow(void* owner, void* data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_fullscreenWindow(void* owner, void* data) {
|
void Events::listener_fullscreenWindow(void* owner, void* data) {
|
||||||
CWindow* PWINDOW = (CWindow*)owner;
|
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
|
||||||
|
|
||||||
if (!PWINDOW->m_bIsMapped) {
|
if (!PWINDOW->m_bIsMapped) {
|
||||||
PWINDOW->m_bWantsInitialFullscreen = true;
|
PWINDOW->m_bWantsInitialFullscreen = true;
|
||||||
|
@ -1015,14 +1017,14 @@ void Events::listener_activateXDG(wl_listener* listener, void* data) {
|
||||||
|
|
||||||
const auto PWINDOW = g_pCompositor->getWindowFromSurface(E->surface);
|
const auto PWINDOW = g_pCompositor->getWindowFromSurface(E->surface);
|
||||||
|
|
||||||
if (!PWINDOW || PWINDOW == g_pCompositor->m_pLastWindow || (PWINDOW->m_eSuppressedEvents & SUPPRESS_ACTIVATE))
|
if (!PWINDOW || PWINDOW == g_pCompositor->m_pLastWindow.lock() || (PWINDOW->m_eSuppressedEvents & SUPPRESS_ACTIVATE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PWINDOW->activate();
|
PWINDOW->activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_activateX11(void* owner, void* data) {
|
void Events::listener_activateX11(void* owner, void* data) {
|
||||||
const auto PWINDOW = (CWindow*)owner;
|
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
|
||||||
|
|
||||||
Debug::log(LOG, "X11 Activate request for window {}", PWINDOW);
|
Debug::log(LOG, "X11 Activate request for window {}", PWINDOW);
|
||||||
|
|
||||||
|
@ -1030,7 +1032,7 @@ void Events::listener_activateX11(void* owner, void* data) {
|
||||||
|
|
||||||
Debug::log(LOG, "Unmanaged X11 {} requests activate", PWINDOW);
|
Debug::log(LOG, "Unmanaged X11 {} requests activate", PWINDOW);
|
||||||
|
|
||||||
if (g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->getPID() != PWINDOW->getPID())
|
if (g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow.lock()->getPID() != PWINDOW->getPID())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!wlr_xwayland_or_surface_wants_focus(PWINDOW->m_uSurface.xwayland))
|
if (!wlr_xwayland_or_surface_wants_focus(PWINDOW->m_uSurface.xwayland))
|
||||||
|
@ -1040,14 +1042,14 @@ void Events::listener_activateX11(void* owner, void* data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PWINDOW == g_pCompositor->m_pLastWindow || (PWINDOW->m_eSuppressedEvents & SUPPRESS_ACTIVATE))
|
if (PWINDOW == g_pCompositor->m_pLastWindow.lock() || (PWINDOW->m_eSuppressedEvents & SUPPRESS_ACTIVATE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PWINDOW->activate();
|
PWINDOW->activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_configureX11(void* owner, void* data) {
|
void Events::listener_configureX11(void* owner, void* data) {
|
||||||
CWindow* PWINDOW = (CWindow*)owner;
|
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
|
||||||
|
|
||||||
const auto E = (wlr_xwayland_surface_configure_event*)data;
|
const auto E = (wlr_xwayland_surface_configure_event*)data;
|
||||||
|
|
||||||
|
@ -1062,7 +1064,7 @@ void Events::listener_configureX11(void* owner, void* data) {
|
||||||
|
|
||||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||||
|
|
||||||
if (!PWINDOW->m_bIsFloating || PWINDOW->m_bIsFullscreen || g_pInputManager->currentlyDraggedWindow == PWINDOW) {
|
if (!PWINDOW->m_bIsFloating || PWINDOW->m_bIsFullscreen || g_pInputManager->currentlyDraggedWindow.lock() == PWINDOW) {
|
||||||
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goal(), true);
|
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goal(), true);
|
||||||
g_pInputManager->refocus();
|
g_pInputManager->refocus();
|
||||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||||
|
@ -1113,7 +1115,7 @@ void Events::listener_configureX11(void* owner, void* data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_unmanagedSetGeometry(void* owner, void* data) {
|
void Events::listener_unmanagedSetGeometry(void* owner, void* data) {
|
||||||
CWindow* PWINDOW = (CWindow*)owner;
|
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
|
||||||
|
|
||||||
if (!PWINDOW->m_bIsMapped)
|
if (!PWINDOW->m_bIsMapped)
|
||||||
return;
|
return;
|
||||||
|
@ -1178,16 +1180,16 @@ void Events::listener_setOverrideRedirect(void* owner, void* data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_associateX11(void* owner, void* data) {
|
void Events::listener_associateX11(void* owner, void* data) {
|
||||||
const auto PWINDOW = (CWindow*)owner;
|
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
|
||||||
|
|
||||||
PWINDOW->hyprListener_mapWindow.initCallback(&PWINDOW->m_uSurface.xwayland->surface->events.map, &Events::listener_mapWindow, PWINDOW, "XWayland Window");
|
PWINDOW->hyprListener_mapWindow.initCallback(&PWINDOW->m_uSurface.xwayland->surface->events.map, &Events::listener_mapWindow, PWINDOW.get(), "XWayland Window");
|
||||||
PWINDOW->hyprListener_commitWindow.initCallback(&PWINDOW->m_uSurface.xwayland->surface->events.commit, &Events::listener_commitWindow, PWINDOW, "XWayland Window");
|
PWINDOW->hyprListener_commitWindow.initCallback(&PWINDOW->m_uSurface.xwayland->surface->events.commit, &Events::listener_commitWindow, PWINDOW.get(), "XWayland Window");
|
||||||
|
|
||||||
PWINDOW->m_pWLSurface.assign(g_pXWaylandManager->getWindowSurface(PWINDOW), PWINDOW);
|
PWINDOW->m_pWLSurface.assign(g_pXWaylandManager->getWindowSurface(PWINDOW), PWINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_dissociateX11(void* owner, void* data) {
|
void Events::listener_dissociateX11(void* owner, void* data) {
|
||||||
const auto PWINDOW = (CWindow*)owner;
|
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
|
||||||
|
|
||||||
PWINDOW->m_pWLSurface.unassign();
|
PWINDOW->m_pWLSurface.unassign();
|
||||||
|
|
||||||
|
@ -1202,7 +1204,7 @@ void Events::listener_surfaceXWayland(wl_listener* listener, void* data) {
|
||||||
if (XWSURFACE->parent)
|
if (XWSURFACE->parent)
|
||||||
Debug::log(LOG, "Window parent data: {} at {:x}", XWSURFACE->parent->_class ? XWSURFACE->parent->_class : "null", (uintptr_t)XWSURFACE->parent);
|
Debug::log(LOG, "Window parent data: {} at {:x}", XWSURFACE->parent->_class ? XWSURFACE->parent->_class : "null", (uintptr_t)XWSURFACE->parent);
|
||||||
|
|
||||||
const auto PNEWWINDOW = (CWindow*)g_pCompositor->m_vWindows.emplace_back(std::make_unique<CWindow>()).get();
|
const auto PNEWWINDOW = g_pCompositor->m_vWindows.emplace_back(CWindow::create());
|
||||||
|
|
||||||
PNEWWINDOW->m_uSurface.xwayland = XWSURFACE;
|
PNEWWINDOW->m_uSurface.xwayland = XWSURFACE;
|
||||||
PNEWWINDOW->m_iX11Type = XWSURFACE->override_redirect ? 2 : 1;
|
PNEWWINDOW->m_iX11Type = XWSURFACE->override_redirect ? 2 : 1;
|
||||||
|
@ -1210,11 +1212,11 @@ void Events::listener_surfaceXWayland(wl_listener* listener, void* data) {
|
||||||
|
|
||||||
PNEWWINDOW->m_pX11Parent = g_pCompositor->getX11Parent(PNEWWINDOW);
|
PNEWWINDOW->m_pX11Parent = g_pCompositor->getX11Parent(PNEWWINDOW);
|
||||||
|
|
||||||
PNEWWINDOW->hyprListener_associateX11.initCallback(&XWSURFACE->events.associate, &Events::listener_associateX11, PNEWWINDOW, "XWayland Window");
|
PNEWWINDOW->hyprListener_associateX11.initCallback(&XWSURFACE->events.associate, &Events::listener_associateX11, PNEWWINDOW.get(), "XWayland Window");
|
||||||
PNEWWINDOW->hyprListener_dissociateX11.initCallback(&XWSURFACE->events.dissociate, &Events::listener_dissociateX11, PNEWWINDOW, "XWayland Window");
|
PNEWWINDOW->hyprListener_dissociateX11.initCallback(&XWSURFACE->events.dissociate, &Events::listener_dissociateX11, PNEWWINDOW.get(), "XWayland Window");
|
||||||
PNEWWINDOW->hyprListener_destroyWindow.initCallback(&XWSURFACE->events.destroy, &Events::listener_destroyWindow, PNEWWINDOW, "XWayland Window");
|
PNEWWINDOW->hyprListener_destroyWindow.initCallback(&XWSURFACE->events.destroy, &Events::listener_destroyWindow, PNEWWINDOW.get(), "XWayland Window");
|
||||||
PNEWWINDOW->hyprListener_setOverrideRedirect.initCallback(&XWSURFACE->events.set_override_redirect, &Events::listener_setOverrideRedirect, PNEWWINDOW, "XWayland Window");
|
PNEWWINDOW->hyprListener_setOverrideRedirect.initCallback(&XWSURFACE->events.set_override_redirect, &Events::listener_setOverrideRedirect, PNEWWINDOW.get(), "XWayland Window");
|
||||||
PNEWWINDOW->hyprListener_configureX11.initCallback(&XWSURFACE->events.request_configure, &Events::listener_configureX11, PNEWWINDOW, "XWayland Window");
|
PNEWWINDOW->hyprListener_configureX11.initCallback(&XWSURFACE->events.request_configure, &Events::listener_configureX11, PNEWWINDOW.get(), "XWayland Window");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_newXDGToplevel(wl_listener* listener, void* data) {
|
void Events::listener_newXDGToplevel(wl_listener* listener, void* data) {
|
||||||
|
@ -1224,18 +1226,18 @@ void Events::listener_newXDGToplevel(wl_listener* listener, void* data) {
|
||||||
|
|
||||||
Debug::log(LOG, "New XDG Toplevel created. (class: {})", XDGSURFACE->toplevel->app_id ? XDGSURFACE->toplevel->app_id : "null");
|
Debug::log(LOG, "New XDG Toplevel created. (class: {})", XDGSURFACE->toplevel->app_id ? XDGSURFACE->toplevel->app_id : "null");
|
||||||
|
|
||||||
const auto PNEWWINDOW = g_pCompositor->m_vWindows.emplace_back(std::make_unique<CWindow>()).get();
|
const auto PNEWWINDOW = g_pCompositor->m_vWindows.emplace_back(CWindow::create());
|
||||||
PNEWWINDOW->m_uSurface.xdg = XDGSURFACE;
|
PNEWWINDOW->m_uSurface.xdg = XDGSURFACE;
|
||||||
|
|
||||||
PNEWWINDOW->hyprListener_mapWindow.initCallback(&XDGSURFACE->surface->events.map, &Events::listener_mapWindow, PNEWWINDOW, "XDG Window");
|
PNEWWINDOW->hyprListener_mapWindow.initCallback(&XDGSURFACE->surface->events.map, &Events::listener_mapWindow, PNEWWINDOW.get(), "XDG Window");
|
||||||
PNEWWINDOW->hyprListener_destroyWindow.initCallback(&XDGSURFACE->events.destroy, &Events::listener_destroyWindow, PNEWWINDOW, "XDG Window");
|
PNEWWINDOW->hyprListener_destroyWindow.initCallback(&XDGSURFACE->events.destroy, &Events::listener_destroyWindow, PNEWWINDOW.get(), "XDG Window");
|
||||||
PNEWWINDOW->hyprListener_commitWindow.initCallback(&XDGSURFACE->surface->events.commit, &Events::listener_commitWindow, PNEWWINDOW, "XDG Window");
|
PNEWWINDOW->hyprListener_commitWindow.initCallback(&XDGSURFACE->surface->events.commit, &Events::listener_commitWindow, PNEWWINDOW.get(), "XDG Window");
|
||||||
|
|
||||||
PNEWWINDOW->m_pWLSurface.assign(g_pXWaylandManager->getWindowSurface(PNEWWINDOW), PNEWWINDOW);
|
PNEWWINDOW->m_pWLSurface.assign(g_pXWaylandManager->getWindowSurface(PNEWWINDOW), PNEWWINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_requestMaximize(void* owner, void* data) {
|
void Events::listener_requestMaximize(void* owner, void* data) {
|
||||||
const auto PWINDOW = (CWindow*)owner;
|
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
|
||||||
|
|
||||||
if (PWINDOW->m_eSuppressedEvents & SUPPRESS_MAXIMIZE)
|
if (PWINDOW->m_eSuppressedEvents & SUPPRESS_MAXIMIZE)
|
||||||
return;
|
return;
|
||||||
|
@ -1256,7 +1258,7 @@ void Events::listener_requestMaximize(void* owner, void* data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_requestMinimize(void* owner, void* data) {
|
void Events::listener_requestMinimize(void* owner, void* data) {
|
||||||
const auto PWINDOW = (CWindow*)owner;
|
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
|
||||||
|
|
||||||
Debug::log(LOG, "Minimize request for {}", PWINDOW);
|
Debug::log(LOG, "Minimize request for {}", PWINDOW);
|
||||||
|
|
||||||
|
@ -1266,25 +1268,25 @@ void Events::listener_requestMinimize(void* owner, void* data) {
|
||||||
|
|
||||||
const auto E = (wlr_xwayland_minimize_event*)data;
|
const auto E = (wlr_xwayland_minimize_event*)data;
|
||||||
|
|
||||||
g_pEventManager->postEvent({"minimize", std::format("{:x},{}", (uintptr_t)PWINDOW, (int)E->minimize)});
|
g_pEventManager->postEvent({"minimize", std::format("{:x},{}", (uintptr_t)PWINDOW.get(), (int)E->minimize)});
|
||||||
EMIT_HOOK_EVENT("minimize", (std::vector<void*>{PWINDOW, (void*)E->minimize}));
|
EMIT_HOOK_EVENT("minimize", (std::vector<std::any>{PWINDOW, E->minimize}));
|
||||||
|
|
||||||
wlr_xwayland_surface_set_minimized(PWINDOW->m_uSurface.xwayland, E->minimize && g_pCompositor->m_pLastWindow != PWINDOW); // fucking DXVK
|
wlr_xwayland_surface_set_minimized(PWINDOW->m_uSurface.xwayland, E->minimize && g_pCompositor->m_pLastWindow.lock() != PWINDOW); // fucking DXVK
|
||||||
} else {
|
} else {
|
||||||
g_pEventManager->postEvent({"minimize", std::format("{:x},{}", (uintptr_t)PWINDOW, 1)});
|
g_pEventManager->postEvent({"minimize", std::format("{:x},{}", (uintptr_t)PWINDOW.get(), 1)});
|
||||||
EMIT_HOOK_EVENT("minimize", (std::vector<void*>{PWINDOW, (void*)(1)}));
|
EMIT_HOOK_EVENT("minimize", (std::vector<std::any>{PWINDOW, (int64_t)(1)}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_requestMove(void* owner, void* data) {
|
void Events::listener_requestMove(void* owner, void* data) {
|
||||||
const auto PWINDOW = (CWindow*)owner;
|
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
|
||||||
|
|
||||||
// ignore
|
// ignore
|
||||||
wlr_xdg_surface_schedule_configure(PWINDOW->m_uSurface.xdg);
|
wlr_xdg_surface_schedule_configure(PWINDOW->m_uSurface.xdg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Events::listener_requestResize(void* owner, void* data) {
|
void Events::listener_requestResize(void* owner, void* data) {
|
||||||
const auto PWINDOW = (CWindow*)owner;
|
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
|
||||||
|
|
||||||
// ignore
|
// ignore
|
||||||
wlr_xdg_surface_schedule_configure(PWINDOW->m_uSurface.xdg);
|
wlr_xdg_surface_schedule_configure(PWINDOW->m_uSurface.xdg);
|
||||||
|
|
|
@ -6,7 +6,7 @@ CBaseAnimatedVariable::CBaseAnimatedVariable(ANIMATEDVARTYPE type) : m_Type(type
|
||||||
; // dummy var
|
; // dummy var
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBaseAnimatedVariable::create(SAnimationPropertyConfig* pAnimConfig, CWindow* pWindow, AVARDAMAGEPOLICY policy) {
|
void CBaseAnimatedVariable::create(SAnimationPropertyConfig* pAnimConfig, PHLWINDOW pWindow, AVARDAMAGEPOLICY policy) {
|
||||||
m_eDamagePolicy = policy;
|
m_eDamagePolicy = policy;
|
||||||
m_pConfig = pAnimConfig;
|
m_pConfig = pAnimConfig;
|
||||||
m_pWindow = pWindow;
|
m_pWindow = pWindow;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include "Vector2D.hpp"
|
#include "Vector2D.hpp"
|
||||||
#include "Color.hpp"
|
#include "Color.hpp"
|
||||||
#include "../macros.hpp"
|
#include "../defines.hpp"
|
||||||
#include "../debug/Log.hpp"
|
#include "../debug/Log.hpp"
|
||||||
#include "../desktop/DesktopTypes.hpp"
|
#include "../desktop/DesktopTypes.hpp"
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ concept Animable = OneOf<T, Vector2D, float, CColor>;
|
||||||
class CBaseAnimatedVariable {
|
class CBaseAnimatedVariable {
|
||||||
public:
|
public:
|
||||||
CBaseAnimatedVariable(ANIMATEDVARTYPE type);
|
CBaseAnimatedVariable(ANIMATEDVARTYPE type);
|
||||||
void create(SAnimationPropertyConfig* pAnimConfig, CWindow* pWindow, AVARDAMAGEPOLICY policy);
|
void create(SAnimationPropertyConfig* pAnimConfig, PHLWINDOW pWindow, AVARDAMAGEPOLICY policy);
|
||||||
void create(SAnimationPropertyConfig* pAnimConfig, SLayerSurface* pLayer, AVARDAMAGEPOLICY policy);
|
void create(SAnimationPropertyConfig* pAnimConfig, SLayerSurface* pLayer, AVARDAMAGEPOLICY policy);
|
||||||
void create(SAnimationPropertyConfig* pAnimConfig, PHLWORKSPACE pWorkspace, AVARDAMAGEPOLICY policy);
|
void create(SAnimationPropertyConfig* pAnimConfig, PHLWORKSPACE pWorkspace, AVARDAMAGEPOLICY policy);
|
||||||
void create(SAnimationPropertyConfig* pAnimConfig, AVARDAMAGEPOLICY policy);
|
void create(SAnimationPropertyConfig* pAnimConfig, AVARDAMAGEPOLICY policy);
|
||||||
|
@ -140,12 +140,12 @@ class CBaseAnimatedVariable {
|
||||||
m_bRemoveEndAfterRan = false;
|
m_bRemoveEndAfterRan = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* getWindow() {
|
PHLWINDOW getWindow() {
|
||||||
return (CWindow*)m_pWindow;
|
return m_pWindow.lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void* m_pWindow = nullptr;
|
PHLWINDOWREF m_pWindow;
|
||||||
std::weak_ptr<CWorkspace> m_pWorkspace;
|
std::weak_ptr<CWorkspace> m_pWorkspace;
|
||||||
void* m_pLayer = nullptr;
|
void* m_pLayer = nullptr;
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ class CAnimatedVariable : public CBaseAnimatedVariable {
|
||||||
public:
|
public:
|
||||||
CAnimatedVariable() : CBaseAnimatedVariable(typeToANIMATEDVARTYPE<VarType>) {} // dummy var
|
CAnimatedVariable() : CBaseAnimatedVariable(typeToANIMATEDVARTYPE<VarType>) {} // dummy var
|
||||||
|
|
||||||
void create(const VarType& value, SAnimationPropertyConfig* pAnimConfig, CWindow* pWindow, AVARDAMAGEPOLICY policy) {
|
void create(const VarType& value, SAnimationPropertyConfig* pAnimConfig, PHLWINDOW pWindow, AVARDAMAGEPOLICY policy) {
|
||||||
create(pAnimConfig, pWindow, policy);
|
create(pAnimConfig, pWindow, policy);
|
||||||
m_Value = value;
|
m_Value = value;
|
||||||
m_Goal = value;
|
m_Goal = value;
|
||||||
|
|
|
@ -303,8 +303,8 @@ void CMonitor::onDisconnect(bool destroy) {
|
||||||
w->startAnim(true, true, true);
|
w->startAnim(true, true, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
g_pCompositor->m_pLastFocus = nullptr;
|
g_pCompositor->m_pLastFocus = nullptr;
|
||||||
g_pCompositor->m_pLastWindow = nullptr;
|
g_pCompositor->m_pLastWindow.reset();
|
||||||
g_pCompositor->m_pLastMonitor = nullptr;
|
g_pCompositor->m_pLastMonitor = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,9 +577,9 @@ void CMonitor::changeWorkspace(const PHLWORKSPACE& pWorkspace, bool internal, bo
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!noFocus && !g_pCompositor->m_pLastMonitor->activeSpecialWorkspace &&
|
if (!noFocus && !g_pCompositor->m_pLastMonitor->activeSpecialWorkspace &&
|
||||||
!(g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bPinned && g_pCompositor->m_pLastWindow->m_iMonitorID == ID)) {
|
!(g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow.lock()->m_bPinned && g_pCompositor->m_pLastWindow.lock()->m_iMonitorID == ID)) {
|
||||||
static auto PFOLLOWMOUSE = CConfigValue<Hyprlang::INT>("input:follow_mouse");
|
static auto PFOLLOWMOUSE = CConfigValue<Hyprlang::INT>("input:follow_mouse");
|
||||||
CWindow* pWindow = pWorkspace->getLastFocusedWindow();
|
auto pWindow = pWorkspace->getLastFocusedWindow();
|
||||||
|
|
||||||
if (!pWindow) {
|
if (!pWindow) {
|
||||||
if (*PFOLLOWMOUSE == 1)
|
if (*PFOLLOWMOUSE == 1)
|
||||||
|
@ -635,7 +635,7 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) {
|
||||||
|
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(ID);
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(ID);
|
||||||
|
|
||||||
if (!(g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bPinned && g_pCompositor->m_pLastWindow->m_iMonitorID == ID)) {
|
if (!(g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow.lock()->m_bPinned && g_pCompositor->m_pLastWindow.lock()->m_iMonitorID == ID)) {
|
||||||
if (const auto PLAST = activeWorkspace->getLastFocusedWindow(); PLAST)
|
if (const auto PLAST = activeWorkspace->getLastFocusedWindow(); PLAST)
|
||||||
g_pCompositor->focusWindow(PLAST);
|
g_pCompositor->focusWindow(PLAST);
|
||||||
else
|
else
|
||||||
|
@ -703,7 +703,7 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) {
|
||||||
|
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(ID);
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(ID);
|
||||||
|
|
||||||
if (!(g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bPinned && g_pCompositor->m_pLastWindow->m_iMonitorID == ID)) {
|
if (!(g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow.lock()->m_bPinned && g_pCompositor->m_pLastWindow.lock()->m_iMonitorID == ID)) {
|
||||||
if (const auto PLAST = pWorkspace->getLastFocusedWindow(); PLAST)
|
if (const auto PLAST = pWorkspace->getLastFocusedWindow(); PLAST)
|
||||||
g_pCompositor->focusWindow(PLAST);
|
g_pCompositor->focusWindow(PLAST);
|
||||||
else
|
else
|
||||||
|
|
|
@ -118,7 +118,7 @@ class CMonitor {
|
||||||
std::vector<CMonitor*> mirrors;
|
std::vector<CMonitor*> mirrors;
|
||||||
|
|
||||||
// for tearing
|
// for tearing
|
||||||
CWindow* solitaryClient = nullptr;
|
PHLWINDOWREF solitaryClient;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool canTear = false;
|
bool canTear = false;
|
||||||
|
|
|
@ -108,9 +108,9 @@ struct SRenderData {
|
||||||
bool squishOversized = true;
|
bool squishOversized = true;
|
||||||
|
|
||||||
// for calculating UV
|
// for calculating UV
|
||||||
CWindow* pWindow = nullptr;
|
PHLWINDOW pWindow;
|
||||||
|
|
||||||
bool popup = false;
|
bool popup = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SExtensionFindingData {
|
struct SExtensionFindingData {
|
||||||
|
|
|
@ -12,7 +12,7 @@ void handleWrapped(wl_listener* listener, void* data) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
pWrap->m_pSelf->emit(data);
|
pWrap->m_pSelf->emit(data);
|
||||||
} catch (std::exception& e) { Debug::log(ERR, "Listener {} timed out and was killed by Watchdog!!!", (uintptr_t)listener); }
|
} catch (std::exception& e) { Debug::log(ERR, "Listener {} threw or timed out and was killed by Watchdog!!! This is bad. what(): {}", (uintptr_t)listener, e.what()); }
|
||||||
|
|
||||||
if (g_pWatchdog)
|
if (g_pWatchdog)
|
||||||
g_pWatchdog->endWatching();
|
g_pWatchdog->endWatching();
|
||||||
|
|
|
@ -12,7 +12,7 @@ void CSignal::emit(std::any data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dirty)
|
if (dirty)
|
||||||
std::erase_if(m_vListeners, [](const auto& other) { return !other.lock(); });
|
std::erase_if(m_vListeners, [](const auto& other) { return other.expired(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
CHyprSignalListener CSignal::registerListener(std::function<void(std::any)> handler) {
|
CHyprSignalListener CSignal::registerListener(std::function<void(std::any)> handler) {
|
||||||
|
|
|
@ -58,7 +58,7 @@ int CHyprDwindleLayout::getNodesOnWorkspace(const int& id) {
|
||||||
|
|
||||||
SDwindleNodeData* CHyprDwindleLayout::getFirstNodeOnWorkspace(const int& id) {
|
SDwindleNodeData* CHyprDwindleLayout::getFirstNodeOnWorkspace(const int& id) {
|
||||||
for (auto& n : m_lDwindleNodesData) {
|
for (auto& n : m_lDwindleNodesData) {
|
||||||
if (n.workspaceID == id && n.pWindow && g_pCompositor->windowValidMapped(n.pWindow))
|
if (n.workspaceID == id && validMapped(n.pWindow))
|
||||||
return &n;
|
return &n;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -68,7 +68,7 @@ SDwindleNodeData* CHyprDwindleLayout::getClosestNodeOnWorkspace(const int& id, c
|
||||||
SDwindleNodeData* res = nullptr;
|
SDwindleNodeData* res = nullptr;
|
||||||
double distClosest = -1;
|
double distClosest = -1;
|
||||||
for (auto& n : m_lDwindleNodesData) {
|
for (auto& n : m_lDwindleNodesData) {
|
||||||
if (n.workspaceID == id && n.pWindow && g_pCompositor->windowValidMapped(n.pWindow)) {
|
if (n.workspaceID == id && validMapped(n.pWindow)) {
|
||||||
auto distAnother = vecToRectDistanceSquared(point, n.box.pos(), n.box.pos() + n.box.size());
|
auto distAnother = vecToRectDistanceSquared(point, n.box.pos(), n.box.pos() + n.box.size());
|
||||||
if (!res || distAnother < distClosest) {
|
if (!res || distAnother < distClosest) {
|
||||||
res = &n;
|
res = &n;
|
||||||
|
@ -79,9 +79,9 @@ SDwindleNodeData* CHyprDwindleLayout::getClosestNodeOnWorkspace(const int& id, c
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDwindleNodeData* CHyprDwindleLayout::getNodeFromWindow(CWindow* pWindow) {
|
SDwindleNodeData* CHyprDwindleLayout::getNodeFromWindow(PHLWINDOW pWindow) {
|
||||||
for (auto& n : m_lDwindleNodesData) {
|
for (auto& n : m_lDwindleNodesData) {
|
||||||
if (n.pWindow == pWindow && !n.isNode)
|
if (n.pWindow.lock() == pWindow && !n.isNode)
|
||||||
return &n;
|
return &n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,12 +125,12 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
|
||||||
const bool DISPLAYTOP = STICKS(pNode->box.y, PMONITOR->vecPosition.y + PMONITOR->vecReservedTopLeft.y);
|
const bool DISPLAYTOP = STICKS(pNode->box.y, PMONITOR->vecPosition.y + PMONITOR->vecReservedTopLeft.y);
|
||||||
const bool DISPLAYBOTTOM = STICKS(pNode->box.y + pNode->box.h, PMONITOR->vecPosition.y + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y);
|
const bool DISPLAYBOTTOM = STICKS(pNode->box.y + pNode->box.h, PMONITOR->vecPosition.y + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y);
|
||||||
|
|
||||||
const auto PWINDOW = pNode->pWindow;
|
const auto PWINDOW = pNode->pWindow.lock();
|
||||||
// get specific gaps and rules for this workspace,
|
// get specific gaps and rules for this workspace,
|
||||||
// if user specified them in config
|
// if user specified them in config
|
||||||
const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(g_pCompositor->getWorkspaceByID(pNode->workspaceID));
|
const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(g_pCompositor->getWorkspaceByID(pNode->workspaceID));
|
||||||
|
|
||||||
if (!g_pCompositor->windowExists(PWINDOW)) {
|
if (!validMapped(PWINDOW)) {
|
||||||
Debug::log(ERR, "Node {} holding invalid {}!!", pNode, PWINDOW);
|
Debug::log(ERR, "Node {} holding invalid {}!!", pNode, PWINDOW);
|
||||||
onWindowRemovedTiling(PWINDOW);
|
onWindowRemovedTiling(PWINDOW);
|
||||||
return;
|
return;
|
||||||
|
@ -248,7 +248,7 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
|
||||||
PWINDOW->updateWindowDecos();
|
PWINDOW->updateWindowDecos();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection direction) {
|
void CHyprDwindleLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection direction) {
|
||||||
if (pWindow->m_bIsFloating)
|
if (pWindow->m_bIsFloating)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -282,9 +282,9 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection dire
|
||||||
OPENINGON = getClosestNodeOnWorkspace(PNODE->workspaceID, MOUSECOORDS);
|
OPENINGON = getClosestNodeOnWorkspace(PNODE->workspaceID, MOUSECOORDS);
|
||||||
|
|
||||||
} else if (*PUSEACTIVE) {
|
} else if (*PUSEACTIVE) {
|
||||||
if (g_pCompositor->m_pLastWindow && !g_pCompositor->m_pLastWindow->m_bIsFloating && g_pCompositor->m_pLastWindow != pWindow &&
|
if (g_pCompositor->m_pLastWindow.lock() && !g_pCompositor->m_pLastWindow.lock()->m_bIsFloating && g_pCompositor->m_pLastWindow.lock() != pWindow &&
|
||||||
g_pCompositor->m_pLastWindow->m_pWorkspace == pWindow->m_pWorkspace && g_pCompositor->m_pLastWindow->m_bIsMapped) {
|
g_pCompositor->m_pLastWindow.lock()->m_pWorkspace == pWindow->m_pWorkspace && g_pCompositor->m_pLastWindow.lock()->m_bIsMapped) {
|
||||||
OPENINGON = getNodeFromWindow(g_pCompositor->m_pLastWindow);
|
OPENINGON = getNodeFromWindow(g_pCompositor->m_pLastWindow.lock());
|
||||||
} else {
|
} else {
|
||||||
OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS));
|
OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS));
|
||||||
}
|
}
|
||||||
|
@ -313,9 +313,9 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection dire
|
||||||
}
|
}
|
||||||
|
|
||||||
// last fail-safe to avoid duplicate fullscreens
|
// last fail-safe to avoid duplicate fullscreens
|
||||||
if ((!OPENINGON || OPENINGON->pWindow == pWindow) && getNodesOnWorkspace(PNODE->workspaceID) > 1) {
|
if ((!OPENINGON || OPENINGON->pWindow.lock() == pWindow) && getNodesOnWorkspace(PNODE->workspaceID) > 1) {
|
||||||
for (auto& node : m_lDwindleNodesData) {
|
for (auto& node : m_lDwindleNodesData) {
|
||||||
if (node.workspaceID == PNODE->workspaceID && node.pWindow != nullptr && node.pWindow != pWindow) {
|
if (node.workspaceID == PNODE->workspaceID && node.pWindow.lock() && node.pWindow.lock() != pWindow) {
|
||||||
OPENINGON = &node;
|
OPENINGON = &node;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection dire
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it's the first, it's easy. Make it fullscreen.
|
// if it's the first, it's easy. Make it fullscreen.
|
||||||
if (!OPENINGON || OPENINGON->pWindow == pWindow) {
|
if (!OPENINGON || OPENINGON->pWindow.lock() == pWindow) {
|
||||||
PNODE->box = CBox{PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft, PMONITOR->vecSize - PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight};
|
PNODE->box = CBox{PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft, PMONITOR->vecSize - PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight};
|
||||||
|
|
||||||
applyNodeDataToWindow(PNODE);
|
applyNodeDataToWindow(PNODE);
|
||||||
|
@ -334,19 +334,19 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection dire
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_vOverrideFocalPoint && g_pInputManager->m_bWasDraggingWindow) {
|
if (!m_vOverrideFocalPoint && g_pInputManager->m_bWasDraggingWindow) {
|
||||||
if (OPENINGON->pWindow->checkInputOnDecos(INPUT_TYPE_DRAG_END, MOUSECOORDS, pWindow))
|
if (OPENINGON->pWindow.lock()->checkInputOnDecos(INPUT_TYPE_DRAG_END, MOUSECOORDS, pWindow))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it's a group, add the window
|
// if it's a group, add the window
|
||||||
if (OPENINGON->pWindow->m_sGroupData.pNextWindow // target is group
|
if (OPENINGON->pWindow.lock()->m_sGroupData.pNextWindow.lock() // target is group
|
||||||
&& pWindow->canBeGroupedInto(OPENINGON->pWindow) && !m_vOverrideFocalPoint) { // we are not moving window
|
&& pWindow->canBeGroupedInto(OPENINGON->pWindow.lock()) && !m_vOverrideFocalPoint) { // we are not moving window
|
||||||
m_lDwindleNodesData.remove(*PNODE);
|
m_lDwindleNodesData.remove(*PNODE);
|
||||||
|
|
||||||
static auto USECURRPOS = CConfigValue<Hyprlang::INT>("group:insert_after_current");
|
static auto USECURRPOS = CConfigValue<Hyprlang::INT>("group:insert_after_current");
|
||||||
(*USECURRPOS ? OPENINGON->pWindow : OPENINGON->pWindow->getGroupTail())->insertWindowToGroup(pWindow);
|
(*USECURRPOS ? OPENINGON->pWindow.lock() : OPENINGON->pWindow.lock()->getGroupTail())->insertWindowToGroup(pWindow);
|
||||||
|
|
||||||
OPENINGON->pWindow->setGroupCurrent(pWindow);
|
OPENINGON->pWindow.lock()->setGroupCurrent(pWindow);
|
||||||
pWindow->applyGroupRules();
|
pWindow->applyGroupRules();
|
||||||
pWindow->updateWindowDecos();
|
pWindow->updateWindowDecos();
|
||||||
recalculateWindow(pWindow);
|
recalculateWindow(pWindow);
|
||||||
|
@ -487,7 +487,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection dire
|
||||||
pWindow->applyGroupRules();
|
pWindow->applyGroupRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDwindleLayout::onWindowRemovedTiling(CWindow* pWindow) {
|
void CHyprDwindleLayout::onWindowRemovedTiling(PHLWINDOW pWindow) {
|
||||||
|
|
||||||
const auto PNODE = getNodeFromWindow(pWindow);
|
const auto PNODE = getNodeFromWindow(pWindow);
|
||||||
|
|
||||||
|
@ -585,7 +585,7 @@ void CHyprDwindleLayout::calculateWorkspace(const PHLWORKSPACE& pWorkspace) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CHyprDwindleLayout::isWindowTiled(CWindow* pWindow) {
|
bool CHyprDwindleLayout::isWindowTiled(PHLWINDOW pWindow) {
|
||||||
return getNodeFromWindow(pWindow) != nullptr;
|
return getNodeFromWindow(pWindow) != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -595,11 +595,11 @@ void CHyprDwindleLayout::onBeginDragWindow() {
|
||||||
IHyprLayout::onBeginDragWindow();
|
IHyprLayout::onBeginDragWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorner corner, CWindow* pWindow) {
|
void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorner corner, PHLWINDOW pWindow) {
|
||||||
|
|
||||||
const auto PWINDOW = pWindow ? pWindow : g_pCompositor->m_pLastWindow;
|
const auto PWINDOW = pWindow ? pWindow : g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!g_pCompositor->windowValidMapped(PWINDOW))
|
if (!validMapped(PWINDOW))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto PNODE = getNodeFromWindow(PWINDOW);
|
const auto PNODE = getNodeFromWindow(PWINDOW);
|
||||||
|
@ -786,8 +786,8 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDwindleLayout::fullscreenRequestForWindow(CWindow* pWindow, eFullscreenMode fullscreenMode, bool on) {
|
void CHyprDwindleLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, eFullscreenMode fullscreenMode, bool on) {
|
||||||
if (!g_pCompositor->windowValidMapped(pWindow))
|
if (!validMapped(pWindow))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (on == pWindow->m_bIsFullscreen)
|
if (on == pWindow->m_bIsFullscreen)
|
||||||
|
@ -867,7 +867,7 @@ void CHyprDwindleLayout::fullscreenRequestForWindow(CWindow* pWindow, eFullscree
|
||||||
recalculateMonitor(PMONITOR->ID);
|
recalculateMonitor(PMONITOR->ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDwindleLayout::recalculateWindow(CWindow* pWindow) {
|
void CHyprDwindleLayout::recalculateWindow(PHLWINDOW pWindow) {
|
||||||
const auto PNODE = getNodeFromWindow(pWindow);
|
const auto PNODE = getNodeFromWindow(pWindow);
|
||||||
|
|
||||||
if (!PNODE)
|
if (!PNODE)
|
||||||
|
@ -886,7 +886,7 @@ void addToDequeRecursive(std::deque<SDwindleNodeData*>* pDeque, std::deque<SDwin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SWindowRenderLayoutHints CHyprDwindleLayout::requestRenderHints(CWindow* pWindow) {
|
SWindowRenderLayoutHints CHyprDwindleLayout::requestRenderHints(PHLWINDOW pWindow) {
|
||||||
// window should be valid, insallah
|
// window should be valid, insallah
|
||||||
SWindowRenderLayoutHints hints;
|
SWindowRenderLayoutHints hints;
|
||||||
|
|
||||||
|
@ -897,7 +897,7 @@ SWindowRenderLayoutHints CHyprDwindleLayout::requestRenderHints(CWindow* pWindow
|
||||||
return hints;
|
return hints;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDwindleLayout::moveWindowTo(CWindow* pWindow, const std::string& dir, bool silent) {
|
void CHyprDwindleLayout::moveWindowTo(PHLWINDOW pWindow, const std::string& dir, bool silent) {
|
||||||
if (!isDirection(dir))
|
if (!isDirection(dir))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -940,12 +940,12 @@ void CHyprDwindleLayout::moveWindowTo(CWindow* pWindow, const std::string& dir,
|
||||||
// restore focus to the previous position
|
// restore focus to the previous position
|
||||||
if (silent) {
|
if (silent) {
|
||||||
const auto PNODETOFOCUS = getClosestNodeOnWorkspace(originalWorkspaceID, originalPos);
|
const auto PNODETOFOCUS = getClosestNodeOnWorkspace(originalWorkspaceID, originalPos);
|
||||||
if (PNODETOFOCUS && PNODETOFOCUS->pWindow)
|
if (PNODETOFOCUS && PNODETOFOCUS->pWindow.lock())
|
||||||
g_pCompositor->focusWindow(PNODETOFOCUS->pWindow);
|
g_pCompositor->focusWindow(PNODETOFOCUS->pWindow.lock());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDwindleLayout::switchWindows(CWindow* pWindow, CWindow* pWindow2) {
|
void CHyprDwindleLayout::switchWindows(PHLWINDOW pWindow, PHLWINDOW pWindow2) {
|
||||||
// windows should be valid, insallah
|
// windows should be valid, insallah
|
||||||
|
|
||||||
auto PNODE = getNodeFromWindow(pWindow);
|
auto PNODE = getNodeFromWindow(pWindow);
|
||||||
|
@ -984,15 +984,15 @@ void CHyprDwindleLayout::switchWindows(CWindow* pWindow, CWindow* pWindow2) {
|
||||||
getMasterNodeOnWorkspace(PNODE2->workspaceID)->recalcSizePosRecursive();
|
getMasterNodeOnWorkspace(PNODE2->workspaceID)->recalcSizePosRecursive();
|
||||||
|
|
||||||
if (ACTIVE1) {
|
if (ACTIVE1) {
|
||||||
ACTIVE1->box = PNODE->box;
|
ACTIVE1->box = PNODE->box;
|
||||||
ACTIVE1->pWindow->m_vPosition = ACTIVE1->box.pos();
|
ACTIVE1->pWindow.lock()->m_vPosition = ACTIVE1->box.pos();
|
||||||
ACTIVE1->pWindow->m_vSize = ACTIVE1->box.size();
|
ACTIVE1->pWindow.lock()->m_vSize = ACTIVE1->box.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACTIVE2) {
|
if (ACTIVE2) {
|
||||||
ACTIVE2->box = PNODE2->box;
|
ACTIVE2->box = PNODE2->box;
|
||||||
ACTIVE2->pWindow->m_vPosition = ACTIVE2->box.pos();
|
ACTIVE2->pWindow.lock()->m_vPosition = ACTIVE2->box.pos();
|
||||||
ACTIVE2->pWindow->m_vSize = ACTIVE2->box.size();
|
ACTIVE2->pWindow.lock()->m_vSize = ACTIVE2->box.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pHyprRenderer->damageWindow(pWindow);
|
g_pHyprRenderer->damageWindow(pWindow);
|
||||||
|
@ -1004,7 +1004,7 @@ void CHyprDwindleLayout::switchWindows(CWindow* pWindow, CWindow* pWindow2) {
|
||||||
g_pCompositor->setWindowFullscreen(pWindow, true);
|
g_pCompositor->setWindowFullscreen(pWindow, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDwindleLayout::alterSplitRatio(CWindow* pWindow, float ratio, bool exact) {
|
void CHyprDwindleLayout::alterSplitRatio(PHLWINDOW pWindow, float ratio, bool exact) {
|
||||||
// window should be valid, insallah
|
// window should be valid, insallah
|
||||||
|
|
||||||
const auto PNODE = getNodeFromWindow(pWindow);
|
const auto PNODE = getNodeFromWindow(pWindow);
|
||||||
|
@ -1063,7 +1063,7 @@ std::any CHyprDwindleLayout::layoutMessage(SLayoutMessageHeader header, std::str
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDwindleLayout::toggleSplit(CWindow* pWindow) {
|
void CHyprDwindleLayout::toggleSplit(PHLWINDOW pWindow) {
|
||||||
const auto PNODE = getNodeFromWindow(pWindow);
|
const auto PNODE = getNodeFromWindow(pWindow);
|
||||||
|
|
||||||
if (!PNODE || !PNODE->pParent)
|
if (!PNODE || !PNODE->pParent)
|
||||||
|
@ -1077,7 +1077,7 @@ void CHyprDwindleLayout::toggleSplit(CWindow* pWindow) {
|
||||||
PNODE->pParent->recalcSizePosRecursive();
|
PNODE->pParent->recalcSizePosRecursive();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDwindleLayout::swapSplit(CWindow* pWindow) {
|
void CHyprDwindleLayout::swapSplit(PHLWINDOW pWindow) {
|
||||||
const auto PNODE = getNodeFromWindow(pWindow);
|
const auto PNODE = getNodeFromWindow(pWindow);
|
||||||
|
|
||||||
if (!PNODE || !PNODE->pParent)
|
if (!PNODE || !PNODE->pParent)
|
||||||
|
@ -1091,7 +1091,7 @@ void CHyprDwindleLayout::swapSplit(CWindow* pWindow) {
|
||||||
PNODE->pParent->recalcSizePosRecursive();
|
PNODE->pParent->recalcSizePosRecursive();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDwindleLayout::replaceWindowDataWith(CWindow* from, CWindow* to) {
|
void CHyprDwindleLayout::replaceWindowDataWith(PHLWINDOW from, PHLWINDOW to) {
|
||||||
const auto PNODE = getNodeFromWindow(from);
|
const auto PNODE = getNodeFromWindow(from);
|
||||||
|
|
||||||
if (!PNODE)
|
if (!PNODE)
|
||||||
|
@ -1111,7 +1111,7 @@ void CHyprDwindleLayout::onEnable() {
|
||||||
if (w->m_bIsFloating || !w->m_bIsMapped || w->isHidden())
|
if (w->m_bIsFloating || !w->m_bIsMapped || w->isHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
onWindowCreatedTiling(w.get());
|
onWindowCreatedTiling(w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1124,7 +1124,7 @@ Vector2D CHyprDwindleLayout::predictSizeForNewWindowTiled() {
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
// get window candidate
|
// get window candidate
|
||||||
CWindow* candidate = g_pCompositor->m_pLastWindow;
|
PHLWINDOW candidate = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!candidate)
|
if (!candidate)
|
||||||
candidate = g_pCompositor->getFirstWindowOnWorkspace(g_pCompositor->m_pLastMonitor->activeWorkspace->m_iID);
|
candidate = g_pCompositor->getFirstWindowOnWorkspace(g_pCompositor->m_pLastMonitor->activeWorkspace->m_iID);
|
||||||
|
@ -1140,8 +1140,8 @@ Vector2D CHyprDwindleLayout::predictSizeForNewWindowTiled() {
|
||||||
if (!PNODE)
|
if (!PNODE)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
node = *PNODE;
|
node = *PNODE;
|
||||||
node.pWindow = nullptr;
|
node.pWindow.reset();
|
||||||
|
|
||||||
CBox box = PNODE->box;
|
CBox box = PNODE->box;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ struct SDwindleNodeData {
|
||||||
SDwindleNodeData* pParent = nullptr;
|
SDwindleNodeData* pParent = nullptr;
|
||||||
bool isNode = false;
|
bool isNode = false;
|
||||||
|
|
||||||
CWindow* pWindow = nullptr;
|
PHLWINDOWREF pWindow;
|
||||||
|
|
||||||
std::array<SDwindleNodeData*, 2> children = {nullptr, nullptr};
|
std::array<SDwindleNodeData*, 2> children = {nullptr, nullptr};
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ struct SDwindleNodeData {
|
||||||
|
|
||||||
// For list lookup
|
// For list lookup
|
||||||
bool operator==(const SDwindleNodeData& rhs) const {
|
bool operator==(const SDwindleNodeData& rhs) const {
|
||||||
return pWindow == rhs.pWindow && workspaceID == rhs.workspaceID && box == rhs.box && pParent == rhs.pParent && children[0] == rhs.children[0] &&
|
return pWindow.lock() == rhs.pWindow.lock() && workspaceID == rhs.workspaceID && box == rhs.box && pParent == rhs.pParent && children[0] == rhs.children[0] &&
|
||||||
children[1] == rhs.children[1];
|
children[1] == rhs.children[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,21 +45,21 @@ struct SDwindleNodeData {
|
||||||
|
|
||||||
class CHyprDwindleLayout : public IHyprLayout {
|
class CHyprDwindleLayout : public IHyprLayout {
|
||||||
public:
|
public:
|
||||||
virtual void onWindowCreatedTiling(CWindow*, eDirection direction = DIRECTION_DEFAULT);
|
virtual void onWindowCreatedTiling(PHLWINDOW, eDirection direction = DIRECTION_DEFAULT);
|
||||||
virtual void onWindowRemovedTiling(CWindow*);
|
virtual void onWindowRemovedTiling(PHLWINDOW);
|
||||||
virtual bool isWindowTiled(CWindow*);
|
virtual bool isWindowTiled(PHLWINDOW);
|
||||||
virtual void recalculateMonitor(const int&);
|
virtual void recalculateMonitor(const int&);
|
||||||
virtual void recalculateWindow(CWindow*);
|
virtual void recalculateWindow(PHLWINDOW);
|
||||||
virtual void onBeginDragWindow();
|
virtual void onBeginDragWindow();
|
||||||
virtual void resizeActiveWindow(const Vector2D&, eRectCorner corner = CORNER_NONE, CWindow* pWindow = nullptr);
|
virtual void resizeActiveWindow(const Vector2D&, eRectCorner corner = CORNER_NONE, PHLWINDOW pWindow = nullptr);
|
||||||
virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode, bool);
|
virtual void fullscreenRequestForWindow(PHLWINDOW, eFullscreenMode, bool);
|
||||||
virtual std::any layoutMessage(SLayoutMessageHeader, std::string);
|
virtual std::any layoutMessage(SLayoutMessageHeader, std::string);
|
||||||
virtual SWindowRenderLayoutHints requestRenderHints(CWindow*);
|
virtual SWindowRenderLayoutHints requestRenderHints(PHLWINDOW);
|
||||||
virtual void switchWindows(CWindow*, CWindow*);
|
virtual void switchWindows(PHLWINDOW, PHLWINDOW);
|
||||||
virtual void moveWindowTo(CWindow*, const std::string& dir, bool silent);
|
virtual void moveWindowTo(PHLWINDOW, const std::string& dir, bool silent);
|
||||||
virtual void alterSplitRatio(CWindow*, float, bool);
|
virtual void alterSplitRatio(PHLWINDOW, float, bool);
|
||||||
virtual std::string getLayoutName();
|
virtual std::string getLayoutName();
|
||||||
virtual void replaceWindowDataWith(CWindow* from, CWindow* to);
|
virtual void replaceWindowDataWith(PHLWINDOW from, PHLWINDOW to);
|
||||||
virtual Vector2D predictSizeForNewWindowTiled();
|
virtual Vector2D predictSizeForNewWindowTiled();
|
||||||
|
|
||||||
virtual void onEnable();
|
virtual void onEnable();
|
||||||
|
@ -80,13 +80,13 @@ class CHyprDwindleLayout : public IHyprLayout {
|
||||||
int getNodesOnWorkspace(const int&);
|
int getNodesOnWorkspace(const int&);
|
||||||
void applyNodeDataToWindow(SDwindleNodeData*, bool force = false);
|
void applyNodeDataToWindow(SDwindleNodeData*, bool force = false);
|
||||||
void calculateWorkspace(const PHLWORKSPACE& pWorkspace);
|
void calculateWorkspace(const PHLWORKSPACE& pWorkspace);
|
||||||
SDwindleNodeData* getNodeFromWindow(CWindow*);
|
SDwindleNodeData* getNodeFromWindow(PHLWINDOW);
|
||||||
SDwindleNodeData* getFirstNodeOnWorkspace(const int&);
|
SDwindleNodeData* getFirstNodeOnWorkspace(const int&);
|
||||||
SDwindleNodeData* getClosestNodeOnWorkspace(const int&, const Vector2D&);
|
SDwindleNodeData* getClosestNodeOnWorkspace(const int&, const Vector2D&);
|
||||||
SDwindleNodeData* getMasterNodeOnWorkspace(const int&);
|
SDwindleNodeData* getMasterNodeOnWorkspace(const int&);
|
||||||
|
|
||||||
void toggleSplit(CWindow*);
|
void toggleSplit(PHLWINDOW);
|
||||||
void swapSplit(CWindow*);
|
void swapSplit(PHLWINDOW);
|
||||||
|
|
||||||
eDirection overrideDirection = DIRECTION_DEFAULT;
|
eDirection overrideDirection = DIRECTION_DEFAULT;
|
||||||
|
|
||||||
|
@ -101,8 +101,8 @@ struct std::formatter<SDwindleNodeData*, CharT> : std::formatter<CharT> {
|
||||||
if (!node)
|
if (!node)
|
||||||
return std::format_to(out, "[Node nullptr]");
|
return std::format_to(out, "[Node nullptr]");
|
||||||
std::format_to(out, "[Node {:x}: workspace: {}, pos: {:j2}, size: {:j2}", (uintptr_t)node, node->workspaceID, node->box.pos(), node->box.size());
|
std::format_to(out, "[Node {:x}: workspace: {}, pos: {:j2}, size: {:j2}", (uintptr_t)node, node->workspaceID, node->box.pos(), node->box.size());
|
||||||
if (!node->isNode && node->pWindow)
|
if (!node->isNode && !node->pWindow.expired())
|
||||||
std::format_to(out, ", window: {:x}", node->pWindow);
|
std::format_to(out, ", window: {:x}", node->pWindow.lock());
|
||||||
return std::format_to(out, "]");
|
return std::format_to(out, "]");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "../config/ConfigValue.hpp"
|
#include "../config/ConfigValue.hpp"
|
||||||
#include "../desktop/Window.hpp"
|
#include "../desktop/Window.hpp"
|
||||||
|
|
||||||
void IHyprLayout::onWindowCreated(CWindow* pWindow, eDirection direction) {
|
void IHyprLayout::onWindowCreated(PHLWINDOW pWindow, eDirection direction) {
|
||||||
if (pWindow->m_bIsFloating) {
|
if (pWindow->m_bIsFloating) {
|
||||||
onWindowCreatedFloating(pWindow);
|
onWindowCreatedFloating(pWindow);
|
||||||
} else {
|
} else {
|
||||||
|
@ -25,32 +25,32 @@ void IHyprLayout::onWindowCreated(CWindow* pWindow, eDirection direction) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHyprLayout::onWindowRemoved(CWindow* pWindow) {
|
void IHyprLayout::onWindowRemoved(PHLWINDOW pWindow) {
|
||||||
if (pWindow->m_bIsFullscreen)
|
if (pWindow->m_bIsFullscreen)
|
||||||
g_pCompositor->setWindowFullscreen(pWindow, false, FULLSCREEN_FULL);
|
g_pCompositor->setWindowFullscreen(pWindow, false, FULLSCREEN_FULL);
|
||||||
|
|
||||||
if (pWindow->m_sGroupData.pNextWindow) {
|
if (!pWindow->m_sGroupData.pNextWindow.expired()) {
|
||||||
if (pWindow->m_sGroupData.pNextWindow == pWindow)
|
if (pWindow->m_sGroupData.pNextWindow.lock() == pWindow)
|
||||||
pWindow->m_sGroupData.pNextWindow = nullptr;
|
pWindow->m_sGroupData.pNextWindow.reset();
|
||||||
else {
|
else {
|
||||||
// find last window and update
|
// find last window and update
|
||||||
CWindow* PWINDOWPREV = pWindow->getGroupPrevious();
|
PHLWINDOW PWINDOWPREV = pWindow->getGroupPrevious();
|
||||||
const auto WINDOWISVISIBLE = pWindow->getGroupCurrent() == pWindow;
|
const auto WINDOWISVISIBLE = pWindow->getGroupCurrent() == pWindow;
|
||||||
|
|
||||||
if (WINDOWISVISIBLE)
|
if (WINDOWISVISIBLE)
|
||||||
PWINDOWPREV->setGroupCurrent(pWindow->m_sGroupData.head ? pWindow->m_sGroupData.pNextWindow : PWINDOWPREV);
|
PWINDOWPREV->setGroupCurrent(pWindow->m_sGroupData.head ? pWindow->m_sGroupData.pNextWindow.lock() : PWINDOWPREV);
|
||||||
|
|
||||||
PWINDOWPREV->m_sGroupData.pNextWindow = pWindow->m_sGroupData.pNextWindow;
|
PWINDOWPREV->m_sGroupData.pNextWindow = pWindow->m_sGroupData.pNextWindow;
|
||||||
|
|
||||||
pWindow->m_sGroupData.pNextWindow = nullptr;
|
pWindow->m_sGroupData.pNextWindow.reset();
|
||||||
|
|
||||||
if (pWindow->m_sGroupData.head) {
|
if (pWindow->m_sGroupData.head) {
|
||||||
std::swap(PWINDOWPREV->m_sGroupData.pNextWindow->m_sGroupData.head, pWindow->m_sGroupData.head);
|
std::swap(PWINDOWPREV->m_sGroupData.pNextWindow.lock()->m_sGroupData.head, pWindow->m_sGroupData.head);
|
||||||
std::swap(PWINDOWPREV->m_sGroupData.pNextWindow->m_sGroupData.locked, pWindow->m_sGroupData.locked);
|
std::swap(PWINDOWPREV->m_sGroupData.pNextWindow.lock()->m_sGroupData.locked, pWindow->m_sGroupData.locked);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pWindow == m_pLastTiledWindow)
|
if (pWindow == m_pLastTiledWindow.lock())
|
||||||
m_pLastTiledWindow = nullptr;
|
m_pLastTiledWindow.reset();
|
||||||
|
|
||||||
pWindow->setHidden(false);
|
pWindow->setHidden(false);
|
||||||
|
|
||||||
|
@ -68,15 +68,15 @@ void IHyprLayout::onWindowRemoved(CWindow* pWindow) {
|
||||||
onWindowRemovedTiling(pWindow);
|
onWindowRemovedTiling(pWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pWindow == m_pLastTiledWindow)
|
if (pWindow == m_pLastTiledWindow.lock())
|
||||||
m_pLastTiledWindow = nullptr;
|
m_pLastTiledWindow.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHyprLayout::onWindowRemovedFloating(CWindow* pWindow) {
|
void IHyprLayout::onWindowRemovedFloating(PHLWINDOW pWindow) {
|
||||||
return; // no-op
|
return; // no-op
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) {
|
void IHyprLayout::onWindowCreatedFloating(PHLWINDOW pWindow) {
|
||||||
|
|
||||||
CBox desiredGeometry = {0};
|
CBox desiredGeometry = {0};
|
||||||
g_pXWaylandManager->getGeometryForWindow(pWindow, &desiredGeometry);
|
g_pXWaylandManager->getGeometryForWindow(pWindow, &desiredGeometry);
|
||||||
|
@ -172,15 +172,15 @@ void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHyprLayout::onBeginDragWindow() {
|
void IHyprLayout::onBeginDragWindow() {
|
||||||
const auto DRAGGINGWINDOW = g_pInputManager->currentlyDraggedWindow;
|
const auto DRAGGINGWINDOW = g_pInputManager->currentlyDraggedWindow.lock();
|
||||||
|
|
||||||
m_iMouseMoveEventCount = 1;
|
m_iMouseMoveEventCount = 1;
|
||||||
m_vBeginDragSizeXY = Vector2D();
|
m_vBeginDragSizeXY = Vector2D();
|
||||||
|
|
||||||
// Window will be floating. Let's check if it's valid. It should be, but I don't like crashing.
|
// Window will be floating. Let's check if it's valid. It should be, but I don't like crashing.
|
||||||
if (!g_pCompositor->windowValidMapped(DRAGGINGWINDOW)) {
|
if (!validMapped(DRAGGINGWINDOW)) {
|
||||||
Debug::log(ERR, "Dragging attempted on an invalid window!");
|
Debug::log(ERR, "Dragging attempted on an invalid window!");
|
||||||
g_pInputManager->currentlyDraggedWindow = nullptr;
|
g_pInputManager->currentlyDraggedWindow.reset();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ void IHyprLayout::onBeginDragWindow() {
|
||||||
|
|
||||||
if (PWORKSPACE->m_bHasFullscreenWindow && (!DRAGGINGWINDOW->m_bCreatedOverFullscreen || !DRAGGINGWINDOW->m_bIsFloating)) {
|
if (PWORKSPACE->m_bHasFullscreenWindow && (!DRAGGINGWINDOW->m_bCreatedOverFullscreen || !DRAGGINGWINDOW->m_bIsFloating)) {
|
||||||
Debug::log(LOG, "Rejecting drag on a fullscreen workspace. (window under fullscreen)");
|
Debug::log(LOG, "Rejecting drag on a fullscreen workspace. (window under fullscreen)");
|
||||||
g_pInputManager->currentlyDraggedWindow = nullptr;
|
g_pInputManager->currentlyDraggedWindow.reset();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,22 +268,22 @@ void IHyprLayout::onBeginDragWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHyprLayout::onEndDragWindow() {
|
void IHyprLayout::onEndDragWindow() {
|
||||||
const auto DRAGGINGWINDOW = g_pInputManager->currentlyDraggedWindow;
|
const auto DRAGGINGWINDOW = g_pInputManager->currentlyDraggedWindow.lock();
|
||||||
|
|
||||||
m_iMouseMoveEventCount = 1;
|
m_iMouseMoveEventCount = 1;
|
||||||
|
|
||||||
if (!g_pCompositor->windowValidMapped(DRAGGINGWINDOW)) {
|
if (!validMapped(DRAGGINGWINDOW)) {
|
||||||
if (DRAGGINGWINDOW) {
|
if (DRAGGINGWINDOW) {
|
||||||
g_pInputManager->unsetCursorImage();
|
g_pInputManager->unsetCursorImage();
|
||||||
g_pInputManager->currentlyDraggedWindow = nullptr;
|
g_pInputManager->currentlyDraggedWindow.reset();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pInputManager->unsetCursorImage();
|
g_pInputManager->unsetCursorImage();
|
||||||
|
|
||||||
g_pInputManager->currentlyDraggedWindow = nullptr;
|
g_pInputManager->currentlyDraggedWindow.reset();
|
||||||
g_pInputManager->m_bWasDraggingWindow = true;
|
g_pInputManager->m_bWasDraggingWindow = true;
|
||||||
|
|
||||||
if (DRAGGINGWINDOW->m_bDraggingTiled) {
|
if (DRAGGINGWINDOW->m_bDraggingTiled) {
|
||||||
DRAGGINGWINDOW->m_bIsFloating = false;
|
DRAGGINGWINDOW->m_bIsFloating = false;
|
||||||
|
@ -293,13 +293,13 @@ void IHyprLayout::onEndDragWindow() {
|
||||||
} else if (g_pInputManager->dragMode == MBIND_MOVE) {
|
} else if (g_pInputManager->dragMode == MBIND_MOVE) {
|
||||||
g_pHyprRenderer->damageWindow(DRAGGINGWINDOW);
|
g_pHyprRenderer->damageWindow(DRAGGINGWINDOW);
|
||||||
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
|
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
|
||||||
CWindow* pWindow = g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING | FLOATING_ONLY, DRAGGINGWINDOW);
|
PHLWINDOW pWindow = g_pCompositor->vectorToWindowUnified(MOUSECOORDS, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING | FLOATING_ONLY, DRAGGINGWINDOW);
|
||||||
|
|
||||||
if (pWindow) {
|
if (pWindow) {
|
||||||
if (pWindow->checkInputOnDecos(INPUT_TYPE_DRAG_END, MOUSECOORDS, DRAGGINGWINDOW))
|
if (pWindow->checkInputOnDecos(INPUT_TYPE_DRAG_END, MOUSECOORDS, DRAGGINGWINDOW))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pWindow->m_sGroupData.pNextWindow && DRAGGINGWINDOW->canBeGroupedInto(pWindow)) {
|
if (pWindow->m_sGroupData.pNextWindow.lock() && DRAGGINGWINDOW->canBeGroupedInto(pWindow)) {
|
||||||
static auto USECURRPOS = CConfigValue<Hyprlang::INT>("group:insert_after_current");
|
static auto USECURRPOS = CConfigValue<Hyprlang::INT>("group:insert_after_current");
|
||||||
(*USECURRPOS ? pWindow : pWindow->getGroupTail())->insertWindowToGroup(DRAGGINGWINDOW);
|
(*USECURRPOS ? pWindow : pWindow->getGroupTail())->insertWindowToGroup(DRAGGINGWINDOW);
|
||||||
pWindow->setGroupCurrent(DRAGGINGWINDOW);
|
pWindow->setGroupCurrent(DRAGGINGWINDOW);
|
||||||
|
@ -318,12 +318,12 @@ void IHyprLayout::onEndDragWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
|
void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
|
||||||
const auto DRAGGINGWINDOW = g_pInputManager->currentlyDraggedWindow;
|
const auto DRAGGINGWINDOW = g_pInputManager->currentlyDraggedWindow.lock();
|
||||||
|
|
||||||
// Window invalid or drag begin size 0,0 meaning we rejected it.
|
// Window invalid or drag begin size 0,0 meaning we rejected it.
|
||||||
if (!g_pCompositor->windowValidMapped(DRAGGINGWINDOW) || m_vBeginDragSizeXY == Vector2D()) {
|
if (!validMapped(DRAGGINGWINDOW) || m_vBeginDragSizeXY == Vector2D()) {
|
||||||
onEndDragWindow();
|
onEndDragWindow();
|
||||||
g_pInputManager->currentlyDraggedWindow = nullptr;
|
g_pInputManager->currentlyDraggedWindow.reset();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,7 +461,7 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
|
||||||
g_pHyprRenderer->damageWindow(DRAGGINGWINDOW);
|
g_pHyprRenderer->damageWindow(DRAGGINGWINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHyprLayout::changeWindowFloatingMode(CWindow* pWindow) {
|
void IHyprLayout::changeWindowFloatingMode(PHLWINDOW pWindow) {
|
||||||
|
|
||||||
if (pWindow->m_bIsFullscreen) {
|
if (pWindow->m_bIsFullscreen) {
|
||||||
Debug::log(LOG, "changeWindowFloatingMode: fullscreen");
|
Debug::log(LOG, "changeWindowFloatingMode: fullscreen");
|
||||||
|
@ -473,7 +473,7 @@ void IHyprLayout::changeWindowFloatingMode(CWindow* pWindow) {
|
||||||
const auto TILED = isWindowTiled(pWindow);
|
const auto TILED = isWindowTiled(pWindow);
|
||||||
|
|
||||||
// event
|
// event
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"changefloatingmode", std::format("{:x},{}", (uintptr_t)pWindow, (int)TILED)});
|
g_pEventManager->postEvent(SHyprIPCEvent{"changefloatingmode", std::format("{:x},{}", (uintptr_t)pWindow.get(), (int)TILED)});
|
||||||
EMIT_HOOK_EVENT("changeFloatingMode", pWindow);
|
EMIT_HOOK_EVENT("changeFloatingMode", pWindow);
|
||||||
|
|
||||||
if (!TILED) {
|
if (!TILED) {
|
||||||
|
@ -508,7 +508,7 @@ void IHyprLayout::changeWindowFloatingMode(CWindow* pWindow) {
|
||||||
// fix pseudo leaving artifacts
|
// fix pseudo leaving artifacts
|
||||||
g_pHyprRenderer->damageMonitor(g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID));
|
g_pHyprRenderer->damageMonitor(g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID));
|
||||||
|
|
||||||
if (pWindow == g_pCompositor->m_pLastWindow)
|
if (pWindow == g_pCompositor->m_pLastWindow.lock())
|
||||||
m_pLastTiledWindow = pWindow;
|
m_pLastTiledWindow = pWindow;
|
||||||
} else {
|
} else {
|
||||||
onWindowRemovedTiling(pWindow);
|
onWindowRemovedTiling(pWindow);
|
||||||
|
@ -533,8 +533,8 @@ void IHyprLayout::changeWindowFloatingMode(CWindow* pWindow) {
|
||||||
|
|
||||||
pWindow->updateSpecialRenderData();
|
pWindow->updateSpecialRenderData();
|
||||||
|
|
||||||
if (pWindow == m_pLastTiledWindow)
|
if (pWindow == m_pLastTiledWindow.lock())
|
||||||
m_pLastTiledWindow = nullptr;
|
m_pLastTiledWindow.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pCompositor->updateWindowAnimatedDecorationValues(pWindow);
|
g_pCompositor->updateWindowAnimatedDecorationValues(pWindow);
|
||||||
|
@ -542,10 +542,10 @@ void IHyprLayout::changeWindowFloatingMode(CWindow* pWindow) {
|
||||||
pWindow->updateToplevel();
|
pWindow->updateToplevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHyprLayout::moveActiveWindow(const Vector2D& delta, CWindow* pWindow) {
|
void IHyprLayout::moveActiveWindow(const Vector2D& delta, PHLWINDOW pWindow) {
|
||||||
const auto PWINDOW = pWindow ? pWindow : g_pCompositor->m_pLastWindow;
|
const auto PWINDOW = pWindow ? pWindow : g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!g_pCompositor->windowValidMapped(PWINDOW))
|
if (!validMapped(PWINDOW))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!PWINDOW->m_bIsFloating) {
|
if (!PWINDOW->m_bIsFloating) {
|
||||||
|
@ -560,11 +560,11 @@ void IHyprLayout::moveActiveWindow(const Vector2D& delta, CWindow* pWindow) {
|
||||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHyprLayout::onWindowFocusChange(CWindow* pNewFocus) {
|
void IHyprLayout::onWindowFocusChange(PHLWINDOW pNewFocus) {
|
||||||
m_pLastTiledWindow = pNewFocus && !pNewFocus->m_bIsFloating ? pNewFocus : m_pLastTiledWindow;
|
m_pLastTiledWindow = pNewFocus && !pNewFocus->m_bIsFloating ? pNewFocus : m_pLastTiledWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* IHyprLayout::getNextWindowCandidate(CWindow* pWindow) {
|
PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) {
|
||||||
// although we don't expect nullptrs here, let's verify jic
|
// although we don't expect nullptrs here, let's verify jic
|
||||||
if (!pWindow)
|
if (!pWindow)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -580,17 +580,17 @@ CWindow* IHyprLayout::getNextWindowCandidate(CWindow* pWindow) {
|
||||||
// find whether there is a floating window below this one
|
// find whether there is a floating window below this one
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2 && w->m_pWorkspace == pWindow->m_pWorkspace && !w->m_bX11ShouldntFocus &&
|
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2 && w->m_pWorkspace == pWindow->m_pWorkspace && !w->m_bX11ShouldntFocus &&
|
||||||
!w->m_sAdditionalConfigData.noFocus && w.get() != pWindow) {
|
!w->m_sAdditionalConfigData.noFocus && w != pWindow) {
|
||||||
if (VECINRECT((pWindow->m_vSize / 2.f + pWindow->m_vPosition), w->m_vPosition.x, w->m_vPosition.y, w->m_vPosition.x + w->m_vSize.x,
|
if (VECINRECT((pWindow->m_vSize / 2.f + pWindow->m_vPosition), w->m_vPosition.x, w->m_vPosition.y, w->m_vPosition.x + w->m_vSize.x,
|
||||||
w->m_vPosition.y + w->m_vSize.y)) {
|
w->m_vPosition.y + w->m_vSize.y)) {
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// let's try the last tiled window.
|
// let's try the last tiled window.
|
||||||
if (m_pLastTiledWindow && m_pLastTiledWindow->m_pWorkspace == pWindow->m_pWorkspace)
|
if (m_pLastTiledWindow.lock() && m_pLastTiledWindow.lock()->m_pWorkspace == pWindow->m_pWorkspace)
|
||||||
return m_pLastTiledWindow;
|
return m_pLastTiledWindow.lock();
|
||||||
|
|
||||||
// if we don't, let's try to find any window that is in the middle
|
// if we don't, let's try to find any window that is in the middle
|
||||||
if (const auto PWINDOWCANDIDATE = g_pCompositor->vectorToWindowUnified(pWindow->middle(), RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
if (const auto PWINDOWCANDIDATE = g_pCompositor->vectorToWindowUnified(pWindow->middle(), RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
||||||
|
@ -600,8 +600,8 @@ CWindow* IHyprLayout::getNextWindowCandidate(CWindow* pWindow) {
|
||||||
// if not, floating window
|
// if not, floating window
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2 && w->m_pWorkspace == pWindow->m_pWorkspace && !w->m_bX11ShouldntFocus &&
|
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2 && w->m_pWorkspace == pWindow->m_pWorkspace && !w->m_bX11ShouldntFocus &&
|
||||||
!w->m_sAdditionalConfigData.noFocus && w.get() != pWindow)
|
!w->m_sAdditionalConfigData.noFocus && w != pWindow)
|
||||||
return w.get();
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if there is no candidate, too bad
|
// if there is no candidate, too bad
|
||||||
|
@ -624,27 +624,27 @@ CWindow* IHyprLayout::getNextWindowCandidate(CWindow* pWindow) {
|
||||||
return pWindowCandidate;
|
return pWindowCandidate;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IHyprLayout::isWindowReachable(CWindow* pWindow) {
|
bool IHyprLayout::isWindowReachable(PHLWINDOW pWindow) {
|
||||||
return pWindow && (!pWindow->isHidden() || pWindow->m_sGroupData.pNextWindow);
|
return pWindow && (!pWindow->isHidden() || pWindow->m_sGroupData.pNextWindow.lock());
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHyprLayout::bringWindowToTop(CWindow* pWindow) {
|
void IHyprLayout::bringWindowToTop(PHLWINDOW pWindow) {
|
||||||
if (pWindow == nullptr)
|
if (pWindow == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pWindow->isHidden() && pWindow->m_sGroupData.pNextWindow) {
|
if (pWindow->isHidden() && pWindow->m_sGroupData.pNextWindow.lock()) {
|
||||||
// grouped, change the current to this window
|
// grouped, change the current to this window
|
||||||
pWindow->setGroupCurrent(pWindow);
|
pWindow->setGroupCurrent(pWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHyprLayout::requestFocusForWindow(CWindow* pWindow) {
|
void IHyprLayout::requestFocusForWindow(PHLWINDOW pWindow) {
|
||||||
bringWindowToTop(pWindow);
|
bringWindowToTop(pWindow);
|
||||||
g_pCompositor->focusWindow(pWindow);
|
g_pCompositor->focusWindow(pWindow);
|
||||||
g_pCompositor->warpCursorTo(pWindow->middle());
|
g_pCompositor->warpCursorTo(pWindow->middle());
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D IHyprLayout::predictSizeForNewWindowFloating(CWindow* pWindow) { // get all rules, see if we have any size overrides.
|
Vector2D IHyprLayout::predictSizeForNewWindowFloating(PHLWINDOW pWindow) { // get all rules, see if we have any size overrides.
|
||||||
Vector2D sizeOverride = {};
|
Vector2D sizeOverride = {};
|
||||||
if (g_pCompositor->m_pLastMonitor) {
|
if (g_pCompositor->m_pLastMonitor) {
|
||||||
for (auto& r : g_pConfigManager->getMatchingRules(pWindow, true, true)) {
|
for (auto& r : g_pConfigManager->getMatchingRules(pWindow, true, true)) {
|
||||||
|
@ -674,7 +674,7 @@ Vector2D IHyprLayout::predictSizeForNewWindowFloating(CWindow* pWindow) { // get
|
||||||
return sizeOverride;
|
return sizeOverride;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D IHyprLayout::predictSizeForNewWindow(CWindow* pWindow) {
|
Vector2D IHyprLayout::predictSizeForNewWindow(PHLWINDOW pWindow) {
|
||||||
bool shouldBeFloated = g_pXWaylandManager->shouldBeFloated(pWindow, true);
|
bool shouldBeFloated = g_pXWaylandManager->shouldBeFloated(pWindow, true);
|
||||||
|
|
||||||
if (!shouldBeFloated) {
|
if (!shouldBeFloated) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ struct SWindowRenderLayoutHints {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SLayoutMessageHeader {
|
struct SLayoutMessageHeader {
|
||||||
CWindow* pWindow = nullptr;
|
PHLWINDOW pWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eFullscreenMode : int8_t;
|
enum eFullscreenMode : int8_t;
|
||||||
|
@ -44,21 +44,21 @@ class IHyprLayout {
|
||||||
The layout HAS TO set the goal pos and size (anim mgr will use it)
|
The layout HAS TO set the goal pos and size (anim mgr will use it)
|
||||||
If !animationinprogress, then the anim mgr will not apply an anim.
|
If !animationinprogress, then the anim mgr will not apply an anim.
|
||||||
*/
|
*/
|
||||||
virtual void onWindowCreated(CWindow*, eDirection direction = DIRECTION_DEFAULT);
|
virtual void onWindowCreated(PHLWINDOW, eDirection direction = DIRECTION_DEFAULT);
|
||||||
virtual void onWindowCreatedTiling(CWindow*, eDirection direction = DIRECTION_DEFAULT) = 0;
|
virtual void onWindowCreatedTiling(PHLWINDOW, eDirection direction = DIRECTION_DEFAULT) = 0;
|
||||||
virtual void onWindowCreatedFloating(CWindow*);
|
virtual void onWindowCreatedFloating(PHLWINDOW);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Return tiled status
|
Return tiled status
|
||||||
*/
|
*/
|
||||||
virtual bool isWindowTiled(CWindow*) = 0;
|
virtual bool isWindowTiled(PHLWINDOW) = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Called when a window is removed (unmapped)
|
Called when a window is removed (unmapped)
|
||||||
*/
|
*/
|
||||||
virtual void onWindowRemoved(CWindow*);
|
virtual void onWindowRemoved(PHLWINDOW);
|
||||||
virtual void onWindowRemovedTiling(CWindow*) = 0;
|
virtual void onWindowRemovedTiling(PHLWINDOW) = 0;
|
||||||
virtual void onWindowRemovedFloating(CWindow*);
|
virtual void onWindowRemovedFloating(PHLWINDOW);
|
||||||
/*
|
/*
|
||||||
Called when the monitor requires a layout recalculation
|
Called when the monitor requires a layout recalculation
|
||||||
this usually means reserved area changes
|
this usually means reserved area changes
|
||||||
|
@ -69,12 +69,12 @@ class IHyprLayout {
|
||||||
Called when the compositor requests a window
|
Called when the compositor requests a window
|
||||||
to be recalculated, e.g. when pseudo is toggled.
|
to be recalculated, e.g. when pseudo is toggled.
|
||||||
*/
|
*/
|
||||||
virtual void recalculateWindow(CWindow*) = 0;
|
virtual void recalculateWindow(PHLWINDOW) = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Called when a window is requested to be floated
|
Called when a window is requested to be floated
|
||||||
*/
|
*/
|
||||||
virtual void changeWindowFloatingMode(CWindow*);
|
virtual void changeWindowFloatingMode(PHLWINDOW);
|
||||||
/*
|
/*
|
||||||
Called when a window is clicked on, beginning a drag
|
Called when a window is clicked on, beginning a drag
|
||||||
this might be a resize, move, whatever the layout defines it
|
this might be a resize, move, whatever the layout defines it
|
||||||
|
@ -86,13 +86,13 @@ class IHyprLayout {
|
||||||
Vector2D holds pixel values
|
Vector2D holds pixel values
|
||||||
Optional pWindow for a specific window
|
Optional pWindow for a specific window
|
||||||
*/
|
*/
|
||||||
virtual void resizeActiveWindow(const Vector2D&, eRectCorner corner = CORNER_NONE, CWindow* pWindow = nullptr) = 0;
|
virtual void resizeActiveWindow(const Vector2D&, eRectCorner corner = CORNER_NONE, PHLWINDOW pWindow = nullptr) = 0;
|
||||||
/*
|
/*
|
||||||
Called when a user requests a move of the current window by a vec
|
Called when a user requests a move of the current window by a vec
|
||||||
Vector2D holds pixel values
|
Vector2D holds pixel values
|
||||||
Optional pWindow for a specific window
|
Optional pWindow for a specific window
|
||||||
*/
|
*/
|
||||||
virtual void moveActiveWindow(const Vector2D&, CWindow* pWindow = nullptr);
|
virtual void moveActiveWindow(const Vector2D&, PHLWINDOW pWindow = nullptr);
|
||||||
/*
|
/*
|
||||||
Called when a window is ended being dragged
|
Called when a window is ended being dragged
|
||||||
(mouse up)
|
(mouse up)
|
||||||
|
@ -110,7 +110,7 @@ class IHyprLayout {
|
||||||
The layout sets all the fullscreen flags.
|
The layout sets all the fullscreen flags.
|
||||||
It can either accept or ignore.
|
It can either accept or ignore.
|
||||||
*/
|
*/
|
||||||
virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode, bool) = 0;
|
virtual void fullscreenRequestForWindow(PHLWINDOW, eFullscreenMode, bool) = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Called when a dispatcher requests a custom message
|
Called when a dispatcher requests a custom message
|
||||||
|
@ -124,25 +124,25 @@ class IHyprLayout {
|
||||||
Called when the renderer requests any special draw flags for
|
Called when the renderer requests any special draw flags for
|
||||||
a specific window, e.g. border color for groups.
|
a specific window, e.g. border color for groups.
|
||||||
*/
|
*/
|
||||||
virtual SWindowRenderLayoutHints requestRenderHints(CWindow*) = 0;
|
virtual SWindowRenderLayoutHints requestRenderHints(PHLWINDOW) = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Called when the user requests two windows to be swapped places.
|
Called when the user requests two windows to be swapped places.
|
||||||
The layout is free to ignore.
|
The layout is free to ignore.
|
||||||
*/
|
*/
|
||||||
virtual void switchWindows(CWindow*, CWindow*) = 0;
|
virtual void switchWindows(PHLWINDOW, PHLWINDOW) = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Called when the user requests a window move in a direction.
|
Called when the user requests a window move in a direction.
|
||||||
The layout is free to ignore.
|
The layout is free to ignore.
|
||||||
*/
|
*/
|
||||||
virtual void moveWindowTo(CWindow*, const std::string& direction, bool silent = false) = 0;
|
virtual void moveWindowTo(PHLWINDOW, const std::string& direction, bool silent = false) = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Called when the user requests to change the splitratio by or to X
|
Called when the user requests to change the splitratio by or to X
|
||||||
on a window
|
on a window
|
||||||
*/
|
*/
|
||||||
virtual void alterSplitRatio(CWindow*, float, bool exact = false) = 0;
|
virtual void alterSplitRatio(PHLWINDOW, float, bool exact = false) = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Called when something wants the current layout's name
|
Called when something wants the current layout's name
|
||||||
|
@ -152,36 +152,36 @@ class IHyprLayout {
|
||||||
/*
|
/*
|
||||||
Called for getting the next candidate for a focus
|
Called for getting the next candidate for a focus
|
||||||
*/
|
*/
|
||||||
virtual CWindow* getNextWindowCandidate(CWindow*);
|
virtual PHLWINDOW getNextWindowCandidate(PHLWINDOW);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Internal: called when window focus changes
|
Internal: called when window focus changes
|
||||||
*/
|
*/
|
||||||
virtual void onWindowFocusChange(CWindow*);
|
virtual void onWindowFocusChange(PHLWINDOW);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Called for replacing any data a layout has for a new window
|
Called for replacing any data a layout has for a new window
|
||||||
*/
|
*/
|
||||||
virtual void replaceWindowDataWith(CWindow* from, CWindow* to) = 0;
|
virtual void replaceWindowDataWith(PHLWINDOW from, PHLWINDOW to) = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Determines if a window can be focused. If hidden this usually means the window is part of a group.
|
Determines if a window can be focused. If hidden this usually means the window is part of a group.
|
||||||
*/
|
*/
|
||||||
virtual bool isWindowReachable(CWindow*);
|
virtual bool isWindowReachable(PHLWINDOW);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Called before an attempt is made to focus a window.
|
Called before an attempt is made to focus a window.
|
||||||
Brings the window to the top of any groups and ensures it is not hidden.
|
Brings the window to the top of any groups and ensures it is not hidden.
|
||||||
If the window is unmapped following this call, the focus attempt will fail.
|
If the window is unmapped following this call, the focus attempt will fail.
|
||||||
*/
|
*/
|
||||||
virtual void bringWindowToTop(CWindow*);
|
virtual void bringWindowToTop(PHLWINDOW);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Called via the foreign toplevel activation protocol.
|
Called via the foreign toplevel activation protocol.
|
||||||
Focuses a window, bringing it to the top of its group if applicable.
|
Focuses a window, bringing it to the top of its group if applicable.
|
||||||
May be ignored.
|
May be ignored.
|
||||||
*/
|
*/
|
||||||
virtual void requestFocusForWindow(CWindow*);
|
virtual void requestFocusForWindow(PHLWINDOW);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Called to predict the size of a newly opened window to send it a configure.
|
Called to predict the size of a newly opened window to send it a configure.
|
||||||
|
@ -192,17 +192,17 @@ class IHyprLayout {
|
||||||
/*
|
/*
|
||||||
Prefer not overriding, use predictSizeForNewWindowTiled.
|
Prefer not overriding, use predictSizeForNewWindowTiled.
|
||||||
*/
|
*/
|
||||||
virtual Vector2D predictSizeForNewWindow(CWindow* pWindow);
|
virtual Vector2D predictSizeForNewWindow(PHLWINDOW pWindow);
|
||||||
virtual Vector2D predictSizeForNewWindowFloating(CWindow* pWindow);
|
virtual Vector2D predictSizeForNewWindowFloating(PHLWINDOW pWindow);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_iMouseMoveEventCount;
|
int m_iMouseMoveEventCount;
|
||||||
Vector2D m_vBeginDragXY;
|
Vector2D m_vBeginDragXY;
|
||||||
Vector2D m_vLastDragXY;
|
Vector2D m_vLastDragXY;
|
||||||
Vector2D m_vBeginDragPositionXY;
|
Vector2D m_vBeginDragPositionXY;
|
||||||
Vector2D m_vBeginDragSizeXY;
|
Vector2D m_vBeginDragSizeXY;
|
||||||
Vector2D m_vDraggingWindowOriginalFloatSize;
|
Vector2D m_vDraggingWindowOriginalFloatSize;
|
||||||
eRectCorner m_eGrabbedCorner = CORNER_TOPLEFT;
|
eRectCorner m_eGrabbedCorner = CORNER_TOPLEFT;
|
||||||
|
|
||||||
CWindow* m_pLastTiledWindow = nullptr;
|
PHLWINDOWREF m_pLastTiledWindow;
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
#include "../config/ConfigValue.hpp"
|
#include "../config/ConfigValue.hpp"
|
||||||
|
|
||||||
SMasterNodeData* CHyprMasterLayout::getNodeFromWindow(CWindow* pWindow) {
|
SMasterNodeData* CHyprMasterLayout::getNodeFromWindow(PHLWINDOW pWindow) {
|
||||||
for (auto& nd : m_lMasterNodesData) {
|
for (auto& nd : m_lMasterNodesData) {
|
||||||
if (nd.pWindow == pWindow)
|
if (nd.pWindow.lock() == pWindow)
|
||||||
return &nd;
|
return &nd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ SMasterNodeData* CHyprMasterLayout::getMasterNodeOnWorkspace(const int& ws) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprMasterLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection direction) {
|
void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection direction) {
|
||||||
if (pWindow->m_bIsFloating)
|
if (pWindow->m_bIsFloating)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -91,27 +91,27 @@ void CHyprMasterLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection direc
|
||||||
static auto PMFACT = CConfigValue<Hyprlang::FLOAT>("master:mfact");
|
static auto PMFACT = CConfigValue<Hyprlang::FLOAT>("master:mfact");
|
||||||
float lastSplitPercent = *PMFACT;
|
float lastSplitPercent = *PMFACT;
|
||||||
|
|
||||||
auto OPENINGON = isWindowTiled(g_pCompositor->m_pLastWindow) && g_pCompositor->m_pLastWindow->m_pWorkspace == pWindow->m_pWorkspace ?
|
auto OPENINGON = isWindowTiled(g_pCompositor->m_pLastWindow.lock()) && g_pCompositor->m_pLastWindow.lock()->m_pWorkspace == pWindow->m_pWorkspace ?
|
||||||
getNodeFromWindow(g_pCompositor->m_pLastWindow) :
|
getNodeFromWindow(g_pCompositor->m_pLastWindow.lock()) :
|
||||||
getMasterNodeOnWorkspace(pWindow->workspaceID());
|
getMasterNodeOnWorkspace(pWindow->workspaceID());
|
||||||
|
|
||||||
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
|
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
|
||||||
|
|
||||||
if (g_pInputManager->m_bWasDraggingWindow && OPENINGON) {
|
if (g_pInputManager->m_bWasDraggingWindow && OPENINGON) {
|
||||||
if (OPENINGON->pWindow->checkInputOnDecos(INPUT_TYPE_DRAG_END, MOUSECOORDS, pWindow))
|
if (OPENINGON->pWindow.lock()->checkInputOnDecos(INPUT_TYPE_DRAG_END, MOUSECOORDS, pWindow))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it's a group, add the window
|
// if it's a group, add the window
|
||||||
if (OPENINGON && OPENINGON != PNODE && OPENINGON->pWindow->m_sGroupData.pNextWindow // target is group
|
if (OPENINGON && OPENINGON != PNODE && OPENINGON->pWindow.lock()->m_sGroupData.pNextWindow.lock() // target is group
|
||||||
&& pWindow->canBeGroupedInto(OPENINGON->pWindow)) {
|
&& pWindow->canBeGroupedInto(OPENINGON->pWindow.lock())) {
|
||||||
|
|
||||||
m_lMasterNodesData.remove(*PNODE);
|
m_lMasterNodesData.remove(*PNODE);
|
||||||
|
|
||||||
static auto USECURRPOS = CConfigValue<Hyprlang::INT>("group:insert_after_current");
|
static auto USECURRPOS = CConfigValue<Hyprlang::INT>("group:insert_after_current");
|
||||||
(*USECURRPOS ? OPENINGON->pWindow : OPENINGON->pWindow->getGroupTail())->insertWindowToGroup(pWindow);
|
(*USECURRPOS ? OPENINGON->pWindow.lock() : OPENINGON->pWindow.lock()->getGroupTail())->insertWindowToGroup(pWindow);
|
||||||
|
|
||||||
OPENINGON->pWindow->setGroupCurrent(pWindow);
|
OPENINGON->pWindow.lock()->setGroupCurrent(pWindow);
|
||||||
pWindow->applyGroupRules();
|
pWindow->applyGroupRules();
|
||||||
pWindow->updateWindowDecos();
|
pWindow->updateWindowDecos();
|
||||||
recalculateWindow(pWindow);
|
recalculateWindow(pWindow);
|
||||||
|
@ -135,17 +135,17 @@ void CHyprMasterLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection direc
|
||||||
for (auto it = m_lMasterNodesData.begin(); it != m_lMasterNodesData.end(); ++it) {
|
for (auto it = m_lMasterNodesData.begin(); it != m_lMasterNodesData.end(); ++it) {
|
||||||
if (it->workspaceID != pWindow->workspaceID())
|
if (it->workspaceID != pWindow->workspaceID())
|
||||||
continue;
|
continue;
|
||||||
const CBox box = it->pWindow->getWindowIdealBoundingBoxIgnoreReserved();
|
const CBox box = it->pWindow.lock()->getWindowIdealBoundingBoxIgnoreReserved();
|
||||||
if (box.containsPoint(MOUSECOORDS)) {
|
if (box.containsPoint(MOUSECOORDS)) {
|
||||||
switch (orientation) {
|
switch (orientation) {
|
||||||
case ORIENTATION_LEFT:
|
case ORIENTATION_LEFT:
|
||||||
case ORIENTATION_RIGHT:
|
case ORIENTATION_RIGHT:
|
||||||
if (MOUSECOORDS.y > it->pWindow->middle().y)
|
if (MOUSECOORDS.y > it->pWindow.lock()->middle().y)
|
||||||
++it;
|
++it;
|
||||||
break;
|
break;
|
||||||
case ORIENTATION_TOP:
|
case ORIENTATION_TOP:
|
||||||
case ORIENTATION_BOTTOM:
|
case ORIENTATION_BOTTOM:
|
||||||
if (MOUSECOORDS.x > it->pWindow->middle().x)
|
if (MOUSECOORDS.x > it->pWindow.lock()->middle().x)
|
||||||
++it;
|
++it;
|
||||||
break;
|
break;
|
||||||
case ORIENTATION_CENTER: break;
|
case ORIENTATION_CENTER: break;
|
||||||
|
@ -163,19 +163,19 @@ void CHyprMasterLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection direc
|
||||||
switch (orientation) {
|
switch (orientation) {
|
||||||
case ORIENTATION_LEFT:
|
case ORIENTATION_LEFT:
|
||||||
case ORIENTATION_CENTER:
|
case ORIENTATION_CENTER:
|
||||||
if (MOUSECOORDS.x < nd.pWindow->middle().x)
|
if (MOUSECOORDS.x < nd.pWindow.lock()->middle().x)
|
||||||
forceDropAsMaster = true;
|
forceDropAsMaster = true;
|
||||||
break;
|
break;
|
||||||
case ORIENTATION_RIGHT:
|
case ORIENTATION_RIGHT:
|
||||||
if (MOUSECOORDS.x > nd.pWindow->middle().x)
|
if (MOUSECOORDS.x > nd.pWindow.lock()->middle().x)
|
||||||
forceDropAsMaster = true;
|
forceDropAsMaster = true;
|
||||||
break;
|
break;
|
||||||
case ORIENTATION_TOP:
|
case ORIENTATION_TOP:
|
||||||
if (MOUSECOORDS.y < nd.pWindow->middle().y)
|
if (MOUSECOORDS.y < nd.pWindow.lock()->middle().y)
|
||||||
forceDropAsMaster = true;
|
forceDropAsMaster = true;
|
||||||
break;
|
break;
|
||||||
case ORIENTATION_BOTTOM:
|
case ORIENTATION_BOTTOM:
|
||||||
if (MOUSECOORDS.y > nd.pWindow->middle().y)
|
if (MOUSECOORDS.y > nd.pWindow.lock()->middle().y)
|
||||||
forceDropAsMaster = true;
|
forceDropAsMaster = true;
|
||||||
break;
|
break;
|
||||||
default: UNREACHABLE();
|
default: UNREACHABLE();
|
||||||
|
@ -226,7 +226,7 @@ void CHyprMasterLayout::onWindowCreatedTiling(CWindow* pWindow, eDirection direc
|
||||||
recalculateMonitor(pWindow->m_iMonitorID);
|
recalculateMonitor(pWindow->m_iMonitorID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprMasterLayout::onWindowRemovedTiling(CWindow* pWindow) {
|
void CHyprMasterLayout::onWindowRemovedTiling(PHLWINDOW pWindow) {
|
||||||
const auto PNODE = getNodeFromWindow(pWindow);
|
const auto PNODE = getNodeFromWindow(pWindow);
|
||||||
|
|
||||||
if (!PNODE)
|
if (!PNODE)
|
||||||
|
@ -610,7 +610,7 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
|
||||||
const bool DISPLAYTOP = STICKS(pNode->position.y, PMONITOR->vecPosition.y + PMONITOR->vecReservedTopLeft.y);
|
const bool DISPLAYTOP = STICKS(pNode->position.y, PMONITOR->vecPosition.y + PMONITOR->vecReservedTopLeft.y);
|
||||||
const bool DISPLAYBOTTOM = STICKS(pNode->position.y + pNode->size.y, PMONITOR->vecPosition.y + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y);
|
const bool DISPLAYBOTTOM = STICKS(pNode->position.y + pNode->size.y, PMONITOR->vecPosition.y + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y);
|
||||||
|
|
||||||
const auto PWINDOW = pNode->pWindow;
|
const auto PWINDOW = pNode->pWindow.lock();
|
||||||
// get specific gaps and rules for this workspace,
|
// get specific gaps and rules for this workspace,
|
||||||
// if user specified them in config
|
// if user specified them in config
|
||||||
const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(PWINDOW->m_pWorkspace);
|
const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(PWINDOW->m_pWorkspace);
|
||||||
|
@ -630,7 +630,7 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
|
||||||
auto gapsIn = WORKSPACERULE.gapsIn.value_or(*PGAPSIN);
|
auto gapsIn = WORKSPACERULE.gapsIn.value_or(*PGAPSIN);
|
||||||
auto gapsOut = WORKSPACERULE.gapsOut.value_or(*PGAPSOUT);
|
auto gapsOut = WORKSPACERULE.gapsOut.value_or(*PGAPSOUT);
|
||||||
|
|
||||||
if (!g_pCompositor->windowValidMapped(PWINDOW)) {
|
if (!validMapped(PWINDOW)) {
|
||||||
Debug::log(ERR, "Node {} holding invalid {}!!", pNode, PWINDOW);
|
Debug::log(ERR, "Node {} holding invalid {}!!", pNode, PWINDOW);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -704,14 +704,14 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
|
||||||
PWINDOW->updateWindowDecos();
|
PWINDOW->updateWindowDecos();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CHyprMasterLayout::isWindowTiled(CWindow* pWindow) {
|
bool CHyprMasterLayout::isWindowTiled(PHLWINDOW pWindow) {
|
||||||
return getNodeFromWindow(pWindow) != nullptr;
|
return getNodeFromWindow(pWindow) != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprMasterLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorner corner, CWindow* pWindow) {
|
void CHyprMasterLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorner corner, PHLWINDOW pWindow) {
|
||||||
const auto PWINDOW = pWindow ? pWindow : g_pCompositor->m_pLastWindow;
|
const auto PWINDOW = pWindow ? pWindow : g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!g_pCompositor->windowValidMapped(PWINDOW))
|
if (!validMapped(PWINDOW))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto PNODE = getNodeFromWindow(PWINDOW);
|
const auto PNODE = getNodeFromWindow(PWINDOW);
|
||||||
|
@ -850,8 +850,8 @@ void CHyprMasterLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorne
|
||||||
m_bForceWarps = false;
|
m_bForceWarps = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprMasterLayout::fullscreenRequestForWindow(CWindow* pWindow, eFullscreenMode fullscreenMode, bool on) {
|
void CHyprMasterLayout::fullscreenRequestForWindow(PHLWINDOW pWindow, eFullscreenMode fullscreenMode, bool on) {
|
||||||
if (!g_pCompositor->windowValidMapped(pWindow))
|
if (!validMapped(pWindow))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (on == pWindow->m_bIsFullscreen)
|
if (on == pWindow->m_bIsFullscreen)
|
||||||
|
@ -932,7 +932,7 @@ void CHyprMasterLayout::fullscreenRequestForWindow(CWindow* pWindow, eFullscreen
|
||||||
recalculateMonitor(PMONITOR->ID);
|
recalculateMonitor(PMONITOR->ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprMasterLayout::recalculateWindow(CWindow* pWindow) {
|
void CHyprMasterLayout::recalculateWindow(PHLWINDOW pWindow) {
|
||||||
const auto PNODE = getNodeFromWindow(pWindow);
|
const auto PNODE = getNodeFromWindow(pWindow);
|
||||||
|
|
||||||
if (!PNODE)
|
if (!PNODE)
|
||||||
|
@ -941,7 +941,7 @@ void CHyprMasterLayout::recalculateWindow(CWindow* pWindow) {
|
||||||
recalculateMonitor(pWindow->m_iMonitorID);
|
recalculateMonitor(pWindow->m_iMonitorID);
|
||||||
}
|
}
|
||||||
|
|
||||||
SWindowRenderLayoutHints CHyprMasterLayout::requestRenderHints(CWindow* pWindow) {
|
SWindowRenderLayoutHints CHyprMasterLayout::requestRenderHints(PHLWINDOW pWindow) {
|
||||||
// window should be valid, insallah
|
// window should be valid, insallah
|
||||||
|
|
||||||
SWindowRenderLayoutHints hints;
|
SWindowRenderLayoutHints hints;
|
||||||
|
@ -949,7 +949,7 @@ SWindowRenderLayoutHints CHyprMasterLayout::requestRenderHints(CWindow* pWindow)
|
||||||
return hints; // master doesnt have any hints
|
return hints; // master doesnt have any hints
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprMasterLayout::moveWindowTo(CWindow* pWindow, const std::string& dir, bool silent) {
|
void CHyprMasterLayout::moveWindowTo(PHLWINDOW pWindow, const std::string& dir, bool silent) {
|
||||||
if (!isDirection(dir))
|
if (!isDirection(dir))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -978,7 +978,7 @@ void CHyprMasterLayout::moveWindowTo(CWindow* pWindow, const std::string& dir, b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprMasterLayout::switchWindows(CWindow* pWindow, CWindow* pWindow2) {
|
void CHyprMasterLayout::switchWindows(PHLWINDOW pWindow, PHLWINDOW pWindow2) {
|
||||||
// windows should be valid, insallah
|
// windows should be valid, insallah
|
||||||
|
|
||||||
const auto PNODE = getNodeFromWindow(pWindow);
|
const auto PNODE = getNodeFromWindow(pWindow);
|
||||||
|
@ -1007,7 +1007,7 @@ void CHyprMasterLayout::switchWindows(CWindow* pWindow, CWindow* pWindow2) {
|
||||||
g_pHyprRenderer->damageWindow(pWindow2);
|
g_pHyprRenderer->damageWindow(pWindow2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprMasterLayout::alterSplitRatio(CWindow* pWindow, float ratio, bool exact) {
|
void CHyprMasterLayout::alterSplitRatio(PHLWINDOW pWindow, float ratio, bool exact) {
|
||||||
// window should be valid, insallah
|
// window should be valid, insallah
|
||||||
|
|
||||||
const auto PNODE = getNodeFromWindow(pWindow);
|
const auto PNODE = getNodeFromWindow(pWindow);
|
||||||
|
@ -1023,7 +1023,7 @@ void CHyprMasterLayout::alterSplitRatio(CWindow* pWindow, float ratio, bool exac
|
||||||
recalculateMonitor(pWindow->m_iMonitorID);
|
recalculateMonitor(pWindow->m_iMonitorID);
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CHyprMasterLayout::getNextWindow(CWindow* pWindow, bool next) {
|
PHLWINDOW CHyprMasterLayout::getNextWindow(PHLWINDOW pWindow, bool next) {
|
||||||
if (!isWindowTiled(pWindow))
|
if (!isWindowTiled(pWindow))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
@ -1042,12 +1042,12 @@ CWindow* CHyprMasterLayout::getNextWindow(CWindow* pWindow, bool next) {
|
||||||
CANDIDATE =
|
CANDIDATE =
|
||||||
std::find_if(nodes.begin(), nodes.end(), [&](const auto& other) { return other != *PNODE && ISMASTER != other.isMaster && other.workspaceID == PNODE->workspaceID; });
|
std::find_if(nodes.begin(), nodes.end(), [&](const auto& other) { return other != *PNODE && ISMASTER != other.isMaster && other.workspaceID == PNODE->workspaceID; });
|
||||||
|
|
||||||
return CANDIDATE == nodes.end() ? nullptr : CANDIDATE->pWindow;
|
return CANDIDATE == nodes.end() ? nullptr : CANDIDATE->pWindow.lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::string message) {
|
std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::string message) {
|
||||||
auto switchToWindow = [&](CWindow* PWINDOWTOCHANGETO) {
|
auto switchToWindow = [&](PHLWINDOW PWINDOWTOCHANGETO) {
|
||||||
if (!g_pCompositor->windowValidMapped(PWINDOWTOCHANGETO))
|
if (!validMapped(PWINDOWTOCHANGETO))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (header.pWindow->m_bIsFullscreen) {
|
if (header.pWindow->m_bIsFullscreen) {
|
||||||
|
@ -1065,7 +1065,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
|
||||||
|
|
||||||
g_pInputManager->m_pForcedFocus = PWINDOWTOCHANGETO;
|
g_pInputManager->m_pForcedFocus = PWINDOWTOCHANGETO;
|
||||||
g_pInputManager->simulateMouseMovement();
|
g_pInputManager->simulateMouseMovement();
|
||||||
g_pInputManager->m_pForcedFocus = nullptr;
|
g_pInputManager->m_pForcedFocus.reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
CVarList vars(message, 0, ' ');
|
CVarList vars(message, 0, ' ');
|
||||||
|
@ -1096,9 +1096,9 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
|
||||||
if (!PMASTER)
|
if (!PMASTER)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const auto NEWCHILD = PMASTER->pWindow;
|
const auto NEWCHILD = PMASTER->pWindow.lock();
|
||||||
|
|
||||||
if (PMASTER->pWindow != PWINDOW) {
|
if (PMASTER->pWindow.lock() != PWINDOW) {
|
||||||
const auto NEWMASTER = PWINDOW;
|
const auto NEWMASTER = PWINDOW;
|
||||||
const bool newFocusToChild = vars.size() >= 2 && vars[1] == "child";
|
const bool newFocusToChild = vars.size() >= 2 && vars[1] == "child";
|
||||||
switchWindows(NEWMASTER, NEWCHILD);
|
switchWindows(NEWMASTER, NEWCHILD);
|
||||||
|
@ -1107,7 +1107,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
|
||||||
} else {
|
} else {
|
||||||
for (auto& n : m_lMasterNodesData) {
|
for (auto& n : m_lMasterNodesData) {
|
||||||
if (n.workspaceID == PMASTER->workspaceID && !n.isMaster) {
|
if (n.workspaceID == PMASTER->workspaceID && !n.isMaster) {
|
||||||
const auto NEWMASTER = n.pWindow;
|
const auto NEWMASTER = n.pWindow.lock();
|
||||||
switchWindows(NEWMASTER, NEWCHILD);
|
switchWindows(NEWMASTER, NEWCHILD);
|
||||||
const bool newFocusToMaster = vars.size() >= 2 && vars[1] == "master";
|
const bool newFocusToMaster = vars.size() >= 2 && vars[1] == "master";
|
||||||
const auto NEWFOCUS = newFocusToMaster ? NEWMASTER : NEWCHILD;
|
const auto NEWFOCUS = newFocusToMaster ? NEWMASTER : NEWCHILD;
|
||||||
|
@ -1134,15 +1134,15 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
|
||||||
if (!PMASTER)
|
if (!PMASTER)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (PMASTER->pWindow != PWINDOW) {
|
if (PMASTER->pWindow.lock() != PWINDOW) {
|
||||||
switchToWindow(PMASTER->pWindow);
|
switchToWindow(PMASTER->pWindow.lock());
|
||||||
} else if (vars.size() >= 2 && vars[1] == "master") {
|
} else if (vars.size() >= 2 && vars[1] == "master") {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
// if master is focused keep master focused (don't do anything)
|
// if master is focused keep master focused (don't do anything)
|
||||||
for (auto& n : m_lMasterNodesData) {
|
for (auto& n : m_lMasterNodesData) {
|
||||||
if (n.workspaceID == PMASTER->workspaceID && !n.isMaster) {
|
if (n.workspaceID == PMASTER->workspaceID && !n.isMaster) {
|
||||||
switchToWindow(n.pWindow);
|
switchToWindow(n.pWindow.lock());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1166,7 +1166,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
|
||||||
const auto PPREVWINDOW = getNextWindow(PWINDOW, false);
|
const auto PPREVWINDOW = getNextWindow(PWINDOW, false);
|
||||||
switchToWindow(PPREVWINDOW);
|
switchToWindow(PPREVWINDOW);
|
||||||
} else if (command == "swapnext") {
|
} else if (command == "swapnext") {
|
||||||
if (!g_pCompositor->windowValidMapped(header.pWindow))
|
if (!validMapped(header.pWindow))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (header.pWindow->m_bIsFloating) {
|
if (header.pWindow->m_bIsFloating) {
|
||||||
|
@ -1182,7 +1182,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
|
||||||
switchToWindow(header.pWindow);
|
switchToWindow(header.pWindow);
|
||||||
}
|
}
|
||||||
} else if (command == "swapprev") {
|
} else if (command == "swapprev") {
|
||||||
if (!g_pCompositor->windowValidMapped(header.pWindow))
|
if (!validMapped(header.pWindow))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (header.pWindow->m_bIsFloating) {
|
if (header.pWindow->m_bIsFloating) {
|
||||||
|
@ -1198,7 +1198,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
|
||||||
switchToWindow(header.pWindow);
|
switchToWindow(header.pWindow);
|
||||||
}
|
}
|
||||||
} else if (command == "addmaster") {
|
} else if (command == "addmaster") {
|
||||||
if (!g_pCompositor->windowValidMapped(header.pWindow))
|
if (!validMapped(header.pWindow))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (header.pWindow->m_bIsFloating)
|
if (header.pWindow->m_bIsFloating)
|
||||||
|
@ -1230,7 +1230,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
|
||||||
|
|
||||||
} else if (command == "removemaster") {
|
} else if (command == "removemaster") {
|
||||||
|
|
||||||
if (!g_pCompositor->windowValidMapped(header.pWindow))
|
if (!validMapped(header.pWindow))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (header.pWindow->m_bIsFloating)
|
if (header.pWindow->m_bIsFloating)
|
||||||
|
@ -1308,7 +1308,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
|
||||||
nd.isMaster = true;
|
nd.isMaster = true;
|
||||||
const auto NEWMASTERIT = std::find(m_lMasterNodesData.begin(), m_lMasterNodesData.end(), nd);
|
const auto NEWMASTERIT = std::find(m_lMasterNodesData.begin(), m_lMasterNodesData.end(), nd);
|
||||||
m_lMasterNodesData.splice(OLDMASTERIT, m_lMasterNodesData, NEWMASTERIT);
|
m_lMasterNodesData.splice(OLDMASTERIT, m_lMasterNodesData, NEWMASTERIT);
|
||||||
switchToWindow(nd.pWindow);
|
switchToWindow(nd.pWindow.lock());
|
||||||
OLDMASTER->isMaster = false;
|
OLDMASTER->isMaster = false;
|
||||||
m_lMasterNodesData.splice(m_lMasterNodesData.end(), m_lMasterNodesData, OLDMASTERIT);
|
m_lMasterNodesData.splice(m_lMasterNodesData.end(), m_lMasterNodesData, OLDMASTERIT);
|
||||||
break;
|
break;
|
||||||
|
@ -1334,7 +1334,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
|
||||||
nd.isMaster = true;
|
nd.isMaster = true;
|
||||||
const auto NEWMASTERIT = std::find(m_lMasterNodesData.begin(), m_lMasterNodesData.end(), nd);
|
const auto NEWMASTERIT = std::find(m_lMasterNodesData.begin(), m_lMasterNodesData.end(), nd);
|
||||||
m_lMasterNodesData.splice(OLDMASTERIT, m_lMasterNodesData, NEWMASTERIT);
|
m_lMasterNodesData.splice(OLDMASTERIT, m_lMasterNodesData, NEWMASTERIT);
|
||||||
switchToWindow(nd.pWindow);
|
switchToWindow(nd.pWindow.lock());
|
||||||
OLDMASTER->isMaster = false;
|
OLDMASTER->isMaster = false;
|
||||||
m_lMasterNodesData.splice(m_lMasterNodesData.begin(), m_lMasterNodesData, OLDMASTERIT);
|
m_lMasterNodesData.splice(m_lMasterNodesData.begin(), m_lMasterNodesData, OLDMASTERIT);
|
||||||
break;
|
break;
|
||||||
|
@ -1428,7 +1428,7 @@ eOrientation CHyprMasterLayout::getDynamicOrientation(PHLWORKSPACE pWorkspace) {
|
||||||
return orientation;
|
return orientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprMasterLayout::replaceWindowDataWith(CWindow* from, CWindow* to) {
|
void CHyprMasterLayout::replaceWindowDataWith(PHLWINDOW from, PHLWINDOW to) {
|
||||||
const auto PNODE = getNodeFromWindow(from);
|
const auto PNODE = getNodeFromWindow(from);
|
||||||
|
|
||||||
if (!PNODE)
|
if (!PNODE)
|
||||||
|
@ -1471,7 +1471,7 @@ void CHyprMasterLayout::onEnable() {
|
||||||
if (w->m_bIsFloating || !w->m_bIsMapped || w->isHidden())
|
if (w->m_bIsFloating || !w->m_bIsMapped || w->isHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
onWindowCreatedTiling(w.get());
|
onWindowCreatedTiling(w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,23 +20,23 @@ enum eOrientation : uint8_t {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SMasterNodeData {
|
struct SMasterNodeData {
|
||||||
bool isMaster = false;
|
bool isMaster = false;
|
||||||
float percMaster = 0.5f;
|
float percMaster = 0.5f;
|
||||||
|
|
||||||
CWindow* pWindow = nullptr;
|
PHLWINDOWREF pWindow;
|
||||||
|
|
||||||
Vector2D position;
|
Vector2D position;
|
||||||
Vector2D size;
|
Vector2D size;
|
||||||
|
|
||||||
float percSize = 1.f; // size multiplier for resizing children
|
float percSize = 1.f; // size multiplier for resizing children
|
||||||
|
|
||||||
int workspaceID = -1;
|
int workspaceID = -1;
|
||||||
|
|
||||||
bool ignoreFullscreenChecks = false;
|
bool ignoreFullscreenChecks = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool operator==(const SMasterNodeData& rhs) const {
|
bool operator==(const SMasterNodeData& rhs) const {
|
||||||
return pWindow == rhs.pWindow;
|
return pWindow.lock() == rhs.pWindow.lock();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -52,20 +52,20 @@ struct SMasterWorkspaceData {
|
||||||
|
|
||||||
class CHyprMasterLayout : public IHyprLayout {
|
class CHyprMasterLayout : public IHyprLayout {
|
||||||
public:
|
public:
|
||||||
virtual void onWindowCreatedTiling(CWindow*, eDirection direction = DIRECTION_DEFAULT);
|
virtual void onWindowCreatedTiling(PHLWINDOW, eDirection direction = DIRECTION_DEFAULT);
|
||||||
virtual void onWindowRemovedTiling(CWindow*);
|
virtual void onWindowRemovedTiling(PHLWINDOW);
|
||||||
virtual bool isWindowTiled(CWindow*);
|
virtual bool isWindowTiled(PHLWINDOW);
|
||||||
virtual void recalculateMonitor(const int&);
|
virtual void recalculateMonitor(const int&);
|
||||||
virtual void recalculateWindow(CWindow*);
|
virtual void recalculateWindow(PHLWINDOW);
|
||||||
virtual void resizeActiveWindow(const Vector2D&, eRectCorner corner = CORNER_NONE, CWindow* pWindow = nullptr);
|
virtual void resizeActiveWindow(const Vector2D&, eRectCorner corner = CORNER_NONE, PHLWINDOW pWindow = nullptr);
|
||||||
virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode, bool);
|
virtual void fullscreenRequestForWindow(PHLWINDOW, eFullscreenMode, bool);
|
||||||
virtual std::any layoutMessage(SLayoutMessageHeader, std::string);
|
virtual std::any layoutMessage(SLayoutMessageHeader, std::string);
|
||||||
virtual SWindowRenderLayoutHints requestRenderHints(CWindow*);
|
virtual SWindowRenderLayoutHints requestRenderHints(PHLWINDOW);
|
||||||
virtual void switchWindows(CWindow*, CWindow*);
|
virtual void switchWindows(PHLWINDOW, PHLWINDOW);
|
||||||
virtual void moveWindowTo(CWindow*, const std::string& dir, bool silent);
|
virtual void moveWindowTo(PHLWINDOW, const std::string& dir, bool silent);
|
||||||
virtual void alterSplitRatio(CWindow*, float, bool);
|
virtual void alterSplitRatio(PHLWINDOW, float, bool);
|
||||||
virtual std::string getLayoutName();
|
virtual std::string getLayoutName();
|
||||||
virtual void replaceWindowDataWith(CWindow* from, CWindow* to);
|
virtual void replaceWindowDataWith(PHLWINDOW from, PHLWINDOW to);
|
||||||
virtual Vector2D predictSizeForNewWindowTiled();
|
virtual Vector2D predictSizeForNewWindowTiled();
|
||||||
|
|
||||||
virtual void onEnable();
|
virtual void onEnable();
|
||||||
|
@ -83,11 +83,11 @@ class CHyprMasterLayout : public IHyprLayout {
|
||||||
eOrientation getDynamicOrientation(PHLWORKSPACE);
|
eOrientation getDynamicOrientation(PHLWORKSPACE);
|
||||||
int getNodesOnWorkspace(const int&);
|
int getNodesOnWorkspace(const int&);
|
||||||
void applyNodeDataToWindow(SMasterNodeData*);
|
void applyNodeDataToWindow(SMasterNodeData*);
|
||||||
SMasterNodeData* getNodeFromWindow(CWindow*);
|
SMasterNodeData* getNodeFromWindow(PHLWINDOW);
|
||||||
SMasterNodeData* getMasterNodeOnWorkspace(const int&);
|
SMasterNodeData* getMasterNodeOnWorkspace(const int&);
|
||||||
SMasterWorkspaceData* getMasterWorkspaceData(const int&);
|
SMasterWorkspaceData* getMasterWorkspaceData(const int&);
|
||||||
void calculateWorkspace(PHLWORKSPACE);
|
void calculateWorkspace(PHLWORKSPACE);
|
||||||
CWindow* getNextWindow(CWindow*, bool);
|
PHLWINDOW getNextWindow(PHLWINDOW, bool);
|
||||||
int getMastersOnWorkspace(const int&);
|
int getMastersOnWorkspace(const int&);
|
||||||
|
|
||||||
friend struct SMasterNodeData;
|
friend struct SMasterNodeData;
|
||||||
|
@ -104,8 +104,8 @@ struct std::formatter<SMasterNodeData*, CharT> : std::formatter<CharT> {
|
||||||
std::format_to(out, "[Node {:x}: workspace: {}, pos: {:j2}, size: {:j2}", (uintptr_t)node, node->workspaceID, node->position, node->size);
|
std::format_to(out, "[Node {:x}: workspace: {}, pos: {:j2}, size: {:j2}", (uintptr_t)node, node->workspaceID, node->position, node->size);
|
||||||
if (node->isMaster)
|
if (node->isMaster)
|
||||||
std::format_to(out, ", master");
|
std::format_to(out, ", master");
|
||||||
if (node->pWindow)
|
if (!node->pWindow.expired())
|
||||||
std::format_to(out, ", window: {:x}", node->pWindow);
|
std::format_to(out, ", window: {:x}", node->pWindow.lock());
|
||||||
return std::format_to(out, "]");
|
return std::format_to(out, "]");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
#include <csignal>
|
#include <csignal>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#define SP std::shared_ptr
|
||||||
|
#define UP std::unique_ptr
|
||||||
|
#define WP std::weak_ptr
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
#ifdef HYPRLAND_DEBUG
|
#ifdef HYPRLAND_DEBUG
|
||||||
#define ISDEBUG true
|
#define ISDEBUG true
|
||||||
|
|
|
@ -80,7 +80,7 @@ void CAnimationManager::tick() {
|
||||||
const float SPENT = av->getPercent();
|
const float SPENT = av->getPercent();
|
||||||
|
|
||||||
// window stuff
|
// window stuff
|
||||||
const auto PWINDOW = (CWindow*)av->m_pWindow;
|
PHLWINDOW PWINDOW = av->m_pWindow.lock();
|
||||||
PHLWORKSPACE PWORKSPACE = av->m_pWorkspace.lock();
|
PHLWORKSPACE PWORKSPACE = av->m_pWorkspace.lock();
|
||||||
const auto PLAYER = (SLayerSurface*)av->m_pLayer;
|
const auto PLAYER = (SLayerSurface*)av->m_pLayer;
|
||||||
CMonitor* PMONITOR = nullptr;
|
CMonitor* PMONITOR = nullptr;
|
||||||
|
@ -121,19 +121,19 @@ void CAnimationManager::tick() {
|
||||||
const CBox windowBoxNoOffset = w->getFullWindowBoundingBox();
|
const CBox windowBoxNoOffset = w->getFullWindowBoundingBox();
|
||||||
const CBox monitorBox = {PMONITOR->vecPosition, PMONITOR->vecSize};
|
const CBox monitorBox = {PMONITOR->vecPosition, PMONITOR->vecSize};
|
||||||
if (windowBoxNoOffset.intersection(monitorBox) != windowBoxNoOffset) // on edges between multiple monitors
|
if (windowBoxNoOffset.intersection(monitorBox) != windowBoxNoOffset) // on edges between multiple monitors
|
||||||
g_pHyprRenderer->damageWindow(w.get(), true);
|
g_pHyprRenderer->damageWindow(w, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PWORKSPACE->m_bIsSpecialWorkspace)
|
if (PWORKSPACE->m_bIsSpecialWorkspace)
|
||||||
g_pHyprRenderer->damageWindow(w.get(), true); // hack for special too because it can cross multiple monitors
|
g_pHyprRenderer->damageWindow(w, true); // hack for special too because it can cross multiple monitors
|
||||||
}
|
}
|
||||||
|
|
||||||
// damage any workspace window that is on any monitor
|
// damage any workspace window that is on any monitor
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!g_pCompositor->windowValidMapped(w.get()) || w->m_pWorkspace != PWORKSPACE || w->m_bPinned)
|
if (!validMapped(w) || w->m_pWorkspace != PWORKSPACE || w->m_bPinned)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
g_pHyprRenderer->damageWindow(w.get());
|
g_pHyprRenderer->damageWindow(w);
|
||||||
}
|
}
|
||||||
} else if (PLAYER) {
|
} else if (PLAYER) {
|
||||||
// "some fucking layers miss 1 pixel???" -- vaxry
|
// "some fucking layers miss 1 pixel???" -- vaxry
|
||||||
|
@ -192,7 +192,7 @@ void CAnimationManager::tick() {
|
||||||
default: UNREACHABLE();
|
default: UNREACHABLE();
|
||||||
}
|
}
|
||||||
// set size and pos if valid, but only if damage policy entire (dont if border for example)
|
// set size and pos if valid, but only if damage policy entire (dont if border for example)
|
||||||
if (g_pCompositor->windowValidMapped(PWINDOW) && av->m_eDamagePolicy == AVARDAMAGE_ENTIRE && PWINDOW->m_iX11Type != 2)
|
if (validMapped(PWINDOW) && av->m_eDamagePolicy == AVARDAMAGE_ENTIRE && PWINDOW->m_iX11Type != 2)
|
||||||
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goal());
|
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goal());
|
||||||
|
|
||||||
// check if we did not finish animating. If so, trigger onAnimationEnd.
|
// check if we did not finish animating. If so, trigger onAnimationEnd.
|
||||||
|
@ -213,14 +213,14 @@ void CAnimationManager::tick() {
|
||||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||||
} else if (PWORKSPACE) {
|
} else if (PWORKSPACE) {
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!g_pCompositor->windowValidMapped(w.get()) || w->m_pWorkspace != PWORKSPACE)
|
if (!validMapped(w) || w->m_pWorkspace != PWORKSPACE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
w->updateWindowDecos();
|
w->updateWindowDecos();
|
||||||
|
|
||||||
// damage any workspace window that is on any monitor
|
// damage any workspace window that is on any monitor
|
||||||
if (!w->m_bPinned)
|
if (!w->m_bPinned)
|
||||||
g_pHyprRenderer->damageWindow(w.get());
|
g_pHyprRenderer->damageWindow(w);
|
||||||
}
|
}
|
||||||
} else if (PLAYER) {
|
} else if (PLAYER) {
|
||||||
if (PLAYER->layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || PLAYER->layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM)
|
if (PLAYER->layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || PLAYER->layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM)
|
||||||
|
@ -304,7 +304,7 @@ bool CAnimationManager::bezierExists(const std::string& bezier) {
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
void CAnimationManager::animationPopin(CWindow* pWindow, bool close, float minPerc) {
|
void CAnimationManager::animationPopin(PHLWINDOW pWindow, bool close, float minPerc) {
|
||||||
const auto GOALPOS = pWindow->m_vRealPosition.goal();
|
const auto GOALPOS = pWindow->m_vRealPosition.goal();
|
||||||
const auto GOALSIZE = pWindow->m_vRealSize.goal();
|
const auto GOALSIZE = pWindow->m_vRealSize.goal();
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ void CAnimationManager::animationPopin(CWindow* pWindow, bool close, float minPe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAnimationManager::animationSlide(CWindow* pWindow, std::string force, bool close) {
|
void CAnimationManager::animationSlide(PHLWINDOW pWindow, std::string force, bool close) {
|
||||||
pWindow->m_vRealSize.warp(false); // size we preserve in slide
|
pWindow->m_vRealSize.warp(false); // size we preserve in slide
|
||||||
|
|
||||||
const auto GOALPOS = pWindow->m_vRealPosition.goal();
|
const auto GOALPOS = pWindow->m_vRealPosition.goal();
|
||||||
|
@ -381,7 +381,7 @@ void CAnimationManager::animationSlide(CWindow* pWindow, std::string force, bool
|
||||||
pWindow->m_vRealPosition = posOffset;
|
pWindow->m_vRealPosition = posOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAnimationManager::onWindowPostCreateClose(CWindow* pWindow, bool close) {
|
void CAnimationManager::onWindowPostCreateClose(PHLWINDOW pWindow, bool close) {
|
||||||
if (!close) {
|
if (!close) {
|
||||||
pWindow->m_vRealPosition.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("windowsIn");
|
pWindow->m_vRealPosition.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("windowsIn");
|
||||||
pWindow->m_vRealSize.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("windowsIn");
|
pWindow->m_vRealSize.m_pConfig = g_pConfigManager->getAnimationPropertyConfig("windowsIn");
|
||||||
|
|
|
@ -21,7 +21,7 @@ class CAnimationManager {
|
||||||
void addBezierWithName(std::string, const Vector2D&, const Vector2D&);
|
void addBezierWithName(std::string, const Vector2D&, const Vector2D&);
|
||||||
void removeAllBeziers();
|
void removeAllBeziers();
|
||||||
|
|
||||||
void onWindowPostCreateClose(CWindow*, bool close = false);
|
void onWindowPostCreateClose(PHLWINDOW, bool close = false);
|
||||||
|
|
||||||
bool bezierExists(const std::string&);
|
bool bezierExists(const std::string&);
|
||||||
CBezierCurve* getBezier(const std::string&);
|
CBezierCurve* getBezier(const std::string&);
|
||||||
|
@ -50,8 +50,8 @@ class CAnimationManager {
|
||||||
bool m_bTickScheduled = false;
|
bool m_bTickScheduled = false;
|
||||||
|
|
||||||
// Anim stuff
|
// Anim stuff
|
||||||
void animationPopin(CWindow*, bool close = false, float minPerc = 0.f);
|
void animationPopin(PHLWINDOW, bool close = false, float minPerc = 0.f);
|
||||||
void animationSlide(CWindow*, std::string force = "", bool close = false);
|
void animationSlide(PHLWINDOW, std::string force = "", bool close = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::unique_ptr<CAnimationManager> g_pAnimationManager;
|
inline std::unique_ptr<CAnimationManager> g_pAnimationManager;
|
||||||
|
|
|
@ -35,7 +35,7 @@ static std::vector<std::pair<std::string, std::string>> getHyprlandLaunchEnv() {
|
||||||
result.push_back(std::make_pair<>(
|
result.push_back(std::make_pair<>(
|
||||||
"HL_INITIAL_WORKSPACE_TOKEN",
|
"HL_INITIAL_WORKSPACE_TOKEN",
|
||||||
g_pTokenManager->registerNewToken(
|
g_pTokenManager->registerNewToken(
|
||||||
SInitialWorkspaceToken{nullptr, PMONITOR->activeSpecialWorkspace ? PMONITOR->activeSpecialWorkspace->getConfigName() : PMONITOR->activeWorkspace->getConfigName()},
|
SInitialWorkspaceToken{{}, PMONITOR->activeSpecialWorkspace ? PMONITOR->activeSpecialWorkspace->getConfigName() : PMONITOR->activeWorkspace->getConfigName()},
|
||||||
std::chrono::months(1337))));
|
std::chrono::months(1337))));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -225,13 +225,13 @@ bool CKeybindManager::ensureMouseBindState() {
|
||||||
if (!m_bIsMouseBindActive)
|
if (!m_bIsMouseBindActive)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (g_pInputManager->currentlyDraggedWindow) {
|
if (!g_pInputManager->currentlyDraggedWindow.expired()) {
|
||||||
CWindow* lastDraggedWindow = g_pInputManager->currentlyDraggedWindow;
|
PHLWINDOW lastDraggedWindow = g_pInputManager->currentlyDraggedWindow.lock();
|
||||||
|
|
||||||
m_bIsMouseBindActive = false;
|
m_bIsMouseBindActive = false;
|
||||||
g_pLayoutManager->getCurrentLayout()->onEndDragWindow();
|
g_pLayoutManager->getCurrentLayout()->onEndDragWindow();
|
||||||
g_pInputManager->currentlyDraggedWindow = nullptr;
|
g_pInputManager->currentlyDraggedWindow.reset();
|
||||||
g_pInputManager->dragMode = MBIND_INVALID;
|
g_pInputManager->dragMode = MBIND_INVALID;
|
||||||
|
|
||||||
g_pCompositor->updateWorkspaceWindows(lastDraggedWindow->workspaceID());
|
g_pCompositor->updateWorkspaceWindows(lastDraggedWindow->workspaceID());
|
||||||
g_pCompositor->updateWorkspaceSpecialRenderData(lastDraggedWindow->workspaceID());
|
g_pCompositor->updateWorkspaceSpecialRenderData(lastDraggedWindow->workspaceID());
|
||||||
|
@ -271,7 +271,7 @@ bool CKeybindManager::tryMoveFocusToMonitor(CMonitor* monitor) {
|
||||||
|
|
||||||
g_pInputManager->m_pForcedFocus = PNEWWINDOW;
|
g_pInputManager->m_pForcedFocus = PNEWWINDOW;
|
||||||
g_pInputManager->simulateMouseMovement();
|
g_pInputManager->simulateMouseMovement();
|
||||||
g_pInputManager->m_pForcedFocus = nullptr;
|
g_pInputManager->m_pForcedFocus.reset();
|
||||||
} else {
|
} else {
|
||||||
g_pCompositor->focusWindow(nullptr);
|
g_pCompositor->focusWindow(nullptr);
|
||||||
g_pCompositor->warpCursorTo(monitor->middle());
|
g_pCompositor->warpCursorTo(monitor->middle());
|
||||||
|
@ -281,8 +281,8 @@ bool CKeybindManager::tryMoveFocusToMonitor(CMonitor* monitor) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::switchToWindow(CWindow* PWINDOWTOCHANGETO) {
|
void CKeybindManager::switchToWindow(PHLWINDOW PWINDOWTOCHANGETO) {
|
||||||
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow;
|
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (PWINDOWTOCHANGETO == PLASTWINDOW || !PWINDOWTOCHANGETO)
|
if (PWINDOWTOCHANGETO == PLASTWINDOW || !PWINDOWTOCHANGETO)
|
||||||
return;
|
return;
|
||||||
|
@ -307,7 +307,7 @@ void CKeybindManager::switchToWindow(CWindow* PWINDOWTOCHANGETO) {
|
||||||
|
|
||||||
g_pInputManager->m_pForcedFocus = PWINDOWTOCHANGETO;
|
g_pInputManager->m_pForcedFocus = PWINDOWTOCHANGETO;
|
||||||
g_pInputManager->simulateMouseMovement();
|
g_pInputManager->simulateMouseMovement();
|
||||||
g_pInputManager->m_pForcedFocus = nullptr;
|
g_pInputManager->m_pForcedFocus.reset();
|
||||||
|
|
||||||
if (PLASTWINDOW && PLASTWINDOW->m_iMonitorID != PWINDOWTOCHANGETO->m_iMonitorID) {
|
if (PLASTWINDOW && PLASTWINDOW->m_iMonitorID != PWINDOWTOCHANGETO->m_iMonitorID) {
|
||||||
// event
|
// event
|
||||||
|
@ -851,7 +851,7 @@ uint64_t CKeybindManager::spawnRaw(std::string args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::killActive(std::string args) {
|
void CKeybindManager::killActive(std::string args) {
|
||||||
g_pCompositor->closeWindow(g_pCompositor->m_pLastWindow);
|
g_pCompositor->closeWindow(g_pCompositor->m_pLastWindow.lock());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::kill(std::string args) {
|
void CKeybindManager::kill(std::string args) {
|
||||||
|
@ -870,12 +870,12 @@ void CKeybindManager::clearKeybinds() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void toggleActiveFloatingCore(std::string args, std::optional<bool> floatState) {
|
static void toggleActiveFloatingCore(std::string args, std::optional<bool> floatState) {
|
||||||
CWindow* PWINDOW = nullptr;
|
PHLWINDOW PWINDOW = nullptr;
|
||||||
|
|
||||||
if (args != "active" && args.length() > 1)
|
if (args != "active" && args.length() > 1)
|
||||||
PWINDOW = g_pCompositor->getWindowByRegex(args);
|
PWINDOW = g_pCompositor->getWindowByRegex(args);
|
||||||
else
|
else
|
||||||
PWINDOW = g_pCompositor->m_pLastWindow;
|
PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!PWINDOW)
|
if (!PWINDOW)
|
||||||
return;
|
return;
|
||||||
|
@ -884,18 +884,18 @@ static void toggleActiveFloatingCore(std::string args, std::optional<bool> float
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// remove drag status
|
// remove drag status
|
||||||
g_pInputManager->currentlyDraggedWindow = nullptr;
|
g_pInputManager->currentlyDraggedWindow.reset();
|
||||||
|
|
||||||
if (PWINDOW->m_sGroupData.pNextWindow && PWINDOW->m_sGroupData.pNextWindow != PWINDOW) {
|
if (PWINDOW->m_sGroupData.pNextWindow.lock() && PWINDOW->m_sGroupData.pNextWindow.lock() != PWINDOW) {
|
||||||
const auto PCURRENT = PWINDOW->getGroupCurrent();
|
const auto PCURRENT = PWINDOW->getGroupCurrent();
|
||||||
|
|
||||||
PCURRENT->m_bIsFloating = !PCURRENT->m_bIsFloating;
|
PCURRENT->m_bIsFloating = !PCURRENT->m_bIsFloating;
|
||||||
g_pLayoutManager->getCurrentLayout()->changeWindowFloatingMode(PCURRENT);
|
g_pLayoutManager->getCurrentLayout()->changeWindowFloatingMode(PCURRENT);
|
||||||
|
|
||||||
CWindow* curr = PCURRENT->m_sGroupData.pNextWindow;
|
PHLWINDOW curr = PCURRENT->m_sGroupData.pNextWindow.lock();
|
||||||
while (curr != PCURRENT) {
|
while (curr != PCURRENT) {
|
||||||
curr->m_bIsFloating = PCURRENT->m_bIsFloating;
|
curr->m_bIsFloating = PCURRENT->m_bIsFloating;
|
||||||
curr = curr->m_sGroupData.pNextWindow;
|
curr = curr->m_sGroupData.pNextWindow.lock();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PWINDOW->m_bIsFloating = !PWINDOW->m_bIsFloating;
|
PWINDOW->m_bIsFloating = !PWINDOW->m_bIsFloating;
|
||||||
|
@ -921,7 +921,7 @@ void CKeybindManager::setActiveTiled(std::string args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::centerWindow(std::string args) {
|
void CKeybindManager::centerWindow(std::string args) {
|
||||||
const auto PWINDOW = g_pCompositor->m_pLastWindow;
|
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!PWINDOW || !PWINDOW->m_bIsFloating || PWINDOW->m_bIsFullscreen)
|
if (!PWINDOW || !PWINDOW->m_bIsFloating || PWINDOW->m_bIsFullscreen)
|
||||||
return;
|
return;
|
||||||
|
@ -937,7 +937,7 @@ void CKeybindManager::centerWindow(std::string args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::toggleActivePseudo(std::string args) {
|
void CKeybindManager::toggleActivePseudo(std::string args) {
|
||||||
const auto ACTIVEWINDOW = g_pCompositor->m_pLastWindow;
|
const auto ACTIVEWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!ACTIVEWINDOW)
|
if (!ACTIVEWINDOW)
|
||||||
return;
|
return;
|
||||||
|
@ -1046,7 +1046,7 @@ void CKeybindManager::changeworkspace(std::string args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::fullscreenActive(std::string args) {
|
void CKeybindManager::fullscreenActive(std::string args) {
|
||||||
const auto PWINDOW = g_pCompositor->m_pLastWindow;
|
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!PWINDOW)
|
if (!PWINDOW)
|
||||||
return;
|
return;
|
||||||
|
@ -1059,13 +1059,13 @@ void CKeybindManager::fullscreenActive(std::string args) {
|
||||||
|
|
||||||
void CKeybindManager::moveActiveToWorkspace(std::string args) {
|
void CKeybindManager::moveActiveToWorkspace(std::string args) {
|
||||||
|
|
||||||
CWindow* PWINDOW = nullptr;
|
PHLWINDOW PWINDOW = nullptr;
|
||||||
|
|
||||||
if (args.contains(',')) {
|
if (args.contains(',')) {
|
||||||
PWINDOW = g_pCompositor->getWindowByRegex(args.substr(args.find_last_of(',') + 1));
|
PWINDOW = g_pCompositor->getWindowByRegex(args.substr(args.find_last_of(',') + 1));
|
||||||
args = args.substr(0, args.find_last_of(','));
|
args = args.substr(0, args.find_last_of(','));
|
||||||
} else {
|
} else {
|
||||||
PWINDOW = g_pCompositor->m_pLastWindow;
|
PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PWINDOW)
|
if (!PWINDOW)
|
||||||
|
@ -1119,7 +1119,7 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
|
void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
|
||||||
CWindow* PWINDOW = nullptr;
|
PHLWINDOW PWINDOW = nullptr;
|
||||||
|
|
||||||
const auto ORIGINALARGS = args;
|
const auto ORIGINALARGS = args;
|
||||||
|
|
||||||
|
@ -1127,7 +1127,7 @@ void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
|
||||||
PWINDOW = g_pCompositor->getWindowByRegex(args.substr(args.find_last_of(',') + 1));
|
PWINDOW = g_pCompositor->getWindowByRegex(args.substr(args.find_last_of(',') + 1));
|
||||||
args = args.substr(0, args.find_last_of(','));
|
args = args.substr(0, args.find_last_of(','));
|
||||||
} else {
|
} else {
|
||||||
PWINDOW = g_pCompositor->m_pLastWindow;
|
PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PWINDOW)
|
if (!PWINDOW)
|
||||||
|
@ -1157,7 +1157,7 @@ void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
|
||||||
g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, pWorkspace);
|
g_pCompositor->moveWindowToWorkspaceSafe(PWINDOW, pWorkspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PWINDOW == g_pCompositor->m_pLastWindow) {
|
if (PWINDOW == g_pCompositor->m_pLastWindow.lock()) {
|
||||||
if (const auto PATCOORDS = g_pCompositor->vectorToWindowUnified(OLDMIDDLE, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING, PWINDOW); PATCOORDS)
|
if (const auto PATCOORDS = g_pCompositor->vectorToWindowUnified(OLDMIDDLE, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING, PWINDOW); PATCOORDS)
|
||||||
g_pCompositor->focusWindow(PATCOORDS);
|
g_pCompositor->focusWindow(PATCOORDS);
|
||||||
else
|
else
|
||||||
|
@ -1174,7 +1174,7 @@ void CKeybindManager::moveFocusTo(std::string args) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow;
|
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
if (!PLASTWINDOW) {
|
if (!PLASTWINDOW) {
|
||||||
tryMoveFocusToMonitor(g_pCompositor->getMonitorInDirection(arg));
|
tryMoveFocusToMonitor(g_pCompositor->getMonitorInDirection(arg));
|
||||||
return;
|
return;
|
||||||
|
@ -1208,8 +1208,8 @@ void CKeybindManager::moveFocusTo(std::string args) {
|
||||||
|
|
||||||
void CKeybindManager::focusUrgentOrLast(std::string args) {
|
void CKeybindManager::focusUrgentOrLast(std::string args) {
|
||||||
const auto PWINDOWURGENT = g_pCompositor->getUrgentWindow();
|
const auto PWINDOWURGENT = g_pCompositor->getUrgentWindow();
|
||||||
const auto PWINDOWPREV = g_pCompositor->m_pLastWindow ? (g_pCompositor->m_vWindowFocusHistory.size() < 2 ? nullptr : g_pCompositor->m_vWindowFocusHistory[1]) :
|
const auto PWINDOWPREV = g_pCompositor->m_pLastWindow.lock() ? (g_pCompositor->m_vWindowFocusHistory.size() < 2 ? nullptr : g_pCompositor->m_vWindowFocusHistory[1].lock()) :
|
||||||
(g_pCompositor->m_vWindowFocusHistory.empty() ? nullptr : g_pCompositor->m_vWindowFocusHistory[0]);
|
(g_pCompositor->m_vWindowFocusHistory.empty() ? nullptr : g_pCompositor->m_vWindowFocusHistory[0].lock());
|
||||||
|
|
||||||
if (!PWINDOWURGENT && !PWINDOWPREV)
|
if (!PWINDOWURGENT && !PWINDOWPREV)
|
||||||
return;
|
return;
|
||||||
|
@ -1218,8 +1218,8 @@ void CKeybindManager::focusUrgentOrLast(std::string args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::focusCurrentOrLast(std::string args) {
|
void CKeybindManager::focusCurrentOrLast(std::string args) {
|
||||||
const auto PWINDOWPREV = g_pCompositor->m_pLastWindow ? (g_pCompositor->m_vWindowFocusHistory.size() < 2 ? nullptr : g_pCompositor->m_vWindowFocusHistory[1]) :
|
const auto PWINDOWPREV = g_pCompositor->m_pLastWindow.lock() ? (g_pCompositor->m_vWindowFocusHistory.size() < 2 ? nullptr : g_pCompositor->m_vWindowFocusHistory[1].lock()) :
|
||||||
(g_pCompositor->m_vWindowFocusHistory.empty() ? nullptr : g_pCompositor->m_vWindowFocusHistory[0]);
|
(g_pCompositor->m_vWindowFocusHistory.empty() ? nullptr : g_pCompositor->m_vWindowFocusHistory[0].lock());
|
||||||
|
|
||||||
if (!PWINDOWPREV)
|
if (!PWINDOWPREV)
|
||||||
return;
|
return;
|
||||||
|
@ -1236,7 +1236,7 @@ void CKeybindManager::swapActive(std::string args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug::log(LOG, "Swapping active window in direction {}", arg);
|
Debug::log(LOG, "Swapping active window in direction {}", arg);
|
||||||
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow;
|
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
if (!PLASTWINDOW || PLASTWINDOW->m_bIsFullscreen)
|
if (!PLASTWINDOW || PLASTWINDOW->m_bIsFullscreen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1270,7 +1270,7 @@ void CKeybindManager::moveActiveTo(std::string args) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow;
|
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!PLASTWINDOW || PLASTWINDOW->m_bIsFullscreen)
|
if (!PLASTWINDOW || PLASTWINDOW->m_bIsFullscreen)
|
||||||
return;
|
return;
|
||||||
|
@ -1315,29 +1315,29 @@ void CKeybindManager::moveActiveTo(std::string args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::toggleGroup(std::string args) {
|
void CKeybindManager::toggleGroup(std::string args) {
|
||||||
const auto PWINDOW = g_pCompositor->m_pLastWindow;
|
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!PWINDOW)
|
if (!PWINDOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_pCompositor->setWindowFullscreen(PWINDOW, false, FULLSCREEN_FULL);
|
g_pCompositor->setWindowFullscreen(PWINDOW, false, FULLSCREEN_FULL);
|
||||||
|
|
||||||
if (!PWINDOW->m_sGroupData.pNextWindow)
|
if (PWINDOW->m_sGroupData.pNextWindow.expired())
|
||||||
PWINDOW->createGroup();
|
PWINDOW->createGroup();
|
||||||
else
|
else
|
||||||
PWINDOW->destroyGroup();
|
PWINDOW->destroyGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::changeGroupActive(std::string args) {
|
void CKeybindManager::changeGroupActive(std::string args) {
|
||||||
const auto PWINDOW = g_pCompositor->m_pLastWindow;
|
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!PWINDOW)
|
if (!PWINDOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!PWINDOW->m_sGroupData.pNextWindow)
|
if (PWINDOW->m_sGroupData.pNextWindow.expired())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (PWINDOW->m_sGroupData.pNextWindow == PWINDOW)
|
if (PWINDOW->m_sGroupData.pNextWindow.lock() == PWINDOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (isNumber(args, false)) {
|
if (isNumber(args, false)) {
|
||||||
|
@ -1353,7 +1353,7 @@ void CKeybindManager::changeGroupActive(std::string args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args != "b" && args != "prev") {
|
if (args != "b" && args != "prev") {
|
||||||
PWINDOW->setGroupCurrent(PWINDOW->m_sGroupData.pNextWindow);
|
PWINDOW->setGroupCurrent(PWINDOW->m_sGroupData.pNextWindow.lock());
|
||||||
} else {
|
} else {
|
||||||
PWINDOW->setGroupCurrent(PWINDOW->getGroupPrevious());
|
PWINDOW->setGroupCurrent(PWINDOW->getGroupPrevious());
|
||||||
}
|
}
|
||||||
|
@ -1361,7 +1361,7 @@ void CKeybindManager::changeGroupActive(std::string args) {
|
||||||
|
|
||||||
void CKeybindManager::toggleSplit(std::string args) {
|
void CKeybindManager::toggleSplit(std::string args) {
|
||||||
SLayoutMessageHeader header;
|
SLayoutMessageHeader header;
|
||||||
header.pWindow = g_pCompositor->m_pLastWindow;
|
header.pWindow = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!header.pWindow)
|
if (!header.pWindow)
|
||||||
return;
|
return;
|
||||||
|
@ -1376,7 +1376,7 @@ void CKeybindManager::toggleSplit(std::string args) {
|
||||||
|
|
||||||
void CKeybindManager::swapSplit(std::string args) {
|
void CKeybindManager::swapSplit(std::string args) {
|
||||||
SLayoutMessageHeader header;
|
SLayoutMessageHeader header;
|
||||||
header.pWindow = g_pCompositor->m_pLastWindow;
|
header.pWindow = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!header.pWindow)
|
if (!header.pWindow)
|
||||||
return;
|
return;
|
||||||
|
@ -1404,7 +1404,7 @@ void CKeybindManager::alterSplitRatio(std::string args) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow;
|
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!PLASTWINDOW)
|
if (!PLASTWINDOW)
|
||||||
return;
|
return;
|
||||||
|
@ -1430,7 +1430,7 @@ void CKeybindManager::moveCursorToCorner(std::string arg) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto PWINDOW = g_pCompositor->m_pLastWindow;
|
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!PWINDOW)
|
if (!PWINDOW)
|
||||||
return;
|
return;
|
||||||
|
@ -1509,9 +1509,9 @@ void CKeybindManager::workspaceOpt(std::string args) {
|
||||||
// apply
|
// apply
|
||||||
|
|
||||||
// we make a copy because changeWindowFloatingMode might invalidate the iterator
|
// we make a copy because changeWindowFloatingMode might invalidate the iterator
|
||||||
std::deque<CWindow*> ptrs;
|
std::deque<PHLWINDOW> ptrs;
|
||||||
for (auto& w : g_pCompositor->m_vWindows)
|
for (auto& w : g_pCompositor->m_vWindows)
|
||||||
ptrs.push_back(w.get());
|
ptrs.push_back(w);
|
||||||
|
|
||||||
for (auto& w : ptrs) {
|
for (auto& w : ptrs) {
|
||||||
if (!w->m_bIsMapped || w->m_pWorkspace != PWORKSPACE || w->isHidden())
|
if (!w->m_bIsMapped || w->m_pWorkspace != PWORKSPACE || w->isHidden())
|
||||||
|
@ -1719,27 +1719,31 @@ void CKeybindManager::forceRendererReload(std::string args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::resizeActive(std::string args) {
|
void CKeybindManager::resizeActive(std::string args) {
|
||||||
if (!g_pCompositor->m_pLastWindow || g_pCompositor->m_pLastWindow->m_bIsFullscreen)
|
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
|
if (!PLASTWINDOW || PLASTWINDOW->m_bIsFullscreen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto SIZ = g_pCompositor->parseWindowVectorArgsRelative(args, g_pCompositor->m_pLastWindow->m_vRealSize.goal());
|
const auto SIZ = g_pCompositor->parseWindowVectorArgsRelative(args, PLASTWINDOW->m_vRealSize.goal());
|
||||||
|
|
||||||
if (SIZ.x < 1 || SIZ.y < 1)
|
if (SIZ.x < 1 || SIZ.y < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_pLayoutManager->getCurrentLayout()->resizeActiveWindow(SIZ - g_pCompositor->m_pLastWindow->m_vRealSize.goal());
|
g_pLayoutManager->getCurrentLayout()->resizeActiveWindow(SIZ - PLASTWINDOW->m_vRealSize.goal());
|
||||||
|
|
||||||
if (g_pCompositor->m_pLastWindow->m_vRealSize.goal().x > 1 && g_pCompositor->m_pLastWindow->m_vRealSize.goal().y > 1)
|
if (PLASTWINDOW->m_vRealSize.goal().x > 1 && PLASTWINDOW->m_vRealSize.goal().y > 1)
|
||||||
g_pCompositor->m_pLastWindow->setHidden(false);
|
PLASTWINDOW->setHidden(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::moveActive(std::string args) {
|
void CKeybindManager::moveActive(std::string args) {
|
||||||
if (!g_pCompositor->m_pLastWindow || g_pCompositor->m_pLastWindow->m_bIsFullscreen)
|
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
|
if (!PLASTWINDOW || PLASTWINDOW->m_bIsFullscreen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto POS = g_pCompositor->parseWindowVectorArgsRelative(args, g_pCompositor->m_pLastWindow->m_vRealPosition.goal());
|
const auto POS = g_pCompositor->parseWindowVectorArgsRelative(args, PLASTWINDOW->m_vRealPosition.goal());
|
||||||
|
|
||||||
g_pLayoutManager->getCurrentLayout()->moveActiveWindow(POS - g_pCompositor->m_pLastWindow->m_vRealPosition.goal());
|
g_pLayoutManager->getCurrentLayout()->moveActiveWindow(POS - PLASTWINDOW->m_vRealPosition.goal());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::moveWindow(std::string args) {
|
void CKeybindManager::moveWindow(std::string args) {
|
||||||
|
@ -1790,7 +1794,7 @@ void CKeybindManager::resizeWindow(std::string args) {
|
||||||
|
|
||||||
void CKeybindManager::circleNext(std::string arg) {
|
void CKeybindManager::circleNext(std::string arg) {
|
||||||
|
|
||||||
if (!g_pCompositor->m_pLastWindow) {
|
if (g_pCompositor->m_pLastWindow.expired()) {
|
||||||
// if we have a clear focus, find the first window and get the next focusable.
|
// if we have a clear focus, find the first window and get the next focusable.
|
||||||
if (g_pCompositor->getWindowsOnWorkspace(g_pCompositor->m_pLastMonitor->activeWorkspaceID()) > 0) {
|
if (g_pCompositor->getWindowsOnWorkspace(g_pCompositor->m_pLastMonitor->activeWorkspaceID()) > 0) {
|
||||||
const auto PWINDOW = g_pCompositor->getFirstWindowOnWorkspace(g_pCompositor->m_pLastMonitor->activeWorkspaceID());
|
const auto PWINDOW = g_pCompositor->getFirstWindowOnWorkspace(g_pCompositor->m_pLastMonitor->activeWorkspaceID());
|
||||||
|
@ -1810,9 +1814,9 @@ void CKeybindManager::circleNext(std::string arg) {
|
||||||
floatStatus = true;
|
floatStatus = true;
|
||||||
|
|
||||||
if (args.contains("prev") || args.contains("p") || args.contains("last") || args.contains("l"))
|
if (args.contains("prev") || args.contains("p") || args.contains("last") || args.contains("l"))
|
||||||
switchToWindow(g_pCompositor->getPrevWindowOnWorkspace(g_pCompositor->m_pLastWindow, true, floatStatus));
|
switchToWindow(g_pCompositor->getPrevWindowOnWorkspace(g_pCompositor->m_pLastWindow.lock(), true, floatStatus));
|
||||||
else
|
else
|
||||||
switchToWindow(g_pCompositor->getNextWindowOnWorkspace(g_pCompositor->m_pLastWindow, true, floatStatus));
|
switchToWindow(g_pCompositor->getNextWindowOnWorkspace(g_pCompositor->m_pLastWindow.lock(), true, floatStatus));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::focusWindow(std::string regexp) {
|
void CKeybindManager::focusWindow(std::string regexp) {
|
||||||
|
@ -1902,7 +1906,7 @@ void CKeybindManager::pass(std::string regexp) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto XWTOXW = PWINDOW->m_bIsX11 && g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bIsX11;
|
const auto XWTOXW = PWINDOW->m_bIsX11 && g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow.lock()->m_bIsX11;
|
||||||
const auto SL = Vector2D(g_pCompositor->m_sSeat.seat->pointer_state.sx, g_pCompositor->m_sSeat.seat->pointer_state.sy);
|
const auto SL = Vector2D(g_pCompositor->m_sSeat.seat->pointer_state.sx, g_pCompositor->m_sSeat.seat->pointer_state.sy);
|
||||||
uint32_t keycodes[32] = {0};
|
uint32_t keycodes[32] = {0};
|
||||||
|
|
||||||
|
@ -1961,12 +1965,12 @@ void CKeybindManager::pass(std::string regexp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::layoutmsg(std::string msg) {
|
void CKeybindManager::layoutmsg(std::string msg) {
|
||||||
SLayoutMessageHeader hd = {g_pCompositor->m_pLastWindow};
|
SLayoutMessageHeader hd = {g_pCompositor->m_pLastWindow.lock()};
|
||||||
g_pLayoutManager->getCurrentLayout()->layoutMessage(hd, msg);
|
g_pLayoutManager->getCurrentLayout()->layoutMessage(hd, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::toggleOpaque(std::string unused) {
|
void CKeybindManager::toggleOpaque(std::string unused) {
|
||||||
const auto PWINDOW = g_pCompositor->m_pLastWindow;
|
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!PWINDOW)
|
if (!PWINDOW)
|
||||||
return;
|
return;
|
||||||
|
@ -2009,16 +2013,16 @@ void CKeybindManager::dpms(std::string arg) {
|
||||||
|
|
||||||
void CKeybindManager::swapnext(std::string arg) {
|
void CKeybindManager::swapnext(std::string arg) {
|
||||||
|
|
||||||
CWindow* toSwap = nullptr;
|
PHLWINDOW toSwap = nullptr;
|
||||||
|
|
||||||
if (!g_pCompositor->m_pLastWindow)
|
if (g_pCompositor->m_pLastWindow.expired())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow;
|
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
const auto PLASTCYCLED = g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow->m_pLastCycledWindow) &&
|
const auto PLASTCYCLED = validMapped(g_pCompositor->m_pLastWindow.lock()->m_pLastCycledWindow) &&
|
||||||
g_pCompositor->m_pLastWindow->m_pLastCycledWindow->m_pWorkspace == PLASTWINDOW->m_pWorkspace ?
|
g_pCompositor->m_pLastWindow.lock()->m_pLastCycledWindow.lock()->m_pWorkspace == PLASTWINDOW->m_pWorkspace ?
|
||||||
g_pCompositor->m_pLastWindow->m_pLastCycledWindow :
|
g_pCompositor->m_pLastWindow.lock()->m_pLastCycledWindow.lock() :
|
||||||
nullptr;
|
nullptr;
|
||||||
|
|
||||||
if (arg == "last" || arg == "l" || arg == "prev" || arg == "p")
|
if (arg == "last" || arg == "l" || arg == "prev" || arg == "p")
|
||||||
|
@ -2056,12 +2060,12 @@ void CKeybindManager::swapActiveWorkspaces(std::string args) {
|
||||||
|
|
||||||
void CKeybindManager::pinActive(std::string args) {
|
void CKeybindManager::pinActive(std::string args) {
|
||||||
|
|
||||||
CWindow* PWINDOW = nullptr;
|
PHLWINDOW PWINDOW = nullptr;
|
||||||
|
|
||||||
if (args != "active" && args.length() > 1)
|
if (args != "active" && args.length() > 1)
|
||||||
PWINDOW = g_pCompositor->getWindowByRegex(args);
|
PWINDOW = g_pCompositor->getWindowByRegex(args);
|
||||||
else
|
else
|
||||||
PWINDOW = g_pCompositor->m_pLastWindow;
|
PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!PWINDOW) {
|
if (!PWINDOW) {
|
||||||
Debug::log(ERR, "pin: window not found");
|
Debug::log(ERR, "pin: window not found");
|
||||||
|
@ -2081,7 +2085,7 @@ void CKeybindManager::pinActive(std::string args) {
|
||||||
|
|
||||||
PWORKSPACE->m_pLastFocusedWindow = g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), RESERVED_EXTENTS | INPUT_EXTENTS);
|
PWORKSPACE->m_pLastFocusedWindow = g_pCompositor->vectorToWindowUnified(g_pInputManager->getMouseCoordsInternal(), RESERVED_EXTENTS | INPUT_EXTENTS);
|
||||||
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"pin", std::format("{:x},{}", (uintptr_t)PWINDOW, (int)PWINDOW->m_bPinned)});
|
g_pEventManager->postEvent(SHyprIPCEvent{"pin", std::format("{:x},{}", (uintptr_t)PWINDOW.get(), (int)PWINDOW->m_bPinned)});
|
||||||
EMIT_HOOK_EVENT("pin", PWINDOW);
|
EMIT_HOOK_EVENT("pin", PWINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2094,12 +2098,12 @@ void CKeybindManager::mouse(std::string args) {
|
||||||
g_pKeybindManager->m_bIsMouseBindActive = true;
|
g_pKeybindManager->m_bIsMouseBindActive = true;
|
||||||
|
|
||||||
const auto mouseCoords = g_pInputManager->getMouseCoordsInternal();
|
const auto mouseCoords = g_pInputManager->getMouseCoordsInternal();
|
||||||
CWindow* pWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
PHLWINDOW pWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
||||||
|
|
||||||
if (pWindow && !pWindow->m_bIsFullscreen)
|
if (pWindow && !pWindow->m_bIsFullscreen)
|
||||||
pWindow->checkInputOnDecos(INPUT_TYPE_DRAG_START, mouseCoords);
|
pWindow->checkInputOnDecos(INPUT_TYPE_DRAG_START, mouseCoords);
|
||||||
|
|
||||||
if (!g_pInputManager->currentlyDraggedWindow)
|
if (g_pInputManager->currentlyDraggedWindow.expired())
|
||||||
g_pInputManager->currentlyDraggedWindow = pWindow;
|
g_pInputManager->currentlyDraggedWindow = pWindow;
|
||||||
|
|
||||||
g_pInputManager->dragMode = MBIND_MOVE;
|
g_pInputManager->dragMode = MBIND_MOVE;
|
||||||
|
@ -2107,10 +2111,10 @@ void CKeybindManager::mouse(std::string args) {
|
||||||
} else {
|
} else {
|
||||||
g_pKeybindManager->m_bIsMouseBindActive = false;
|
g_pKeybindManager->m_bIsMouseBindActive = false;
|
||||||
|
|
||||||
if (g_pInputManager->currentlyDraggedWindow) {
|
if (!g_pInputManager->currentlyDraggedWindow.expired()) {
|
||||||
g_pLayoutManager->getCurrentLayout()->onEndDragWindow();
|
g_pLayoutManager->getCurrentLayout()->onEndDragWindow();
|
||||||
g_pInputManager->currentlyDraggedWindow = nullptr;
|
g_pInputManager->currentlyDraggedWindow.reset();
|
||||||
g_pInputManager->dragMode = MBIND_INVALID;
|
g_pInputManager->dragMode = MBIND_INVALID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (ARGS[0] == "resizewindow") {
|
} else if (ARGS[0] == "resizewindow") {
|
||||||
|
@ -2131,18 +2135,18 @@ void CKeybindManager::mouse(std::string args) {
|
||||||
} else {
|
} else {
|
||||||
g_pKeybindManager->m_bIsMouseBindActive = false;
|
g_pKeybindManager->m_bIsMouseBindActive = false;
|
||||||
|
|
||||||
if (g_pInputManager->currentlyDraggedWindow) {
|
if (!g_pInputManager->currentlyDraggedWindow.expired()) {
|
||||||
g_pLayoutManager->getCurrentLayout()->onEndDragWindow();
|
g_pLayoutManager->getCurrentLayout()->onEndDragWindow();
|
||||||
g_pInputManager->currentlyDraggedWindow = nullptr;
|
g_pInputManager->currentlyDraggedWindow.reset();
|
||||||
g_pInputManager->dragMode = MBIND_INVALID;
|
g_pInputManager->dragMode = MBIND_INVALID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::bringActiveToTop(std::string args) {
|
void CKeybindManager::bringActiveToTop(std::string args) {
|
||||||
if (g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bIsFloating)
|
if (g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow.lock()->m_bIsFloating)
|
||||||
g_pCompositor->changeWindowZOrder(g_pCompositor->m_pLastWindow, true);
|
g_pCompositor->changeWindowZOrder(g_pCompositor->m_pLastWindow.lock(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::alterZOrder(std::string args) {
|
void CKeybindManager::alterZOrder(std::string args) {
|
||||||
|
@ -2150,8 +2154,8 @@ void CKeybindManager::alterZOrder(std::string args) {
|
||||||
const auto POSITION = args.substr(0, args.find_first_of(','));
|
const auto POSITION = args.substr(0, args.find_first_of(','));
|
||||||
auto PWINDOW = g_pCompositor->getWindowByRegex(WINDOWREGEX);
|
auto PWINDOW = g_pCompositor->getWindowByRegex(WINDOWREGEX);
|
||||||
|
|
||||||
if (!PWINDOW && g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bIsFloating)
|
if (!PWINDOW && g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow.lock()->m_bIsFloating)
|
||||||
PWINDOW = g_pCompositor->m_pLastWindow;
|
PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!PWINDOW) {
|
if (!PWINDOW) {
|
||||||
Debug::log(ERR, "alterZOrder: no window");
|
Debug::log(ERR, "alterZOrder: no window");
|
||||||
|
@ -2171,10 +2175,10 @@ void CKeybindManager::alterZOrder(std::string args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::fakeFullscreenActive(std::string args) {
|
void CKeybindManager::fakeFullscreenActive(std::string args) {
|
||||||
if (g_pCompositor->m_pLastWindow) {
|
if (!g_pCompositor->m_pLastWindow.expired()) {
|
||||||
// will also set the flag
|
// will also set the flag
|
||||||
g_pCompositor->m_pLastWindow->m_bFakeFullscreenState = !g_pCompositor->m_pLastWindow->m_bFakeFullscreenState;
|
g_pCompositor->m_pLastWindow.lock()->m_bFakeFullscreenState = !g_pCompositor->m_pLastWindow.lock()->m_bFakeFullscreenState;
|
||||||
g_pXWaylandManager->setWindowFullscreen(g_pCompositor->m_pLastWindow, g_pCompositor->m_pLastWindow->shouldSendFullscreenState());
|
g_pXWaylandManager->setWindowFullscreen(g_pCompositor->m_pLastWindow.lock(), g_pCompositor->m_pLastWindow.lock()->shouldSendFullscreenState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2190,9 +2194,9 @@ void CKeybindManager::lockGroups(std::string args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::lockActiveGroup(std::string args) {
|
void CKeybindManager::lockActiveGroup(std::string args) {
|
||||||
const auto PWINDOW = g_pCompositor->m_pLastWindow;
|
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!PWINDOW || !PWINDOW->m_sGroupData.pNextWindow)
|
if (!PWINDOW || !PWINDOW->m_sGroupData.pNextWindow.lock())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto PHEAD = PWINDOW->getGroupHead();
|
const auto PHEAD = PWINDOW->getGroupHead();
|
||||||
|
@ -2207,7 +2211,7 @@ void CKeybindManager::lockActiveGroup(std::string args) {
|
||||||
g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW);
|
g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::moveWindowIntoGroup(CWindow* pWindow, CWindow* pWindowInDirection) {
|
void CKeybindManager::moveWindowIntoGroup(PHLWINDOW pWindow, PHLWINDOW pWindowInDirection) {
|
||||||
if (pWindow->m_sGroupData.deny)
|
if (pWindow->m_sGroupData.deny)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -2227,7 +2231,7 @@ void CKeybindManager::moveWindowIntoGroup(CWindow* pWindow, CWindow* pWindowInDi
|
||||||
pWindow->addWindowDeco(std::make_unique<CHyprGroupBarDecoration>(pWindow));
|
pWindow->addWindowDeco(std::make_unique<CHyprGroupBarDecoration>(pWindow));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::moveWindowOutOfGroup(CWindow* pWindow, const std::string& dir) {
|
void CKeybindManager::moveWindowOutOfGroup(PHLWINDOW pWindow, const std::string& dir) {
|
||||||
static auto BFOCUSREMOVEDWINDOW = CConfigValue<Hyprlang::INT>("group:focus_removed_window");
|
static auto BFOCUSREMOVEDWINDOW = CConfigValue<Hyprlang::INT>("group:focus_removed_window");
|
||||||
const auto PWINDOWPREV = pWindow->getGroupPrevious();
|
const auto PWINDOWPREV = pWindow->getGroupPrevious();
|
||||||
eDirection direction;
|
eDirection direction;
|
||||||
|
@ -2242,7 +2246,7 @@ void CKeybindManager::moveWindowOutOfGroup(CWindow* pWindow, const std::string&
|
||||||
default: direction = DIRECTION_DEFAULT;
|
default: direction = DIRECTION_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pWindow->m_sGroupData.pNextWindow == pWindow) {
|
if (pWindow->m_sGroupData.pNextWindow.lock() == pWindow) {
|
||||||
pWindow->destroyGroup();
|
pWindow->destroyGroup();
|
||||||
} else {
|
} else {
|
||||||
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow);
|
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow);
|
||||||
|
@ -2277,18 +2281,18 @@ void CKeybindManager::moveIntoGroup(std::string args) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto PWINDOW = g_pCompositor->m_pLastWindow;
|
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!PWINDOW || PWINDOW->m_bIsFloating || PWINDOW->m_sGroupData.deny)
|
if (!PWINDOW || PWINDOW->m_bIsFloating || PWINDOW->m_sGroupData.deny)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto PWINDOWINDIR = g_pCompositor->getWindowInDirection(PWINDOW, arg);
|
auto PWINDOWINDIR = g_pCompositor->getWindowInDirection(PWINDOW, arg);
|
||||||
|
|
||||||
if (!PWINDOWINDIR || !PWINDOWINDIR->m_sGroupData.pNextWindow)
|
if (!PWINDOWINDIR || !PWINDOWINDIR->m_sGroupData.pNextWindow.lock())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Do not move window into locked group if binds:ignore_group_lock is false
|
// 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 && PWINDOW->getGroupHead()->m_sGroupData.locked)))
|
if (!*PIGNOREGROUPLOCK && (PWINDOWINDIR->getGroupHead()->m_sGroupData.locked || (PWINDOW->m_sGroupData.pNextWindow.lock() && PWINDOW->getGroupHead()->m_sGroupData.locked)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
moveWindowIntoGroup(PWINDOW, PWINDOWINDIR);
|
moveWindowIntoGroup(PWINDOW, PWINDOWINDIR);
|
||||||
|
@ -2300,14 +2304,14 @@ void CKeybindManager::moveOutOfGroup(std::string args) {
|
||||||
if (!*PIGNOREGROUPLOCK && g_pKeybindManager->m_bGroupsLocked)
|
if (!*PIGNOREGROUPLOCK && g_pKeybindManager->m_bGroupsLocked)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CWindow* PWINDOW = nullptr;
|
PHLWINDOW PWINDOW = nullptr;
|
||||||
|
|
||||||
if (args != "active" && args.length() > 1)
|
if (args != "active" && args.length() > 1)
|
||||||
PWINDOW = g_pCompositor->getWindowByRegex(args);
|
PWINDOW = g_pCompositor->getWindowByRegex(args);
|
||||||
else
|
else
|
||||||
PWINDOW = g_pCompositor->m_pLastWindow;
|
PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!PWINDOW || !PWINDOW->m_sGroupData.pNextWindow)
|
if (!PWINDOW || !PWINDOW->m_sGroupData.pNextWindow.lock())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
moveWindowOutOfGroup(PWINDOW);
|
moveWindowOutOfGroup(PWINDOW);
|
||||||
|
@ -2323,7 +2327,7 @@ void CKeybindManager::moveWindowOrGroup(std::string args) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto PWINDOW = g_pCompositor->m_pLastWindow;
|
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
if (!PWINDOW || PWINDOW->m_bIsFullscreen)
|
if (!PWINDOW || PWINDOW->m_bIsFullscreen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -2334,12 +2338,12 @@ void CKeybindManager::moveWindowOrGroup(std::string args) {
|
||||||
|
|
||||||
const auto PWINDOWINDIR = g_pCompositor->getWindowInDirection(PWINDOW, arg);
|
const auto PWINDOWINDIR = g_pCompositor->getWindowInDirection(PWINDOW, arg);
|
||||||
|
|
||||||
const bool ISWINDOWGROUP = PWINDOW->m_sGroupData.pNextWindow;
|
const bool ISWINDOWGROUP = PWINDOW->m_sGroupData.pNextWindow.lock().get();
|
||||||
const bool ISWINDOWGROUPLOCKED = ISWINDOWGROUP && PWINDOW->getGroupHead()->m_sGroupData.locked;
|
const bool ISWINDOWGROUPLOCKED = ISWINDOWGROUP && PWINDOW->getGroupHead()->m_sGroupData.locked;
|
||||||
const bool ISWINDOWGROUPSINGLE = ISWINDOWGROUP && PWINDOW->m_sGroupData.pNextWindow == PWINDOW;
|
const bool ISWINDOWGROUPSINGLE = ISWINDOWGROUP && PWINDOW->m_sGroupData.pNextWindow.lock() == PWINDOW;
|
||||||
|
|
||||||
// note: PWINDOWINDIR is not null implies !PWINDOW->m_bIsFloating
|
// note: PWINDOWINDIR is not null implies !PWINDOW->m_bIsFloating
|
||||||
if (PWINDOWINDIR && PWINDOWINDIR->m_sGroupData.pNextWindow) { // target is group
|
if (PWINDOWINDIR && PWINDOWINDIR->m_sGroupData.pNextWindow.lock()) { // target is group
|
||||||
if (!*PIGNOREGROUPLOCK && (PWINDOWINDIR->getGroupHead()->m_sGroupData.locked || ISWINDOWGROUPLOCKED || PWINDOW->m_sGroupData.deny)) {
|
if (!*PIGNOREGROUPLOCK && (PWINDOWINDIR->getGroupHead()->m_sGroupData.locked || ISWINDOWGROUPLOCKED || PWINDOW->m_sGroupData.deny)) {
|
||||||
g_pLayoutManager->getCurrentLayout()->moveWindowTo(PWINDOW, args);
|
g_pLayoutManager->getCurrentLayout()->moveWindowTo(PWINDOW, args);
|
||||||
g_pCompositor->warpCursorTo(PWINDOW->middle());
|
g_pCompositor->warpCursorTo(PWINDOW->middle());
|
||||||
|
@ -2373,8 +2377,8 @@ void CKeybindManager::setIgnoreGroupLock(std::string args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::denyWindowFromGroup(std::string args) {
|
void CKeybindManager::denyWindowFromGroup(std::string args) {
|
||||||
const auto PWINDOW = g_pCompositor->m_pLastWindow;
|
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
if (!PWINDOW || (PWINDOW && PWINDOW->m_sGroupData.pNextWindow))
|
if (!PWINDOW || (PWINDOW && PWINDOW->m_sGroupData.pNextWindow.lock()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (args == "toggle")
|
if (args == "toggle")
|
||||||
|
@ -2401,14 +2405,16 @@ void CKeybindManager::global(std::string args) {
|
||||||
void CKeybindManager::moveGroupWindow(std::string args) {
|
void CKeybindManager::moveGroupWindow(std::string args) {
|
||||||
const auto BACK = args == "b" || args == "prev";
|
const auto BACK = args == "b" || args == "prev";
|
||||||
|
|
||||||
if (!g_pCompositor->m_pLastWindow || !g_pCompositor->m_pLastWindow->m_sGroupData.pNextWindow)
|
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
|
if (!PLASTWINDOW || !PLASTWINDOW->m_sGroupData.pNextWindow.lock())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((!BACK && g_pCompositor->m_pLastWindow->m_sGroupData.pNextWindow->m_sGroupData.head) || (BACK && g_pCompositor->m_pLastWindow->m_sGroupData.head)) {
|
if ((!BACK && PLASTWINDOW->m_sGroupData.pNextWindow.lock()->m_sGroupData.head) || (BACK && PLASTWINDOW->m_sGroupData.head)) {
|
||||||
std::swap(g_pCompositor->m_pLastWindow->m_sGroupData.head, g_pCompositor->m_pLastWindow->m_sGroupData.pNextWindow->m_sGroupData.head);
|
std::swap(PLASTWINDOW->m_sGroupData.head, PLASTWINDOW->m_sGroupData.pNextWindow.lock()->m_sGroupData.head);
|
||||||
std::swap(g_pCompositor->m_pLastWindow->m_sGroupData.locked, g_pCompositor->m_pLastWindow->m_sGroupData.pNextWindow->m_sGroupData.locked);
|
std::swap(PLASTWINDOW->m_sGroupData.locked, PLASTWINDOW->m_sGroupData.pNextWindow.lock()->m_sGroupData.locked);
|
||||||
} else
|
} else
|
||||||
g_pCompositor->m_pLastWindow->switchWithWindowInGroup(BACK ? g_pCompositor->m_pLastWindow->getGroupPrevious() : g_pCompositor->m_pLastWindow->m_sGroupData.pNextWindow);
|
PLASTWINDOW->switchWithWindowInGroup(BACK ? PLASTWINDOW->getGroupPrevious() : PLASTWINDOW->m_sGroupData.pNextWindow.lock());
|
||||||
|
|
||||||
g_pCompositor->m_pLastWindow->updateWindowDecos();
|
PLASTWINDOW->updateWindowDecos();
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,9 +111,9 @@ class CKeybindManager {
|
||||||
bool ensureMouseBindState();
|
bool ensureMouseBindState();
|
||||||
|
|
||||||
static bool tryMoveFocusToMonitor(CMonitor* monitor);
|
static bool tryMoveFocusToMonitor(CMonitor* monitor);
|
||||||
static void moveWindowOutOfGroup(CWindow* pWindow, const std::string& dir = "");
|
static void moveWindowOutOfGroup(PHLWINDOW pWindow, const std::string& dir = "");
|
||||||
static void moveWindowIntoGroup(CWindow* pWindow, CWindow* pWindowInDirection);
|
static void moveWindowIntoGroup(PHLWINDOW pWindow, PHLWINDOW pWindowInDirection);
|
||||||
static void switchToWindow(CWindow* PWINDOWTOCHANGETO);
|
static void switchToWindow(PHLWINDOW PWINDOWTOCHANGETO);
|
||||||
|
|
||||||
// -------------- Dispatchers -------------- //
|
// -------------- Dispatchers -------------- //
|
||||||
static void killActive(std::string);
|
static void killActive(std::string);
|
||||||
|
|
|
@ -29,7 +29,7 @@ CHyprXWaylandManager::CHyprXWaylandManager() {
|
||||||
|
|
||||||
CHyprXWaylandManager::~CHyprXWaylandManager() {}
|
CHyprXWaylandManager::~CHyprXWaylandManager() {}
|
||||||
|
|
||||||
wlr_surface* CHyprXWaylandManager::getWindowSurface(CWindow* pWindow) {
|
wlr_surface* CHyprXWaylandManager::getWindowSurface(PHLWINDOW pWindow) {
|
||||||
if (pWindow->m_bIsX11)
|
if (pWindow->m_bIsX11)
|
||||||
return pWindow->m_uSurface.xwayland->surface;
|
return pWindow->m_uSurface.xwayland->surface;
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ void CHyprXWaylandManager::activateSurface(wlr_surface* pSurface, bool activate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprXWaylandManager::activateWindow(CWindow* pWindow, bool activate) {
|
void CHyprXWaylandManager::activateWindow(PHLWINDOW pWindow, bool activate) {
|
||||||
if (pWindow->m_bIsX11) {
|
if (pWindow->m_bIsX11) {
|
||||||
setWindowSize(pWindow, pWindow->m_vRealSize.value()); // update xwayland output pos
|
setWindowSize(pWindow, pWindow->m_vRealSize.value()); // update xwayland output pos
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ void CHyprXWaylandManager::activateWindow(CWindow* pWindow, bool activate) {
|
||||||
pWindow->m_pWorkspace->m_pLastFocusedWindow = pWindow;
|
pWindow->m_pWorkspace->m_pLastFocusedWindow = pWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprXWaylandManager::getGeometryForWindow(CWindow* pWindow, CBox* pbox) {
|
void CHyprXWaylandManager::getGeometryForWindow(PHLWINDOW pWindow, CBox* pbox) {
|
||||||
if (pWindow->m_bIsX11) {
|
if (pWindow->m_bIsX11) {
|
||||||
const auto SIZEHINTS = pWindow->m_uSurface.xwayland->size_hints;
|
const auto SIZEHINTS = pWindow->m_uSurface.xwayland->size_hints;
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ void CHyprXWaylandManager::getGeometryForWindow(CWindow* pWindow, CBox* pbox) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CHyprXWaylandManager::getTitle(CWindow* pWindow) {
|
std::string CHyprXWaylandManager::getTitle(PHLWINDOW pWindow) {
|
||||||
try {
|
try {
|
||||||
if (pWindow->m_bIsX11) {
|
if (pWindow->m_bIsX11) {
|
||||||
if (!pWindow->m_bIsMapped)
|
if (!pWindow->m_bIsMapped)
|
||||||
|
@ -121,7 +121,7 @@ std::string CHyprXWaylandManager::getTitle(CWindow* pWindow) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CHyprXWaylandManager::getAppIDClass(CWindow* pWindow) {
|
std::string CHyprXWaylandManager::getAppIDClass(PHLWINDOW pWindow) {
|
||||||
try {
|
try {
|
||||||
if (pWindow->m_bIsX11) {
|
if (pWindow->m_bIsX11) {
|
||||||
if (!pWindow->m_bIsMapped)
|
if (!pWindow->m_bIsMapped)
|
||||||
|
@ -144,14 +144,14 @@ std::string CHyprXWaylandManager::getAppIDClass(CWindow* pWindow) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprXWaylandManager::sendCloseWindow(CWindow* pWindow) {
|
void CHyprXWaylandManager::sendCloseWindow(PHLWINDOW pWindow) {
|
||||||
if (pWindow->m_bIsX11)
|
if (pWindow->m_bIsX11)
|
||||||
wlr_xwayland_surface_close(pWindow->m_uSurface.xwayland);
|
wlr_xwayland_surface_close(pWindow->m_uSurface.xwayland);
|
||||||
else
|
else
|
||||||
wlr_xdg_toplevel_send_close(pWindow->m_uSurface.xdg->toplevel);
|
wlr_xdg_toplevel_send_close(pWindow->m_uSurface.xdg->toplevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, Vector2D size, bool force) {
|
void CHyprXWaylandManager::setWindowSize(PHLWINDOW pWindow, Vector2D size, bool force) {
|
||||||
|
|
||||||
static auto PXWLFORCESCALEZERO = CConfigValue<Hyprlang::INT>("xwayland:force_zero_scaling");
|
static auto PXWLFORCESCALEZERO = CConfigValue<Hyprlang::INT>("xwayland:force_zero_scaling");
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, Vector2D size, bool f
|
||||||
pWindow->m_vPendingSizeAcks.push_back(std::make_pair<>(wlr_xdg_toplevel_set_size(pWindow->m_uSurface.xdg->toplevel, size.x, size.y), size.floor()));
|
pWindow->m_vPendingSizeAcks.push_back(std::make_pair<>(wlr_xdg_toplevel_set_size(pWindow->m_uSurface.xdg->toplevel, size.x, size.y), size.floor()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprXWaylandManager::setWindowStyleTiled(CWindow* pWindow, uint32_t edgez) {
|
void CHyprXWaylandManager::setWindowStyleTiled(PHLWINDOW pWindow, uint32_t edgez) {
|
||||||
if (pWindow->m_bIsX11)
|
if (pWindow->m_bIsX11)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -197,14 +197,14 @@ void CHyprXWaylandManager::setWindowStyleTiled(CWindow* pWindow, uint32_t edgez)
|
||||||
wlr_xdg_toplevel_set_maximized(pWindow->m_uSurface.xdg->toplevel, true);
|
wlr_xdg_toplevel_set_maximized(pWindow->m_uSurface.xdg->toplevel, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_surface* CHyprXWaylandManager::surfaceAt(CWindow* pWindow, const Vector2D& client, Vector2D& surface) {
|
wlr_surface* CHyprXWaylandManager::surfaceAt(PHLWINDOW pWindow, const Vector2D& client, Vector2D& surface) {
|
||||||
if (pWindow->m_bIsX11)
|
if (pWindow->m_bIsX11)
|
||||||
return wlr_surface_surface_at(pWindow->m_uSurface.xwayland->surface, client.x, client.y, &surface.x, &surface.y);
|
return wlr_surface_surface_at(pWindow->m_uSurface.xwayland->surface, client.x, client.y, &surface.x, &surface.y);
|
||||||
|
|
||||||
return wlr_xdg_surface_surface_at(pWindow->m_uSurface.xdg, client.x, client.y, &surface.x, &surface.y);
|
return wlr_xdg_surface_surface_at(pWindow->m_uSurface.xdg, client.x, client.y, &surface.x, &surface.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CHyprXWaylandManager::shouldBeFloated(CWindow* pWindow, bool pending) {
|
bool CHyprXWaylandManager::shouldBeFloated(PHLWINDOW pWindow, bool pending) {
|
||||||
if (pWindow->m_bIsX11) {
|
if (pWindow->m_bIsX11) {
|
||||||
for (size_t i = 0; i < pWindow->m_uSurface.xwayland->window_type_len; i++)
|
for (size_t i = 0; i < pWindow->m_uSurface.xwayland->window_type_len; i++)
|
||||||
if (pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_DIALOG"] ||
|
if (pWindow->m_uSurface.xwayland->window_type[i] == HYPRATOMS["_NET_WM_WINDOW_TYPE_DIALOG"] ||
|
||||||
|
@ -257,8 +257,8 @@ bool CHyprXWaylandManager::shouldBeFloated(CWindow* pWindow, bool pending) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprXWaylandManager::moveXWaylandWindow(CWindow* pWindow, const Vector2D& pos) {
|
void CHyprXWaylandManager::moveXWaylandWindow(PHLWINDOW pWindow, const Vector2D& pos) {
|
||||||
if (!g_pCompositor->windowValidMapped(pWindow))
|
if (!validMapped(pWindow))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!pWindow->m_bIsX11)
|
if (!pWindow->m_bIsX11)
|
||||||
|
@ -267,7 +267,7 @@ void CHyprXWaylandManager::moveXWaylandWindow(CWindow* pWindow, const Vector2D&
|
||||||
wlr_xwayland_surface_configure(pWindow->m_uSurface.xwayland, pos.x, pos.y, pWindow->m_vRealSize.value().x, pWindow->m_vRealSize.value().y);
|
wlr_xwayland_surface_configure(pWindow->m_uSurface.xwayland, pos.x, pos.y, pWindow->m_vRealSize.value().x, pWindow->m_vRealSize.value().y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprXWaylandManager::checkBorders(CWindow* pWindow) {
|
void CHyprXWaylandManager::checkBorders(PHLWINDOW pWindow) {
|
||||||
if (!pWindow->m_bIsX11)
|
if (!pWindow->m_bIsX11)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -290,15 +290,15 @@ void CHyprXWaylandManager::checkBorders(CWindow* pWindow) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprXWaylandManager::setWindowFullscreen(CWindow* pWindow, bool fullscreen) {
|
void CHyprXWaylandManager::setWindowFullscreen(PHLWINDOW pWindow, bool fullscreen) {
|
||||||
if (pWindow->m_bIsX11)
|
if (pWindow->m_bIsX11)
|
||||||
wlr_xwayland_surface_set_fullscreen(pWindow->m_uSurface.xwayland, fullscreen);
|
wlr_xwayland_surface_set_fullscreen(pWindow->m_uSurface.xwayland, fullscreen);
|
||||||
else
|
else
|
||||||
wlr_xdg_toplevel_set_fullscreen(pWindow->m_uSurface.xdg->toplevel, fullscreen);
|
wlr_xdg_toplevel_set_fullscreen(pWindow->m_uSurface.xdg->toplevel, fullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D CHyprXWaylandManager::getMaxSizeForWindow(CWindow* pWindow) {
|
Vector2D CHyprXWaylandManager::getMaxSizeForWindow(PHLWINDOW pWindow) {
|
||||||
if (!g_pCompositor->windowValidMapped(pWindow))
|
if (!validMapped(pWindow))
|
||||||
return Vector2D(99999, 99999);
|
return Vector2D(99999, 99999);
|
||||||
|
|
||||||
if ((pWindow->m_bIsX11 && !pWindow->m_uSurface.xwayland->size_hints) || (!pWindow->m_bIsX11 && !pWindow->m_uSurface.xdg->toplevel) ||
|
if ((pWindow->m_bIsX11 && !pWindow->m_uSurface.xwayland->size_hints) || (!pWindow->m_bIsX11 && !pWindow->m_uSurface.xdg->toplevel) ||
|
||||||
|
@ -316,8 +316,8 @@ Vector2D CHyprXWaylandManager::getMaxSizeForWindow(CWindow* pWindow) {
|
||||||
return MAXSIZE;
|
return MAXSIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D CHyprXWaylandManager::getMinSizeForWindow(CWindow* pWindow) {
|
Vector2D CHyprXWaylandManager::getMinSizeForWindow(PHLWINDOW pWindow) {
|
||||||
if (!g_pCompositor->windowValidMapped(pWindow))
|
if (!validMapped(pWindow))
|
||||||
return Vector2D(0, 0);
|
return Vector2D(0, 0);
|
||||||
|
|
||||||
if ((pWindow->m_bIsX11 && !pWindow->m_uSurface.xwayland->size_hints) || (!pWindow->m_bIsX11 && !pWindow->m_uSurface.xdg->toplevel))
|
if ((pWindow->m_bIsX11 && !pWindow->m_uSurface.xwayland->size_hints) || (!pWindow->m_bIsX11 && !pWindow->m_uSurface.xdg->toplevel))
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
class CWindow; // because clangd
|
class CWindow; // because clangd
|
||||||
|
typedef SP<CWindow> PHLWINDOW;
|
||||||
|
|
||||||
class CHyprXWaylandManager {
|
class CHyprXWaylandManager {
|
||||||
public:
|
public:
|
||||||
|
@ -12,22 +13,22 @@ class CHyprXWaylandManager {
|
||||||
|
|
||||||
wlr_xwayland* m_sWLRXWayland = nullptr;
|
wlr_xwayland* m_sWLRXWayland = nullptr;
|
||||||
|
|
||||||
wlr_surface* getWindowSurface(CWindow*);
|
wlr_surface* getWindowSurface(PHLWINDOW);
|
||||||
void activateSurface(wlr_surface*, bool);
|
void activateSurface(wlr_surface*, bool);
|
||||||
void activateWindow(CWindow*, bool);
|
void activateWindow(PHLWINDOW, bool);
|
||||||
void getGeometryForWindow(CWindow*, CBox*);
|
void getGeometryForWindow(PHLWINDOW, CBox*);
|
||||||
std::string getTitle(CWindow*);
|
std::string getTitle(PHLWINDOW);
|
||||||
std::string getAppIDClass(CWindow*);
|
std::string getAppIDClass(PHLWINDOW);
|
||||||
void sendCloseWindow(CWindow*);
|
void sendCloseWindow(PHLWINDOW);
|
||||||
void setWindowSize(CWindow*, Vector2D, bool force = false);
|
void setWindowSize(PHLWINDOW, Vector2D, bool force = false);
|
||||||
void setWindowStyleTiled(CWindow*, uint32_t);
|
void setWindowStyleTiled(PHLWINDOW, uint32_t);
|
||||||
void setWindowFullscreen(CWindow*, bool);
|
void setWindowFullscreen(PHLWINDOW, bool);
|
||||||
wlr_surface* surfaceAt(CWindow*, const Vector2D&, Vector2D&);
|
wlr_surface* surfaceAt(PHLWINDOW, const Vector2D&, Vector2D&);
|
||||||
bool shouldBeFloated(CWindow*, bool pending = false);
|
bool shouldBeFloated(PHLWINDOW, bool pending = false);
|
||||||
void moveXWaylandWindow(CWindow*, const Vector2D&);
|
void moveXWaylandWindow(PHLWINDOW, const Vector2D&);
|
||||||
void checkBorders(CWindow*);
|
void checkBorders(PHLWINDOW);
|
||||||
Vector2D getMaxSizeForWindow(CWindow*);
|
Vector2D getMaxSizeForWindow(PHLWINDOW);
|
||||||
Vector2D getMinSizeForWindow(CWindow*);
|
Vector2D getMinSizeForWindow(PHLWINDOW);
|
||||||
Vector2D xwaylandToWaylandCoords(const Vector2D&);
|
Vector2D xwaylandToWaylandCoords(const Vector2D&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ void CInputManager::newIdleInhibitor(std::any inhibitor) {
|
||||||
PINHIBIT->pWindow = PWINDOW;
|
PINHIBIT->pWindow = PWINDOW;
|
||||||
PINHIBIT->windowDestroyListener = PWINDOW->events.destroy.registerListener([PINHIBIT](std::any data) {
|
PINHIBIT->windowDestroyListener = PWINDOW->events.destroy.registerListener([PINHIBIT](std::any data) {
|
||||||
Debug::log(WARN, "Inhibitor got its window destroyed before its inhibitor resource.");
|
Debug::log(WARN, "Inhibitor got its window destroyed before its inhibitor resource.");
|
||||||
PINHIBIT->pWindow = nullptr;
|
PINHIBIT->pWindow.reset();
|
||||||
});
|
});
|
||||||
} else
|
} else
|
||||||
Debug::log(WARN, "Inhibitor is for no window?");
|
Debug::log(WARN, "Inhibitor is for no window?");
|
||||||
|
@ -29,10 +29,10 @@ void CInputManager::newIdleInhibitor(std::any inhibitor) {
|
||||||
void CInputManager::recheckIdleInhibitorStatus() {
|
void CInputManager::recheckIdleInhibitorStatus() {
|
||||||
|
|
||||||
for (auto& ii : m_vIdleInhibitors) {
|
for (auto& ii : m_vIdleInhibitors) {
|
||||||
if (!ii->pWindow) {
|
if (ii->pWindow.expired()) {
|
||||||
g_pCompositor->setIdleActivityInhibit(false);
|
g_pCompositor->setIdleActivityInhibit(false);
|
||||||
return;
|
return;
|
||||||
} else if (g_pHyprRenderer->shouldRenderWindow(ii->pWindow)) {
|
} else if (g_pHyprRenderer->shouldRenderWindow(ii->pWindow.lock())) {
|
||||||
g_pCompositor->setIdleActivityInhibit(false);
|
g_pCompositor->setIdleActivityInhibit(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ void CInputManager::recheckIdleInhibitorStatus() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (w->m_eIdleInhibitMode == IDLEINHIBIT_FOCUS && g_pCompositor->isWindowActive(w.get())) {
|
if (w->m_eIdleInhibitMode == IDLEINHIBIT_FOCUS && g_pCompositor->isWindowActive(w)) {
|
||||||
g_pCompositor->setIdleActivityInhibit(false);
|
g_pCompositor->setIdleActivityInhibit(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,13 +118,13 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
|
|
||||||
const auto FOLLOWMOUSE = *PFOLLOWONDND && m_sDrag.drag ? 1 : *PFOLLOWMOUSE;
|
const auto FOLLOWMOUSE = *PFOLLOWONDND && m_sDrag.drag ? 1 : *PFOLLOWMOUSE;
|
||||||
|
|
||||||
m_pFoundSurfaceToFocus = nullptr;
|
m_pFoundSurfaceToFocus = nullptr;
|
||||||
m_pFoundLSToFocus = nullptr;
|
m_pFoundLSToFocus = nullptr;
|
||||||
m_pFoundWindowToFocus = nullptr;
|
m_pFoundWindowToFocus.reset();
|
||||||
wlr_surface* foundSurface = nullptr;
|
wlr_surface* foundSurface = nullptr;
|
||||||
Vector2D surfaceCoords;
|
Vector2D surfaceCoords;
|
||||||
Vector2D surfacePos = Vector2D(-1337, -1337);
|
Vector2D surfacePos = Vector2D(-1337, -1337);
|
||||||
CWindow* pFoundWindow = nullptr;
|
PHLWINDOW pFoundWindow;
|
||||||
SLayerSurface* pFoundLayerSurface = nullptr;
|
SLayerSurface* pFoundLayerSurface = nullptr;
|
||||||
|
|
||||||
if (!g_pCompositor->m_bReadyToProcess || g_pCompositor->m_bIsShuttingDown || g_pCompositor->m_bUnsafeState)
|
if (!g_pCompositor->m_bReadyToProcess || g_pCompositor->m_bIsShuttingDown || g_pCompositor->m_bUnsafeState)
|
||||||
|
@ -157,10 +157,10 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
if (*PZOOMFACTOR != 1.f)
|
if (*PZOOMFACTOR != 1.f)
|
||||||
g_pHyprRenderer->damageMonitor(PMONITOR);
|
g_pHyprRenderer->damageMonitor(PMONITOR);
|
||||||
|
|
||||||
if (!PMONITOR->solitaryClient && g_pHyprRenderer->shouldRenderCursor() && PMONITOR->output->software_cursor_locks > 0)
|
if (!PMONITOR->solitaryClient.lock() && g_pHyprRenderer->shouldRenderCursor() && PMONITOR->output->software_cursor_locks > 0)
|
||||||
g_pCompositor->scheduleFrameForMonitor(PMONITOR);
|
g_pCompositor->scheduleFrameForMonitor(PMONITOR);
|
||||||
|
|
||||||
CWindow* forcedFocus = m_pForcedFocus;
|
PHLWINDOW forcedFocus = m_pForcedFocus.lock();
|
||||||
|
|
||||||
if (!forcedFocus)
|
if (!forcedFocus)
|
||||||
forcedFocus = g_pCompositor->getForceFocus();
|
forcedFocus = g_pCompositor->getForceFocus();
|
||||||
|
@ -213,9 +213,9 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
surfacePos = foundPopup->globalBox().pos();
|
surfacePos = foundPopup->globalBox().pos();
|
||||||
m_bFocusHeldByButtons = true;
|
m_bFocusHeldByButtons = true;
|
||||||
m_bRefocusHeldByButtons = refocus;
|
m_bRefocusHeldByButtons = refocus;
|
||||||
} else if (g_pCompositor->m_pLastWindow) {
|
} else if (!g_pCompositor->m_pLastWindow.expired()) {
|
||||||
foundSurface = m_pLastMouseSurface;
|
foundSurface = m_pLastMouseSurface;
|
||||||
pFoundWindow = g_pCompositor->m_pLastWindow;
|
pFoundWindow = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
surfaceCoords = g_pCompositor->vectorToSurfaceLocal(mouseCoords, pFoundWindow, foundSurface);
|
surfaceCoords = g_pCompositor->vectorToSurfaceLocal(mouseCoords, pFoundWindow, foundSurface);
|
||||||
m_bFocusHeldByButtons = true;
|
m_bFocusHeldByButtons = true;
|
||||||
|
@ -226,7 +226,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
|
|
||||||
g_pLayoutManager->getCurrentLayout()->onMouseMove(getMouseCoordsInternal());
|
g_pLayoutManager->getCurrentLayout()->onMouseMove(getMouseCoordsInternal());
|
||||||
|
|
||||||
if (PMONITOR && PMONITOR != g_pCompositor->m_pLastMonitor && (*PMOUSEFOCUSMON || refocus) && !m_pForcedFocus)
|
if (PMONITOR && PMONITOR != g_pCompositor->m_pLastMonitor && (*PMOUSEFOCUSMON || refocus) && m_pForcedFocus.expired())
|
||||||
g_pCompositor->setActiveMonitor(PMONITOR);
|
g_pCompositor->setActiveMonitor(PMONITOR);
|
||||||
|
|
||||||
if (g_pSessionLockManager->isSessionLocked()) {
|
if (g_pSessionLockManager->isSessionLocked()) {
|
||||||
|
@ -356,7 +356,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
wlr_seat_pointer_clear_focus(g_pCompositor->m_sSeat.seat);
|
wlr_seat_pointer_clear_focus(g_pCompositor->m_sSeat.seat);
|
||||||
m_pLastMouseSurface = nullptr;
|
m_pLastMouseSurface = nullptr;
|
||||||
|
|
||||||
if (refocus || !g_pCompositor->m_pLastWindow) // if we are forcing a refocus, and we don't find a surface, clear the kb focus too!
|
if (refocus || g_pCompositor->m_pLastWindow.expired()) // if we are forcing a refocus, and we don't find a surface, clear the kb focus too!
|
||||||
g_pCompositor->focusWindow(nullptr);
|
g_pCompositor->focusWindow(nullptr);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -393,7 +393,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
m_pFoundSurfaceToFocus = foundSurface;
|
m_pFoundSurfaceToFocus = foundSurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentlyDraggedWindow && pFoundWindow != currentlyDraggedWindow) {
|
if (currentlyDraggedWindow.lock() && pFoundWindow != currentlyDraggedWindow.lock()) {
|
||||||
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
|
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
|
||||||
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, time, surfaceLocal.x, surfaceLocal.y);
|
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, time, surfaceLocal.x, surfaceLocal.y);
|
||||||
return;
|
return;
|
||||||
|
@ -418,8 +418,9 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FOLLOWMOUSE != 1 && !refocus) {
|
if (FOLLOWMOUSE != 1 && !refocus) {
|
||||||
if (pFoundWindow != g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow &&
|
if (pFoundWindow != g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow.lock() &&
|
||||||
((pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR == 2) || (g_pCompositor->m_pLastWindow->m_bIsFloating != pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR != 0))) {
|
((pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR == 2) ||
|
||||||
|
(g_pCompositor->m_pLastWindow.lock()->m_bIsFloating != pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR != 0))) {
|
||||||
// enter if change floating style
|
// enter if change floating style
|
||||||
if (FOLLOWMOUSE != 3 && allowKeyboardRefocus)
|
if (FOLLOWMOUSE != 3 && allowKeyboardRefocus)
|
||||||
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
||||||
|
@ -430,24 +431,24 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
|
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pFoundWindow == g_pCompositor->m_pLastWindow) {
|
if (pFoundWindow == g_pCompositor->m_pLastWindow.lock()) {
|
||||||
m_pLastMouseSurface = foundSurface;
|
m_pLastMouseSurface = foundSurface;
|
||||||
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
|
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FOLLOWMOUSE != 0 || pFoundWindow == g_pCompositor->m_pLastWindow)
|
if (FOLLOWMOUSE != 0 || pFoundWindow == g_pCompositor->m_pLastWindow.lock())
|
||||||
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, time, surfaceLocal.x, surfaceLocal.y);
|
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, time, surfaceLocal.x, surfaceLocal.y);
|
||||||
|
|
||||||
m_bLastFocusOnLS = false;
|
m_bLastFocusOnLS = false;
|
||||||
return; // don't enter any new surfaces
|
return; // don't enter any new surfaces
|
||||||
} else {
|
} else {
|
||||||
if (allowKeyboardRefocus && ((FOLLOWMOUSE != 3 && (*PMOUSEREFOCUS || m_pLastMouseFocus != pFoundWindow)) || refocus)) {
|
if (allowKeyboardRefocus && ((FOLLOWMOUSE != 3 && (*PMOUSEREFOCUS || m_pLastMouseFocus.lock() != pFoundWindow)) || refocus)) {
|
||||||
if (m_pLastMouseFocus != pFoundWindow || g_pCompositor->m_pLastWindow != pFoundWindow || g_pCompositor->m_pLastFocus != foundSurface || refocus) {
|
if (m_pLastMouseFocus.lock() != pFoundWindow || g_pCompositor->m_pLastWindow.lock() != pFoundWindow || g_pCompositor->m_pLastFocus != foundSurface || refocus) {
|
||||||
m_pLastMouseFocus = pFoundWindow;
|
m_pLastMouseFocus = pFoundWindow;
|
||||||
|
|
||||||
// TODO: this looks wrong. When over a popup, it constantly is switching.
|
// TODO: this looks wrong. When over a popup, it constantly is switching.
|
||||||
// Temp fix until that's figured out. Otherwise spams windowrule lookups and other shit.
|
// Temp fix until that's figured out. Otherwise spams windowrule lookups and other shit.
|
||||||
if (m_pLastMouseFocus != pFoundWindow || g_pCompositor->m_pLastWindow != pFoundWindow)
|
if (m_pLastMouseFocus.lock() != pFoundWindow || g_pCompositor->m_pLastWindow.lock() != pFoundWindow)
|
||||||
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
||||||
else
|
else
|
||||||
g_pCompositor->focusSurface(foundSurface, pFoundWindow);
|
g_pCompositor->focusSurface(foundSurface, pFoundWindow);
|
||||||
|
@ -642,7 +643,7 @@ void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ((!g_pCompositor->m_sSeat.mouse || !isConstrained()) /* No constraints */
|
if ((!g_pCompositor->m_sSeat.mouse || !isConstrained()) /* No constraints */
|
||||||
&& (w && g_pCompositor->m_pLastWindow != w) /* window should change */) {
|
&& (w && g_pCompositor->m_pLastWindow.lock() != w) /* window should change */) {
|
||||||
// a bit hacky
|
// a bit hacky
|
||||||
// if we only pressed one button, allow us to refocus. m_lCurrentlyHeldButtons.size() > 0 will stick the focus
|
// if we only pressed one button, allow us to refocus. m_lCurrentlyHeldButtons.size() > 0 will stick the focus
|
||||||
if (m_lCurrentlyHeldButtons.size() == 1) {
|
if (m_lCurrentlyHeldButtons.size() == 1) {
|
||||||
|
@ -655,8 +656,8 @@ void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if clicked on a floating window make it top
|
// if clicked on a floating window make it top
|
||||||
if (g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bIsFloating)
|
if (g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow.lock()->m_bIsFloating)
|
||||||
g_pCompositor->changeWindowZOrder(g_pCompositor->m_pLastWindow, true);
|
g_pCompositor->changeWindowZOrder(g_pCompositor->m_pLastWindow.lock(), true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case WL_POINTER_BUTTON_STATE_RELEASED: break;
|
case WL_POINTER_BUTTON_STATE_RELEASED: break;
|
||||||
|
@ -1615,7 +1616,7 @@ void CInputManager::releaseAllMouseButtons() {
|
||||||
m_lCurrentlyHeldButtons.clear();
|
m_lCurrentlyHeldButtons.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::setCursorIconOnBorder(CWindow* w) {
|
void CInputManager::setCursorIconOnBorder(PHLWINDOW w) {
|
||||||
// do not override cursor icons set by mouse binds
|
// do not override cursor icons set by mouse binds
|
||||||
if (g_pKeybindManager->m_bIsMouseBindActive) {
|
if (g_pKeybindManager->m_bIsMouseBindActive) {
|
||||||
m_eBorderIconDirection = BORDERICON_NONE;
|
m_eBorderIconDirection = BORDERICON_NONE;
|
||||||
|
@ -1636,7 +1637,7 @@ void CInputManager::setCursorIconOnBorder(CWindow* w) {
|
||||||
|
|
||||||
if (w->hasPopupAt(mouseCoords))
|
if (w->hasPopupAt(mouseCoords))
|
||||||
direction = BORDERICON_NONE;
|
direction = BORDERICON_NONE;
|
||||||
else if (!boxFullGrabInput.containsPoint(mouseCoords) || (!m_lCurrentlyHeldButtons.empty() && !currentlyDraggedWindow))
|
else if (!boxFullGrabInput.containsPoint(mouseCoords) || (!m_lCurrentlyHeldButtons.empty() && currentlyDraggedWindow.expired()))
|
||||||
direction = BORDERICON_NONE;
|
direction = BORDERICON_NONE;
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ enum eBorderIconDirection {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct STouchData {
|
struct STouchData {
|
||||||
CWindow* touchFocusWindow = nullptr;
|
PHLWINDOWREF touchFocusWindow;
|
||||||
SLayerSurface* touchFocusLS = nullptr;
|
SLayerSurface* touchFocusLS = nullptr;
|
||||||
wlr_surface* touchFocusSurface = nullptr;
|
wlr_surface* touchFocusSurface = nullptr;
|
||||||
Vector2D touchSurfaceOrigin;
|
Vector2D touchSurfaceOrigin;
|
||||||
|
@ -114,12 +114,12 @@ class CInputManager {
|
||||||
STouchData m_sTouchData;
|
STouchData m_sTouchData;
|
||||||
|
|
||||||
// for dragging floating windows
|
// for dragging floating windows
|
||||||
CWindow* currentlyDraggedWindow = nullptr;
|
PHLWINDOWREF currentlyDraggedWindow;
|
||||||
eMouseBindMode dragMode = MBIND_INVALID;
|
eMouseBindMode dragMode = MBIND_INVALID;
|
||||||
bool m_bWasDraggingWindow = false;
|
bool m_bWasDraggingWindow = false;
|
||||||
|
|
||||||
// for refocus to be forced
|
// for refocus to be forced
|
||||||
CWindow* m_pForcedFocus = nullptr;
|
PHLWINDOWREF m_pForcedFocus;
|
||||||
|
|
||||||
SDrag m_sDrag;
|
SDrag m_sDrag;
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ class CInputManager {
|
||||||
bool m_bLastInputTouch = false;
|
bool m_bLastInputTouch = false;
|
||||||
|
|
||||||
// for tracking mouse refocus
|
// for tracking mouse refocus
|
||||||
CWindow* m_pLastMouseFocus = nullptr;
|
PHLWINDOWREF m_pLastMouseFocus;
|
||||||
wlr_surface* m_pLastMouseSurface = nullptr;
|
wlr_surface* m_pLastMouseSurface = nullptr;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -226,7 +226,7 @@ class CInputManager {
|
||||||
// this will be set after a refocus()
|
// this will be set after a refocus()
|
||||||
wlr_surface* m_pFoundSurfaceToFocus = nullptr;
|
wlr_surface* m_pFoundSurfaceToFocus = nullptr;
|
||||||
SLayerSurface* m_pFoundLSToFocus = nullptr;
|
SLayerSurface* m_pFoundLSToFocus = nullptr;
|
||||||
CWindow* m_pFoundWindowToFocus = nullptr;
|
PHLWINDOWREF m_pFoundWindowToFocus;
|
||||||
|
|
||||||
// for holding focus on buttons held
|
// for holding focus on buttons held
|
||||||
bool m_bFocusHeldByButtons = false;
|
bool m_bFocusHeldByButtons = false;
|
||||||
|
@ -238,7 +238,7 @@ class CInputManager {
|
||||||
// idle inhibitors
|
// idle inhibitors
|
||||||
struct SIdleInhibitor {
|
struct SIdleInhibitor {
|
||||||
std::shared_ptr<CIdleInhibitor> inhibitor;
|
std::shared_ptr<CIdleInhibitor> inhibitor;
|
||||||
CWindow* pWindow = nullptr;
|
PHLWINDOWREF pWindow;
|
||||||
CHyprSignalListener windowDestroyListener;
|
CHyprSignalListener windowDestroyListener;
|
||||||
};
|
};
|
||||||
std::vector<std::unique_ptr<SIdleInhibitor>> m_vIdleInhibitors;
|
std::vector<std::unique_ptr<SIdleInhibitor>> m_vIdleInhibitors;
|
||||||
|
@ -249,7 +249,7 @@ class CInputManager {
|
||||||
void endWorkspaceSwipe();
|
void endWorkspaceSwipe();
|
||||||
|
|
||||||
void setBorderCursorIcon(eBorderIconDirection);
|
void setBorderCursorIcon(eBorderIconDirection);
|
||||||
void setCursorIconOnBorder(CWindow* w);
|
void setCursorIconOnBorder(PHLWINDOW w);
|
||||||
|
|
||||||
// temporary. Obeys setUntilUnset.
|
// temporary. Obeys setUntilUnset.
|
||||||
void setCursorImageOverride(const std::string& name);
|
void setCursorImageOverride(const std::string& name);
|
||||||
|
|
|
@ -263,7 +263,7 @@ void CInputManager::newTabletPad(wlr_input_device* pDevice) {
|
||||||
void CInputManager::focusTablet(STablet* pTab, wlr_tablet_tool* pTool, bool motion) {
|
void CInputManager::focusTablet(STablet* pTab, wlr_tablet_tool* pTool, bool motion) {
|
||||||
const auto PTOOL = g_pInputManager->ensureTabletToolPresent(pTool);
|
const auto PTOOL = g_pInputManager->ensureTabletToolPresent(pTool);
|
||||||
|
|
||||||
if (const auto PWINDOW = g_pCompositor->m_pLastWindow; PWINDOW) {
|
if (const auto PWINDOW = g_pCompositor->m_pLastWindow.lock(); PWINDOW) {
|
||||||
const auto CURSORPOS = g_pInputManager->getMouseCoordsInternal();
|
const auto CURSORPOS = g_pInputManager->getMouseCoordsInternal();
|
||||||
|
|
||||||
if (PTOOL->pSurface != g_pInputManager->m_pLastMouseSurface)
|
if (PTOOL->pSurface != g_pInputManager->m_pLastMouseSurface)
|
||||||
|
|
|
@ -64,12 +64,13 @@ void CInputManager::onTouchDown(wlr_touch_down_event* e) {
|
||||||
|
|
||||||
Vector2D local;
|
Vector2D local;
|
||||||
|
|
||||||
if (m_sTouchData.touchFocusWindow) {
|
if (!m_sTouchData.touchFocusWindow.expired()) {
|
||||||
if (m_sTouchData.touchFocusWindow->m_bIsX11) {
|
if (m_sTouchData.touchFocusWindow.lock()->m_bIsX11) {
|
||||||
local = (g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusWindow->m_vRealPosition.goal()) * m_sTouchData.touchFocusWindow->m_fX11SurfaceScaledBy;
|
local = (g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusWindow.lock()->m_vRealPosition.goal()) *
|
||||||
m_sTouchData.touchSurfaceOrigin = m_sTouchData.touchFocusWindow->m_vRealPosition.goal();
|
m_sTouchData.touchFocusWindow.lock()->m_fX11SurfaceScaledBy;
|
||||||
|
m_sTouchData.touchSurfaceOrigin = m_sTouchData.touchFocusWindow.lock()->m_vRealPosition.goal();
|
||||||
} else {
|
} else {
|
||||||
g_pCompositor->vectorWindowToSurface(g_pInputManager->getMouseCoordsInternal(), m_sTouchData.touchFocusWindow, local);
|
g_pCompositor->vectorWindowToSurface(g_pInputManager->getMouseCoordsInternal(), m_sTouchData.touchFocusWindow.lock(), local);
|
||||||
m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local;
|
m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local;
|
||||||
}
|
}
|
||||||
} else if (m_sTouchData.touchFocusLS) {
|
} else if (m_sTouchData.touchFocusLS) {
|
||||||
|
@ -126,14 +127,14 @@ void CInputManager::onTouchMove(wlr_touch_motion_event* e) {
|
||||||
updateWorkspaceSwipe(SWIPEDISTANCE * (1 - (VERTANIMS ? e->y : e->x)));
|
updateWorkspaceSwipe(SWIPEDISTANCE * (1 - (VERTANIMS ? e->y : e->x)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_sTouchData.touchFocusWindow && g_pCompositor->windowValidMapped(m_sTouchData.touchFocusWindow)) {
|
if (validMapped(m_sTouchData.touchFocusWindow)) {
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_sTouchData.touchFocusWindow->m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_sTouchData.touchFocusWindow.lock()->m_iMonitorID);
|
||||||
|
|
||||||
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr, PMONITOR->vecPosition.x + e->x * PMONITOR->vecSize.x, PMONITOR->vecPosition.y + e->y * PMONITOR->vecSize.y);
|
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr, PMONITOR->vecPosition.x + e->x * PMONITOR->vecSize.x, PMONITOR->vecPosition.y + e->y * PMONITOR->vecSize.y);
|
||||||
|
|
||||||
auto local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchSurfaceOrigin;
|
auto local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchSurfaceOrigin;
|
||||||
if (m_sTouchData.touchFocusWindow->m_bIsX11)
|
if (m_sTouchData.touchFocusWindow.lock()->m_bIsX11)
|
||||||
local = local * m_sTouchData.touchFocusWindow->m_fX11SurfaceScaledBy;
|
local = local * m_sTouchData.touchFocusWindow.lock()->m_fX11SurfaceScaledBy;
|
||||||
|
|
||||||
wlr_seat_touch_notify_motion(g_pCompositor->m_sSeat.seat, e->time_msec, e->touch_id, local.x, local.y);
|
wlr_seat_touch_notify_motion(g_pCompositor->m_sSeat.seat, e->time_msec, e->touch_id, local.x, local.y);
|
||||||
// wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, e->time_msec, local.x, local.y);
|
// wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, e->time_msec, local.x, local.y);
|
||||||
|
|
|
@ -99,13 +99,13 @@ APICALL bool HyprlandAPI::removeFunctionHook(HANDLE handle, CFunctionHook* hook)
|
||||||
return g_pFunctionHookSystem->removeHook(hook);
|
return g_pFunctionHookSystem->removeHook(hook);
|
||||||
}
|
}
|
||||||
|
|
||||||
APICALL bool HyprlandAPI::addWindowDecoration(HANDLE handle, CWindow* pWindow, std::unique_ptr<IHyprWindowDecoration> pDecoration) {
|
APICALL bool HyprlandAPI::addWindowDecoration(HANDLE handle, PHLWINDOW pWindow, std::unique_ptr<IHyprWindowDecoration> pDecoration) {
|
||||||
auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle);
|
auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle);
|
||||||
|
|
||||||
if (!PLUGIN)
|
if (!PLUGIN)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!g_pCompositor->windowValidMapped(pWindow))
|
if (!validMapped(pWindow))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
PLUGIN->registeredDecorations.push_back(pDecoration.get());
|
PLUGIN->registeredDecorations.push_back(pDecoration.get());
|
||||||
|
|
|
@ -61,6 +61,10 @@ class IHyprLayout;
|
||||||
class CWindow;
|
class CWindow;
|
||||||
class IHyprWindowDecoration;
|
class IHyprWindowDecoration;
|
||||||
struct SConfigValue;
|
struct SConfigValue;
|
||||||
|
class CWindow;
|
||||||
|
|
||||||
|
typedef std::shared_ptr<CWindow> PHLWINDOW;
|
||||||
|
typedef std::weak_ptr<CWindow> PHLWINDOWREF;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
These methods are for the plugin to implement
|
These methods are for the plugin to implement
|
||||||
|
@ -219,7 +223,7 @@ namespace HyprlandAPI {
|
||||||
|
|
||||||
returns: true on success. False otherwise.
|
returns: true on success. False otherwise.
|
||||||
*/
|
*/
|
||||||
APICALL bool addWindowDecoration(HANDLE handle, CWindow* pWindow, std::unique_ptr<IHyprWindowDecoration> pDecoration);
|
APICALL bool addWindowDecoration(HANDLE handle, PHLWINDOW pWindow, std::unique_ptr<IHyprWindowDecoration> pDecoration);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Removes a window decoration
|
Removes a window decoration
|
||||||
|
|
|
@ -97,8 +97,8 @@ void CPluginSystem::unloadPlugin(const CPlugin* plugin, bool eject) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& [k, v] : plugin->registeredCallbacks) {
|
for (auto& [k, v] : plugin->registeredCallbacks) {
|
||||||
if (const auto SP = v.lock())
|
if (const auto SHP = v.lock())
|
||||||
g_pHookSystem->unhook(SP);
|
g_pHookSystem->unhook(SHP);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ls = plugin->registeredLayouts;
|
const auto ls = plugin->registeredLayouts;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#define LOGM PROTO::foreignToplevel->protoLog
|
#define LOGM PROTO::foreignToplevel->protoLog
|
||||||
|
|
||||||
CForeignToplevelHandle::CForeignToplevelHandle(SP<CExtForeignToplevelHandleV1> resource_, CWindow* pWindow_) : resource(resource_), pWindow(pWindow_) {
|
CForeignToplevelHandle::CForeignToplevelHandle(SP<CExtForeignToplevelHandleV1> resource_, PHLWINDOW pWindow_) : resource(resource_), pWindow(pWindow_) {
|
||||||
if (!resource_->resource())
|
if (!resource_->resource())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ bool CForeignToplevelHandle::good() {
|
||||||
return resource->resource();
|
return resource->resource();
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CForeignToplevelHandle::window() {
|
PHLWINDOW CForeignToplevelHandle::window() {
|
||||||
return pWindow;
|
return pWindow.lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
CForeignToplevelList::CForeignToplevelList(SP<CExtForeignToplevelListV1> resource_) : resource(resource_) {
|
CForeignToplevelList::CForeignToplevelList(SP<CExtForeignToplevelListV1> resource_) : resource(resource_) {
|
||||||
|
@ -36,11 +36,11 @@ CForeignToplevelList::CForeignToplevelList(SP<CExtForeignToplevelListV1> resourc
|
||||||
if (!w->m_bIsMapped || w->m_bFadingOut)
|
if (!w->m_bIsMapped || w->m_bFadingOut)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
onMap(w.get());
|
onMap(w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CForeignToplevelList::onMap(CWindow* pWindow) {
|
void CForeignToplevelList::onMap(PHLWINDOW pWindow) {
|
||||||
if (finished)
|
if (finished)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ void CForeignToplevelList::onMap(CWindow* pWindow) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto IDENTIFIER = std::format("{:08x}->{:016x}", static_cast<uint32_t>((uintptr_t)this & 0xFFFFFFFF), (uintptr_t)pWindow);
|
const auto IDENTIFIER = std::format("{:08x}->{:016x}", static_cast<uint32_t>((uintptr_t)this & 0xFFFFFFFF), (uintptr_t)pWindow.get());
|
||||||
|
|
||||||
LOGM(LOG, "Newly mapped window gets an identifier of {}", IDENTIFIER);
|
LOGM(LOG, "Newly mapped window gets an identifier of {}", IDENTIFIER);
|
||||||
resource->sendToplevel(NEWHANDLE->resource.get());
|
resource->sendToplevel(NEWHANDLE->resource.get());
|
||||||
|
@ -66,13 +66,13 @@ void CForeignToplevelList::onMap(CWindow* pWindow) {
|
||||||
handles.push_back(NEWHANDLE);
|
handles.push_back(NEWHANDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
SP<CForeignToplevelHandle> CForeignToplevelList::handleForWindow(CWindow* pWindow) {
|
SP<CForeignToplevelHandle> CForeignToplevelList::handleForWindow(PHLWINDOW pWindow) {
|
||||||
std::erase_if(handles, [](const auto& wp) { return !wp.lock(); });
|
std::erase_if(handles, [](const auto& wp) { return wp.expired(); });
|
||||||
const auto IT = std::find_if(handles.begin(), handles.end(), [pWindow](const auto& h) { return h.lock()->window() == pWindow; });
|
const auto IT = std::find_if(handles.begin(), handles.end(), [pWindow](const auto& h) { return h.lock()->window() == pWindow; });
|
||||||
return IT == handles.end() ? SP<CForeignToplevelHandle>{} : IT->lock();
|
return IT == handles.end() ? SP<CForeignToplevelHandle>{} : IT->lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CForeignToplevelList::onTitle(CWindow* pWindow) {
|
void CForeignToplevelList::onTitle(PHLWINDOW pWindow) {
|
||||||
if (finished)
|
if (finished)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ void CForeignToplevelList::onTitle(CWindow* pWindow) {
|
||||||
H->resource->sendTitle(pWindow->m_szTitle.c_str());
|
H->resource->sendTitle(pWindow->m_szTitle.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CForeignToplevelList::onClass(CWindow* pWindow) {
|
void CForeignToplevelList::onClass(PHLWINDOW pWindow) {
|
||||||
if (finished)
|
if (finished)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ void CForeignToplevelList::onClass(CWindow* pWindow) {
|
||||||
H->resource->sendAppId(g_pXWaylandManager->getAppIDClass(pWindow).c_str());
|
H->resource->sendAppId(g_pXWaylandManager->getAppIDClass(pWindow).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CForeignToplevelList::onUnmap(CWindow* pWindow) {
|
void CForeignToplevelList::onUnmap(PHLWINDOW pWindow) {
|
||||||
if (finished)
|
if (finished)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -113,19 +113,19 @@ bool CForeignToplevelList::good() {
|
||||||
CForeignToplevelProtocol::CForeignToplevelProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
CForeignToplevelProtocol::CForeignToplevelProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||||
static auto P = g_pHookSystem->hookDynamic("openWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
static auto P = g_pHookSystem->hookDynamic("openWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
for (auto& m : m_vManagers) {
|
for (auto& m : m_vManagers) {
|
||||||
m->onMap(std::any_cast<CWindow*>(data));
|
m->onMap(std::any_cast<PHLWINDOW>(data));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
for (auto& m : m_vManagers) {
|
for (auto& m : m_vManagers) {
|
||||||
m->onUnmap(std::any_cast<CWindow*>(data));
|
m->onUnmap(std::any_cast<PHLWINDOW>(data));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
static auto P2 = g_pHookSystem->hookDynamic("windowTitle", [this](void* self, SCallbackInfo& info, std::any data) {
|
static auto P2 = g_pHookSystem->hookDynamic("windowTitle", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
for (auto& m : m_vManagers) {
|
for (auto& m : m_vManagers) {
|
||||||
m->onTitle(std::any_cast<CWindow*>(data));
|
m->onTitle(std::any_cast<PHLWINDOW>(data));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,19 +6,17 @@
|
||||||
#include "WaylandProtocol.hpp"
|
#include "WaylandProtocol.hpp"
|
||||||
#include "ext-foreign-toplevel-list-v1.hpp"
|
#include "ext-foreign-toplevel-list-v1.hpp"
|
||||||
|
|
||||||
class CWindow;
|
|
||||||
|
|
||||||
class CForeignToplevelHandle {
|
class CForeignToplevelHandle {
|
||||||
public:
|
public:
|
||||||
CForeignToplevelHandle(SP<CExtForeignToplevelHandleV1> resource_, CWindow* pWindow);
|
CForeignToplevelHandle(SP<CExtForeignToplevelHandleV1> resource_, PHLWINDOW pWindow);
|
||||||
|
|
||||||
bool good();
|
bool good();
|
||||||
CWindow* window();
|
PHLWINDOW window();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SP<CExtForeignToplevelHandleV1> resource;
|
SP<CExtForeignToplevelHandleV1> resource;
|
||||||
CWindow* pWindow = nullptr;
|
PHLWINDOWREF pWindow;
|
||||||
bool closed = false;
|
bool closed = false;
|
||||||
|
|
||||||
friend class CForeignToplevelList;
|
friend class CForeignToplevelList;
|
||||||
};
|
};
|
||||||
|
@ -27,10 +25,10 @@ class CForeignToplevelList {
|
||||||
public:
|
public:
|
||||||
CForeignToplevelList(SP<CExtForeignToplevelListV1> resource_);
|
CForeignToplevelList(SP<CExtForeignToplevelListV1> resource_);
|
||||||
|
|
||||||
void onMap(CWindow* pWindow);
|
void onMap(PHLWINDOW pWindow);
|
||||||
void onTitle(CWindow* pWindow);
|
void onTitle(PHLWINDOW pWindow);
|
||||||
void onClass(CWindow* pWindow);
|
void onClass(PHLWINDOW pWindow);
|
||||||
void onUnmap(CWindow* pWindow);
|
void onUnmap(PHLWINDOW pWindow);
|
||||||
|
|
||||||
bool good();
|
bool good();
|
||||||
|
|
||||||
|
@ -38,7 +36,7 @@ class CForeignToplevelList {
|
||||||
SP<CExtForeignToplevelListV1> resource;
|
SP<CExtForeignToplevelListV1> resource;
|
||||||
bool finished = false;
|
bool finished = false;
|
||||||
|
|
||||||
SP<CForeignToplevelHandle> handleForWindow(CWindow* pWindow);
|
SP<CForeignToplevelHandle> handleForWindow(PHLWINDOW pWindow);
|
||||||
|
|
||||||
std::vector<WP<CForeignToplevelHandle>> handles;
|
std::vector<WP<CForeignToplevelHandle>> handles;
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#define LOGM PROTO::foreignToplevelWlr->protoLog
|
#define LOGM PROTO::foreignToplevelWlr->protoLog
|
||||||
|
|
||||||
CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHandleV1> resource_, CWindow* pWindow_) : resource(resource_), pWindow(pWindow_) {
|
CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHandleV1> resource_, PHLWINDOW pWindow_) : resource(resource_), pWindow(pWindow_) {
|
||||||
if (!resource_->resource())
|
if (!resource_->resource())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -12,70 +12,82 @@ CForeignToplevelHandleWlr::CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHand
|
||||||
resource->setDestroy([this](CZwlrForeignToplevelHandleV1* h) { PROTO::foreignToplevelWlr->destroyHandle(this); });
|
resource->setDestroy([this](CZwlrForeignToplevelHandleV1* h) { PROTO::foreignToplevelWlr->destroyHandle(this); });
|
||||||
|
|
||||||
resource->setActivate([this](CZwlrForeignToplevelHandleV1* p, wl_resource* seat) {
|
resource->setActivate([this](CZwlrForeignToplevelHandleV1* p, wl_resource* seat) {
|
||||||
if (!pWindow)
|
const auto PWINDOW = pWindow.lock();
|
||||||
|
|
||||||
|
if (!PWINDOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pWindow->m_eSuppressedEvents & SUPPRESS_ACTIVATE)
|
if (PWINDOW->m_eSuppressedEvents & SUPPRESS_ACTIVATE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pWindow->activate();
|
PWINDOW->activate();
|
||||||
});
|
});
|
||||||
|
|
||||||
resource->setSetFullscreen([this](CZwlrForeignToplevelHandleV1* p, wl_resource* output) {
|
resource->setSetFullscreen([this](CZwlrForeignToplevelHandleV1* p, wl_resource* output) {
|
||||||
if (!pWindow)
|
const auto PWINDOW = pWindow.lock();
|
||||||
|
|
||||||
|
if (!PWINDOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pWindow->m_eSuppressedEvents & SUPPRESS_FULLSCREEN)
|
if (PWINDOW->m_eSuppressedEvents & SUPPRESS_FULLSCREEN)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!pWindow->m_bIsMapped) {
|
if (!PWINDOW->m_bIsMapped) {
|
||||||
pWindow->m_bWantsInitialFullscreen = true;
|
PWINDOW->m_bWantsInitialFullscreen = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pCompositor->setWindowFullscreen(pWindow, true);
|
g_pCompositor->setWindowFullscreen(PWINDOW, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
resource->setUnsetFullscreen([this](CZwlrForeignToplevelHandleV1* p) {
|
resource->setUnsetFullscreen([this](CZwlrForeignToplevelHandleV1* p) {
|
||||||
if (!pWindow)
|
const auto PWINDOW = pWindow.lock();
|
||||||
|
|
||||||
|
if (!PWINDOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pWindow->m_eSuppressedEvents & SUPPRESS_FULLSCREEN)
|
if (PWINDOW->m_eSuppressedEvents & SUPPRESS_FULLSCREEN)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_pCompositor->setWindowFullscreen(pWindow, false);
|
g_pCompositor->setWindowFullscreen(PWINDOW, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
resource->setSetMaximized([this](CZwlrForeignToplevelHandleV1* p) {
|
resource->setSetMaximized([this](CZwlrForeignToplevelHandleV1* p) {
|
||||||
if (!pWindow)
|
const auto PWINDOW = pWindow.lock();
|
||||||
|
|
||||||
|
if (!PWINDOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pWindow->m_eSuppressedEvents & SUPPRESS_MAXIMIZE)
|
if (PWINDOW->m_eSuppressedEvents & SUPPRESS_MAXIMIZE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!pWindow->m_bIsMapped) {
|
if (!PWINDOW->m_bIsMapped) {
|
||||||
pWindow->m_bWantsInitialFullscreen = true;
|
PWINDOW->m_bWantsInitialFullscreen = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pCompositor->setWindowFullscreen(pWindow, true, FULLSCREEN_MAXIMIZED);
|
g_pCompositor->setWindowFullscreen(PWINDOW, true, FULLSCREEN_MAXIMIZED);
|
||||||
});
|
});
|
||||||
|
|
||||||
resource->setUnsetMaximized([this](CZwlrForeignToplevelHandleV1* p) {
|
resource->setUnsetMaximized([this](CZwlrForeignToplevelHandleV1* p) {
|
||||||
if (!pWindow)
|
const auto PWINDOW = pWindow.lock();
|
||||||
|
|
||||||
|
if (!PWINDOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pWindow->m_eSuppressedEvents & SUPPRESS_MAXIMIZE)
|
if (PWINDOW->m_eSuppressedEvents & SUPPRESS_MAXIMIZE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_pCompositor->setWindowFullscreen(pWindow, false);
|
g_pCompositor->setWindowFullscreen(PWINDOW, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
resource->setClose([this](CZwlrForeignToplevelHandleV1* p) {
|
resource->setClose([this](CZwlrForeignToplevelHandleV1* p) {
|
||||||
if (!pWindow)
|
const auto PWINDOW = pWindow.lock();
|
||||||
|
|
||||||
|
if (!PWINDOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_pCompositor->closeWindow(pWindow);
|
g_pCompositor->closeWindow(PWINDOW);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,8 +95,8 @@ bool CForeignToplevelHandleWlr::good() {
|
||||||
return resource->resource();
|
return resource->resource();
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CForeignToplevelHandleWlr::window() {
|
PHLWINDOW CForeignToplevelHandleWlr::window() {
|
||||||
return pWindow;
|
return pWindow.lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_resource* CForeignToplevelHandleWlr::res() {
|
wl_resource* CForeignToplevelHandleWlr::res() {
|
||||||
|
@ -119,20 +131,22 @@ void CForeignToplevelHandleWlr::sendMonitor(CMonitor* pMonitor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CForeignToplevelHandleWlr::sendState() {
|
void CForeignToplevelHandleWlr::sendState() {
|
||||||
if (!pWindow || !pWindow->m_pWorkspace || !pWindow->m_bIsMapped)
|
const auto PWINDOW = pWindow.lock();
|
||||||
|
|
||||||
|
if (!PWINDOW || !PWINDOW->m_pWorkspace || !PWINDOW->m_bIsMapped)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wl_array state;
|
wl_array state;
|
||||||
wl_array_init(&state);
|
wl_array_init(&state);
|
||||||
|
|
||||||
if (pWindow == g_pCompositor->m_pLastWindow) {
|
if (PWINDOW == g_pCompositor->m_pLastWindow.lock()) {
|
||||||
auto p = (uint32_t*)wl_array_add(&state, sizeof(uint32_t));
|
auto p = (uint32_t*)wl_array_add(&state, sizeof(uint32_t));
|
||||||
*p = ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_ACTIVATED;
|
*p = ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_ACTIVATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pWindow->m_bIsFullscreen) {
|
if (PWINDOW->m_bIsFullscreen) {
|
||||||
auto p = (uint32_t*)wl_array_add(&state, sizeof(uint32_t));
|
auto p = (uint32_t*)wl_array_add(&state, sizeof(uint32_t));
|
||||||
if (pWindow->m_pWorkspace->m_efFullscreenMode == FULLSCREEN_FULL)
|
if (PWINDOW->m_pWorkspace->m_efFullscreenMode == FULLSCREEN_FULL)
|
||||||
*p = ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_FULLSCREEN;
|
*p = ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_FULLSCREEN;
|
||||||
else
|
else
|
||||||
*p = ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MAXIMIZED;
|
*p = ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MAXIMIZED;
|
||||||
|
@ -160,13 +174,13 @@ CForeignToplevelWlrManager::CForeignToplevelWlrManager(SP<CZwlrForeignToplevelMa
|
||||||
if (!w->m_bIsMapped || w->m_bFadingOut)
|
if (!w->m_bIsMapped || w->m_bFadingOut)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
onMap(w.get());
|
onMap(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastFocus = g_pCompositor->m_pLastWindow;
|
lastFocus = g_pCompositor->m_pLastWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CForeignToplevelWlrManager::onMap(CWindow* pWindow) {
|
void CForeignToplevelWlrManager::onMap(PHLWINDOW pWindow) {
|
||||||
if (finished)
|
if (finished)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -180,7 +194,7 @@ void CForeignToplevelWlrManager::onMap(CWindow* pWindow) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGM(LOG, "Newly mapped window {:016x}", (uintptr_t)pWindow);
|
LOGM(LOG, "Newly mapped window {:016x}", (uintptr_t)pWindow.get());
|
||||||
resource->sendToplevel(NEWHANDLE->resource.get());
|
resource->sendToplevel(NEWHANDLE->resource.get());
|
||||||
NEWHANDLE->resource->sendAppId(pWindow->m_szInitialClass.c_str());
|
NEWHANDLE->resource->sendAppId(pWindow->m_szInitialClass.c_str());
|
||||||
NEWHANDLE->resource->sendTitle(pWindow->m_szInitialTitle.c_str());
|
NEWHANDLE->resource->sendTitle(pWindow->m_szInitialTitle.c_str());
|
||||||
|
@ -192,13 +206,13 @@ void CForeignToplevelWlrManager::onMap(CWindow* pWindow) {
|
||||||
handles.push_back(NEWHANDLE);
|
handles.push_back(NEWHANDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
SP<CForeignToplevelHandleWlr> CForeignToplevelWlrManager::handleForWindow(CWindow* pWindow) {
|
SP<CForeignToplevelHandleWlr> CForeignToplevelWlrManager::handleForWindow(PHLWINDOW pWindow) {
|
||||||
std::erase_if(handles, [](const auto& wp) { return !wp.lock(); });
|
std::erase_if(handles, [](const auto& wp) { return wp.expired(); });
|
||||||
const auto IT = std::find_if(handles.begin(), handles.end(), [pWindow](const auto& h) { return h.lock()->window() == pWindow; });
|
const auto IT = std::find_if(handles.begin(), handles.end(), [pWindow](const auto& h) { return h.lock()->window() == pWindow; });
|
||||||
return IT == handles.end() ? SP<CForeignToplevelHandleWlr>{} : IT->lock();
|
return IT == handles.end() ? SP<CForeignToplevelHandleWlr>{} : IT->lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CForeignToplevelWlrManager::onTitle(CWindow* pWindow) {
|
void CForeignToplevelWlrManager::onTitle(PHLWINDOW pWindow) {
|
||||||
if (finished)
|
if (finished)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -210,7 +224,7 @@ void CForeignToplevelWlrManager::onTitle(CWindow* pWindow) {
|
||||||
H->resource->sendDone();
|
H->resource->sendDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CForeignToplevelWlrManager::onClass(CWindow* pWindow) {
|
void CForeignToplevelWlrManager::onClass(PHLWINDOW pWindow) {
|
||||||
if (finished)
|
if (finished)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -222,7 +236,7 @@ void CForeignToplevelWlrManager::onClass(CWindow* pWindow) {
|
||||||
H->resource->sendDone();
|
H->resource->sendDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CForeignToplevelWlrManager::onUnmap(CWindow* pWindow) {
|
void CForeignToplevelWlrManager::onUnmap(PHLWINDOW pWindow) {
|
||||||
if (finished)
|
if (finished)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -235,7 +249,7 @@ void CForeignToplevelWlrManager::onUnmap(CWindow* pWindow) {
|
||||||
H->closed = true;
|
H->closed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CForeignToplevelWlrManager::onMoveMonitor(CWindow* pWindow) {
|
void CForeignToplevelWlrManager::onMoveMonitor(PHLWINDOW pWindow) {
|
||||||
if (finished)
|
if (finished)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -252,7 +266,7 @@ void CForeignToplevelWlrManager::onMoveMonitor(CWindow* pWindow) {
|
||||||
H->resource->sendDone();
|
H->resource->sendDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CForeignToplevelWlrManager::onFullscreen(CWindow* pWindow) {
|
void CForeignToplevelWlrManager::onFullscreen(PHLWINDOW pWindow) {
|
||||||
if (finished)
|
if (finished)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -264,11 +278,11 @@ void CForeignToplevelWlrManager::onFullscreen(CWindow* pWindow) {
|
||||||
H->resource->sendDone();
|
H->resource->sendDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CForeignToplevelWlrManager::onNewFocus(CWindow* pWindow) {
|
void CForeignToplevelWlrManager::onNewFocus(PHLWINDOW pWindow) {
|
||||||
if (finished)
|
if (finished)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (const auto HOLD = handleForWindow(lastFocus); HOLD) {
|
if (const auto HOLD = handleForWindow(lastFocus.lock()); HOLD) {
|
||||||
HOLD->sendState();
|
HOLD->sendState();
|
||||||
HOLD->resource->sendDone();
|
HOLD->resource->sendDone();
|
||||||
}
|
}
|
||||||
|
@ -289,42 +303,42 @@ bool CForeignToplevelWlrManager::good() {
|
||||||
|
|
||||||
CForeignToplevelWlrProtocol::CForeignToplevelWlrProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
CForeignToplevelWlrProtocol::CForeignToplevelWlrProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||||
static auto P = g_pHookSystem->hookDynamic("openWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
static auto P = g_pHookSystem->hookDynamic("openWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
const auto PWINDOW = std::any_cast<CWindow*>(data);
|
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||||
for (auto& m : m_vManagers) {
|
for (auto& m : m_vManagers) {
|
||||||
m->onMap(PWINDOW);
|
m->onMap(PWINDOW);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
const auto PWINDOW = std::any_cast<CWindow*>(data);
|
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||||
for (auto& m : m_vManagers) {
|
for (auto& m : m_vManagers) {
|
||||||
m->onUnmap(PWINDOW);
|
m->onUnmap(PWINDOW);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
static auto P2 = g_pHookSystem->hookDynamic("windowTitle", [this](void* self, SCallbackInfo& info, std::any data) {
|
static auto P2 = g_pHookSystem->hookDynamic("windowTitle", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
const auto PWINDOW = std::any_cast<CWindow*>(data);
|
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||||
for (auto& m : m_vManagers) {
|
for (auto& m : m_vManagers) {
|
||||||
m->onTitle(PWINDOW);
|
m->onTitle(PWINDOW);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
static auto P3 = g_pHookSystem->hookDynamic("activeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
static auto P3 = g_pHookSystem->hookDynamic("activeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
const auto PWINDOW = std::any_cast<CWindow*>(data);
|
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||||
for (auto& m : m_vManagers) {
|
for (auto& m : m_vManagers) {
|
||||||
m->onNewFocus(PWINDOW);
|
m->onNewFocus(PWINDOW);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
static auto P4 = g_pHookSystem->hookDynamic("moveWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
static auto P4 = g_pHookSystem->hookDynamic("moveWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
const auto PWINDOW = std::any_cast<CWindow*>(std::any_cast<std::vector<std::any>>(data).at(0));
|
const auto PWINDOW = std::any_cast<PHLWINDOW>(std::any_cast<std::vector<std::any>>(data).at(0));
|
||||||
for (auto& m : m_vManagers) {
|
for (auto& m : m_vManagers) {
|
||||||
m->onMoveMonitor(PWINDOW);
|
m->onMoveMonitor(PWINDOW);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
static auto P5 = g_pHookSystem->hookDynamic("fullscreen", [this](void* self, SCallbackInfo& info, std::any data) {
|
static auto P5 = g_pHookSystem->hookDynamic("fullscreen", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
const auto PWINDOW = std::any_cast<CWindow*>(data);
|
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||||
for (auto& m : m_vManagers) {
|
for (auto& m : m_vManagers) {
|
||||||
m->onFullscreen(PWINDOW);
|
m->onFullscreen(PWINDOW);
|
||||||
}
|
}
|
||||||
|
@ -350,7 +364,7 @@ void CForeignToplevelWlrProtocol::destroyHandle(CForeignToplevelHandleWlr* handl
|
||||||
std::erase_if(m_vHandles, [&](const auto& other) { return other.get() == handle; });
|
std::erase_if(m_vHandles, [&](const auto& other) { return other.get() == handle; });
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* CForeignToplevelWlrProtocol::windowFromHandleResource(wl_resource* res) {
|
PHLWINDOW CForeignToplevelWlrProtocol::windowFromHandleResource(wl_resource* res) {
|
||||||
for (auto& h : m_vHandles) {
|
for (auto& h : m_vHandles) {
|
||||||
if (h->res() != res)
|
if (h->res() != res)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -10,15 +10,15 @@ class CMonitor;
|
||||||
|
|
||||||
class CForeignToplevelHandleWlr {
|
class CForeignToplevelHandleWlr {
|
||||||
public:
|
public:
|
||||||
CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHandleV1> resource_, CWindow* pWindow);
|
CForeignToplevelHandleWlr(SP<CZwlrForeignToplevelHandleV1> resource_, PHLWINDOW pWindow);
|
||||||
|
|
||||||
bool good();
|
bool good();
|
||||||
CWindow* window();
|
PHLWINDOW window();
|
||||||
wl_resource* res();
|
wl_resource* res();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SP<CZwlrForeignToplevelHandleV1> resource;
|
SP<CZwlrForeignToplevelHandleV1> resource;
|
||||||
CWindow* pWindow = nullptr;
|
PHLWINDOWREF pWindow;
|
||||||
bool closed = false;
|
bool closed = false;
|
||||||
int64_t lastMonitorID = -1;
|
int64_t lastMonitorID = -1;
|
||||||
|
|
||||||
|
@ -32,22 +32,22 @@ class CForeignToplevelWlrManager {
|
||||||
public:
|
public:
|
||||||
CForeignToplevelWlrManager(SP<CZwlrForeignToplevelManagerV1> resource_);
|
CForeignToplevelWlrManager(SP<CZwlrForeignToplevelManagerV1> resource_);
|
||||||
|
|
||||||
void onMap(CWindow* pWindow);
|
void onMap(PHLWINDOW pWindow);
|
||||||
void onTitle(CWindow* pWindow);
|
void onTitle(PHLWINDOW pWindow);
|
||||||
void onClass(CWindow* pWindow);
|
void onClass(PHLWINDOW pWindow);
|
||||||
void onMoveMonitor(CWindow* pWindow);
|
void onMoveMonitor(PHLWINDOW pWindow);
|
||||||
void onFullscreen(CWindow* pWindow);
|
void onFullscreen(PHLWINDOW pWindow);
|
||||||
void onNewFocus(CWindow* pWindow);
|
void onNewFocus(PHLWINDOW pWindow);
|
||||||
void onUnmap(CWindow* pWindow);
|
void onUnmap(PHLWINDOW pWindow);
|
||||||
|
|
||||||
bool good();
|
bool good();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SP<CZwlrForeignToplevelManagerV1> resource;
|
SP<CZwlrForeignToplevelManagerV1> resource;
|
||||||
bool finished = false;
|
bool finished = false;
|
||||||
CWindow* lastFocus = nullptr; // READ-ONLY
|
PHLWINDOWREF lastFocus; // READ-ONLY
|
||||||
|
|
||||||
SP<CForeignToplevelHandleWlr> handleForWindow(CWindow* pWindow);
|
SP<CForeignToplevelHandleWlr> handleForWindow(PHLWINDOW pWindow);
|
||||||
|
|
||||||
std::vector<WP<CForeignToplevelHandleWlr>> handles;
|
std::vector<WP<CForeignToplevelHandleWlr>> handles;
|
||||||
};
|
};
|
||||||
|
@ -58,7 +58,7 @@ class CForeignToplevelWlrProtocol : public IWaylandProtocol {
|
||||||
|
|
||||||
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
||||||
|
|
||||||
CWindow* windowFromHandleResource(wl_resource* res);
|
PHLWINDOW windowFromHandleResource(wl_resource* res);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onManagerResourceDestroy(CForeignToplevelWlrManager* mgr);
|
void onManagerResourceDestroy(CForeignToplevelWlrManager* mgr);
|
||||||
|
|
|
@ -56,7 +56,7 @@ struct SScreencopyFrame {
|
||||||
wlr_buffer* buffer = nullptr;
|
wlr_buffer* buffer = nullptr;
|
||||||
|
|
||||||
CMonitor* pMonitor = nullptr;
|
CMonitor* pMonitor = nullptr;
|
||||||
CWindow* pWindow = nullptr;
|
PHLWINDOWREF pWindow;
|
||||||
|
|
||||||
bool operator==(const SScreencopyFrame& other) const {
|
bool operator==(const SScreencopyFrame& other) const {
|
||||||
return resource == other.resource && client == other.client;
|
return resource == other.resource && client == other.client;
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
|
|
||||||
CTearingControlProtocol::CTearingControlProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
CTearingControlProtocol::CTearingControlProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||||
static auto P = g_pHookSystem->hookDynamic("destroyWindow", [this](void* self, SCallbackInfo& info, std::any param) { this->onWindowDestroy(std::any_cast<CWindow*>(param)); });
|
static auto P =
|
||||||
|
g_pHookSystem->hookDynamic("destroyWindow", [this](void* self, SCallbackInfo& info, std::any param) { this->onWindowDestroy(std::any_cast<PHLWINDOW>(param)); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTearingControlProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
|
void CTearingControlProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
|
||||||
|
@ -36,10 +37,10 @@ void CTearingControlProtocol::onControllerDestroy(CTearingControl* control) {
|
||||||
std::erase_if(m_vTearingControllers, [control](const auto& other) { return other.get() == control; });
|
std::erase_if(m_vTearingControllers, [control](const auto& other) { return other.get() == control; });
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTearingControlProtocol::onWindowDestroy(CWindow* pWindow) {
|
void CTearingControlProtocol::onWindowDestroy(PHLWINDOW pWindow) {
|
||||||
for (auto& c : m_vTearingControllers) {
|
for (auto& c : m_vTearingControllers) {
|
||||||
if (c->pWindow == pWindow)
|
if (c->pWindow.lock() == pWindow)
|
||||||
c->pWindow = nullptr;
|
c->pWindow.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ CTearingControl::CTearingControl(SP<CWpTearingControlV1> resource_, wlr_surface*
|
||||||
|
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (w->m_pWLSurface.wlr() == surf_) {
|
if (w->m_pWLSurface.wlr() == surf_) {
|
||||||
pWindow = w.get();
|
pWindow = w;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,10 +66,10 @@ void CTearingControl::onHint(wpTearingControlV1PresentationHint hint_) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTearingControl::updateWindow() {
|
void CTearingControl::updateWindow() {
|
||||||
if (!pWindow)
|
if (pWindow.expired())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pWindow->m_bTearingHint = hint == WP_TEARING_CONTROL_V1_PRESENTATION_HINT_ASYNC;
|
pWindow.lock()->m_bTearingHint = hint == WP_TEARING_CONTROL_V1_PRESENTATION_HINT_ASYNC;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CTearingControl::good() {
|
bool CTearingControl::good() {
|
||||||
|
|
|
@ -27,8 +27,8 @@ class CTearingControl {
|
||||||
void updateWindow();
|
void updateWindow();
|
||||||
|
|
||||||
SP<CWpTearingControlV1> resource;
|
SP<CWpTearingControlV1> resource;
|
||||||
CWindow* pWindow = nullptr;
|
PHLWINDOWREF pWindow;
|
||||||
wpTearingControlV1PresentationHint hint = WP_TEARING_CONTROL_V1_PRESENTATION_HINT_VSYNC;
|
wpTearingControlV1PresentationHint hint = WP_TEARING_CONTROL_V1_PRESENTATION_HINT_VSYNC;
|
||||||
|
|
||||||
friend class CTearingControlProtocol;
|
friend class CTearingControlProtocol;
|
||||||
};
|
};
|
||||||
|
@ -43,7 +43,7 @@ class CTearingControlProtocol : public IWaylandProtocol {
|
||||||
void onManagerResourceDestroy(wl_resource* res);
|
void onManagerResourceDestroy(wl_resource* res);
|
||||||
void onControllerDestroy(CTearingControl* control);
|
void onControllerDestroy(CTearingControl* control);
|
||||||
void onGetController(wl_client* client, wl_resource* resource, uint32_t id, wlr_surface* surf);
|
void onGetController(wl_client* client, wl_resource* resource, uint32_t id, wlr_surface* surf);
|
||||||
void onWindowDestroy(CWindow* pWindow);
|
void onWindowDestroy(PHLWINDOW pWindow);
|
||||||
|
|
||||||
//
|
//
|
||||||
std::vector<UP<CWpTearingControlManagerV1>> m_vManagers;
|
std::vector<UP<CWpTearingControlManagerV1>> m_vManagers;
|
||||||
|
|
|
@ -136,7 +136,7 @@ void CToplevelExportProtocolManager::removeFrame(SScreencopyFrame* frame, bool f
|
||||||
m_lFrames.remove(*frame);
|
m_lFrames.remove(*frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CToplevelExportProtocolManager::captureToplevel(wl_client* client, wl_resource* resource, uint32_t frame, int32_t overlay_cursor, CWindow* pWindow) {
|
void CToplevelExportProtocolManager::captureToplevel(wl_client* client, wl_resource* resource, uint32_t frame, int32_t overlay_cursor, PHLWINDOW pWindow) {
|
||||||
const auto PCLIENT = clientFromResource(resource);
|
const auto PCLIENT = clientFromResource(resource);
|
||||||
|
|
||||||
// create a frame
|
// create a frame
|
||||||
|
@ -145,15 +145,15 @@ void CToplevelExportProtocolManager::captureToplevel(wl_client* client, wl_resou
|
||||||
PFRAME->resource = wl_resource_create(client, &hyprland_toplevel_export_frame_v1_interface, wl_resource_get_version(resource), frame);
|
PFRAME->resource = wl_resource_create(client, &hyprland_toplevel_export_frame_v1_interface, wl_resource_get_version(resource), frame);
|
||||||
PFRAME->pWindow = pWindow;
|
PFRAME->pWindow = pWindow;
|
||||||
|
|
||||||
if (!PFRAME->pWindow) {
|
if (!pWindow) {
|
||||||
Debug::log(ERR, "Client requested sharing of window handle {:x} which does not exist!", PFRAME->pWindow);
|
Debug::log(ERR, "Client requested sharing of window handle {:x} which does not exist!", pWindow);
|
||||||
hyprland_toplevel_export_frame_v1_send_failed(PFRAME->resource);
|
hyprland_toplevel_export_frame_v1_send_failed(PFRAME->resource);
|
||||||
removeFrame(PFRAME);
|
removeFrame(PFRAME);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PFRAME->pWindow->m_bIsMapped || PFRAME->pWindow->isHidden()) {
|
if (!pWindow->m_bIsMapped || pWindow->isHidden()) {
|
||||||
Debug::log(ERR, "Client requested sharing of window handle {:x} which is not shareable!", PFRAME->pWindow);
|
Debug::log(ERR, "Client requested sharing of window handle {:x} which is not shareable!", pWindow);
|
||||||
hyprland_toplevel_export_frame_v1_send_failed(PFRAME->resource);
|
hyprland_toplevel_export_frame_v1_send_failed(PFRAME->resource);
|
||||||
removeFrame(PFRAME);
|
removeFrame(PFRAME);
|
||||||
return;
|
return;
|
||||||
|
@ -171,7 +171,7 @@ void CToplevelExportProtocolManager::captureToplevel(wl_client* client, wl_resou
|
||||||
PFRAME->client = PCLIENT;
|
PFRAME->client = PCLIENT;
|
||||||
PCLIENT->ref++;
|
PCLIENT->ref++;
|
||||||
|
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(PFRAME->pWindow->m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
|
||||||
|
|
||||||
g_pHyprRenderer->makeEGLCurrent();
|
g_pHyprRenderer->makeEGLCurrent();
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ void CToplevelExportProtocolManager::captureToplevel(wl_client* client, wl_resou
|
||||||
PFRAME->dmabufFormat = DRM_FORMAT_INVALID;
|
PFRAME->dmabufFormat = DRM_FORMAT_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
PFRAME->box = {0, 0, (int)(PFRAME->pWindow->m_vRealSize.value().x * PMONITOR->scale), (int)(PFRAME->pWindow->m_vRealSize.value().y * PMONITOR->scale)};
|
PFRAME->box = {0, 0, (int)(pWindow->m_vRealSize.value().x * PMONITOR->scale), (int)(pWindow->m_vRealSize.value().y * PMONITOR->scale)};
|
||||||
int ow, oh;
|
int ow, oh;
|
||||||
wlr_output_effective_resolution(PMONITOR->output, &ow, &oh);
|
wlr_output_effective_resolution(PMONITOR->output, &ow, &oh);
|
||||||
PFRAME->box.transform(PMONITOR->transform, ow, oh).round();
|
PFRAME->box.transform(PMONITOR->transform, ow, oh).round();
|
||||||
|
@ -221,15 +221,17 @@ void CToplevelExportProtocolManager::copyFrame(wl_client* client, wl_resource* r
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_pCompositor->windowValidMapped(PFRAME->pWindow)) {
|
const auto PWINDOW = PFRAME->pWindow.lock();
|
||||||
Debug::log(ERR, "Client requested sharing of window handle {:x} which is gone!", (uintptr_t)PFRAME->pWindow);
|
|
||||||
|
if (!validMapped(PWINDOW)) {
|
||||||
|
Debug::log(ERR, "Client requested sharing of window handle {:x} which is gone!", (uintptr_t)PWINDOW.get());
|
||||||
hyprland_toplevel_export_frame_v1_send_failed(PFRAME->resource);
|
hyprland_toplevel_export_frame_v1_send_failed(PFRAME->resource);
|
||||||
removeFrame(PFRAME);
|
removeFrame(PFRAME);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PFRAME->pWindow->m_bIsMapped || PFRAME->pWindow->isHidden()) {
|
if (!PWINDOW->m_bIsMapped || PWINDOW->isHidden()) {
|
||||||
Debug::log(ERR, "Client requested sharing of window handle {:x} which is not shareable (2)!", PFRAME->pWindow);
|
Debug::log(ERR, "Client requested sharing of window handle {:x} which is not shareable (2)!", PWINDOW);
|
||||||
hyprland_toplevel_export_frame_v1_send_failed(PFRAME->resource);
|
hyprland_toplevel_export_frame_v1_send_failed(PFRAME->resource);
|
||||||
removeFrame(PFRAME);
|
removeFrame(PFRAME);
|
||||||
return;
|
return;
|
||||||
|
@ -299,15 +301,17 @@ void CToplevelExportProtocolManager::onOutputCommit(CMonitor* pMonitor, wlr_outp
|
||||||
|
|
||||||
// share frame if correct output
|
// share frame if correct output
|
||||||
for (auto& f : m_vFramesAwaitingWrite) {
|
for (auto& f : m_vFramesAwaitingWrite) {
|
||||||
if (!f->pWindow) {
|
const auto PWINDOW = f->pWindow.lock();
|
||||||
|
|
||||||
|
if (!validMapped(PWINDOW)) {
|
||||||
framesToRemove.push_back(f);
|
framesToRemove.push_back(f);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PMONITOR != g_pCompositor->getMonitorFromID(f->pWindow->m_iMonitorID))
|
if (PMONITOR != g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CBox geometry = {f->pWindow->m_vRealPosition.value().x, f->pWindow->m_vRealPosition.value().y, f->pWindow->m_vRealSize.value().x, f->pWindow->m_vRealSize.value().y};
|
CBox geometry = {PWINDOW->m_vRealPosition.value().x, PWINDOW->m_vRealPosition.value().y, PWINDOW->m_vRealSize.value().x, PWINDOW->m_vRealSize.value().y};
|
||||||
|
|
||||||
if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, pMonitor->output, geometry.pWlr()))
|
if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, pMonitor->output, geometry.pWlr()))
|
||||||
continue;
|
continue;
|
||||||
|
@ -326,7 +330,7 @@ void CToplevelExportProtocolManager::onOutputCommit(CMonitor* pMonitor, wlr_outp
|
||||||
}
|
}
|
||||||
|
|
||||||
void CToplevelExportProtocolManager::shareFrame(SScreencopyFrame* frame) {
|
void CToplevelExportProtocolManager::shareFrame(SScreencopyFrame* frame) {
|
||||||
if (!frame->buffer || !g_pCompositor->windowValidMapped(frame->pWindow))
|
if (!frame->buffer || !validMapped(frame->pWindow))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
timespec now;
|
timespec now;
|
||||||
|
@ -365,7 +369,7 @@ bool CToplevelExportProtocolManager::copyFrameShm(SScreencopyFrame* frame, times
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// render the client
|
// render the client
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(frame->pWindow->m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(frame->pWindow.lock()->m_iMonitorID);
|
||||||
CRegion fakeDamage{0, 0, PMONITOR->vecPixelSize.x * 10, PMONITOR->vecPixelSize.y * 10};
|
CRegion fakeDamage{0, 0, PMONITOR->vecPixelSize.x * 10, PMONITOR->vecPixelSize.y * 10};
|
||||||
|
|
||||||
g_pHyprRenderer->makeEGLCurrent();
|
g_pHyprRenderer->makeEGLCurrent();
|
||||||
|
@ -384,12 +388,12 @@ bool CToplevelExportProtocolManager::copyFrameShm(SScreencopyFrame* frame, times
|
||||||
g_pHyprOpenGL->clear(CColor(0, 0, 0, 1.0));
|
g_pHyprOpenGL->clear(CColor(0, 0, 0, 1.0));
|
||||||
|
|
||||||
// render client at 0,0
|
// render client at 0,0
|
||||||
g_pHyprRenderer->m_bBlockSurfaceFeedback = g_pHyprRenderer->shouldRenderWindow(frame->pWindow); // block the feedback to avoid spamming the surface if it's visible
|
g_pHyprRenderer->m_bBlockSurfaceFeedback = g_pHyprRenderer->shouldRenderWindow(frame->pWindow.lock()); // block the feedback to avoid spamming the surface if it's visible
|
||||||
g_pHyprRenderer->renderWindow(frame->pWindow, PMONITOR, now, false, RENDER_PASS_ALL, true, true);
|
g_pHyprRenderer->renderWindow(frame->pWindow.lock(), PMONITOR, now, false, RENDER_PASS_ALL, true, true);
|
||||||
g_pHyprRenderer->m_bBlockSurfaceFeedback = false;
|
g_pHyprRenderer->m_bBlockSurfaceFeedback = false;
|
||||||
|
|
||||||
if (frame->overlayCursor)
|
if (frame->overlayCursor)
|
||||||
g_pHyprRenderer->renderSoftwareCursors(PMONITOR, fakeDamage, g_pInputManager->getMouseCoordsInternal() - frame->pWindow->m_vRealPosition.value());
|
g_pHyprRenderer->renderSoftwareCursors(PMONITOR, fakeDamage, g_pInputManager->getMouseCoordsInternal() - frame->pWindow.lock()->m_vRealPosition.value());
|
||||||
|
|
||||||
const auto PFORMAT = g_pHyprOpenGL->getPixelFormatFromDRM(format);
|
const auto PFORMAT = g_pHyprOpenGL->getPixelFormatFromDRM(format);
|
||||||
if (!PFORMAT) {
|
if (!PFORMAT) {
|
||||||
|
@ -422,7 +426,7 @@ bool CToplevelExportProtocolManager::copyFrameShm(SScreencopyFrame* frame, times
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CToplevelExportProtocolManager::copyFrameDmabuf(SScreencopyFrame* frame, timespec* now) {
|
bool CToplevelExportProtocolManager::copyFrameDmabuf(SScreencopyFrame* frame, timespec* now) {
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(frame->pWindow->m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(frame->pWindow.lock()->m_iMonitorID);
|
||||||
|
|
||||||
CRegion fakeDamage{0, 0, INT16_MAX, INT16_MAX};
|
CRegion fakeDamage{0, 0, INT16_MAX, INT16_MAX};
|
||||||
|
|
||||||
|
@ -431,21 +435,21 @@ bool CToplevelExportProtocolManager::copyFrameDmabuf(SScreencopyFrame* frame, ti
|
||||||
|
|
||||||
g_pHyprOpenGL->clear(CColor(0, 0, 0, 1.0));
|
g_pHyprOpenGL->clear(CColor(0, 0, 0, 1.0));
|
||||||
|
|
||||||
g_pHyprRenderer->m_bBlockSurfaceFeedback = g_pHyprRenderer->shouldRenderWindow(frame->pWindow); // block the feedback to avoid spamming the surface if it's visible
|
g_pHyprRenderer->m_bBlockSurfaceFeedback = g_pHyprRenderer->shouldRenderWindow(frame->pWindow.lock()); // block the feedback to avoid spamming the surface if it's visible
|
||||||
g_pHyprRenderer->renderWindow(frame->pWindow, PMONITOR, now, false, RENDER_PASS_ALL, true, true);
|
g_pHyprRenderer->renderWindow(frame->pWindow.lock(), PMONITOR, now, false, RENDER_PASS_ALL, true, true);
|
||||||
g_pHyprRenderer->m_bBlockSurfaceFeedback = false;
|
g_pHyprRenderer->m_bBlockSurfaceFeedback = false;
|
||||||
|
|
||||||
if (frame->overlayCursor)
|
if (frame->overlayCursor)
|
||||||
g_pHyprRenderer->renderSoftwareCursors(PMONITOR, fakeDamage, g_pInputManager->getMouseCoordsInternal() - frame->pWindow->m_vRealPosition.value());
|
g_pHyprRenderer->renderSoftwareCursors(PMONITOR, fakeDamage, g_pInputManager->getMouseCoordsInternal() - frame->pWindow.lock()->m_vRealPosition.value());
|
||||||
|
|
||||||
g_pHyprOpenGL->m_RenderData.blockScreenShader = true;
|
g_pHyprOpenGL->m_RenderData.blockScreenShader = true;
|
||||||
g_pHyprRenderer->endRender();
|
g_pHyprRenderer->endRender();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CToplevelExportProtocolManager::onWindowUnmap(CWindow* pWindow) {
|
void CToplevelExportProtocolManager::onWindowUnmap(PHLWINDOW pWindow) {
|
||||||
for (auto& f : m_lFrames) {
|
for (auto& f : m_lFrames) {
|
||||||
if (f.pWindow == pWindow)
|
if (f.pWindow.lock() == pWindow)
|
||||||
f.pWindow = nullptr;
|
f.pWindow.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,12 +15,12 @@ class CToplevelExportProtocolManager {
|
||||||
CToplevelExportProtocolManager();
|
CToplevelExportProtocolManager();
|
||||||
|
|
||||||
void bindManager(wl_client* client, void* data, uint32_t version, uint32_t id);
|
void bindManager(wl_client* client, void* data, uint32_t version, uint32_t id);
|
||||||
void captureToplevel(wl_client* client, wl_resource* resource, uint32_t frame, int32_t overlay_cursor, CWindow* handle);
|
void captureToplevel(wl_client* client, wl_resource* resource, uint32_t frame, int32_t overlay_cursor, PHLWINDOW handle);
|
||||||
void removeClient(CScreencopyClient* client, bool force = false);
|
void removeClient(CScreencopyClient* client, bool force = false);
|
||||||
void removeFrame(SScreencopyFrame* frame, bool force = false);
|
void removeFrame(SScreencopyFrame* frame, bool force = false);
|
||||||
void copyFrame(wl_client* client, wl_resource* resource, wl_resource* buffer, int32_t ignore_damage);
|
void copyFrame(wl_client* client, wl_resource* resource, wl_resource* buffer, int32_t ignore_damage);
|
||||||
void displayDestroy();
|
void displayDestroy();
|
||||||
void onWindowUnmap(CWindow* pWindow);
|
void onWindowUnmap(PHLWINDOW pWindow);
|
||||||
void onOutputCommit(CMonitor* pMonitor, wlr_output_event_commit* e);
|
void onOutputCommit(CMonitor* pMonitor, wlr_output_event_commit* e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -9,10 +9,6 @@
|
||||||
if (!resname) \
|
if (!resname) \
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#define SP std::shared_ptr
|
|
||||||
#define UP std::unique_ptr
|
|
||||||
#define WP std::weak_ptr
|
|
||||||
|
|
||||||
#define PROTO NProtocols
|
#define PROTO NProtocols
|
||||||
|
|
||||||
class IWaylandProtocol {
|
class IWaylandProtocol {
|
||||||
|
|
|
@ -167,7 +167,7 @@ bool CHyprOpenGLImpl::passRequiresIntrospection(CMonitor* pMonitor) {
|
||||||
if (m_RenderData.pCurrentMonData->blurFBShouldRender)
|
if (m_RenderData.pCurrentMonData->blurFBShouldRender)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (pMonitor->solitaryClient)
|
if (!pMonitor->solitaryClient.expired())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) {
|
for (auto& ls : pMonitor->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) {
|
||||||
|
@ -224,7 +224,7 @@ bool CHyprOpenGLImpl::passRequiresIntrospection(CMonitor* pMonitor) {
|
||||||
if (!w->m_bIsMapped || w->isHidden())
|
if (!w->m_bIsMapped || w->isHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!g_pHyprRenderer->shouldRenderWindow(w.get()))
|
if (!g_pHyprRenderer->shouldRenderWindow(w))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w->popupsCount() > 0 && *PBLURPOPUPS)
|
if (w->popupsCount() > 0 && *PBLURPOPUPS)
|
||||||
|
@ -873,7 +873,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, CBox*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pCurrentWindow && m_pCurrentWindow->m_sAdditionalConfigData.forceRGBX)
|
if (m_pCurrentWindow.lock() && m_pCurrentWindow.lock()->m_sAdditionalConfigData.forceRGBX)
|
||||||
shader = &m_RenderData.pCurrentMonData->m_shRGBX;
|
shader = &m_RenderData.pCurrentMonData->m_shRGBX;
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
@ -940,9 +940,9 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, CBox*
|
||||||
glUniform2f(shader->fullSize, FULLSIZE.x, FULLSIZE.y);
|
glUniform2f(shader->fullSize, FULLSIZE.x, FULLSIZE.y);
|
||||||
glUniform1f(shader->radius, round);
|
glUniform1f(shader->radius, round);
|
||||||
|
|
||||||
if (allowDim && m_pCurrentWindow && *PDIMINACTIVE) {
|
if (allowDim && m_pCurrentWindow.lock() && *PDIMINACTIVE) {
|
||||||
glUniform1i(shader->applyTint, 1);
|
glUniform1i(shader->applyTint, 1);
|
||||||
const auto DIM = m_pCurrentWindow->m_fDimPercent.value();
|
const auto DIM = m_pCurrentWindow.lock()->m_fDimPercent.value();
|
||||||
glUniform3f(shader->tint, 1.f - DIM, 1.f - DIM, 1.f - DIM);
|
glUniform3f(shader->tint, 1.f - DIM, 1.f - DIM, 1.f - DIM);
|
||||||
} else {
|
} else {
|
||||||
glUniform1i(shader->applyTint, 0);
|
glUniform1i(shader->applyTint, 0);
|
||||||
|
@ -1333,14 +1333,14 @@ void CHyprOpenGLImpl::preRender(CMonitor* pMonitor) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// ignore if solitary present, nothing to blur
|
// ignore if solitary present, nothing to blur
|
||||||
if (pMonitor->solitaryClient)
|
if (!pMonitor->solitaryClient.expired())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// check if we need to update the blur fb
|
// check if we need to update the blur fb
|
||||||
// if there are no windows that would benefit from it,
|
// if there are no windows that would benefit from it,
|
||||||
// we will ignore that the blur FB is dirty.
|
// we will ignore that the blur FB is dirty.
|
||||||
|
|
||||||
auto windowShouldBeBlurred = [&](CWindow* pWindow) -> bool {
|
auto windowShouldBeBlurred = [&](PHLWINDOW pWindow) -> bool {
|
||||||
if (!pWindow)
|
if (!pWindow)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1377,7 +1377,7 @@ void CHyprOpenGLImpl::preRender(CMonitor* pMonitor) {
|
||||||
if (w->m_pWorkspace == pMonitor->activeWorkspace && !w->isHidden() && w->m_bIsMapped && (!w->m_bIsFloating || *PBLURXRAY)) {
|
if (w->m_pWorkspace == pMonitor->activeWorkspace && !w->isHidden() && w->m_bIsMapped && (!w->m_bIsFloating || *PBLURXRAY)) {
|
||||||
|
|
||||||
// check if window is valid
|
// check if window is valid
|
||||||
if (!windowShouldBeBlurred(w.get()))
|
if (!windowShouldBeBlurred(w))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
hasWindows = true;
|
hasWindows = true;
|
||||||
|
@ -1453,7 +1453,7 @@ bool CHyprOpenGLImpl::preBlurQueued() {
|
||||||
return !(!m_RenderData.pCurrentMonData->blurFBDirty || !*PBLURNEWOPTIMIZE || !*PBLUR || !m_RenderData.pCurrentMonData->blurFBShouldRender);
|
return !(!m_RenderData.pCurrentMonData->blurFBDirty || !*PBLURNEWOPTIMIZE || !*PBLUR || !m_RenderData.pCurrentMonData->blurFBShouldRender);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CHyprOpenGLImpl::shouldUseNewBlurOptimizations(SLayerSurface* pLayer, CWindow* pWindow) {
|
bool CHyprOpenGLImpl::shouldUseNewBlurOptimizations(SLayerSurface* pLayer, PHLWINDOW pWindow) {
|
||||||
static auto PBLURNEWOPTIMIZE = CConfigValue<Hyprlang::INT>("decoration:blur:new_optimizations");
|
static auto PBLURNEWOPTIMIZE = CConfigValue<Hyprlang::INT>("decoration:blur:new_optimizations");
|
||||||
static auto PBLURXRAY = CConfigValue<Hyprlang::INT>("decoration:blur:xray");
|
static auto PBLURXRAY = CConfigValue<Hyprlang::INT>("decoration:blur:xray");
|
||||||
|
|
||||||
|
@ -1493,7 +1493,7 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, CBox* pBox, flo
|
||||||
m_RenderData.renderModif.applyToRegion(texDamage);
|
m_RenderData.renderModif.applyToRegion(texDamage);
|
||||||
|
|
||||||
if (*PBLURENABLED == 0 || (*PNOBLUROVERSIZED && m_RenderData.primarySurfaceUVTopLeft != Vector2D(-1, -1)) ||
|
if (*PBLURENABLED == 0 || (*PNOBLUROVERSIZED && m_RenderData.primarySurfaceUVTopLeft != Vector2D(-1, -1)) ||
|
||||||
(m_pCurrentWindow && (m_pCurrentWindow->m_sAdditionalConfigData.forceNoBlur || m_pCurrentWindow->m_sAdditionalConfigData.forceRGBX))) {
|
(m_pCurrentWindow.lock() && (m_pCurrentWindow.lock()->m_sAdditionalConfigData.forceNoBlur || m_pCurrentWindow.lock()->m_sAdditionalConfigData.forceRGBX))) {
|
||||||
renderTexture(tex, pBox, a, round, false, true);
|
renderTexture(tex, pBox, a, round, false, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1517,7 +1517,7 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, CBox* pBox, flo
|
||||||
wlr_region_scale(inverseOpaque.pixman(), inverseOpaque.pixman(), m_RenderData.pMonitor->scale);
|
wlr_region_scale(inverseOpaque.pixman(), inverseOpaque.pixman(), m_RenderData.pMonitor->scale);
|
||||||
|
|
||||||
// vvv TODO: layered blur fbs?
|
// vvv TODO: layered blur fbs?
|
||||||
const bool USENEWOPTIMIZE = shouldUseNewBlurOptimizations(m_pCurrentLayer, m_pCurrentWindow) && !blockBlurOptimization;
|
const bool USENEWOPTIMIZE = shouldUseNewBlurOptimizations(m_pCurrentLayer, m_pCurrentWindow.lock()) && !blockBlurOptimization;
|
||||||
|
|
||||||
CFramebuffer* POUTFB = nullptr;
|
CFramebuffer* POUTFB = nullptr;
|
||||||
if (!USENEWOPTIMIZE) {
|
if (!USENEWOPTIMIZE) {
|
||||||
|
@ -1590,7 +1590,7 @@ void CHyprOpenGLImpl::renderBorder(CBox* box, const CGradientValueData& grad, in
|
||||||
|
|
||||||
TRACY_GPU_ZONE("RenderBorder");
|
TRACY_GPU_ZONE("RenderBorder");
|
||||||
|
|
||||||
if (m_RenderData.damage.empty() || (m_pCurrentWindow && m_pCurrentWindow->m_sAdditionalConfigData.forceNoBorder))
|
if (m_RenderData.damage.empty() || (m_pCurrentWindow.lock() && m_pCurrentWindow.lock()->m_sAdditionalConfigData.forceNoBorder))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CBox newBox = *box;
|
CBox newBox = *box;
|
||||||
|
@ -1681,7 +1681,7 @@ void CHyprOpenGLImpl::renderBorder(CBox* box, const CGradientValueData& grad, in
|
||||||
blend(BLEND);
|
blend(BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::makeRawWindowSnapshot(CWindow* pWindow, CFramebuffer* pFramebuffer) {
|
void CHyprOpenGLImpl::makeRawWindowSnapshot(PHLWINDOW pWindow, CFramebuffer* pFramebuffer) {
|
||||||
// we trust the window is valid.
|
// we trust the window is valid.
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
|
||||||
|
|
||||||
|
@ -1729,7 +1729,7 @@ void CHyprOpenGLImpl::makeRawWindowSnapshot(CWindow* pWindow, CFramebuffer* pFra
|
||||||
g_pHyprRenderer->endRender();
|
g_pHyprRenderer->endRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::makeWindowSnapshot(CWindow* pWindow) {
|
void CHyprOpenGLImpl::makeWindowSnapshot(PHLWINDOW pWindow) {
|
||||||
// we trust the window is valid.
|
// we trust the window is valid.
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
|
||||||
|
|
||||||
|
@ -1742,11 +1742,13 @@ void CHyprOpenGLImpl::makeWindowSnapshot(CWindow* pWindow) {
|
||||||
// we need to "damage" the entire monitor
|
// we need to "damage" the entire monitor
|
||||||
// so that we render the entire window
|
// so that we render the entire window
|
||||||
// this is temporary, doesnt mess with the actual wlr damage
|
// this is temporary, doesnt mess with the actual wlr damage
|
||||||
CRegion fakeDamage{0, 0, (int)PMONITOR->vecTransformedSize.x, (int)PMONITOR->vecTransformedSize.y};
|
CRegion fakeDamage{0, 0, (int)PMONITOR->vecTransformedSize.x, (int)PMONITOR->vecTransformedSize.y};
|
||||||
|
|
||||||
|
PHLWINDOWREF ref{pWindow};
|
||||||
|
|
||||||
g_pHyprRenderer->makeEGLCurrent();
|
g_pHyprRenderer->makeEGLCurrent();
|
||||||
|
|
||||||
const auto PFRAMEBUFFER = &m_mWindowFramebuffers[pWindow];
|
const auto PFRAMEBUFFER = &m_mWindowFramebuffers[ref];
|
||||||
|
|
||||||
PFRAMEBUFFER->alloc(PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y, PMONITOR->drmFormat);
|
PFRAMEBUFFER->alloc(PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y, PMONITOR->drmFormat);
|
||||||
|
|
||||||
|
@ -1819,46 +1821,45 @@ void CHyprOpenGLImpl::makeLayerSnapshot(SLayerSurface* pLayer) {
|
||||||
g_pHyprRenderer->m_bRenderingSnapshot = false;
|
g_pHyprRenderer->m_bRenderingSnapshot = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::renderSnapshot(CWindow** pWindow) {
|
void CHyprOpenGLImpl::renderSnapshot(PHLWINDOW pWindow) {
|
||||||
RASSERT(m_RenderData.pMonitor, "Tried to render snapshot rect without begin()!");
|
RASSERT(m_RenderData.pMonitor, "Tried to render snapshot rect without begin()!");
|
||||||
const auto PWINDOW = *pWindow;
|
|
||||||
|
|
||||||
static auto PDIMAROUND = CConfigValue<Hyprlang::FLOAT>("decoration:dim_around");
|
static auto PDIMAROUND = CConfigValue<Hyprlang::FLOAT>("decoration:dim_around");
|
||||||
|
|
||||||
auto it = m_mWindowFramebuffers.begin();
|
PHLWINDOWREF ref{pWindow};
|
||||||
for (; it != m_mWindowFramebuffers.end(); it++) {
|
|
||||||
if (it->first == PWINDOW) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (it == m_mWindowFramebuffers.end() || !it->second.m_cTex.m_iTexID)
|
if (!m_mWindowFramebuffers.contains(ref))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
|
const auto FBDATA = &m_mWindowFramebuffers.at(ref);
|
||||||
|
|
||||||
|
if (!FBDATA->m_cTex.m_iTexID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
|
||||||
|
|
||||||
CBox windowBox;
|
CBox windowBox;
|
||||||
// some mafs to figure out the correct box
|
// some mafs to figure out the correct box
|
||||||
// the originalClosedPos is relative to the monitor's pos
|
// the originalClosedPos is relative to the monitor's pos
|
||||||
Vector2D scaleXY = Vector2D((PMONITOR->scale * PWINDOW->m_vRealSize.value().x / (PWINDOW->m_vOriginalClosedSize.x * PMONITOR->scale)),
|
Vector2D scaleXY = Vector2D((PMONITOR->scale * pWindow->m_vRealSize.value().x / (pWindow->m_vOriginalClosedSize.x * PMONITOR->scale)),
|
||||||
(PMONITOR->scale * PWINDOW->m_vRealSize.value().y / (PWINDOW->m_vOriginalClosedSize.y * PMONITOR->scale)));
|
(PMONITOR->scale * pWindow->m_vRealSize.value().y / (pWindow->m_vOriginalClosedSize.y * PMONITOR->scale)));
|
||||||
|
|
||||||
windowBox.width = PMONITOR->vecTransformedSize.x * scaleXY.x;
|
windowBox.width = PMONITOR->vecTransformedSize.x * scaleXY.x;
|
||||||
windowBox.height = PMONITOR->vecTransformedSize.y * scaleXY.y;
|
windowBox.height = PMONITOR->vecTransformedSize.y * scaleXY.y;
|
||||||
windowBox.x = ((PWINDOW->m_vRealPosition.value().x - PMONITOR->vecPosition.x) * PMONITOR->scale) - ((PWINDOW->m_vOriginalClosedPos.x * PMONITOR->scale) * scaleXY.x);
|
windowBox.x = ((pWindow->m_vRealPosition.value().x - PMONITOR->vecPosition.x) * PMONITOR->scale) - ((pWindow->m_vOriginalClosedPos.x * PMONITOR->scale) * scaleXY.x);
|
||||||
windowBox.y = ((PWINDOW->m_vRealPosition.value().y - PMONITOR->vecPosition.y) * PMONITOR->scale) - ((PWINDOW->m_vOriginalClosedPos.y * PMONITOR->scale) * scaleXY.y);
|
windowBox.y = ((pWindow->m_vRealPosition.value().y - PMONITOR->vecPosition.y) * PMONITOR->scale) - ((pWindow->m_vOriginalClosedPos.y * PMONITOR->scale) * scaleXY.y);
|
||||||
|
|
||||||
CRegion fakeDamage{0, 0, PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y};
|
CRegion fakeDamage{0, 0, PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y};
|
||||||
|
|
||||||
if (*PDIMAROUND && (*pWindow)->m_sAdditionalConfigData.dimAround) {
|
if (*PDIMAROUND && pWindow->m_sAdditionalConfigData.dimAround) {
|
||||||
CBox monbox = {0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.y};
|
CBox monbox = {0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.y};
|
||||||
g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, *PDIMAROUND * PWINDOW->m_fAlpha.value()));
|
g_pHyprOpenGL->renderRect(&monbox, CColor(0, 0, 0, *PDIMAROUND * pWindow->m_fAlpha.value()));
|
||||||
g_pHyprRenderer->damageMonitor(PMONITOR);
|
g_pHyprRenderer->damageMonitor(PMONITOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bEndFrame = true;
|
m_bEndFrame = true;
|
||||||
|
|
||||||
renderTextureInternalWithDamage(it->second.m_cTex, &windowBox, PWINDOW->m_fAlpha.value(), &fakeDamage, 0);
|
renderTextureInternalWithDamage(FBDATA->m_cTex, &windowBox, pWindow->m_fAlpha.value(), &fakeDamage, 0);
|
||||||
|
|
||||||
m_bEndFrame = false;
|
m_bEndFrame = false;
|
||||||
}
|
}
|
||||||
|
@ -1902,7 +1903,7 @@ void CHyprOpenGLImpl::renderSnapshot(SLayerSurface** pLayer) {
|
||||||
void CHyprOpenGLImpl::renderRoundedShadow(CBox* box, int round, int range, const CColor& color, float a) {
|
void CHyprOpenGLImpl::renderRoundedShadow(CBox* box, int round, int range, const CColor& color, float a) {
|
||||||
RASSERT(m_RenderData.pMonitor, "Tried to render shadow without begin()!");
|
RASSERT(m_RenderData.pMonitor, "Tried to render shadow without begin()!");
|
||||||
RASSERT((box->width > 0 && box->height > 0), "Tried to render shadow with width/height < 0!");
|
RASSERT((box->width > 0 && box->height > 0), "Tried to render shadow with width/height < 0!");
|
||||||
RASSERT(m_pCurrentWindow, "Tried to render shadow without a window!");
|
RASSERT(m_pCurrentWindow.lock(), "Tried to render shadow without a window!");
|
||||||
|
|
||||||
if (m_RenderData.damage.empty())
|
if (m_RenderData.damage.empty())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "../helpers/Region.hpp"
|
#include "../helpers/Region.hpp"
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
#include <cairo/cairo.h>
|
#include <cairo/cairo.h>
|
||||||
|
|
||||||
|
@ -151,12 +152,12 @@ class CHyprOpenGLImpl {
|
||||||
|
|
||||||
void blend(bool enabled);
|
void blend(bool enabled);
|
||||||
|
|
||||||
void makeWindowSnapshot(CWindow*);
|
void makeWindowSnapshot(PHLWINDOW);
|
||||||
void makeRawWindowSnapshot(CWindow*, CFramebuffer*);
|
void makeRawWindowSnapshot(PHLWINDOW, CFramebuffer*);
|
||||||
void makeLayerSnapshot(SLayerSurface*);
|
void makeLayerSnapshot(SLayerSurface*);
|
||||||
void renderSnapshot(CWindow**);
|
void renderSnapshot(PHLWINDOW);
|
||||||
void renderSnapshot(SLayerSurface**);
|
void renderSnapshot(SLayerSurface**);
|
||||||
bool shouldUseNewBlurOptimizations(SLayerSurface* pLayer, CWindow* pWindow);
|
bool shouldUseNewBlurOptimizations(SLayerSurface* pLayer, PHLWINDOW pWindow);
|
||||||
|
|
||||||
void clear(const CColor&);
|
void clear(const CColor&);
|
||||||
void clearWithTex();
|
void clearWithTex();
|
||||||
|
@ -192,13 +193,13 @@ class CHyprOpenGLImpl {
|
||||||
|
|
||||||
bool m_bReloadScreenShader = true; // at launch it can be set
|
bool m_bReloadScreenShader = true; // at launch it can be set
|
||||||
|
|
||||||
CWindow* m_pCurrentWindow = nullptr; // hack to get the current rendered window
|
PHLWINDOWREF m_pCurrentWindow; // hack to get the current rendered window
|
||||||
SLayerSurface* m_pCurrentLayer = nullptr; // hack to get the current rendered layer
|
SLayerSurface* m_pCurrentLayer = nullptr; // hack to get the current rendered layer
|
||||||
|
|
||||||
std::unordered_map<CWindow*, CFramebuffer> m_mWindowFramebuffers;
|
std::map<PHLWINDOWREF, CFramebuffer, std::owner_less<PHLWINDOWREF>> m_mWindowFramebuffers;
|
||||||
std::unordered_map<SLayerSurface*, CFramebuffer> m_mLayerFramebuffers;
|
std::unordered_map<SLayerSurface*, CFramebuffer> m_mLayerFramebuffers;
|
||||||
std::unordered_map<CMonitor*, SMonitorRenderData> m_mMonitorRenderResources;
|
std::unordered_map<CMonitor*, SMonitorRenderData> m_mMonitorRenderResources;
|
||||||
std::unordered_map<CMonitor*, CFramebuffer> m_mMonitorBGFBs;
|
std::unordered_map<CMonitor*, CFramebuffer> m_mMonitorBGFBs;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glEGLImageTargetRenderbufferStorageOES = nullptr;
|
PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glEGLImageTargetRenderbufferStorageOES = nullptr;
|
||||||
|
|
|
@ -86,7 +86,7 @@ CHyprRenderer::CHyprRenderer() {
|
||||||
static void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
|
static void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
|
||||||
const auto TEXTURE = wlr_surface_get_texture(surface);
|
const auto TEXTURE = wlr_surface_get_texture(surface);
|
||||||
const auto RDATA = (SRenderData*)data;
|
const auto RDATA = (SRenderData*)data;
|
||||||
const auto INTERACTIVERESIZEINPROGRESS = RDATA->pWindow && g_pInputManager->currentlyDraggedWindow == RDATA->pWindow && g_pInputManager->dragMode == MBIND_RESIZE;
|
const auto INTERACTIVERESIZEINPROGRESS = RDATA->pWindow && g_pInputManager->currentlyDraggedWindow.lock() == RDATA->pWindow && g_pInputManager->dragMode == MBIND_RESIZE;
|
||||||
|
|
||||||
if (!TEXTURE)
|
if (!TEXTURE)
|
||||||
return;
|
return;
|
||||||
|
@ -214,7 +214,7 @@ static void renderSurface(struct wlr_surface* surface, int x, int y, void* data)
|
||||||
g_pHyprOpenGL->m_RenderData.useNearestNeighbor = NEARESTNEIGHBORSET;
|
g_pHyprOpenGL->m_RenderData.useNearestNeighbor = NEARESTNEIGHBORSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CHyprRenderer::shouldRenderWindow(CWindow* pWindow, CMonitor* pMonitor) {
|
bool CHyprRenderer::shouldRenderWindow(PHLWINDOW pWindow, CMonitor* pMonitor) {
|
||||||
CBox geometry = pWindow->getFullWindowBoundingBox();
|
CBox geometry = pWindow->getFullWindowBoundingBox();
|
||||||
|
|
||||||
if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, pMonitor->output, geometry.pWlr()))
|
if (!wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, pMonitor->output, geometry.pWlr()))
|
||||||
|
@ -278,9 +278,9 @@ bool CHyprRenderer::shouldRenderWindow(CWindow* pWindow, CMonitor* pMonitor) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CHyprRenderer::shouldRenderWindow(CWindow* pWindow) {
|
bool CHyprRenderer::shouldRenderWindow(PHLWINDOW pWindow) {
|
||||||
|
|
||||||
if (!g_pCompositor->windowValidMapped(pWindow))
|
if (!validMapped(pWindow))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const auto PWORKSPACE = pWindow->m_pWorkspace;
|
const auto PWORKSPACE = pWindow->m_pWorkspace;
|
||||||
|
@ -306,13 +306,13 @@ bool CHyprRenderer::shouldRenderWindow(CWindow* pWindow) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::renderWorkspaceWindowsFullscreen(CMonitor* pMonitor, PHLWORKSPACE pWorkspace, timespec* time) {
|
void CHyprRenderer::renderWorkspaceWindowsFullscreen(CMonitor* pMonitor, PHLWORKSPACE pWorkspace, timespec* time) {
|
||||||
CWindow* pWorkspaceWindow = nullptr;
|
PHLWINDOW pWorkspaceWindow = nullptr;
|
||||||
|
|
||||||
EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOWS);
|
EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOWS);
|
||||||
|
|
||||||
// loop over the tiled windows that are fading out
|
// loop over the tiled windows that are fading out
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!shouldRenderWindow(w.get(), pMonitor))
|
if (!shouldRenderWindow(w, pMonitor))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w->m_fAlpha.value() == 0.f)
|
if (w->m_fAlpha.value() == 0.f)
|
||||||
|
@ -324,12 +324,12 @@ void CHyprRenderer::renderWorkspaceWindowsFullscreen(CMonitor* pMonitor, PHLWORK
|
||||||
if (pWorkspace->m_bIsSpecialWorkspace != w->onSpecialWorkspace())
|
if (pWorkspace->m_bIsSpecialWorkspace != w->onSpecialWorkspace())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_ALL);
|
renderWindow(w, pMonitor, time, true, RENDER_PASS_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// and floating ones too
|
// and floating ones too
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!shouldRenderWindow(w.get(), pMonitor))
|
if (!shouldRenderWindow(w, pMonitor))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w->m_fAlpha.value() == 0.f)
|
if (w->m_fAlpha.value() == 0.f)
|
||||||
|
@ -344,7 +344,7 @@ void CHyprRenderer::renderWorkspaceWindowsFullscreen(CMonitor* pMonitor, PHLWORK
|
||||||
if (pWorkspace->m_bIsSpecialWorkspace && w->m_iMonitorID != pWorkspace->m_iMonitorID)
|
if (pWorkspace->m_bIsSpecialWorkspace && w->m_iMonitorID != pWorkspace->m_iMonitorID)
|
||||||
continue; // special on another are rendered as a part of the base pass
|
continue; // special on another are rendered as a part of the base pass
|
||||||
|
|
||||||
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_ALL);
|
renderWindow(w, pMonitor, time, true, RENDER_PASS_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: this pass sucks
|
// TODO: this pass sucks
|
||||||
|
@ -365,13 +365,13 @@ void CHyprRenderer::renderWorkspaceWindowsFullscreen(CMonitor* pMonitor, PHLWORK
|
||||||
if (w->m_iMonitorID == pWorkspace->m_iMonitorID && pWorkspace->m_bIsSpecialWorkspace != w->onSpecialWorkspace())
|
if (w->m_iMonitorID == pWorkspace->m_iMonitorID && pWorkspace->m_bIsSpecialWorkspace != w->onSpecialWorkspace())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (shouldRenderWindow(w.get(), pMonitor))
|
if (shouldRenderWindow(w, pMonitor))
|
||||||
renderWindow(w.get(), pMonitor, time, pWorkspace->m_efFullscreenMode != FULLSCREEN_FULL, RENDER_PASS_ALL);
|
renderWindow(w, pMonitor, time, pWorkspace->m_efFullscreenMode != FULLSCREEN_FULL, RENDER_PASS_ALL);
|
||||||
|
|
||||||
if (w->m_pWorkspace != pWorkspace)
|
if (w->m_pWorkspace != pWorkspace)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pWorkspaceWindow = w.get();
|
pWorkspaceWindow = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pWorkspaceWindow) {
|
if (!pWorkspaceWindow) {
|
||||||
|
@ -391,12 +391,12 @@ void CHyprRenderer::renderWorkspaceWindowsFullscreen(CMonitor* pMonitor, PHLWORK
|
||||||
if (pWorkspace->m_bIsSpecialWorkspace && w->m_iMonitorID != pWorkspace->m_iMonitorID)
|
if (pWorkspace->m_bIsSpecialWorkspace && w->m_iMonitorID != pWorkspace->m_iMonitorID)
|
||||||
continue; // special on another are rendered as a part of the base pass
|
continue; // special on another are rendered as a part of the base pass
|
||||||
|
|
||||||
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_ALL);
|
renderWindow(w, pMonitor, time, true, RENDER_PASS_ALL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::renderWorkspaceWindows(CMonitor* pMonitor, PHLWORKSPACE pWorkspace, timespec* time) {
|
void CHyprRenderer::renderWorkspaceWindows(CMonitor* pMonitor, PHLWORKSPACE pWorkspace, timespec* time) {
|
||||||
CWindow* lastWindow = nullptr;
|
PHLWINDOW lastWindow;
|
||||||
|
|
||||||
EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOWS);
|
EMIT_HOOK_EVENT("render", RENDER_PRE_WINDOWS);
|
||||||
|
|
||||||
|
@ -408,20 +408,20 @@ void CHyprRenderer::renderWorkspaceWindows(CMonitor* pMonitor, PHLWORKSPACE pWor
|
||||||
if (w->m_bIsFloating)
|
if (w->m_bIsFloating)
|
||||||
continue; // floating are in the second pass
|
continue; // floating are in the second pass
|
||||||
|
|
||||||
if (!shouldRenderWindow(w.get(), pMonitor))
|
if (!shouldRenderWindow(w, pMonitor))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pWorkspace->m_bIsSpecialWorkspace != w->onSpecialWorkspace())
|
if (pWorkspace->m_bIsSpecialWorkspace != w->onSpecialWorkspace())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// render active window after all others of this pass
|
// render active window after all others of this pass
|
||||||
if (w.get() == g_pCompositor->m_pLastWindow) {
|
if (w == g_pCompositor->m_pLastWindow.lock()) {
|
||||||
lastWindow = w.get();
|
lastWindow = w;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// render the bad boy
|
// render the bad boy
|
||||||
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_MAIN);
|
renderWindow(w, pMonitor, time, true, RENDER_PASS_MAIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastWindow)
|
if (lastWindow)
|
||||||
|
@ -438,11 +438,11 @@ void CHyprRenderer::renderWorkspaceWindows(CMonitor* pMonitor, PHLWORKSPACE pWor
|
||||||
if (pWorkspace->m_bIsSpecialWorkspace != w->onSpecialWorkspace())
|
if (pWorkspace->m_bIsSpecialWorkspace != w->onSpecialWorkspace())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!shouldRenderWindow(w.get(), pMonitor))
|
if (!shouldRenderWindow(w, pMonitor))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// render the bad boy
|
// render the bad boy
|
||||||
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_POPUP);
|
renderWindow(w, pMonitor, time, true, RENDER_PASS_POPUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
// floating on top
|
// floating on top
|
||||||
|
@ -453,7 +453,7 @@ void CHyprRenderer::renderWorkspaceWindows(CMonitor* pMonitor, PHLWORKSPACE pWor
|
||||||
if (!w->m_bIsFloating || w->m_bPinned)
|
if (!w->m_bIsFloating || w->m_bPinned)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!shouldRenderWindow(w.get(), pMonitor))
|
if (!shouldRenderWindow(w, pMonitor))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pWorkspace->m_bIsSpecialWorkspace != w->onSpecialWorkspace())
|
if (pWorkspace->m_bIsSpecialWorkspace != w->onSpecialWorkspace())
|
||||||
|
@ -463,17 +463,17 @@ void CHyprRenderer::renderWorkspaceWindows(CMonitor* pMonitor, PHLWORKSPACE pWor
|
||||||
continue; // special on another are rendered as a part of the base pass
|
continue; // special on another are rendered as a part of the base pass
|
||||||
|
|
||||||
// render the bad boy
|
// render the bad boy
|
||||||
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_ALL);
|
renderWindow(w, pMonitor, time, true, RENDER_PASS_ALL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec* time, bool decorate, eRenderPassMode mode, bool ignorePosition, bool ignoreAllGeometry) {
|
void CHyprRenderer::renderWindow(PHLWINDOW pWindow, CMonitor* pMonitor, timespec* time, bool decorate, eRenderPassMode mode, bool ignorePosition, bool ignoreAllGeometry) {
|
||||||
if (pWindow->isHidden())
|
if (pWindow->isHidden())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pWindow->m_bFadingOut) {
|
if (pWindow->m_bFadingOut) {
|
||||||
if (pMonitor->ID == pWindow->m_iMonitorID) // TODO: fix this
|
if (pMonitor->ID == pWindow->m_iMonitorID) // TODO: fix this
|
||||||
g_pHyprOpenGL->renderSnapshot(&pWindow);
|
g_pHyprOpenGL->renderSnapshot(pWindow);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -658,7 +658,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec*
|
||||||
|
|
||||||
EMIT_HOOK_EVENT("render", RENDER_POST_WINDOW);
|
EMIT_HOOK_EVENT("render", RENDER_POST_WINDOW);
|
||||||
|
|
||||||
g_pHyprOpenGL->m_pCurrentWindow = nullptr;
|
g_pHyprOpenGL->m_pCurrentWindow.reset();
|
||||||
g_pHyprOpenGL->m_RenderData.clipBox = CBox();
|
g_pHyprOpenGL->m_RenderData.clipBox = CBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -885,11 +885,11 @@ void CHyprRenderer::renderAllClientsForWorkspace(CMonitor* pMonitor, PHLWORKSPAC
|
||||||
if (!w->m_bPinned || !w->m_bIsFloating)
|
if (!w->m_bPinned || !w->m_bIsFloating)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!shouldRenderWindow(w.get(), pMonitor))
|
if (!shouldRenderWindow(w, pMonitor))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// render the bad boy
|
// render the bad boy
|
||||||
renderWindow(w.get(), pMonitor, time, true, RENDER_PASS_ALL);
|
renderWindow(w, pMonitor, time, true, RENDER_PASS_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
EMIT_HOOK_EVENT("render", RENDER_POST_WINDOWS);
|
EMIT_HOOK_EVENT("render", RENDER_POST_WINDOWS);
|
||||||
|
@ -943,7 +943,7 @@ void CHyprRenderer::renderLockscreen(CMonitor* pMonitor, timespec* now, const CB
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::calculateUVForSurface(CWindow* pWindow, wlr_surface* pSurface, bool main, const Vector2D& projSize, bool fixMisalignedFSV1) {
|
void CHyprRenderer::calculateUVForSurface(PHLWINDOW pWindow, wlr_surface* pSurface, bool main, const Vector2D& projSize, bool fixMisalignedFSV1) {
|
||||||
if (!pWindow || !pWindow->m_bIsX11) {
|
if (!pWindow || !pWindow->m_bIsX11) {
|
||||||
Vector2D uvTL;
|
Vector2D uvTL;
|
||||||
Vector2D uvBR = Vector2D(1, 1);
|
Vector2D uvBR = Vector2D(1, 1);
|
||||||
|
@ -1038,7 +1038,7 @@ bool CHyprRenderer::attemptDirectScanout(CMonitor* pMonitor) {
|
||||||
if (!wlr_output_is_direct_scanout_allowed(pMonitor->output))
|
if (!wlr_output_is_direct_scanout_allowed(pMonitor->output))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const auto PCANDIDATE = pMonitor->solitaryClient;
|
const auto PCANDIDATE = pMonitor->solitaryClient.lock();
|
||||||
|
|
||||||
if (!PCANDIDATE)
|
if (!PCANDIDATE)
|
||||||
return false;
|
return false;
|
||||||
|
@ -1060,12 +1060,12 @@ bool CHyprRenderer::attemptDirectScanout(CMonitor* pMonitor) {
|
||||||
wlr_presentation_surface_scanned_out_on_output(PSURFACE, pMonitor->output);
|
wlr_presentation_surface_scanned_out_on_output(PSURFACE, pMonitor->output);
|
||||||
|
|
||||||
if (pMonitor->state.commit()) {
|
if (pMonitor->state.commit()) {
|
||||||
if (!m_pLastScanout) {
|
if (m_pLastScanout.expired()) {
|
||||||
m_pLastScanout = PCANDIDATE;
|
m_pLastScanout = PCANDIDATE;
|
||||||
Debug::log(LOG, "Entered a direct scanout to {:x}: \"{}\"", (uintptr_t)PCANDIDATE, PCANDIDATE->m_szTitle);
|
Debug::log(LOG, "Entered a direct scanout to {:x}: \"{}\"", (uintptr_t)PCANDIDATE.get(), PCANDIDATE->m_szTitle);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_pLastScanout = nullptr;
|
m_pLastScanout.reset();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1171,16 +1171,16 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pMonitor->solitaryClient)
|
if (!pMonitor->solitaryClient.expired())
|
||||||
shouldTear = true;
|
shouldTear = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!*PNODIRECTSCANOUT && !shouldTear) {
|
if (!*PNODIRECTSCANOUT && !shouldTear) {
|
||||||
if (attemptDirectScanout(pMonitor)) {
|
if (attemptDirectScanout(pMonitor)) {
|
||||||
return;
|
return;
|
||||||
} else if (m_pLastScanout) {
|
} else if (!m_pLastScanout.expired()) {
|
||||||
Debug::log(LOG, "Left a direct scanout.");
|
Debug::log(LOG, "Left a direct scanout.");
|
||||||
m_pLastScanout = nullptr;
|
m_pLastScanout.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1285,7 +1285,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
|
||||||
bool renderCursor = true;
|
bool renderCursor = true;
|
||||||
|
|
||||||
if (!finalDamage.empty()) {
|
if (!finalDamage.empty()) {
|
||||||
if (!pMonitor->solitaryClient) {
|
if (pMonitor->solitaryClient.expired()) {
|
||||||
if (pMonitor->isMirror()) {
|
if (pMonitor->isMirror()) {
|
||||||
g_pHyprOpenGL->blend(false);
|
g_pHyprOpenGL->blend(false);
|
||||||
g_pHyprOpenGL->renderMirrored();
|
g_pHyprOpenGL->renderMirrored();
|
||||||
|
@ -1321,7 +1321,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
g_pHyprRenderer->renderWindow(pMonitor->solitaryClient, pMonitor, &now, false, RENDER_PASS_MAIN /* solitary = no popups */);
|
g_pHyprRenderer->renderWindow(pMonitor->solitaryClient.lock(), pMonitor, &now, false, RENDER_PASS_MAIN /* solitary = no popups */);
|
||||||
} else {
|
} else {
|
||||||
sendFrameEventsToWorkspace(pMonitor, pMonitor->activeWorkspace, &now);
|
sendFrameEventsToWorkspace(pMonitor, pMonitor->activeWorkspace, &now);
|
||||||
if (pMonitor->activeSpecialWorkspace)
|
if (pMonitor->activeSpecialWorkspace)
|
||||||
|
@ -1426,7 +1426,7 @@ void CHyprRenderer::sendFrameEventsToWorkspace(CMonitor* pMonitor, PHLWORKSPACE
|
||||||
if (w->isHidden() || !w->m_bIsMapped || w->m_bFadingOut || !w->m_pWLSurface.wlr())
|
if (w->isHidden() || !w->m_bIsMapped || w->m_bFadingOut || !w->m_pWLSurface.wlr())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!shouldRenderWindow(w.get(), pMonitor))
|
if (!shouldRenderWindow(w, pMonitor))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
wlr_surface_for_each_surface(
|
wlr_surface_for_each_surface(
|
||||||
|
@ -1444,7 +1444,7 @@ void CHyprRenderer::sendFrameEventsToWorkspace(CMonitor* pMonitor, PHLWORKSPACE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::setWindowScanoutMode(CWindow* pWindow) {
|
void CHyprRenderer::setWindowScanoutMode(PHLWINDOW pWindow) {
|
||||||
if (!g_pCompositor->m_sWLRLinuxDMABuf || g_pSessionLockManager->isSessionLocked())
|
if (!g_pCompositor->m_sWLRLinuxDMABuf || g_pSessionLockManager->isSessionLocked())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1764,7 +1764,7 @@ void CHyprRenderer::damageSurface(wlr_surface* pSurface, double x, double y, dou
|
||||||
damageBox.pixman()->extents.x2 - damageBox.pixman()->extents.x1, damageBox.pixman()->extents.y2 - damageBox.pixman()->extents.y1);
|
damageBox.pixman()->extents.x2 - damageBox.pixman()->extents.x1, damageBox.pixman()->extents.y2 - damageBox.pixman()->extents.y1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::damageWindow(CWindow* pWindow, bool forceFull) {
|
void CHyprRenderer::damageWindow(PHLWINDOW pWindow, bool forceFull) {
|
||||||
if (g_pCompositor->m_bUnsafeState)
|
if (g_pCompositor->m_bUnsafeState)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -2540,7 +2540,7 @@ bool CHyprRenderer::canSkipBackBufferClear(CMonitor* pMonitor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::recheckSolitaryForMonitor(CMonitor* pMonitor) {
|
void CHyprRenderer::recheckSolitaryForMonitor(CMonitor* pMonitor) {
|
||||||
pMonitor->solitaryClient = nullptr; // reset it, if we find one it will be set.
|
pMonitor->solitaryClient.reset(); // reset it, if we find one it will be set.
|
||||||
|
|
||||||
if (g_pHyprNotificationOverlay->hasAny())
|
if (g_pHyprNotificationOverlay->hasAny())
|
||||||
return;
|
return;
|
||||||
|
@ -2572,7 +2572,7 @@ void CHyprRenderer::recheckSolitaryForMonitor(CMonitor* pMonitor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (w.get() == PCANDIDATE || (!w->m_bIsMapped && !w->m_bFadingOut) || w->isHidden())
|
if (w == PCANDIDATE || (!w->m_bIsMapped && !w->m_bFadingOut) || w->isHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (w->m_pWorkspace == PCANDIDATE->m_pWorkspace && w->m_bIsFloating && w->m_bCreatedOverFullscreen && w->visibleOnMonitor(pMonitor))
|
if (w->m_pWorkspace == PCANDIDATE->m_pWorkspace && w->m_bIsFloating && w->m_bCreatedOverFullscreen && w->visibleOnMonitor(pMonitor))
|
||||||
|
|
|
@ -46,19 +46,19 @@ class CHyprRenderer {
|
||||||
void outputMgrApplyTest(wlr_output_configuration_v1*, bool);
|
void outputMgrApplyTest(wlr_output_configuration_v1*, bool);
|
||||||
void arrangeLayersForMonitor(const int&);
|
void arrangeLayersForMonitor(const int&);
|
||||||
void damageSurface(wlr_surface*, double, double, double scale = 1.0);
|
void damageSurface(wlr_surface*, double, double, double scale = 1.0);
|
||||||
void damageWindow(CWindow*, bool forceFull = false);
|
void damageWindow(PHLWINDOW, bool forceFull = false);
|
||||||
void damageBox(CBox*);
|
void damageBox(CBox*);
|
||||||
void damageBox(const int& x, const int& y, const int& w, const int& h);
|
void damageBox(const int& x, const int& y, const int& w, const int& h);
|
||||||
void damageRegion(const CRegion&);
|
void damageRegion(const CRegion&);
|
||||||
void damageMonitor(CMonitor*);
|
void damageMonitor(CMonitor*);
|
||||||
void damageMirrorsWith(CMonitor*, const CRegion&);
|
void damageMirrorsWith(CMonitor*, const CRegion&);
|
||||||
bool applyMonitorRule(CMonitor*, SMonitorRule*, bool force = false);
|
bool applyMonitorRule(CMonitor*, SMonitorRule*, bool force = false);
|
||||||
bool shouldRenderWindow(CWindow*, CMonitor*);
|
bool shouldRenderWindow(PHLWINDOW, CMonitor*);
|
||||||
bool shouldRenderWindow(CWindow*);
|
bool shouldRenderWindow(PHLWINDOW);
|
||||||
void ensureCursorRenderingMode();
|
void ensureCursorRenderingMode();
|
||||||
bool shouldRenderCursor();
|
bool shouldRenderCursor();
|
||||||
void setCursorHidden(bool hide);
|
void setCursorHidden(bool hide);
|
||||||
void calculateUVForSurface(CWindow*, wlr_surface*, bool main = false, const Vector2D& projSize = {}, bool fixMisalignedFSV1 = false);
|
void calculateUVForSurface(PHLWINDOW, wlr_surface*, bool main = false, const Vector2D& projSize = {}, bool fixMisalignedFSV1 = false);
|
||||||
std::tuple<float, float, float> getRenderTimes(CMonitor* pMonitor); // avg max min
|
std::tuple<float, float, float> getRenderTimes(CMonitor* pMonitor); // avg max min
|
||||||
void renderLockscreen(CMonitor* pMonitor, timespec* now, const CBox& geometry);
|
void renderLockscreen(CMonitor* pMonitor, timespec* now, const CBox& geometry);
|
||||||
void setOccludedForBackLayers(CRegion& region, PHLWORKSPACE pWorkspace);
|
void setOccludedForBackLayers(CRegion& region, PHLWORKSPACE pWorkspace);
|
||||||
|
@ -76,21 +76,21 @@ class CHyprRenderer {
|
||||||
|
|
||||||
// if RENDER_MODE_NORMAL, provided damage will be written to.
|
// if RENDER_MODE_NORMAL, provided damage will be written to.
|
||||||
// otherwise, it will be the one used.
|
// otherwise, it will be the one used.
|
||||||
bool beginRender(CMonitor* pMonitor, CRegion& damage, eRenderMode mode = RENDER_MODE_NORMAL, wlr_buffer* buffer = nullptr, CFramebuffer* fb = nullptr);
|
bool beginRender(CMonitor* pMonitor, CRegion& damage, eRenderMode mode = RENDER_MODE_NORMAL, wlr_buffer* buffer = nullptr, CFramebuffer* fb = nullptr);
|
||||||
void endRender();
|
void endRender();
|
||||||
|
|
||||||
bool m_bBlockSurfaceFeedback = false;
|
bool m_bBlockSurfaceFeedback = false;
|
||||||
bool m_bRenderingSnapshot = false;
|
bool m_bRenderingSnapshot = false;
|
||||||
CWindow* m_pLastScanout = nullptr;
|
PHLWINDOWREF m_pLastScanout;
|
||||||
CMonitor* m_pMostHzMonitor = nullptr;
|
CMonitor* m_pMostHzMonitor = nullptr;
|
||||||
bool m_bDirectScanoutBlocked = false;
|
bool m_bDirectScanoutBlocked = false;
|
||||||
bool m_bSoftwareCursorsLocked = false;
|
bool m_bSoftwareCursorsLocked = false;
|
||||||
|
|
||||||
DAMAGETRACKINGMODES
|
DAMAGETRACKINGMODES
|
||||||
damageTrackingModeFromStr(const std::string&);
|
damageTrackingModeFromStr(const std::string&);
|
||||||
|
|
||||||
bool attemptDirectScanout(CMonitor*);
|
bool attemptDirectScanout(CMonitor*);
|
||||||
void setWindowScanoutMode(CWindow*);
|
void setWindowScanoutMode(PHLWINDOW);
|
||||||
void initiateManualCrash();
|
void initiateManualCrash();
|
||||||
|
|
||||||
bool m_bCrashingInProgress = false;
|
bool m_bCrashingInProgress = false;
|
||||||
|
@ -111,7 +111,7 @@ class CHyprRenderer {
|
||||||
void arrangeLayerArray(CMonitor*, const std::vector<std::unique_ptr<SLayerSurface>>&, bool, CBox*);
|
void arrangeLayerArray(CMonitor*, const std::vector<std::unique_ptr<SLayerSurface>>&, bool, CBox*);
|
||||||
void renderWorkspaceWindowsFullscreen(CMonitor*, PHLWORKSPACE, timespec*); // renders workspace windows (fullscreen) (tiled, floating, pinned, but no special)
|
void renderWorkspaceWindowsFullscreen(CMonitor*, PHLWORKSPACE, timespec*); // renders workspace windows (fullscreen) (tiled, floating, pinned, but no special)
|
||||||
void renderWorkspaceWindows(CMonitor*, PHLWORKSPACE, timespec*); // renders workspace windows (no fullscreen) (tiled, floating, pinned, but no special)
|
void renderWorkspaceWindows(CMonitor*, PHLWORKSPACE, timespec*); // renders workspace windows (no fullscreen) (tiled, floating, pinned, but no special)
|
||||||
void renderWindow(CWindow*, CMonitor*, timespec*, bool, eRenderPassMode, bool ignorePosition = false, bool ignoreAllGeometry = false);
|
void renderWindow(PHLWINDOW, CMonitor*, timespec*, bool, eRenderPassMode, bool ignorePosition = false, bool ignoreAllGeometry = false);
|
||||||
void renderLayer(SLayerSurface*, CMonitor*, timespec*, bool popups = false);
|
void renderLayer(SLayerSurface*, CMonitor*, timespec*, bool popups = false);
|
||||||
void renderSessionLockSurface(SSessionLockSurface*, CMonitor*, timespec*);
|
void renderSessionLockSurface(SSessionLockSurface*, CMonitor*, timespec*);
|
||||||
void renderDragIcon(CMonitor*, timespec*);
|
void renderDragIcon(CMonitor*, timespec*);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "../../Compositor.hpp"
|
#include "../../Compositor.hpp"
|
||||||
#include "../../config/ConfigValue.hpp"
|
#include "../../config/ConfigValue.hpp"
|
||||||
|
|
||||||
CHyprBorderDecoration::CHyprBorderDecoration(CWindow* pWindow) : IHyprWindowDecoration(pWindow) {
|
CHyprBorderDecoration::CHyprBorderDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow) {
|
||||||
m_pWindow = pWindow;
|
m_pWindow = pWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ CHyprBorderDecoration::~CHyprBorderDecoration() {
|
||||||
}
|
}
|
||||||
|
|
||||||
SDecorationPositioningInfo CHyprBorderDecoration::getPositioningInfo() {
|
SDecorationPositioningInfo CHyprBorderDecoration::getPositioningInfo() {
|
||||||
const auto BORDERSIZE = m_pWindow->getRealBorderSize();
|
const auto BORDERSIZE = m_pWindow.lock()->getRealBorderSize();
|
||||||
m_seExtents = {{BORDERSIZE, BORDERSIZE}, {BORDERSIZE, BORDERSIZE}};
|
m_seExtents = {{BORDERSIZE, BORDERSIZE}, {BORDERSIZE, BORDERSIZE}};
|
||||||
|
|
||||||
if (doesntWantBorders())
|
if (doesntWantBorders())
|
||||||
|
@ -34,14 +34,14 @@ void CHyprBorderDecoration::onPositioningReply(const SDecorationPositioningReply
|
||||||
|
|
||||||
CBox CHyprBorderDecoration::assignedBoxGlobal() {
|
CBox CHyprBorderDecoration::assignedBoxGlobal() {
|
||||||
CBox box = m_bAssignedGeometry;
|
CBox box = m_bAssignedGeometry;
|
||||||
box.translate(g_pDecorationPositioner->getEdgeDefinedPoint(DECORATION_EDGE_BOTTOM | DECORATION_EDGE_LEFT | DECORATION_EDGE_RIGHT | DECORATION_EDGE_TOP, m_pWindow));
|
box.translate(g_pDecorationPositioner->getEdgeDefinedPoint(DECORATION_EDGE_BOTTOM | DECORATION_EDGE_LEFT | DECORATION_EDGE_RIGHT | DECORATION_EDGE_TOP, m_pWindow.lock()));
|
||||||
|
|
||||||
const auto PWORKSPACE = m_pWindow->m_pWorkspace;
|
const auto PWORKSPACE = m_pWindow.lock()->m_pWorkspace;
|
||||||
|
|
||||||
if (!PWORKSPACE)
|
if (!PWORKSPACE)
|
||||||
return box;
|
return box;
|
||||||
|
|
||||||
const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset.value() : Vector2D();
|
const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow.lock()->m_bPinned ? PWORKSPACE->m_vRenderOffset.value() : Vector2D();
|
||||||
return box.translate(WORKSPACEOFFSET);
|
return box.translate(WORKSPACEOFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,28 +52,29 @@ void CHyprBorderDecoration::draw(CMonitor* pMonitor, float a) {
|
||||||
if (m_bAssignedGeometry.width < m_seExtents.topLeft.x + 1 || m_bAssignedGeometry.height < m_seExtents.topLeft.y + 1)
|
if (m_bAssignedGeometry.width < m_seExtents.topLeft.x + 1 || m_bAssignedGeometry.height < m_seExtents.topLeft.y + 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CBox windowBox = assignedBoxGlobal().translate(-pMonitor->vecPosition + m_pWindow->m_vFloatingOffset).expand(-m_pWindow->getRealBorderSize()).scale(pMonitor->scale).round();
|
CBox windowBox =
|
||||||
|
assignedBoxGlobal().translate(-pMonitor->vecPosition + m_pWindow.lock()->m_vFloatingOffset).expand(-m_pWindow.lock()->getRealBorderSize()).scale(pMonitor->scale).round();
|
||||||
|
|
||||||
if (windowBox.width < 1 || windowBox.height < 1)
|
if (windowBox.width < 1 || windowBox.height < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto grad = m_pWindow->m_cRealBorderColor;
|
auto grad = m_pWindow.lock()->m_cRealBorderColor;
|
||||||
const bool ANIMATED = m_pWindow->m_fBorderFadeAnimationProgress.isBeingAnimated();
|
const bool ANIMATED = m_pWindow.lock()->m_fBorderFadeAnimationProgress.isBeingAnimated();
|
||||||
float a1 = a * (ANIMATED ? m_pWindow->m_fBorderFadeAnimationProgress.value() : 1.f);
|
float a1 = a * (ANIMATED ? m_pWindow.lock()->m_fBorderFadeAnimationProgress.value() : 1.f);
|
||||||
|
|
||||||
if (m_pWindow->m_fBorderAngleAnimationProgress.getConfig()->pValues->internalEnabled) {
|
if (m_pWindow.lock()->m_fBorderAngleAnimationProgress.getConfig()->pValues->internalEnabled) {
|
||||||
grad.m_fAngle += m_pWindow->m_fBorderAngleAnimationProgress.value() * M_PI * 2;
|
grad.m_fAngle += m_pWindow.lock()->m_fBorderAngleAnimationProgress.value() * M_PI * 2;
|
||||||
grad.m_fAngle = normalizeAngleRad(grad.m_fAngle);
|
grad.m_fAngle = normalizeAngleRad(grad.m_fAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
int borderSize = m_pWindow->getRealBorderSize();
|
int borderSize = m_pWindow.lock()->getRealBorderSize();
|
||||||
const auto ROUNDING = m_pWindow->rounding() * pMonitor->scale;
|
const auto ROUNDING = m_pWindow.lock()->rounding() * pMonitor->scale;
|
||||||
|
|
||||||
g_pHyprOpenGL->renderBorder(&windowBox, grad, ROUNDING, borderSize, a1);
|
g_pHyprOpenGL->renderBorder(&windowBox, grad, ROUNDING, borderSize, a1);
|
||||||
|
|
||||||
if (ANIMATED) {
|
if (ANIMATED) {
|
||||||
float a2 = a * (1.f - m_pWindow->m_fBorderFadeAnimationProgress.value());
|
float a2 = a * (1.f - m_pWindow.lock()->m_fBorderFadeAnimationProgress.value());
|
||||||
g_pHyprOpenGL->renderBorder(&windowBox, m_pWindow->m_cRealBorderColorPrevious, ROUNDING, borderSize, a2);
|
g_pHyprOpenGL->renderBorder(&windowBox, m_pWindow.lock()->m_cRealBorderColorPrevious, ROUNDING, borderSize, a2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,24 +82,24 @@ eDecorationType CHyprBorderDecoration::getDecorationType() {
|
||||||
return DECORATION_BORDER;
|
return DECORATION_BORDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprBorderDecoration::updateWindow(CWindow*) {
|
void CHyprBorderDecoration::updateWindow(PHLWINDOW) {
|
||||||
if (m_pWindow->getRealBorderSize() != m_seExtents.topLeft.x)
|
if (m_pWindow.lock()->getRealBorderSize() != m_seExtents.topLeft.x)
|
||||||
g_pDecorationPositioner->repositionDeco(this);
|
g_pDecorationPositioner->repositionDeco(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprBorderDecoration::damageEntire() {
|
void CHyprBorderDecoration::damageEntire() {
|
||||||
if (!g_pCompositor->windowValidMapped(m_pWindow))
|
if (!validMapped(m_pWindow))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto surfaceBox = m_pWindow->getWindowMainSurfaceBox();
|
auto surfaceBox = m_pWindow.lock()->getWindowMainSurfaceBox();
|
||||||
const auto ROUNDING = m_pWindow->rounding();
|
const auto ROUNDING = m_pWindow.lock()->rounding();
|
||||||
const auto ROUNDINGSIZE = ROUNDING - M_SQRT1_2 * ROUNDING + 2;
|
const auto ROUNDINGSIZE = ROUNDING - M_SQRT1_2 * ROUNDING + 2;
|
||||||
const auto BORDERSIZE = m_pWindow->getRealBorderSize() + 1;
|
const auto BORDERSIZE = m_pWindow.lock()->getRealBorderSize() + 1;
|
||||||
|
|
||||||
const auto PWINDOWWORKSPACE = m_pWindow->m_pWorkspace;
|
const auto PWINDOWWORKSPACE = m_pWindow.lock()->m_pWorkspace;
|
||||||
if (PWINDOWWORKSPACE && PWINDOWWORKSPACE->m_vRenderOffset.isBeingAnimated() && !m_pWindow->m_bPinned)
|
if (PWINDOWWORKSPACE && PWINDOWWORKSPACE->m_vRenderOffset.isBeingAnimated() && !m_pWindow.lock()->m_bPinned)
|
||||||
surfaceBox.translate(PWINDOWWORKSPACE->m_vRenderOffset.value());
|
surfaceBox.translate(PWINDOWWORKSPACE->m_vRenderOffset.value());
|
||||||
surfaceBox.translate(m_pWindow->m_vFloatingOffset);
|
surfaceBox.translate(m_pWindow.lock()->m_vFloatingOffset);
|
||||||
|
|
||||||
CBox surfaceBoxExpandedBorder = surfaceBox;
|
CBox surfaceBoxExpandedBorder = surfaceBox;
|
||||||
surfaceBoxExpandedBorder.expand(BORDERSIZE);
|
surfaceBoxExpandedBorder.expand(BORDERSIZE);
|
||||||
|
@ -109,7 +110,7 @@ void CHyprBorderDecoration::damageEntire() {
|
||||||
borderRegion.subtract(surfaceBoxShrunkRounding);
|
borderRegion.subtract(surfaceBoxShrunkRounding);
|
||||||
|
|
||||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
if (!g_pHyprRenderer->shouldRenderWindow(m_pWindow, m.get())) {
|
if (!g_pHyprRenderer->shouldRenderWindow(m_pWindow.lock(), m.get())) {
|
||||||
const CRegion monitorRegion({m->vecPosition, m->vecSize});
|
const CRegion monitorRegion({m->vecPosition, m->vecSize});
|
||||||
borderRegion.subtract(monitorRegion);
|
borderRegion.subtract(monitorRegion);
|
||||||
}
|
}
|
||||||
|
@ -133,5 +134,5 @@ std::string CHyprBorderDecoration::getDisplayName() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CHyprBorderDecoration::doesntWantBorders() {
|
bool CHyprBorderDecoration::doesntWantBorders() {
|
||||||
return !m_pWindow->m_sSpecialRenderData.border || m_pWindow->m_bX11DoesntWantBorders || m_pWindow->getRealBorderSize() == 0;
|
return !m_pWindow.lock()->m_sSpecialRenderData.border || m_pWindow.lock()->m_bX11DoesntWantBorders || m_pWindow.lock()->getRealBorderSize() == 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
class CHyprBorderDecoration : public IHyprWindowDecoration {
|
class CHyprBorderDecoration : public IHyprWindowDecoration {
|
||||||
public:
|
public:
|
||||||
CHyprBorderDecoration(CWindow*);
|
CHyprBorderDecoration(PHLWINDOW);
|
||||||
virtual ~CHyprBorderDecoration();
|
virtual ~CHyprBorderDecoration();
|
||||||
|
|
||||||
virtual SDecorationPositioningInfo getPositioningInfo();
|
virtual SDecorationPositioningInfo getPositioningInfo();
|
||||||
|
@ -15,7 +15,7 @@ class CHyprBorderDecoration : public IHyprWindowDecoration {
|
||||||
|
|
||||||
virtual eDecorationType getDecorationType();
|
virtual eDecorationType getDecorationType();
|
||||||
|
|
||||||
virtual void updateWindow(CWindow*);
|
virtual void updateWindow(PHLWINDOW);
|
||||||
|
|
||||||
virtual void damageEntire();
|
virtual void damageEntire();
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class CHyprBorderDecoration : public IHyprWindowDecoration {
|
||||||
SWindowDecorationExtents m_seExtents;
|
SWindowDecorationExtents m_seExtents;
|
||||||
SWindowDecorationExtents m_seReportedExtents;
|
SWindowDecorationExtents m_seReportedExtents;
|
||||||
|
|
||||||
CWindow* m_pWindow = nullptr;
|
PHLWINDOWREF m_pWindow;
|
||||||
|
|
||||||
Vector2D m_vLastWindowPos;
|
Vector2D m_vLastWindowPos;
|
||||||
Vector2D m_vLastWindowSize;
|
Vector2D m_vLastWindowSize;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "../../Compositor.hpp"
|
#include "../../Compositor.hpp"
|
||||||
#include "../../config/ConfigValue.hpp"
|
#include "../../config/ConfigValue.hpp"
|
||||||
|
|
||||||
CHyprDropShadowDecoration::CHyprDropShadowDecoration(CWindow* pWindow) : IHyprWindowDecoration(pWindow) {
|
CHyprDropShadowDecoration::CHyprDropShadowDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow) {
|
||||||
m_pWindow = pWindow;
|
m_pWindow = pWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ SDecorationPositioningInfo CHyprDropShadowDecoration::getPositioningInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDropShadowDecoration::onPositioningReply(const SDecorationPositioningReply& reply) {
|
void CHyprDropShadowDecoration::onPositioningReply(const SDecorationPositioningReply& reply) {
|
||||||
updateWindow(m_pWindow);
|
updateWindow(m_pWindow.lock());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t CHyprDropShadowDecoration::getDecorationFlags() {
|
uint64_t CHyprDropShadowDecoration::getDecorationFlags() {
|
||||||
|
@ -41,31 +41,33 @@ void CHyprDropShadowDecoration::damageEntire() {
|
||||||
if (*PSHADOWS != 1)
|
if (*PSHADOWS != 1)
|
||||||
return; // disabled
|
return; // disabled
|
||||||
|
|
||||||
CBox shadowBox = {m_pWindow->m_vRealPosition.value().x - m_seExtents.topLeft.x, m_pWindow->m_vRealPosition.value().y - m_seExtents.topLeft.y,
|
const auto PWINDOW = m_pWindow.lock();
|
||||||
m_pWindow->m_vRealSize.value().x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x,
|
|
||||||
m_pWindow->m_vRealSize.value().y + m_seExtents.topLeft.y + m_seExtents.bottomRight.y};
|
|
||||||
|
|
||||||
const auto PWORKSPACE = m_pWindow->m_pWorkspace;
|
CBox shadowBox = {PWINDOW->m_vRealPosition.value().x - m_seExtents.topLeft.x, PWINDOW->m_vRealPosition.value().y - m_seExtents.topLeft.y,
|
||||||
if (PWORKSPACE && PWORKSPACE->m_vRenderOffset.isBeingAnimated() && !m_pWindow->m_bPinned)
|
PWINDOW->m_vRealSize.value().x + m_seExtents.topLeft.x + m_seExtents.bottomRight.x,
|
||||||
|
PWINDOW->m_vRealSize.value().y + m_seExtents.topLeft.y + m_seExtents.bottomRight.y};
|
||||||
|
|
||||||
|
const auto PWORKSPACE = PWINDOW->m_pWorkspace;
|
||||||
|
if (PWORKSPACE && PWORKSPACE->m_vRenderOffset.isBeingAnimated() && !PWINDOW->m_bPinned)
|
||||||
shadowBox.translate(PWORKSPACE->m_vRenderOffset.value());
|
shadowBox.translate(PWORKSPACE->m_vRenderOffset.value());
|
||||||
shadowBox.translate(m_pWindow->m_vFloatingOffset);
|
shadowBox.translate(PWINDOW->m_vFloatingOffset);
|
||||||
|
|
||||||
static auto PSHADOWIGNOREWINDOW = CConfigValue<Hyprlang::INT>("decoration:shadow_ignore_window");
|
static auto PSHADOWIGNOREWINDOW = CConfigValue<Hyprlang::INT>("decoration:shadow_ignore_window");
|
||||||
const auto ROUNDING = m_pWindow->rounding();
|
const auto ROUNDING = PWINDOW->rounding();
|
||||||
const auto ROUNDINGSIZE = ROUNDING - M_SQRT1_2 * ROUNDING + 1;
|
const auto ROUNDINGSIZE = ROUNDING - M_SQRT1_2 * ROUNDING + 1;
|
||||||
|
|
||||||
CRegion shadowRegion(shadowBox);
|
CRegion shadowRegion(shadowBox);
|
||||||
if (*PSHADOWIGNOREWINDOW) {
|
if (*PSHADOWIGNOREWINDOW) {
|
||||||
CBox surfaceBox = m_pWindow->getWindowMainSurfaceBox();
|
CBox surfaceBox = PWINDOW->getWindowMainSurfaceBox();
|
||||||
if (PWORKSPACE && PWORKSPACE->m_vRenderOffset.isBeingAnimated() && !m_pWindow->m_bPinned)
|
if (PWORKSPACE && PWORKSPACE->m_vRenderOffset.isBeingAnimated() && !PWINDOW->m_bPinned)
|
||||||
surfaceBox.translate(PWORKSPACE->m_vRenderOffset.value());
|
surfaceBox.translate(PWORKSPACE->m_vRenderOffset.value());
|
||||||
surfaceBox.translate(m_pWindow->m_vFloatingOffset);
|
surfaceBox.translate(PWINDOW->m_vFloatingOffset);
|
||||||
surfaceBox.expand(-ROUNDINGSIZE);
|
surfaceBox.expand(-ROUNDINGSIZE);
|
||||||
shadowRegion.subtract(CRegion(surfaceBox));
|
shadowRegion.subtract(CRegion(surfaceBox));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
if (!g_pHyprRenderer->shouldRenderWindow(m_pWindow, m.get())) {
|
if (!g_pHyprRenderer->shouldRenderWindow(PWINDOW, m.get())) {
|
||||||
const CRegion monitorRegion({m->vecPosition, m->vecSize});
|
const CRegion monitorRegion({m->vecPosition, m->vecSize});
|
||||||
shadowRegion.subtract(monitorRegion);
|
shadowRegion.subtract(monitorRegion);
|
||||||
}
|
}
|
||||||
|
@ -74,9 +76,11 @@ void CHyprDropShadowDecoration::damageEntire() {
|
||||||
g_pHyprRenderer->damageRegion(shadowRegion);
|
g_pHyprRenderer->damageRegion(shadowRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDropShadowDecoration::updateWindow(CWindow* pWindow) {
|
void CHyprDropShadowDecoration::updateWindow(PHLWINDOW pWindow) {
|
||||||
m_vLastWindowPos = m_pWindow->m_vRealPosition.value();
|
const auto PWINDOW = m_pWindow.lock();
|
||||||
m_vLastWindowSize = m_pWindow->m_vRealSize.value();
|
|
||||||
|
m_vLastWindowPos = PWINDOW->m_vRealPosition.value();
|
||||||
|
m_vLastWindowSize = PWINDOW->m_vRealSize.value();
|
||||||
|
|
||||||
m_bLastWindowBox = {m_vLastWindowPos.x, m_vLastWindowPos.y, m_vLastWindowSize.x, m_vLastWindowSize.y};
|
m_bLastWindowBox = {m_vLastWindowPos.x, m_vLastWindowPos.y, m_vLastWindowSize.x, m_vLastWindowSize.y};
|
||||||
m_bLastWindowBoxWithDecos = g_pDecorationPositioner->getBoxWithIncludedDecos(pWindow);
|
m_bLastWindowBoxWithDecos = g_pDecorationPositioner->getBoxWithIncludedDecos(pWindow);
|
||||||
|
@ -84,19 +88,21 @@ void CHyprDropShadowDecoration::updateWindow(CWindow* pWindow) {
|
||||||
|
|
||||||
void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a) {
|
void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a) {
|
||||||
|
|
||||||
if (!g_pCompositor->windowValidMapped(m_pWindow))
|
const auto PWINDOW = m_pWindow.lock();
|
||||||
|
|
||||||
|
if (!validMapped(PWINDOW))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_pWindow->m_cRealShadowColor.value() == CColor(0, 0, 0, 0))
|
if (PWINDOW->m_cRealShadowColor.value() == CColor(0, 0, 0, 0))
|
||||||
return; // don't draw invisible shadows
|
return; // don't draw invisible shadows
|
||||||
|
|
||||||
if (!m_pWindow->m_sSpecialRenderData.decorate)
|
if (!PWINDOW->m_sSpecialRenderData.decorate)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!m_pWindow->m_sSpecialRenderData.shadow)
|
if (!PWINDOW->m_sSpecialRenderData.shadow)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_pWindow->m_sAdditionalConfigData.forceNoShadow)
|
if (PWINDOW->m_sAdditionalConfigData.forceNoShadow)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
static auto PSHADOWS = CConfigValue<Hyprlang::INT>("decoration:drop_shadow");
|
static auto PSHADOWS = CConfigValue<Hyprlang::INT>("decoration:drop_shadow");
|
||||||
|
@ -108,10 +114,10 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a) {
|
||||||
if (*PSHADOWS != 1)
|
if (*PSHADOWS != 1)
|
||||||
return; // disabled
|
return; // disabled
|
||||||
|
|
||||||
const auto ROUNDINGBASE = m_pWindow->rounding();
|
const auto ROUNDINGBASE = PWINDOW->rounding();
|
||||||
const auto ROUNDING = ROUNDINGBASE > 0 ? ROUNDINGBASE + m_pWindow->getRealBorderSize() : 0;
|
const auto ROUNDING = ROUNDINGBASE > 0 ? ROUNDINGBASE + PWINDOW->getRealBorderSize() : 0;
|
||||||
const auto PWORKSPACE = m_pWindow->m_pWorkspace;
|
const auto PWORKSPACE = PWINDOW->m_pWorkspace;
|
||||||
const auto WORKSPACEOFFSET = PWORKSPACE && !m_pWindow->m_bPinned ? PWORKSPACE->m_vRenderOffset.value() : Vector2D();
|
const auto WORKSPACEOFFSET = PWORKSPACE && !PWINDOW->m_bPinned ? PWORKSPACE->m_vRenderOffset.value() : Vector2D();
|
||||||
|
|
||||||
// draw the shadow
|
// draw the shadow
|
||||||
CBox fullBox = m_bLastWindowBoxWithDecos;
|
CBox fullBox = m_bLastWindowBoxWithDecos;
|
||||||
|
@ -126,13 +132,13 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a) {
|
||||||
// scale the box in relation to the center of the box
|
// scale the box in relation to the center of the box
|
||||||
fullBox.scaleFromCenter(SHADOWSCALE).translate(*PSHADOWOFFSET);
|
fullBox.scaleFromCenter(SHADOWSCALE).translate(*PSHADOWOFFSET);
|
||||||
|
|
||||||
updateWindow(m_pWindow);
|
updateWindow(PWINDOW);
|
||||||
m_vLastWindowPos += WORKSPACEOFFSET;
|
m_vLastWindowPos += WORKSPACEOFFSET;
|
||||||
m_seExtents = {{m_vLastWindowPos.x - fullBox.x - pMonitor->vecPosition.x + 2, m_vLastWindowPos.y - fullBox.y - pMonitor->vecPosition.y + 2},
|
m_seExtents = {{m_vLastWindowPos.x - fullBox.x - pMonitor->vecPosition.x + 2, m_vLastWindowPos.y - fullBox.y - pMonitor->vecPosition.y + 2},
|
||||||
{fullBox.x + fullBox.width + pMonitor->vecPosition.x - m_vLastWindowPos.x - m_vLastWindowSize.x + 2,
|
{fullBox.x + fullBox.width + pMonitor->vecPosition.x - m_vLastWindowPos.x - m_vLastWindowSize.x + 2,
|
||||||
fullBox.y + fullBox.height + pMonitor->vecPosition.y - m_vLastWindowPos.y - m_vLastWindowSize.y + 2}};
|
fullBox.y + fullBox.height + pMonitor->vecPosition.y - m_vLastWindowPos.y - m_vLastWindowSize.y + 2}};
|
||||||
|
|
||||||
fullBox.translate(m_pWindow->m_vFloatingOffset);
|
fullBox.translate(PWINDOW->m_vFloatingOffset);
|
||||||
|
|
||||||
if (fullBox.width < 1 || fullBox.height < 1)
|
if (fullBox.width < 1 || fullBox.height < 1)
|
||||||
return; // don't draw invisible shadows
|
return; // don't draw invisible shadows
|
||||||
|
@ -154,8 +160,8 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a) {
|
||||||
windowBox.translate(-pMonitor->vecPosition + WORKSPACEOFFSET);
|
windowBox.translate(-pMonitor->vecPosition + WORKSPACEOFFSET);
|
||||||
withDecos.translate(-pMonitor->vecPosition + WORKSPACEOFFSET);
|
withDecos.translate(-pMonitor->vecPosition + WORKSPACEOFFSET);
|
||||||
|
|
||||||
windowBox.translate(m_pWindow->m_vFloatingOffset);
|
windowBox.translate(PWINDOW->m_vFloatingOffset);
|
||||||
withDecos.translate(m_pWindow->m_vFloatingOffset);
|
withDecos.translate(PWINDOW->m_vFloatingOffset);
|
||||||
|
|
||||||
auto scaledExtentss = withDecos.extentsFrom(windowBox);
|
auto scaledExtentss = withDecos.extentsFrom(windowBox);
|
||||||
scaledExtentss = scaledExtentss * pMonitor->scale;
|
scaledExtentss = scaledExtentss * pMonitor->scale;
|
||||||
|
@ -181,7 +187,7 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a) {
|
||||||
g_pHyprOpenGL->renderRect(&fullBox, CColor(0, 0, 0, 1), 0);
|
g_pHyprOpenGL->renderRect(&fullBox, CColor(0, 0, 0, 1), 0);
|
||||||
|
|
||||||
// render white shadow with the alpha of the shadow color (otherwise we clear with alpha later and shit it to 2 bit)
|
// render white shadow with the alpha of the shadow color (otherwise we clear with alpha later and shit it to 2 bit)
|
||||||
g_pHyprOpenGL->renderRoundedShadow(&fullBox, ROUNDING * pMonitor->scale, *PSHADOWSIZE * pMonitor->scale, CColor(1, 1, 1, m_pWindow->m_cRealShadowColor.value().a), a);
|
g_pHyprOpenGL->renderRoundedShadow(&fullBox, ROUNDING * pMonitor->scale, *PSHADOWSIZE * pMonitor->scale, CColor(1, 1, 1, PWINDOW->m_cRealShadowColor.value().a), a);
|
||||||
|
|
||||||
// render black window box ("clip")
|
// render black window box ("clip")
|
||||||
g_pHyprOpenGL->renderRect(&windowBox, CColor(0, 0, 0, 1.0), ROUNDING * pMonitor->scale);
|
g_pHyprOpenGL->renderRect(&windowBox, CColor(0, 0, 0, 1.0), ROUNDING * pMonitor->scale);
|
||||||
|
@ -189,7 +195,7 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a) {
|
||||||
alphaSwapFB.bind();
|
alphaSwapFB.bind();
|
||||||
|
|
||||||
// alpha swap just has the shadow color. It will be the "texture" to render.
|
// alpha swap just has the shadow color. It will be the "texture" to render.
|
||||||
g_pHyprOpenGL->renderRect(&fullBox, m_pWindow->m_cRealShadowColor.value().stripA(), 0);
|
g_pHyprOpenGL->renderRect(&fullBox, PWINDOW->m_cRealShadowColor.value().stripA(), 0);
|
||||||
|
|
||||||
LASTFB->bind();
|
LASTFB->bind();
|
||||||
|
|
||||||
|
@ -202,7 +208,7 @@ void CHyprDropShadowDecoration::draw(CMonitor* pMonitor, float a) {
|
||||||
|
|
||||||
g_pHyprOpenGL->m_RenderData.damage = saveDamage;
|
g_pHyprOpenGL->m_RenderData.damage = saveDamage;
|
||||||
} else {
|
} else {
|
||||||
g_pHyprOpenGL->renderRoundedShadow(&fullBox, ROUNDING * pMonitor->scale, *PSHADOWSIZE * pMonitor->scale, m_pWindow->m_cRealShadowColor.value(), a);
|
g_pHyprOpenGL->renderRoundedShadow(&fullBox, ROUNDING * pMonitor->scale, *PSHADOWSIZE * pMonitor->scale, PWINDOW->m_cRealShadowColor.value(), a);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_seExtents != m_seReportedExtents)
|
if (m_seExtents != m_seReportedExtents)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
class CHyprDropShadowDecoration : public IHyprWindowDecoration {
|
class CHyprDropShadowDecoration : public IHyprWindowDecoration {
|
||||||
public:
|
public:
|
||||||
CHyprDropShadowDecoration(CWindow*);
|
CHyprDropShadowDecoration(PHLWINDOW);
|
||||||
virtual ~CHyprDropShadowDecoration();
|
virtual ~CHyprDropShadowDecoration();
|
||||||
|
|
||||||
virtual SDecorationPositioningInfo getPositioningInfo();
|
virtual SDecorationPositioningInfo getPositioningInfo();
|
||||||
|
@ -15,7 +15,7 @@ class CHyprDropShadowDecoration : public IHyprWindowDecoration {
|
||||||
|
|
||||||
virtual eDecorationType getDecorationType();
|
virtual eDecorationType getDecorationType();
|
||||||
|
|
||||||
virtual void updateWindow(CWindow*);
|
virtual void updateWindow(PHLWINDOW);
|
||||||
|
|
||||||
virtual void damageEntire();
|
virtual void damageEntire();
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class CHyprDropShadowDecoration : public IHyprWindowDecoration {
|
||||||
SWindowDecorationExtents m_seExtents;
|
SWindowDecorationExtents m_seExtents;
|
||||||
SWindowDecorationExtents m_seReportedExtents;
|
SWindowDecorationExtents m_seReportedExtents;
|
||||||
|
|
||||||
CWindow* m_pWindow = nullptr;
|
PHLWINDOWREF m_pWindow;
|
||||||
|
|
||||||
Vector2D m_vLastWindowPos;
|
Vector2D m_vLastWindowPos;
|
||||||
Vector2D m_vLastWindowSize;
|
Vector2D m_vLastWindowSize;
|
||||||
|
|
|
@ -15,7 +15,7 @@ constexpr int BAR_PADDING_OUTER_VERT = 2;
|
||||||
constexpr int BAR_TEXT_PAD = 2;
|
constexpr int BAR_TEXT_PAD = 2;
|
||||||
constexpr int BAR_HORIZONTAL_PADDING = 2;
|
constexpr int BAR_HORIZONTAL_PADDING = 2;
|
||||||
|
|
||||||
CHyprGroupBarDecoration::CHyprGroupBarDecoration(CWindow* pWindow) : IHyprWindowDecoration(pWindow) {
|
CHyprGroupBarDecoration::CHyprGroupBarDecoration(PHLWINDOW pWindow) : IHyprWindowDecoration(pWindow) {
|
||||||
static auto PGRADIENTS = CConfigValue<Hyprlang::INT>("group:groupbar:enabled");
|
static auto PGRADIENTS = CConfigValue<Hyprlang::INT>("group:groupbar:enabled");
|
||||||
static auto PENABLED = CConfigValue<Hyprlang::INT>("group:groupbar:gradients");
|
static auto PENABLED = CConfigValue<Hyprlang::INT>("group:groupbar:gradients");
|
||||||
m_pWindow = pWindow;
|
m_pWindow = pWindow;
|
||||||
|
@ -39,7 +39,7 @@ SDecorationPositioningInfo CHyprGroupBarDecoration::getPositioningInfo() {
|
||||||
info.priority = *PPRIORITY;
|
info.priority = *PPRIORITY;
|
||||||
info.reserved = true;
|
info.reserved = true;
|
||||||
|
|
||||||
if (*PENABLED && m_pWindow->m_sSpecialRenderData.decorate)
|
if (*PENABLED && m_pWindow.lock()->m_sSpecialRenderData.decorate)
|
||||||
info.desiredExtents = {{0, BAR_PADDING_OUTER_VERT * 2 + BAR_INDICATOR_HEIGHT + (*PGRADIENTS || *PRENDERTITLES ? *PHEIGHT : 0) + 2}, {0, 0}};
|
info.desiredExtents = {{0, BAR_PADDING_OUTER_VERT * 2 + BAR_INDICATOR_HEIGHT + (*PGRADIENTS || *PRENDERTITLES ? *PHEIGHT : 0) + 2}, {0, 0}};
|
||||||
else
|
else
|
||||||
info.desiredExtents = {{0, 0}, {0, 0}};
|
info.desiredExtents = {{0, 0}, {0, 0}};
|
||||||
|
@ -57,33 +57,33 @@ eDecorationType CHyprGroupBarDecoration::getDecorationType() {
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
void CHyprGroupBarDecoration::updateWindow(CWindow* pWindow) {
|
void CHyprGroupBarDecoration::updateWindow(PHLWINDOW pWindow) {
|
||||||
if (!m_pWindow->m_sGroupData.pNextWindow) {
|
if (m_pWindow.lock()->m_sGroupData.pNextWindow.expired()) {
|
||||||
m_pWindow->removeWindowDeco(this);
|
m_pWindow.lock()->removeWindowDeco(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dwGroupMembers.clear();
|
m_dwGroupMembers.clear();
|
||||||
CWindow* head = pWindow->getGroupHead();
|
PHLWINDOW head = pWindow->getGroupHead();
|
||||||
m_dwGroupMembers.push_back(head);
|
m_dwGroupMembers.push_back(head);
|
||||||
|
|
||||||
CWindow* curr = head->m_sGroupData.pNextWindow;
|
PHLWINDOW curr = head->m_sGroupData.pNextWindow.lock();
|
||||||
while (curr != head) {
|
while (curr != head) {
|
||||||
m_dwGroupMembers.push_back(curr);
|
m_dwGroupMembers.push_back(curr);
|
||||||
curr = curr->m_sGroupData.pNextWindow;
|
curr = curr->m_sGroupData.pNextWindow.lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
damageEntire();
|
damageEntire();
|
||||||
|
|
||||||
if (m_dwGroupMembers.size() == 0) {
|
if (m_dwGroupMembers.size() == 0) {
|
||||||
m_pWindow->removeWindowDeco(this);
|
m_pWindow.lock()->removeWindowDeco(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprGroupBarDecoration::damageEntire() {
|
void CHyprGroupBarDecoration::damageEntire() {
|
||||||
auto box = assignedBoxGlobal();
|
auto box = assignedBoxGlobal();
|
||||||
box.translate(m_pWindow->m_vFloatingOffset);
|
box.translate(m_pWindow.lock()->m_vFloatingOffset);
|
||||||
g_pHyprRenderer->damageBox(&box);
|
g_pHyprRenderer->damageBox(&box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a) {
|
||||||
static auto PHEIGHT = CConfigValue<Hyprlang::INT>("group:groupbar:height");
|
static auto PHEIGHT = CConfigValue<Hyprlang::INT>("group:groupbar:height");
|
||||||
static auto PGRADIENTS = CConfigValue<Hyprlang::INT>("group:groupbar:gradients");
|
static auto PGRADIENTS = CConfigValue<Hyprlang::INT>("group:groupbar:gradients");
|
||||||
|
|
||||||
if (!*PENABLED || !m_pWindow->m_sSpecialRenderData.decorate)
|
if (!*PENABLED || !m_pWindow.lock()->m_sSpecialRenderData.decorate)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto ASSIGNEDBOX = assignedBoxGlobal();
|
const auto ASSIGNEDBOX = assignedBoxGlobal();
|
||||||
|
@ -111,8 +111,8 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a) {
|
||||||
int xoff = 0;
|
int xoff = 0;
|
||||||
|
|
||||||
for (int i = 0; i < barsToDraw; ++i) {
|
for (int i = 0; i < barsToDraw; ++i) {
|
||||||
CBox rect = {ASSIGNEDBOX.x + xoff - pMonitor->vecPosition.x + m_pWindow->m_vFloatingOffset.x,
|
CBox rect = {ASSIGNEDBOX.x + xoff - pMonitor->vecPosition.x + m_pWindow.lock()->m_vFloatingOffset.x,
|
||||||
ASSIGNEDBOX.y + ASSIGNEDBOX.h - BAR_INDICATOR_HEIGHT - BAR_PADDING_OUTER_VERT - pMonitor->vecPosition.y + m_pWindow->m_vFloatingOffset.y, m_fBarWidth,
|
ASSIGNEDBOX.y + ASSIGNEDBOX.h - BAR_INDICATOR_HEIGHT - BAR_PADDING_OUTER_VERT - pMonitor->vecPosition.y + m_pWindow.lock()->m_vFloatingOffset.y, m_fBarWidth,
|
||||||
BAR_INDICATOR_HEIGHT};
|
BAR_INDICATOR_HEIGHT};
|
||||||
|
|
||||||
if (rect.width <= 0 || rect.height <= 0)
|
if (rect.width <= 0 || rect.height <= 0)
|
||||||
|
@ -129,32 +129,32 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a) {
|
||||||
auto* const GROUPCOLACTIVELOCKED = (CGradientValueData*)(PGROUPCOLACTIVELOCKED.ptr())->getData();
|
auto* const GROUPCOLACTIVELOCKED = (CGradientValueData*)(PGROUPCOLACTIVELOCKED.ptr())->getData();
|
||||||
auto* const GROUPCOLINACTIVELOCKED = (CGradientValueData*)(PGROUPCOLINACTIVELOCKED.ptr())->getData();
|
auto* const GROUPCOLINACTIVELOCKED = (CGradientValueData*)(PGROUPCOLINACTIVELOCKED.ptr())->getData();
|
||||||
|
|
||||||
const bool GROUPLOCKED = m_pWindow->getGroupHead()->m_sGroupData.locked;
|
const bool GROUPLOCKED = m_pWindow.lock()->getGroupHead()->m_sGroupData.locked;
|
||||||
const auto* const PCOLACTIVE = GROUPLOCKED ? GROUPCOLACTIVELOCKED : GROUPCOLACTIVE;
|
const auto* const PCOLACTIVE = GROUPLOCKED ? GROUPCOLACTIVELOCKED : GROUPCOLACTIVE;
|
||||||
const auto* const PCOLINACTIVE = GROUPLOCKED ? GROUPCOLINACTIVELOCKED : GROUPCOLINACTIVE;
|
const auto* const PCOLINACTIVE = GROUPLOCKED ? GROUPCOLINACTIVELOCKED : GROUPCOLINACTIVE;
|
||||||
|
|
||||||
CColor color = m_dwGroupMembers[i] == g_pCompositor->m_pLastWindow ? PCOLACTIVE->m_vColors[0] : PCOLINACTIVE->m_vColors[0];
|
CColor color = m_dwGroupMembers[i].lock() == g_pCompositor->m_pLastWindow.lock() ? PCOLACTIVE->m_vColors[0] : PCOLINACTIVE->m_vColors[0];
|
||||||
color.a *= a;
|
color.a *= a;
|
||||||
g_pHyprOpenGL->renderRect(&rect, color);
|
g_pHyprOpenGL->renderRect(&rect, color);
|
||||||
|
|
||||||
rect = {ASSIGNEDBOX.x + xoff - pMonitor->vecPosition.x + m_pWindow->m_vFloatingOffset.x,
|
rect = {ASSIGNEDBOX.x + xoff - pMonitor->vecPosition.x + m_pWindow.lock()->m_vFloatingOffset.x,
|
||||||
ASSIGNEDBOX.y - pMonitor->vecPosition.y + m_pWindow->m_vFloatingOffset.y + BAR_PADDING_OUTER_VERT, m_fBarWidth,
|
ASSIGNEDBOX.y - pMonitor->vecPosition.y + m_pWindow.lock()->m_vFloatingOffset.y + BAR_PADDING_OUTER_VERT, m_fBarWidth,
|
||||||
ASSIGNEDBOX.h - BAR_INDICATOR_HEIGHT - BAR_PADDING_OUTER_VERT * 2};
|
ASSIGNEDBOX.h - BAR_INDICATOR_HEIGHT - BAR_PADDING_OUTER_VERT * 2};
|
||||||
rect.scale(pMonitor->scale);
|
rect.scale(pMonitor->scale);
|
||||||
|
|
||||||
if (*PGRADIENTS) {
|
if (*PGRADIENTS) {
|
||||||
const auto& GRADIENTTEX = (m_dwGroupMembers[i] == g_pCompositor->m_pLastWindow ? (GROUPLOCKED ? m_tGradientLockedActive : m_tGradientActive) :
|
const auto& GRADIENTTEX = (m_dwGroupMembers[i].lock() == g_pCompositor->m_pLastWindow.lock() ? (GROUPLOCKED ? m_tGradientLockedActive : m_tGradientActive) :
|
||||||
(GROUPLOCKED ? m_tGradientLockedInactive : m_tGradientInactive));
|
(GROUPLOCKED ? m_tGradientLockedInactive : m_tGradientInactive));
|
||||||
if (GRADIENTTEX.m_iTexID != 0)
|
if (GRADIENTTEX.m_iTexID != 0)
|
||||||
g_pHyprOpenGL->renderTexture(GRADIENTTEX, &rect, 1.0);
|
g_pHyprOpenGL->renderTexture(GRADIENTTEX, &rect, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*PRENDERTITLES) {
|
if (*PRENDERTITLES) {
|
||||||
CTitleTex* pTitleTex = textureFromTitle(m_dwGroupMembers[i]->m_szTitle);
|
CTitleTex* pTitleTex = textureFromTitle(m_dwGroupMembers[i].lock()->m_szTitle);
|
||||||
|
|
||||||
if (!pTitleTex)
|
if (!pTitleTex)
|
||||||
pTitleTex = m_sTitleTexs.titleTexs
|
pTitleTex = m_sTitleTexs.titleTexs
|
||||||
.emplace_back(std::make_unique<CTitleTex>(m_dwGroupMembers[i],
|
.emplace_back(std::make_unique<CTitleTex>(m_dwGroupMembers[i].lock(),
|
||||||
Vector2D{m_fBarWidth * pMonitor->scale, (*PTITLEFONTSIZE + 2 * BAR_TEXT_PAD) * pMonitor->scale}))
|
Vector2D{m_fBarWidth * pMonitor->scale, (*PTITLEFONTSIZE + 2 * BAR_TEXT_PAD) * pMonitor->scale}))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ void CHyprGroupBarDecoration::invalidateTextures() {
|
||||||
m_sTitleTexs.titleTexs.clear();
|
m_sTitleTexs.titleTexs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
CTitleTex::CTitleTex(CWindow* pWindow, const Vector2D& bufferSize) {
|
CTitleTex::CTitleTex(PHLWINDOW pWindow, const Vector2D& bufferSize) {
|
||||||
szContent = pWindow->m_szTitle;
|
szContent = pWindow->m_szTitle;
|
||||||
pWindowOwner = pWindow;
|
pWindowOwner = pWindow;
|
||||||
const auto CAIROSURFACE = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, bufferSize.x, bufferSize.y);
|
const auto CAIROSURFACE = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, bufferSize.x, bufferSize.y);
|
||||||
|
@ -335,7 +335,7 @@ void refreshGroupBarGradients() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CHyprGroupBarDecoration::onBeginWindowDragOnDeco(const Vector2D& pos) {
|
bool CHyprGroupBarDecoration::onBeginWindowDragOnDeco(const Vector2D& pos) {
|
||||||
if (m_pWindow == m_pWindow->m_sGroupData.pNextWindow)
|
if (m_pWindow.lock() == m_pWindow.lock()->m_sGroupData.pNextWindow.lock())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const float BARRELATIVEX = pos.x - assignedBoxGlobal().x;
|
const float BARRELATIVEX = pos.x - assignedBoxGlobal().x;
|
||||||
|
@ -344,7 +344,7 @@ bool CHyprGroupBarDecoration::onBeginWindowDragOnDeco(const Vector2D& pos) {
|
||||||
if (BARRELATIVEX - (m_fBarWidth + BAR_HORIZONTAL_PADDING) * WINDOWINDEX > m_fBarWidth)
|
if (BARRELATIVEX - (m_fBarWidth + BAR_HORIZONTAL_PADDING) * WINDOWINDEX > m_fBarWidth)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
CWindow* pWindow = m_pWindow->getGroupWindowByIndex(WINDOWINDEX);
|
PHLWINDOW pWindow = m_pWindow.lock()->getGroupWindowByIndex(WINDOWINDEX);
|
||||||
|
|
||||||
// hack
|
// hack
|
||||||
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow);
|
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow);
|
||||||
|
@ -363,33 +363,33 @@ bool CHyprGroupBarDecoration::onBeginWindowDragOnDeco(const Vector2D& pos) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, CWindow* pDraggedWindow) {
|
bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, PHLWINDOW pDraggedWindow) {
|
||||||
if (!pDraggedWindow->canBeGroupedInto(m_pWindow))
|
if (!pDraggedWindow->canBeGroupedInto(m_pWindow.lock()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const float BARRELATIVEX = pos.x - assignedBoxGlobal().x - m_fBarWidth / 2;
|
const float BARRELATIVEX = pos.x - assignedBoxGlobal().x - m_fBarWidth / 2;
|
||||||
const int WINDOWINDEX = BARRELATIVEX < 0 ? -1 : (BARRELATIVEX) / (m_fBarWidth + BAR_HORIZONTAL_PADDING);
|
const int WINDOWINDEX = BARRELATIVEX < 0 ? -1 : (BARRELATIVEX) / (m_fBarWidth + BAR_HORIZONTAL_PADDING);
|
||||||
|
|
||||||
CWindow* pWindowInsertAfter = m_pWindow->getGroupWindowByIndex(WINDOWINDEX);
|
PHLWINDOW pWindowInsertAfter = m_pWindow.lock()->getGroupWindowByIndex(WINDOWINDEX);
|
||||||
CWindow* pWindowInsertEnd = pWindowInsertAfter->m_sGroupData.pNextWindow;
|
PHLWINDOW pWindowInsertEnd = pWindowInsertAfter->m_sGroupData.pNextWindow.lock();
|
||||||
CWindow* pDraggedHead = pDraggedWindow->m_sGroupData.pNextWindow ? pDraggedWindow->getGroupHead() : pDraggedWindow;
|
PHLWINDOW pDraggedHead = pDraggedWindow->m_sGroupData.pNextWindow.lock() ? pDraggedWindow->getGroupHead() : pDraggedWindow;
|
||||||
|
|
||||||
if (pDraggedWindow->m_sGroupData.pNextWindow) {
|
if (!pDraggedWindow->m_sGroupData.pNextWindow.expired()) {
|
||||||
|
|
||||||
// stores group data
|
// stores group data
|
||||||
std::vector<CWindow*> members;
|
std::vector<PHLWINDOW> members;
|
||||||
CWindow* curr = pDraggedHead;
|
PHLWINDOW curr = pDraggedHead;
|
||||||
const bool WASLOCKED = pDraggedHead->m_sGroupData.locked;
|
const bool WASLOCKED = pDraggedHead->m_sGroupData.locked;
|
||||||
do {
|
do {
|
||||||
members.push_back(curr);
|
members.push_back(curr);
|
||||||
curr = curr->m_sGroupData.pNextWindow;
|
curr = curr->m_sGroupData.pNextWindow.lock();
|
||||||
} while (curr != members[0]);
|
} while (curr != members[0]);
|
||||||
|
|
||||||
// removes all windows
|
// removes all windows
|
||||||
for (CWindow* w : members) {
|
for (PHLWINDOW w : members) {
|
||||||
w->m_sGroupData.pNextWindow = nullptr;
|
w->m_sGroupData.pNextWindow.reset();
|
||||||
w->m_sGroupData.head = false;
|
w->m_sGroupData.head = false;
|
||||||
w->m_sGroupData.locked = false;
|
w->m_sGroupData.locked = false;
|
||||||
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(w);
|
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, CWindow
|
||||||
if (WINDOWINDEX == -1)
|
if (WINDOWINDEX == -1)
|
||||||
std::swap(pDraggedHead->m_sGroupData.head, pWindowInsertEnd->m_sGroupData.head);
|
std::swap(pDraggedHead->m_sGroupData.head, pWindowInsertEnd->m_sGroupData.head);
|
||||||
|
|
||||||
m_pWindow->setGroupCurrent(pDraggedWindow);
|
m_pWindow.lock()->setGroupCurrent(pDraggedWindow);
|
||||||
pDraggedWindow->applyGroupRules();
|
pDraggedWindow->applyGroupRules();
|
||||||
pDraggedWindow->updateWindowDecos();
|
pDraggedWindow->updateWindowDecos();
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateWindow(pDraggedWindow);
|
g_pLayoutManager->getCurrentLayout()->recalculateWindow(pDraggedWindow);
|
||||||
|
@ -423,7 +423,7 @@ bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, CWindow
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, wlr_pointer_button_event* e) {
|
bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, wlr_pointer_button_event* e) {
|
||||||
if (m_pWindow->m_bIsFullscreen && m_pWindow->m_pWorkspace->m_efFullscreenMode == FULLSCREEN_FULL)
|
if (m_pWindow.lock()->m_bIsFullscreen && m_pWindow.lock()->m_pWorkspace->m_efFullscreenMode == FULLSCREEN_FULL)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
const float BARRELATIVEX = pos.x - assignedBoxGlobal().x;
|
const float BARRELATIVEX = pos.x - assignedBoxGlobal().x;
|
||||||
|
@ -437,7 +437,7 @@ bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, wlr_point
|
||||||
if (e->state == WL_POINTER_BUTTON_STATE_PRESSED)
|
if (e->state == WL_POINTER_BUTTON_STATE_PRESSED)
|
||||||
pressedCursorPos = pos;
|
pressedCursorPos = pos;
|
||||||
else if (e->state == WL_POINTER_BUTTON_STATE_RELEASED && pressedCursorPos == pos)
|
else if (e->state == WL_POINTER_BUTTON_STATE_RELEASED && pressedCursorPos == pos)
|
||||||
g_pXWaylandManager->sendCloseWindow(m_pWindow->getGroupWindowByIndex(WINDOWINDEX));
|
g_pXWaylandManager->sendCloseWindow(m_pWindow.lock()->getGroupWindowByIndex(WINDOWINDEX));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -447,14 +447,14 @@ bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, wlr_point
|
||||||
|
|
||||||
// click on padding
|
// click on padding
|
||||||
if (BARRELATIVEX - (m_fBarWidth + BAR_HORIZONTAL_PADDING) * WINDOWINDEX > m_fBarWidth) {
|
if (BARRELATIVEX - (m_fBarWidth + BAR_HORIZONTAL_PADDING) * WINDOWINDEX > m_fBarWidth) {
|
||||||
if (!g_pCompositor->isWindowActive(m_pWindow))
|
if (!g_pCompositor->isWindowActive(m_pWindow.lock()))
|
||||||
g_pCompositor->focusWindow(m_pWindow);
|
g_pCompositor->focusWindow(m_pWindow.lock());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWindow* pWindow = m_pWindow->getGroupWindowByIndex(WINDOWINDEX);
|
PHLWINDOW pWindow = m_pWindow.lock()->getGroupWindowByIndex(WINDOWINDEX);
|
||||||
|
|
||||||
if (pWindow != m_pWindow)
|
if (pWindow != m_pWindow.lock())
|
||||||
pWindow->setGroupCurrent(pWindow);
|
pWindow->setGroupCurrent(pWindow);
|
||||||
|
|
||||||
if (!g_pCompositor->isWindowActive(pWindow) && *PFOLLOWMOUSE != 3)
|
if (!g_pCompositor->isWindowActive(pWindow) && *PFOLLOWMOUSE != 3)
|
||||||
|
@ -469,13 +469,13 @@ bool CHyprGroupBarDecoration::onMouseButtonOnDeco(const Vector2D& pos, wlr_point
|
||||||
bool CHyprGroupBarDecoration::onScrollOnDeco(const Vector2D& pos, wlr_pointer_axis_event* e) {
|
bool CHyprGroupBarDecoration::onScrollOnDeco(const Vector2D& pos, wlr_pointer_axis_event* e) {
|
||||||
static auto PGROUPBARSCROLLING = CConfigValue<Hyprlang::INT>("group:groupbar:scrolling");
|
static auto PGROUPBARSCROLLING = CConfigValue<Hyprlang::INT>("group:groupbar:scrolling");
|
||||||
|
|
||||||
if (!*PGROUPBARSCROLLING || !m_pWindow->m_sGroupData.pNextWindow)
|
if (!*PGROUPBARSCROLLING || m_pWindow.lock()->m_sGroupData.pNextWindow.expired())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (e->delta > 0)
|
if (e->delta > 0)
|
||||||
m_pWindow->setGroupCurrent(m_pWindow->m_sGroupData.pNextWindow);
|
m_pWindow.lock()->setGroupCurrent(m_pWindow.lock()->m_sGroupData.pNextWindow.lock());
|
||||||
else
|
else
|
||||||
m_pWindow->setGroupCurrent(m_pWindow->getGroupPrevious());
|
m_pWindow.lock()->setGroupCurrent(m_pWindow.lock()->getGroupPrevious());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -485,7 +485,7 @@ bool CHyprGroupBarDecoration::onInputOnDeco(const eInputType type, const Vector2
|
||||||
case INPUT_TYPE_AXIS: return onScrollOnDeco(mouseCoords, std::any_cast<wlr_pointer_axis_event*>(data));
|
case INPUT_TYPE_AXIS: return onScrollOnDeco(mouseCoords, std::any_cast<wlr_pointer_axis_event*>(data));
|
||||||
case INPUT_TYPE_BUTTON: return onMouseButtonOnDeco(mouseCoords, std::any_cast<wlr_pointer_button_event*>(data));
|
case INPUT_TYPE_BUTTON: return onMouseButtonOnDeco(mouseCoords, std::any_cast<wlr_pointer_button_event*>(data));
|
||||||
case INPUT_TYPE_DRAG_START: return onBeginWindowDragOnDeco(mouseCoords);
|
case INPUT_TYPE_DRAG_START: return onBeginWindowDragOnDeco(mouseCoords);
|
||||||
case INPUT_TYPE_DRAG_END: return onEndWindowDragOnDeco(mouseCoords, std::any_cast<CWindow*>(data));
|
case INPUT_TYPE_DRAG_END: return onEndWindowDragOnDeco(mouseCoords, std::any_cast<PHLWINDOW>(data));
|
||||||
default: return false;
|
default: return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -504,11 +504,11 @@ std::string CHyprGroupBarDecoration::getDisplayName() {
|
||||||
|
|
||||||
CBox CHyprGroupBarDecoration::assignedBoxGlobal() {
|
CBox CHyprGroupBarDecoration::assignedBoxGlobal() {
|
||||||
CBox box = m_bAssignedBox;
|
CBox box = m_bAssignedBox;
|
||||||
box.translate(g_pDecorationPositioner->getEdgeDefinedPoint(DECORATION_EDGE_TOP, m_pWindow));
|
box.translate(g_pDecorationPositioner->getEdgeDefinedPoint(DECORATION_EDGE_TOP, m_pWindow.lock()));
|
||||||
|
|
||||||
const auto PWORKSPACE = m_pWindow->m_pWorkspace;
|
const auto PWORKSPACE = m_pWindow.lock()->m_pWorkspace;
|
||||||
|
|
||||||
if (PWORKSPACE && !m_pWindow->m_bPinned)
|
if (PWORKSPACE && !m_pWindow.lock()->m_bPinned)
|
||||||
box.translate(PWORKSPACE->m_vRenderOffset.value());
|
box.translate(PWORKSPACE->m_vRenderOffset.value());
|
||||||
|
|
||||||
return box;
|
return box;
|
||||||
|
|
|
@ -8,19 +8,19 @@
|
||||||
|
|
||||||
class CTitleTex {
|
class CTitleTex {
|
||||||
public:
|
public:
|
||||||
CTitleTex(CWindow* pWindow, const Vector2D& bufferSize);
|
CTitleTex(PHLWINDOW pWindow, const Vector2D& bufferSize);
|
||||||
~CTitleTex();
|
~CTitleTex();
|
||||||
|
|
||||||
CTexture tex;
|
CTexture tex;
|
||||||
std::string szContent;
|
std::string szContent;
|
||||||
CWindow* pWindowOwner = nullptr;
|
PHLWINDOWREF pWindowOwner;
|
||||||
};
|
};
|
||||||
|
|
||||||
void refreshGroupBarGradients();
|
void refreshGroupBarGradients();
|
||||||
|
|
||||||
class CHyprGroupBarDecoration : public IHyprWindowDecoration {
|
class CHyprGroupBarDecoration : public IHyprWindowDecoration {
|
||||||
public:
|
public:
|
||||||
CHyprGroupBarDecoration(CWindow*);
|
CHyprGroupBarDecoration(PHLWINDOW);
|
||||||
virtual ~CHyprGroupBarDecoration();
|
virtual ~CHyprGroupBarDecoration();
|
||||||
|
|
||||||
virtual SDecorationPositioningInfo getPositioningInfo();
|
virtual SDecorationPositioningInfo getPositioningInfo();
|
||||||
|
@ -31,7 +31,7 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration {
|
||||||
|
|
||||||
virtual eDecorationType getDecorationType();
|
virtual eDecorationType getDecorationType();
|
||||||
|
|
||||||
virtual void updateWindow(CWindow*);
|
virtual void updateWindow(PHLWINDOW);
|
||||||
|
|
||||||
virtual void damageEntire();
|
virtual void damageEntire();
|
||||||
|
|
||||||
|
@ -48,9 +48,9 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration {
|
||||||
|
|
||||||
CBox m_bAssignedBox = {0};
|
CBox m_bAssignedBox = {0};
|
||||||
|
|
||||||
CWindow* m_pWindow = nullptr;
|
PHLWINDOWREF m_pWindow;
|
||||||
|
|
||||||
std::deque<CWindow*> m_dwGroupMembers;
|
std::deque<PHLWINDOWREF> m_dwGroupMembers;
|
||||||
|
|
||||||
float m_fBarWidth;
|
float m_fBarWidth;
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class CHyprGroupBarDecoration : public IHyprWindowDecoration {
|
||||||
CBox assignedBoxGlobal();
|
CBox assignedBoxGlobal();
|
||||||
|
|
||||||
bool onBeginWindowDragOnDeco(const Vector2D&);
|
bool onBeginWindowDragOnDeco(const Vector2D&);
|
||||||
bool onEndWindowDragOnDeco(const Vector2D&, CWindow*);
|
bool onEndWindowDragOnDeco(const Vector2D&, PHLWINDOW);
|
||||||
bool onMouseButtonOnDeco(const Vector2D&, wlr_pointer_button_event*);
|
bool onMouseButtonOnDeco(const Vector2D&, wlr_pointer_button_event*);
|
||||||
bool onScrollOnDeco(const Vector2D&, wlr_pointer_axis_event*);
|
bool onScrollOnDeco(const Vector2D&, wlr_pointer_axis_event*);
|
||||||
|
|
||||||
|
|
|
@ -3,17 +3,17 @@
|
||||||
|
|
||||||
CDecorationPositioner::CDecorationPositioner() {
|
CDecorationPositioner::CDecorationPositioner() {
|
||||||
static auto P = g_pHookSystem->hookDynamic("closeWindow", [this](void* call, SCallbackInfo& info, std::any data) {
|
static auto P = g_pHookSystem->hookDynamic("closeWindow", [this](void* call, SCallbackInfo& info, std::any data) {
|
||||||
auto* const PWINDOW = std::any_cast<CWindow*>(data);
|
auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||||
this->onWindowUnmap(PWINDOW);
|
this->onWindowUnmap(PWINDOW);
|
||||||
});
|
});
|
||||||
|
|
||||||
static auto P2 = g_pHookSystem->hookDynamic("openWindow", [this](void* call, SCallbackInfo& info, std::any data) {
|
static auto P2 = g_pHookSystem->hookDynamic("openWindow", [this](void* call, SCallbackInfo& info, std::any data) {
|
||||||
auto* const PWINDOW = std::any_cast<CWindow*>(data);
|
auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||||
this->onWindowMap(PWINDOW);
|
this->onWindowMap(PWINDOW);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D CDecorationPositioner::getEdgeDefinedPoint(uint32_t edges, CWindow* pWindow) {
|
Vector2D CDecorationPositioner::getEdgeDefinedPoint(uint32_t edges, PHLWINDOW pWindow) {
|
||||||
const bool TOP = edges & DECORATION_EDGE_TOP;
|
const bool TOP = edges & DECORATION_EDGE_TOP;
|
||||||
const bool BOTTOM = edges & DECORATION_EDGE_BOTTOM;
|
const bool BOTTOM = edges & DECORATION_EDGE_BOTTOM;
|
||||||
const bool LEFT = edges & DECORATION_EDGE_LEFT;
|
const bool LEFT = edges & DECORATION_EDGE_LEFT;
|
||||||
|
@ -57,9 +57,9 @@ Vector2D CDecorationPositioner::getEdgeDefinedPoint(uint32_t edges, CWindow* pWi
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDecorationPositioner::uncacheDecoration(IHyprWindowDecoration* deco) {
|
void CDecorationPositioner::uncacheDecoration(IHyprWindowDecoration* deco) {
|
||||||
std::erase_if(m_vWindowPositioningDatas, [&](const auto& data) { return data->pDecoration == deco; });
|
std::erase_if(m_vWindowPositioningDatas, [&](const auto& data) { return !data->pWindow.lock() || data->pDecoration == deco; });
|
||||||
|
|
||||||
const auto WIT = std::find_if(m_mWindowDatas.begin(), m_mWindowDatas.end(), [&](const auto& other) { return other.first == deco->m_pWindow; });
|
const auto WIT = std::find_if(m_mWindowDatas.begin(), m_mWindowDatas.end(), [&](const auto& other) { return other.first.lock() == deco->m_pWindow.lock(); });
|
||||||
if (WIT == m_mWindowDatas.end())
|
if (WIT == m_mWindowDatas.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -68,10 +68,10 @@ void CDecorationPositioner::uncacheDecoration(IHyprWindowDecoration* deco) {
|
||||||
|
|
||||||
void CDecorationPositioner::repositionDeco(IHyprWindowDecoration* deco) {
|
void CDecorationPositioner::repositionDeco(IHyprWindowDecoration* deco) {
|
||||||
uncacheDecoration(deco);
|
uncacheDecoration(deco);
|
||||||
onWindowUpdate(deco->m_pWindow);
|
onWindowUpdate(deco->m_pWindow.lock());
|
||||||
}
|
}
|
||||||
|
|
||||||
CDecorationPositioner::SWindowPositioningData* CDecorationPositioner::getDataFor(IHyprWindowDecoration* pDecoration, CWindow* pWindow) {
|
CDecorationPositioner::SWindowPositioningData* CDecorationPositioner::getDataFor(IHyprWindowDecoration* pDecoration, PHLWINDOW pWindow) {
|
||||||
auto it = std::find_if(m_vWindowPositioningDatas.begin(), m_vWindowPositioningDatas.end(), [&](const auto& el) { return el->pDecoration == pDecoration; });
|
auto it = std::find_if(m_vWindowPositioningDatas.begin(), m_vWindowPositioningDatas.end(), [&](const auto& el) { return el->pDecoration == pDecoration; });
|
||||||
|
|
||||||
if (it != m_vWindowPositioningDatas.end())
|
if (it != m_vWindowPositioningDatas.end())
|
||||||
|
@ -85,19 +85,19 @@ CDecorationPositioner::SWindowPositioningData* CDecorationPositioner::getDataFor
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDecorationPositioner::sanitizeDatas() {
|
void CDecorationPositioner::sanitizeDatas() {
|
||||||
std::erase_if(m_mWindowDatas, [](const auto& other) { return !g_pCompositor->windowExists(other.first); });
|
std::erase_if(m_mWindowDatas, [](const auto& other) { return !valid(other.first); });
|
||||||
std::erase_if(m_vWindowPositioningDatas, [](const auto& other) {
|
std::erase_if(m_vWindowPositioningDatas, [](const auto& other) {
|
||||||
if (!g_pCompositor->windowExists(other->pWindow))
|
if (!validMapped(other->pWindow))
|
||||||
return true;
|
return true;
|
||||||
if (std::find_if(other->pWindow->m_dWindowDecorations.begin(), other->pWindow->m_dWindowDecorations.end(),
|
if (std::find_if(other->pWindow.lock()->m_dWindowDecorations.begin(), other->pWindow.lock()->m_dWindowDecorations.end(),
|
||||||
[&](const auto& el) { return el.get() == other->pDecoration; }) == other->pWindow->m_dWindowDecorations.end())
|
[&](const auto& el) { return el.get() == other->pDecoration; }) == other->pWindow.lock()->m_dWindowDecorations.end())
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDecorationPositioner::forceRecalcFor(CWindow* pWindow) {
|
void CDecorationPositioner::forceRecalcFor(PHLWINDOW pWindow) {
|
||||||
const auto WIT = std::find_if(m_mWindowDatas.begin(), m_mWindowDatas.end(), [&](const auto& other) { return other.first == pWindow; });
|
const auto WIT = std::find_if(m_mWindowDatas.begin(), m_mWindowDatas.end(), [&](const auto& other) { return other.first.lock() == pWindow; });
|
||||||
if (WIT == m_mWindowDatas.end())
|
if (WIT == m_mWindowDatas.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -106,11 +106,11 @@ void CDecorationPositioner::forceRecalcFor(CWindow* pWindow) {
|
||||||
WINDOWDATA->needsRecalc = true;
|
WINDOWDATA->needsRecalc = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDecorationPositioner::onWindowUpdate(CWindow* pWindow) {
|
void CDecorationPositioner::onWindowUpdate(PHLWINDOW pWindow) {
|
||||||
if (!g_pCompositor->windowExists(pWindow) || !pWindow->m_bIsMapped)
|
if (!validMapped(pWindow))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto WIT = std::find_if(m_mWindowDatas.begin(), m_mWindowDatas.end(), [&](const auto& other) { return other.first == pWindow; });
|
const auto WIT = std::find_if(m_mWindowDatas.begin(), m_mWindowDatas.end(), [&](const auto& other) { return other.first.lock() == pWindow; });
|
||||||
if (WIT == m_mWindowDatas.end())
|
if (WIT == m_mWindowDatas.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -125,8 +125,8 @@ void CDecorationPositioner::onWindowUpdate(CWindow* pWindow) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WINDOWDATA->lastWindowSize == pWindow->m_vRealSize.value() /* position not changed */
|
if (WINDOWDATA->lastWindowSize == pWindow->m_vRealSize.value() /* position not changed */
|
||||||
&&
|
&& std::all_of(m_vWindowPositioningDatas.begin(), m_vWindowPositioningDatas.end(),
|
||||||
std::all_of(m_vWindowPositioningDatas.begin(), m_vWindowPositioningDatas.end(), [pWindow](const auto& data) { return pWindow != data->pWindow || !data->needsReposition; })
|
[pWindow](const auto& data) { return pWindow != data->pWindow.lock() || !data->needsReposition; })
|
||||||
/* all window datas are either not for this window or don't need a reposition */
|
/* all window datas are either not for this window or don't need a reposition */
|
||||||
&& !WINDOWDATA->needsRecalc /* window doesn't need recalc */
|
&& !WINDOWDATA->needsRecalc /* window doesn't need recalc */
|
||||||
)
|
)
|
||||||
|
@ -269,30 +269,30 @@ void CDecorationPositioner::onWindowUpdate(CWindow* pWindow) {
|
||||||
WINDOWDATA->extents = {{stickyOffsetXL + reservedXL, stickyOffsetYT + reservedYT}, {stickyOffsetXR + reservedXR, stickyOffsetYB + reservedYB}};
|
WINDOWDATA->extents = {{stickyOffsetXL + reservedXL, stickyOffsetYT + reservedYT}, {stickyOffsetXR + reservedXR, stickyOffsetYB + reservedYB}};
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDecorationPositioner::onWindowUnmap(CWindow* pWindow) {
|
void CDecorationPositioner::onWindowUnmap(PHLWINDOW pWindow) {
|
||||||
std::erase_if(m_vWindowPositioningDatas, [&](const auto& data) { return data->pWindow == pWindow; });
|
std::erase_if(m_vWindowPositioningDatas, [&](const auto& data) { return data->pWindow.lock() == pWindow; });
|
||||||
m_mWindowDatas.erase(pWindow);
|
m_mWindowDatas.erase(pWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDecorationPositioner::onWindowMap(CWindow* pWindow) {
|
void CDecorationPositioner::onWindowMap(PHLWINDOW pWindow) {
|
||||||
m_mWindowDatas[pWindow] = {};
|
m_mWindowDatas[pWindow] = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
SWindowDecorationExtents CDecorationPositioner::getWindowDecorationReserved(CWindow* pWindow) {
|
SWindowDecorationExtents CDecorationPositioner::getWindowDecorationReserved(PHLWINDOW pWindow) {
|
||||||
try {
|
try {
|
||||||
const auto E = m_mWindowDatas.at(pWindow);
|
const auto E = m_mWindowDatas.at(pWindow);
|
||||||
return E.reserved;
|
return E.reserved;
|
||||||
} catch (std::out_of_range& e) { return {}; }
|
} catch (std::out_of_range& e) { return {}; }
|
||||||
}
|
}
|
||||||
|
|
||||||
SWindowDecorationExtents CDecorationPositioner::getWindowDecorationExtents(CWindow* pWindow, bool inputOnly) {
|
SWindowDecorationExtents CDecorationPositioner::getWindowDecorationExtents(PHLWINDOW pWindow, bool inputOnly) {
|
||||||
CBox accum = pWindow->getWindowMainSurfaceBox();
|
CBox accum = pWindow->getWindowMainSurfaceBox();
|
||||||
|
|
||||||
for (auto& data : m_vWindowPositioningDatas) {
|
for (auto& data : m_vWindowPositioningDatas) {
|
||||||
if (data->pWindow != pWindow)
|
if (data->pWindow.lock() != pWindow)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!data->pWindow || !data->pDecoration)
|
if (!data->pWindow.lock() || !data->pDecoration)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!(data->pDecoration->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT) && inputOnly)
|
if (!(data->pDecoration->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT) && inputOnly)
|
||||||
|
@ -301,7 +301,7 @@ SWindowDecorationExtents CDecorationPositioner::getWindowDecorationExtents(CWind
|
||||||
CBox decoBox;
|
CBox decoBox;
|
||||||
|
|
||||||
if (data->positioningInfo.policy == DECORATION_POSITION_ABSOLUTE) {
|
if (data->positioningInfo.policy == DECORATION_POSITION_ABSOLUTE) {
|
||||||
decoBox = data->pWindow->getWindowMainSurfaceBox();
|
decoBox = data->pWindow.lock()->getWindowMainSurfaceBox();
|
||||||
decoBox.addExtents(data->positioningInfo.desiredExtents);
|
decoBox.addExtents(data->positioningInfo.desiredExtents);
|
||||||
} else {
|
} else {
|
||||||
decoBox = data->lastReply.assignedGeometry;
|
decoBox = data->lastReply.assignedGeometry;
|
||||||
|
@ -326,11 +326,11 @@ SWindowDecorationExtents CDecorationPositioner::getWindowDecorationExtents(CWind
|
||||||
return accum.extentsFrom(pWindow->getWindowMainSurfaceBox());
|
return accum.extentsFrom(pWindow->getWindowMainSurfaceBox());
|
||||||
}
|
}
|
||||||
|
|
||||||
CBox CDecorationPositioner::getBoxWithIncludedDecos(CWindow* pWindow) {
|
CBox CDecorationPositioner::getBoxWithIncludedDecos(PHLWINDOW pWindow) {
|
||||||
CBox accum = pWindow->getWindowMainSurfaceBox();
|
CBox accum = pWindow->getWindowMainSurfaceBox();
|
||||||
|
|
||||||
for (auto& data : m_vWindowPositioningDatas) {
|
for (auto& data : m_vWindowPositioningDatas) {
|
||||||
if (data->pWindow != pWindow)
|
if (data->pWindow.lock() != pWindow)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!(data->pDecoration->getDecorationFlags() & DECORATION_PART_OF_MAIN_WINDOW))
|
if (!(data->pDecoration->getDecorationFlags() & DECORATION_PART_OF_MAIN_WINDOW))
|
||||||
|
@ -339,7 +339,7 @@ CBox CDecorationPositioner::getBoxWithIncludedDecos(CWindow* pWindow) {
|
||||||
CBox decoBox;
|
CBox decoBox;
|
||||||
|
|
||||||
if (data->positioningInfo.policy == DECORATION_POSITION_ABSOLUTE) {
|
if (data->positioningInfo.policy == DECORATION_POSITION_ABSOLUTE) {
|
||||||
decoBox = data->pWindow->getWindowMainSurfaceBox();
|
decoBox = data->pWindow.lock()->getWindowMainSurfaceBox();
|
||||||
decoBox.addExtents(data->positioningInfo.desiredExtents);
|
decoBox.addExtents(data->positioningInfo.desiredExtents);
|
||||||
} else {
|
} else {
|
||||||
decoBox = data->lastReply.assignedGeometry;
|
decoBox = data->lastReply.assignedGeometry;
|
||||||
|
@ -365,9 +365,9 @@ CBox CDecorationPositioner::getBoxWithIncludedDecos(CWindow* pWindow) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CBox CDecorationPositioner::getWindowDecorationBox(IHyprWindowDecoration* deco) {
|
CBox CDecorationPositioner::getWindowDecorationBox(IHyprWindowDecoration* deco) {
|
||||||
const auto DATA = getDataFor(deco, deco->m_pWindow);
|
const auto DATA = getDataFor(deco, deco->m_pWindow.lock());
|
||||||
|
|
||||||
CBox box = DATA->lastReply.assignedGeometry;
|
CBox box = DATA->lastReply.assignedGeometry;
|
||||||
box.translate(getEdgeDefinedPoint(DATA->positioningInfo.edges, deco->m_pWindow));
|
box.translate(getEdgeDefinedPoint(DATA->positioningInfo.edges, deco->m_pWindow.lock()));
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,15 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <unordered_map>
|
#include <map>
|
||||||
#include "../../helpers/Box.hpp"
|
#include "../../helpers/Box.hpp"
|
||||||
|
|
||||||
class CWindow;
|
class CWindow;
|
||||||
class IHyprWindowDecoration;
|
class IHyprWindowDecoration;
|
||||||
|
|
||||||
|
typedef std::shared_ptr<CWindow> PHLWINDOW;
|
||||||
|
typedef std::weak_ptr<CWindow> PHLWINDOWREF;
|
||||||
|
|
||||||
enum eDecorationPositioningPolicy {
|
enum eDecorationPositioningPolicy {
|
||||||
DECORATION_POSITION_ABSOLUTE = 0, /* Decoration wants absolute positioning */
|
DECORATION_POSITION_ABSOLUTE = 0, /* Decoration wants absolute positioning */
|
||||||
DECORATION_POSITION_STICKY, /* Decoration is stuck to some edge of a window */
|
DECORATION_POSITION_STICKY, /* Decoration is stuck to some edge of a window */
|
||||||
|
@ -59,21 +62,21 @@ class CDecorationPositioner {
|
||||||
public:
|
public:
|
||||||
CDecorationPositioner();
|
CDecorationPositioner();
|
||||||
|
|
||||||
Vector2D getEdgeDefinedPoint(uint32_t edges, CWindow* pWindow);
|
Vector2D getEdgeDefinedPoint(uint32_t edges, PHLWINDOW pWindow);
|
||||||
|
|
||||||
// called on resize, or insert/removal of a new deco
|
// called on resize, or insert/removal of a new deco
|
||||||
void onWindowUpdate(CWindow* pWindow);
|
void onWindowUpdate(PHLWINDOW pWindow);
|
||||||
void uncacheDecoration(IHyprWindowDecoration* deco);
|
void uncacheDecoration(IHyprWindowDecoration* deco);
|
||||||
SWindowDecorationExtents getWindowDecorationReserved(CWindow* pWindow);
|
SWindowDecorationExtents getWindowDecorationReserved(PHLWINDOW pWindow);
|
||||||
SWindowDecorationExtents getWindowDecorationExtents(CWindow* pWindow, bool inputOnly = false);
|
SWindowDecorationExtents getWindowDecorationExtents(PHLWINDOW pWindow, bool inputOnly = false);
|
||||||
CBox getBoxWithIncludedDecos(CWindow* pWindow);
|
CBox getBoxWithIncludedDecos(PHLWINDOW pWindow);
|
||||||
void repositionDeco(IHyprWindowDecoration* deco);
|
void repositionDeco(IHyprWindowDecoration* deco);
|
||||||
CBox getWindowDecorationBox(IHyprWindowDecoration* deco);
|
CBox getWindowDecorationBox(IHyprWindowDecoration* deco);
|
||||||
void forceRecalcFor(CWindow* pWindow);
|
void forceRecalcFor(PHLWINDOW pWindow);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct SWindowPositioningData {
|
struct SWindowPositioningData {
|
||||||
CWindow* pWindow = nullptr;
|
PHLWINDOWREF pWindow;
|
||||||
IHyprWindowDecoration* pDecoration = nullptr;
|
IHyprWindowDecoration* pDecoration = nullptr;
|
||||||
SDecorationPositioningInfo positioningInfo;
|
SDecorationPositioningInfo positioningInfo;
|
||||||
SDecorationPositioningReply lastReply;
|
SDecorationPositioningReply lastReply;
|
||||||
|
@ -87,13 +90,13 @@ class CDecorationPositioner {
|
||||||
bool needsRecalc = false;
|
bool needsRecalc = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unordered_map<CWindow*, SWindowData> m_mWindowDatas;
|
std::map<PHLWINDOWREF, SWindowData, std::owner_less<PHLWINDOWREF>> m_mWindowDatas;
|
||||||
std::vector<std::unique_ptr<SWindowPositioningData>> m_vWindowPositioningDatas;
|
std::vector<std::unique_ptr<SWindowPositioningData>> m_vWindowPositioningDatas;
|
||||||
|
|
||||||
SWindowPositioningData* getDataFor(IHyprWindowDecoration* pDecoration, CWindow* pWindow);
|
SWindowPositioningData* getDataFor(IHyprWindowDecoration* pDecoration, PHLWINDOW pWindow);
|
||||||
void onWindowUnmap(CWindow* pWindow);
|
void onWindowUnmap(PHLWINDOW pWindow);
|
||||||
void onWindowMap(CWindow* pWindow);
|
void onWindowMap(PHLWINDOW pWindow);
|
||||||
void sanitizeDatas();
|
void sanitizeDatas();
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::unique_ptr<CDecorationPositioner> g_pDecorationPositioner;
|
inline std::unique_ptr<CDecorationPositioner> g_pDecorationPositioner;
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
class CWindow;
|
class CWindow;
|
||||||
|
|
||||||
IHyprWindowDecoration::IHyprWindowDecoration(CWindow* pWindow) {
|
IHyprWindowDecoration::IHyprWindowDecoration(PHLWINDOW pWindow) {
|
||||||
m_pWindow = pWindow;
|
m_pWindow = pWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ class CDecorationPositioner;
|
||||||
|
|
||||||
class IHyprWindowDecoration {
|
class IHyprWindowDecoration {
|
||||||
public:
|
public:
|
||||||
IHyprWindowDecoration(CWindow*);
|
IHyprWindowDecoration(PHLWINDOW);
|
||||||
virtual ~IHyprWindowDecoration() = 0;
|
virtual ~IHyprWindowDecoration() = 0;
|
||||||
|
|
||||||
virtual SDecorationPositioningInfo getPositioningInfo() = 0;
|
virtual SDecorationPositioningInfo getPositioningInfo() = 0;
|
||||||
|
@ -43,7 +43,7 @@ class IHyprWindowDecoration {
|
||||||
|
|
||||||
virtual eDecorationType getDecorationType() = 0;
|
virtual eDecorationType getDecorationType() = 0;
|
||||||
|
|
||||||
virtual void updateWindow(CWindow*) = 0;
|
virtual void updateWindow(PHLWINDOW) = 0;
|
||||||
|
|
||||||
virtual void damageEntire() = 0; // should be ignored by non-absolute decos
|
virtual void damageEntire() = 0; // should be ignored by non-absolute decos
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class IHyprWindowDecoration {
|
||||||
virtual std::string getDisplayName();
|
virtual std::string getDisplayName();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CWindow* m_pWindow = nullptr;
|
PHLWINDOWREF m_pWindow;
|
||||||
|
|
||||||
friend class CDecorationPositioner;
|
friend class CDecorationPositioner;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue