(#156) bugfix: place fullscreen windows properly (#159)

This commit is contained in:
Matthew Kosarek 2024-06-16 20:24:11 -04:00 committed by GitHub
parent febe04b213
commit 9b3f31f044
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 7 deletions

View File

@ -57,6 +57,11 @@ void LeafNode::set_parent(std::shared_ptr<ParentNode> const& in_parent)
parent = in_parent;
}
void LeafNode::set_state(MirWindowState state)
{
next_state = state;
}
geom::Rectangle LeafNode::get_visible_area() const
{
// TODO: Could cache these half values in the config
@ -132,7 +137,7 @@ void LeafNode::toggle_fullscreen()
bool LeafNode::is_fullscreen() const
{
return node_interface.get_state(window) == mir_window_state_maximized;
return node_interface.is_fullscreen(window);
}
void LeafNode::commit_changes()

View File

@ -53,6 +53,7 @@ public:
[[nodiscard]] geom::Rectangle get_visible_area() const;
void set_logical_area(geom::Rectangle const& target_rect) override;
void set_parent(std::shared_ptr<ParentNode> const&) override;
void set_state(MirWindowState state);
void show();
void hide();
void toggle_fullscreen();

View File

@ -289,20 +289,25 @@ void OutputContent::handle_modify_window(const std::shared_ptr<miracle::WindowMe
{
case WindowType::tiled:
{
if (get_active_tree().get() != metadata->get_tiling_node()->get_tree())
auto& window = metadata->get_window();
auto node = metadata->get_tiling_node();
auto const& info = tools.info_for(window);
if (get_active_tree().get() != node->get_tree())
break;
if (modifications.state().is_set())
if (modifications.state().is_set() && modifications.state().value() != info.state())
{
auto tree = metadata->get_tiling_node()->get_tree();
node->set_state(modifications.state().value());
node->commit_changes();
if (window_helpers::is_window_fullscreen(modifications.state().value()))
tree->advise_fullscreen_window(metadata->get_window());
tree->advise_fullscreen_window(window);
else if (modifications.state().value() == mir_window_state_restored)
tree->advise_restored_window(metadata->get_window());
tree->constrain(metadata->get_window());
tree->advise_restored_window(window);
}
tools.modify_window(metadata->get_window(), modifications);
tools.modify_window(window, modifications);
break;
}
case WindowType::floating: