aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2022-08-25 21:35:47 +0200
committervaxerski <[email protected]>2022-08-25 21:35:47 +0200
commit0d1a9e4ba9cd8f1a6a826c99f927fbc036f3aa3c (patch)
tree5b6c50767f9dba1407e02370014b50353ae88256
parente327b0a8354f7c967d2f701162a3138487ecd5ca (diff)
downloadHyprland-0d1a9e4ba9cd8f1a6a826c99f927fbc036f3aa3c.tar.gz
Hyprland-0d1a9e4ba9cd8f1a6a826c99f927fbc036f3aa3c.zip
modify exit behaviour a bit
-rw-r--r--src/Compositor.cpp10
-rw-r--r--src/Compositor.hpp1
-rw-r--r--src/main.cpp3
3 files changed, 10 insertions, 4 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index 44ad52b4..15a0ebf9 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -216,7 +216,7 @@ void CCompositor::initAllSignals() {
}
void CCompositor::cleanup() {
- if (!m_sWLDisplay)
+ if (!m_sWLDisplay || m_bIsShuttingDown)
return;
m_pLastFocus = nullptr;
@@ -225,9 +225,13 @@ void CCompositor::cleanup() {
m_vWorkspaces.clear();
m_vWindows.clear();
- for (auto& m : m_vMonitors)
+ for (auto& m : m_vMonitors) {
g_pHyprOpenGL->destroyMonitorResources(m.get());
+ wlr_output_enable(m->output, false);
+ wlr_output_commit(m->output);
+ }
+
if (g_pXWaylandManager->m_sWLRXWayland) {
wlr_xwayland_destroy(g_pXWaylandManager->m_sWLRXWayland);
g_pXWaylandManager->m_sWLRXWayland = nullptr;
@@ -235,7 +239,7 @@ void CCompositor::cleanup() {
wl_display_terminate(m_sWLDisplay);
- m_sWLDisplay = nullptr;
+ m_bIsShuttingDown = true;
// kill the PID with a sigkill after 2 seconds
const auto PID = getpid();
diff --git a/src/Compositor.hpp b/src/Compositor.hpp
index c178eef1..1b285d3b 100644
--- a/src/Compositor.hpp
+++ b/src/Compositor.hpp
@@ -98,6 +98,7 @@ public:
bool m_bSessionActive = true;
bool m_bDPMSStateON = true;
bool m_bUnsafeState = false; // unsafe state is when there is no monitors.
+ bool m_bIsShuttingDown = false;
// ------------------------------------------------- //
diff --git a/src/main.cpp b/src/main.cpp
index a37e993c..b131e59a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -61,7 +61,8 @@ int main(int argc, char** argv) {
// If we are here it means we got yote.
Debug::log(LOG, "Hyprland reached the end.");
- g_pCompositor->cleanup();
+ wl_display_destroy_clients(g_pCompositor->m_sWLDisplay);
+ wl_display_destroy(g_pCompositor->m_sWLDisplay);
return EXIT_SUCCESS;
}