Merge pull request #1929 from julianschuler/monitor-reconnect-fix

Fixes https://github.com/Alexays/Waybar/issues/1783
This commit is contained in:
Alex 2023-01-08 19:56:27 +01:00 committed by GitHub
commit c692d7bf64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 2 deletions

View File

@ -9,6 +9,7 @@
#include <stdexcept>
#include <vector>
#include "client.hpp"
#include "gtkmm/widget.h"
#include "modules/wlr/workspace_manager_binding.hpp"
@ -166,8 +167,20 @@ WorkspaceManager::~WorkspaceManager() {
return;
}
zext_workspace_manager_v1_destroy(workspace_manager_);
workspace_manager_ = nullptr;
wl_display *display = Client::inst()->wl_display;
// Send `stop` request and wait for one roundtrip. This is not quite correct as
// the protocol encourages us to wait for the .finished event, but it should work
// with wlroots workspace manager implementation.
zext_workspace_manager_v1_stop(workspace_manager_);
wl_display_roundtrip(display);
// If the .finished handler is still not executed, destroy the workspace manager here.
if (workspace_manager_) {
spdlog::warn("Foreign toplevel manager destroyed before .finished event");
zext_workspace_manager_v1_destroy(workspace_manager_);
workspace_manager_ = nullptr;
}
}
auto WorkspaceManager::remove_workspace_group(uint32_t id) -> void {