-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow servers to dynamically update input configuration. There's a very simple "mir_demo_server.input" addition to `mir_demo_server` to exercise part of this API, but that is not intended prototype.
- Loading branch information
Showing
10 changed files
with
740 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/* | ||
* 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_CONFIGURATION_H | ||
#define MIRAL_INPUT_CONFIGURATION_H | ||
|
||
#include <mir_toolkit/mir_input_device_types.h> | ||
|
||
#include <optional> | ||
#include <memory> | ||
|
||
namespace mir { class Server; } | ||
|
||
|
||
namespace miral | ||
{ | ||
/** Input configuration. | ||
* Allow servers to make input configuration changes at runtime | ||
* \remark Since MirAL 5.1 | ||
*/ | ||
class InputConfiguration | ||
{ | ||
public: | ||
InputConfiguration(); | ||
~InputConfiguration(); | ||
void operator()(mir::Server& server); | ||
|
||
class Mouse; | ||
class Touchpad; | ||
|
||
auto mouse() -> Mouse; | ||
void mouse(Mouse const& val); | ||
auto touchpad() -> Touchpad; | ||
void touchpad(Touchpad const& val); | ||
|
||
private: | ||
class Self; | ||
std::shared_ptr<Self> self; | ||
}; | ||
|
||
/** Input configuration for mouse pointer devices | ||
* \remark Since MirAL 5.1 | ||
*/ | ||
class InputConfiguration::Mouse | ||
{ | ||
public: | ||
Mouse(); | ||
~Mouse(); | ||
|
||
Mouse(Mouse const& that); | ||
auto operator=(Mouse that) -> Mouse&; | ||
|
||
auto handedness() const -> std::optional<MirPointerHandedness>; | ||
auto acceleration() const -> std::optional<MirPointerAcceleration>; | ||
auto acceleration_bias() const -> std::optional<double>; | ||
auto vscroll_speed() const -> std::optional<double>; | ||
auto hscroll_speed() const -> std::optional<double>; | ||
|
||
void handedness(std::optional<MirPointerHandedness>const& val); | ||
void acceleration(std::optional<MirPointerAcceleration>const& val); | ||
/// \note val will be clamped to the range [-1.0, 1.0] | ||
void acceleration_bias(std::optional<double>const& val); | ||
void vscroll_speed(std::optional<double>const& val); | ||
void hscroll_speed(std::optional<double>const& val); | ||
|
||
private: | ||
friend class InputConfiguration::Self; | ||
class Self; | ||
std::unique_ptr<Self> self; | ||
}; | ||
|
||
/** Input configuration for touchpad devices | ||
* \remark Since MirAL 5.1 | ||
*/ | ||
class InputConfiguration::Touchpad | ||
{ | ||
public: | ||
Touchpad(); | ||
~Touchpad(); | ||
|
||
Touchpad(Touchpad const& that); | ||
auto operator=(Touchpad that) -> Touchpad&; | ||
|
||
auto disable_while_typing() const -> std::optional<bool>; | ||
auto disable_with_external_mouse() const -> std::optional<bool>; | ||
auto acceleration() const -> std::optional<MirPointerAcceleration>; | ||
auto acceleration_bias() const -> std::optional<double>; | ||
auto vscroll_speed() const -> std::optional<double>; | ||
auto hscroll_speed() const -> std::optional<double>; | ||
auto click_mode() const -> std::optional<MirTouchpadClickMode>; | ||
auto scroll_mode() const -> std::optional<MirTouchpadScrollMode>; | ||
auto tap_to_click() const -> std::optional<bool>; | ||
|
||
void disable_while_typing(std::optional<bool>const& val); | ||
void disable_with_external_mouse(std::optional<bool>const& val); | ||
void acceleration(std::optional<MirPointerAcceleration>const& val); | ||
/// \note val will be clamped to the range [-1.0, 1.0] | ||
void acceleration_bias(std::optional<double>const& val); | ||
void vscroll_speed(std::optional<double>const& val); | ||
void hscroll_speed(std::optional<double>const& val); | ||
void click_mode(std::optional<MirTouchpadClickMode>const& val); | ||
void scroll_mode(std::optional<MirTouchpadScrollMode>const& val); | ||
void tap_to_click(std::optional<bool>const& val); | ||
|
||
private: | ||
friend class InputConfiguration::Self; | ||
class Self; | ||
std::shared_ptr<Self> self; | ||
}; | ||
} | ||
|
||
#endif //MIRAL_INPUT_CONFIGURATION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.