Avoid GCC build warnings

- Add `default` to switch statements to ensure that a defined value is returned from non-void functions
- Add `HY3_ENABLE_UNUSED_BLOCKS` option (default: `FALSE`) which controls a `#if` pre-processor
  directive surrounding the apparently unused `unfullscreen` label (and associated block)
  in `Hy3Layout.cpp`
This commit is contained in:
Pete Appleton 2024-01-20 11:51:43 +00:00
parent d247317a38
commit f150886e63
3 changed files with 11 additions and 2 deletions

View file

@ -23,6 +23,7 @@ add_library(hy3 SHARED
)
option(HY3_NO_VERSION_CHECK "Disable hyprland version check" FALSE)
option(HY3_ENABLE_UNUSED_BLOCKS "Enable the compilation of unused blocks" FALSE)
if (HY3_NO_VERSION_CHECK)
target_compile_definitions(hy3 PRIVATE -DHY3_NO_VERSION_CHECK=TRUE)

View file

@ -752,6 +752,7 @@ CWindow* Hy3Layout::getNextWindowCandidate(CWindow* window) {
switch (node->data.type) {
case Hy3NodeType::Window: return node->data.as_window;
case Hy3NodeType::Group: return nullptr;
default: return nullptr;
}
}
@ -1072,7 +1073,7 @@ void Hy3Layout::moveNodeToWorkspace(int origin, std::string wsname, bool follow)
);
Hy3Node* expand_actor = nullptr;
auto* parent = node->removeFromParentRecursive(&expand_actor);
node->removeFromParentRecursive(&expand_actor);
if (expand_actor != nullptr) expand_actor->recalcSizePosRecursive();
changeNodeWorkspaceRecursive(*node, workspace);
@ -1402,12 +1403,14 @@ fullscreen:
window->m_vRealPosition = monitor->vecPosition;
window->m_vRealSize = monitor->vecSize;
goto fsupdate;
#ifdef HY3_ENABLE_UNUSED_BLOCKS
unfullscreen:
if (node->data.type != Hy3NodeType::Window) return;
window = node->data.as_window;
window->m_bIsFullscreen = false;
workspace->m_bHasFullscreenWindow = false;
goto fsupdate;
#endif
fsupdate:
g_pCompositor->updateWindowAnimatedDecorationValues(window);
g_pXWaylandManager->setWindowSize(window, window->m_vRealSize.goalv());
@ -1427,11 +1430,13 @@ bool Hy3Layout::shouldRenderSelected(CWindow* window) {
switch (focused->data.type) {
case Hy3NodeType::Window: return focused->data.as_window == window;
case Hy3NodeType::Group:
case Hy3NodeType::Group: {
auto* node = this->getNodeFromWindow(window);
if (node == nullptr) return false;
return focused->data.as_group.hasChild(node);
}
default: return false;
}
}
Hy3Node* Hy3Layout::getWorkspaceRootGroup(const int& workspace) {

View file

@ -174,6 +174,7 @@ CWindow* Hy3Node::bringToTop() {
}
return nullptr;
default: return nullptr;
}
}
@ -237,6 +238,7 @@ Hy3Node* Hy3Node::getFocusedNode(bool ignore_group_focus, bool stop_at_expanded)
stop_at_expanded
);
}
default: return nullptr;
}
}
@ -584,6 +586,7 @@ bool Hy3Node::isUrgent() {
}
return false;
default: return false;
}
}