This commit is contained in:
Vaxry 2024-04-27 03:06:21 +01:00
parent 1d3023cf24
commit 8b21a37059
21 changed files with 99 additions and 94 deletions

View File

@ -362,7 +362,7 @@ 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.reset(); m_pLastWindow.reset();
// end threads // end threads
@ -693,8 +693,7 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
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 != pIgnoreWindow) {
if (box.containsPoint({m_sWLRCursor->x, m_sWLRCursor->y})) if (box.containsPoint({m_sWLRCursor->x, m_sWLRCursor->y}))
return w; return w;
@ -734,7 +733,7 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
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.lock(); // 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; return w;
@ -934,7 +933,7 @@ void CCompositor::focusWindow(PHLWINDOW 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", (PHLWINDOW)nullptr); EMIT_HOOK_EVENT("activeWindow", (PHLWINDOW) nullptr);
g_pLayoutManager->getCurrentLayout()->onWindowFocusChange(nullptr); g_pLayoutManager->getCurrentLayout()->onWindowFocusChange(nullptr);
@ -1327,7 +1326,7 @@ void CCompositor::changeWindowZOrder(PHLWINDOW pWindow, bool top) {
std::deque<PHLWINDOW> toMove; std::deque<PHLWINDOW> toMove;
auto x11Stack = [&](PHLWINDOW 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
@ -1464,7 +1463,7 @@ PHLWINDOW CCompositor::getWindowInDirection(PHLWINDOW pWindow, char dir) {
const auto PWORKSPACE = pWindow->m_pWorkspace; const auto PWORKSPACE = pWindow->m_pWorkspace;
auto leaderValue = -1; auto leaderValue = -1;
PHLWINDOW leaderWindow = nullptr; PHLWINDOW leaderWindow = nullptr;
if (!pWindow->m_bIsFloating) { if (!pWindow->m_bIsFloating) {
@ -1839,8 +1838,8 @@ void CCompositor::updateWindowAnimatedDecorationValues(PHLWINDOW pWindow) {
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.lock() ? (!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());
} }

View File

@ -148,8 +148,8 @@ static std::string getGroupedData(PHLWINDOW w, eHyprCtlOutputFormat format) {
std::ostringstream result; std::ostringstream result;
PHLWINDOW head = w->getGroupHead(); PHLWINDOW head = w->getGroupHead();
PHLWINDOW curr = head; PHLWINDOW curr = head;
while (true) { while (true) {
if (isJson) if (isJson)
result << std::format("\"0x{:x}\"", (uintptr_t)curr.get()); result << std::format("\"0x{:x}\"", (uintptr_t)curr.get());

View File

@ -45,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;
PHLWINDOWREF m_pWindowParent; 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;

View File

@ -113,10 +113,10 @@ void CWLSurface::destroy() {
hyprListener_commit.removeCallback(); hyprListener_commit.removeCallback();
m_pWLRSurface->data = nullptr; m_pWLRSurface->data = nullptr;
m_pWindowOwner.reset(); 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;

View File

@ -849,7 +849,7 @@ void CWindow::destroyGroup() {
return; return;
} }
m_sGroupData.pNextWindow.reset(); 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());
@ -861,8 +861,8 @@ void CWindow::destroyGroup() {
PHLWINDOW curr = m_pSelf.lock(); PHLWINDOW curr = m_pSelf.lock();
std::vector<PHLWINDOW> members; std::vector<PHLWINDOW> members;
do { do {
const auto PLASTWIN = curr; const auto PLASTWIN = curr;
curr = curr->m_sGroupData.pNextWindow.lock(); curr = curr->m_sGroupData.pNextWindow.lock();
PLASTWIN->m_sGroupData.pNextWindow.reset(); PLASTWIN->m_sGroupData.pNextWindow.reset();
curr->setHidden(false); curr->setHidden(false);
members.push_back(curr); members.push_back(curr);
@ -920,12 +920,12 @@ int CWindow::getGroupSize() {
} }
bool CWindow::canBeGroupedInto(PHLWINDOW 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.lock() && 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
} }
PHLWINDOW CWindow::getGroupWindowByIndex(int index) { PHLWINDOW CWindow::getGroupWindowByIndex(int index) {

View File

@ -370,9 +370,9 @@ class CWindow {
// for groups // for groups
struct SGroupData { struct SGroupData {
PHLWINDOWREF pNextWindow; // 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;

View File

@ -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.lock(), g_pCompositor->m_pLastWindow.lock() ? g_pXWaylandManager->getWindowSurface(g_pCompositor->m_pLastWindow.lock()) : 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) {

View File

@ -505,14 +505,16 @@ void Events::listener_mapWindow(void* owner, void* data) {
PWINDOW->hyprListener_requestMinimize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_minimize, &Events::listener_requestMinimize, PWINDOW.get(), 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.get(), "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.get(), "XDG Window Late"); PWINDOW->hyprListener_requestResize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_resize, &Events::listener_requestResize, PWINDOW.get(),
"XDG Window Late");
PWINDOW->hyprListener_fullscreenWindow.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_fullscreen, &Events::listener_fullscreenWindow, PWINDOW.get(), 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.get(), "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.get(), 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.get(), "XWayland Window Late"); PWINDOW->hyprListener_activateX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_activate, &Events::listener_activateX11, PWINDOW.get(),
"XWayland Window Late");
PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_title, &Events::listener_setTitleWindow, PWINDOW.get(), "XWayland Window Late"); 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(), PWINDOW->hyprListener_requestMinimize.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_minimize, &Events::listener_requestMinimize, PWINDOW.get(),
"Xwayland Window Late"); "Xwayland Window Late");
@ -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) {
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
Debug::log(LOG, "{:c} unmapped", PWINDOW); Debug::log(LOG, "{:c} unmapped", PWINDOW);
@ -727,9 +729,9 @@ void Events::listener_unmapWindow(void* owner, void* data) {
bool wasLastWindow = false; bool wasLastWindow = false;
if (PWINDOW == g_pCompositor->m_pLastWindow.lock()) { if (PWINDOW == g_pCompositor->m_pLastWindow.lock()) {
wasLastWindow = true; wasLastWindow = true;
g_pCompositor->m_pLastWindow.reset(); g_pCompositor->m_pLastWindow.reset();
g_pCompositor->m_pLastFocus = nullptr; g_pCompositor->m_pLastFocus = nullptr;
g_pInputManager->releaseAllMouseButtons(); g_pInputManager->releaseAllMouseButtons();
} }
@ -763,7 +765,7 @@ void Events::listener_unmapWindow(void* owner, void* data) {
if (PWINDOW == g_pCompositor->m_pLastWindow.lock() || !g_pCompositor->m_pLastWindow.lock()) { 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", (PHLWINDOW)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) {
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); 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) {
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); 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);
@ -883,7 +885,7 @@ void Events::listener_commitWindow(void* owner, void* data) {
} }
void Events::listener_destroyWindow(void* owner, void* data) { void Events::listener_destroyWindow(void* owner, void* data) {
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
Debug::log(LOG, "{:c} destroyed, queueing.", PWINDOW); Debug::log(LOG, "{:c} destroyed, queueing.", PWINDOW);
@ -892,7 +894,7 @@ void Events::listener_destroyWindow(void* owner, void* data) {
if (PWINDOW == g_pCompositor->m_pLastWindow.lock()) { if (PWINDOW == g_pCompositor->m_pLastWindow.lock()) {
g_pCompositor->m_pLastWindow.reset(); g_pCompositor->m_pLastWindow.reset();
g_pCompositor->m_pLastFocus = nullptr; g_pCompositor->m_pLastFocus = nullptr;
} }
PWINDOW->m_pWLSurface.unassign(); PWINDOW->m_pWLSurface.unassign();
@ -919,7 +921,7 @@ void Events::listener_destroyWindow(void* owner, void* data) {
} }
void Events::listener_setTitleWindow(void* owner, void* data) { void Events::listener_setTitleWindow(void* owner, void* data) {
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
if (!validMapped(PWINDOW)) if (!validMapped(PWINDOW))
return; return;
@ -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) {
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
if (!PWINDOW->m_bIsMapped) { if (!PWINDOW->m_bIsMapped) {
PWINDOW->m_bWantsInitialFullscreen = true; PWINDOW->m_bWantsInitialFullscreen = true;
@ -1022,7 +1024,7 @@ void Events::listener_activateXDG(wl_listener* listener, void* data) {
} }
void Events::listener_activateX11(void* owner, void* data) { void Events::listener_activateX11(void* owner, void* data) {
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); 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);
@ -1047,7 +1049,7 @@ void Events::listener_activateX11(void* owner, void* data) {
} }
void Events::listener_configureX11(void* owner, void* data) { void Events::listener_configureX11(void* owner, void* data) {
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); 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;
@ -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) {
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
if (!PWINDOW->m_bIsMapped) if (!PWINDOW->m_bIsMapped)
return; return;
@ -1178,7 +1180,7 @@ void Events::listener_setOverrideRedirect(void* owner, void* data) {
} }
void Events::listener_associateX11(void* owner, void* data) { void Events::listener_associateX11(void* owner, void* data) {
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
PWINDOW->hyprListener_mapWindow.initCallback(&PWINDOW->m_uSurface.xwayland->surface->events.map, &Events::listener_mapWindow, PWINDOW.get(), "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.get(), "XWayland Window"); PWINDOW->hyprListener_commitWindow.initCallback(&PWINDOW->m_uSurface.xwayland->surface->events.commit, &Events::listener_commitWindow, PWINDOW.get(), "XWayland Window");
@ -1187,7 +1189,7 @@ void Events::listener_associateX11(void* owner, void* data) {
} }
void Events::listener_dissociateX11(void* owner, void* data) { void Events::listener_dissociateX11(void* owner, void* data) {
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
PWINDOW->m_pWLSurface.unassign(); PWINDOW->m_pWLSurface.unassign();
@ -1235,7 +1237,7 @@ void Events::listener_newXDGToplevel(wl_listener* listener, void* data) {
} }
void Events::listener_requestMaximize(void* owner, void* data) { void Events::listener_requestMaximize(void* owner, void* data) {
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); 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) {
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock();
Debug::log(LOG, "Minimize request for {}", PWINDOW); Debug::log(LOG, "Minimize request for {}", PWINDOW);
@ -1277,14 +1279,14 @@ void Events::listener_requestMinimize(void* owner, void* data) {
} }
void Events::listener_requestMove(void* owner, void* data) { void Events::listener_requestMove(void* owner, void* data) {
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); 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) {
PHLWINDOW PWINDOW = ((CWindow*)owner)->m_pSelf.lock(); 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);

View File

@ -339,7 +339,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dir
} }
// if it's a group, add the window // if it's a group, add the window
if (OPENINGON->pWindow.lock()->m_sGroupData.pNextWindow.lock() // target is group if (OPENINGON->pWindow.lock()->m_sGroupData.pNextWindow.lock() // target is group
&& pWindow->canBeGroupedInto(OPENINGON->pWindow.lock()) && !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);
@ -984,13 +984,13 @@ void CHyprDwindleLayout::switchWindows(PHLWINDOW pWindow, PHLWINDOW pWindow2) {
getMasterNodeOnWorkspace(PNODE2->workspaceID)->recalcSizePosRecursive(); getMasterNodeOnWorkspace(PNODE2->workspaceID)->recalcSizePosRecursive();
if (ACTIVE1) { if (ACTIVE1) {
ACTIVE1->box = PNODE->box; ACTIVE1->box = PNODE->box;
ACTIVE1->pWindow.lock()->m_vPosition = ACTIVE1->box.pos(); ACTIVE1->pWindow.lock()->m_vPosition = ACTIVE1->box.pos();
ACTIVE1->pWindow.lock()->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.lock()->m_vPosition = ACTIVE2->box.pos(); ACTIVE2->pWindow.lock()->m_vPosition = ACTIVE2->box.pos();
ACTIVE2->pWindow.lock()->m_vSize = ACTIVE2->box.size(); ACTIVE2->pWindow.lock()->m_vSize = ACTIVE2->box.size();
} }
@ -1140,7 +1140,7 @@ Vector2D CHyprDwindleLayout::predictSizeForNewWindowTiled() {
if (!PNODE) if (!PNODE)
return {}; return {};
node = *PNODE; node = *PNODE;
node.pWindow.reset(); node.pWindow.reset();
CBox box = PNODE->box; CBox box = PNODE->box;

View File

@ -283,7 +283,7 @@ void IHyprLayout::onEndDragWindow() {
g_pInputManager->unsetCursorImage(); g_pInputManager->unsetCursorImage();
g_pInputManager->currentlyDraggedWindow.reset(); 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;

View File

@ -231,7 +231,7 @@ bool CKeybindManager::ensureMouseBindState() {
m_bIsMouseBindActive = false; m_bIsMouseBindActive = false;
g_pLayoutManager->getCurrentLayout()->onEndDragWindow(); g_pLayoutManager->getCurrentLayout()->onEndDragWindow();
g_pInputManager->currentlyDraggedWindow.reset(); 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());
@ -1119,7 +1119,7 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
} }
void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) { void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
PHLWINDOW PWINDOW = nullptr; PHLWINDOW PWINDOW = nullptr;
const auto ORIGINALARGS = args; const auto ORIGINALARGS = args;
@ -1209,7 +1209,7 @@ 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.lock() ? (g_pCompositor->m_vWindowFocusHistory.size() < 2 ? nullptr : g_pCompositor->m_vWindowFocusHistory[1].lock()) : 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].lock()); (g_pCompositor->m_vWindowFocusHistory.empty() ? nullptr : g_pCompositor->m_vWindowFocusHistory[0].lock());
if (!PWINDOWURGENT && !PWINDOWPREV) if (!PWINDOWURGENT && !PWINDOWPREV)
return; return;
@ -1219,7 +1219,7 @@ 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.lock() ? (g_pCompositor->m_vWindowFocusHistory.size() < 2 ? nullptr : g_pCompositor->m_vWindowFocusHistory[1].lock()) : 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].lock()); (g_pCompositor->m_vWindowFocusHistory.empty() ? nullptr : g_pCompositor->m_vWindowFocusHistory[0].lock());
if (!PWINDOWPREV) if (!PWINDOWPREV)
return; return;
@ -2098,7 +2098,7 @@ 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();
PHLWINDOW 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);
@ -2114,7 +2114,7 @@ void CKeybindManager::mouse(std::string args) {
if (g_pInputManager->currentlyDraggedWindow.lock()) { if (g_pInputManager->currentlyDraggedWindow.lock()) {
g_pLayoutManager->getCurrentLayout()->onEndDragWindow(); g_pLayoutManager->getCurrentLayout()->onEndDragWindow();
g_pInputManager->currentlyDraggedWindow.reset(); g_pInputManager->currentlyDraggedWindow.reset();
g_pInputManager->dragMode = MBIND_INVALID; g_pInputManager->dragMode = MBIND_INVALID;
} }
} }
} else if (ARGS[0] == "resizewindow") { } else if (ARGS[0] == "resizewindow") {
@ -2138,7 +2138,7 @@ void CKeybindManager::mouse(std::string args) {
if (g_pInputManager->currentlyDraggedWindow.lock()) { if (g_pInputManager->currentlyDraggedWindow.lock()) {
g_pLayoutManager->getCurrentLayout()->onEndDragWindow(); g_pLayoutManager->getCurrentLayout()->onEndDragWindow();
g_pInputManager->currentlyDraggedWindow.reset(); g_pInputManager->currentlyDraggedWindow.reset();
g_pInputManager->dragMode = MBIND_INVALID; g_pInputManager->dragMode = MBIND_INVALID;
} }
} }
} }

View File

@ -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.reset(); 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);
PHLWINDOW pFoundWindow; 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)
@ -419,7 +419,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
if (FOLLOWMOUSE != 1 && !refocus) { if (FOLLOWMOUSE != 1 && !refocus) {
if (pFoundWindow != g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow.lock() && if (pFoundWindow != g_pCompositor->m_pLastWindow.lock() && g_pCompositor->m_pLastWindow.lock() &&
((pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR == 2) || (g_pCompositor->m_pLastWindow.lock()->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);

View File

@ -66,7 +66,8 @@ void CInputManager::onTouchDown(wlr_touch_down_event* e) {
if (m_sTouchData.touchFocusWindow.lock()) { if (m_sTouchData.touchFocusWindow.lock()) {
if (m_sTouchData.touchFocusWindow.lock()->m_bIsX11) { if (m_sTouchData.touchFocusWindow.lock()->m_bIsX11) {
local = (g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusWindow.lock()->m_vRealPosition.goal()) * m_sTouchData.touchFocusWindow.lock()->m_fX11SurfaceScaledBy; local = (g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusWindow.lock()->m_vRealPosition.goal()) *
m_sTouchData.touchFocusWindow.lock()->m_fX11SurfaceScaledBy;
m_sTouchData.touchSurfaceOrigin = m_sTouchData.touchFocusWindow.lock()->m_vRealPosition.goal(); m_sTouchData.touchSurfaceOrigin = m_sTouchData.touchFocusWindow.lock()->m_vRealPosition.goal();
} else { } else {
g_pCompositor->vectorWindowToSurface(g_pInputManager->getMouseCoordsInternal(), m_sTouchData.touchFocusWindow.lock(), local); g_pCompositor->vectorWindowToSurface(g_pInputManager->getMouseCoordsInternal(), m_sTouchData.touchFocusWindow.lock(), local);

View File

@ -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<PHLWINDOW>(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) {

View File

@ -1742,7 +1742,7 @@ void CHyprOpenGLImpl::makeWindowSnapshot(PHLWINDOW 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}; PHLWINDOWREF ref{pWindow};
@ -1824,11 +1824,10 @@ void CHyprOpenGLImpl::makeLayerSnapshot(SLayerSurface* pLayer) {
void CHyprOpenGLImpl::renderSnapshot(PHLWINDOW 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()!");
static auto PDIMAROUND = CConfigValue<Hyprlang::FLOAT>("decoration:dim_around"); static auto PDIMAROUND = CConfigValue<Hyprlang::FLOAT>("decoration:dim_around");
PHLWINDOWREF ref{pWindow}; PHLWINDOWREF ref{pWindow};
if (!m_mWindowFramebuffers.contains(ref)) if (!m_mWindowFramebuffers.contains(ref))
return; return;

View File

@ -196,10 +196,10 @@ class CHyprOpenGLImpl {
PHLWINDOWREF m_pCurrentWindow; // 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::map<PHLWINDOWREF, CFramebuffer, std::owner_less<PHLWINDOWREF>> 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;

View File

@ -52,7 +52,8 @@ 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.lock()->m_vFloatingOffset).expand(-m_pWindow.lock()->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;

View File

@ -29,7 +29,7 @@ class CHyprDropShadowDecoration : public IHyprWindowDecoration {
SWindowDecorationExtents m_seExtents; SWindowDecorationExtents m_seExtents;
SWindowDecorationExtents m_seReportedExtents; SWindowDecorationExtents m_seReportedExtents;
PHLWINDOWREF m_pWindow; PHLWINDOWREF m_pWindow;
Vector2D m_vLastWindowPos; Vector2D m_vLastWindowPos;
Vector2D m_vLastWindowSize; Vector2D m_vLastWindowSize;

View File

@ -144,7 +144,7 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a) {
if (*PGRADIENTS) { if (*PGRADIENTS) {
const auto& GRADIENTTEX = (m_dwGroupMembers[i].lock() == g_pCompositor->m_pLastWindow.lock() ? (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);
} }
@ -370,16 +370,16 @@ bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, PHLWIND
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);
PHLWINDOW pWindowInsertAfter = m_pWindow.lock()->getGroupWindowByIndex(WINDOWINDEX); PHLWINDOW pWindowInsertAfter = m_pWindow.lock()->getGroupWindowByIndex(WINDOWINDEX);
PHLWINDOW pWindowInsertEnd = pWindowInsertAfter->m_sGroupData.pNextWindow.lock(); PHLWINDOW pWindowInsertEnd = pWindowInsertAfter->m_sGroupData.pNextWindow.lock();
PHLWINDOW pDraggedHead = pDraggedWindow->m_sGroupData.pNextWindow.lock() ? pDraggedWindow->getGroupHead() : pDraggedWindow; PHLWINDOW pDraggedHead = pDraggedWindow->m_sGroupData.pNextWindow.lock() ? pDraggedWindow->getGroupHead() : pDraggedWindow;
if (pDraggedWindow->m_sGroupData.pNextWindow.lock()) { if (pDraggedWindow->m_sGroupData.pNextWindow.lock()) {
// stores group data // stores group data
std::vector<PHLWINDOW> members; std::vector<PHLWINDOW> members;
PHLWINDOW 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.lock(); curr = curr->m_sGroupData.pNextWindow.lock();
@ -388,8 +388,8 @@ bool CHyprGroupBarDecoration::onEndWindowDragOnDeco(const Vector2D& pos, PHLWIND
// removes all windows // removes all windows
for (PHLWINDOW w : members) { for (PHLWINDOW w : members) {
w->m_sGroupData.pNextWindow.reset(); 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);
} }

View File

@ -125,8 +125,8 @@ void CDecorationPositioner::onWindowUpdate(PHLWINDOW 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.lock() || !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 */
) )

View File

@ -10,7 +10,7 @@ class CWindow;
class IHyprWindowDecoration; class IHyprWindowDecoration;
typedef std::shared_ptr<CWindow> PHLWINDOW; typedef std::shared_ptr<CWindow> PHLWINDOW;
typedef std::weak_ptr<CWindow> PHLWINDOWREF; 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 */
@ -90,13 +90,13 @@ class CDecorationPositioner {
bool needsRecalc = false; bool needsRecalc = false;
}; };
std::map<PHLWINDOWREF, SWindowData, std::owner_less<PHLWINDOWREF>> 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, PHLWINDOW pWindow); SWindowPositioningData* getDataFor(IHyprWindowDecoration* pDecoration, PHLWINDOW pWindow);
void onWindowUnmap(PHLWINDOW pWindow); void onWindowUnmap(PHLWINDOW pWindow);
void onWindowMap(PHLWINDOW pWindow); void onWindowMap(PHLWINDOW pWindow);
void sanitizeDatas(); void sanitizeDatas();
}; };
inline std::unique_ptr<CDecorationPositioner> g_pDecorationPositioner; inline std::unique_ptr<CDecorationPositioner> g_pDecorationPositioner;