Fix bitcoin-qt visual glitches on Wayland #904

pull diegoviola wants to merge 1 commits into bitcoin-core:master from diegoviola:fix-qt-wayland-rendering-issue changing 1 files +1 −1
  1. diegoviola commented at 7:19 am on October 16, 2025: contributor

    The main window (BitcoinGUI) does not need to be passed to bringToFront(), doing so sets Qt::WindowStaysOnTopHint on the main window and causes it to flicker.

    Fixes #903.

  2. DrahtBot commented at 7:19 am on October 16, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK pablomartin4btc

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  3. hebasto renamed this:
    qt: fix Wayland visual glitches
    Fix Wayland visual glitches
    on Oct 16, 2025
  4. in src/qt/guiutil.cpp:413 in 4daf53b12e outdated
    406@@ -407,10 +407,6 @@ void bringToFront(QWidget* w)
    407 {
    408     if (w) {
    409         if (QGuiApplication::platformName() == "wayland") {
    410-            auto flags = w->windowFlags();
    411-            w->setWindowFlags(flags|Qt::WindowStaysOnTopHint);
    412-            w->show();
    413-            w->setWindowFlags(flags);
    


    hebasto commented at 11:09 am on October 16, 2025:

    This code was introduced in #831.

    cc @pablomartin4btc


    diegoviola commented at 11:38 am on October 16, 2025:

    @hebasto Thanks for letting me know. I managed to reproduce the artifacts/flicker with the original code on sway and labwc (wlroots-based compositors). In both cases, getting rid of the flags fixed the issue.

    I’ve not tested this on KWin and Mutter yet, I plan on doing that later today. Hopefully we can come up with a solution that works everywhere.

  5. in src/qt/guiutil.cpp:414 in 4daf53b12e
    406@@ -407,10 +407,6 @@ void bringToFront(QWidget* w)
    407 {
    408     if (w) {
    409         if (QGuiApplication::platformName() == "wayland") {
    410-            auto flags = w->windowFlags();
    411-            w->setWindowFlags(flags|Qt::WindowStaysOnTopHint);
    412-            w->show();
    413-            w->setWindowFlags(flags);
    414             w->show();
    


    hebasto commented at 12:37 pm on October 16, 2025:

    Is it necessary now to call w->show(); here?

    Would it be more clear to simply revert https://github.com/bitcoin-core/gui/commit/15aa7d023688700a47997b92108de95f2d864f5a?


    diegoviola commented at 12:47 pm on October 16, 2025:
    @hebasto Yeah, I think a revert would also do the trick.

    diegoviola commented at 12:57 pm on October 16, 2025:

    diegoviola commented at 1:16 pm on October 16, 2025:
    @hebasto Yeah, I can confirm that reverting https://github.com/bitcoin-core/gui/commit/15aa7d023688700a47997b92108de95f2d864f5a solves the problem for me (on sway).
  6. diegoviola force-pushed on Oct 16, 2025
  7. diegoviola force-pushed on Oct 16, 2025
  8. diegoviola requested review from hebasto on Oct 16, 2025
  9. diegoviola force-pushed on Oct 16, 2025
  10. pablomartin4btc commented at 4:25 pm on October 16, 2025: contributor

    Concept ACK

    If you can, please check how this behaves on #817.

  11. diegoviola force-pushed on Oct 18, 2025
  12. diegoviola force-pushed on Oct 18, 2025
  13. diegoviola requested review from pablomartin4btc on Oct 18, 2025
  14. diegoviola commented at 5:28 pm on October 18, 2025: contributor
    @pablomartin4btc can you please re-review?
  15. diegoviola force-pushed on Oct 18, 2025
  16. diegoviola force-pushed on Oct 18, 2025
  17. qt: don't pass BitcoinGUI to bringToFront()
    The main window (BitcoinGUI) does not need to be passed to
    bringToFront(), doing so sets Qt::WindowStaysOnTopHint on the main
    window and causes it to flicker.
    
    Fixes #903.
    095f920629
  18. diegoviola force-pushed on Oct 18, 2025
  19. diegoviola renamed this:
    Fix Wayland visual glitches
    Fix bitcoin-qt visual glitches on Wayland
    on Oct 19, 2025
  20. pablomartin4btc commented at 7:26 am on October 24, 2025: contributor

    tested 095f920629207b5ec4c50de7b454dfced0eafefb and it fixes the problem.

    I still need to check if this is the right approach, need to check against xcb and macOS. Also there are other places where bringToFront is being used, the rpcconsole has the same issue as the main window in wayland, so perhaps the fix has to be within bringToFront, need more time to test. Thanks for finding the issue and taking a look at this!

  21. diegoviola commented at 4:31 pm on October 24, 2025: contributor

    tested 095f920 and it fixes the problem.

    Great! Thanks for confirming that.

    I still need to check if this is the right approach, need to check against xcb and macOS.

    Sure.

    Also there are other places where bringToFront is being used, the rpcconsole has the same issue as the main window in wayland, so perhaps the fix has to be within bringToFront, need more time to test.

    I am not able to reproduce the flickering with the rpcconsole specifically, but in a previous testing that I did removing these two lines helped with getting rid of some flickering, not all: https://github.com/bitcoin/bitcoin/blob/v30.0/src/qt/guiutil.cpp#L413-L414.

    Can you please test if removing those help with the rpcconsole?

    Thanks for finding the issue and taking a look at this!

    You’re welcome, thank you for your work as well.

  22. hebasto commented at 12:30 pm on November 21, 2025: member

    Tested 095f920629207b5ec4c50de7b454dfced0eafefb, it breaks UX.

    For example, on Fedora 43 with Gnome 49 and Wayland, follow these steps:

    1. Run bitcoin-qt.
    2. Hide the main window using the “Hide” command in context menu.
    3. Click on “Receive” in the system tray icon menu.

    On the master branch, the main window reappears.

    With this PR, however, the main window remains hidden.

  23. hebasto commented at 12:47 pm on November 21, 2025: member

    From #904 (review):

    Would it be more clear to simply revert 15aa7d0?

    Done in #914.

  24. diegoviola commented at 1:31 pm on November 21, 2025: contributor
    Closing in favor of #904.
  25. diegoviola closed this on Nov 21, 2025

  26. diegoviola commented at 3:12 pm on November 21, 2025: contributor

    For example, on Fedora 43 with Gnome 49 and Wayland

    Ah, I haven’t tested this on GNOME. I suspect the use of showNormal() likely helps with the desired window behavior, which is why the revert works better.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/gui. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-11-27 22:20 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me