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

Main window cannot open after escape key pressed #472

Merged
merged 16 commits into from
Apr 1, 2024

Conversation

phlpsong
Copy link
Collaborator

close #471

@tisfeng
Copy link
Owner

tisfeng commented Mar 27, 2024

After this PR #448 , we now no longer need to destroy the main window in most cases, such as by clicking the close button in the upper left corner, or the escape key.

To simplify the logic, I think we can remove the closeFloatingWindowExceptMain method and use the closeFloatingWindow method, just like fixedWindow, and change the main window to not release when closed: mainWindow.releasedWhenClosed = NO.

I simply tested it and it works.

- (EZFixedQueryWindow *)fixedWindow {
    if (!_fixedWindow) {
        _fixedWindow = [EZFixedQueryWindow shared];
        _fixedWindow.releasedWhenClosed = NO;
    }
    return _fixedWindow;
}

@phlpsong
Copy link
Collaborator Author

You are right. It's a better approach.

@tisfeng
Copy link
Owner

tisfeng commented Mar 29, 2024

@phlpsong Sorry, I didn't consider it thoroughly before. In some cases, it is not necessary to close the main window, such as when the main window loses focus or when opening App links.

I have improved the code by adding closeFloatingWindowIfNotPinned and closeFloatingWindowIfNotPinnedOrMain methods to handle different situations.

The specific usage here is a bit complex, please test the effect of the code carefully.

@phlpsong
Copy link
Collaborator Author

Looks good.

I have left some comments and would appreciate it if you could clarify them.

@tisfeng tisfeng merged commit 4701225 into tisfeng:dev Apr 1, 2024
5 checks passed
@phlpsong phlpsong deleted the main-window-close-issue branch April 2, 2024 02:57
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.

4 participants