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

widgets: fall back to Xwayland #234

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DemiMarie
Copy link

The widgets do not work under Wayland, so just use Xwayland for now.

If GTK somehow still connects to Wayland despite WAYLAND_DISPLAY being unset I will not be happy.

This is broken under KDE because of a bug in KDE (https://bugs.kde.org/show_bug.cgi?id=468085), but that can be fixed.

Copy link

codecov bot commented Nov 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.16%. Comparing base (1231efc) to head (e011e5f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #234      +/-   ##
==========================================
- Coverage   93.17%   93.16%   -0.01%     
==========================================
  Files          58       58              
  Lines       11048    11048              
==========================================
- Hits        10294    10293       -1     
- Misses        754      755       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marmarek
Copy link
Member

This doesn't seem to work. For some reason it still connects to Wayland anyway. It does it when I set XDG_SESSION_TYPE=x11 too. The only way I could find to force it to use X11 is chmod 0 /run/user/1000/wayland-0 (and then indeed widget seems to work), which ofc is not feasible.
When I say "seems to work", I mean the icon shows up, the menu shows up on click and is functional (looks to be quite reliable), but I can close the menu only with the "esc" key. Clicking on the widget again doesn't close it, and also clicking outsize of the menu doesn't close it either (that latter one is kinda expected, widgets from VMs behave the same way, for similar reason).

@marmarek
Copy link
Member

Defaulting to wayland-0 seems to be caused by https://gitlab.gnome.org/GNOME/gtk/-/commit/55ea6e4dcc4bbe6c7fc40c8e814ad2ee99b3b2e2 (if I got the URL right, right now it says HTTP 503...). Setting WAYLAND_DISPLAY to an empty value seems to work better. But still, the issue with closing the menu remains. Note that closing the menu by clicking on the widget the second time works fine with nm-applet, so it's likely not directly a KDE issue but more like an interaction of some more components. But with real Xorg, widgets work in this regard just fine...

@qubesos-bot
Copy link

qubesos-bot commented Nov 25, 2024

OpenQA test summary

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

Test run included the following:

New failures, excluding unstable

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

  • system_tests_pvgrub_salt_storage

    • TC_41_HVMGrub_debian-12-xfce: test_000_standalone_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_41_HVMGrub_debian-12-xfce: test_001_standalone_vm_dracut (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_41_HVMGrub_debian-12-xfce: test_010_template_based_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_41_HVMGrub_debian-12-xfce: test_011_template_based_vm_dracut (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_41_HVMGrub_fedora-41-xfce: test_000_standalone_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_41_HVMGrub_fedora-41-xfce: test_010_template_based_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

  • system_tests_extra

    • TC_00_QVCTest_whonix-workstation-17: test_010_screenshare (failure)
      AssertionError: 13.069686413555461 not less than 2.0

    • TC_01_InputProxyExclude_debian-12-xfce: test_000_qemu_tablet (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_01_InputProxyExclude_fedora-41-xfce: test_000_qemu_tablet (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

  • system_tests_manager

    • tests: test_vm_settings (error)
      ModuleNotFoundError: No module named 'pytest'

    • tests: test_clone_vm (error)
      ModuleNotFoundError: No module named 'pytest'

    • tests: test_backup (error)
      ModuleNotFoundError: No module named 'pytest'

    • tests: test_qube_manager (error)
      ModuleNotFoundError: No module named 'pytest'

  • system_tests_kde_gui_interactive

    • gui_keyboard_layout: wait_serial (wait serial expected)
      # wait_serial expected: "echo -e '[Layout]\nLayoutList=us,de' | sud...

Failed tests

15 failures
  • system_tests_pvgrub_salt_storage

    • TC_41_HVMGrub_debian-12-xfce: test_000_standalone_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_41_HVMGrub_debian-12-xfce: test_001_standalone_vm_dracut (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_41_HVMGrub_debian-12-xfce: test_010_template_based_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_41_HVMGrub_debian-12-xfce: test_011_template_based_vm_dracut (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_41_HVMGrub_fedora-41-xfce: test_000_standalone_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_41_HVMGrub_fedora-41-xfce: test_010_template_based_vm (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

  • system_tests_extra

    • TC_00_QVCTest_whonix-workstation-17: test_010_screenshare (failure)
      AssertionError: 13.069686413555461 not less than 2.0

    • TC_01_InputProxyExclude_debian-12-xfce: test_000_qemu_tablet (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

    • TC_01_InputProxyExclude_fedora-41-xfce: test_000_qemu_tablet (error)
      qubes.exc.QubesVMError: Cannot connect to qrexec agent for 120 seco...

  • system_tests_manager

    • tests: test_vm_settings (error)
      ModuleNotFoundError: No module named 'pytest'

    • tests: test_clone_vm (error)
      ModuleNotFoundError: No module named 'pytest'

    • tests: test_backup (error)
      ModuleNotFoundError: No module named 'pytest'

    • tests: test_qube_manager (error)
      ModuleNotFoundError: No module named 'pytest'

  • system_tests_kde_gui_interactive

    • gui_keyboard_layout: wait_serial (wait serial expected)
      # wait_serial expected: "echo -e '[Layout]\nLayoutList=us,de' | sud...

    • gui_keyboard_layout: Failed (test died)
      # Test died: command 'test "$(cd ~user;ls e1*)" = "$(qvm-run -p wor...

Fixed failures

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

3 fixed
  • system_tests_extra

    • TC_00_QVCTest_whonix-gateway-17: test_010_screenshare (failure)
      ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^... AssertionError: 0 == 0
  • system_tests_basic_vm_qrexec_gui_zfs

    • switch_pool: Failed (test died)
      # Test died: command 'dnf install -y ./zfs-release.rpm' failed at /...
  • system_tests_audio@hw1

Unstable tests

  • system_tests_update

    update2/Failed (1/5 times with errors)
    • job 121711 # Test died: command '(set -o pipefail; qubesctl --show-output stat...
  • system_tests_update@hw7

    update2/Failed (1/5 times with errors)
    • job 121711 # Test died: command '(set -o pipefail; qubesctl --show-output stat...
  • system_tests_update@hw1

    update2/Failed (1/5 times with errors)
    • job 121711 # Test died: command '(set -o pipefail; qubesctl --show-output stat...

@DemiMarie
Copy link
Author

Is it necessary for clicking outside the menu to close the menu, or is it good enough to require clicking again on the widget? The latter might be fixable in the menu itself, by closing the menu when the widget is clicked.

@marmarta
Copy link
Member

Is it necessary for clicking outside the menu to close the menu, or is it good enough to require clicking again on the widget? The latter might be fixable in the menu itself, by closing the menu when the widget is clicked.

It is necessary, it is a dom0 widget, it should not have the bad behavior of the vm widgets (which also should work better wrt to closing, but that's out of scope here).

@DemiMarie
Copy link
Author

Is it necessary for clicking outside the menu to close the menu, or is it good enough to require clicking again on the widget? The latter might be fixable in the menu itself, by closing the menu when the widget is clicked.

It is necessary, it is a dom0 widget, it should not have the bad behavior of the vm widgets (which also should work better wrt to closing, but that's out of scope here).

Can you try my most recent commit? That dismisses the menu when it loses focus.

@marmarta
Copy link
Member

I don't think this addresses the root cause, which is some wayland failure - this works correctly under X and so, from what you said previously, should work correctly under XWayland. I don't think we want to patch the whole world, if it requires additional workarounds like this (which BTW duplicate what the menu generally does on its own) I don't think this is a good solution.

qui/tray/domains.py Outdated Show resolved Hide resolved
qui/tray/domains.py Outdated Show resolved Hide resolved
@marmarek
Copy link
Member

pylint complains a lot, and also rpm fails to build (%files not updated)

@DemiMarie DemiMarie requested a review from marmarek December 23, 2024 23:37
@DemiMarie
Copy link
Author

Tested and working on real hardware, in a real Xwayland session, using an RPM built in the Qubes executor from the same commit I just pushed.

qui/tray/gross_gtk3_bug_workaround.py Outdated Show resolved Hide resolved
qui/tray/gross_gtk3_bug_workaround.py Outdated Show resolved Hide resolved
Copy link
Author

@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.

Review comments addressed and all widgets tested.

qui/tray/gross_gtk3_bug_workaround.py Outdated Show resolved Hide resolved
qui/tray/gross_gtk3_bug_workaround.py Outdated Show resolved Hide resolved
@DemiMarie DemiMarie requested a review from marmarek December 24, 2024 09:42
qui/clipboard.py Outdated Show resolved Hide resolved
qui/tray/gross_gtk3_bug_workaround.py Outdated Show resolved Hide resolved
qui/tray/gross_gtk3_bug_workaround.py Outdated Show resolved Hide resolved
qui/tray/gross_gtk3_bug_workaround.py Outdated Show resolved Hide resolved
@DemiMarie
Copy link
Author

This includes #238 because without #238 I wouldn’t be able to do any testing.

This has two parts:

1. Set GDK_BACKEND=x11, so that GDK3 chooses to use X11 as its backend.
   This must be done while only one thread is running, as otherwise
   undefined behavior results.  It also must be done before
   gi.overrides.Gdk is imported, as otherwise it will be too late to set
   the GDK backend.  Therefore, this code is run very early, and
   RuntimeError is raised if the preconditions are violated.

2. Create a fullscreen invisible window for mouse input.  This works
   around Xwayland not passing all pointer input to X11.  The menu is
   dismissed if the user clicks on the fullscreen window.  This hack
   is only used if WAYLAND_DISPLAY is set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants