void-packages/srcpkgs/wayfire-plugins-extra/patches/forcefullscreen-crash.patch

51 lines
1.7 KiB
Diff

From c321dda631026485d767f7125e80e5f5d7ad5b35 Mon Sep 17 00:00:00 2001
From: Scott Moreau <oreaus@gmail.com>
Date: Tue, 16 Feb 2021 04:49:52 -0700
Subject: [PATCH] force-fullscreen: Fix crash when closing fullscreened
surfaces (#79)
Introduced by a change in core, rework things to make it not crash
when closing a view.
---
src/force-fullscreen.cpp | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/force-fullscreen.cpp b/src/force-fullscreen.cpp
index 364f239..894c403 100644
--- a/src/force-fullscreen.cpp
+++ b/src/force-fullscreen.cpp
@@ -41,11 +41,23 @@ class fullscreen_subsurface : public wf::surface_interface_t,
fullscreen_subsurface(wayfire_view view) :
wf::surface_interface_t(), wf::compositor_surface_t()
- {}
+ {
+ view->connect_signal("subsurface-removed", &on_subsurface_removed);
+ }
~fullscreen_subsurface()
{}
+ wf::signal_connection_t on_subsurface_removed = [&] (auto data)
+ {
+ auto ev = static_cast<wf::subsurface_removed_signal*>(data);
+ if ((ev->subsurface.get() == this) && _mapped)
+ {
+ _mapped = false;
+ wf::emit_map_state_change(this);
+ }
+ };
+
void on_pointer_enter(int x, int y) override
{
wf::get_core().set_cursor("default");
@@ -295,8 +307,6 @@ class wayfire_force_fullscreen : public wf::plugin_interface_t
if (background->black_border)
{
- wf::emit_map_state_change(background->black_border);
- background->black_border->_mapped = false;
view->remove_subsurface(background->black_border);
background->black_border = nullptr;
}