diff --git a/README.en.md b/README.en.md index e11d258..ebcfa41 100644 --- a/README.en.md +++ b/README.en.md @@ -332,6 +332,7 @@ Common environment variables: | `UU_DESKTOP_BACKEND` | `auto` / `x11` / `wayland` / `portal` / `kms` (experimental feature) / `none` (headless) | | `UU_WAYLAND_MULTISCREEN=1` | Enable Hyprland physical monitor switching (off by default) | | `UU_WAYLAND_OUTPUT` | Initial native Wayland output name, e.g. `HDMI-A-1` | +| `UU_WAYLAND_NO_VIRTUAL_KEYBOARD=1` | Native Wayland skips the virtual keyboard (e.g. Denial reserves it for its input method); keys go through uinput. Without wlr-virtual-pointer the pointer also uses uinput (#72) | | `UU_INPUT_BACKEND` | `auto` (default: uinput on Wayland when accessible) / `uinput` / `native` | | `UU_TERMINAL_SHORTCUTS=0` | Disable the Ctrl+V paste rewrite in terminal windows | | `UU_VIDEO_ENCODER` | `cpu`: libx264; `vaapi`: opt-in Intel/AMD; `nvenc`: force NVENC; unset: NVENC only when an NVIDIA driver is loaded, else CPU | diff --git a/README.md b/README.md index 6b68add..d4b9c9b 100644 --- a/README.md +++ b/README.md @@ -300,6 +300,7 @@ systemctl --user restart uuremote-native.service | `UU_DESKTOP_BACKEND` | `auto` / `x11` / `wayland` / `portal` / `kms`(实验性特性) / `none`(无头模式) | | `UU_WAYLAND_MULTISCREEN=1` | 启用 Hyprland 物理显示器切换(默认关闭) | | `UU_WAYLAND_OUTPUT` | 原生 Wayland 默认采集输出名称,例如 `HDMI-A-1` | +| `UU_WAYLAND_NO_VIRTUAL_KEYBOARD=1` | 原生 Wayland 不创建虚拟键盘(如 Denial 只把它给自己的输入法),键盘改走 uinput。合成器没有 wlr-virtual-pointer 时鼠标也自动改走 uinput(#72) | | `UU_INPUT_BACKEND` | `auto`(默认,Wayland 下可用时用 uinput)/ `uinput` / `native` | | `UU_TERMINAL_SHORTCUTS=0` | 关闭终端窗口里的 Ctrl+V 粘贴转换 | | `UU_VIDEO_ENCODER` | `cpu` 强制 CPU;`vaapi` 显式启用 Intel/AMD 硬编;`nvenc` 强制 NVENC;未设置时检测到 NVIDIA 驱动才用 NVENC,否则用 CPU | diff --git a/c_engine/wayland_engine.c b/c_engine/wayland_engine.c index e574525..8af18ea 100644 --- a/c_engine/wayland_engine.c +++ b/c_engine/wayland_engine.c @@ -553,9 +553,6 @@ int uu_wl_init(int32_t *w,int32_t *h) { zwlr_output_power_v1_add_listener(power,&power_listener,NULL); } if(pointer_manager) pointer=zwlr_virtual_pointer_manager_v1_create_virtual_pointer_with_output(pointer_manager,seat,outputs[selected].handle); - /* Some compositors (e.g. Denial) only hand a virtual keyboard to their active input - method and reject everyone else at the protocol level. Keyboard injection then falls - back to uinput on the caller side; capture must still come up. */ /* Some compositors reject a virtual keyboard from anything that is not their active input method (Denial does), and a rejected proxy poisons later requests. Allow the caller to opt out and rely on uinput for key input instead. */ @@ -670,7 +667,8 @@ end: } int uu_wl_move(int32_t x,int32_t y,int relative) { pthread_mutex_lock(&lock); int result=-1; - if(initialized && !pointer) { goto end; } /* no virtual pointer: report failure so the caller falls back to uinput */ + /* -2: no virtual pointer at all, so the caller may use uinput; -1 stays a real failure. */ + if(initialized && !pointer) { result=-2; goto end; } if(initialized) { if(relative) { /* UU reports pixels (source DPR=1); Wayland motion is in logical points. */ diff --git a/src/input.rs b/src/input.rs index a3e4916..c2d126b 100644 --- a/src/input.rs +++ b/src/input.rs @@ -328,12 +328,12 @@ impl InputInjector { // uinput ABS axes span the compositor's whole desktop. A captured output // uses its own pixel space; bind absolute motion to that Wayland output, // including when uinput remains in use for keyboard/buttons/relative input. - if !relative && self.backend==crate::desktop_backend::DesktopBackend::Wayland - && crate::wayland::move_pointer(x,y,false)==0 { - return 0; + // Only a compositor without wlr-virtual-pointer (-2) falls through to the uinput + // absolute pointer; an out-of-range point must not land on another output. + if !relative && self.backend==crate::desktop_backend::DesktopBackend::Wayland { + let result=crate::wayland::move_pointer(x,y,false); + if result!=-2 { return result; } } - // Compositors without wlr-virtual-pointer reject absolute motion here; fall - // through to the uinput absolute pointer instead of reporting a phantom success. if let Some(uinput)=&self.uinput { if relative { return Self::uinput_result(uinput.move_relative(x,y)); } let (w,h)=*self.screen.lock().unwrap();