Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPIKE: expose existing input configuration options #3315

Closed
wants to merge 12 commits into from
1 change: 1 addition & 0 deletions debian/libmiral7.symbols
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
libmiral.so.7 libmiral7 #MINVER#
MIRAL_5.0@MIRAL_5.0 5.0.0
(c++)"miral::add_input_device_configuration(mir::Server&)@MIRAL_5.0" 5.0.0
(c++)"miral::AddInitCallback::AddInitCallback(std::function<void ()> const&)@MIRAL_5.0" 5.0.0
(c++)"miral::AddInitCallback::operator()(mir::Server&) const@MIRAL_5.0" 5.0.0
(c++)"miral::AddInitCallback::~AddInitCallback()@MIRAL_5.0" 5.0.0
Expand Down
1 change: 0 additions & 1 deletion examples/mir_demo_server/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
add_library(exampleserverconfig STATIC
server_example_input_device_config.cpp
server_example_input_event_filter.cpp
server_example_input_filter.cpp
)
Expand Down
28 changes: 15 additions & 13 deletions examples/mir_demo_server/server_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "server_example_input_event_filter.h"
#include "server_example_input_filter.h"
#include "server_example_test_client.h"
#include "server_example_input_device_config.h"
#include "miral/input_device_config.h"

#include <miral/cursor_theme.h>
#include <miral/display_configuration_option.h>
Expand Down Expand Up @@ -130,18 +130,20 @@ try
for (auto const& ext : wayland_extensions.all_supported())
wayland_extensions.enable(ext);

auto const server_exit_status = runner.run_with({
// example options for display layout, logging and timeout
miral::display_configuration_options,
miral::X11Support{},
wayland_extensions,
miral::set_window_management_policy<miral::MinimalWindowManager>(),
me::add_input_device_configuration_options_to,
add_timeout_option_to,
miral::CursorTheme{"default:DMZ-White"},
input_filters,
test_runner
});
auto const server_exit_status = runner.run_with(
{
// example options for display layout, logging and timeout
miral::display_configuration_options,

miral::X11Support{},
wayland_extensions,
miral::set_window_management_policy<miral::MinimalWindowManager>(),
miral::add_input_device_configuration,
add_timeout_option_to,
miral::CursorTheme{"default:DMZ-White"},
input_filters,
test_runner
});

// Propagate any test failure
if (test_runner.test_failed())
Expand Down
188 changes: 0 additions & 188 deletions examples/mir_demo_server/server_example_input_device_config.cpp

This file was deleted.

22 changes: 12 additions & 10 deletions examples/mir_demo_server/server_example_input_device_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class InputDeviceConfig : public mir::input::InputDeviceObserver
{
public:
InputDeviceConfig(bool disable_while_typing,
bool tap_to_click,
MirPointerAcceleration mouse_profile,
double mouse_cursor_acceleration_bias,
double mouse_scroll_speed_scale,
Expand All @@ -45,18 +46,19 @@ class InputDeviceConfig : public mir::input::InputDeviceObserver
MirTouchpadClickModes click_mode,
MirTouchpadScrollModes scroll_mode);
void device_added(std::shared_ptr<input::Device> const& device) override;
void device_changed(std::shared_ptr<input::Device> const&) override {};
void device_removed(std::shared_ptr<input::Device> const&) override {};
void device_changed(std::shared_ptr<input::Device> const&) override {}
void device_removed(std::shared_ptr<input::Device> const&) override {}
void changes_complete() override {}
private:
bool disable_while_typing;
MirPointerAcceleration mouse_profile;
double mouse_cursor_acceleration_bias;
double mouse_scroll_speed_scale;
double touchpad_cursor_acceleration_bias;
double touchpad_scroll_speed_scale;
MirTouchpadClickModes click_mode;
MirTouchpadScrollModes scroll_mode;
bool const disable_while_typing;
MirPointerAcceleration const mouse_profile;
double const mouse_cursor_acceleration_bias;
double const mouse_scroll_speed_scale;
double const touchpad_cursor_acceleration_bias;
double const touchpad_scroll_speed_scale;
MirTouchpadClickModes const click_mode;
MirTouchpadScrollModes const scroll_mode;
bool const tap_to_click;
};

}
Expand Down
12 changes: 6 additions & 6 deletions include/common/mir/input/mir_touchpad_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ struct MirTouchpadConfig
MirTouchpadConfig(MirTouchpadConfig const& other);
MirTouchpadConfig& operator=(MirTouchpadConfig const& other);
~MirTouchpadConfig();
MirTouchpadConfig(MirTouchpadClickModes click_mode,
MirTouchpadScrollModes scroll_mode,
MirTouchpadConfig(MirTouchpadClickMode click_mode,
MirTouchpadScrollMode scroll_mode,
int button_down_scroll_button,
bool tap_to_click,
bool disable_while_typing,
Expand All @@ -41,13 +41,13 @@ struct MirTouchpadConfig
/*!
* The click mode defines when the touchpad generates software emulated button events.
*/
MirTouchpadClickModes click_mode() const;
void click_mode(MirTouchpadClickModes) ;
MirTouchpadClickMode click_mode() const;
void click_mode(MirTouchpadClickMode modes) ;
/*!
* The scroll mode defines when the touchpad generates scroll events instead of pointer motion events.
*/
MirTouchpadScrollModes scroll_mode() const;
void scroll_mode(MirTouchpadScrollModes);
MirTouchpadScrollMode scroll_mode() const;
void scroll_mode(MirTouchpadScrollMode mode);

/*!
* Configures the button used for the on-button-down scroll mode
Expand Down
2 changes: 0 additions & 2 deletions include/core/mir_toolkit/mir_input_device_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ typedef enum MirTouchpadClickMode
mir_touchpad_click_mode_area_to_click = 1 << 0,
mir_touchpad_click_mode_finger_count = 1 << 1
} MirTouchpadClickMode;
typedef unsigned int MirTouchpadClickModes;

/**
* MirTouchpadScrollMode configures how the touchpad should generate scroll
Expand All @@ -83,7 +82,6 @@ typedef enum MirTouchpadScrollMode
mir_touchpad_scroll_mode_edge_scroll = 1 << 1,
mir_touchpad_scroll_mode_button_down_scroll = 1 << 2
} MirTouchpadScrollMode;
typedef unsigned int MirTouchpadScrollModes;

/**
* Mapping modes for touchscreen devices. The mode defines how coordinates
Expand Down
30 changes: 30 additions & 0 deletions include/miral/miral/input_device_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright © Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 or 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef MIRAL_INPUT_DEVICE_CONFIG_H_
#define MIRAL_INPUT_DEVICE_CONFIG_H_

namespace mir
{
class Server;
}

namespace miral
{
void add_input_device_configuration(::mir::Server& opt_val);
}

#endif
11 changes: 3 additions & 8 deletions include/platform/mir/input/pointer_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,10 @@ struct PointerSettings
* Scale vertical scrolling linearly
*/
double vertical_scroll_scale{1.0};
};

inline bool operator==(PointerSettings const& lhs, PointerSettings const& rhs)
{
return lhs.handedness == rhs.handedness && lhs.cursor_acceleration_bias == rhs.cursor_acceleration_bias &&
lhs.acceleration == rhs.acceleration && lhs.horizontal_scroll_scale == rhs.horizontal_scroll_scale &&
lhs.vertical_scroll_scale == rhs.vertical_scroll_scale;
}

bool operator==(PointerSettings const& rhs) const = default;
bool operator!=(PointerSettings const& rhs) const = default;
};
}
}

Expand Down
Loading
Loading