mirror of
https://github.com/miracle-wm-org/miracle-wm.git
synced 2024-11-22 11:23:11 +03:00
fix focus property in json payloads (#275)
This commit is contained in:
parent
5b63bcdc83
commit
9b186b0352
@ -369,7 +369,7 @@ nlohmann::json FloatingWindowContainer::to_json() const
|
||||
{ "width", logical_area.size.width.as_int() },
|
||||
{ "height", logical_area.size.height.as_int() },
|
||||
} },
|
||||
{ "focused", is_focused() },
|
||||
{ "focused", visible && is_focused() },
|
||||
{ "focus", std::vector<int>() },
|
||||
{ "border", "normal" },
|
||||
{ "current_border_width", config->get_border_config().size },
|
||||
|
@ -443,7 +443,7 @@ nlohmann::json LeafContainer::to_json() const
|
||||
{ "width", logical_area.size.width.as_int() },
|
||||
{ "height", logical_area.size.height.as_int() },
|
||||
} },
|
||||
{ "focused", is_focused() },
|
||||
{ "focused", visible && is_focused() },
|
||||
{ "focus", std::vector<int>() },
|
||||
{ "border", "normal" },
|
||||
{ "current_border_width", config->get_border_config().size },
|
||||
|
@ -831,7 +831,7 @@ nlohmann::json ParentContainer::to_json() const
|
||||
{ "width", logical_area.size.width.as_int() },
|
||||
{ "height", logical_area.size.height.as_int() },
|
||||
} },
|
||||
{ "focused", is_focused() },
|
||||
{ "focused", visible && is_focused() },
|
||||
{ "focus", std::vector<int>() },
|
||||
{ "border", "none" },
|
||||
{ "current_border_width", 0 },
|
||||
|
@ -461,8 +461,10 @@ void Policy::advise_output_create(miral::Output const& output)
|
||||
floating_window_manager, state, config, window_controller, animator);
|
||||
workspace_manager.request_first_available_workspace(output_content);
|
||||
output_list.push_back(output_content);
|
||||
if (state.active_output == nullptr)
|
||||
if (state.active_output == nullptr) {
|
||||
state.active_output = output_content;
|
||||
state.active_output->set_is_active(true);
|
||||
}
|
||||
|
||||
// Let's rehome some orphan windows if we need to
|
||||
if (!orphaned_window_list.empty())
|
||||
@ -525,6 +527,7 @@ void Policy::advise_output_delete(miral::Output const& output)
|
||||
else
|
||||
{
|
||||
state.active_output = output_list.front();
|
||||
state.active_output->set_is_active(true);
|
||||
for (auto& window : other_output->collect_all_windows())
|
||||
{
|
||||
state.active_output->add_immediately(window);
|
||||
|
@ -474,7 +474,7 @@ nlohmann::json Workspace::to_json() const
|
||||
{ "type", "workspace" },
|
||||
{ "name", std::to_string(workspace) },
|
||||
{ "visible", output->is_active() && is_focused },
|
||||
{ "focused", output->is_active() && is_focused && root->is_focused() },
|
||||
{ "focused", output->is_active() && is_focused },
|
||||
{ "urgent", false },
|
||||
{ "output", output->get_output().name() },
|
||||
{ "border", "none" },
|
||||
|
@ -248,17 +248,17 @@ std::shared_ptr<Output> WorkspaceManager::request_focus(int key)
|
||||
return nullptr;
|
||||
|
||||
auto active_screen = get_active_screen();
|
||||
int previous_workspace = -1;
|
||||
if (active_screen)
|
||||
{
|
||||
int previous_workspace = active_screen->get_active_workspace_num();
|
||||
previous_workspace = active_screen->get_active_workspace_num();
|
||||
last_selected = { previous_workspace, output_to_workspace_mapping[previous_workspace] };
|
||||
}
|
||||
output_to_workspace_mapping[key]->advise_workspace_active(key);
|
||||
|
||||
if (active_screen != nullptr)
|
||||
{
|
||||
auto active_workspace = active_screen->get_active_workspace_num();
|
||||
registry.advise_focused(active_screen, active_workspace, output_to_workspace_mapping[key].get(), key);
|
||||
registry.advise_focused(output_to_workspace_mapping[previous_workspace].get(), previous_workspace, output_to_workspace_mapping[key].get(), key);
|
||||
}
|
||||
else
|
||||
registry.advise_focused(nullptr, -1, output_to_workspace_mapping[key].get(), key);
|
||||
|
Loading…
Reference in New Issue
Block a user