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

Drop repeat key events #98

Closed
wants to merge 21 commits into from
Closed

Drop repeat key events #98

wants to merge 21 commits into from

Conversation

iacore
Copy link

@iacore iacore commented Mar 5, 2022

This is actually usable now.
Close QubesOS/qubes-issues#7231

* is used by window managers during task switching (either classic task
* switcher, or KDE "present windows" feature).
*/
if (ev->mode != NotifyNormal && ev->mode != NotifyWhileGrabbed)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out this is the reason for extraneous keystrokes when cycling windows.
The window manager use NotifyGrab to signal temponany focus out.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept having problems with this when writing the Wayland compositor. I had no idea what the cause was, though. I wound up having to try different approaches until I found one that worked. Hopefully this PR will fix the actual problem.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still don't know how to send correct focus events to windows. I tried:

  • XSendEvent
  • XGrabKeyboard
    I don't know about Wayland though, I only tested with X server in VM.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know about Wayland though, I only tested with X server in VM.

Don’t worry about that. Something that works properly under X is hopefully going to be easier to handle with Wayland as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iacore
Copy link
Author

iacore commented Mar 5, 2022

Actually, there is no telling that this "keypress" would come from a keyboard or not.

XIDeviceEvent * xi_device = (XIDeviceEvent *)xi_event;
XILeaveEvent * xi_leave = (XILeaveEvent *)xi_event;
switch (xi_event->evtype) {
// ideally raw input events are better, but I'm relying on X server's built-in event filtering and routing feature here
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this to avoid information leaks if the GUI daemon thinks it has focus when it does not?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raw input events are sent to the root window, not individual windows. If I want to use raw events, I need to track window focus myself. Also, raw key events don't have modifiers key state (Ctrl, Alt), so I'll have to track that too.

gui-daemon/xside.c Outdated Show resolved Hide resolved
gui-daemon/xside.c Outdated Show resolved Hide resolved
gui-daemon/xside.c Outdated Show resolved Hide resolved
* is used by window managers during task switching (either classic task
* switcher, or KDE "present windows" feature).
*/
if (ev->mode != NotifyNormal && ev->mode != NotifyWhileGrabbed)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept having problems with this when writing the Wayland compositor. I had no idea what the cause was, though. I wound up having to try different approaches until I found one that worked. Hopefully this PR will fix the actual problem.

gui-daemon/xside.c Outdated Show resolved Hide resolved
@DemiMarie
Copy link
Contributor

Code-signing check is failing because GitHub’s key isn’t considered verified.

@qubesos-bot
Copy link

qubesos-bot commented Mar 27, 2022

OpenQA test summary

Complete test suite and dependencies: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.1&build=2022060604-4.1&flavor=pull-requests

New failures, excluding unstable

Compared to: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.1&build=2022031706-4.1&flavor=update

  • system_tests_devices

    • TC_10_Attach_fedora-35: test_000_attach_reattach (error)
      subprocess.CalledProcessError: Command 'ls /dev/xvdi' returned non-...

    • TC_10_Attach_whonix-gw-16: test_000_attach_reattach (error)
      subprocess.CalledProcessError: Command 'ls /dev/xvdi' returned non-...

    • TC_10_Attach_whonix-ws-16: test_000_attach_reattach (error)
      subprocess.CalledProcessError: Command 'ls /dev/xvdi' returned non-...

  • system_tests_manager

  • system_tests_suspend

    • suspend: fail (unknown)
      Whonixcheck for sys-whonix failed...

Failed tests

9 failures
  • system_tests_suspend@hw1

    • [unstable] suspend: wait_serial (wait serial expected)
      # wait_serial expected: qr/p5~T5-\d+-/...

    • [unstable] suspend: Failed (test died + timed out)
      # Test died: command 'true' timed out at qubesos/tests/suspend.pm l...

  • system_tests_devices

    • TC_10_Attach_fedora-35: test_000_attach_reattach (error)
      subprocess.CalledProcessError: Command 'ls /dev/xvdi' returned non-...

    • TC_10_Attach_whonix-gw-16: test_000_attach_reattach (error)
      subprocess.CalledProcessError: Command 'ls /dev/xvdi' returned non-...

    • TC_10_Attach_whonix-ws-16: test_000_attach_reattach (error)
      subprocess.CalledProcessError: Command 'ls /dev/xvdi' returned non-...

  • system_tests_manager

  • system_tests_suspend

    • suspend: fail (unknown)
      Whonixcheck for sys-whonix failed...

    • [unstable] suspend: unnamed test (unknown)

  • system_tests_dispvm

    • [unstable] TC_20_DispVM_whonix-ws-16: test_100_open_in_dispvm (failure)
      AssertionError: libvirt event impl drain timeout

Fixed failures

Compared to: https://openqa.qubes-os.org/tests/36922#dependencies

5 fixed
  • system_tests_pvgrub_salt_storage

    • TC_40_PVGrub_debian-11: test_000_standalone_vm (error + timed out)
      qubes.exc.QubesVMShutdownTimeoutError: Domain shutdown timed out: '...

    • TC_40_PVGrub_debian-11: test_010_template_based_vm (error + timed out)
      qubes.exc.QubesVMShutdownTimeoutError: Domain shutdown timed out: '...

  • system_tests_network_updates

  • system_tests_basic_vm_qrexec_gui@hw1

  • system_tests_basic_vm_qrexec_gui_ext4

    • TC_03_QvmRevertTemplateChanges: test_000_revert_linux (error)
      NotImplementedError: FileVolume supports maximum 1 volume revision ...

Unstable tests

  • system_tests_network

    VmNetworking_fedora-35/test_020_simple_proxyvm_nm (2/5 times with errors)
    • job 38794 AssertionError: 2 != 0 : Ping by name failed (after NM reconnection)
    • job 39157 AssertionError: 2 != 0 : Ping by name failed (after NM reconnection)
  • system_tests_pvgrub_salt_storage

    TC_41_HVMGrub_debian-11/test_000_standalone_vm (1/5 times with errors)
    • job 40093 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_41_HVMGrub_fedora-35/test_000_standalone_vm (1/5 times with errors)
    • job 40093 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_42_PVHGrub_debian-11/test_000_standalone_vm (2/5 times with errors)
    • job 39160 AssertionError: Failed command: apt-get update && apt-get install -...
    • job 40093 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_41_HVMGrub_debian-11/test_010_template_based_vm (1/5 times with errors)
    • job 40093 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_41_HVMGrub_fedora-35/test_010_template_based_vm (1/5 times with errors)
    • job 40093 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    TC_42_PVHGrub_debian-11/test_010_template_based_vm (2/5 times with errors)
    • job 38783 AssertionError: Failed command: apt-get update && apt-get install -...
    • job 40093 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
  • system_tests_qrexec

    TC_00_Qrexec_debian-11/test_070_qrexec_vm_simultaneous_write (1/5 times with errors)
    • job 40405 AssertionError: Timeout, probably deadlock
    TC_00_Qrexec_fedora-35/test_070_qrexec_vm_simultaneous_write (1/5 times with errors)
    • job 40405 AssertionError: Timeout, probably deadlock
  • system_tests_network_ipv6

    VmIPv6Networking_fedora-35/test_020_simple_proxyvm_nm (2/5 times with errors)
    • job 38781 AssertionError: 2 != 0 : Ping by name failed (after NM reconnection)
    • job 39158 AssertionError: 2 != 0 : Ping by name failed (after NM reconnection)
    VmIPv6Networking_fedora-35/test_040_inter_vm (1/5 times with errors)
    • job 38781 qubes.exc.QubesVMError: Cannot connect to qrexec agent for 90 secon...
    VmIPv6Networking_debian-11/test_520_ipv6_simple_proxyvm_nm (1/5 times with errors)
    • job 40428 AssertionError: 1 != 0 : nm-applet window not found
    VmIPv6Networking_fedora-35/test_520_ipv6_simple_proxyvm_nm (2/5 times with errors)
    • job 38781 AssertionError: 2 != 0 : Ping by name failed (after NM reconnection)
    • job 39158 AssertionError: 2 != 0 : Ping by name failed (after NM reconnection)
    VmIPv6Networking_debian-11/test_540_ipv6_inter_vm (1/5 times with errors)
    • job 38781 subprocess.CalledProcessError: Command 'qubes.WaitForSession' retur...
  • system_tests_network_updates

    TC_10_QvmTemplate_whonix-gw-16/test_000_template_list (1/5 times with errors)
    • job 38782 qvm-template: error: No matching templates to list
    TC_10_QvmTemplate_debian-11/test_010_template_install (2/5 times with errors)
    • job 39159 AssertionError: libvirt event impl drain timeout
    • job 40110 AssertionError: libvirt event impl drain timeout
    TC_10_QvmTemplate_fedora-34/test_010_template_install (1/5 times with errors)
    • job 38573 AssertionError: libvirt event impl drain timeout
    TC_10_QvmTemplate_whonix-gw-16/test_010_template_install (2/5 times with errors)
    • job 38573 AssertionError: qvm-template failed: Downloading 'qubes-template-de...
    • job 40110 AssertionError: qvm-template failed: Downloading 'qubes-template-de...
    TC_11_QvmTemplateMgmtVM_debian-11/test_010_template_install (3/5 times with errors)
    • job 38573 qubesadmin.exc.QubesDaemonAccessError: Service call error: Request ...
    • job 38782 qubesadmin.exc.QubesDaemonAccessError: Service call error: Request ...
    • job 39159 qubesadmin.exc.QubesDaemonAccessError: Service call error: Request ...
    TC_11_QvmTemplateMgmtVM_fedora-34/test_010_template_install (1/5 times with errors)
    • job 38573 qubesadmin.exc.QubesDaemonAccessError: Service call error: Request ...
    TC_11_QvmTemplateMgmtVM_fedora-35/test_010_template_install (2/5 times with errors)
    • job 38782 qubesadmin.exc.QubesDaemonAccessError: Service call error: Request ...
    • job 39159 qubesadmin.exc.QubesDaemonAccessError: Service call error: Request ...
    TC_11_QvmTemplateMgmtVM_whonix-gw-16/test_010_template_install (4/5 times with errors)
    • job 38573 qubesadmin.exc.QubesDaemonAccessError: Service call error: Request ...
    • job 38782 AssertionError: qvm-template failed: Downloading 'qubes-template-de...
    • job 39159 qubesadmin.exc.QubesDaemonAccessError: Service call error: Request ...
    • job 40110 AssertionError: qvm-template failed: Downloading 'qubes-template-de...
  • system_tests_basic_vm_qrexec_gui_xfs

    TC_30_Gui_daemon/test_000_clipboard (1/5 times with errors)
    • job 39146 self.assertEqual(clipboard_content, ... AssertionError: '' != 'test24'
    TC_00_AppVM_whonix-gw-16-pool/test_000_start_shutdown (2/5 times with errors)
    • job 39146 qubes.exc.QubesVMShutdownTimeoutError: Domain shutdown timed out: '...
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-ws-16-pool/test_000_start_shutdown (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-gw-16-pool/test_010_run_xterm (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-ws-16-pool/test_010_run_xterm (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-gw-16-pool/test_011_run_gnome_terminal (1/5 times with errors)
    TC_00_AppVM_whonix-ws-16-pool/test_011_run_gnome_terminal (1/5 times with errors)
    TC_00_AppVM_fedora-35-pool/test_012_qubes_desktop_run (1/5 times with errors)
    • job 40404 AssertionError: Timeout while waiting for user@test-inst-vm1 window...
    TC_00_AppVM_whonix-gw-16-pool/test_012_qubes_desktop_run (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-ws-16-pool/test_012_qubes_desktop_run (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_fedora-35-pool/test_100_qrexec_filecopy (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-gw-16-pool/test_100_qrexec_filecopy (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-ws-16-pool/test_100_qrexec_filecopy (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_fedora-35-pool/test_101_qrexec_filecopy_with_autostart (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-gw-16-pool/test_101_qrexec_filecopy_with_autostart (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-ws-16-pool/test_101_qrexec_filecopy_with_autostart (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_fedora-35-pool/test_105_qrexec_filemove (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-gw-16-pool/test_105_qrexec_filemove (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-ws-16-pool/test_105_qrexec_filemove (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_fedora-35-pool/test_110_qrexec_filecopy_deny (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-gw-16-pool/test_110_qrexec_filecopy_deny (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-ws-16-pool/test_110_qrexec_filecopy_deny (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_fedora-35-pool/test_115_qrexec_filecopy_no_agent (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-gw-16-pool/test_115_qrexec_filecopy_no_agent (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-ws-16-pool/test_115_qrexec_filecopy_no_agent (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_fedora-35-pool/test_130_qrexec_filemove_disk_full (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-gw-16-pool/test_130_qrexec_filemove_disk_full (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-ws-16-pool/test_130_qrexec_filemove_disk_full (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_fedora-35-pool/test_200_timezone (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-gw-16-pool/test_200_timezone (1/5 times with errors)
    TC_00_AppVM_whonix-ws-16-pool/test_200_timezone (1/5 times with errors)
    TC_00_AppVM_fedora-35-pool/test_210_time_sync (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-gw-16-pool/test_210_time_sync (1/5 times with errors)
    TC_00_AppVM_whonix-ws-16-pool/test_210_time_sync (1/5 times with errors)
    TC_00_AppVM_fedora-35-pool/test_220_audio_play (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-gw-16-pool/test_220_audio_play (1/5 times with errors)
    TC_00_AppVM_whonix-ws-16-pool/test_220_audio_play (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_fedora-35-pool/test_221_audio_rec_muted (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-gw-16-pool/test_221_audio_rec_muted (1/5 times with errors)
    TC_00_AppVM_whonix-ws-16-pool/test_221_audio_rec_muted (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_fedora-35-pool/test_222_audio_rec_unmuted (1/5 times with errors)
    • job 40404 AssertionError: only silence detected, no useful audio data
    TC_00_AppVM_whonix-gw-16-pool/test_222_audio_rec_unmuted (1/5 times with errors)
    TC_00_AppVM_whonix-ws-16-pool/test_222_audio_rec_unmuted (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_fedora-35-pool/test_223_audio_play_hvm (3/5 times with errors)
    • job 38769 AssertionError: Command 'paplay --format=float32le --rate=44100 ...
    • job 39146 AssertionError: Command 'paplay --format=float32le --rate=44100 ...
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-gw-16-pool/test_223_audio_play_hvm (1/5 times with errors)
    TC_00_AppVM_whonix-ws-16-pool/test_223_audio_play_hvm (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_fedora-35-pool/test_224_audio_rec_muted_hvm (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-gw-16-pool/test_224_audio_rec_muted_hvm (1/5 times with errors)
    TC_00_AppVM_whonix-ws-16-pool/test_224_audio_rec_muted_hvm (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_fedora-35-pool/test_225_audio_rec_unmuted_hvm (3/5 times with errors)
    • job 38769 AssertionError: only silence detected, no useful audio data
    • job 39146 AssertionError: only silence detected, no useful audio data
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-gw-16-pool/test_225_audio_rec_unmuted_hvm (1/5 times with errors)
    TC_00_AppVM_whonix-ws-16-pool/test_225_audio_rec_unmuted_hvm (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_fedora-35-pool/test_250_resize_private_img (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-gw-16-pool/test_250_resize_private_img (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-ws-16-pool/test_250_resize_private_img (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_fedora-35-pool/test_300_bug_1028_gui_memory_pinning (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-gw-16-pool/test_300_bug_1028_gui_memory_pinning (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_00_AppVM_whonix-ws-16-pool/test_300_bug_1028_gui_memory_pinning (1/5 times with errors)
    • job 40404 assert len(self.loop._selector.get_map()) \... AssertionError
  • system_tests_basic_vm_qrexec_gui@hw1

    TC_30_Gui_daemon/test_000_clipboard (1/5 times with errors)
    • job 38774 self.assertEqual(clipboard_content, ... AssertionError: '' != 'test20'
    TC_00_AppVM_fedora-35/test_222_audio_rec_unmuted (1/5 times with errors)
    • job 40102 AssertionError: only silence detected, no useful audio data
    TC_00_AppVM_fedora-35/test_223_audio_play_hvm (2/5 times with errors)
    • job 38774 AssertionError: Command 'paplay --format=float32le --rate=44100 ...
    • job 39151 AssertionError: Command 'paplay --format=float32le --rate=44100 ...
    TC_00_AppVM_fedora-35/test_225_audio_rec_unmuted_hvm (2/5 times with errors)
    • job 38774 AssertionError: only silence detected, no useful audio data
    • job 39151 AssertionError: only silence detected, no useful audio data
  • system_tests_suspend@hw1

    suspend/ (1/5 times with errors)
    suspend/Failed (1/5 times with errors)
    • job 40109 # Test died: no candidate needle with tag(s) 'xscreensaver-prompt' ...
    suspend/Failed (1/5 times with errors)
    • job 38785 # Test died: command 'true' timed out at qubesos/tests/suspend.pm l...
    suspend/Failed (1/5 times with errors)
    • job 39162 # Test died: command 'qvm-run -p sys-firewall "curl https://www.qub...
    suspend/wait_serial (1/5 times with errors)
    • job 38785 # wait_serial expected: qr/p5~T5-\d+-/u...
    suspend/wait_serial (1/5 times with errors)
    • job 40109 # wait_serial expected: "xl info; echo 8Ye1l-\$?-"...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "xl info; echo 8Ye1l-\$?-"...
    • job 40109 # wait_serial expected: qr/8Ye1l-\d+-/...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: qr/8Ye1l-\d+-/u...
    • job 40109 # wait_serial expected: "# "...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "# "...
    • job 40109 # wait_serial expected: "xl list; echo MfjdI-\$?-"...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "xl list; echo MfjdI-\$?-"...
    • job 40109 # wait_serial expected: qr/MfjdI-\d+-/...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: qr/MfjdI-\d+-/u...
    • job 40109 # wait_serial expected: "# "...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "# "...
    • job 40109 # wait_serial expected: "xl dmesg; echo hNz_G-\$?-"...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "xl dmesg; echo hNz_G-\$?-"...
    • job 40109 # wait_serial expected: qr/hNz_G-\d+-/...
    suspend/wait_serial (3/5 times with errors)
    • job 38785 # wait_serial expected: qr/hNz_G-\d+-/u...
    • job 39162 # wait_serial expected: qr/0DNLB-\d+-/u...
    • job 40109 # wait_serial expected: "# "...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "# "...
    • job 40109 # wait_serial expected: "journalctl -b|tail -n 10000; echo Adw2Q-\$...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "journalctl -b|tail -n 10000; echo Adw2Q-\$...
    • job 40109 # wait_serial expected: qr/Adw2Q-\d+-/...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: qr/Adw2Q-\d+-/u...
    • job 40109 # wait_serial expected: "# "...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "# "...
    • job 40109 # wait_serial expected: "cat /var/log/salt/minion; echo 5Ktxw-\$?-"...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "cat /var/log/salt/minion; echo 5Ktxw-\$?-"...
    • job 40109 # wait_serial expected: qr/5Ktxw-\d+-/...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: qr/5Ktxw-\d+-/u...
    • job 40109 # wait_serial expected: "# "...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "# "...
    • job 40109 # wait_serial expected: "cat /var/log/libvirt/libxl/libxl-driver.lo...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "cat /var/log/libvirt/libxl/libxl-driver.lo...
    • job 40109 # wait_serial expected: qr/SBh43-\d+-/...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: qr/SBh43-\d+-/u...
    • job 40109 # wait_serial expected: "# "...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "# "...
    • job 40109 # wait_serial expected: "tail /var/log/xen/console/guest*-dm.log; e...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "tail /var/log/xen/console/guest*-dm.log; e...
    • job 40109 # wait_serial expected: qr/MZxne-\d+-/...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: qr/MZxne-\d+-/u...
    • job 40109 # wait_serial expected: "# "...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "# "...
    • job 40109 # wait_serial expected: "grep -B 60 'Kernel panic' /var/log/xen/con...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "grep -B 60 'Kernel panic' /var/log/xen/con...
    • job 40109 # wait_serial expected: qr/kuoMm-\d+-/...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: qr/kuoMm-\d+-/u...
    • job 40109 # wait_serial expected: "# "...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "# "...
    • job 40109 # wait_serial expected: "ip r |grep ^default; echo 4tG2W-\$?-"...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "ip r |grep ^default; echo 4tG2W-\$?-"...
    • job 40109 # wait_serial expected: qr/4tG2W-\d+-/...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: qr/4tG2W-\d+-/u...
    • job 40109 # wait_serial expected: "# "...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "# "...
    • job 40109 # wait_serial expected: "curl --form upload=\@/var/log/libvirt/libx...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "curl --form upload=\@/var/log/libvirt/libx...
    • job 40109 # wait_serial expected: qr/7rqz_-\d+-/...
    suspend/wait_serial (1/5 times with errors)
    • job 38785 # wait_serial expected: qr/xboww-\d+-/u...
  • system_tests_basic_vm_qrexec_gui

    TC_30_Gui_daemon/test_000_clipboard (1/5 times with errors)
    • job 38774 self.assertEqual(clipboard_content, ... AssertionError: '' != 'test20'
    TC_00_AppVM_fedora-35/test_222_audio_rec_unmuted (1/5 times with errors)
    • job 40102 AssertionError: only silence detected, no useful audio data
    TC_00_AppVM_fedora-35/test_223_audio_play_hvm (2/5 times with errors)
    • job 38774 AssertionError: Command 'paplay --format=float32le --rate=44100 ...
    • job 39151 AssertionError: Command 'paplay --format=float32le --rate=44100 ...
    TC_00_AppVM_fedora-35/test_225_audio_rec_unmuted_hvm (2/5 times with errors)
    • job 38774 AssertionError: only silence detected, no useful audio data
    • job 39151 AssertionError: only silence detected, no useful audio data
  • system_tests_usbproxy

    TC_20_USBProxy_core3_fedora-35/test_061_auto_attach_on_reconnect (1/5 times with errors)
    • job 40097 AssertionError: 1 != 0 : Device reconnection failed
  • system_tests_backupdispvm

    TC_10_RestoreInDispVM_whonix-ws-16/test_000_basic_backup (1/5 times with errors)
    • job 38564 FileNotFoundError: [Errno 2] No such file or directory: '/var/tmp/r...
  • system_tests_suspend

    suspend/ (1/5 times with errors)
    suspend/Failed (1/5 times with errors)
    • job 40109 # Test died: no candidate needle with tag(s) 'xscreensaver-prompt' ...
    suspend/Failed (1/5 times with errors)
    • job 38785 # Test died: command 'true' timed out at qubesos/tests/suspend.pm l...
    suspend/Failed (1/5 times with errors)
    • job 39162 # Test died: command 'qvm-run -p sys-firewall "curl https://www.qub...
    suspend/wait_serial (1/5 times with errors)
    • job 38785 # wait_serial expected: qr/p5~T5-\d+-/u...
    suspend/wait_serial (1/5 times with errors)
    • job 40109 # wait_serial expected: "xl info; echo 8Ye1l-\$?-"...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "xl info; echo 8Ye1l-\$?-"...
    • job 40109 # wait_serial expected: qr/8Ye1l-\d+-/...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: qr/8Ye1l-\d+-/u...
    • job 40109 # wait_serial expected: "# "...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "# "...
    • job 40109 # wait_serial expected: "xl list; echo MfjdI-\$?-"...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "xl list; echo MfjdI-\$?-"...
    • job 40109 # wait_serial expected: qr/MfjdI-\d+-/...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: qr/MfjdI-\d+-/u...
    • job 40109 # wait_serial expected: "# "...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "# "...
    • job 40109 # wait_serial expected: "xl dmesg; echo hNz_G-\$?-"...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "xl dmesg; echo hNz_G-\$?-"...
    • job 40109 # wait_serial expected: qr/hNz_G-\d+-/...
    suspend/wait_serial (3/5 times with errors)
    • job 38785 # wait_serial expected: qr/hNz_G-\d+-/u...
    • job 39162 # wait_serial expected: qr/0DNLB-\d+-/u...
    • job 40109 # wait_serial expected: "# "...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "# "...
    • job 40109 # wait_serial expected: "journalctl -b|tail -n 10000; echo Adw2Q-\$...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "journalctl -b|tail -n 10000; echo Adw2Q-\$...
    • job 40109 # wait_serial expected: qr/Adw2Q-\d+-/...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: qr/Adw2Q-\d+-/u...
    • job 40109 # wait_serial expected: "# "...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "# "...
    • job 40109 # wait_serial expected: "cat /var/log/salt/minion; echo 5Ktxw-\$?-"...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "cat /var/log/salt/minion; echo 5Ktxw-\$?-"...
    • job 40109 # wait_serial expected: qr/5Ktxw-\d+-/...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: qr/5Ktxw-\d+-/u...
    • job 40109 # wait_serial expected: "# "...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "# "...
    • job 40109 # wait_serial expected: "cat /var/log/libvirt/libxl/libxl-driver.lo...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "cat /var/log/libvirt/libxl/libxl-driver.lo...
    • job 40109 # wait_serial expected: qr/SBh43-\d+-/...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: qr/SBh43-\d+-/u...
    • job 40109 # wait_serial expected: "# "...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "# "...
    • job 40109 # wait_serial expected: "tail /var/log/xen/console/guest*-dm.log; e...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "tail /var/log/xen/console/guest*-dm.log; e...
    • job 40109 # wait_serial expected: qr/MZxne-\d+-/...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: qr/MZxne-\d+-/u...
    • job 40109 # wait_serial expected: "# "...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "# "...
    • job 40109 # wait_serial expected: "grep -B 60 'Kernel panic' /var/log/xen/con...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "grep -B 60 'Kernel panic' /var/log/xen/con...
    • job 40109 # wait_serial expected: qr/kuoMm-\d+-/...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: qr/kuoMm-\d+-/u...
    • job 40109 # wait_serial expected: "# "...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "# "...
    • job 40109 # wait_serial expected: "ip r |grep ^default; echo 4tG2W-\$?-"...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "ip r |grep ^default; echo 4tG2W-\$?-"...
    • job 40109 # wait_serial expected: qr/4tG2W-\d+-/...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: qr/4tG2W-\d+-/u...
    • job 40109 # wait_serial expected: "# "...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "# "...
    • job 40109 # wait_serial expected: "curl --form upload=\@/var/log/libvirt/libx...
    suspend/wait_serial (2/5 times with errors)
    • job 38785 # wait_serial expected: "curl --form upload=\@/var/log/libvirt/libx...
    • job 40109 # wait_serial expected: qr/7rqz_-\d+-/...
    suspend/wait_serial (1/5 times with errors)
    • job 38785 # wait_serial expected: qr/xboww-\d+-/u...
  • system_tests_basic_vm_qrexec_gui_ext4

    TC_30_Gui_daemon/test_000_clipboard (1/5 times with errors)
    • job 39172 self.assertEqual(clipboard_content, ... AssertionError: '' != 'test22'
    TC_03_QvmRevertTemplateChanges/test_000_revert_linux (3/5 times with errors)
    • job 38559 NotImplementedError: FileVolume supports maximum 1 volume revision ...
    • job 38768 NotImplementedError: FileVolume supports maximum 1 volume revision ...
    • job 39172 NotImplementedError: FileVolume supports maximum 1 volume revision ...
    TC_00_AppVM_fedora-35-pool/test_223_audio_play_hvm (2/5 times with errors)
    • job 38768 AssertionError: Command 'paplay --format=float32le --rate=44100 ...
    • job 39172 AssertionError: Command 'paplay --format=float32le --rate=44100 ...
    TC_00_AppVM_fedora-35-pool/test_225_audio_rec_unmuted_hvm (2/5 times with errors)
    • job 38768 AssertionError: only silence detected, no useful audio data
    • job 39172 AssertionError: only silence detected, no useful audio data
  • system_tests_basic_vm_qrexec_gui_btrfs

    TC_30_Gui_daemon/test_000_clipboard (2/5 times with errors)
    • job 40077 self.assertEqual(clipboard_content, ... AssertionError: '' != 'test23'
    • job 40402 self.assertEqual(clipboard_content, ... AssertionError: '' != 'test24'
    TC_00_AppVM_fedora-35-pool/test_223_audio_play_hvm (2/5 times with errors)
    • job 38767 AssertionError: Command 'paplay --format=float32le --rate=44100 ...
    • job 39144 AssertionError: Command 'paplay --format=float32le --rate=44100 ...
    TC_00_AppVM_fedora-35-pool/test_225_audio_rec_unmuted_hvm (2/5 times with errors)
    • job 38767 AssertionError: only silence detected, no useful audio data
    • job 39144 AssertionError: only silence detected, no useful audio data
  • system_tests_dispvm

    TC_04_DispVM/test_003_cleanup_destroyed (1/5 times with errors)
    • job 39141 raise exceptions.TimeoutError()... asyncio.exceptions.TimeoutError
    TC_20_DispVM_fedora-35/test_010_simple_dvm_run (1/5 times with errors)
    • job 39141 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_20_DispVM_whonix-gw-16/test_010_simple_dvm_run (1/5 times with errors)
    TC_20_DispVM_whonix-ws-16/test_010_simple_dvm_run (1/5 times with errors)
    • job 39141 assert len(self.loop._selector.get_map()) \... AssertionError
    TC_20_DispVM_whonix-gw-16/test_020_gui_app (1/5 times with errors)
    TC_20_DispVM_debian-11/test_030_edit_file (1/5 times with errors)
    • job 39141 AssertionError: Timeout while waiting for disp[0-9]* window to show
    TC_20_DispVM_fedora-35/test_030_edit_file (1/5 times with errors)
    • job 39141 AssertionError: Timeout while waiting for disp[0-9]* window to show
    TC_20_DispVM_whonix-gw-16/test_030_edit_file (1/5 times with errors)
    TC_20_DispVM_whonix-ws-16/test_030_edit_file (1/5 times with errors)
    • job 39141 AssertionError: Timeout while waiting for disp[0-9]* window to show
    TC_20_DispVM_debian-11/test_100_open_in_dispvm (3/5 times with errors)
    • job 38555 AssertionError: './open-file test.txt' failed with ./open-file test...
    • job 38764 AssertionError: './open-file test.txt' failed with ./open-file test...
    • job 39141 AssertionError: './open-file test.txt' failed with ./open-file test...
    TC_20_DispVM_fedora-35/test_100_open_in_dispvm (1/5 times with errors)
    • job 39141 AssertionError: './open-file test.txt' failed with ./open-file test...
    TC_20_DispVM_whonix-gw-16/test_100_open_in_dispvm (1/5 times with errors)
    TC_20_DispVM_whonix-ws-16/test_100_open_in_dispvm (5/5 times with errors)
    • job 38555 AssertionError: libvirt event impl drain timeout
    • job 38764 AssertionError: libvirt event impl drain timeout
    • job 39141 AssertionError: './open-file test.txt' failed with ./open-file test...
    • job 40096 AssertionError: libvirt event impl drain timeout
    • job 40399 AssertionError: libvirt event impl drain timeout

Copy link
Contributor

@DemiMarie DemiMarie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch! This should fix some really ugly bugs when it comes to window switching. Avoiding them required a disgusting hack in the Wayland GUI agent that I still do not really understand.

Some suggestions below:

gui-daemon/xside.c Outdated Show resolved Hide resolved
gui-daemon/xside.c Outdated Show resolved Hide resolved
gui-daemon/xside.c Outdated Show resolved Hide resolved
gui-daemon/xside.c Show resolved Hide resolved
gui-daemon/xside.c Show resolved Hide resolved
gui-daemon/xside.c Outdated Show resolved Hide resolved
@DemiMarie
Copy link
Contributor

Also, don’t forget to add “FIxes: QubesOS/qubes-issues#7396” to whichever commit fixed that bug.

@iacore
Copy link
Author

iacore commented Apr 1, 2022

I've used it for a month, and it's pretty stable. Sometimes, shortcuts like Super+S to open windows in dom0 will get S key stuck (likely focus issue).

@marmarek
Copy link
Member

marmarek commented Apr 2, 2022

It doesn't build, see CI logs:

DEBUG: make[1]: Entering directory '/builddir/build/BUILD/qubes-gui-daemon-4.1.21/gui-daemon'
DEBUG: gcc -MD -MP -MF xside.o.dep -c -o xside.o -I../include/ -g -O2 -Wall -Wextra -Werror -pie -fPIC -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/vchan-xen -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -pthread  -fvisibility=hidden -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection xside.c
DEBUG: xside.c: In function 'process_xevent':
DEBUG: xside.c:2359:41: error: 'xi_device' undeclared (first use in this function)
DEBUG:  2359 |             process_xievent_keypress(g, xi_device);
DEBUG:       |                                         ^~~~~~~~~
DEBUG: xside.c:2359:41: note: each undeclared identifier is reported only once for each function it appears in
DEBUG: make[1]: Leaving directory '/builddir/build/BUILD/qubes-gui-daemon-4.1.21/gui-daemon'

@marmarek
Copy link
Member

marmarek commented Apr 2, 2022

Please also squash git history into functional commits (no WIP commits).

Copy link
Contributor

@DemiMarie DemiMarie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should fix the build.

gui-daemon/xside.c Outdated Show resolved Hide resolved
@DemiMarie
Copy link
Contributor

Is it possible to use libxcb instead of libXi?

@iacore
Copy link
Author

iacore commented Apr 8, 2022

Is it possible to use libxcb instead of libXi?

Yes, but need to change source code a lot. Also I'm not sure what will happen if xcb is used together with Xlib.

@iacore
Copy link
Author

iacore commented Apr 8, 2022

Please also squash git history into functional commits (no WIP commits).

How do I do that? I feel like the commit history is descriptive enough.

@marmarek
Copy link
Member

marmarek commented Apr 8, 2022

Is it possible to use libxcb instead of libXi?

Using libxcb and libX11-like together, both for handling events is a bad idea. You will run into events reordering (and probably a lot of other issues). Not worth it in this PR.

@marmarek
Copy link
Member

marmarek commented Apr 8, 2022

How do I do that? I feel like the commit history is descriptive enough.

I don't like introducing not working commit that is known to be not working at merge time already (that is later fixed or even reverted in the same PR). For example 60ee007 is later basically reverted. You included also some non-trivial changes into a merge commit 6bddd0e...
Can you rebase it and keep only commits that are relevant to the final version?

@iacore
Copy link
Author

iacore commented Apr 8, 2022

I'm not good at git to know how to rebase something like (A -> B -> revert A). I also think that git commits should reflect how software is actually developed, not how it should be (source).

The diff of 6bddd0e is simple if you use a language-aware diff tool like https://github.com/Wilfred/difftastic.

Is it possible to squash the whole thing into a single commit?

@marmarek
Copy link
Member

Is it possible to squash the whole thing into a single commit?

Take a look here for example: https://gitbetter.substack.com/p/how-to-squash-git-commits

Anyway, I tried to use it, and the key repeat in VM doesn't work. It isn't surprising, because it's disabled. After enabling it, it works. Just enabling it is not a problem, but I'm worried about extra parameters (delay, rate). Those user normally set in dom0 (or wherever GUI runs) and should apply to all the VMs. Synchronizing them may be messy but probably doable... Anyway, handling it in some way is necessary for merging this change.

@marmarek
Copy link
Member

marmarek commented May 27, 2022

system_tests_gui_interactive

* clipboard_and_web: [unnamed test](https://openqa.qubes-os.org/tests/40791#step/clipboard_and_web/16) (unknown)

* clipboard_and_web: [Failed](https://openqa.qubes-os.org/tests/40791#step/clipboard_and_web/17) (test died)
  `# Test died: no candidate needle with tag(s) 'qubes-website' matche...`

This failure actually may be related to this PR. The test is supposed to type in https://www.qubes-os.org/, but it ends up with https://ww.qubes-os.org/. I'm not sure why exactly one "w" is missing, but this failure can be reproduced rather reliably (I tried restarting the test several times - it happened in 4 out of 5 runs).

@iacore
Copy link
Author

iacore commented Jun 17, 2022

I have no idea how to untangle this git history. I cleaned up the history up to the last merge commit.

Git is broken. I tried to do git rebase -i --rebase-merges xxxxxxx but I can't do reword, fixup or squarch easily. It should be automatic.

XISetMask(xi_mask.mask, XI_KeyRelease);
XISetMask(xi_mask.mask, XI_FocusIn);
XISetMask(xi_mask.mask, XI_FocusOut);
XISelectEvents(g->display, child_win, &xi_mask, 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this fails (returns anything but Success) the code should exit.

{
struct msg_hdr hdr;
char keys[32];
XQueryKeymap(g->display, keys);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this does not succeed, just exit.


// select xinput events
XIEventMask xi_mask;
xi_mask.deviceid = XIAllMasterDevices; // https://stackoverflow.com/questions/44095001/getting-double-rawkeypress-events-using-xinput2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
xi_mask.deviceid = XIAllMasterDevices; // https://stackoverflow.com/questions/44095001/getting-double-rawkeypress-events-using-xinput2
// https://stackoverflow.com/questions/44095001/getting-double-rawkeypress-events-using-xinput2
xi_mask.deviceid = XIAllMasterDevices;

@DemiMarie
Copy link
Contributor

I have no idea how to untangle this git history. I cleaned up the history up to the last merge commit.

Git is broken. I tried to do git rebase -i --rebase-merges xxxxxxx but I can't do reword, fixup or squarch easily. It should be automatic.

What do you normally use? One option is to just create a patch series and use git am to apply it. If the intermediate states would not be useful, just squash everything.

@DemiMarie
Copy link
Contributor

How is this normally handled by X applications? That is, what event sequence do X applications normally get if a key is pressed while they have keyboard focus, and is released after they have lost focus? Qubes should send the same event sequence in the same order. This should fix other bugs as well.

@iacore
Copy link
Author

iacore commented Jun 18, 2022

How is this normally handled by X applications? That is, what event sequence do X applications normally get if a key is pressed while they have keyboard focus, and is released after they have lost focus? Qubes should send the same event sequence in the same order. This should fix other bugs as well.

We discussed about this earlier. The problem is

  1. You can't send all events with X API. Some applications ignore SendEvent (I tried, maybe I did it wrong).
  2. If focus being stolen by another VM, we can't "same event sequence in the same order". The events are spliced in time.

I suspect it's sometimes B:FocusIn A:FocusOut sometimes A:FocusOut B:FocusIn. It's not in X's spec (WM-implementation).

What do you normally use? One option is to just create a patch series and use git am to apply it. If the intermediate states would not be useful, just squash everything.

I never rebase graph. I usually rebase linear history.

@iacore
Copy link
Author

iacore commented Jun 20, 2022

Still one more bug that I can't fix:

When 1 VM switch from vm0:window0 to vm0:window1, I can't regain focus by sending focus events. This bug didn't exist before this PR.

Sending focus on mouse down is not working.

@DemiMarie
Copy link
Contributor

When 1 VM switch from vm0:window0 to vm0:window1, I can't regain focus by sending focus events. This bug didn't exist before this PR.

How does the dom0 window manager give focus to a window? It should be possible for the GUI agent to do the same with its windows.

  1. You can't send all events with X API. Some applications ignore SendEvent (I tried, maybe I did it wrong).

Those events should be able to be sent via the X11 driver, which is part of the GUI agent.

@iacore
Copy link
Author

iacore commented Jun 20, 2022

"Focus window when clicked" was originally handled by vmside.c. I removed it during refactoring. I'll add it back now properly.

Those events should be able to be sent via the X11 driver, which is part of the GUI agent.

Some special focus events are traditionally sent by like XFCE4, and Xlib API cannot send that.

@DemiMarie
Copy link
Contributor

Those events should be able to be sent via the X11 driver, which is part of the GUI agent.

Some special focus events are traditionally sent by like XFCE4, and Xlib API cannot send that.

Presumably there is some API that XFCE4 is using; Qubes can use the same.

@iacore
Copy link
Author

iacore commented Jul 4, 2022

I think XFCE4 use xf86 (library for window manager/ X driver).

This should be solved in vmside.c. See QubesOS/qubes-gui-agent-linux#154 (comment)

@DemiMarie
Copy link
Contributor

@locriacyber Can you drop the focus-related changes from this PR? I based #104 on them.

@iacore
Copy link
Author

iacore commented Jul 6, 2022

I wrote them at the same time, and it would be difficult to separate in git history. Do you want just the focus part as separate branch?

Also, just having xside.c won't work well unless vmside.c sends the right detail and mode in focus events.

@iacore
Copy link
Author

iacore commented Jul 14, 2022

The focus code has a bug: when clicking on IBus's tray icon, I get three simultaneous popups. I don't know if IBus think it's been clicked thrice, or it's something else.
Every other tray icon works fine.

@iacore
Copy link
Author

iacore commented Jul 18, 2022

Is it possible to dynamically negotiate protocol version?

Currently in vmside.c:

#if !(PROTOCOL_VERSION_MAJOR == QUBES_GUID_PROTOCOL_VERSION_MAJOR && \
      PROTOCOL_VERSION_MINOR <= QUBES_GUID_PROTOCOL_VERSION_MINOR)
#  error Incompatible qubes-gui-protocol.h.
#endif

it's hardcoded.

@DemiMarie
Copy link
Contributor

@locriacyber Not yet. It will be starting with protocol 1.4 (#105).

@DemiMarie
Copy link
Contributor

@locriacyber Protocol 1.4 has been merged, so dynamic negotiation is now possible.

@iacore
Copy link
Author

iacore commented Aug 6, 2022

To whom may be reading this
This branch works, but #115 has the same features plus backwards-compatibility. Closing in favor of that.

@iacore iacore closed this Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gui rpc drop keystroke flags like repeat
4 participants