Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

views: emit pre_unmap immediately when starting a transaction #2080

Merged
merged 1 commit into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/view/xdg-shell/xdg-toplevel-view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ void wf::xdg_toplevel_view_base_t::map()
void wf::xdg_toplevel_view_base_t::unmap()
{
damage();
emit_view_pre_unmap();

priv->unset_mapped_surface_contents();

emit_view_unmap();
Expand Down Expand Up @@ -506,6 +504,8 @@ void wf::xdg_toplevel_view_t::start_map_tx()

void wf::xdg_toplevel_view_t::start_unmap_tx()
{
emit_view_pre_unmap();

// Take reference until the view has been unmapped
_self_ref = shared_from_this();
wtoplevel->pending().mapped = false;
Expand Down
2 changes: 2 additions & 0 deletions src/view/xwayland/xwayland-toplevel-view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "xwayland-toplevel.hpp"
#include <wayfire/txn/transaction-manager.hpp>
#include <wayfire/view-helpers.hpp>
#include "../toplevel-node.hpp"

#if WF_HAS_XWAYLAND

Expand Down Expand Up @@ -372,6 +373,7 @@ class wayfire_xwayland_view : public wf::toplevel_view_interface_t, public wayfi

void handle_unmap_request() override
{
emit_view_pre_unmap();
// Store a reference to this until the view is actually unmapped with a transaction.
_self_ref = shared_from_this();
toplevel->set_main_surface(nullptr);
Expand Down
8 changes: 1 addition & 7 deletions src/view/xwayland/xwayland-unmanaged-view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,9 @@ class wayfire_unmanaged_xwayland_view : public wayfire_xwayland_view_internal_ba
void handle_unmap_request() override
{
LOGC(XWL, "Unmapping unmanaged xwayland surface ", self());
damage();
emit_view_pre_unmap();

main_surface = nullptr;
priv->unset_mapped_surface_contents();
on_surface_commit.disconnect();

emit_view_unmap();
priv->set_mapped(false);
do_unmap();
}

void destroy() override
Expand Down
6 changes: 3 additions & 3 deletions src/view/xwayland/xwayland-view-base.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include "xwayland-view-base.hpp"
#include "wayfire/unstable/xwl-toplevel-base.hpp"
#include "wayfire/view-helpers.hpp"
#include "../view-impl.hpp"

#if WF_HAS_XWAYLAND

Expand Down Expand Up @@ -59,8 +61,6 @@ void wf::xwayland_view_base_t::do_map(wlr_surface *surface, bool autocommit, boo
void wf::xwayland_view_base_t::do_unmap()
{
damage();
emit_view_pre_unmap();

main_surface = nullptr;
priv->unset_mapped_surface_contents();

Expand Down
5 changes: 0 additions & 5 deletions src/view/xwayland/xwayland-view-base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@
#include <wayfire/workarea.hpp>
#include <wayfire/signal-definitions.hpp>

#include "../view-impl.hpp"
#include "../toplevel-node.hpp"
#include "wayfire/core.hpp"
#include "wayfire/geometry.hpp"
#include "wayfire/util.hpp"
#include "wayfire/view.hpp"
#include "xwayland-helpers.hpp"
#include <wayfire/scene-operations.hpp>
#include <wayfire/view-helpers.hpp>
Expand Down
Loading