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

Bugfix - don't allow multiple dialogs for same tx in TransactionView #817

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

Conversation

pablomartin4btc
Copy link
Contributor

Limit to one the transaction details dialogs that a user can open.

Currently a user can open unlimited tx details dialogs for the same tx id.

Peek 2024-04-12 00-50

This PR fixes the issue.

Peek 2024-04-12 00-37

@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 12, 2024

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 hebasto
Stale ACK BrandonOdiwuor, alfonsoromanz

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

@DrahtBot
Copy link
Contributor

🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the
documentation.

Possibly this is due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.

Leave a comment here, if you need help tracking down a confusing failure.

Debug: https://github.com/bitcoin-core/gui/runs/23737775174

@flack
Copy link
Contributor

flack commented Apr 12, 2024

would be nice if a click on a row where the dialog is already open would bring that dialog to the foreground

@pablomartin4btc
Copy link
Contributor Author

would be nice if a click on a row where the dialog is already open would bring that dialog to the foreground

Great suggestion! I'll try that since I have to fix a lint. Thanks!

@pablomartin4btc pablomartin4btc force-pushed the gui-fix-tx-view-only-one-dialog-per-tx-id branch from dbbec32 to b26d2e8 Compare April 12, 2024 15:16
@pablomartin4btc
Copy link
Contributor Author

Updates:

  • Fixed lint failure.
  • Bring an already open dialog to the foreground as @flack suggested.

Copy link
Contributor

@alfonsoromanz alfonsoromanz left a comment

Choose a reason for hiding this comment

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

Tested ACK b26d2e8. Only one dialog is opened for a single tx.

src/qt/transactionview.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@BrandonOdiwuor BrandonOdiwuor left a comment

Choose a reason for hiding this comment

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

Tested ACK b26d2e8

Tested successfully on Ubuntu 22.04.4 LTS. Only one dialogue is created per transaction and the clicked transaction is brought to the foreground

Screencast.from.24-04-2024.03.35.10.ALASIRI.webm

@luke-jr
Copy link
Member

luke-jr commented May 7, 2024

Why?

@pablomartin4btc pablomartin4btc force-pushed the gui-fix-tx-view-only-one-dialog-per-tx-id branch from b26d2e8 to ba13f10 Compare May 10, 2024 22:38
@pablomartin4btc
Copy link
Contributor Author

Why?

Discussed a bit offline... Please feel free to add more context here and any concerns you have.

@pablomartin4btc
Copy link
Contributor Author

Updates:

Copy link
Contributor

@alfonsoromanz alfonsoromanz left a comment

Choose a reason for hiding this comment

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

Re ACK ba13f10. I tested in Mac and now the dialog is brought to the foreground

pr.mov

@hebasto
Copy link
Member

hebasto commented Jul 15, 2024

Currently a user can open unlimited tx details dialogs for the same tx id.

Concept ACK. Such a behavior can confuse the user.

@hebasto
Copy link
Member

hebasto commented Jul 15, 2024

Tested successfully on Ubuntu 22.04.4 LTS. Only one dialogue is created per transaction and the clicked transaction is brought to the foreground

Tested on Ubuntu 24.04. It works with QT_QPA_PLATFORM=xcb, but fails with QT_QPA_PLATFORM=wayland.

@pablomartin4btc
Copy link
Contributor Author

Tested on Ubuntu 24.04. It works with QT_QPA_PLATFORM=xcb, but fails with QT_QPA_PLATFORM=wayland.

I'll take a look, thanks!

@pablomartin4btc
Copy link
Contributor Author

@hebasto it seems there are some issues with Wayland on how these actions are being handled (this one specific to KDE but found some old ones in gnome).

As a workaround (tried other things as well), might be not elegant, but this works fine on both X11/Xorg and Wayland:

