Closed phlpsong closed 6 months ago
After this PR https://github.com/tisfeng/Easydict/pull/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;
}
You are right. It's a better approach.
@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.
Looks good.
I have left some comments and would appreciate it if you could clarify them.
close https://github.com/tisfeng/Easydict/issues/471