Compare commits

...
4 Commits
Author SHA1 Message Date
VallierDevandClaude Opus 5.5 e09778cc94 Release v0.2.21: Wayland without virtual pointer/keyboard, systemd unit docs
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-21 21:05:58 +08:00
VallierDevandClaude Opus 5.5 b1da297e42 Wayland: only a missing virtual pointer falls back to uinput (#78)
uu_wl_move returns -2 only when the compositor has no wlr-virtual-pointer; other failures are returned as before. Document UU_WAYLAND_NO_VIRTUAL_KEYBOARD.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-21 21:05:11 +08:00
ossSBandClaude Opus 5.5 c739036301 Wayland: virtual pointer and keyboard are optional; capture still starts (#72, #73)
Compositors without wlr-virtual-pointer, or that restrict the virtual keyboard to their input method (Denial), now bring up capture and fall back to uinput for input. UU_WAYLAND_NO_VIRTUAL_KEYBOARD=1 skips the virtual keyboard.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-21 16:29:19 +08:00
25893cd4ab docs: align the user systemd unit with the deb package unit (#69)
Drop the hard-coded DISPLAY=:0 and install under graphical-session.target like packaging/deb; Xfce/i3, headless and the virtual desktop keep WantedBy=default.target. AGENTS.md recipe aligned.

Co-authored-by: ferstar <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 22:42:11 +08:00
8 changed files with 103 additions and 47 deletions

No files matched your search

+7 -3
View File
@@ -79,17 +79,21 @@ cargo build --release --features native-viewer,viewer-sdl --bin uuremote-viewer
[Unit] [Unit]
Description=UU Remote Linux host (unofficial) Description=UU Remote Linux host (unofficial)
After=graphical-session.target After=graphical-session.target
PartOf=graphical-session.target
[Service] [Service]
Environment=RUST_LOG=info Environment=RUST_LOG=info
Environment=DISPLAY=:0
# GNOME on Xorg usually needs: Environment=XAUTHORITY=/run/user/<uid>/gdm/Xauthority
ExecStart=%h/.local/bin/uuremote-server ExecStart=%h/.local/bin/uuremote-server
Restart=always Restart=always
RestartSec=5 RestartSec=5
[Install] [Install]
WantedBy=default.target WantedBy=graphical-session.target
``` ```
Same as packaging/deb. GNOME/KDE import DISPLAY / WAYLAND_DISPLAY and start graphical-session.target; do not hard-code
DISPLAY there (it overrides the session's real one, XWayland is often :1); under default.target the unit can
start before WAYLAND_DISPLAY is imported and fall back to X11. Desktops without that target (Xfce, i3) and the Xvfb
virtual desktop need `WantedBy=default.target` plus an explicit `Environment=DISPLAY=...`; headless
(`UU_DESKTOP_BACKEND=none` + linger) needs `WantedBy=default.target` only (GNOME on Xorg outside the session: `XAUTHORITY=/run/user/<uid>/gdm/Xauthority`).
Find the real display/Xauthority with `loginctl show-session <id> -p Display` / `ps -o args -C Xorg`. Find the real display/Xauthority with `loginctl show-session <id> -p Display` / `ps -o args -C Xorg`.
5. `systemctl --user daemon-reload && systemctl --user enable --now uuremote-native.service` 5. `systemctl --user daemon-reload && systemctl --user enable --now uuremote-native.service`
6. Verify: `journalctl --user -u uuremote-native.service -f` must show 6. Verify: `journalctl --user -u uuremote-native.service -f` must show
Generated
+1 -1
View File
@@ -2741,7 +2741,7 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]] [[package]]
name = "uu-remote-linux" name = "uu-remote-linux"
version = "0.2.20" version = "0.2.21"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"base64 0.22.1", "base64 0.22.1",
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "uu-remote-linux" name = "uu-remote-linux"
version = "0.2.20" version = "0.2.21"
edition = "2021" edition = "2021"
default-run = "uuremote-server" default-run = "uuremote-server"
authors = ["uu-remote-linux contributors"] authors = ["uu-remote-linux contributors"]
+9 -4
View File
@@ -211,17 +211,17 @@ machine, in `~/.config/uuremote/config.json` (mode 0600).
[Unit] [Unit]
Description=UU Remote Linux host (unofficial) Description=UU Remote Linux host (unofficial)
After=graphical-session.target After=graphical-session.target
PartOf=graphical-session.target
[Service] [Service]
Environment=RUST_LOG=info Environment=RUST_LOG=info
# X11 desktops need the display; on GNOME, XAUTHORITY is usually /run/user/<uid>/gdm/Xauthority # GNOME/KDE import DISPLAY / WAYLAND_DISPLAY into the user manager and start graphical-session.target
Environment=DISPLAY=:0
ExecStart=%h/.local/bin/uuremote-server ExecStart=%h/.local/bin/uuremote-server
Restart=always Restart=always
RestartSec=5 RestartSec=5
[Install] [Install]
WantedBy=default.target WantedBy=graphical-session.target
``` ```
```sh ```sh
@@ -233,6 +233,10 @@ journalctl --user -u uuremote-native.service -f # online once you see availabi
If you have not logged in yet, the service opens the QR login window on your desktop. If you have not logged in yet, the service opens the QR login window on your desktop.
Desktops that never start `graphical-session.target` (e.g. Xfce, i3) will not autostart this unit: change `[Install]` to
`WantedBy=default.target`, add `Environment=DISPLAY=:0` (your actual display) and `enable` again. Headless mode and the
virtual desktop below also need `default.target`.
### 5. uinput virtual keyboard/mouse on Wayland (recommended) ### 5. uinput virtual keyboard/mouse on Wayland (recommended)
On Wayland (especially GNOME/KDE via the portal) the default input path needs portal consent and some keyboard layouts On Wayland (especially GNOME/KDE via the portal) the default input path needs portal consent and some keyboard layouts
@@ -283,7 +287,7 @@ the same account cannot assist each other, an official restriction).
## Servers without a monitor ## Servers without a monitor
**Headless mode** (terminal, file transfer and port mapping only): add `Environment=UU_DESKTOP_BACKEND=none` to the **Headless mode** (terminal, file transfer and port mapping only): add `Environment=UU_DESKTOP_BACKEND=none` to the
service and run `loginctl enable-linger $USER`, so the systemd user manager (with `XDG_RUNTIME_DIR` and the user D-Bus) service, change `[Install]` to `WantedBy=default.target` (`graphical-session.target` never starts without a login), and run `loginctl enable-linger $USER`, so the systemd user manager (with `XDG_RUNTIME_DIR` and the user D-Bus)
starts at boot without a login. The viewer's remote desktop keeps showing "connecting" in this mode; that is expected. starts at boot without a login. The viewer's remote desktop keeps showing "connecting" in this mode; that is expected.
Log in once with `uuremote-server login --no-gui` (QR in the terminal). Log in once with `uuremote-server login --no-gui` (QR in the terminal).
@@ -328,6 +332,7 @@ Common environment variables:
| `UU_DESKTOP_BACKEND` | `auto` / `x11` / `wayland` / `portal` / `kms` (experimental feature) / `none` (headless) | | `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_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_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_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_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 | | `UU_VIDEO_ENCODER` | `cpu`: libx264; `vaapi`: opt-in Intel/AMD; `nvenc`: force NVENC; unset: NVENC only when an NVIDIA driver is loaded, else CPU |
+8 -4
View File
@@ -194,17 +194,17 @@ FFmpeg 7 及以上会在依赖 `ffmpeg-sys-next` 里报 `avfft.h file not found`
[Unit] [Unit]
Description=UU Remote Linux host (unofficial) Description=UU Remote Linux host (unofficial)
After=graphical-session.target After=graphical-session.target
PartOf=graphical-session.target
[Service] [Service]
Environment=RUST_LOG=info Environment=RUST_LOG=info
# X11 桌面需要指明显示器;GNOME 的 XAUTHORITY 一般在 /run/user/<uid>/gdm/Xauthority # GNOME/KDE 等桌面会把 DISPLAY / WAYLAND_DISPLAY 导入用户管理器,并启动 graphical-session.target
Environment=DISPLAY=:0
ExecStart=%h/.local/bin/uuremote-server ExecStart=%h/.local/bin/uuremote-server
Restart=always Restart=always
RestartSec=5 RestartSec=5
[Install] [Install]
WantedBy=default.target WantedBy=graphical-session.target
``` ```
```sh ```sh
@@ -216,6 +216,9 @@ journalctl --user -u uuremote-native.service -f # 看到 availability=Some("re
如果还没有登录,服务会自动在桌面上弹出扫码窗口。 如果还没有登录,服务会自动在桌面上弹出扫码窗口。
Xfce、i3 等不启动 `graphical-session.target` 的桌面,按上面的写法开机不会自启:把 `[Install]` 改成 `WantedBy=default.target`,
并加上 `Environment=DISPLAY=:0`(按实际显示器填写),再重新 `enable`。下文的无头模式、虚拟桌面也要用 `default.target`。
### 5. Wayland 下使用 uinput 虚拟键鼠(推荐) ### 5. Wayland 下使用 uinput 虚拟键鼠(推荐)
Wayland(尤其是 GNOME/KDE portal)下,默认的键鼠注入要经过 portal 授权,部分键盘布局下还会丢符号(比如下划线)。 Wayland(尤其是 GNOME/KDE portal)下,默认的键鼠注入要经过 portal 授权,部分键盘布局下还会丢符号(比如下划线)。
@@ -255,7 +258,7 @@ install -Dm644 contrib/desktop/uu-remote-linux-viewer.desktop ~/.local/share/app
## 没有显示器的服务器 ## 没有显示器的服务器
**无头模式**:只要终端、文件传输和端口映射,不需要图形界面。在服务里加 `Environment=UU_DESKTOP_BACKEND=none`, **无头模式**:只要终端、文件传输和端口映射,不需要图形界面。在服务里加 `Environment=UU_DESKTOP_BACKEND=none`,
再执行 `loginctl enable-linger $USER`,这样开机后不用登录,systemd 用户服务(以及 `XDG_RUNTIME_DIR`、用户 D-Bus)也会自动启动。 把 `[Install]` 改成 `WantedBy=default.target`(无人登录时 `graphical-session.target` 不会启动),再执行 `loginctl enable-linger $USER`,这样开机后不用登录,systemd 用户服务(以及 `XDG_RUNTIME_DIR`、用户 D-Bus)也会自动启动。
无头模式下控制端点「远程桌面」会一直显示正在连接,这是正常的。首次登录用 `uuremote-server login --no-gui` 在终端里扫码。 无头模式下控制端点「远程桌面」会一直显示正在连接,这是正常的。首次登录用 `uuremote-server login --no-gui` 在终端里扫码。
**群晖 / NAS(Docker)**:没有桌面的 NAS 可以用容器运行无头模式(文件传输、终端、端口映射)。 **群晖 / NAS(Docker)**:没有桌面的 NAS 可以用容器运行无头模式(文件传输、终端、端口映射)。
@@ -297,6 +300,7 @@ systemctl --user restart uuremote-native.service
| `UU_DESKTOP_BACKEND` | `auto` / `x11` / `wayland` / `portal` / `kms`(实验性特性) / `none`(无头模式) | | `UU_DESKTOP_BACKEND` | `auto` / `x11` / `wayland` / `portal` / `kms`(实验性特性) / `none`(无头模式) |
| `UU_WAYLAND_MULTISCREEN=1` | 启用 Hyprland 物理显示器切换(默认关闭) | | `UU_WAYLAND_MULTISCREEN=1` | 启用 Hyprland 物理显示器切换(默认关闭) |
| `UU_WAYLAND_OUTPUT` | 原生 Wayland 默认采集输出名称,例如 `HDMI-A-1` | | `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_INPUT_BACKEND` | `auto`(默认,Wayland 下可用时用 uinput)/ `uinput` / `native` |
| `UU_TERMINAL_SHORTCUTS=0` | 关闭终端窗口里的 Ctrl+V 粘贴转换 | | `UU_TERMINAL_SHORTCUTS=0` | 关闭终端窗口里的 Ctrl+V 粘贴转换 |
| `UU_VIDEO_ENCODER` | `cpu` 强制 CPU;`vaapi` 显式启用 Intel/AMD 硬编;`nvenc` 强制 NVENC;未设置时检测到 NVIDIA 驱动才用 NVENC,否则用 CPU | | `UU_VIDEO_ENCODER` | `cpu` 强制 CPU;`vaapi` 显式启用 Intel/AMD 硬编;`nvenc` 强制 NVENC;未设置时检测到 NVIDIA 驱动才用 NVENC,否则用 CPU |
+54 -33
View File
@@ -535,7 +535,10 @@ int uu_wl_init(int32_t *w,int32_t *h) {
wl_registry_add_listener(registry,&registry_listener,NULL); wl_registry_add_listener(registry,&registry_listener,NULL);
if(sync_display()!=0 || sync_display()!=0) goto end; if(sync_display()!=0 || sync_display()!=0) goto end;
dma_init(); dma_init();
if(!shm || !seat || !copy_manager || !pointer_manager || !keyboard_manager || !output_count) goto end; /* wlr-virtual-pointer is an optional input path. When the compositor does not
advertise it, pointer injection is skipped and the caller may drive input
through uinput; screencopy + virtual keyboard are still enough to capture. */
if(!shm || !seat || !copy_manager || !output_count) goto end;
const char *name=getenv("UU_WAYLAND_OUTPUT"); selected=0; const char *name=getenv("UU_WAYLAND_OUTPUT"); selected=0;
if(name && *name) { if(name && *name) {
for(selected=0;selected<output_count;selected++) if(!strcmp(outputs[selected].name,name)) break; for(selected=0;selected<output_count;selected++) if(!strcmp(outputs[selected].name,name)) break;
@@ -549,23 +552,30 @@ int uu_wl_init(int32_t *w,int32_t *h) {
power=zwlr_output_power_manager_v1_get_output_power(power_manager,outputs[selected].handle); power=zwlr_output_power_manager_v1_get_output_power(power_manager,outputs[selected].handle);
zwlr_output_power_v1_add_listener(power,&power_listener,NULL); zwlr_output_power_v1_add_listener(power,&power_listener,NULL);
} }
pointer=zwlr_virtual_pointer_manager_v1_create_virtual_pointer_with_output(pointer_manager,seat,outputs[selected].handle); if(pointer_manager) pointer=zwlr_virtual_pointer_manager_v1_create_virtual_pointer_with_output(pointer_manager,seat,outputs[selected].handle);
keyboard=zwp_virtual_keyboard_manager_v1_create_virtual_keyboard(keyboard_manager,seat); /* Some compositors reject a virtual keyboard from anything that is not their active
xkb=xkb_context_new(XKB_CONTEXT_NO_FLAGS); input method (Denial does), and a rejected proxy poisons later requests. Allow the
if(!xkb) goto end; caller to opt out and rely on uinput for key input instead. */
struct xkb_rule_names names={.layout="us"}; const char *skip_kbd=getenv("UU_WAYLAND_NO_VIRTUAL_KEYBOARD");
keymap=xkb_keymap_new_from_names(xkb,&names,XKB_KEYMAP_COMPILE_NO_FLAGS); if(keyboard_manager && !(skip_kbd && *skip_kbd && strcmp(skip_kbd,"0")))
if(!keymap) goto end; keyboard=zwp_virtual_keyboard_manager_v1_create_virtual_keyboard(keyboard_manager,seat);
key_state=xkb_state_new(keymap); if(!key_state) goto end; if(keyboard) {
keymap_text=xkb_keymap_get_as_string(keymap,XKB_KEYMAP_FORMAT_TEXT_V1); xkb=xkb_context_new(XKB_CONTEXT_NO_FLAGS);
if(!keymap_text) goto end; if(!xkb) goto end;
keymap_text_len=strlen(keymap_text)+1; struct xkb_rule_names names={.layout="us"};
if(upload_keymap(keymap_text,keymap_text_len)!=0) goto end; keymap=xkb_keymap_new_from_names(xkb,&names,XKB_KEYMAP_COMPILE_NO_FLAGS);
if(sync_display()!=0) goto end; if(!keymap) goto end;
/* Text typing needs unmapped keycodes and a place to declare them. A keymap without either key_state=xkb_state_new(keymap); if(!key_state) goto end;
only costs that path - uu_wl_type_utf8 refuses and the caller keeps its own fallback. */ keymap_text=xkb_keymap_get_as_string(keymap,XKB_KEYMAP_FORMAT_TEXT_V1);
keymap_insert=symbols_close(keymap_text); if(!keymap_text) goto end;
spare_count=find_spare_codes(spare_codes,sizeof(spare_codes)/sizeof(spare_codes[0])); keymap_text_len=strlen(keymap_text)+1;
if(upload_keymap(keymap_text,keymap_text_len)!=0) goto end;
if(sync_display()!=0) goto end;
/* Text typing needs unmapped keycodes and a place to declare them. A keymap without either
only costs that path - uu_wl_type_utf8 refuses and the caller keeps its own fallback. */
keymap_insert=symbols_close(keymap_text);
spare_count=find_spare_codes(spare_codes,sizeof(spare_codes)/sizeof(spare_codes[0]));
}
initialized=1; *w=width; *h=height; result=0; initialized=1; *w=width; *h=height; result=0;
end: end:
if(result!=0) reset(); if(result!=0) reset();
@@ -581,9 +591,12 @@ int uu_wl_select_output(const char *name,uint32_t expected_w,uint32_t expected_h
if(target==output_count || outputs[target].transform!=WL_OUTPUT_TRANSFORM_NORMAL) goto end; if(target==output_count || outputs[target].transform!=WL_OUTPUT_TRANSFORM_NORMAL) goto end;
uint32_t w=outputs[target].width,h=outputs[target].height; uint32_t w=outputs[target].width,h=outputs[target].height;
if(w!=expected_w || h!=expected_h || !w || !h || w>16384 || h>16384 || (uint64_t)w*h*4>256*1024*1024) goto end; if(w!=expected_w || h!=expected_h || !w || !h || w>16384 || h>16384 || (uint64_t)w*h*4>256*1024*1024) goto end;
struct zwlr_virtual_pointer_v1 *next=zwlr_virtual_pointer_manager_v1_create_virtual_pointer_with_output(pointer_manager,seat,outputs[target].handle); struct zwlr_virtual_pointer_v1 *next=NULL;
if(!next) goto end; if(pointer_manager) {
if(sync_display()!=0) {zwlr_virtual_pointer_v1_destroy(next);goto end;} next=zwlr_virtual_pointer_manager_v1_create_virtual_pointer_with_output(pointer_manager,seat,outputs[target].handle);
if(!next) goto end;
if(sync_display()!=0) {zwlr_virtual_pointer_v1_destroy(next);goto end;}
}
for(unsigned i=0;i<2;i++) { frame_clear(&frames[i]); dma_clear(&frames[i]); shm_clear(&frames[i]); } for(unsigned i=0;i<2;i++) { frame_clear(&frames[i]); dma_clear(&frames[i]); shm_clear(&frames[i]); }
pending=0; pending=0;
if(pointer) zwlr_virtual_pointer_v1_destroy(pointer); if(pointer) zwlr_virtual_pointer_v1_destroy(pointer);
@@ -654,6 +667,8 @@ end:
} }
int uu_wl_move(int32_t x,int32_t y,int relative) { int uu_wl_move(int32_t x,int32_t y,int relative) {
pthread_mutex_lock(&lock); int result=-1; pthread_mutex_lock(&lock); int result=-1;
/* -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(initialized) {
if(relative) { if(relative) {
/* UU reports pixels (source DPR=1); Wayland motion is in logical points. */ /* UU reports pixels (source DPR=1); Wayland motion is in logical points. */
@@ -668,6 +683,7 @@ end: pthread_mutex_unlock(&lock); return result;
} }
int uu_wl_button(int button,int pressed) { int uu_wl_button(int button,int pressed) {
pthread_mutex_lock(&lock); int result=-1; pthread_mutex_lock(&lock); int result=-1;
if(initialized && !pointer) { goto end; } /* no virtual pointer: report failure so the caller falls back to uinput */
if(initialized) { if(initialized) {
if(button>=4 && button<=7) { if(button>=4 && button<=7) {
if(pressed) { if(pressed) {
@@ -687,6 +703,7 @@ end: pthread_mutex_unlock(&lock); return result;
} }
int uu_wl_key(uint64_t symbol,int pressed) { int uu_wl_key(uint64_t symbol,int pressed) {
pthread_mutex_lock(&lock); int result=-1; pthread_mutex_lock(&lock); int result=-1;
if(initialized && !keyboard) { pthread_mutex_unlock(&lock); return -1; } /* no virtual keyboard: caller falls back to uinput */
if(initialized) { if(initialized) {
for(xkb_keycode_t code=xkb_keymap_min_keycode(keymap);code<=xkb_keymap_max_keycode(keymap);code++) { for(xkb_keycode_t code=xkb_keymap_min_keycode(keymap);code<=xkb_keymap_max_keycode(keymap);code++) {
int matches=0; int matches=0;
@@ -717,20 +734,24 @@ int uu_wl_release_all(void) {
if(initialized) { if(initialized) {
/* Sweep this client's virtual keyboard directly: a keysym lookup can /* Sweep this client's virtual keyboard directly: a keysym lookup can
fail for unmapped OEM/keypad symbols before reaching held modifiers. */ fail for unmapped OEM/keypad symbols before reaching held modifiers. */
for(xkb_keycode_t code=xkb_keymap_min_keycode(keymap);code<=xkb_keymap_max_keycode(keymap);code++) { if(keyboard) {
if(code<8 || code>=sizeof(held_keys) || !xkb_keymap_key_get_name(keymap,code)) continue; for(xkb_keycode_t code=xkb_keymap_min_keycode(keymap);code<=xkb_keymap_max_keycode(keymap);code++) {
zwp_virtual_keyboard_v1_key(keyboard,timestamp(),code-8,WL_KEYBOARD_KEY_STATE_RELEASED); if(code<8 || code>=sizeof(held_keys) || !xkb_keymap_key_get_name(keymap,code)) continue;
if(held_keys[code]) xkb_state_update_key(key_state,code,XKB_KEY_UP); zwp_virtual_keyboard_v1_key(keyboard,timestamp(),code-8,WL_KEYBOARD_KEY_STATE_RELEASED);
if(held_keys[code]) xkb_state_update_key(key_state,code,XKB_KEY_UP);
}
zwp_virtual_keyboard_v1_modifiers(keyboard,
xkb_state_serialize_mods(key_state,XKB_STATE_MODS_DEPRESSED),
xkb_state_serialize_mods(key_state,XKB_STATE_MODS_LATCHED),
xkb_state_serialize_mods(key_state,XKB_STATE_MODS_LOCKED),
xkb_state_serialize_layout(key_state,XKB_STATE_LAYOUT_EFFECTIVE));
} }
memset(held_keys,0,sizeof(held_keys)); memset(held_keys,0,sizeof(held_keys));
zwp_virtual_keyboard_v1_modifiers(keyboard, if(pointer) {
xkb_state_serialize_mods(key_state,XKB_STATE_MODS_DEPRESSED), for(unsigned code=0x110;code<=0x114;code++)
xkb_state_serialize_mods(key_state,XKB_STATE_MODS_LATCHED), zwlr_virtual_pointer_v1_button(pointer,timestamp(),code,WL_POINTER_BUTTON_STATE_RELEASED);
xkb_state_serialize_mods(key_state,XKB_STATE_MODS_LOCKED), zwlr_virtual_pointer_v1_frame(pointer);
xkb_state_serialize_layout(key_state,XKB_STATE_LAYOUT_EFFECTIVE)); }
for(unsigned code=0x110;code<=0x114;code++)
zwlr_virtual_pointer_v1_button(pointer,timestamp(),code,WL_POINTER_BUTTON_STATE_RELEASED);
zwlr_virtual_pointer_v1_frame(pointer);
result=wl_display_flush(display)<0?-1:0; result=wl_display_flush(display)<0?-1:0;
} }
pthread_mutex_unlock(&lock);return result; pthread_mutex_unlock(&lock);return result;
+19
View File
@@ -0,0 +1,19 @@
Wayland 合成器缺少虚拟指针或虚拟键盘时,桌面仍可使用;systemd 单元示例与 deb 包一致。/ Wayland desktops without virtual pointer/keyboard protocols still come up.
### 修复 / Fixed
- **只缺 wlr-virtual-pointer 或虚拟键盘受限的合成器整个桌面不可用**(#72、#73,感谢 @clionertr):Denial 等合成器不提供
`zwlr_virtual_pointer_manager_v1`,或只把虚拟键盘给它自己的输入法。现在这两个协议都是可选的:画面采集照常启动,
缺指针时绝对移动改走 uinput(需能访问 `/dev/uinput`,见 README);`UU_WAYLAND_NO_VIRTUAL_KEYBOARD=1` 可跳过虚拟键盘。
只有「完全没有虚拟指针」才回退 uinput;坐标超出当前采集输出等其他失败照旧返回,不会把指针移到别的屏幕(#78)。
CI 构建与测试通过,**未在 Denial 上实机验证**;Hyprland 等已有虚拟指针的合成器行为不变。
- Virtual pointer and keyboard are optional on Wayland; capture still starts and pointer motion falls back to uinput only when
the compositor has no wlr-virtual-pointer. Not tested on Denial.
### 文档 / Docs
- README 的用户 systemd 单元与 deb 包一致:不再写死 `DISPLAY=:0`,随 `graphical-session.target` 启动;无头模式、虚拟桌面和
Xfce/i3 等不启动该 target 的桌面改用 `WantedBy=default.target`(#69,感谢 @ferstar)。
### 下载 / Download
`uu-remote-linux_0.2.21_<amd64|arm64>.deb`,或 `uu-remote-linux-v0.2.21-<x86_64|aarch64>-linux.tar.gz`,或 `docker pull ghcr.io/vallierdev/uu-remote-linux:v0.2.21`(x86_64)。
**非官方项目,与网易无关。** / **Unofficial, not affiliated with NetEase.**
+4 -1
View File
@@ -328,8 +328,11 @@ impl InputInjector {
// uinput ABS axes span the compositor's whole desktop. A captured output // uinput ABS axes span the compositor's whole desktop. A captured output
// uses its own pixel space; bind absolute motion to that Wayland output, // uses its own pixel space; bind absolute motion to that Wayland output,
// including when uinput remains in use for keyboard/buttons/relative input. // including when uinput remains in use for keyboard/buttons/relative input.
// 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 { if !relative && self.backend==crate::desktop_backend::DesktopBackend::Wayland {
return crate::wayland::move_pointer(x,y,false); let result=crate::wayland::move_pointer(x,y,false);
if result!=-2 { return result; }
} }
if let Some(uinput)=&self.uinput { if let Some(uinput)=&self.uinput {
if relative { return Self::uinput_result(uinput.move_relative(x,y)); } if relative { return Self::uinput_result(uinput.move_relative(x,y)); }