bugfix: not being able to interact with any app

This commit is contained in:
Matthew Kosarek 2023-12-21 15:06:25 -05:00
parent ccf9940b66
commit 208d3ed144
3 changed files with 13 additions and 19 deletions

View File

@ -128,18 +128,6 @@ bool MiracleWindowManagementPolicy::handle_keyboard_event(MirKeyboardEvent const
bool MiracleWindowManagementPolicy::handle_pointer_event(MirPointerEvent const* event)
{
auto const new_cursor = pointer_position(event);
auto const action = miral::toolkit::mir_pointer_event_action(event);
if (action == mir_pointer_action_button_down)
{
if (auto const window = window_manager_tools.window_at(new_cursor))
{
window_manager_tools.select_active_window(window);
std::cout << "MEOW" << std::endl;
}
}
auto x = miral::toolkit::mir_pointer_event_axis_value(event, MirPointerAxis::mir_pointer_axis_x);
auto y = miral::toolkit::mir_pointer_event_axis_value(event, MirPointerAxis::mir_pointer_axis_y);
@ -167,12 +155,13 @@ auto MiracleWindowManagementPolicy::place_new_window(
void MiracleWindowManagementPolicy::handle_window_ready(miral::WindowInfo &window_info)
{
active_tree->tree.confirm_new_window(window_info.window());
active_tree->tree.confirm_new_window(window_info);
}
void MiracleWindowManagementPolicy::advise_focus_gained(const miral::WindowInfo &window_info)
{
active_tree->tree.advise_focus_gained(window_info.window());
window_manager_tools.raise_tree(window_info.window());
}
void MiracleWindowManagementPolicy::advise_focus_lost(const miral::WindowInfo &window_info)
@ -232,10 +221,12 @@ void MiracleWindowManagementPolicy::handle_modify_window(
miral::WindowInfo &window_info,
const miral::WindowSpecification &modifications)
{
window_manager_tools.modify_window(window_info, modifications);
}
void MiracleWindowManagementPolicy::handle_raise_window(miral::WindowInfo &window_info)
{
window_manager_tools.select_active_window(window_info.window());
}
mir::geometry::Rectangle
@ -269,5 +260,5 @@ mir::geometry::Rectangle MiracleWindowManagementPolicy::confirm_inherited_move(
const miral::WindowInfo &window_info,
mir::geometry::Displacement movement)
{
return mir::geometry::Rectangle();
return {window_info.window().top_left()+movement, window_info.window().size()};
}

View File

@ -51,10 +51,12 @@ miral::WindowSpecification WindowTree::allocate_position(const miral::WindowSpec
return new_spec;
}
void WindowTree::confirm_new_window(miral::Window &window)
void WindowTree::confirm_new_window(miral::WindowInfo &window_info)
{
get_active_lane()->add_window(window);
tools.select_active_window(window);
get_active_lane()->add_window(window_info.window());
if (window_info.can_be_active())
tools.select_active_window(window_info.window());
}
void WindowTree::toggle_resize_mode()
@ -122,7 +124,8 @@ bool WindowTree::select_window_from_point(int x, int y)
if (!node)
return false;
tools.select_active_window(node->get_window());
if (active_window != node)
tools.select_active_window(node->get_window());
return true;
}

View File

@ -56,7 +56,7 @@ public:
miral::WindowSpecification allocate_position(const miral::WindowSpecification &requested_specification);
/// Confirms the position of this window in the previously allocated position.
void confirm_new_window(miral::Window&);
void confirm_new_window(miral::WindowInfo&);
/// Places us into resize mode. Other operations are prohibited while we are in resize mode.
void toggle_resize_mode();