mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
using evdev instead of string constants
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
|
||||
import math
|
||||
|
||||
from evdev import ecodes
|
||||
|
||||
from ....mouse import MouseRange
|
||||
from ....mouse import MouseDelta
|
||||
|
||||
@@ -43,18 +45,18 @@ class Mouse: # pylint: disable=too-many-instance-attributes
|
||||
def is_absolute(self) -> bool:
|
||||
return self.__absolute
|
||||
|
||||
def process_button(self, button: str, state: bool) -> bytes:
|
||||
def process_button(self, button: int, state: bool) -> bytes:
|
||||
code = 0x00
|
||||
match button:
|
||||
case "left":
|
||||
case ecodes.BTN_LEFT:
|
||||
code = 0x01
|
||||
case "right":
|
||||
case ecodes.BTN_RIGHT:
|
||||
code = 0x02
|
||||
case "middle":
|
||||
case ecodes.BTN_MIDDLE:
|
||||
code = 0x04
|
||||
case "up":
|
||||
case ecodes.BTN_BACK:
|
||||
code = 0x08
|
||||
case "down":
|
||||
case ecodes.BTN_FORWARD:
|
||||
code = 0x10
|
||||
if code:
|
||||
if state:
|
||||
|
||||
Reference in New Issue
Block a user