mirror of
https://github.com/miracle-wm-org/miracle-wm.git
synced 2025-01-07 19:13:50 +03:00
bugfix: fullscreen windows were some times broken (#308)
This commit is contained in:
parent
4477bdd9fc
commit
a38a0e54a3
@ -140,7 +140,6 @@ void LeafContainer::handle_ready()
|
||||
{
|
||||
tree->handle_container_ready(*this);
|
||||
get_workspace()->handle_ready_hack(*this);
|
||||
auto const& info = window_controller.info_for(window_);
|
||||
if (window_controller.is_fullscreen(window_))
|
||||
toggle_fullscreen();
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ int main(int argc, char const* argv[])
|
||||
MirRunner runner { argc, argv };
|
||||
miracle::CompositorState compositor_state;
|
||||
|
||||
std::function<void()> shutdown_hook { [] {} };
|
||||
std::function<void()> shutdown_hook { [] { } };
|
||||
runner.add_stop_callback([&]
|
||||
{ shutdown_hook(); });
|
||||
|
||||
|
@ -1384,5 +1384,5 @@ bool Policy::can_set_layout() const
|
||||
if (!state.active())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return !state.active()->is_fullscreen();
|
||||
}
|
||||
|
@ -106,12 +106,6 @@ void TilingWindowTree::graft(std::shared_ptr<LeafContainer> const& leaf)
|
||||
|
||||
bool TilingWindowTree::resize_container(miracle::Direction direction, Container& container)
|
||||
{
|
||||
if (is_active_window_fullscreen)
|
||||
{
|
||||
mir::log_warning("Unable to resize the next window: fullscreened");
|
||||
return false;
|
||||
}
|
||||
|
||||
handle_resize(container, direction, config->get_resize_jump());
|
||||
return true;
|
||||
}
|
||||
@ -119,12 +113,6 @@ bool TilingWindowTree::resize_container(miracle::Direction direction, Container&
|
||||
bool TilingWindowTree::select_next(
|
||||
miracle::Direction direction, Container& container)
|
||||
{
|
||||
if (is_active_window_fullscreen)
|
||||
{
|
||||
mir::log_warning("Unable to select the next window: fullscreened");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto node = handle_select(container, direction);
|
||||
if (!node)
|
||||
{
|
||||
@ -138,10 +126,10 @@ bool TilingWindowTree::select_next(
|
||||
|
||||
bool TilingWindowTree::toggle_fullscreen(LeafContainer& container)
|
||||
{
|
||||
if (is_active_window_fullscreen)
|
||||
advise_restored_container(container);
|
||||
else
|
||||
if (container.is_fullscreen())
|
||||
advise_fullscreen_container(container);
|
||||
else
|
||||
advise_restored_container(container);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -156,27 +144,8 @@ geom::Rectangle TilingWindowTree::get_area() const
|
||||
return root_lane->get_logical_area();
|
||||
}
|
||||
|
||||
std::shared_ptr<LeafContainer> TilingWindowTree::select_window_from_point(int x, int y)
|
||||
{
|
||||
if (is_active_window_fullscreen)
|
||||
return active_container();
|
||||
|
||||
auto node = root_lane->find_where([&](std::shared_ptr<Container> const& node)
|
||||
{
|
||||
return node->is_leaf() && node->get_logical_area().contains(geom::Point(x, y));
|
||||
});
|
||||
|
||||
return Container::as_leaf(node);
|
||||
}
|
||||
|
||||
bool TilingWindowTree::move_container(miracle::Direction direction, Container& container)
|
||||
{
|
||||
if (is_active_window_fullscreen)
|
||||
{
|
||||
mir::log_warning("Unable to move active window: fullscreen");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto traversal_result = handle_move(container, direction);
|
||||
switch (traversal_result.traversal_type)
|
||||
{
|
||||
@ -286,12 +255,6 @@ void TilingWindowTree::toggle_layout(Container& container, bool cycle_thru_all)
|
||||
|
||||
void TilingWindowTree::handle_layout_scheme(LayoutScheme scheme, Container& container)
|
||||
{
|
||||
if (is_active_window_fullscreen)
|
||||
{
|
||||
mir::log_warning("Unable to handle direction request: fullscreen");
|
||||
return;
|
||||
}
|
||||
|
||||
auto parent = container.get_parent().lock();
|
||||
if (!parent)
|
||||
{
|
||||
@ -312,7 +275,7 @@ void TilingWindowTree::handle_layout_scheme(LayoutScheme scheme, Container& cont
|
||||
|
||||
void TilingWindowTree::advise_focus_gained(LeafContainer& container)
|
||||
{
|
||||
if (is_active_window_fullscreen)
|
||||
if (container.is_fullscreen())
|
||||
window_controller.raise(container.window().value());
|
||||
else if (auto const& parent = container.get_parent().lock())
|
||||
parent->on_focus_gained();
|
||||
@ -320,13 +283,6 @@ void TilingWindowTree::advise_focus_gained(LeafContainer& container)
|
||||
|
||||
void TilingWindowTree::advise_delete_window(std::shared_ptr<Container> const& container)
|
||||
{
|
||||
auto active = active_container();
|
||||
if (active == container)
|
||||
{
|
||||
if (is_active_window_fullscreen)
|
||||
is_active_window_fullscreen = false;
|
||||
}
|
||||
|
||||
auto parent = handle_remove(container);
|
||||
parent->commit_changes();
|
||||
}
|
||||
@ -650,16 +606,14 @@ bool TilingWindowTree::advise_fullscreen_container(LeafContainer& container)
|
||||
auto window = container.window().value();
|
||||
window_controller.select_active_window(window);
|
||||
window_controller.raise(window);
|
||||
is_active_window_fullscreen = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TilingWindowTree::advise_restored_container(LeafContainer& container)
|
||||
{
|
||||
auto active = active_container();
|
||||
if (active && active->window() == container.window().value() && is_active_window_fullscreen)
|
||||
auto active = state.active();
|
||||
if (active && active->window() == container.window().value())
|
||||
{
|
||||
is_active_window_fullscreen = false;
|
||||
container.set_logical_area(container.get_logical_area());
|
||||
container.commit_changes();
|
||||
}
|
||||
@ -670,7 +624,7 @@ bool TilingWindowTree::advise_restored_container(LeafContainer& container)
|
||||
bool TilingWindowTree::handle_container_ready(LeafContainer& container)
|
||||
{
|
||||
constrain(container);
|
||||
if (is_active_window_fullscreen)
|
||||
if (state.active() && state.active()->is_fullscreen())
|
||||
return true;
|
||||
|
||||
auto window = container.window().value();
|
||||
@ -796,8 +750,3 @@ Workspace* TilingWindowTree::get_workspace() const
|
||||
{
|
||||
return tree_interface->get_workspace();
|
||||
}
|
||||
|
||||
std::shared_ptr<LeafContainer> TilingWindowTree::active_container() const
|
||||
{
|
||||
return Container::as_leaf(state.active());
|
||||
}
|
||||
|
@ -83,8 +83,6 @@ public:
|
||||
/// Toggle the active window between fullscreen and not fullscreen
|
||||
bool toggle_fullscreen(LeafContainer&);
|
||||
|
||||
bool has_fullscreen_window() const { return is_active_window_fullscreen; }
|
||||
|
||||
void request_layout(Container&, LayoutScheme);
|
||||
|
||||
/// Request a change to vertical window placement
|
||||
@ -113,8 +111,6 @@ public:
|
||||
|
||||
geom::Rectangle get_area() const;
|
||||
|
||||
std::shared_ptr<LeafContainer> select_window_from_point(int x, int y);
|
||||
|
||||
bool advise_fullscreen_container(LeafContainer&);
|
||||
bool advise_restored_container(LeafContainer&);
|
||||
bool handle_container_ready(LeafContainer&);
|
||||
@ -159,7 +155,6 @@ private:
|
||||
std::shared_ptr<ParentContainer> root_lane;
|
||||
std::unique_ptr<TilingWindowTreeInterface> tree_interface;
|
||||
|
||||
bool is_active_window_fullscreen = false;
|
||||
bool is_hidden = false;
|
||||
int config_handle = 0;
|
||||
|
||||
@ -187,8 +182,6 @@ private:
|
||||
/// Selects the next node in the provided direction
|
||||
/// @returns The next selectable window or nullptr if none is found
|
||||
static std::shared_ptr<LeafContainer> handle_select(Container& from, Direction direction);
|
||||
|
||||
std::shared_ptr<LeafContainer> active_container() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ void Workspace::handle_ready_hack(LeafContainer& container)
|
||||
for (auto const& window : floating_windows)
|
||||
window_controller.raise(window->window().value());
|
||||
|
||||
if (tree->has_fullscreen_window())
|
||||
if (state.active() && state.active()->is_fullscreen())
|
||||
window_controller.raise(state.active()->window().value());
|
||||
}
|
||||
|
||||
|
@ -45,8 +45,8 @@ class ImmediateServerActionQueue : public mir::ServerActionQueue
|
||||
action();
|
||||
}
|
||||
|
||||
void pause_processing_for(void const* owner) override {};
|
||||
void resume_processing_for(void const* owner) override {};
|
||||
void pause_processing_for(void const* owner) override { };
|
||||
void resume_processing_for(void const* owner) override { };
|
||||
};
|
||||
|
||||
class AnimatorTest : public testing::Test
|
||||
@ -154,6 +154,6 @@ TEST_F(AnimationTest, InterruptingSlideResultsInModifiedAnimationDuration)
|
||||
mir::geometry::Rectangle(
|
||||
mir::geometry::Point(200, 200),
|
||||
mir::geometry::Size(0, 0)),
|
||||
[](auto const& asr) {});
|
||||
[](auto const& asr) { });
|
||||
ASSERT_NEAR(animation.get_runtime_seconds(), 2, 0.05);
|
||||
}
|
Loading…
Reference in New Issue
Block a user