enhance: remove MinimalWindoManager

This commit is contained in:
Matthew Kosarek 2023-12-21 11:57:15 -05:00
parent 92050e8176
commit 8cece1184a
2 changed files with 72 additions and 14 deletions

View File

@ -32,8 +32,7 @@ MiracleWindowManagementPolicy::MiracleWindowManagementPolicy(
const miral::WindowManagerTools & tools,
miral::ExternalClientLauncher const& external_client_launcher,
miral::InternalClientLauncher const& internal_client_launcher)
: miral::MinimalWindowManager(tools),
window_manager_tools{tools},
: window_manager_tools{tools},
external_client_launcher{external_client_launcher},
internal_client_launcher{internal_client_launcher}
{
@ -41,10 +40,6 @@ MiracleWindowManagementPolicy::MiracleWindowManagementPolicy(
bool MiracleWindowManagementPolicy::handle_keyboard_event(MirKeyboardEvent const* event)
{
if (MinimalWindowManager::handle_keyboard_event(event)) {
return true;
}
auto const action = miral::toolkit::mir_keyboard_event_action(event);
auto const scan_code = miral::toolkit::mir_keyboard_event_scan_code(event);
auto const modifiers = miral::toolkit::mir_keyboard_event_modifiers(event) & MODIFIER_MASK;
@ -126,10 +121,6 @@ bool MiracleWindowManagementPolicy::handle_keyboard_event(MirKeyboardEvent const
bool MiracleWindowManagementPolicy::handle_pointer_event(MirPointerEvent const* event)
{
if (MinimalWindowManager::handle_pointer_event(event)) {
return true;
}
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);
@ -179,7 +170,7 @@ void MiracleWindowManagementPolicy::advise_output_create(miral::Output const& ou
WindowTreeOptions options = { 10, 10 };
auto new_tree = std::make_shared<OutputTreePair>(
output,
WindowTree(output.extents(), tools, options));
WindowTree(output.extents(), window_manager_tools, options));
tree_list.push_back(new_tree);
if (active_tree == nullptr)
active_tree = new_tree;
@ -216,3 +207,48 @@ void MiracleWindowManagementPolicy::advise_output_delete(miral::Output const& ou
}
}
}
void MiracleWindowManagementPolicy::handle_modify_window(miral::WindowInfo &window_info,
const miral::WindowSpecification &modifications)
{
}
void MiracleWindowManagementPolicy::handle_raise_window(miral::WindowInfo &window_info)
{
}
mir::geometry::Rectangle
MiracleWindowManagementPolicy::confirm_placement_on_display(
const miral::WindowInfo &window_info,
MirWindowState new_state,
const mir::geometry::Rectangle &new_placement)
{
return new_placement;
}
bool MiracleWindowManagementPolicy::handle_touch_event(const MirTouchEvent *event)
{
return false;
}
void MiracleWindowManagementPolicy::handle_request_move(miral::WindowInfo &window_info, const MirInputEvent *input_event)
{
}
void MiracleWindowManagementPolicy::handle_request_resize(
miral::WindowInfo &window_info,
const MirInputEvent *input_event,
MirResizeEdge edge)
{
}
mir::geometry::Rectangle MiracleWindowManagementPolicy::confirm_inherited_move(
const miral::WindowInfo &window_info,
mir::geometry::Displacement movement)
{
return mir::geometry::Rectangle();
}

View File

@ -7,7 +7,7 @@
#include "window_tree.h"
#include <miral/window_manager_tools.h>
#include <miral/minimal_window_manager.h>
#include <miral/window_management_policy.h>
#include <miral/external_client.h>
#include <miral/internal_client.h>
#include <miral/output.h>
@ -25,7 +25,7 @@ struct OutputTreePair
WindowTree tree;
};
class MiracleWindowManagementPolicy : public miral::MinimalWindowManager
class MiracleWindowManagementPolicy : public miral::WindowManagementPolicy
{
public:
MiracleWindowManagementPolicy(
@ -48,6 +48,28 @@ public:
void advise_output_update(miral::Output const& updated, miral::Output const& original);
void advise_output_delete(miral::Output const& output);
void handle_modify_window(miral::WindowInfo &window_info, const miral::WindowSpecification &modifications) override;
void handle_raise_window(miral::WindowInfo &window_info) override;
auto confirm_placement_on_display(
const miral::WindowInfo &window_info,
MirWindowState new_state,
const mir::geometry::Rectangle &new_placement) -> mir::geometry::Rectangle override;
bool handle_touch_event(const MirTouchEvent *event) override;
void handle_request_move(miral::WindowInfo &window_info, const MirInputEvent *input_event) override;
void handle_request_resize(
miral::WindowInfo &window_info,
const MirInputEvent *input_event,
MirResizeEdge edge) override;
auto confirm_inherited_move(
const miral::WindowInfo &window_info,
mir::geometry::Displacement movement) -> mir::geometry::Rectangle override;
private:
std::shared_ptr<OutputTreePair> active_tree;
std::vector<std::shared_ptr<OutputTreePair>> tree_list;