summaryrefslogtreecommitdiff
path: root/kvmd/mouse.py
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2021-03-26 21:32:21 +0300
committerDevaev Maxim <[email protected]>2021-03-26 21:32:21 +0300
commita66221a494e35ab070d13291ce82928797bf95d4 (patch)
tree3dd496eccf1f3281dad1d545e50a111c28ccdfbc /kvmd/mouse.py
parent1674cf70b3f925fe055398911761542c14d304e9 (diff)
fixed mouse remap
Diffstat (limited to 'kvmd/mouse.py')
-rw-r--r--kvmd/mouse.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/kvmd/mouse.py b/kvmd/mouse.py
new file mode 100644
index 00000000..53fa98b5
--- /dev/null
+++ b/kvmd/mouse.py
@@ -0,0 +1,34 @@
+# ========================================================================== #
+# #
+# KVMD - The main Pi-KVM daemon. #
+# #
+# Copyright (C) 2018-2021 Maxim Devaev <[email protected]> #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# 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 <https://www.gnu.org/licenses/>. #
+# #
+# ========================================================================== #
+
+
+from . import tools
+
+
+# =====
+class MouseRange:
+ MIN = -32768
+ MAX = 32767
+ RANGE = (MIN, MAX)
+
+ @classmethod
+ def remap(cls, value: int, out_min: int, out_max: int) -> int:
+ return tools.remap(value, cls.MIN, cls.MAX, out_min, out_max)