--- a/src/qt/transactionview.cpp
+++ b/src/qt/transactionview.cpp
@@ -671,8 +671,11 @@ bool TransactionView::detailsAlreadyShown(const QModelIndex &idx)
 {
     for (TransactionDescDialog* dlg : m_opened_dialogs) {
         if (dlg->getTransactionId() == idx.data(TransactionTableModel::TxHashRole).toString()) {
-            dlg->activateWindow();
-            dlg->raise();
+            auto eFlags = dlg->windowFlags();
+            dlg->setWindowFlags(eFlags|Qt::WindowStaysOnTopHint);
+            dlg->show();
+            dlg->setWindowFlags(eFlags);
+            dlg->show();
             return true;
         }
     }

I can update the code with that snippet above or we can do it on a follow-up.

@hebasto
Copy link
Member

hebasto commented Jul 29, 2024

@hebasto it seems there are some issues with Wayland on how these actions are being handled (this one specific to KDE but found some old ones in gnome).

As a workaround (tried other things as well), might be not elegant, but this works fine on both X11/Xorg and Wayland:

The approach you suggested works for me.

Here are other references to this workaround:

I can update the code with that snippet above or we can do it on a follow-up.

I think we should first fix our GUIUtil::bringToFront() first in a separate PR, which will also address similar issues in other cases.

Then we can apply the fixed GUIUtil::bringToFront() in this PR.

@pablomartin4btc
Copy link
Contributor Author

I think we should first fix our GUIUtil::bringToFront() first in a separate PR, which will also address similar issues in other cases.

Then we can apply the fixed GUIUtil::bringToFront() in this PR.

Ok, I'll open a new PR for GUIUtil::bringToFront() and will put this one on draft in the meantime.

@pablomartin4btc pablomartin4btc marked this pull request as draft July 30, 2024 18:49
@pablomartin4btc pablomartin4btc force-pushed the gui-fix-tx-view-only-one-dialog-per-tx-id branch from ba13f10 to 5aec5d2 Compare August 2, 2024 17:18
hebasto added a commit to bitcoin/bitcoin that referenced this pull request Aug 12, 2024
15aa7d0 gui, qt: brintToFront workaround for Wayland (pablomartin4btc)

Pull request description:

  There are known issues around handling windows focus in `Wayland` ([this one specific](https://bugs.kde.org/show_bug.cgi?id=462574) in KDE but also in [gnome](https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/730)).

  The idea is that the workaround will be executed if `bitcoin-qt` is running using `Wayland` platform (e.g.: `QT_QPA_PLATFORM=wayland ./src/qt/bitcoin-qt -regtest`), since the workaround behaviour looks like re-opening the window again (which I tried to fix by moving the window to the original position and/ or re-setting the original geometry without success) while in `X11` (not sure in Mac) the current `GUIUtil::brintToFront` actually sets the focus to the desired window, keeping its original position as expected, and I didn't want to change that (`X11` behaviour).

  The solution was [initially discussed](bitcoin-core/gui#817 (comment)) with hebasto in #817.

ACKs for top commit:
  hebasto:
    ACK 15aa7d0.

Tree-SHA512: 141d6cc4a618026e551627b9f4cc284285980db02a54a7b19c7de91e8c5adccf0c1d67380625146b5413e58c59f39c9e944ed5ba68cb8644f67647518918b6f7
@pablomartin4btc pablomartin4btc marked this pull request as ready for review August 15, 2024 15:41
Only one tx details dialog that a user can open per tx id is enough.
@pablomartin4btc pablomartin4btc force-pushed the gui-fix-tx-view-only-one-dialog-per-tx-id branch from 5aec5d2 to 0f77a6e Compare August 15, 2024 15:47
@pablomartin4btc
Copy link
Contributor Author

Updates:

  • No functional changes:
    • Using GUIUtil::bringToFront() that was recently fixed (and merged) for Wayland;
    • Removed unnecessary extra line in (src/qt/transactiondescdialog.h).

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.

8 participants