Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to regain control over mouse with libvirt's remote-viewer #8153

Open
GrabbenD opened this issue May 8, 2024 · 4 comments
Open

Unable to regain control over mouse with libvirt's remote-viewer #8153

GrabbenD opened this issue May 8, 2024 · 4 comments
Labels
bug Not working as intended

Comments

@GrabbenD
Copy link

GrabbenD commented May 8, 2024

  • Sway Version:

    • 1.9
  • Debug Log:
    Here's relevant logs after the last step in reproducible example from below:

    $ sway -d
    (...)
    00:03:47.113 [DEBUG] [sway/desktop/transaction.c:398] Transaction 0x57aacecf4220 committing with 4 instructions
    00:03:47.113 [DEBUG] [sway/desktop/transaction.c:294] Applying transaction 0x57aacecf4220
    00:03:48.747 [DEBUG] [sway/desktop/transaction.c:398] Transaction 0x57aaceb4c900 committing with 4 instructions
    00:03:48.747 [DEBUG] [sway/desktop/transaction.c:294] Applying transaction 0x57aaceb4c900
    00:03:49.218 [DEBUG] [wlr] [types/wlr_compositor.c:692] New wlr_surface 0x57aacecfbe50 (res 0x57aacece0500)
    00:03:49.218 [DEBUG] [wlr] [types/wlr_compositor.c:692] New wlr_surface 0x57aacecdcfe0 (res 0x57aacecdd390)
    00:03:49.256 [DEBUG] [wlr] [types/wlr_compositor.c:692] New wlr_surface 0x57aacecd8db0 (res 0x57aacecd9160)
    00:03:49.256 [DEBUG] [wlr] [types/wlr_compositor.c:692] New wlr_surface 0x57aacecfb660 (res 0x57aacecfba10)
    00:03:49.256 [DEBUG] [wlr] [types/wlr_compositor.c:692] New wlr_surface 0x57aacecdfa40 (res 0x57aacecdfdf0)
    00:03:49.256 [DEBUG] [wlr] [types/wlr_compositor.c:692] New wlr_surface 0x57aacecbb7e0 (res 0x57aacecbbb90)
    00:03:49.256 [DEBUG] [wlr] [types/xdg_shell/wlr_xdg_surface.c:388] new xdg_surface 0x57aaceceee80 (res 0x57aacecd9250)
    00:03:49.256 [DEBUG] [sway/desktop/xdg_shell.c:530] New xdg_shell toplevel title='spice://localhost:3001 (1)' app_id='remote-viewer'
    00:03:49.256 [DEBUG] [wlr] [types/wlr_server_decoration.c:104] new server_decoration 0x57aacecf1e60 (res 0x57aacecd3740)
    00:03:49.277 [DEBUG] [sway/tree/view.c:421] View 0x57aaced07500 updated CSD to 1
    00:03:49.277 [DEBUG] [sway/tree/arrange.c:263] Usable area for ws: 3840x1600@0,0
    00:03:49.277 [DEBUG] [sway/tree/arrange.c:297] Arranging workspace '1' at 2.000000, 2.000000
    00:03:49.277 [DEBUG] [sway/tree/arrange.c:77] Arranging 0x7ffec30c9450 horizontally
    00:03:49.277 [DEBUG] [sway/desktop/transaction.c:398] Transaction 0x57aaceb4c900 committing with 7 instructions
    00:03:49.279 [DEBUG] [wlr] [types/wlr_compositor.c:692] New wlr_surface 0x57aaced05440 (res 0x57aaced057f0)
    00:03:49.279 [DEBUG] [wlr] [types/wlr_compositor.c:692] New wlr_surface 0x57aacecfd120 (res 0x57aacecfd4d0)
    00:03:49.289 [DEBUG] [sway/desktop/transaction.c:494] Transaction 0x57aaceb4c900 is ready
    00:03:49.289 [DEBUG] [sway/desktop/transaction.c:294] Applying transaction 0x57aaceb4c900
    00:03:49.289 [DEBUG] [sway/tree/container.c:1320] Container 0x57aacecdd660 entered output 0x57aacea71400
    00:03:49.290 [DEBUG] [sway/input/input-manager.c:335] Adding keyboard shortcuts inhibitor
    00:03:49.944 [DEBUG] [wlr] [types/wlr_pointer_constraints_v1.c:252] new locked_pointer 0x57aacecfe380 (res 0x57aacecd8b40)
    00:03:49.944 [DEBUG] [wlr] [types/wlr_pointer_constraints_v1.c:352] constrained 0x57aacecfe380
    00:03:52.655 [DEBUG] [sway/input/input-manager.c:320] Removing keyboard shortcuts inhibitor
    00:03:57.040 [DEBUG] [sway/ipc-server.c:354] Sending bar_state_update event
    00:03:57.040 [DEBUG] [wlr] [types/wlr_layer_shell_v1.c:466] new layer_surface 0x57aaced04b80 (res 0x57aacecbc9e0)
    00:03:57.040 [DEBUG] [sway/desktop/layer_shell.c:646] new layer surface: namespace panel layer 3 anchor 13 size 0x30 margin 0,0,0,0,
    00:03:57.223 [DEBUG] [sway/commands/bind.c:619] running command for binding: workspace next

    I'm only able to regain control by switching workplace and executing: $ killall remote-viewer

  • Configuration File:
    Default

  • Description:

    • virt-viewer (11.0-2)'s remote-viewer wont release the mouse lock with SPICE protocol despite using Shift + F12 (which only releases the keyboard).
    • Only reproducible during ISO installation of Arch Linux (meaning not in VT0/TTY)
  • Minimal reproducible example:

    # ARCH LINUX
    
    # SERVER
    $ sudo pacman --sync --needed qemu-base qemu-chardev-spice qemu-hw-usb-redirect qemu-hw-display-virtio-vga qemu-hw-display-virtio-gpu
    $ sudo wget https://geo.mirror.pkgbuild.com/iso/latest/archlinux-x86_64.iso
    $ sudo qemu-system-x86_64 \
      -name archlinux \
      -machine q35 \
      -enable-kvm \
      -cpu max \
      -smp 4 \
      -m 16G \
      -drive format=raw,media=cdrom,readonly=on,file=archlinux-x86_64.iso \
      -spice port=3001,disable-ticketing=on
    
    # CLIENT
    $ sudo pacman --sync --needed virt-viewer
    $ remote-viewer spice://localhost:3001

    remote-viewer-2
    Captured with bindsym --no-repeat --inhibited PRINT exec flameshot gui

    "(Press Shift+F12 to release pointer)" doesn't work here unlike virt-manager

