mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-13 01:30:31 +08:00
separate keyboard and mouse statuses
This commit is contained in:
parent
a60e4142b8
commit
a089334371
@ -118,7 +118,7 @@ class _MouseButtonEvent(_BoolEvent):
|
|||||||
class _MouseWheelEvent(_IntEvent):
|
class _MouseWheelEvent(_IntEvent):
|
||||||
def __post_init__(self) -> None:
|
def __post_init__(self) -> None:
|
||||||
assert self.x == 0 # Горизонтальная прокрутка пока не поддерживается
|
assert self.x == 0 # Горизонтальная прокрутка пока не поддерживается
|
||||||
assert -128 <= self.y <= 127
|
assert -127 <= self.y <= 127
|
||||||
|
|
||||||
def make_command(self) -> bytes:
|
def make_command(self) -> bytes:
|
||||||
return b"\x14\x00" + struct.pack(">b", self.y) + b"\x00\x00"
|
return b"\x14\x00" + struct.pack(">b", self.y) + b"\x00\x00"
|
||||||
@ -188,7 +188,12 @@ class Plugin(BaseHid, multiprocessing.Process): # pylint: disable=too-many-inst
|
|||||||
multiprocessing.Process.start(self)
|
multiprocessing.Process.start(self)
|
||||||
|
|
||||||
def get_state(self) -> Dict:
|
def get_state(self) -> Dict:
|
||||||
return {"online": bool(self.__online_shared.value)}
|
online = bool(self.__online_shared.value)
|
||||||
|
return {
|
||||||
|
"online": online,
|
||||||
|
"keyboard": {"online": online},
|
||||||
|
"mouse": {"online": online},
|
||||||
|
}
|
||||||
|
|
||||||
async def poll_state(self) -> AsyncGenerator[Dict, None]:
|
async def poll_state(self) -> AsyncGenerator[Dict, None]:
|
||||||
prev_state: Dict = {}
|
prev_state: Dict = {}
|
||||||
|
|||||||
@ -95,8 +95,8 @@ export function Hid() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
self.setState = function(state) {
|
self.setState = function(state) {
|
||||||
__keyboard.setState(state);
|
__keyboard.setState(state.keyboard);
|
||||||
__mouse.setState(state);
|
__mouse.setState(state.mouse);
|
||||||
};
|
};
|
||||||
|
|
||||||
var __releaseAll = function() {
|
var __releaseAll = function() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user