mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
fix(wlr/taskbar): protocol error when reconnecting outputs
Destroy request is not specified for foreign toplevel manager and it does not prevent the compositor from sending more events. Libwayland would ignore events to a destroyed objects, but that could indirectly cause a gap in the sequence of new object ids and trigger error condition in the library. With this commit waybar sends a `stop` request to notify the compositor about the destruction of a toplevel manager. That fixes abnormal termination of the bar with following errors: ``` (waybar:11791): Gdk-DEBUG: 20:04:19.778: not a valid new object id (4278190088), message toplevel(n) Gdk-Message: 20:04:19.778: Error reading events from display: Invalid argument ```
This commit is contained in:
parent
ef9c3ef1cb
commit
b79301a5bd
@ -637,8 +637,20 @@ Taskbar::Taskbar(const std::string &id, const waybar::Bar &bar, const Json::Valu
|
||||
Taskbar::~Taskbar()
|
||||
{
|
||||
if (manager_) {
|
||||
zwlr_foreign_toplevel_manager_v1_destroy(manager_);
|
||||
manager_ = nullptr;
|
||||
struct 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 foreign toplevel manager implementation.
|
||||
*/
|
||||
zwlr_foreign_toplevel_manager_v1_stop(manager_);
|
||||
wl_display_roundtrip(display);
|
||||
|
||||
if (manager_) {
|
||||
spdlog::warn("Foreign toplevel manager destroyed before .finished event");
|
||||
zwlr_foreign_toplevel_manager_v1_destroy(manager_);
|
||||
manager_ = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user