@GrabbenD GrabbenD added the bug Not working as intended label May 8, 2024
@GrabbenD
Copy link
Author

Workaround 1

Use --inhibited to disable pass-through of predefined bindsym in conjunction with mouse_warping to automatically move cursor to focused window:

# Move cursor to focused window
mouse_warping container

# Move focus
bindsym --no-repeat --inhibited $KEY_MOD+LEFT focus left
bindsym --no-repeat --inhibited $KEY_MOD+DOWN focus down
bindsym --no-repeat --inhibited $KEY_MOD+UP focus up
bindsym --no-repeat --inhibited $KEY_MOD+RIGHT focus right

@emersion
Copy link
Member

Seems like a client issue. The client constrains the pointer (00:03:49.944 [DEBUG] [wlr] [types/wlr_pointer_constraints_v1.c:352] constrained 0x57aacecfe380) but doesn't unconstrain it when Shift+F12 is pressed.

@emersion
Copy link
Member

Note, we have a seat <name> pointer_constraint enable|disable|escape command.

@GrabbenD
Copy link
Author

You're a lifesaver @emersion 😄
Thanks for the proper workaround!

  • Strangely escape doesn't re-engage mouse lock when I click on the remote-viewer window again unless I first click on a different window and then on remote-viewer (which is also reproducible when using 2 keybindings instead of escape, one for enable & another for disable)

  • I've reported this issue upstream: https://gitlab.com/virt-viewer/virt-viewer/-/issues/140

Workaround 2

bindsym --no-repeat --inhibited $KEY_MOD+X seat * pointer_constraint escape

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended
Development

No branches or pull requests

2 participants