功能:完善2K串流、显示恢复与输入优化
This commit is contained in:
1 parent
e47b01beec
commit
938ec97cce
95 files changed
+5788
-72
No files matched your search
@@ -0,0 +1,31 @@
|
||||
"""X11 benchmark only: 20 seconds of 125 Hz motion, no buttons or keys."""
|
||||
import ctypes
|
||||
import math
|
||||
import time
|
||||
|
||||
x11 = ctypes.CDLL("libX11.so.6")
|
||||
xtest = ctypes.CDLL("libXtst.so.6")
|
||||
x11.XOpenDisplay.argtypes = [ctypes.c_char_p]
|
||||
x11.XOpenDisplay.restype = ctypes.c_void_p
|
||||
x11.XFlush.argtypes = [ctypes.c_void_p]
|
||||
x11.XCloseDisplay.argtypes = [ctypes.c_void_p]
|
||||
xtest.XTestFakeMotionEvent.argtypes = [ctypes.c_void_p, ctypes.c_int,
|
||||
ctypes.c_int, ctypes.c_int, ctypes.c_ulong]
|
||||
display = x11.XOpenDisplay(None)
|
||||
if not display:
|
||||
raise RuntimeError("X11 unavailable")
|
||||
start = time.monotonic()
|
||||
count = 0
|
||||
try:
|
||||
while time.monotonic() - start < 20:
|
||||
elapsed = time.monotonic() - start
|
||||
x = round(1280 + 1000 * math.sin(elapsed * 4))
|
||||
y = round(720 + 450 * math.cos(elapsed * 3))
|
||||
if not xtest.XTestFakeMotionEvent(display, -1, x, y, 0):
|
||||
raise RuntimeError("Motion injection failed")
|
||||
x11.XFlush(display)
|
||||
count += 1
|
||||
time.sleep(max(0, start + count / 125 - time.monotonic()))
|
||||
finally:
|
||||
x11.XCloseDisplay(display)
|
||||
print(f"Injected {count} motion events in {time.monotonic()-start:.2f}s")
|
||||
Reference in new issue
Block a user