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

Double middle click on taskbar preview closes application #7871

Merged
2 commits merged into from
Oct 29, 2020
Merged

Double middle click on taskbar preview closes application #7871

2 commits merged into from
Oct 29, 2020

Conversation

rhorber
Copy link
Contributor

@rhorber rhorber commented Oct 9, 2020

Summary of the Pull Request

A second close command (middle click on taskbar preview) overrides the warning dialog and closes the application.

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

When a close command is invoked (middle click on taskbar preview or 'X' button), a new flag is set. When the user wants to close again (this time only via the taskbar preview, as the 'X' button is disabled), the application is closed. If the user cancels the dialog, the flag is reset to prevent accidental closing on a subsequent close command.

Validation Steps Performed

I am developing with a Windows 10 virtual machine provided by Microsoft. I tested manually. I considered the 'X' button, middle click on taskbar preview, and Alt+F4. Only a middle click on the taskbar preview does override the dialog.

When a close command is invoked (middle click on taskbar preview or
'X' button), new flag is set. When the user wants to close again
(this time only via the taskbar preview, as the 'X' button is
disabled), the application is closed. If the user cancels the dialog,
the flag is reset to prevent accidental closing on a subsequent
close command.
@ghost ghost added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. labels Oct 9, 2020
@rhorber
Copy link
Contributor Author

rhorber commented Oct 12, 2020

Let me know if my approach isn't state of the art.
Also, I don't know if and how my change led to the failing unit test.

@DHowett
Copy link
Member

DHowett commented Oct 12, 2020

This is clever, and I like the feature. Nothing bothers me more than when Vim doesn't exit because it wanted to ask if I was sure 😄. Thanks! You didn't cause the UT failure -- they can just be a bit flaky. We'll get on reviewing this tomorrow/tuesday 😄

@DHowett
Copy link
Member

DHowett commented Oct 12, 2020

If this is ready for the team to look at, make sure you unmark it as Draft! We usually don't look at drafts too quickly. (EDIT: I deleted the smiley because holy heck did I use a lot in the past 2 minutes.)

@rhorber rhorber marked this pull request as ready for review October 12, 2020 06:04
@rhorber
Copy link
Contributor Author

rhorber commented Oct 12, 2020

Failure: I'm glad.
Review: Yes, it's ready. I wasn't sure, when I should remove the mark 😀 (and thus rather leave it).

@zadjii-msft zadjii-msft self-assigned this Oct 12, 2020
Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

This is great. Couple thoughts:

  1. I think we should flip the sense of the boolean (_displayingCloseDialog instead of _isFirstClose)
  2. We need to eventually refactor (you definitely don't need to do it for this PR!) dialog display to be "awaitable", so we don't need to add an event handler to the close button.

That would make dialog display more like this:

_displayingCloseDialog = true;
co_await _ShowCloseDialog();
_displayingCloseDialog = false;

@rhorber
Copy link
Contributor Author

rhorber commented Oct 16, 2020

I had a shot at refactoring the dialog 😄. See commit.
As I branched from my feature branch, I did not create a PR because I'm not sure, which base I should choose (master branch as base would also include this PR).

@microsoft-github-updates microsoft-github-updates bot changed the base branch from master to main October 22, 2020 00:27
Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

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

Sorry for the delay - just checked this out locally, and I really like the way it feels. Thanks for doing this!

@zadjii-msft zadjii-msft removed their assignment Oct 29, 2020
@zadjii-msft zadjii-msft added the AutoMerge Marked for automatic merge by the bot when requirements are met label Oct 29, 2020
@ghost
Copy link

ghost commented Oct 29, 2020

Hello @zadjii-msft!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit d1e58bd into microsoft:main Oct 29, 2020
@rhorber
Copy link
Contributor Author

rhorber commented Oct 30, 2020

I'm happy I could help.

About refactoring the dialog: Is it okay that I create a PR directly (and mention this PR) or do you prefer that I first create an issue for it?

@zadjii-msft
Copy link
Member

Meh, if the code's already done, then just make the second PR and reference this one in it. No need to make an issue to say "Do the thing I've done in {PR}" 😆

@rhorber rhorber deleted the feature/issue-7451 branch October 30, 2020 21:05
DHowett pushed a commit that referenced this pull request Nov 3, 2020
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? -->
## Summary of the Pull Request
A second close command (middle click on taskbar preview) overrides the warning dialog and closes the application.

<!-- Other than the issue solved, is this relevant to any other issues/existing PRs? -->
## References

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist
* [x] Closes #7451
* [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA
* [ ] Tests added/passed
* [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx
* [ ] Schema updated.
* [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

<!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments
When a close command is invoked (middle click on taskbar preview or 'X' button), a new flag is set. When the user wants to close again (this time only via the taskbar preview, as the 'X' button is disabled), the application is closed. If the user cancels the dialog, the flag is reset to prevent accidental closing on a subsequent close command.

<!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
I am developing with a [Windows 10 virtual machine](https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/) provided by Microsoft. I tested manually. I considered the 'X' button, middle click on taskbar preview, and Alt+F4. Only a middle click on the taskbar preview does override the dialog.

(cherry picked from commit d1e58bd)
@ghost
Copy link

ghost commented Nov 11, 2020

🎉Windows Terminal v1.4.3141.0 has been released which incorporates this pull request.:tada:

Handy links:

@ghost
Copy link

ghost commented Nov 11, 2020

🎉Windows Terminal Preview v1.5.3142.0 has been released which incorporates this pull request.:tada:

Handy links:

ghost pushed a commit that referenced this pull request Nov 20, 2020
The CloseWarningDialog is now "awaitable"/async, as suggested in PR #7871.

As opening the dialog is async, the flag can be reset in the same
method. This way the flag operations occur in the same method.  The
event handlers of the buttons became obsolete and are removed.

## Validation Steps Performed
Tested manually.
mpela81 pushed a commit to mpela81/terminal that referenced this pull request Nov 22, 2020
The CloseWarningDialog is now "awaitable"/async, as suggested in PR microsoft#7871.

As opening the dialog is async, the flag can be reset in the same
method. This way the flag operations occur in the same method.  The
event handlers of the buttons became obsolete and are removed.

## Validation Steps Performed
Tested manually.
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal AutoMerge Marked for automatic merge by the bot when requirements are met hacktoberfest-accepted Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Double middle click on taskbar preview to close despite confirmation modal
3 participants