Skip to content

Commit

Permalink
Merge pull request #191 from WayfireWM/fix-mag
Browse files Browse the repository at this point in the history
mag: Fixup
  • Loading branch information
soreau authored Oct 3, 2023
2 parents c310a61 + 83fddcd commit aa2c01a
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions src/mag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class mag_view_t : public wf::toplevel_view_interface_t

if (old_state.mapped && !_current.mapped)
{
view->unmap();
view->unmap(true);
}

wf::view_implementation::emit_toplevel_state_change_signals(view, old_state);
Expand Down Expand Up @@ -219,9 +219,13 @@ class mag_view_t : public wf::toplevel_view_interface_t
emit_view_map();
}

void unmap()
void unmap(bool animate)
{
emit_view_pre_unmap();
if (animate)
{
emit_view_pre_unmap();
}

_is_mapped = false;
wf::scene::set_node_enabled(get_root_node(), false);
emit_view_unmap();
Expand Down Expand Up @@ -255,7 +259,7 @@ class wayfire_magnifier : public wf::per_output_plugin_instance_t
wf::activator_callback toggle_cb = [=] (auto)
{
active = !active;
if (active)
if (active || (mag_view && mag_view->minimized))
{
return activate();
} else
Expand Down Expand Up @@ -284,6 +288,11 @@ class wayfire_magnifier : public wf::per_output_plugin_instance_t
{
if (mag_view)
{
if (mag_view->minimized)
{
mag_view->set_minimized(false);
}

return;
}

Expand All @@ -301,6 +310,12 @@ class wayfire_magnifier : public wf::per_output_plugin_instance_t

bool activate()
{
if (mag_view && mag_view->minimized && hook_set)
{
mag_view->set_minimized(false);
return true;
}

if (!output->activate_plugin(&grab_interface))
{
return false;
Expand Down Expand Up @@ -422,8 +437,9 @@ class wayfire_magnifier : public wf::per_output_plugin_instance_t

output->render->damage_whole();

if (!mag_view)
if (!mag_view || !mag_view->is_mapped())
{
active = false;
return;
}

Expand All @@ -432,6 +448,11 @@ class wayfire_magnifier : public wf::per_output_plugin_instance_t

void fini() override
{
if (mag_view)
{
mag_view->unmap(false);
}

deactivate();
output->rem_binding(&toggle_cb);
}
Expand Down

0 comments on commit aa2c01a

Please sign in to comment.