Fix crash when moving focus of a node containing multiple windows

This commit is contained in:
outfoxxed 2023-12-10 01:02:23 -08:00
parent f71ac37565
commit b341fe60a7
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E

View file

@ -938,20 +938,23 @@ void Hy3Layout::shiftWindow(int workspace, ShiftDirection direction, bool once,
void Hy3Layout::shiftFocus(int workspace, ShiftDirection direction, bool visible) { void Hy3Layout::shiftFocus(int workspace, ShiftDirection direction, bool visible) {
auto* current_window = g_pCompositor->m_pLastWindow; auto* current_window = g_pCompositor->m_pLastWindow;
auto* p_workspace = g_pCompositor->getWorkspaceByID(current_window->m_iWorkspaceID);
if (p_workspace->m_bHasFullscreenWindow) return;
if (current_window != nullptr && current_window->m_bIsFloating) { if (current_window != nullptr) {
auto* next_window = g_pCompositor->getWindowInDirection( auto* p_workspace = g_pCompositor->getWorkspaceByID(current_window->m_iWorkspaceID);
current_window, if (p_workspace->m_bHasFullscreenWindow) return;
direction == ShiftDirection::Left ? 'l'
: direction == ShiftDirection::Up ? 'u'
: direction == ShiftDirection::Down ? 'd'
: 'r'
);
if (next_window != nullptr) g_pCompositor->focusWindow(next_window); if (current_window->m_bIsFloating) {
return; auto* next_window = g_pCompositor->getWindowInDirection(
current_window,
direction == ShiftDirection::Left ? 'l'
: direction == ShiftDirection::Up ? 'u'
: direction == ShiftDirection::Down ? 'd'
: 'r'
);
if (next_window != nullptr) g_pCompositor->focusWindow(next_window);
return;
}
} }
auto* node = this->getWorkspaceFocusedNode(workspace); auto* node = this->getWorkspaceFocusedNode(workspace);